patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] test/event_crypto: fix event crypto metadata write
       [not found] <2c543df71bc79ff363c1aa501e0bf5a88cb448a7.1632731708.git.sthotton@marvell.com>
@ 2021-09-27 15:29 ` Shijith Thotton
  2021-10-03  9:46   ` Gujjar, Abhinandan S
  0 siblings, 1 reply; 3+ messages in thread
From: Shijith Thotton @ 2021-09-27 15:29 UTC (permalink / raw)
  To: dev; +Cc: stable, Shijith Thotton, jerinj, anoobj, Abhinandan Gujjar

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] test/event_crypto: fix event crypto metadata write
  2021-09-27 15:29 ` [dpdk-stable] [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
  0 siblings, 1 reply; 3+ messages in thread
From: Gujjar, Abhinandan S @ 2021-10-03  9:46 UTC (permalink / raw)
  To: Shijith Thotton, dev; +Cc: stable, jerinj, anoobj

Acked-by: Abhinandan Gujjar <Abhinandan.gujjar@intel.com>

> -----Original Message-----
> From: Shijith Thotton <sthotton@marvell.com>
> Sent: Monday, September 27, 2021 8:59 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Shijith Thotton <sthotton@marvell.com>;
> jerinj@marvell.com; anoobj@marvell.com; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>
> Subject: [PATCH] test/event_crypto: fix event crypto metadata write
> 
> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] test/event_crypto: fix event crypto metadata write
  2021-10-03  9:46   ` Gujjar, Abhinandan S
@ 2021-10-05 15:15     ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2021-10-05 15:15 UTC (permalink / raw)
  To: Gujjar, Abhinandan S, Shijith Thotton, dev
  Cc: stable, Jerin Jacob Kollanukkaran, Anoob Joseph

> Acked-by: Abhinandan Gujjar <Abhinandan.gujjar@intel.com>
> 
Applied to dpdk-next-crypto

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-05 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2c543df71bc79ff363c1aa501e0bf5a88cb448a7.1632731708.git.sthotton@marvell.com>
2021-09-27 15:29 ` [dpdk-stable] [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

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git