DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shijith Thotton <sthotton@marvell.com>
To: <dev@dpdk.org>
Cc: Shijith Thotton <sthotton@marvell.com>,
	<abhinandan.gujjar@intel.com>, <jerinj@marvell.com>,
	<gakhil@marvell.com>, <anoobj@marvell.com>, <thomas@monjalon.net>,
	<mdr@ashroe.eu>, Ankur Dwivedi <adwivedi@marvell.com>,
	Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [dpdk-dev] [RFC] eventdev: update crypto adapter metadata structures
Date: Thu, 5 Aug 2021 08:23:34 +0530	[thread overview]
Message-ID: <1b4287b763777a5b0a612ede4a5b70cf9cc98de5.1628131909.git.sthotton@marvell.com> (raw)
In-Reply-To: <27596654d574825a71b4f422584194ebd8da6116.1628100722.git.sthotton@marvell.com>

In crypto adapter metadata, reserved bytes in request info structure is
a space holder for response info. It enforces an order of operation if
the structures are updated using memcpy to avoid overwriting response
info. It is logical to move the reserved space out of request info. It
also solves the ordering issue mentioned above.

This patch removes the reserve field from request info and makes event
crypto metadata type to structure from union to make space for response
info.

App and drivers are updated as per metadata change.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 app/test/test_event_crypto_adapter.c              | 10 +++++-----
 drivers/crypto/octeontx/otx_cryptodev_ops.c       |  8 ++++----
 drivers/crypto/octeontx2/otx2_cryptodev_ops.c     |  4 ++--
 .../event/octeontx2/otx2_evdev_crypto_adptr_tx.h  |  4 ++--
 lib/eventdev/rte_event_crypto_adapter.c           |  8 ++++----
 lib/eventdev/rte_event_crypto_adapter.h           | 15 +++++----------
 6 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 3ad20921e2..8344719186 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -168,7 +168,7 @@ test_op_forward_mode(uint8_t session_less)
 {
 	struct rte_crypto_sym_xform cipher_xform;
 	struct rte_cryptodev_sym_session *sess;
-	union rte_event_crypto_metadata m_data;
+	struct rte_event_crypto_metadata m_data;
 	struct rte_crypto_sym_op *sym_op;
 	struct rte_crypto_op *op;
 	struct rte_mbuf *m;
@@ -368,7 +368,7 @@ test_op_new_mode(uint8_t session_less)
 {
 	struct rte_crypto_sym_xform cipher_xform;
 	struct rte_cryptodev_sym_session *sess;
-	union rte_event_crypto_metadata m_data;
+	struct rte_event_crypto_metadata m_data;
 	struct rte_crypto_sym_op *sym_op;
 	struct rte_crypto_op *op;
 	struct rte_mbuf *m;
@@ -519,7 +519,7 @@ configure_cryptodev(void)
 			DEFAULT_NUM_XFORMS *
 			sizeof(struct rte_crypto_sym_xform) +
 			MAXIMUM_IV_LENGTH +
-			sizeof(union rte_event_crypto_metadata),
+			sizeof(struct rte_event_crypto_metadata),
 			rte_socket_id());
 	if (params.op_mpool == NULL) {
 		RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
@@ -549,12 +549,12 @@ configure_cryptodev(void)
 	 * to include the session headers & private data
 	 */
 	session_size = rte_cryptodev_sym_get_private_session_size(TEST_CDEV_ID);
-	session_size += sizeof(union rte_event_crypto_metadata);
+	session_size += sizeof(struct rte_event_crypto_metadata);
 
 	params.session_mpool = rte_cryptodev_sym_session_pool_create(
 			"CRYPTO_ADAPTER_SESSION_MP",
 			MAX_NB_SESSIONS, 0, 0,
-			sizeof(union rte_event_crypto_metadata),
+			sizeof(struct rte_event_crypto_metadata),
 			SOCKET_ID_ANY);
 	TEST_ASSERT_NOT_NULL(params.session_mpool,
 			"session mempool allocation failed\n");
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index eac6796cfb..c51be63146 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -710,17 +710,17 @@ submit_request_to_sso(struct ssows *ws, uintptr_t req,
 	ssovf_store_pair(add_work, req, ws->grps[rsp_info->queue_id]);
 }
 
-static inline union rte_event_crypto_metadata *
+static inline struct rte_event_crypto_metadata *
 get_event_crypto_mdata(struct rte_crypto_op *op)
 {
-	union rte_event_crypto_metadata *ec_mdata;
+	struct rte_event_crypto_metadata *ec_mdata;
 
 	if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
 		ec_mdata = rte_cryptodev_sym_session_get_user_data(
 							   op->sym->session);
 	else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS &&
 		 op->private_data_offset)
-		ec_mdata = (union rte_event_crypto_metadata *)
+		ec_mdata = (struct rte_event_crypto_metadata *)
 			((uint8_t *)op + op->private_data_offset);
 	else
 		return NULL;
@@ -731,7 +731,7 @@ get_event_crypto_mdata(struct rte_crypto_op *op)
 uint16_t __rte_hot
 otx_crypto_adapter_enqueue(void *port, struct rte_crypto_op *op)
 {
-	union rte_event_crypto_metadata *ec_mdata;
+	struct rte_event_crypto_metadata *ec_mdata;
 	struct cpt_instance *instance;
 	struct cpt_request_info *req;
 	struct rte_event *rsp_info;
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index 42100154cd..952d1352f4 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -453,7 +453,7 @@ otx2_ca_enqueue_req(const struct otx2_cpt_qp *qp,
 		    struct rte_crypto_op *op,
 		    uint64_t cpt_inst_w7)
 {
-	union rte_event_crypto_metadata *m_data;
+	struct rte_event_crypto_metadata *m_data;
 	union cpt_inst_s inst;
 	uint64_t lmt_status;
 
@@ -468,7 +468,7 @@ otx2_ca_enqueue_req(const struct otx2_cpt_qp *qp,
 		}
 	} else if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS &&
 		   op->private_data_offset) {
-		m_data = (union rte_event_crypto_metadata *)
+		m_data = (struct rte_event_crypto_metadata *)
 			 ((uint8_t *)op +
 			  op->private_data_offset);
 	} else {
diff --git a/drivers/event/octeontx2/otx2_evdev_crypto_adptr_tx.h b/drivers/event/octeontx2/otx2_evdev_crypto_adptr_tx.h
index ecf7eb9f56..458e8306d7 100644
--- a/drivers/event/octeontx2/otx2_evdev_crypto_adptr_tx.h
+++ b/drivers/event/octeontx2/otx2_evdev_crypto_adptr_tx.h
@@ -16,7 +16,7 @@
 static inline uint16_t
 otx2_ca_enq(uintptr_t tag_op, const struct rte_event *ev)
 {
-	union rte_event_crypto_metadata *m_data;
+	struct rte_event_crypto_metadata *m_data;
 	struct rte_crypto_op *crypto_op;
 	struct rte_cryptodev *cdev;
 	struct otx2_cpt_qp *qp;
@@ -37,7 +37,7 @@ otx2_ca_enq(uintptr_t tag_op, const struct rte_event *ev)
 		qp_id = m_data->request_info.queue_pair_id;
 	} else if (crypto_op->sess_type == RTE_CRYPTO_OP_SESSIONLESS &&
 		   crypto_op->private_data_offset) {
-		m_data = (union rte_event_crypto_metadata *)
+		m_data = (struct rte_event_crypto_metadata *)
 			 ((uint8_t *)crypto_op +
 			  crypto_op->private_data_offset);
 		cdev_id = m_data->request_info.cdev_id;
diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c
index e1d38d383d..6977391ae9 100644
--- a/lib/eventdev/rte_event_crypto_adapter.c
+++ b/lib/eventdev/rte_event_crypto_adapter.c
@@ -333,7 +333,7 @@ eca_enq_to_cryptodev(struct rte_event_crypto_adapter *adapter,
 		 struct rte_event *ev, unsigned int cnt)
 {
 	struct rte_event_crypto_adapter_stats *stats = &adapter->crypto_stats;
-	union rte_event_crypto_metadata *m_data = NULL;
+	struct rte_event_crypto_metadata *m_data = NULL;
 	struct crypto_queue_pair_info *qp_info = NULL;
 	struct rte_crypto_op *crypto_op;
 	unsigned int i, n;
@@ -371,7 +371,7 @@ eca_enq_to_cryptodev(struct rte_event_crypto_adapter *adapter,
 			len++;
 		} else if (crypto_op->sess_type == RTE_CRYPTO_OP_SESSIONLESS &&
 				crypto_op->private_data_offset) {
-			m_data = (union rte_event_crypto_metadata *)
+			m_data = (struct rte_event_crypto_metadata *)
 				 ((uint8_t *)crypto_op +
 					crypto_op->private_data_offset);
 			cdev_id = m_data->request_info.cdev_id;
@@ -504,7 +504,7 @@ eca_ops_enqueue_burst(struct rte_event_crypto_adapter *adapter,
 		  struct rte_crypto_op **ops, uint16_t num)
 {
 	struct rte_event_crypto_adapter_stats *stats = &adapter->crypto_stats;
-	union rte_event_crypto_metadata *m_data = NULL;
+	struct rte_event_crypto_metadata *m_data = NULL;
 	uint8_t event_dev_id = adapter->eventdev_id;
 	uint8_t event_port_id = adapter->event_port_id;
 	struct rte_event events[BATCH_SIZE];
@@ -523,7 +523,7 @@ eca_ops_enqueue_burst(struct rte_event_crypto_adapter *adapter,
 					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 *)
+			m_data = (struct rte_event_crypto_metadata *)
 				 ((uint8_t *)ops[i] +
 				  ops[i]->private_data_offset);
 		}
diff --git a/lib/eventdev/rte_event_crypto_adapter.h b/lib/eventdev/rte_event_crypto_adapter.h
index f8c6cca87c..3c24d9d9df 100644
--- a/lib/eventdev/rte_event_crypto_adapter.h
+++ b/lib/eventdev/rte_event_crypto_adapter.h
@@ -200,11 +200,6 @@ enum rte_event_crypto_adapter_mode {
  * provide event request information to the adapter.
  */
 struct rte_event_crypto_request {
-	uint8_t resv[8];
-	/**< Overlaps with first 8 bytes of struct rte_event
-	 * that encode the response event information. Application
-	 * is expected to fill in struct rte_event response_info.
-	 */
 	uint16_t cdev_id;
 	/**< cryptodev ID to be used */
 	uint16_t queue_pair_id;
@@ -223,16 +218,16 @@ struct rte_event_crypto_request {
  * operation. If the transfer is done by SW, event response information
  * will be used by the adapter.
  */
-union rte_event_crypto_metadata {
-	struct rte_event_crypto_request request_info;
-	/**< Request information to be filled in by application
-	 * for RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode.
-	 */
+struct rte_event_crypto_metadata {
 	struct rte_event response_info;
 	/**< Response information to be filled in by application
 	 * for RTE_EVENT_CRYPTO_ADAPTER_OP_NEW and
 	 * RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode.
 	 */
+	struct rte_event_crypto_request request_info;
+	/**< Request information to be filled in by application
+	 * for RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode.
+	 */
 };
 
 /**
-- 
2.25.1


  parent reply	other threads:[~2021-08-05  2:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 18:14 [dpdk-dev] [PATCH] doc: announce change in crypto adapter metadata Shijith Thotton
2021-08-04 18:17 ` Akhil Goyal
2021-08-05 10:12   ` Kinsella, Ray
2021-08-05 10:21     ` Jerin Jacob
2021-08-07 15:10       ` Thomas Monjalon
2021-08-05  2:53 ` Shijith Thotton [this message]
2021-08-30 19:44   ` [dpdk-dev] [PATCH] eventdev: update crypto adapter metadata structures Shijith Thotton
2021-08-30 19:59     ` [dpdk-dev] [PATCH v2] " Shijith Thotton
2021-08-31  4:00       ` Anoob Joseph
2021-08-31  6:08       ` Akhil Goyal
2021-08-31  6:51         ` Shijith Thotton
2021-08-31  7:56       ` [dpdk-dev] [PATCH v3] " Shijith Thotton
2021-09-07  8:34         ` Jerin Jacob
2021-09-07  8:37           ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-07  8:53         ` [dpdk-dev] " Gujjar, Abhinandan S
2021-09-07 10:37           ` Shijith Thotton
2021-09-07 17:30             ` Gujjar, Abhinandan S
2021-09-08  7:42               ` Shijith Thotton
2021-09-08  7:53                 ` Gujjar, Abhinandan S
2021-09-14  4:36                   ` Shijith Thotton
2021-09-14  4:46                     ` Anoob Joseph
2021-09-19 14:25                       ` Gujjar, Abhinandan S
2021-09-19 18:49                         ` Akhil Goyal
2021-09-20  5:54                           ` Gujjar, Abhinandan S
2021-09-27 15:22         ` [dpdk-dev] [PATCH v4] doc: remove event crypto metadata deprecation note Shijith Thotton
2021-09-27 15:29           ` [dpdk-dev] [PATCH] test/event_crypto: fix event crypto metadata write Shijith Thotton
2021-10-03  9:46             ` Gujjar, Abhinandan S
2021-10-05 15:15               ` Akhil Goyal
2021-10-03  9:48           ` [dpdk-dev] [PATCH v4] doc: remove event crypto metadata deprecation note Gujjar, Abhinandan S
2021-10-05 14:49             ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b4287b763777a5b0a612ede4a5b70cf9cc98de5.1628131909.git.sthotton@marvell.com \
    --to=sthotton@marvell.com \
    --cc=abhinandan.gujjar@intel.com \
    --cc=adwivedi@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=mdr@ashroe.eu \
    --cc=pbhagavatula@marvell.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).