DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shijith Thotton <sthotton@marvell.com>
To: <dev@dpdk.org>
Cc: <stable@dpdk.org>, Shijith Thotton <sthotton@marvell.com>,
	<jerinj@marvell.com>, <anoobj@marvell.com>,
	Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Subject: [dpdk-dev] [PATCH] test/event_crypto: fix event crypto metadata write
Date: Mon, 27 Sep 2021 20:59:13 +0530	[thread overview]
Message-ID: <fe10a92bf84637cfbc1d207b9e16657148220f1c.1632756287.git.sthotton@marvell.com> (raw)
In-Reply-To: <2c543df71bc79ff363c1aa501e0bf5a88cb448a7.1632731708.git.sthotton@marvell.com>

Using memcpy to update event crypto metadata fields (request/response)
will result in one overwriting the other. To avoid this, fields of each
structure should be updated one by one.

Fixes: 3c2c535ecfc0 ("test: add event crypto adapter auto-test")

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 app/test/test_event_crypto_adapter.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c
index 279aa3abf5..3d7e9fb93c 100644
--- a/app/test/test_event_crypto_adapter.c
+++ b/app/test/test_event_crypto_adapter.c
@@ -212,10 +212,10 @@ test_op_forward_mode(uint8_t session_less)
 
 		if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA) {
 			/* Fill in private user data information */
-			rte_memcpy(&m_data.response_info, &response_info,
-				sizeof(response_info));
-			rte_memcpy(&m_data.request_info, &request_info,
-				sizeof(request_info));
+			m_data.request_info.cdev_id = request_info.cdev_id;
+			m_data.request_info.queue_pair_id =
+				request_info.queue_pair_id;
+			m_data.response_info.event = response_info.event;
 			rte_cryptodev_sym_session_set_user_data(sess,
 						&m_data, sizeof(m_data));
 		}
@@ -231,10 +231,9 @@ test_op_forward_mode(uint8_t session_less)
 		uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH;
 		op->private_data_offset = len;
 		/* Fill in private data information */
-		rte_memcpy(&m_data.response_info, &response_info,
-			   sizeof(response_info));
-		rte_memcpy(&m_data.request_info, &request_info,
-			   sizeof(request_info));
+		m_data.request_info.cdev_id = request_info.cdev_id;
+		m_data.request_info.queue_pair_id = request_info.queue_pair_id;
+		m_data.response_info.event = response_info.event;
 		rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data));
 	}
 
@@ -405,8 +404,7 @@ test_op_new_mode(uint8_t session_less)
 
 		if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA) {
 			/* Fill in private user data information */
-			rte_memcpy(&m_data.response_info, &response_info,
-				   sizeof(m_data));
+			m_data.response_info.event = response_info.event;
 			rte_cryptodev_sym_session_set_user_data(sess,
 						&m_data, sizeof(m_data));
 		}
@@ -425,8 +423,7 @@ test_op_new_mode(uint8_t session_less)
 		uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH;
 		op->private_data_offset = len;
 		/* Fill in private data information */
-		rte_memcpy(&m_data.response_info, &response_info,
-			   sizeof(m_data));
+		m_data.response_info.event = response_info.event;
 		rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data));
 	}
 
-- 
2.25.1


  reply	other threads:[~2021-09-27 15:31 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 ` [dpdk-dev] [RFC] eventdev: update crypto adapter metadata structures Shijith Thotton
2021-08-30 19:44   ` [dpdk-dev] [PATCH] " 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           ` Shijith Thotton [this message]
2021-10-03  9:46             ` [dpdk-dev] [PATCH] test/event_crypto: fix event crypto metadata write 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=fe10a92bf84637cfbc1d207b9e16657148220f1c.1632756287.git.sthotton@marvell.com \
    --to=sthotton@marvell.com \
    --cc=abhinandan.gujjar@intel.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=stable@dpdk.org \
    /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).