[1/2] app/test-crypto-perf: fix copy segment size calculation

Message ID 20240103040024.720600-2-suanmingm@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series app/test-crypto-perf: fix multi-segment issue |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Suanming Mou Jan. 3, 2024, 4 a.m. UTC
  For the case crypto device requires headroom and tailroom,
the segment_sz in options also contains the headroom_sz
and tailroom_sz, but mbuf's data_len is user's segment_sz
without headroom_sz and tailroom_sz. That means the data
size to be copied should use user's segment_sz instead
of options->segment_sz.

This commit fixes the copy segment size calculation.

Fixes: 14864c4217ce ("test/crypto-perf: populate mbuf in latency test")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
---
 app/test-crypto-perf/cperf_test_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Suanming Mou Feb. 1, 2024, 1:16 p.m. UTC | #1
Hi,

I saw other crypto perf fixes are reviewed, any chance to take a look at this series?

> -----Original Message-----
> From: Suanming Mou <suanmingm@nvidia.com>
> Sent: Wednesday, January 3, 2024 12:00 PM
> To: ciara.power@intel.com
> Cc: dev@dpdk.org
> Subject: [PATCH 1/2] app/test-crypto-perf: fix copy segment size calculation
> 
> For the case crypto device requires headroom and tailroom, the segment_sz in
> options also contains the headroom_sz and tailroom_sz, but mbuf's data_len is
> user's segment_sz without headroom_sz and tailroom_sz. That means the data
> size to be copied should use user's segment_sz instead of options->segment_sz.
> 
> This commit fixes the copy segment size calculation.
> 
> Fixes: 14864c4217ce ("test/crypto-perf: populate mbuf in latency test")
> 
> Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
> ---
>  app/test-crypto-perf/cperf_test_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-
> perf/cperf_test_common.c
> index ad2076dd2e..8faf832527 100644
> --- a/app/test-crypto-perf/cperf_test_common.c
> +++ b/app/test-crypto-perf/cperf_test_common.c
> @@ -271,7 +271,7 @@ cperf_mbuf_set(struct rte_mbuf *mbuf,
>  		const struct cperf_options *options,
>  		const struct cperf_test_vector *test_vector)  {
> -	uint32_t segment_sz = options->segment_sz;
> +	uint32_t segment_sz = options->segment_sz - options->headroom_sz -
> +options->tailroom_sz;
>  	uint8_t *mbuf_data;
>  	uint8_t *test_data;
>  	uint32_t remaining_bytes = options->max_buffer_size;
> --
> 2.34.1
  

Patch

diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c
index ad2076dd2e..8faf832527 100644
--- a/app/test-crypto-perf/cperf_test_common.c
+++ b/app/test-crypto-perf/cperf_test_common.c
@@ -271,7 +271,7 @@  cperf_mbuf_set(struct rte_mbuf *mbuf,
 		const struct cperf_options *options,
 		const struct cperf_test_vector *test_vector)
 {
-	uint32_t segment_sz = options->segment_sz;
+	uint32_t segment_sz = options->segment_sz - options->headroom_sz - options->tailroom_sz;
 	uint8_t *mbuf_data;
 	uint8_t *test_data;
 	uint32_t remaining_bytes = options->max_buffer_size;