diff mbox series

[v5,5/7] eventdev: use new API to get event crypto metadata

Message ID 20220512124527.2031321-6-gakhil@marvell.com (mailing list archive)
State Accepted
Delegated to: akhil goyal
Headers show
Series Add new cryptodev op for event metadata | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Akhil Goyal May 12, 2022, 12:45 p.m. UTC
For getting event crypto metadata from crypto_op,
the new API rte_cryptodev_get_session_event_mdata is used
instead of getting userdata inside PMD.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Abhinandan Gujjar <Abhinandan.gujjar@intel.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
---
 lib/eventdev/rte_event_crypto_adapter.c | 55 ++++++-------------------
 1 file changed, 12 insertions(+), 43 deletions(-)
diff mbox series

Patch

diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index f624f50187..7c695176f4 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -457,43 +457,22 @@  eca_enq_to_cryptodev(struct event_crypto_adapter *adapter, struct rte_event *ev,
 		crypto_op = ev[i].event_ptr;
 		if (crypto_op == NULL)
 			continue;
-		if (crypto_op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
-			m_data = rte_cryptodev_sym_session_get_user_data(
-					crypto_op->sym->session);
-			if (m_data == NULL) {
-				rte_pktmbuf_free(crypto_op->sym->m_src);
-				rte_crypto_op_free(crypto_op);
-				continue;
-			}
+		m_data = rte_cryptodev_session_event_mdata_get(crypto_op);
+		if (m_data == NULL) {
+			rte_pktmbuf_free(crypto_op->sym->m_src);
+			rte_crypto_op_free(crypto_op);
+			continue;
+		}
 
-			cdev_id = m_data->request_info.cdev_id;
-			qp_id = m_data->request_info.queue_pair_id;
-			qp_info = &adapter->cdevs[cdev_id].qpairs[qp_id];
-			if (!qp_info->qp_enabled) {
-				rte_pktmbuf_free(crypto_op->sym->m_src);
-				rte_crypto_op_free(crypto_op);
-				continue;
-			}
-			eca_circular_buffer_add(&qp_info->cbuf, crypto_op);
-		} else if (crypto_op->sess_type == RTE_CRYPTO_OP_SESSIONLESS &&
-				crypto_op->private_data_offset) {
-			m_data = (union rte_event_crypto_metadata *)
-				 ((uint8_t *)crypto_op +
-					crypto_op->private_data_offset);
-			cdev_id = m_data->request_info.cdev_id;
-			qp_id = m_data->request_info.queue_pair_id;
-			qp_info = &adapter->cdevs[cdev_id].qpairs[qp_id];
-			if (!qp_info->qp_enabled) {
-				rte_pktmbuf_free(crypto_op->sym->m_src);
-				rte_crypto_op_free(crypto_op);
-				continue;
-			}
-			eca_circular_buffer_add(&qp_info->cbuf, crypto_op);
-		} else {
+		cdev_id = m_data->request_info.cdev_id;
+		qp_id = m_data->request_info.queue_pair_id;
+		qp_info = &adapter->cdevs[cdev_id].qpairs[qp_id];
+		if (!qp_info->qp_enabled) {
 			rte_pktmbuf_free(crypto_op->sym->m_src);
 			rte_crypto_op_free(crypto_op);
 			continue;
 		}
+		eca_circular_buffer_add(&qp_info->cbuf, crypto_op);
 
 		if (eca_circular_buffer_batch_ready(&qp_info->cbuf)) {
 			ret = eca_circular_buffer_flush_to_cdev(&qp_info->cbuf,
@@ -636,17 +615,7 @@  eca_ops_enqueue_burst(struct event_crypto_adapter *adapter,
 	for (i = 0; i < num; i++) {
 		struct rte_event *ev = &events[nb_ev++];
 
-		m_data = NULL;
-		if (ops[i]->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
-			m_data = rte_cryptodev_sym_session_get_user_data(
-					ops[i]->sym->session);
-		} else if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS &&
-				ops[i]->private_data_offset) {
-			m_data = (union rte_event_crypto_metadata *)
-				 ((uint8_t *)ops[i] +
-				  ops[i]->private_data_offset);
-		}
-
+		m_data = rte_cryptodev_session_event_mdata_get(ops[i]);
 		if (unlikely(m_data == NULL)) {
 			rte_pktmbuf_free(ops[i]->sym->m_src);
 			rte_crypto_op_free(ops[i]);