Skip to contentSkip to conversation

test/bbdev: changes for 23.03

PATCH Superseded Hernan Vargas 3 participants 41 messages Jan 17, 2023 – Feb 23, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover test/bbdev: changes for 23.03

Upstreaming bbdev-test changes for 23.03.

Hernan Vargas (13):
test/bbdev: fix seg fault for non supported HARQ len test/bbdev: refactor TB throughput report test/bbdev: add timeout for latency tests test/bbdev: early termination not explicit set test/bbdev: report device status in bbdev-test test/bbdev: log capture from queue stop test/bbdev: add support for BLER for 4G test/bbdev: extend support for large TB test/bbdev: bbdev-test cannot compare some scenarios test/bbdev: adjustment for soft output test/bbdev: expose warning counters test/bbdev: remove check for invalid opaque data test/bbdev: remove iteration count check

 app/test-bbdev/test_bbdev_perf.c | 319 +++++++++++++++++++++++++------
 1 file changed, 265 insertions(+), 54 deletions(-)
Signature · 1 line
2.37.1
#1 lore raw

PATCH 1/13 test/bbdev: fix seg fault for non supported HARQ len

Catching a corner in bbdev-test (not in the actual PMD) when running some specific vectors which size are not supported by the PMD.

Fixes 335c11fd276 ("app/bbdev: support HARQ validation")
---
 app/test-bbdev/test_bbdev_perf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
app/test-bbdev/test_bbdev_perf.c +3 -3
index 3818b74c79..cc7b5481d6 100644
@@ -84,7 +84,7 @@
 /* Increment for next code block in external HARQ memory */
 #define HARQ_INCR 32768
 /* Headroom for filler LLRs insertion in HARQ buffer */
-#define FILLER_HEADROOM 1024
+#define FILLER_HEADROOM 2048
 /* Constants from K0 computation from 3GPP 38.212 Table 5.4.2.1-2 */
 #define N_ZC_1 66 /* N = 66 Zc for BG 1 */
 #define N_ZC_2 50 /* N = 50 Zc for BG 2 */
@@ -2111,9 +2111,9 @@ validate_op_harq_chain(struct rte_bbdev_op_data *op,
 					ops_ld->n_filler;
 			if (data_len > deRmOutSize)
 				data_len = deRmOutSize;
-			if (data_len > orig_op->segments[i].length)
-				data_len = orig_op->segments[i].length;
 		}
+		if (data_len > orig_op->segments[i].length)
+			data_len = orig_op->segments[i].length;
 		/*
 		 * HARQ output can have minor differences
 		 * due to integer representation and related scaling
Signature · 1 line
2.37.1
#2 lore raw

Re: [PATCH v1 01/13] test/bbdev: fix seg fault for non supported HARQ len

Hi Hernan,

Quoted 2 lines · Hernan Vargas

Catching a corner in bbdev-test (not in the actual PMD) when running some specific vectors which size are not supported by the PMD.

Could you please reword the commit message, the title is clearer than the commit message itself.

Also, the app name is test-bbdev.

Quoted 34 lines
Fixes 335c11fd276 ("app/bbdev: support HARQ validation")
---
  app/test-bbdev/test_bbdev_perf.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
app/test-bbdev/test_bbdev_perf.c +3 -3
index 3818b74c79..cc7b5481d6 100644
@@ -84,7 +84,7 @@
  /* Increment for next code block in external HARQ memory */
  #define HARQ_INCR 32768
  /* Headroom for filler LLRs insertion in HARQ buffer */
-#define FILLER_HEADROOM 1024
+#define FILLER_HEADROOM 2048
  /* Constants from K0 computation from 3GPP 38.212 Table 5.4.2.1-2 */
  #define N_ZC_1 66 /* N = 66 Zc for BG 1 */
  #define N_ZC_2 50 /* N = 50 Zc for BG 2 */
@@ -2111,9 +2111,9 @@ validate_op_harq_chain(struct rte_bbdev_op_data *op,
  					ops_ld->n_filler;
  			if (data_len > deRmOutSize)
  				data_len = deRmOutSize;
-			if (data_len > orig_op->segments[i].length)
-				data_len = orig_op->segments[i].length;
  		}
+		if (data_len > orig_op->segments[i].length)
+			data_len = orig_op->segments[i].length;
  		/*
  		 * HARQ output can have minor differences
  		 * due to integer representation and related scaling
#3 lore raw

PATCH 2/13 test/bbdev: refactor TB throughput report

In reply to Hernan Vargas

Refactor calculation for tb_size.
No functional impact.

---
 app/test-bbdev/test_bbdev_perf.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
app/test-bbdev/test_bbdev_perf.c +4 -7
index cc7b5481d6..1a8a6b9f82 100644
@@ -2613,18 +2613,15 @@ calc_enc_TB_size(struct rte_bbdev_enc_op *op)
 static uint32_t
 calc_ldpc_enc_TB_size(struct rte_bbdev_enc_op *op)
 {
-	uint8_t i;
-	uint32_t c, r, tb_size = 0;
+	uint32_t tb_size = 0;
 	uint16_t sys_cols = (op->ldpc_enc.basegraph == 1) ? 22 : 10;
 
 	if (op->ldpc_enc.code_block_mode == RTE_BBDEV_CODE_BLOCK) {
 		tb_size = sys_cols * op->ldpc_enc.z_c - op->ldpc_enc.n_filler;
 	} else {
-		c = op->turbo_enc.tb_params.c;
-		r = op->turbo_enc.tb_params.r;
-		for (i = 0; i < c-r; i++)
-			tb_size += sys_cols * op->ldpc_enc.z_c
-					- op->ldpc_enc.n_filler;
+		tb_size = (sys_cols * op->ldpc_enc.z_c - op->ldpc_enc.n_filler)
+				* (op->ldpc_enc.tb_params.c -
+				op->ldpc_enc.tb_params.r);
 	}
 	return tb_size;
 }
Signature · 1 line
2.37.1
#4 lore raw

Re: [PATCH v1 02/13] test/bbdev: refactor TB throughput report

Quoted 22 lines · Hernan Vargas

Refactor calculation for tb_size.
No functional impact.

---
  app/test-bbdev/test_bbdev_perf.c | 11 ++++-------
  1 file changed, 4 insertions(+), 7 deletions(-)
app/test-bbdev/test_bbdev_perf.c +1 -2
index cc7b5481d6..1a8a6b9f82 100644
@@ -2613,18 +2613,15 @@ calc_enc_TB_size(struct rte_bbdev_enc_op *op)
  static uint32_t
  calc_ldpc_enc_TB_size(struct rte_bbdev_enc_op *op)
  {
-	uint8_t i;
-	uint32_t c, r, tb_size = 0;
+	uint32_t tb_size = 0;
  	uint16_t sys_cols = (op->ldpc_enc.basegraph == 1) ? 22 : 10;
 
  	if (op->ldpc_enc.code_block_mode == RTE_BBDEV_CODE_BLOCK) {

app/test-bbdev/test_bbdev_perf.c calc_enc_TB_size(struct rte_bbdev_enc_op *op) · line 2624

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +3 -5
  		tb_size = sys_cols * op->ldpc_enc.z_c - op->ldpc_enc.n_filler;
  	} else {
-		c = op->turbo_enc.tb_params.c;
-		r = op->turbo_enc.tb_params.r;
-		for (i = 0; i < c-r; i++)
-			tb_size += sys_cols * op->ldpc_enc.z_c
-					- op->ldpc_enc.n_filler;
+		tb_size = (sys_cols * op->ldpc_enc.z_c - op->ldpc_enc.n_filler)
+				* (op->ldpc_enc.tb_params.c -
+				op->ldpc_enc.tb_params.r);

It could be made simpler.

static uint32_t calc_ldpc_dec_TB_size(struct rte_bbdev_dec_op *op)

{
	uint8_t i;
	uint32_t tb_size = 0;
	uint16_t sys_cols = (op->ldpc_dec.basegraph == 1) ? 22 : 10;

	if (op->ldpc_dec.code_block_mode == RTE_BBDEV_CODE_BLOCK)
		i = 1
	else
		i = op->ldpc_dec.tb_params.c - op->ldpc_dec.tb_params.r;

	tb_size = (sys_cols * op->ldpc_dec.z_c - op->ldpc_dec.n_filler) * i;

	return tb_size;
}

What do you think?

Thanks,
Maxime

Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
  	}
  	return tb_size;
  }
#5 lore raw

PATCH 3/13 test/bbdev: add timeout for latency tests

In reply to Hernan Vargas

Add a timeout to force exit the latency tests in case dequeue never happens.

---
 app/test-bbdev/test_bbdev_perf.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)
app/test-bbdev/test_bbdev_perf.c +21 -5
index 1a8a6b9f82..14fe76eb64 100644
@@ -26,6 +26,7 @@
 
 #define MAX_QUEUES RTE_MAX_LCORE
 #define TEST_REPETITIONS 100
+#define TIME_OUT_POLL 1e8
 #define WAIT_OFFLOAD_US 1000
 
 #ifdef RTE_BASEBAND_FPGA_LTE_FEC
@@ -4544,6 +4545,7 @@ latency_test_ldpc_dec(struct rte_mempool *mempool,
 
 	for (i = 0, dequeued = 0; dequeued < num_to_process; ++i) {
 		uint16_t enq = 0, deq = 0;
+		uint32_t time_out = 0;
 		bool first_time = true;
 		last_time = 0;
 
@@ -4595,7 +4597,8 @@ latency_test_ldpc_dec(struct rte_mempool *mempool,
 				last_time = rte_rdtsc_precise() - start_time;
 				first_time = false;
 			}
-		} while (unlikely(burst_sz != deq));
+			time_out++;
+		} while ((burst_sz != deq) && (time_out < TIME_OUT_POLL));
 
 		*max_time = RTE_MAX(*max_time, last_time);
 		*min_time = RTE_MIN(*min_time, last_time);
@@ -4604,7 +4607,13 @@ latency_test_ldpc_dec(struct rte_mempool *mempool,
 		if (extDdr)
 			retrieve_harq_ddr(dev_id, queue_id, ops_enq, burst_sz);
 
-		if (test_vector.op_type != RTE_BBDEV_OP_NONE) {
+		if (burst_sz != deq) {
+			ret = TEST_FAILED;
+			dequeued = num_to_process; /* Force exit */
+			struct rte_bbdev_info info;
+			rte_bbdev_info_get(dev_id, &info);
+			TEST_ASSERT_SUCCESS(ret, "Dequeue timeout!");
+		} else if (test_vector.op_type != RTE_BBDEV_OP_NONE) {
 			ret = validate_ldpc_dec_op(ops_deq, burst_sz, ref_op,
 					vector_mask);
 			TEST_ASSERT_SUCCESS(ret, "Validation failed!");
@@ -4630,6 +4639,7 @@ latency_test_enc(struct rte_mempool *mempool,
 
 	for (i = 0, dequeued = 0; dequeued < num_to_process; ++i) {
 		uint16_t enq = 0, deq = 0;
+		uint32_t time_out = 0;
 		bool first_time = true;
 		last_time = 0;
 
@@ -4665,13 +4675,19 @@ latency_test_enc(struct rte_mempool *mempool,
 				last_time += rte_rdtsc_precise() - start_time;
 				first_time = false;
 			}
-		} while (unlikely(burst_sz != deq));
+			time_out++;
+		} while ((burst_sz != deq) && (time_out < TIME_OUT_POLL));
 
 		*max_time = RTE_MAX(*max_time, last_time);
 		*min_time = RTE_MIN(*min_time, last_time);
 		*total_time += last_time;
-
-		if (test_vector.op_type != RTE_BBDEV_OP_NONE) {
+		if (burst_sz != deq) {
+			ret = TEST_FAILED;
+			dequeued = num_to_process; /* Force exit */
+			struct rte_bbdev_info info;
+			rte_bbdev_info_get(dev_id, &info);
+			TEST_ASSERT_SUCCESS(ret, "Dequeue timeout!");
+		} else if (test_vector.op_type != RTE_BBDEV_OP_NONE) {
 			ret = validate_enc_op(ops_deq, burst_sz, ref_op);
 			TEST_ASSERT_SUCCESS(ret, "Validation failed!");
 		}
Signature · 1 line
2.37.1
#6 lore raw

Re: [PATCH v1 03/13] test/bbdev: add timeout for latency tests

Quoted 39 lines · Hernan Vargas

Add a timeout to force exit the latency tests in case dequeue never happens.

---
  app/test-bbdev/test_bbdev_perf.c | 26 +++++++++++++++++++++-----
  1 file changed, 21 insertions(+), 5 deletions(-)
app/test-bbdev/test_bbdev_perf.c +4 -1
index 1a8a6b9f82..14fe76eb64 100644
@@ -26,6 +26,7 @@
 
  #define MAX_QUEUES RTE_MAX_LCORE
  #define TEST_REPETITIONS 100
+#define TIME_OUT_POLL 1e8
  #define WAIT_OFFLOAD_US 1000
 
  #ifdef RTE_BASEBAND_FPGA_LTE_FEC
@@ -4544,6 +4545,7 @@ latency_test_ldpc_dec(struct rte_mempool *mempool,
 
  	for (i = 0, dequeued = 0; dequeued < num_to_process; ++i) {
  		uint16_t enq = 0, deq = 0;
+		uint32_t time_out = 0;
  		bool first_time = true;
  		last_time = 0;
 
@@ -4595,7 +4597,8 @@ latency_test_ldpc_dec(struct rte_mempool *mempool,
  				last_time = rte_rdtsc_precise() - start_time;
  				first_time = false;
  			}
-		} while (unlikely(burst_sz != deq));
+			time_out++;
+		} while ((burst_sz != deq) && (time_out < TIME_OUT_POLL));
 
  		*max_time = RTE_MAX(*max_time, last_time);
  		*min_time = RTE_MIN(*min_time, last_time);

app/test-bbdev/test_bbdev_perf.c latency_test_ldpc_dec(struct rte_mempool *mempool, · line 4612

Quoted 7 lines
app/test-bbdev/test_bbdev_perf.c +3 -1
@@ -4604,7 +4607,13 @@ latency_test_ldpc_dec(struct rte_mempool *mempool,
  		if (extDdr)
  			retrieve_harq_ddr(dev_id, queue_id, ops_enq, burst_sz);
 
-		if (test_vector.op_type != RTE_BBDEV_OP_NONE) {
+		if (burst_sz != deq) {
+			ret = TEST_FAILED;
+			dequeued = num_to_process; /* Force exit */

This should not be necessary, as TEST_ASSERT_SUCCESS() hides a return statement.

app/test-bbdev/test_bbdev_perf.c latency_test_ldpc_dec(struct rte_mempool *mempool, · line 4613

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+			struct rte_bbdev_info info;

Don't mix declaration & code.

Quoted 23 lines
app/test-bbdev/test_bbdev_perf.c +6 -1
+			rte_bbdev_info_get(dev_id, &info);
+			TEST_ASSERT_SUCCESS(ret, "Dequeue timeout!");
+		} else if (test_vector.op_type != RTE_BBDEV_OP_NONE) {
  			ret = validate_ldpc_dec_op(ops_deq, burst_sz, ref_op,
  					vector_mask);
  			TEST_ASSERT_SUCCESS(ret, "Validation failed!");
@@ -4630,6 +4639,7 @@ latency_test_enc(struct rte_mempool *mempool,
 
  	for (i = 0, dequeued = 0; dequeued < num_to_process; ++i) {
  		uint16_t enq = 0, deq = 0;
+		uint32_t time_out = 0;
  		bool first_time = true;
  		last_time = 0;
 
@@ -4665,13 +4675,19 @@ latency_test_enc(struct rte_mempool *mempool,
  				last_time += rte_rdtsc_precise() - start_time;
  				first_time = false;
  			}
-		} while (unlikely(burst_sz != deq));
+			time_out++;
+		} while ((burst_sz != deq) && (time_out < TIME_OUT_POLL));
 
  		*max_time = RTE_MAX(*max_time, last_time);

app/test-bbdev/test_bbdev_perf.c latency_test_enc(struct rte_mempool *mempool, · line 4689

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +6 -2
  		*min_time = RTE_MIN(*min_time, last_time);
  		*total_time += last_time;
-
-		if (test_vector.op_type != RTE_BBDEV_OP_NONE) {
+		if (burst_sz != deq) {
+			ret = TEST_FAILED;
+			dequeued = num_to_process; /* Force exit */
+			struct rte_bbdev_info info;
+			rte_bbdev_info_get(dev_id, &info);
+			TEST_ASSERT_SUCCESS(ret, "Dequeue timeout!");

Same comments here.

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
+		} else if (test_vector.op_type != RTE_BBDEV_OP_NONE) {
  			ret = validate_enc_op(ops_deq, burst_sz, ref_op);
  			TEST_ASSERT_SUCCESS(ret, "Validation failed!");
  		}
#7 lore raw

PATCH 4/13 test/bbdev: early termination not explicit set

In reply to Hernan Vargas

Early termination needs to be explicitly enabled.

---
 app/test-bbdev/test_bbdev_perf.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
app/test-bbdev/test_bbdev_perf.c +9 -2
index 14fe76eb64..12fa988da6 100644
@@ -4463,7 +4463,7 @@ latency_test_dec(struct rte_mempool *mempool,
 		struct test_buffers *bufs, struct rte_bbdev_dec_op *ref_op,
 		int vector_mask, uint16_t dev_id, uint16_t queue_id,
 		const uint16_t num_to_process, uint16_t burst_sz,
-		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time)
+		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time, bool disable_et)
 {
 	int ret = TEST_SUCCESS;
 	uint16_t i, j, dequeued;
@@ -4481,6 +4481,13 @@ latency_test_dec(struct rte_mempool *mempool,
 		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
 		TEST_ASSERT_SUCCESS(ret,
 				"rte_bbdev_dec_op_alloc_bulk() failed");
+		ref_op->turbo_dec.iter_max = get_iter_max();
+		/* For validation tests we want to enable early termination */
+		if (!disable_et && !check_bit(ref_op->turbo_dec.op_flags,
+				RTE_BBDEV_TURBO_EARLY_TERMINATION))
+			ref_op->turbo_dec.op_flags |=
+					RTE_BBDEV_TURBO_EARLY_TERMINATION;
+
 		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
 			copy_reference_dec_op(ops_enq, burst_sz, dequeued,
 					bufs->inputs,
@@ -4873,7 +4880,7 @@ validation_latency_test(struct active_device *ad,
 		iter = latency_test_dec(op_params->mp, bufs,
 				op_params->ref_dec_op, op_params->vector_mask,
 				ad->dev_id, queue_id, num_to_process,
-				burst_sz, &total_time, &min_time, &max_time);
+				burst_sz, &total_time, &min_time, &max_time, latency_flag);
 	else if (op_type == RTE_BBDEV_OP_LDPC_ENC)
 		iter = latency_test_ldpc_enc(op_params->mp, bufs,
 				op_params->ref_enc_op, ad->dev_id, queue_id,
Signature · 1 line
2.37.1
#8 lore raw

Re: [PATCH v1 04/13] test/bbdev: early termination not explicit set

Quoted 35 lines · Hernan Vargas

Early termination needs to be explicitly enabled.

---
  app/test-bbdev/test_bbdev_perf.c | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
app/test-bbdev/test_bbdev_perf.c +8 -1
index 14fe76eb64..12fa988da6 100644
@@ -4463,7 +4463,7 @@ latency_test_dec(struct rte_mempool *mempool,
  		struct test_buffers *bufs, struct rte_bbdev_dec_op *ref_op,
  		int vector_mask, uint16_t dev_id, uint16_t queue_id,
  		const uint16_t num_to_process, uint16_t burst_sz,
-		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time)
+		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time, bool disable_et)
  {
  	int ret = TEST_SUCCESS;
  	uint16_t i, j, dequeued;
@@ -4481,6 +4481,13 @@ latency_test_dec(struct rte_mempool *mempool,
  		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
  		TEST_ASSERT_SUCCESS(ret,
  				"rte_bbdev_dec_op_alloc_bulk() failed");
+		ref_op->turbo_dec.iter_max = get_iter_max();
+		/* For validation tests we want to enable early termination */
+		if (!disable_et && !check_bit(ref_op->turbo_dec.op_flags,
+				RTE_BBDEV_TURBO_EARLY_TERMINATION))
+			ref_op->turbo_dec.op_flags |=
+					RTE_BBDEV_TURBO_EARLY_TERMINATION;
+
  		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
  			copy_reference_dec_op(ops_enq, burst_sz, dequeued,
  					bufs->inputs,

app/test-bbdev/test_bbdev_perf.c validation_latency_test(struct active_device *ad, · line 4886

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
@@ -4873,7 +4880,7 @@ validation_latency_test(struct active_device *ad,
  		iter = latency_test_dec(op_params->mp, bufs,
  				op_params->ref_dec_op, op_params->vector_mask,
  				ad->dev_id, queue_id, num_to_process,
-				burst_sz, &total_time, &min_time, &max_time);
+				burst_sz, &total_time, &min_time, &max_time, latency_flag);
  	else if (op_type == RTE_BBDEV_OP_LDPC_ENC)
  		iter = latency_test_ldpc_enc(op_params->mp, bufs,
  				op_params->ref_enc_op, ad->dev_id, queue_id,

Not clear to me whether it should be a fix. Any thoughts?

Thanks,
Maxime

#9 lore raw

RE: [PATCH v1 04/13] test/bbdev: early termination not explicit set

Hi Maxime,

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 4:04 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 04/13] test/bbdev: early termination not explicit set

Quoted 35 lines · Hernan Vargas

Early termination needs to be explicitly enabled.

---
  app/test-bbdev/test_bbdev_perf.c | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
app/test-bbdev/test_bbdev_perf.c +8 -1
index 14fe76eb64..12fa988da6 100644
@@ -4463,7 +4463,7 @@ latency_test_dec(struct rte_mempool *mempool,
  		struct test_buffers *bufs, struct rte_bbdev_dec_op *ref_op,
  		int vector_mask, uint16_t dev_id, uint16_t queue_id,
  		const uint16_t num_to_process, uint16_t burst_sz,
-		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time)
+		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time, bool disable_et)
  {
  	int ret = TEST_SUCCESS;
  	uint16_t i, j, dequeued;
@@ -4481,6 +4481,13 @@ latency_test_dec(struct rte_mempool *mempool,
  		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
  		TEST_ASSERT_SUCCESS(ret,
  				"rte_bbdev_dec_op_alloc_bulk() failed");
+		ref_op->turbo_dec.iter_max = get_iter_max();
+		/* For validation tests we want to enable early termination */
+		if (!disable_et && !check_bit(ref_op->turbo_dec.op_flags,
+				RTE_BBDEV_TURBO_EARLY_TERMINATION))
+			ref_op->turbo_dec.op_flags |=
+					RTE_BBDEV_TURBO_EARLY_TERMINATION;
+
  		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
  			copy_reference_dec_op(ops_enq, burst_sz, dequeued,
  					bufs->inputs,

app/test-bbdev/test_bbdev_perf.c validation_latency_test(struct active_device *ad, · line 4886

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
@@ -4873,7 +4880,7 @@ validation_latency_test(struct active_device *ad,
  		iter = latency_test_dec(op_params->mp, bufs,
  				op_params->ref_dec_op, op_params->vector_mask,
  				ad->dev_id, queue_id, num_to_process,
-				burst_sz, &total_time, &min_time, &max_time);
+				burst_sz, &total_time, &min_time, &max_time, latency_flag);
  	else if (op_type == RTE_BBDEV_OP_LDPC_ENC)
  		iter = latency_test_ldpc_enc(op_params->mp, bufs,
  				op_params->ref_enc_op, ad->dev_id, queue_id,

Not clear to me whether it should be a fix. Any thoughts?

Thanks,
Maxime

This is not a fix, it's just an enhancement to enable early termination for validation tests if the device supports it. The validation tests currently run iter_max number of iterations for decoding, with this enhancement the decoding could terminate early.

Thanks,
Hernan

#10 lore raw

Re: [PATCH v1 04/13] test/bbdev: early termination not explicit set

Quoted 58 lines · Hernan

Hi Maxime,

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 4:04 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 04/13] test/bbdev: early termination not explicit set

Quoted 35 lines · Hernan Vargas

Early termination needs to be explicitly enabled.

---
   app/test-bbdev/test_bbdev_perf.c | 11 +++++++++--
   1 file changed, 9 insertions(+), 2 deletions(-)
app/test-bbdev/test_bbdev_perf.c +8 -1
index 14fe76eb64..12fa988da6 100644
@@ -4463,7 +4463,7 @@ latency_test_dec(struct rte_mempool *mempool,
   		struct test_buffers *bufs, struct rte_bbdev_dec_op *ref_op,
   		int vector_mask, uint16_t dev_id, uint16_t queue_id,
   		const uint16_t num_to_process, uint16_t burst_sz,
-		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time)
+		uint64_t *total_time, uint64_t *min_time, uint64_t *max_time, bool disable_et)
   {
   	int ret = TEST_SUCCESS;
   	uint16_t i, j, dequeued;
@@ -4481,6 +4481,13 @@ latency_test_dec(struct rte_mempool *mempool,
   		ret = rte_bbdev_dec_op_alloc_bulk(mempool, ops_enq, burst_sz);
   		TEST_ASSERT_SUCCESS(ret,
   				"rte_bbdev_dec_op_alloc_bulk() failed");
+		ref_op->turbo_dec.iter_max = get_iter_max();
+		/* For validation tests we want to enable early termination */
+		if (!disable_et && !check_bit(ref_op->turbo_dec.op_flags,
+				RTE_BBDEV_TURBO_EARLY_TERMINATION))
+			ref_op->turbo_dec.op_flags |=
+					RTE_BBDEV_TURBO_EARLY_TERMINATION;
+
   		if (test_vector.op_type != RTE_BBDEV_OP_NONE)
   			copy_reference_dec_op(ops_enq, burst_sz, dequeued,
   					bufs->inputs,

app/test-bbdev/test_bbdev_perf.c validation_latency_test(struct active_device *ad, · line 4886

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
@@ -4873,7 +4880,7 @@ validation_latency_test(struct active_device *ad,
   		iter = latency_test_dec(op_params->mp, bufs,
   				op_params->ref_dec_op, op_params->vector_mask,
   				ad->dev_id, queue_id, num_to_process,
-				burst_sz, &total_time, &min_time, &max_time);
+				burst_sz, &total_time, &min_time, &max_time, latency_flag);
   	else if (op_type == RTE_BBDEV_OP_LDPC_ENC)
   		iter = latency_test_ldpc_enc(op_params->mp, bufs,
   				op_params->ref_enc_op, ad->dev_id, queue_id,

Not clear to me whether it should be a fix. Any thoughts?

Quoted 8 lines

Thanks,
Maxime

This is not a fix, it's just an enhancement to enable early termination for validation tests if the device supports it. The validation tests currently run iter_max number of iterations for decoding, with this enhancement the decoding could terminate early.

Thanks,
Hernan

Could you please fix your email client?
The message you are replying to is not quoted.

Thanks,
Maxime

#11 lore raw

PATCH 5/13 test/bbdev: report device status in bbdev-test

In reply to Hernan Vargas

No functional impact.

---
 app/test-bbdev/test_bbdev_perf.c | 2 ++
 1 file changed, 2 insertions(+)
app/test-bbdev/test_bbdev_perf.c +2 -0
index 12fa988da6..36ea399938 100644
@@ -849,6 +849,8 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
 #endif
 	/* Let's refresh this now this is configured */
 	rte_bbdev_info_get(dev_id, info);
+	if (info->drv.device_status == RTE_BBDEV_DEV_FATAL_ERR)
+		printf("Device Status %s\n", rte_bbdev_device_status_str(info->drv.device_status));
 	nb_queues = RTE_MIN(rte_lcore_count(), info->drv.max_num_queues);
 	nb_queues = RTE_MIN(nb_queues, (unsigned int) MAX_QUEUES);
 
Signature · 1 line
2.37.1
Reviewed-by on v1 5/13
#12 lore raw

Re: [PATCH v1 05/13] test/bbdev: report device status in bbdev-test

Quoted 12 lines · Hernan Vargas

No functional impact.

---
  app/test-bbdev/test_bbdev_perf.c | 2 ++
  1 file changed, 2 insertions(+)
app/test-bbdev/test_bbdev_perf.c +0 -0
index 12fa988da6..36ea399938 100644

app/test-bbdev/test_bbdev_perf.c add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info, · line 856

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +2 -0
@@ -849,6 +849,8 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
  #endif
  	/* Let's refresh this now this is configured */
  	rte_bbdev_info_get(dev_id, info);
+	if (info->drv.device_status == RTE_BBDEV_DEV_FATAL_ERR)
+		printf("Device Status %s\n", rte_bbdev_device_status_str(info->drv.device_status));
  	nb_queues = RTE_MIN(rte_lcore_count(), info->drv.max_num_queues);
  	nb_queues = RTE_MIN(nb_queues, (unsigned int) MAX_QUEUES);
 

Thanks,
Maxime

#13 lore raw

PATCH 6/13 test/bbdev: log capture from queue stop

In reply to Hernan Vargas

Improve log capture in bbdev not requiring standard output.

---
 app/test-bbdev/test_bbdev_perf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
app/test-bbdev/test_bbdev_perf.c +4 -2
index 36ea399938..ffb2de0604 100644
@@ -889,6 +889,7 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
 			ret = rte_bbdev_queue_configure(ad->dev_id, queue_id,
 					&qconf);
 		}
+		rte_bbdev_queue_start(ad->dev_id, queue_id);
 		if (ret != 0) {
 			printf("All queues on dev %u allocated: %u\n",
 					dev_id, queue_id);
@@ -897,8 +898,8 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
 		ad->queue_ids[queue_id] = queue_id;
 	}
 	TEST_ASSERT(queue_id != 0,
-			"ERROR Failed to configure any queues on dev %u",
-			dev_id);
+			"ERROR Failed to configure any queues on dev %u\n"
+			"\tthe device may not support or have been configured", dev_id);
 	ad->nb_queues = queue_id;
 
 	set_avail_op(ad, op_type);
@@ -3844,6 +3845,7 @@ throughput_pmd_lcore_ldpc_dec(void *arg)
 		TEST_ASSERT_SUCCESS(ret, "Validation failed!");
 	}
 
+	rte_bbdev_queue_stop(tp->dev_id, queue_id);
 	rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
 
 	double tb_len_bits = calc_ldpc_dec_TB_size(ref_op);
Signature · 1 line
2.37.1
#14 lore raw

Re: [PATCH v1 06/13] test/bbdev: log capture from queue stop

Quoted 31 lines · Hernan Vargas

Improve log capture in bbdev not requiring standard output.

---
  app/test-bbdev/test_bbdev_perf.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
app/test-bbdev/test_bbdev_perf.c +3 -2
index 36ea399938..ffb2de0604 100644
@@ -889,6 +889,7 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
  			ret = rte_bbdev_queue_configure(ad->dev_id, queue_id,
  					&qconf);
  		}
+		rte_bbdev_queue_start(ad->dev_id, queue_id);
  		if (ret != 0) {
  			printf("All queues on dev %u allocated: %u\n",
  					dev_id, queue_id);
@@ -897,8 +898,8 @@ add_bbdev_dev(uint8_t dev_id, struct rte_bbdev_info *info,
  		ad->queue_ids[queue_id] = queue_id;
  	}
  	TEST_ASSERT(queue_id != 0,
-			"ERROR Failed to configure any queues on dev %u",
-			dev_id);
+			"ERROR Failed to configure any queues on dev %u\n"
+			"\tthe device may not support or have been configured", dev_id);
  	ad->nb_queues = queue_id;
 
  	set_avail_op(ad, op_type);

app/test-bbdev/test_bbdev_perf.c throughput_pmd_lcore_ldpc_dec(void *arg) · line 3848

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
@@ -3844,6 +3845,7 @@ throughput_pmd_lcore_ldpc_dec(void *arg)
  		TEST_ASSERT_SUCCESS(ret, "Validation failed!");
  	}
 
+	rte_bbdev_queue_stop(tp->dev_id, queue_id);

The patch is doing more than advertised.

app/test-bbdev/test_bbdev_perf.c throughput_pmd_lcore_ldpc_dec(void *arg) · line 3851

Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
  	rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
 
  	double tb_len_bits = calc_ldpc_dec_TB_size(ref_op);

Maxime

#15 lore raw

PATCH 7/13 test/bbdev: add support for BLER for 4G

In reply to Hernan Vargas

New feature to add BLER support for 4G in bbdev-test.

---
 app/test-bbdev/test_bbdev_perf.c | 184 ++++++++++++++++++++++++++++++-
 1 file changed, 183 insertions(+), 1 deletion(-)
app/test-bbdev/test_bbdev_perf.c +183 -1
index ffb2de0604..69b86cdeb1 100644
@@ -1756,6 +1756,30 @@ gen_qm2_llr(int8_t *llrs, uint32_t j, double N0, double llr_max)
 	llrs[j] = (int8_t) b;
 }
 
+/* Simple LLR generation assuming AWGN and QPSK */
+static void
+gen_turbo_llr(int8_t *llrs, uint32_t j, double N0, double llr_max)
+{
+	double b, b1, n;
+	double coeff = 2.0 * sqrt(N0);
+
+	/* Ignore in vectors null LLRs not to be saturated */
+	if (llrs[j] == 0)
+		return;
+
+	/* Note don't change sign here */
+	n = randn(j % 2);
+	b1 = ((llrs[j] > 0 ? 2.0 : -2.0)
+			+ coeff * n) / N0;
+	b = b1 * (1 << 4);
+	b = round(b);
+	if (b > llr_max)
+		b = llr_max;
+	if (b < -llr_max)
+		b = -llr_max;
+	llrs[j] = (int8_t) b;
+}
+
 /* Generate LLR for a given SNR */
 static void
 generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
@@ -1791,6 +1815,27 @@ generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
 	}
 }
 
+/* Generate LLR for turbo decoder for a given SNR */
+static void
+generate_turbo_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
+		struct rte_bbdev_dec_op *ref_op)
+{
+	struct rte_mbuf *m;
+	uint32_t i, j, range;
+	double N0, llr_max;
+
+	llr_max = 127;
+	range = ref_op->turbo_dec.input.length;
+	N0 = 1.0 / pow(10.0, get_snr() / 10.0);
+
+	for (i = 0; i < n; ++i) {
+		m = inputs[i].data;
+		int8_t *llrs = rte_pktmbuf_mtod_offset(m, int8_t *, 0);
+		for (j = 0; j < range; ++j)
+			gen_turbo_llr(llrs, j, N0, llr_max);
+	}
+}
+
 static void
 copy_reference_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned int n,
 		unsigned int start_idx,
@@ -2301,6 +2346,31 @@ validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n)
 	return errors;
 }
 
+/* Check Number of code blocks errors */
+static int
+validate_turbo_bler(struct rte_bbdev_dec_op **ops, const uint16_t n)
+{
+	unsigned int i;
+	struct op_data_entries *hard_data_orig =
+			&test_vector.entries[DATA_HARD_OUTPUT];
+	struct rte_bbdev_op_turbo_dec *ops_td;
+	struct rte_bbdev_op_data *hard_output;
+	int errors = 0;
+	struct rte_mbuf *m;
+
+	for (i = 0; i < n; ++i) {
+		ops_td = &ops[i]->turbo_dec;
+		hard_output = &ops_td->hard_output;
+		m = hard_output->data;
+		if (memcmp(rte_pktmbuf_mtod_offset(m, uint32_t *, 0),
+				hard_data_orig->segments[0].addr,
+				hard_data_orig->segments[0].length))
+			errors++;
+	}
+	return errors;
+}
+
+
 static int
 validate_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
 		struct rte_bbdev_dec_op *ref_op, const int vector_mask)
@@ -3736,6 +3806,114 @@ bler_pmd_lcore_ldpc_dec(void *arg)
 	return TEST_SUCCESS;
 }
 
+
+static int
+bler_pmd_lcore_turbo_dec(void *arg)
+{
+	struct thread_params *tp = arg;
+	uint16_t enq, deq;
+	uint64_t total_time = 0, start_time;
+	const uint16_t queue_id = tp->queue_id;
+	const uint16_t burst_sz = tp->op_params->burst_sz;
+	const uint16_t num_ops = tp->op_params->num_to_process;
+	struct rte_bbdev_dec_op *ops_enq[num_ops];
+	struct rte_bbdev_dec_op *ops_deq[num_ops];
+	struct rte_bbdev_dec_op *ref_op = tp->op_params->ref_dec_op;
+	struct test_buffers *bufs = NULL;
+	int i, j, ret;
+	struct rte_bbdev_info info;
+	uint16_t num_to_enq;
+
+	TEST_ASSERT_SUCCESS((burst_sz > MAX_BURST),
+			"BURST_SIZE should be <= %u", MAX_BURST);
+
+	rte_bbdev_info_get(tp->dev_id, &info);
+
+	TEST_ASSERT_SUCCESS((num_ops > info.drv.queue_size_lim),
+			"NUM_OPS cannot exceed %u for this device",
+			info.drv.queue_size_lim);
+
+	bufs = &tp->op_params->q_bufs[GET_SOCKET(info.socket_id)][queue_id];
+
+	rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, __ATOMIC_RELAXED);
+
+	ret = rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops_enq, num_ops);
+	TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", num_ops);
+
+	/* For BLER tests we need to enable early termination */
+	if (!check_bit(ref_op->turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_EARLY_TERMINATION))
+		ref_op->turbo_dec.op_flags +=
+				RTE_BBDEV_TURBO_EARLY_TERMINATION;
+	ref_op->turbo_dec.iter_max = get_iter_max();
+	ref_op->turbo_dec.iter_count = ref_op->turbo_dec.iter_max;
+
+	if (test_vector.op_type != RTE_BBDEV_OP_NONE)
+		copy_reference_dec_op(ops_enq, num_ops, 0, bufs->inputs,
+				bufs->hard_outputs, bufs->soft_outputs,
+				ref_op);
+	generate_turbo_llr_input(num_ops, bufs->inputs, ref_op);
+
+	/* Set counter to validate the ordering */
+	for (j = 0; j < num_ops; ++j)
+		ops_enq[j]->opaque_data = (void *)(uintptr_t)j;
+
+	for (i = 0; i < 1; ++i) { /* Could add more iterations */
+		for (j = 0; j < num_ops; ++j) {
+			mbuf_reset(
+			ops_enq[j]->turbo_dec.hard_output.data);
+		}
+
+		start_time = rte_rdtsc_precise();
+
+		for (enq = 0, deq = 0; enq < num_ops;) {
+			num_to_enq = burst_sz;
+
+			if (unlikely(num_ops - enq < num_to_enq))
+				num_to_enq = num_ops - enq;
+
+			enq += rte_bbdev_enqueue_dec_ops(tp->dev_id,
+					queue_id, &ops_enq[enq], num_to_enq);
+
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq - deq);
+		}
+
+		/* dequeue the remaining */
+		while (deq < enq) {
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq - deq);
+		}
+
+		total_time += rte_rdtsc_precise() - start_time;
+	}
+
+	tp->iter_count = 0;
+	tp->iter_average = 0;
+	/* get the max of iter_count for all dequeued ops */
+	for (i = 0; i < num_ops; ++i) {
+		tp->iter_count = RTE_MAX(ops_enq[i]->turbo_dec.iter_count,
+				tp->iter_count);
+		tp->iter_average += (double) ops_enq[i]->turbo_dec.iter_count;
+	}
+
+	tp->iter_average /= num_ops;
+	tp->bler = (double) validate_turbo_bler(ops_deq, num_ops) / num_ops;
+
+	rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
+
+	double tb_len_bits = calc_dec_TB_size(ref_op);
+	tp->ops_per_sec = ((double)num_ops * 1) /
+			((double)total_time / (double)rte_get_tsc_hz());
+	tp->mbps = (((double)(num_ops * 1 * tb_len_bits)) /
+			1000000.0) / ((double)total_time /
+			(double)rte_get_tsc_hz());
+	printf("TBS %.0f Time %.0f\n", tb_len_bits, 1000000.0 *
+			((double)total_time / (double)rte_get_tsc_hz()));
+
+	return TEST_SUCCESS;
+}
+
 static int
 throughput_pmd_lcore_ldpc_dec(void *arg)
 {
@@ -4193,7 +4371,7 @@ print_dec_bler(struct thread_params *t_params, unsigned int used_cores)
 	total_bler /= used_cores;
 	total_iter /= used_cores;
 
-	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.1f Mbps %s\n",
+	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.3f Mbps %s\n",
 			snr, total_bler * 100, total_iter, get_iter_max(),
 			total_mbps, get_vector_filename());
 }
@@ -4245,6 +4423,10 @@ bler_test(struct active_device *ad,
 			&& !check_bit(test_vector.ldpc_dec.op_flags,
 			RTE_BBDEV_LDPC_LLR_COMPRESSION))
 		bler_function = bler_pmd_lcore_ldpc_dec;
+	else if ((test_vector.op_type == RTE_BBDEV_OP_TURBO_DEC) &&
+			!check_bit(test_vector.turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_SOFT_OUTPUT))
+		bler_function = bler_pmd_lcore_turbo_dec;
 	else
 		return TEST_SKIPPED;
 
Signature · 1 line
2.37.1
#16 lore raw

Re: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Quoted 83 lines · Hernan Vargas

New feature to add BLER support for 4G in bbdev-test.

---
  app/test-bbdev/test_bbdev_perf.c | 184 ++++++++++++++++++++++++++++++-
  1 file changed, 183 insertions(+), 1 deletion(-)
app/test-bbdev/test_bbdev_perf.c +54 -0
index ffb2de0604..69b86cdeb1 100644
@@ -1756,6 +1756,30 @@ gen_qm2_llr(int8_t *llrs, uint32_t j, double N0, double llr_max)
  	llrs[j] = (int8_t) b;
  }
 
+/* Simple LLR generation assuming AWGN and QPSK */
+static void
+gen_turbo_llr(int8_t *llrs, uint32_t j, double N0, double llr_max)
+{
+	double b, b1, n;
+	double coeff = 2.0 * sqrt(N0);
+
+	/* Ignore in vectors null LLRs not to be saturated */
+	if (llrs[j] == 0)
+		return;
+
+	/* Note don't change sign here */
+	n = randn(j % 2);
+	b1 = ((llrs[j] > 0 ? 2.0 : -2.0)
+			+ coeff * n) / N0;
+	b = b1 * (1 << 4);
+	b = round(b);
+	if (b > llr_max)
+		b = llr_max;
+	if (b < -llr_max)
+		b = -llr_max;
+	llrs[j] = (int8_t) b;
+}
+
  /* Generate LLR for a given SNR */
  static void
  generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
@@ -1791,6 +1815,27 @@ generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
  	}
  }
 
+/* Generate LLR for turbo decoder for a given SNR */
+static void
+generate_turbo_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
+		struct rte_bbdev_dec_op *ref_op)
+{
+	struct rte_mbuf *m;
+	uint32_t i, j, range;
+	double N0, llr_max;
+
+	llr_max = 127;
+	range = ref_op->turbo_dec.input.length;
+	N0 = 1.0 / pow(10.0, get_snr() / 10.0);
+
+	for (i = 0; i < n; ++i) {
+		m = inputs[i].data;
+		int8_t *llrs = rte_pktmbuf_mtod_offset(m, int8_t *, 0);
+		for (j = 0; j < range; ++j)
+			gen_turbo_llr(llrs, j, N0, llr_max);
+	}
+}
+
  static void
  copy_reference_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned int n,
  		unsigned int start_idx,
@@ -2301,6 +2346,31 @@ validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n)
  	return errors;
  }
 
+/* Check Number of code blocks errors */
+static int
+validate_turbo_bler(struct rte_bbdev_dec_op **ops, const uint16_t n)
+{
+	unsigned int i;
+	struct op_data_entries *hard_data_orig =
+			&test_vector.entries[DATA_HARD_OUTPUT];
+	struct rte_bbdev_op_turbo_dec *ops_td;
+	struct rte_bbdev_op_data *hard_output;

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n) · line 2367

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+	int errors = 0;
+	struct rte_mbuf *m;
+
+	for (i = 0; i < n; ++i) {
+		ops_td = &ops[i]->turbo_dec;
+		hard_output = &ops_td->hard_output;
+		m = hard_output->data;
+		if (memcmp(rte_pktmbuf_mtod_offset(m, uint32_t *, 0),
+				hard_data_orig->segments[0].addr,
+				hard_data_orig->segments[0].length))

No need to check mbuf is at least as large as segment 0 length?

Quoted 71 lines
app/test-bbdev/test_bbdev_perf.c +64 -0
+			errors++;
+	}
+	return errors;
+}
+
+
  static int
  validate_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
  		struct rte_bbdev_dec_op *ref_op, const int vector_mask)
@@ -3736,6 +3806,114 @@ bler_pmd_lcore_ldpc_dec(void *arg)
  	return TEST_SUCCESS;
  }
 
+
+static int
+bler_pmd_lcore_turbo_dec(void *arg)
+{
+	struct thread_params *tp = arg;
+	uint16_t enq, deq;
+	uint64_t total_time = 0, start_time;
+	const uint16_t queue_id = tp->queue_id;
+	const uint16_t burst_sz = tp->op_params->burst_sz;
+	const uint16_t num_ops = tp->op_params->num_to_process;
+	struct rte_bbdev_dec_op *ops_enq[num_ops];
+	struct rte_bbdev_dec_op *ops_deq[num_ops];
+	struct rte_bbdev_dec_op *ref_op = tp->op_params->ref_dec_op;
+	struct test_buffers *bufs = NULL;
+	int i, j, ret;
+	struct rte_bbdev_info info;
+	uint16_t num_to_enq;
+
+	TEST_ASSERT_SUCCESS((burst_sz > MAX_BURST),
+			"BURST_SIZE should be <= %u", MAX_BURST);
+
+	rte_bbdev_info_get(tp->dev_id, &info);
+
+	TEST_ASSERT_SUCCESS((num_ops > info.drv.queue_size_lim),
+			"NUM_OPS cannot exceed %u for this device",
+			info.drv.queue_size_lim);
+
+	bufs = &tp->op_params->q_bufs[GET_SOCKET(info.socket_id)][queue_id];
+
+	rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START, __ATOMIC_RELAXED);
+
+	ret = rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops_enq, num_ops);
+	TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops", num_ops);
+
+	/* For BLER tests we need to enable early termination */
+	if (!check_bit(ref_op->turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_EARLY_TERMINATION))
+		ref_op->turbo_dec.op_flags +=
+				RTE_BBDEV_TURBO_EARLY_TERMINATION;
+	ref_op->turbo_dec.iter_max = get_iter_max();
+	ref_op->turbo_dec.iter_count = ref_op->turbo_dec.iter_max;
+
+	if (test_vector.op_type != RTE_BBDEV_OP_NONE)
+		copy_reference_dec_op(ops_enq, num_ops, 0, bufs->inputs,
+				bufs->hard_outputs, bufs->soft_outputs,
+				ref_op);
+	generate_turbo_llr_input(num_ops, bufs->inputs, ref_op);
+
+	/* Set counter to validate the ordering */
+	for (j = 0; j < num_ops; ++j)
+		ops_enq[j]->opaque_data = (void *)(uintptr_t)j;
+
+	for (i = 0; i < 1; ++i) { /* Could add more iterations */
+		for (j = 0; j < num_ops; ++j) {
+			mbuf_reset(
+			ops_enq[j]->turbo_dec.hard_output.data);
+		}
+

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg) · line 3876

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+		start_time = rte_rdtsc_precise();
+
+		for (enq = 0, deq = 0; enq < num_ops;) {
+			num_to_enq = burst_sz;
+
+			if (unlikely(num_ops - enq < num_to_enq))
+				num_to_enq = num_ops - enq;
+
+			enq += rte_bbdev_enqueue_dec_ops(tp->dev_id,
+					queue_id, &ops_enq[enq], num_to_enq);

If for some reason the operation fails (looks like it can fail in at least ACC200 I checked), it ends up doing an endless loop as enc won't get incremented.

Quoted 63 lines
app/test-bbdev/test_bbdev_perf.c +45 -1
+
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq - deq);
+		}
+
+		/* dequeue the remaining */
+		while (deq < enq) {
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq - deq);
+		}
+
+		total_time += rte_rdtsc_precise() - start_time;
+	}
+
+	tp->iter_count = 0;
+	tp->iter_average = 0;
+	/* get the max of iter_count for all dequeued ops */
+	for (i = 0; i < num_ops; ++i) {
+		tp->iter_count = RTE_MAX(ops_enq[i]->turbo_dec.iter_count,
+				tp->iter_count);
+		tp->iter_average += (double) ops_enq[i]->turbo_dec.iter_count;
+	}
+
+	tp->iter_average /= num_ops;
+	tp->bler = (double) validate_turbo_bler(ops_deq, num_ops) / num_ops;
+
+	rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
+
+	double tb_len_bits = calc_dec_TB_size(ref_op);
+	tp->ops_per_sec = ((double)num_ops * 1) /
+			((double)total_time / (double)rte_get_tsc_hz());
+	tp->mbps = (((double)(num_ops * 1 * tb_len_bits)) /
+			1000000.0) / ((double)total_time /
+			(double)rte_get_tsc_hz());
+	printf("TBS %.0f Time %.0f\n", tb_len_bits, 1000000.0 *
+			((double)total_time / (double)rte_get_tsc_hz()));
+
+	return TEST_SUCCESS;
+}
+
  static int
  throughput_pmd_lcore_ldpc_dec(void *arg)
  {
@@ -4193,7 +4371,7 @@ print_dec_bler(struct thread_params *t_params, unsigned int used_cores)
  	total_bler /= used_cores;
  	total_iter /= used_cores;
 
-	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.1f Mbps %s\n",
+	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.3f Mbps %s\n",
  			snr, total_bler * 100, total_iter, get_iter_max(),
  			total_mbps, get_vector_filename());
  }
@@ -4245,6 +4423,10 @@ bler_test(struct active_device *ad,
  			&& !check_bit(test_vector.ldpc_dec.op_flags,
  			RTE_BBDEV_LDPC_LLR_COMPRESSION))
  		bler_function = bler_pmd_lcore_ldpc_dec;
+	else if ((test_vector.op_type == RTE_BBDEV_OP_TURBO_DEC) &&
+			!check_bit(test_vector.turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_SOFT_OUTPUT))
+		bler_function = bler_pmd_lcore_turbo_dec;
  	else
  		return TEST_SKIPPED;
 
#17 lore raw

RE: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Quoted 201 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 4:20 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Quoted 5 lines · Hernan Vargas

New feature to add BLER support for 4G in bbdev-test.

---
  app/test-bbdev/test_bbdev_perf.c | 184

++++++++++++++++++++++++++++++-

app/test-bbdev/test_bbdev_perf.c gen_qm2_llr(int8_t *llrs, uint32_t j, double N0,

Quoted 8 lines
  1 file changed, 183 insertions(+), 1 deletion(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index ffb2de0604..69b86cdeb1 100644
@@ -1756,6 +1756,30 @@ gen_qm2_llr(int8_t *llrs, uint32_t j, double N0,

double llr_max)

Quoted 19 lines
app/test-bbdev/test_bbdev_perf.c +16 -0
  	llrs[j] = (int8_t) b;
  }
 
+/* Simple LLR generation assuming AWGN and QPSK */ static void
+gen_turbo_llr(int8_t *llrs, uint32_t j, double N0, double llr_max) {
+	double b, b1, n;
+	double coeff = 2.0 * sqrt(N0);
+
+	/* Ignore in vectors null LLRs not to be saturated */
+	if (llrs[j] == 0)
+		return;
+
+	/* Note don't change sign here */
+	n = randn(j % 2);
+	b1 = ((llrs[j] > 0 ? 2.0 : -2.0)
+			+ coeff * n) / N0;
+	b = b1 * (1 << 4);
+	b = round(b);
+	if (b > llr_max)

app/test-bbdev/test_bbdev_perf.c gen_qm2_llr(int8_t *llrs, uint32_t j, double N0, double llr_max)

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +6 -1
+		b = llr_max;
+	if (b < -llr_max)
+		b = -llr_max;
+	llrs[j] = (int8_t) b;
+}
+
  /* Generate LLR for a given SNR */
  static void
  generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs, @@
-1791,6 +1815,27 @@ generate_llr_input(uint16_t n, struct

rte_bbdev_op_data *inputs,

Quoted 15 lines
  	}
  }
app/test-bbdev/test_bbdev_perf.c +12 -0
+/* Generate LLR for turbo decoder for a given SNR */ static void
+generate_turbo_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
+		struct rte_bbdev_dec_op *ref_op)
+{
+	struct rte_mbuf *m;
+	uint32_t i, j, range;
+	double N0, llr_max;
+
+	llr_max = 127;
+	range = ref_op->turbo_dec.input.length;
+	N0 = 1.0 / pow(10.0, get_snr() / 10.0);
+

app/test-bbdev/test_bbdev_perf.c generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +8 -0
+	for (i = 0; i < n; ++i) {
+		m = inputs[i].data;
+		int8_t *llrs = rte_pktmbuf_mtod_offset(m, int8_t *, 0);
+		for (j = 0; j < range; ++j)
+			gen_turbo_llr(llrs, j, N0, llr_max);
+	}
+}
+
  static void
  copy_reference_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned

int n,

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op

Quoted 2 lines

unsigned int start_idx,

app/test-bbdev/test_bbdev_perf.c +0 -0
@@ -2301,6 +2346,31 @@ validate_ldpc_bler(struct rte_bbdev_dec_op

**ops, const uint16_t n)

Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +8 -0
  	return errors;
  }
 
+/* Check Number of code blocks errors */ static int
+validate_turbo_bler(struct rte_bbdev_dec_op **ops, const uint16_t n)
+{
+	unsigned int i;
+	struct op_data_entries *hard_data_orig =
+			&test_vector.entries[DATA_HARD_OUTPUT];
+	struct rte_bbdev_op_turbo_dec *ops_td;
+	struct rte_bbdev_op_data *hard_output;

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n) · line 2367

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+	int errors = 0;
+	struct rte_mbuf *m;
+
+	for (i = 0; i < n; ++i) {
+		ops_td = &ops[i]->turbo_dec;
+		hard_output = &ops_td->hard_output;
+		m = hard_output->data;
+		if (memcmp(rte_pktmbuf_mtod_offset(m, uint32_t *, 0),
+				hard_data_orig->segments[0].addr,
+				hard_data_orig->segments[0].length))

No need to check mbuf is at least as large as segment 0 length?

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n) · line 2376

Quoted 9 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+			errors++;
+	}
+	return errors;
+}
+
+
  static int
  validate_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
  		struct rte_bbdev_dec_op *ref_op, const int vector_mask)

@@ -3736,6

Quoted 33 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
+3806,114 @@ bler_pmd_lcore_ldpc_dec(void *arg)
  	return TEST_SUCCESS;
  }
app/test-bbdev/test_bbdev_perf.c +28 -0
+
+static int
+bler_pmd_lcore_turbo_dec(void *arg)
+{
+	struct thread_params *tp = arg;
+	uint16_t enq, deq;
+	uint64_t total_time = 0, start_time;
+	const uint16_t queue_id = tp->queue_id;
+	const uint16_t burst_sz = tp->op_params->burst_sz;
+	const uint16_t num_ops = tp->op_params->num_to_process;
+	struct rte_bbdev_dec_op *ops_enq[num_ops];
+	struct rte_bbdev_dec_op *ops_deq[num_ops];
+	struct rte_bbdev_dec_op *ref_op = tp->op_params->ref_dec_op;
+	struct test_buffers *bufs = NULL;
+	int i, j, ret;
+	struct rte_bbdev_info info;
+	uint16_t num_to_enq;
+
+	TEST_ASSERT_SUCCESS((burst_sz > MAX_BURST),
+			"BURST_SIZE should be <= %u", MAX_BURST);
+
+	rte_bbdev_info_get(tp->dev_id, &info);
+
+	TEST_ASSERT_SUCCESS((num_ops > info.drv.queue_size_lim),
+			"NUM_OPS cannot exceed %u for this device",
+			info.drv.queue_size_lim);
+
+	bufs = &tp->op_params-

q_bufs[GET_SOCKET(info.socket_id)][queue_id];

app/test-bbdev/test_bbdev_perf.c

Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +5 -0
+
+	rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START,
+__ATOMIC_RELAXED);
+
+	ret = rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops_enq,

num_ops);

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+	TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",

num_ops);

Quoted 26 lines
app/test-bbdev/test_bbdev_perf.c +11 -0
+
+	/* For BLER tests we need to enable early termination */
+	if (!check_bit(ref_op->turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_EARLY_TERMINATION))
+		ref_op->turbo_dec.op_flags +=
+				RTE_BBDEV_TURBO_EARLY_TERMINATION;
+	ref_op->turbo_dec.iter_max = get_iter_max();
+	ref_op->turbo_dec.iter_count = ref_op->turbo_dec.iter_max;
+
+	if (test_vector.op_type != RTE_BBDEV_OP_NONE)
+		copy_reference_dec_op(ops_enq, num_ops, 0, bufs-

inputs,

app/test-bbdev/test_bbdev_perf.c +14 -0
+				bufs->hard_outputs, bufs->soft_outputs,
+				ref_op);
+	generate_turbo_llr_input(num_ops, bufs->inputs, ref_op);
+
+	/* Set counter to validate the ordering */
+	for (j = 0; j < num_ops; ++j)
+		ops_enq[j]->opaque_data = (void *)(uintptr_t)j;
+
+	for (i = 0; i < 1; ++i) { /* Could add more iterations */
+		for (j = 0; j < num_ops; ++j) {
+			mbuf_reset(
+			ops_enq[j]->turbo_dec.hard_output.data);
+		}
+

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+		start_time = rte_rdtsc_precise();
+
+		for (enq = 0, deq = 0; enq < num_ops;) {
+			num_to_enq = burst_sz;
+
+			if (unlikely(num_ops - enq < num_to_enq))
+				num_to_enq = num_ops - enq;
+
+			enq += rte_bbdev_enqueue_dec_ops(tp->dev_id,
+					queue_id, &ops_enq[enq],

num_to_enq);

Quoted 2 lines

If for some reason the operation fails (looks like it can fail in at least ACC200 I checked), it ends up doing an endless loop as enc won't get incremented.

The python wrapper script used to invoke test-bbdev has a configurable timeout (default 600 seconds) that would stop the test in case it ends up in an infinite loop.

Quoted 71 lines

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3 -0
+
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq -

deq);

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+		}
+
+		/* dequeue the remaining */
+		while (deq < enq) {
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq -

deq);

Quoted 14 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+		}
+
+		total_time += rte_rdtsc_precise() - start_time;
+	}
+
+	tp->iter_count = 0;
+	tp->iter_average = 0;
+	/* get the max of iter_count for all dequeued ops */
+	for (i = 0; i < num_ops; ++i) {
+		tp->iter_count = RTE_MAX(ops_enq[i]-

turbo_dec.iter_count,

app/test-bbdev/test_bbdev_perf.c +2 -0
+				tp->iter_count);
+		tp->iter_average += (double) ops_enq[i]-

turbo_dec.iter_count;

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4 -0
+	}
+
+	tp->iter_average /= num_ops;
+	tp->bler = (double) validate_turbo_bler(ops_deq, num_ops) /

num_ops;

app/test-bbdev/test_bbdev_perf.c print_dec_bler(struct thread_params *t_params,

Quoted 19 lines
app/test-bbdev/test_bbdev_perf.c +15 -0
+
+	rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
+
+	double tb_len_bits = calc_dec_TB_size(ref_op);
+	tp->ops_per_sec = ((double)num_ops * 1) /
+			((double)total_time / (double)rte_get_tsc_hz());
+	tp->mbps = (((double)(num_ops * 1 * tb_len_bits)) /
+			1000000.0) / ((double)total_time /
+			(double)rte_get_tsc_hz());
+	printf("TBS %.0f Time %.0f\n", tb_len_bits, 1000000.0 *
+			((double)total_time / (double)rte_get_tsc_hz()));
+
+	return TEST_SUCCESS;
+}
+
  static int
  throughput_pmd_lcore_ldpc_dec(void *arg)
  {
@@ -4193,7 +4371,7 @@ print_dec_bler(struct thread_params *t_params,

unsigned int used_cores)

app/test-bbdev/test_bbdev_perf.c print_dec_bler(struct thread_params *t_params, unsigned int used_cores)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +0 -1
  	total_bler /= used_cores;
  	total_iter /= used_cores;
 
-	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.1f Mbps

%s\n",

Quoted 16 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.3f Mbps
+%s\n",
  			snr, total_bler * 100, total_iter, get_iter_max(),
  			total_mbps, get_vector_filename());
  }
@@ -4245,6 +4423,10 @@ bler_test(struct active_device *ad,
  			&& !check_bit(test_vector.ldpc_dec.op_flags,
  			RTE_BBDEV_LDPC_LLR_COMPRESSION))
  		bler_function = bler_pmd_lcore_ldpc_dec;
+	else if ((test_vector.op_type == RTE_BBDEV_OP_TURBO_DEC) &&
+			!check_bit(test_vector.turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_SOFT_OUTPUT))
+		bler_function = bler_pmd_lcore_turbo_dec;
  	else
  		return TEST_SKIPPED;
 
#18 lore raw

Re: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Quoted 201 lines · Hernan
Quoted 201 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 4:20 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Quoted 5 lines · Hernan Vargas

New feature to add BLER support for 4G in bbdev-test.

---
   app/test-bbdev/test_bbdev_perf.c | 184

++++++++++++++++++++++++++++++-

app/test-bbdev/test_bbdev_perf.c gen_qm2_llr(int8_t *llrs, uint32_t j, double N0,

Quoted 8 lines
   1 file changed, 183 insertions(+), 1 deletion(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index ffb2de0604..69b86cdeb1 100644
@@ -1756,6 +1756,30 @@ gen_qm2_llr(int8_t *llrs, uint32_t j, double N0,

double llr_max)

Quoted 19 lines
app/test-bbdev/test_bbdev_perf.c +16 -0
   	llrs[j] = (int8_t) b;
   }
 
+/* Simple LLR generation assuming AWGN and QPSK */ static void
+gen_turbo_llr(int8_t *llrs, uint32_t j, double N0, double llr_max) {
+	double b, b1, n;
+	double coeff = 2.0 * sqrt(N0);
+
+	/* Ignore in vectors null LLRs not to be saturated */
+	if (llrs[j] == 0)
+		return;
+
+	/* Note don't change sign here */
+	n = randn(j % 2);
+	b1 = ((llrs[j] > 0 ? 2.0 : -2.0)
+			+ coeff * n) / N0;
+	b = b1 * (1 << 4);
+	b = round(b);
+	if (b > llr_max)

app/test-bbdev/test_bbdev_perf.c gen_qm2_llr(int8_t *llrs, uint32_t j, double N0, double llr_max)

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +6 -1
+		b = llr_max;
+	if (b < -llr_max)
+		b = -llr_max;
+	llrs[j] = (int8_t) b;
+}
+
   /* Generate LLR for a given SNR */
   static void
   generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs, @@
-1791,6 +1815,27 @@ generate_llr_input(uint16_t n, struct

rte_bbdev_op_data *inputs,

Quoted 15 lines
   	}
   }
app/test-bbdev/test_bbdev_perf.c +12 -0
+/* Generate LLR for turbo decoder for a given SNR */ static void
+generate_turbo_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
+		struct rte_bbdev_dec_op *ref_op)
+{
+	struct rte_mbuf *m;
+	uint32_t i, j, range;
+	double N0, llr_max;
+
+	llr_max = 127;
+	range = ref_op->turbo_dec.input.length;
+	N0 = 1.0 / pow(10.0, get_snr() / 10.0);
+

app/test-bbdev/test_bbdev_perf.c generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +8 -0
+	for (i = 0; i < n; ++i) {
+		m = inputs[i].data;
+		int8_t *llrs = rte_pktmbuf_mtod_offset(m, int8_t *, 0);
+		for (j = 0; j < range; ++j)
+			gen_turbo_llr(llrs, j, N0, llr_max);
+	}
+}
+
   static void
   copy_reference_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned

int n,

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op

Quoted 2 lines

unsigned int start_idx,

app/test-bbdev/test_bbdev_perf.c +0 -0
@@ -2301,6 +2346,31 @@ validate_ldpc_bler(struct rte_bbdev_dec_op

**ops, const uint16_t n)

Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +8 -0
   	return errors;
   }
 
+/* Check Number of code blocks errors */ static int
+validate_turbo_bler(struct rte_bbdev_dec_op **ops, const uint16_t n)
+{
+	unsigned int i;
+	struct op_data_entries *hard_data_orig =
+			&test_vector.entries[DATA_HARD_OUTPUT];
+	struct rte_bbdev_op_turbo_dec *ops_td;
+	struct rte_bbdev_op_data *hard_output;

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n) · line 2367

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+	int errors = 0;
+	struct rte_mbuf *m;
+
+	for (i = 0; i < n; ++i) {
+		ops_td = &ops[i]->turbo_dec;
+		hard_output = &ops_td->hard_output;
+		m = hard_output->data;
+		if (memcmp(rte_pktmbuf_mtod_offset(m, uint32_t *, 0),
+				hard_data_orig->segments[0].addr,
+				hard_data_orig->segments[0].length))

No need to check mbuf is at least as large as segment 0 length?

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n) · line 2376

Quoted 9 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+			errors++;
+	}
+	return errors;
+}
+
+
   static int
   validate_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
   		struct rte_bbdev_dec_op *ref_op, const int vector_mask)

@@ -3736,6

Quoted 33 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
+3806,114 @@ bler_pmd_lcore_ldpc_dec(void *arg)
   	return TEST_SUCCESS;
   }
app/test-bbdev/test_bbdev_perf.c +28 -0
+
+static int
+bler_pmd_lcore_turbo_dec(void *arg)
+{
+	struct thread_params *tp = arg;
+	uint16_t enq, deq;
+	uint64_t total_time = 0, start_time;
+	const uint16_t queue_id = tp->queue_id;
+	const uint16_t burst_sz = tp->op_params->burst_sz;
+	const uint16_t num_ops = tp->op_params->num_to_process;
+	struct rte_bbdev_dec_op *ops_enq[num_ops];
+	struct rte_bbdev_dec_op *ops_deq[num_ops];
+	struct rte_bbdev_dec_op *ref_op = tp->op_params->ref_dec_op;
+	struct test_buffers *bufs = NULL;
+	int i, j, ret;
+	struct rte_bbdev_info info;
+	uint16_t num_to_enq;
+
+	TEST_ASSERT_SUCCESS((burst_sz > MAX_BURST),
+			"BURST_SIZE should be <= %u", MAX_BURST);
+
+	rte_bbdev_info_get(tp->dev_id, &info);
+
+	TEST_ASSERT_SUCCESS((num_ops > info.drv.queue_size_lim),
+			"NUM_OPS cannot exceed %u for this device",
+			info.drv.queue_size_lim);
+
+	bufs = &tp->op_params-

q_bufs[GET_SOCKET(info.socket_id)][queue_id];

app/test-bbdev/test_bbdev_perf.c

Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +5 -0
+
+	rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START,
+__ATOMIC_RELAXED);
+
+	ret = rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops_enq,

num_ops);

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+	TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",

num_ops);

Quoted 26 lines
app/test-bbdev/test_bbdev_perf.c +11 -0
+
+	/* For BLER tests we need to enable early termination */
+	if (!check_bit(ref_op->turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_EARLY_TERMINATION))
+		ref_op->turbo_dec.op_flags +=
+				RTE_BBDEV_TURBO_EARLY_TERMINATION;
+	ref_op->turbo_dec.iter_max = get_iter_max();
+	ref_op->turbo_dec.iter_count = ref_op->turbo_dec.iter_max;
+
+	if (test_vector.op_type != RTE_BBDEV_OP_NONE)
+		copy_reference_dec_op(ops_enq, num_ops, 0, bufs-

inputs,

app/test-bbdev/test_bbdev_perf.c +14 -0
+				bufs->hard_outputs, bufs->soft_outputs,
+				ref_op);
+	generate_turbo_llr_input(num_ops, bufs->inputs, ref_op);
+
+	/* Set counter to validate the ordering */
+	for (j = 0; j < num_ops; ++j)
+		ops_enq[j]->opaque_data = (void *)(uintptr_t)j;
+
+	for (i = 0; i < 1; ++i) { /* Could add more iterations */
+		for (j = 0; j < num_ops; ++j) {
+			mbuf_reset(
+			ops_enq[j]->turbo_dec.hard_output.data);
+		}
+

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+		start_time = rte_rdtsc_precise();
+
+		for (enq = 0, deq = 0; enq < num_ops;) {
+			num_to_enq = burst_sz;
+
+			if (unlikely(num_ops - enq < num_to_enq))
+				num_to_enq = num_ops - enq;
+
+			enq += rte_bbdev_enqueue_dec_ops(tp->dev_id,
+					queue_id, &ops_enq[enq],

num_to_enq);

Quoted 3 lines
Quoted 2 lines

If for some reason the operation fails (looks like it can fail in at least ACC200 I checked), it ends up doing an endless loop as enc won't get incremented.

The python wrapper script used to invoke test-bbdev has a configurable timeout (default 600 seconds) that would stop the test in case it ends up in an infinite loop.

Ok, but having a timeout in the test script does not prevent to do a proprer error propagation/handling in the application.

It is happens in when running in a CI, having errors properly checked would provide useful information to investigate without having to reproduce, or when failing to reproduce.

Regards,
Maxime

Quoted 73 lines
Quoted 72 lines

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +3 -0
+
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq -

deq);

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+		}
+
+		/* dequeue the remaining */
+		while (deq < enq) {
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq -

deq);

Quoted 14 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+		}
+
+		total_time += rte_rdtsc_precise() - start_time;
+	}
+
+	tp->iter_count = 0;
+	tp->iter_average = 0;
+	/* get the max of iter_count for all dequeued ops */
+	for (i = 0; i < num_ops; ++i) {
+		tp->iter_count = RTE_MAX(ops_enq[i]-

turbo_dec.iter_count,

app/test-bbdev/test_bbdev_perf.c +2 -0
+				tp->iter_count);
+		tp->iter_average += (double) ops_enq[i]-

turbo_dec.iter_count;

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4 -0
+	}
+
+	tp->iter_average /= num_ops;
+	tp->bler = (double) validate_turbo_bler(ops_deq, num_ops) /

num_ops;

app/test-bbdev/test_bbdev_perf.c print_dec_bler(struct thread_params *t_params,

Quoted 19 lines
app/test-bbdev/test_bbdev_perf.c +15 -0
+
+	rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
+
+	double tb_len_bits = calc_dec_TB_size(ref_op);
+	tp->ops_per_sec = ((double)num_ops * 1) /
+			((double)total_time / (double)rte_get_tsc_hz());
+	tp->mbps = (((double)(num_ops * 1 * tb_len_bits)) /
+			1000000.0) / ((double)total_time /
+			(double)rte_get_tsc_hz());
+	printf("TBS %.0f Time %.0f\n", tb_len_bits, 1000000.0 *
+			((double)total_time / (double)rte_get_tsc_hz()));
+
+	return TEST_SUCCESS;
+}
+
   static int
   throughput_pmd_lcore_ldpc_dec(void *arg)
   {
@@ -4193,7 +4371,7 @@ print_dec_bler(struct thread_params *t_params,

unsigned int used_cores)

app/test-bbdev/test_bbdev_perf.c print_dec_bler(struct thread_params *t_params, unsigned int used_cores)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +0 -1
   	total_bler /= used_cores;
   	total_iter /= used_cores;
 
-	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.1f Mbps

%s\n",

Quoted 16 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.3f Mbps
+%s\n",
   			snr, total_bler * 100, total_iter, get_iter_max(),
   			total_mbps, get_vector_filename());
   }
@@ -4245,6 +4423,10 @@ bler_test(struct active_device *ad,
   			&& !check_bit(test_vector.ldpc_dec.op_flags,
   			RTE_BBDEV_LDPC_LLR_COMPRESSION))
   		bler_function = bler_pmd_lcore_ldpc_dec;
+	else if ((test_vector.op_type == RTE_BBDEV_OP_TURBO_DEC) &&
+			!check_bit(test_vector.turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_SOFT_OUTPUT))
+		bler_function = bler_pmd_lcore_turbo_dec;
   	else
   		return TEST_SKIPPED;
 
#19 lore raw

RE: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Hi Maxime,

Quoted 227 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Monday, February 20, 2023 9:44 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Quoted 61 lines · Hernan
Quoted 61 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 4:20 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Quoted 5 lines · Hernan Vargas

New feature to add BLER support for 4G in bbdev-test.

---
   app/test-bbdev/test_bbdev_perf.c | 184

++++++++++++++++++++++++++++++-

app/test-bbdev/test_bbdev_perf.c gen_qm2_llr(int8_t *llrs, uint32_t j, double · line 1756

Quoted 9 lines
   1 file changed, 183 insertions(+), 1 deletion(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index ffb2de0604..69b86cdeb1 100644
@@ -1756,6 +1756,30 @@ gen_qm2_llr(int8_t *llrs, uint32_t j, double
 N0,

double llr_max)

Quoted 28 lines
app/test-bbdev/test_bbdev_perf.c +22 -0
   	llrs[j] = (int8_t) b;
   }
 
+/* Simple LLR generation assuming AWGN and QPSK */ static void
+gen_turbo_llr(int8_t *llrs, uint32_t j, double N0, double llr_max) {
+	double b, b1, n;
+	double coeff = 2.0 * sqrt(N0);
+
+	/* Ignore in vectors null LLRs not to be saturated */
+	if (llrs[j] == 0)
+		return;
+
+	/* Note don't change sign here */
+	n = randn(j % 2);
+	b1 = ((llrs[j] > 0 ? 2.0 : -2.0)
+			+ coeff * n) / N0;
+	b = b1 * (1 << 4);
+	b = round(b);
+	if (b > llr_max)
+		b = llr_max;
+	if (b < -llr_max)
+		b = -llr_max;
+	llrs[j] = (int8_t) b;
+}
+
   /* Generate LLR for a given SNR */
   static void
   generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
Quoted 2 lines

@@
-1791,6 +1815,27 @@ generate_llr_input(uint16_t n, struct

rte_bbdev_op_data *inputs,

Quoted 5 lines
Quoted 5 lines

app/test-bbdev/test_bbdev_perf.c

Quoted 5 lines
   	}
   }
app/test-bbdev/test_bbdev_perf.c +2 -0
+/* Generate LLR for turbo decoder for a given SNR */ static void
+generate_turbo_llr_input(uint16_t n, struct rte_bbdev_op_data

*inputs,

Quoted 49 lines
Quoted 49 lines
Quoted 20 lines
app/test-bbdev/test_bbdev_perf.c +18 -0
+		struct rte_bbdev_dec_op *ref_op)
+{
+	struct rte_mbuf *m;
+	uint32_t i, j, range;
+	double N0, llr_max;
+
+	llr_max = 127;
+	range = ref_op->turbo_dec.input.length;
+	N0 = 1.0 / pow(10.0, get_snr() / 10.0);
+
+	for (i = 0; i < n; ++i) {
+		m = inputs[i].data;
+		int8_t *llrs = rte_pktmbuf_mtod_offset(m, int8_t *, 0);
+		for (j = 0; j < range; ++j)
+			gen_turbo_llr(llrs, j, N0, llr_max);
+	}
+}
+
   static void
   copy_reference_ldpc_dec_op(struct rte_bbdev_dec_op **ops,
Quoted 1 line

unsigned

int n,

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op

Quoted 2 lines

unsigned int start_idx,

app/test-bbdev/test_bbdev_perf.c +0 -0
@@ -2301,6 +2346,31 @@ validate_ldpc_bler(struct rte_bbdev_dec_op

**ops, const uint16_t n)

Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +8 -0
   	return errors;
   }
 
+/* Check Number of code blocks errors */ static int
+validate_turbo_bler(struct rte_bbdev_dec_op **ops, const uint16_t
+n) {
+	unsigned int i;
+	struct op_data_entries *hard_data_orig =
+			&test_vector.entries[DATA_HARD_OUTPUT];
+	struct rte_bbdev_op_turbo_dec *ops_td;
+	struct rte_bbdev_op_data *hard_output;

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n) · line 2367

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+	int errors = 0;
+	struct rte_mbuf *m;
+
+	for (i = 0; i < n; ++i) {
+		ops_td = &ops[i]->turbo_dec;
+		hard_output = &ops_td->hard_output;
+		m = hard_output->data;
+		if (memcmp(rte_pktmbuf_mtod_offset(m, uint32_t *, 0),
+				hard_data_orig->segments[0].addr,
+				hard_data_orig->segments[0].length))

No need to check mbuf is at least as large as segment 0 length?

Quoted 8 lines
Quoted 8 lines

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n)

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+			errors++;
+	}
+	return errors;
+}
+
+
   static int
   validate_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t

n,

Quoted 80 lines
Quoted 80 lines

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n) · line 2376

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -0
   		struct rte_bbdev_dec_op *ref_op, const int vector_mask)

@@ -3736,6

Quoted 32 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
+3806,114 @@ bler_pmd_lcore_ldpc_dec(void *arg)
   	return TEST_SUCCESS;
   }
app/test-bbdev/test_bbdev_perf.c +27 -0
+
+static int
+bler_pmd_lcore_turbo_dec(void *arg) {
+	struct thread_params *tp = arg;
+	uint16_t enq, deq;
+	uint64_t total_time = 0, start_time;
+	const uint16_t queue_id = tp->queue_id;
+	const uint16_t burst_sz = tp->op_params->burst_sz;
+	const uint16_t num_ops = tp->op_params->num_to_process;
+	struct rte_bbdev_dec_op *ops_enq[num_ops];
+	struct rte_bbdev_dec_op *ops_deq[num_ops];
+	struct rte_bbdev_dec_op *ref_op = tp->op_params->ref_dec_op;
+	struct test_buffers *bufs = NULL;
+	int i, j, ret;
+	struct rte_bbdev_info info;
+	uint16_t num_to_enq;
+
+	TEST_ASSERT_SUCCESS((burst_sz > MAX_BURST),
+			"BURST_SIZE should be <= %u", MAX_BURST);
+
+	rte_bbdev_info_get(tp->dev_id, &info);
+
+	TEST_ASSERT_SUCCESS((num_ops > info.drv.queue_size_lim),
+			"NUM_OPS cannot exceed %u for this device",
+			info.drv.queue_size_lim);
+
+	bufs = &tp->op_params-

q_bufs[GET_SOCKET(info.socket_id)][queue_id];

app/test-bbdev/test_bbdev_perf.c

Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +5 -0
+
+	rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START,
+__ATOMIC_RELAXED);
+
+	ret = rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops_enq,

num_ops);

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+	TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",

num_ops);

Quoted 26 lines
app/test-bbdev/test_bbdev_perf.c +11 -0
+
+	/* For BLER tests we need to enable early termination */
+	if (!check_bit(ref_op->turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_EARLY_TERMINATION))
+		ref_op->turbo_dec.op_flags +=
+				RTE_BBDEV_TURBO_EARLY_TERMINATION;
+	ref_op->turbo_dec.iter_max = get_iter_max();
+	ref_op->turbo_dec.iter_count = ref_op->turbo_dec.iter_max;
+
+	if (test_vector.op_type != RTE_BBDEV_OP_NONE)
+		copy_reference_dec_op(ops_enq, num_ops, 0, bufs-

inputs,

app/test-bbdev/test_bbdev_perf.c +14 -0
+				bufs->hard_outputs, bufs->soft_outputs,
+				ref_op);
+	generate_turbo_llr_input(num_ops, bufs->inputs, ref_op);
+
+	/* Set counter to validate the ordering */
+	for (j = 0; j < num_ops; ++j)
+		ops_enq[j]->opaque_data = (void *)(uintptr_t)j;
+
+	for (i = 0; i < 1; ++i) { /* Could add more iterations */
+		for (j = 0; j < num_ops; ++j) {
+			mbuf_reset(
+			ops_enq[j]->turbo_dec.hard_output.data);
+		}
+

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+		start_time = rte_rdtsc_precise();
+
+		for (enq = 0, deq = 0; enq < num_ops;) {
+			num_to_enq = burst_sz;
+
+			if (unlikely(num_ops - enq < num_to_enq))
+				num_to_enq = num_ops - enq;
+
+			enq += rte_bbdev_enqueue_dec_ops(tp->dev_id,
+					queue_id, &ops_enq[enq],

num_to_enq);

Quoted 2 lines
Quoted 2 lines

If for some reason the operation fails (looks like it can fail in at least ACC200 I checked), it ends up doing an endless loop as enc won't get

incremented.

Quoted 1 line

The python wrapper script used to invoke test-bbdev has a configurable

timeout (default 600 seconds) that would stop the test in case it ends up in an infinite loop.

Ok, but having a timeout in the test script does not prevent to do a proprer error propagation/handling in the application.

Quoted 7 lines

It is happens in when running in a CI, having errors properly checked would provide useful information to investigate without having to reproduce, or when failing to reproduce.

Regards,
Maxime

This is a good point for future improvement but not related to this series. We can implement it in the future. What do you think?

Thanks,
Hernan

Quoted 74 lines
Quoted 42 lines
Quoted 42 lines

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +3 -0
+
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq -

deq);

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+		}
+
+		/* dequeue the remaining */
+		while (deq < enq) {
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq -

deq);

Quoted 14 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+		}
+
+		total_time += rte_rdtsc_precise() - start_time;
+	}
+
+	tp->iter_count = 0;
+	tp->iter_average = 0;
+	/* get the max of iter_count for all dequeued ops */
+	for (i = 0; i < num_ops; ++i) {
+		tp->iter_count = RTE_MAX(ops_enq[i]-

turbo_dec.iter_count,

app/test-bbdev/test_bbdev_perf.c +2 -0
+				tp->iter_count);
+		tp->iter_average += (double) ops_enq[i]-

turbo_dec.iter_count;

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4 -0
+	}
+
+	tp->iter_average /= num_ops;
+	tp->bler = (double) validate_turbo_bler(ops_deq, num_ops) /

num_ops;

Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +11 -0
+
+	rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
+
+	double tb_len_bits = calc_dec_TB_size(ref_op);
+	tp->ops_per_sec = ((double)num_ops * 1) /
+			((double)total_time / (double)rte_get_tsc_hz());
+	tp->mbps = (((double)(num_ops * 1 * tb_len_bits)) /
+			1000000.0) / ((double)total_time /
+			(double)rte_get_tsc_hz());
+	printf("TBS %.0f Time %.0f\n", tb_len_bits, 1000000.0 *
+			((double)total_time / (double)rte_get_tsc_hz()));
Quoted 8 lines
Quoted 8 lines

app/test-bbdev/test_bbdev_perf.c print_dec_bler(struct thread_params

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +4 -0
+
+	return TEST_SUCCESS;
+}
+
   static int
   throughput_pmd_lcore_ldpc_dec(void *arg)
   {
@@ -4193,7 +4371,7 @@ print_dec_bler(struct thread_params

*t_params,

Quoted 23 lines
Quoted 22 lines

unsigned int used_cores)

app/test-bbdev/test_bbdev_perf.c print_dec_bler(struct thread_params *t_params, unsigned int used_cores)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +0 -1
   	total_bler /= used_cores;
   	total_iter /= used_cores;
 
-	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.1f Mbps

%s\n",

Quoted 16 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.3f Mbps
+%s\n",
   			snr, total_bler * 100, total_iter, get_iter_max(),
   			total_mbps, get_vector_filename());
   }
@@ -4245,6 +4423,10 @@ bler_test(struct active_device *ad,
   			&& !check_bit(test_vector.ldpc_dec.op_flags,
   			RTE_BBDEV_LDPC_LLR_COMPRESSION))
   		bler_function = bler_pmd_lcore_ldpc_dec;
+	else if ((test_vector.op_type == RTE_BBDEV_OP_TURBO_DEC) &&
+			!check_bit(test_vector.turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_SOFT_OUTPUT))
+		bler_function = bler_pmd_lcore_turbo_dec;
   	else
   		return TEST_SKIPPED;
 
#20 lore raw

Re: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Hi Hernan,

Quoted 233 lines · Hernan

Hi Maxime,

Quoted 231 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Monday, February 20, 2023 9:44 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Quoted 61 lines · Hernan
Quoted 61 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 4:20 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 07/13] test/bbdev: add support for BLER for 4G

Quoted 5 lines · Hernan Vargas

New feature to add BLER support for 4G in bbdev-test.

---
    app/test-bbdev/test_bbdev_perf.c | 184

++++++++++++++++++++++++++++++-

app/test-bbdev/test_bbdev_perf.c gen_qm2_llr(int8_t *llrs, uint32_t j, double · line 1756

Quoted 9 lines
    1 file changed, 183 insertions(+), 1 deletion(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index ffb2de0604..69b86cdeb1 100644
@@ -1756,6 +1756,30 @@ gen_qm2_llr(int8_t *llrs, uint32_t j, double
 N0,

double llr_max)

Quoted 28 lines
app/test-bbdev/test_bbdev_perf.c +22 -0
    	llrs[j] = (int8_t) b;
    }
 
+/* Simple LLR generation assuming AWGN and QPSK */ static void
+gen_turbo_llr(int8_t *llrs, uint32_t j, double N0, double llr_max) {
+	double b, b1, n;
+	double coeff = 2.0 * sqrt(N0);
+
+	/* Ignore in vectors null LLRs not to be saturated */
+	if (llrs[j] == 0)
+		return;
+
+	/* Note don't change sign here */
+	n = randn(j % 2);
+	b1 = ((llrs[j] > 0 ? 2.0 : -2.0)
+			+ coeff * n) / N0;
+	b = b1 * (1 << 4);
+	b = round(b);
+	if (b > llr_max)
+		b = llr_max;
+	if (b < -llr_max)
+		b = -llr_max;
+	llrs[j] = (int8_t) b;
+}
+
    /* Generate LLR for a given SNR */
    static void
    generate_llr_input(uint16_t n, struct rte_bbdev_op_data *inputs,
Quoted 2 lines

@@
-1791,6 +1815,27 @@ generate_llr_input(uint16_t n, struct

rte_bbdev_op_data *inputs,

Quoted 5 lines
Quoted 5 lines

app/test-bbdev/test_bbdev_perf.c

Quoted 5 lines
    	}
    }
app/test-bbdev/test_bbdev_perf.c +2 -0
+/* Generate LLR for turbo decoder for a given SNR */ static void
+generate_turbo_llr_input(uint16_t n, struct rte_bbdev_op_data

*inputs,

Quoted 49 lines
Quoted 49 lines
Quoted 20 lines
app/test-bbdev/test_bbdev_perf.c +18 -0
+		struct rte_bbdev_dec_op *ref_op)
+{
+	struct rte_mbuf *m;
+	uint32_t i, j, range;
+	double N0, llr_max;
+
+	llr_max = 127;
+	range = ref_op->turbo_dec.input.length;
+	N0 = 1.0 / pow(10.0, get_snr() / 10.0);
+
+	for (i = 0; i < n; ++i) {
+		m = inputs[i].data;
+		int8_t *llrs = rte_pktmbuf_mtod_offset(m, int8_t *, 0);
+		for (j = 0; j < range; ++j)
+			gen_turbo_llr(llrs, j, N0, llr_max);
+	}
+}
+
    static void
    copy_reference_ldpc_dec_op(struct rte_bbdev_dec_op **ops,
Quoted 1 line

unsigned

int n,

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op

Quoted 2 lines

unsigned int start_idx,

app/test-bbdev/test_bbdev_perf.c +0 -0
@@ -2301,6 +2346,31 @@ validate_ldpc_bler(struct rte_bbdev_dec_op

**ops, const uint16_t n)

Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +8 -0
    	return errors;
    }
 
+/* Check Number of code blocks errors */ static int
+validate_turbo_bler(struct rte_bbdev_dec_op **ops, const uint16_t
+n) {
+	unsigned int i;
+	struct op_data_entries *hard_data_orig =
+			&test_vector.entries[DATA_HARD_OUTPUT];
+	struct rte_bbdev_op_turbo_dec *ops_td;
+	struct rte_bbdev_op_data *hard_output;

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n) · line 2367

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+	int errors = 0;
+	struct rte_mbuf *m;
+
+	for (i = 0; i < n; ++i) {
+		ops_td = &ops[i]->turbo_dec;
+		hard_output = &ops_td->hard_output;
+		m = hard_output->data;
+		if (memcmp(rte_pktmbuf_mtod_offset(m, uint32_t *, 0),
+				hard_data_orig->segments[0].addr,
+				hard_data_orig->segments[0].length))

No need to check mbuf is at least as large as segment 0 length?

Quoted 8 lines
Quoted 8 lines

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n)

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+			errors++;
+	}
+	return errors;
+}
+
+
    static int
    validate_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t

n,

Quoted 80 lines
Quoted 80 lines

app/test-bbdev/test_bbdev_perf.c validate_ldpc_bler(struct rte_bbdev_dec_op **ops, const uint16_t n) · line 2376

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -0
    		struct rte_bbdev_dec_op *ref_op, const int vector_mask)

@@ -3736,6

Quoted 32 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
+3806,114 @@ bler_pmd_lcore_ldpc_dec(void *arg)
    	return TEST_SUCCESS;
    }
app/test-bbdev/test_bbdev_perf.c +27 -0
+
+static int
+bler_pmd_lcore_turbo_dec(void *arg) {
+	struct thread_params *tp = arg;
+	uint16_t enq, deq;
+	uint64_t total_time = 0, start_time;
+	const uint16_t queue_id = tp->queue_id;
+	const uint16_t burst_sz = tp->op_params->burst_sz;
+	const uint16_t num_ops = tp->op_params->num_to_process;
+	struct rte_bbdev_dec_op *ops_enq[num_ops];
+	struct rte_bbdev_dec_op *ops_deq[num_ops];
+	struct rte_bbdev_dec_op *ref_op = tp->op_params->ref_dec_op;
+	struct test_buffers *bufs = NULL;
+	int i, j, ret;
+	struct rte_bbdev_info info;
+	uint16_t num_to_enq;
+
+	TEST_ASSERT_SUCCESS((burst_sz > MAX_BURST),
+			"BURST_SIZE should be <= %u", MAX_BURST);
+
+	rte_bbdev_info_get(tp->dev_id, &info);
+
+	TEST_ASSERT_SUCCESS((num_ops > info.drv.queue_size_lim),
+			"NUM_OPS cannot exceed %u for this device",
+			info.drv.queue_size_lim);
+
+	bufs = &tp->op_params-

q_bufs[GET_SOCKET(info.socket_id)][queue_id];

app/test-bbdev/test_bbdev_perf.c

Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +5 -0
+
+	rte_wait_until_equal_16(&tp->op_params->sync, SYNC_START,
+__ATOMIC_RELAXED);
+
+	ret = rte_bbdev_dec_op_alloc_bulk(tp->op_params->mp, ops_enq,

num_ops);

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+	TEST_ASSERT_SUCCESS(ret, "Allocation failed for %d ops",

num_ops);

Quoted 26 lines
app/test-bbdev/test_bbdev_perf.c +11 -0
+
+	/* For BLER tests we need to enable early termination */
+	if (!check_bit(ref_op->turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_EARLY_TERMINATION))
+		ref_op->turbo_dec.op_flags +=
+				RTE_BBDEV_TURBO_EARLY_TERMINATION;
+	ref_op->turbo_dec.iter_max = get_iter_max();
+	ref_op->turbo_dec.iter_count = ref_op->turbo_dec.iter_max;
+
+	if (test_vector.op_type != RTE_BBDEV_OP_NONE)
+		copy_reference_dec_op(ops_enq, num_ops, 0, bufs-

inputs,

app/test-bbdev/test_bbdev_perf.c +14 -0
+				bufs->hard_outputs, bufs->soft_outputs,
+				ref_op);
+	generate_turbo_llr_input(num_ops, bufs->inputs, ref_op);
+
+	/* Set counter to validate the ordering */
+	for (j = 0; j < num_ops; ++j)
+		ops_enq[j]->opaque_data = (void *)(uintptr_t)j;
+
+	for (i = 0; i < 1; ++i) { /* Could add more iterations */
+		for (j = 0; j < num_ops; ++j) {
+			mbuf_reset(
+			ops_enq[j]->turbo_dec.hard_output.data);
+		}
+

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+		start_time = rte_rdtsc_precise();
+
+		for (enq = 0, deq = 0; enq < num_ops;) {
+			num_to_enq = burst_sz;
+
+			if (unlikely(num_ops - enq < num_to_enq))
+				num_to_enq = num_ops - enq;
+
+			enq += rte_bbdev_enqueue_dec_ops(tp->dev_id,
+					queue_id, &ops_enq[enq],

num_to_enq);

Quoted 2 lines
Quoted 2 lines

If for some reason the operation fails (looks like it can fail in at least ACC200 I checked), it ends up doing an endless loop as enc won't get

incremented.

Quoted 1 line

The python wrapper script used to invoke test-bbdev has a configurable

timeout (default 600 seconds) that would stop the test in case it ends up in an infinite loop.

Ok, but having a timeout in the test script does not prevent to do a proprer error propagation/handling in the application.

It is happens in when running in a CI, having errors properly checked would provide useful information to investigate without having to reproduce, or when failing to reproduce.

Quoted 5 lines
Quoted 3 lines

Regards,
Maxime

This is a good point for future improvement but not related to this series. We can implement it in the future. What do you think?

This patch is introducing a new feature, there is a bug in this exact feature. So this should be fixed in this patch, not in a future release.

Thanks,
Maxime

Quoted 77 lines

Thanks,
Hernan

Quoted 74 lines
Quoted 42 lines
Quoted 42 lines

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +3 -0
+
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq -

deq);

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+		}
+
+		/* dequeue the remaining */
+		while (deq < enq) {
+			deq += rte_bbdev_dequeue_dec_ops(tp->dev_id,
+					queue_id, &ops_deq[deq], enq -

deq);

Quoted 14 lines
app/test-bbdev/test_bbdev_perf.c +10 -0
+		}
+
+		total_time += rte_rdtsc_precise() - start_time;
+	}
+
+	tp->iter_count = 0;
+	tp->iter_average = 0;
+	/* get the max of iter_count for all dequeued ops */
+	for (i = 0; i < num_ops; ++i) {
+		tp->iter_count = RTE_MAX(ops_enq[i]-

turbo_dec.iter_count,

app/test-bbdev/test_bbdev_perf.c +2 -0
+				tp->iter_count);
+		tp->iter_average += (double) ops_enq[i]-

turbo_dec.iter_count;

app/test-bbdev/test_bbdev_perf.c bler_pmd_lcore_ldpc_dec(void *arg)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +4 -0
+	}
+
+	tp->iter_average /= num_ops;
+	tp->bler = (double) validate_turbo_bler(ops_deq, num_ops) /

num_ops;

Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +11 -0
+
+	rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
+
+	double tb_len_bits = calc_dec_TB_size(ref_op);
+	tp->ops_per_sec = ((double)num_ops * 1) /
+			((double)total_time / (double)rte_get_tsc_hz());
+	tp->mbps = (((double)(num_ops * 1 * tb_len_bits)) /
+			1000000.0) / ((double)total_time /
+			(double)rte_get_tsc_hz());
+	printf("TBS %.0f Time %.0f\n", tb_len_bits, 1000000.0 *
+			((double)total_time / (double)rte_get_tsc_hz()));
Quoted 8 lines
Quoted 8 lines

app/test-bbdev/test_bbdev_perf.c print_dec_bler(struct thread_params

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +4 -0
+
+	return TEST_SUCCESS;
+}
+
    static int
    throughput_pmd_lcore_ldpc_dec(void *arg)
    {
@@ -4193,7 +4371,7 @@ print_dec_bler(struct thread_params

*t_params,

Quoted 23 lines
Quoted 22 lines

unsigned int used_cores)

app/test-bbdev/test_bbdev_perf.c print_dec_bler(struct thread_params *t_params, unsigned int used_cores)

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +0 -1
    	total_bler /= used_cores;
    	total_iter /= used_cores;
 
-	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.1f Mbps

%s\n",

Quoted 16 lines
app/test-bbdev/test_bbdev_perf.c +6 -0
+	printf("SNR %.2f BLER %.1f %% - Iterations %.1f %d - Tp %.3f Mbps
+%s\n",
    			snr, total_bler * 100, total_iter, get_iter_max(),
    			total_mbps, get_vector_filename());
    }
@@ -4245,6 +4423,10 @@ bler_test(struct active_device *ad,
    			&& !check_bit(test_vector.ldpc_dec.op_flags,
    			RTE_BBDEV_LDPC_LLR_COMPRESSION))
    		bler_function = bler_pmd_lcore_ldpc_dec;
+	else if ((test_vector.op_type == RTE_BBDEV_OP_TURBO_DEC) &&
+			!check_bit(test_vector.turbo_dec.op_flags,
+			RTE_BBDEV_TURBO_SOFT_OUTPUT))
+		bler_function = bler_pmd_lcore_turbo_dec;
    	else
    		return TEST_SKIPPED;
 
#21 lore raw

PATCH 8/13 test/bbdev: extend support for large TB

In reply to Hernan Vargas

Add support for large TB when it cannot fit into a true mbuf.

---
 app/test-bbdev/test_bbdev_perf.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
app/test-bbdev/test_bbdev_perf.c +12 -9
index 69b86cdeb1..fdf7a28ba2 100644
@@ -1072,8 +1072,6 @@ init_op_data_objs(struct rte_bbdev_op_data *bufs,
 			 * Special case when DPDK mbuf cannot handle
 			 * the required input size
 			 */
-			printf("Warning: Larger input size than DPDK mbuf %d\n",
-					seg->length);
 			large_input = true;
 		}
 		bufs[i].data = m_head;
@@ -2030,6 +2028,7 @@ validate_op_chain(struct rte_bbdev_op_data *op,
 	struct rte_mbuf *m = op->data;
 	uint8_t nb_dst_segments = orig_op->nb_segments;
 	uint32_t total_data_size = 0;
+	bool ignore_mbuf = false; /* ignore mbuf limitations */
 
 	TEST_ASSERT(nb_dst_segments == m->nb_segs,
 			"Number of segments differ in original (%u) and filled (%u) op",
@@ -2042,21 +2041,25 @@ validate_op_chain(struct rte_bbdev_op_data *op,
 		uint16_t data_len = rte_pktmbuf_data_len(m) - offset;
 		total_data_size += orig_op->segments[i].length;
 
-		TEST_ASSERT(orig_op->segments[i].length == data_len,
-				"Length of segment differ in original (%u) and filled (%u) op",
-				orig_op->segments[i].length, data_len);
+		if (orig_op->segments[i].length > RTE_BBDEV_LDPC_E_MAX_MBUF)
+			ignore_mbuf = true;
+		if (!ignore_mbuf)
+			TEST_ASSERT(orig_op->segments[i].length == data_len,
+					"Length of segment differ in original (%u) and filled (%u) op",
+					orig_op->segments[i].length, data_len);
 		TEST_ASSERT_BUFFERS_ARE_EQUAL(orig_op->segments[i].addr,
 				rte_pktmbuf_mtod_offset(m, uint32_t *, offset),
-				data_len,
+				orig_op->segments[i].length,
 				"Output buffers (CB=%u) are not equal", i);
 		m = m->next;
 	}
 
 	/* Validate total mbuf pkt length */
 	uint32_t pkt_len = rte_pktmbuf_pkt_len(op->data) - op->offset;
-	TEST_ASSERT(total_data_size == pkt_len,
-			"Length of data differ in original (%u) and filled (%u) op",
-			total_data_size, pkt_len);
+	if (!ignore_mbuf)
+		TEST_ASSERT(total_data_size == pkt_len,
+				"Length of data differ in original (%u) and filled (%u) op",
+				total_data_size, pkt_len);
 
 	return TEST_SUCCESS;
 }
Signature · 1 line
2.37.1
#22 lore raw

Re: [PATCH v1 08/13] test/bbdev: extend support for large TB

Quoted 35 lines · Hernan Vargas

Add support for large TB when it cannot fit into a true mbuf.

---
  app/test-bbdev/test_bbdev_perf.c | 21 ++++++++++++---------
  1 file changed, 12 insertions(+), 9 deletions(-)
app/test-bbdev/test_bbdev_perf.c +1 -5
index 69b86cdeb1..fdf7a28ba2 100644
@@ -1072,8 +1072,6 @@ init_op_data_objs(struct rte_bbdev_op_data *bufs,
  			 * Special case when DPDK mbuf cannot handle
  			 * the required input size
  			 */
-			printf("Warning: Larger input size than DPDK mbuf %d\n",
-					seg->length);
  			large_input = true;
  		}
  		bufs[i].data = m_head;
@@ -2030,6 +2028,7 @@ validate_op_chain(struct rte_bbdev_op_data *op,
  	struct rte_mbuf *m = op->data;
  	uint8_t nb_dst_segments = orig_op->nb_segments;
  	uint32_t total_data_size = 0;
+	bool ignore_mbuf = false; /* ignore mbuf limitations */
 
  	TEST_ASSERT(nb_dst_segments == m->nb_segs,
  			"Number of segments differ in original (%u) and filled (%u) op",
@@ -2042,21 +2041,25 @@ validate_op_chain(struct rte_bbdev_op_data *op,
  		uint16_t data_len = rte_pktmbuf_data_len(m) - offset;
  		total_data_size += orig_op->segments[i].length;
 
-		TEST_ASSERT(orig_op->segments[i].length == data_len,
-				"Length of segment differ in original (%u) and filled (%u) op",
-				orig_op->segments[i].length, data_len);

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op, · line 2052

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +7 -1
+		if (orig_op->segments[i].length > RTE_BBDEV_LDPC_E_MAX_MBUF)
+			ignore_mbuf = true;
+		if (!ignore_mbuf)
+			TEST_ASSERT(orig_op->segments[i].length == data_len,
+					"Length of segment differ in original (%u) and filled (%u) op",
+					orig_op->segments[i].length, data_len);
  		TEST_ASSERT_BUFFERS_ARE_EQUAL(orig_op->segments[i].addr,
  				rte_pktmbuf_mtod_offset(m, uint32_t *, offset),
-				data_len,
+				orig_op->segments[i].length,

Isn't it ending up in performing out of bounds access in the mbuf?

Quoted 16 lines
app/test-bbdev/test_bbdev_perf.c +4 -3
  				"Output buffers (CB=%u) are not equal", i);
  		m = m->next;
  	}
 
  	/* Validate total mbuf pkt length */
  	uint32_t pkt_len = rte_pktmbuf_pkt_len(op->data) - op->offset;
-	TEST_ASSERT(total_data_size == pkt_len,
-			"Length of data differ in original (%u) and filled (%u) op",
-			total_data_size, pkt_len);
+	if (!ignore_mbuf)
+		TEST_ASSERT(total_data_size == pkt_len,
+				"Length of data differ in original (%u) and filled (%u) op",
+				total_data_size, pkt_len);
 
  	return TEST_SUCCESS;
  }
#23 lore raw

RE: [PATCH v1 08/13] test/bbdev: extend support for large TB

Hi Maxime,

Quoted 64 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 5:29 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 08/13] test/bbdev: extend support for large TB

app/test-bbdev/test_bbdev_perf.c init_op_data_objs(struct rte_bbdev_op_data

Quoted 13 lines · Hernan Vargas

Add support for large TB when it cannot fit into a true mbuf.

---
  app/test-bbdev/test_bbdev_perf.c | 21 ++++++++++++---------
  1 file changed, 12 insertions(+), 9 deletions(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index 69b86cdeb1..fdf7a28ba2 100644
@@ -1072,8 +1072,6 @@ init_op_data_objs(struct rte_bbdev_op_data

*bufs,

app/test-bbdev/test_bbdev_perf.c init_op_data_objs(struct rte_bbdev_op_data *bufs,

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +0 -1
  			 * Special case when DPDK mbuf cannot handle
  			 * the required input size
  			 */
-			printf("Warning: Larger input size than DPDK mbuf

%d\n",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data

Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +0 -1
-					seg->length);
  			large_input = true;
  		}
  		bufs[i].data = m_head;
@@ -2030,6 +2028,7 @@ validate_op_chain(struct rte_bbdev_op_data

*op,

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 7 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
  	struct rte_mbuf *m = op->data;
  	uint8_t nb_dst_segments = orig_op->nb_segments;
  	uint32_t total_data_size = 0;
+	bool ignore_mbuf = false; /* ignore mbuf limitations */
 
  	TEST_ASSERT(nb_dst_segments == m->nb_segs,
  			"Number of segments differ in original (%u) and filled

(%u) op",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -0
@@ -2042,21 +2041,25 @@ validate_op_chain(struct rte_bbdev_op_data

*op,

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +0 -2
  		uint16_t data_len = rte_pktmbuf_data_len(m) - offset;
  		total_data_size += orig_op->segments[i].length;
 
-		TEST_ASSERT(orig_op->segments[i].length == data_len,
-				"Length of segment differ in original (%u) and

filled (%u) op",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data · line 2044

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
-				orig_op->segments[i].length, data_len);
+		if (orig_op->segments[i].length >

RTE_BBDEV_LDPC_E_MAX_MBUF)

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3 -0
+			ignore_mbuf = true;
+		if (!ignore_mbuf)
+			TEST_ASSERT(orig_op->segments[i].length ==

data_len,

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data · line 2048

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+					"Length of segment differ in original

(%u) and filled (%u) op",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op, · line 2052

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+					orig_op->segments[i].length,

data_len);

Quoted 8 lines

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data · line 2052

Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
  		TEST_ASSERT_BUFFERS_ARE_EQUAL(orig_op-
 segments[i].addr,
  				rte_pktmbuf_mtod_offset(m, uint32_t *,

offset),

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op, · line 2052

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
-				data_len,
+				orig_op->segments[i].length,

Isn't it ending up in performing out of bounds access in the mbuf?

No, in the case when ignore_mbuf is set to true, we use a "fake" mbuf allocated in memory with rte_malloc. The size allocated is segments[i].length.
Thanks

Quoted 18 lines

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +0 -2
  				"Output buffers (CB=%u) are not equal", i);
  		m = m->next;
  	}
 
  	/* Validate total mbuf pkt length */
  	uint32_t pkt_len = rte_pktmbuf_pkt_len(op->data) - op->offset;
-	TEST_ASSERT(total_data_size == pkt_len,
-			"Length of data differ in original (%u) and filled (%u)

op",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +3 -1
-			total_data_size, pkt_len);
+	if (!ignore_mbuf)
+		TEST_ASSERT(total_data_size == pkt_len,
+				"Length of data differ in original (%u) and

filled (%u) op",

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
+				total_data_size, pkt_len);
 
  	return TEST_SUCCESS;
  }
#24 lore raw

Re: [PATCH v1 08/13] test/bbdev: extend support for large TB

Quoted 69 lines · Hernan

Hi Maxime,

Quoted 67 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 5:29 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 08/13] test/bbdev: extend support for large TB

app/test-bbdev/test_bbdev_perf.c init_op_data_objs(struct rte_bbdev_op_data

Quoted 13 lines · Hernan Vargas

Add support for large TB when it cannot fit into a true mbuf.

---
   app/test-bbdev/test_bbdev_perf.c | 21 ++++++++++++---------
   1 file changed, 12 insertions(+), 9 deletions(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index 69b86cdeb1..fdf7a28ba2 100644
@@ -1072,8 +1072,6 @@ init_op_data_objs(struct rte_bbdev_op_data

*bufs,

app/test-bbdev/test_bbdev_perf.c init_op_data_objs(struct rte_bbdev_op_data *bufs,

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +0 -1
   			 * Special case when DPDK mbuf cannot handle
   			 * the required input size
   			 */
-			printf("Warning: Larger input size than DPDK mbuf

%d\n",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data

Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +0 -1
-					seg->length);
   			large_input = true;
   		}
   		bufs[i].data = m_head;
@@ -2030,6 +2028,7 @@ validate_op_chain(struct rte_bbdev_op_data

*op,

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 7 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
   	struct rte_mbuf *m = op->data;
   	uint8_t nb_dst_segments = orig_op->nb_segments;
   	uint32_t total_data_size = 0;
+	bool ignore_mbuf = false; /* ignore mbuf limitations */
 
   	TEST_ASSERT(nb_dst_segments == m->nb_segs,
   			"Number of segments differ in original (%u) and filled

(%u) op",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -0
@@ -2042,21 +2041,25 @@ validate_op_chain(struct rte_bbdev_op_data

*op,

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +0 -2
   		uint16_t data_len = rte_pktmbuf_data_len(m) - offset;
   		total_data_size += orig_op->segments[i].length;
 
-		TEST_ASSERT(orig_op->segments[i].length == data_len,
-				"Length of segment differ in original (%u) and

filled (%u) op",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data · line 2044

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
-				orig_op->segments[i].length, data_len);
+		if (orig_op->segments[i].length >

RTE_BBDEV_LDPC_E_MAX_MBUF)

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +3 -0
+			ignore_mbuf = true;
+		if (!ignore_mbuf)
+			TEST_ASSERT(orig_op->segments[i].length ==

data_len,

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data · line 2048

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+					"Length of segment differ in original

(%u) and filled (%u) op",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op, · line 2052

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+					orig_op->segments[i].length,

data_len);

Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
   		TEST_ASSERT_BUFFERS_ARE_EQUAL(orig_op-
 segments[i].addr,
   				rte_pktmbuf_mtod_offset(m, uint32_t *,
Quoted 8 lines
Quoted 5 lines

offset),

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op, · line 2052

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
-				data_len,
+				orig_op->segments[i].length,

Isn't it ending up in performing out of bounds access in the mbuf?

No, in the case when ignore_mbuf is set to true, we use a "fake" mbuf allocated in memory with rte_malloc. The size allocated is segments[i].length.

Ok.

Thanks,
Maxime

Quoted 21 lines

Thanks

Quoted 18 lines

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 8 lines
app/test-bbdev/test_bbdev_perf.c +0 -2
   				"Output buffers (CB=%u) are not equal", i);
   		m = m->next;
   	}
 
   	/* Validate total mbuf pkt length */
   	uint32_t pkt_len = rte_pktmbuf_pkt_len(op->data) - op->offset;
-	TEST_ASSERT(total_data_size == pkt_len,
-			"Length of data differ in original (%u) and filled (%u)

op",

app/test-bbdev/test_bbdev_perf.c validate_op_chain(struct rte_bbdev_op_data *op,

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +3 -1
-			total_data_size, pkt_len);
+	if (!ignore_mbuf)
+		TEST_ASSERT(total_data_size == pkt_len,
+				"Length of data differ in original (%u) and

filled (%u) op",

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
+				total_data_size, pkt_len);
 
   	return TEST_SUCCESS;
   }
#25 lore raw

PATCH 9/13 test/bbdev: bbdev-test cannot compare some scenarios

In reply to Hernan Vargas

Updating logic for compression usecases.

---
 app/test-bbdev/test_bbdev_perf.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
app/test-bbdev/test_bbdev_perf.c +7 -2
index fdf7a28ba2..3b2578baf6 100644
@@ -2143,12 +2143,17 @@ validate_op_harq_chain(struct rte_bbdev_op_data *op,
 		total_data_size += orig_op->segments[i].length;
 
 		TEST_ASSERT(orig_op->segments[i].length <
-				(uint32_t)(data_len + 64),
+				(uint32_t)(data_len + 256),
 				"Length of segment differ in original (%u) and filled (%u) op",
 				orig_op->segments[i].length, data_len);
 		harq_orig = (int8_t *) orig_op->segments[i].addr;
 		harq_out = rte_pktmbuf_mtod_offset(m, int8_t *, offset);
 
+		/* Cannot compare HARQ output data for such cases */
+		if ((ldpc_llr_decimals > 1) && ((ops_ld->op_flags & RTE_BBDEV_LDPC_LLR_COMPRESSION)
+				|| (ops_ld->op_flags & RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION)))
+			break;
+
 		if (!(ldpc_cap_flags &
 				RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS
 				) || (ops_ld->op_flags &
@@ -2224,7 +2229,7 @@ validate_op_harq_chain(struct rte_bbdev_op_data *op,
 
 	/* Validate total mbuf pkt length */
 	uint32_t pkt_len = rte_pktmbuf_pkt_len(op->data) - op->offset;
-	TEST_ASSERT(total_data_size < pkt_len + 64,
+	TEST_ASSERT(total_data_size < pkt_len + 256,
 			"Length of data differ in original (%u) and filled (%u) op",
 			total_data_size, pkt_len);
 
Signature · 1 line
2.37.1
#26 lore raw

Re: [PATCH v1 09/13] test/bbdev: bbdev-test cannot compare some scenarios

Quoted 12 lines · Hernan Vargas

Updating logic for compression usecases.

---
  app/test-bbdev/test_bbdev_perf.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index fdf7a28ba2..3b2578baf6 100644

app/test-bbdev/test_bbdev_perf.c validate_op_harq_chain(struct rte_bbdev_op_data *op, · line 2146

Quoted 5 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
@@ -2143,12 +2143,17 @@ validate_op_harq_chain(struct rte_bbdev_op_data *op,
  		total_data_size += orig_op->segments[i].length;
 
  		TEST_ASSERT(orig_op->segments[i].length <
-				(uint32_t)(data_len + 64),
+				(uint32_t)(data_len + 256),

Where is that value coming from?
It lacks explanations in my opinion, and the patch looks like a fix but is not tagged as one.

Quoted 22 lines
app/test-bbdev/test_bbdev_perf.c +6 -1
  				"Length of segment differ in original (%u) and filled (%u) op",
  				orig_op->segments[i].length, data_len);
  		harq_orig = (int8_t *) orig_op->segments[i].addr;
  		harq_out = rte_pktmbuf_mtod_offset(m, int8_t *, offset);
 
+		/* Cannot compare HARQ output data for such cases */
+		if ((ldpc_llr_decimals > 1) && ((ops_ld->op_flags & RTE_BBDEV_LDPC_LLR_COMPRESSION)
+				|| (ops_ld->op_flags & RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION)))
+			break;
+
  		if (!(ldpc_cap_flags &
  				RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS
  				) || (ops_ld->op_flags &
@@ -2224,7 +2229,7 @@ validate_op_harq_chain(struct rte_bbdev_op_data *op,
 
  	/* Validate total mbuf pkt length */
  	uint32_t pkt_len = rte_pktmbuf_pkt_len(op->data) - op->offset;
-	TEST_ASSERT(total_data_size < pkt_len + 64,
+	TEST_ASSERT(total_data_size < pkt_len + 256,
  			"Length of data differ in original (%u) and filled (%u) op",
  			total_data_size, pkt_len);
 
#27 lore raw

RE: [PATCH v1 09/13] test/bbdev: bbdev-test cannot compare some scenarios

Hi Maxime,

Quoted 29 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 4:16 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 09/13] test/bbdev: bbdev-test cannot compare some scenarios

app/test-bbdev/test_bbdev_perf.c validate_op_harq_chain(struct

Quoted 13 lines · Hernan Vargas

Updating logic for compression usecases.

---
  app/test-bbdev/test_bbdev_perf.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index fdf7a28ba2..3b2578baf6 100644
@@ -2143,12 +2143,17 @@ validate_op_harq_chain(struct

rte_bbdev_op_data *op,

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
  		total_data_size += orig_op->segments[i].length;
 
Quoted 7 lines

app/test-bbdev/test_bbdev_perf.c validate_op_harq_chain(struct rte_bbdev_op_data *op, · line 2146

Quoted 3 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
  		TEST_ASSERT(orig_op->segments[i].length <
-				(uint32_t)(data_len + 64),
+				(uint32_t)(data_len + 256),

Where is that value coming from?
It lacks explanations in my opinion, and the patch looks like a fix but is not tagged as one.

This is a tolerance as different implementations have different assumptions with regards to the HARQ size explicitly stored in memory (some data may be optimized out or having different alignment assumptions). Hence the check includes some tolerance specific to that buffer. That tolerance is extended to cover different implementations.
An #define will be used now instead of a magic number HARQ_MEM_TOLERANCE

I don’t believe it is critical to be backported. Still it would not harm to add the fix tag.

Thanks

Quoted 30 lines

app/test-bbdev/test_bbdev_perf.c validate_op_harq_chain(struct · line 2147

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
  				"Length of segment differ in original (%u) and

filled (%u) op",

app/test-bbdev/test_bbdev_perf.c validate_op_harq_chain(struct rte_bbdev_op_data *op,

Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c +2 -0
  				orig_op->segments[i].length, data_len);
  		harq_orig = (int8_t *) orig_op->segments[i].addr;
  		harq_out = rte_pktmbuf_mtod_offset(m, int8_t *, offset);
 
+		/* Cannot compare HARQ output data for such cases */
+		if ((ldpc_llr_decimals > 1) && ((ops_ld->op_flags &

RTE_BBDEV_LDPC_LLR_COMPRESSION)

app/test-bbdev/test_bbdev_perf.c validate_op_harq_chain(struct · line 2154

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +1 -0
+				|| (ops_ld->op_flags &

RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION)))

app/test-bbdev/test_bbdev_perf.c validate_op_harq_chain(struct rte_bbdev_op_data *op,

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +2 -0
+			break;
+
  		if (!(ldpc_cap_flags &
 

RTE_BBDEV_LDPC_INTERNAL_HARQ_MEMORY_FILLERS

app/test-bbdev/test_bbdev_perf.c validate_op_harq_chain(struct

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
  				) || (ops_ld->op_flags &
@@ -2224,7 +2229,7 @@ validate_op_harq_chain(struct

rte_bbdev_op_data

app/test-bbdev/test_bbdev_perf.c validate_op_harq_chain(struct rte_bbdev_op_data *op,

Quoted 7 lines
app/test-bbdev/test_bbdev_perf.c +1 -1
 *op,
 
  	/* Validate total mbuf pkt length */
  	uint32_t pkt_len = rte_pktmbuf_pkt_len(op->data) - op->offset;
-	TEST_ASSERT(total_data_size < pkt_len + 64,
+	TEST_ASSERT(total_data_size < pkt_len + 256,
  			"Length of data differ in original (%u) and filled (%u)

op",

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
  			total_data_size, pkt_len);
#28 lore raw

PATCH 10/13 test/bbdev: adjustment for soft output

In reply to Hernan Vargas

Extend bbdev-test for soft output check, notably due to the logic in bbdev-test to enable termination changing.

---
 app/test-bbdev/test_bbdev_perf.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
app/test-bbdev/test_bbdev_perf.c +13 -13
index 3b2578baf6..1d18d9e054 100644
@@ -1348,6 +1348,7 @@ fill_queue_buffers(struct test_op_params *op_params,
 				RTE_BBDEV_LDPC_LLR_COMPRESSION;
 		bool harq_comp = op_params->ref_dec_op->ldpc_dec.op_flags &
 				RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION;
+
 		ldpc_llr_decimals = capabilities->cap.ldpc_dec.llr_decimals;
 		ldpc_llr_size = capabilities->cap.ldpc_dec.llr_size;
 		ldpc_cap_flags = capabilities->cap.ldpc_dec.capability_flags;
@@ -2425,7 +2426,7 @@ validate_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
 					i);
 
 		if (ref_op->ldpc_dec.op_flags & RTE_BBDEV_LDPC_SOFT_OUT_ENABLE)
-			TEST_ASSERT_SUCCESS(validate_op_chain(soft_output,
+			TEST_ASSERT_SUCCESS(validate_op_so_chain(soft_output,
 					soft_data_orig),
 					"Soft output buffers (CB=%u) are not equal",
 					i);
@@ -2495,7 +2496,6 @@ validate_ldpc_enc_op(struct rte_bbdev_enc_op **ops, const uint16_t n,
 	return TEST_SUCCESS;
 }
 
-
 static inline int
 validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig_op)
 {
@@ -3185,11 +3185,11 @@ throughput_intr_lcore_ldpc_dec(void *arg)
 	for (j = 0; j < TEST_REPETITIONS; ++j) {
 		for (i = 0; i < num_to_process; ++i) {
 			if (!loopback)
-				rte_pktmbuf_reset(
-					ops[i]->ldpc_dec.hard_output.data);
+				rte_pktmbuf_reset(ops[i]->ldpc_dec.hard_output.data);
 			if (hc_out || loopback)
-				mbuf_reset(
-				ops[i]->ldpc_dec.harq_combined_output.data);
+				mbuf_reset(ops[i]->ldpc_dec.harq_combined_output.data);
+			if (ops[i]->ldpc_dec.soft_output.data != NULL)
+				rte_pktmbuf_reset(ops[i]->ldpc_dec.soft_output.data);
 		}
 
 		tp->start_time = rte_rdtsc_precise();
@@ -3284,7 +3284,6 @@ throughput_intr_lcore_dec(void *arg)
 				rte_pktmbuf_reset(ops[i]->turbo_dec.soft_output.data);
 		}
 
-
 		tp->start_time = rte_rdtsc_precise();
 		for (enqueued = 0; enqueued < num_to_process;) {
 			num_to_enq = burst_sz;
@@ -3746,10 +3745,11 @@ bler_pmd_lcore_ldpc_dec(void *arg)
 	for (i = 0; i < 1; ++i) { /* Could add more iterations */
 		for (j = 0; j < num_ops; ++j) {
 			if (!loopback)
-				mbuf_reset(
-				ops_enq[j]->ldpc_dec.hard_output.data);
+				mbuf_reset(ops_enq[j]->ldpc_dec.hard_output.data);
 			if (hc_out || loopback)
 				mbuf_reset(ops_enq[j]->ldpc_dec.harq_combined_output.data);
+			if (ops_enq[j]->ldpc_dec.soft_output.data != NULL)
+				mbuf_reset(ops_enq[j]->ldpc_dec.soft_output.data);
 		}
 		if (extDdr)
 			preload_harq_ddr(tp->dev_id, queue_id, ops_enq,
@@ -3981,11 +3981,11 @@ throughput_pmd_lcore_ldpc_dec(void *arg)
 	for (i = 0; i < TEST_REPETITIONS; ++i) {
 		for (j = 0; j < num_ops; ++j) {
 			if (!loopback)
-				mbuf_reset(
-				ops_enq[j]->ldpc_dec.hard_output.data);
+				mbuf_reset(ops_enq[j]->ldpc_dec.hard_output.data);
 			if (hc_out || loopback)
-				mbuf_reset(
-				ops_enq[j]->ldpc_dec.harq_combined_output.data);
+				mbuf_reset(ops_enq[j]->ldpc_dec.harq_combined_output.data);
+			if (ops_enq[j]->ldpc_dec.soft_output.data != NULL)
+				mbuf_reset(ops_enq[j]->ldpc_dec.soft_output.data);
 		}
 		if (extDdr)
 			preload_harq_ddr(tp->dev_id, queue_id, ops_enq,
Signature · 1 line
2.37.1
#29 lore raw

Re: [PATCH v1 10/13] test/bbdev: adjustment for soft output

Quoted 1 line · Hernan Vargas

Extend bbdev-test for soft output check, notably due to the logic in

test-bbdev

Quoted 37 lines

bbdev-test to enable termination changing.

---
  app/test-bbdev/test_bbdev_perf.c | 26 +++++++++++++-------------
  1 file changed, 13 insertions(+), 13 deletions(-)
app/test-bbdev/test_bbdev_perf.c +2 -2
index 3b2578baf6..1d18d9e054 100644
@@ -1348,6 +1348,7 @@ fill_queue_buffers(struct test_op_params *op_params,
  				RTE_BBDEV_LDPC_LLR_COMPRESSION;
  		bool harq_comp = op_params->ref_dec_op->ldpc_dec.op_flags &
  				RTE_BBDEV_LDPC_HARQ_6BIT_COMPRESSION;
+
  		ldpc_llr_decimals = capabilities->cap.ldpc_dec.llr_decimals;
  		ldpc_llr_size = capabilities->cap.ldpc_dec.llr_size;
  		ldpc_cap_flags = capabilities->cap.ldpc_dec.capability_flags;
@@ -2425,7 +2426,7 @@ validate_ldpc_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
  					i);
 
  		if (ref_op->ldpc_dec.op_flags & RTE_BBDEV_LDPC_SOFT_OUT_ENABLE)
-			TEST_ASSERT_SUCCESS(validate_op_chain(soft_output,
+			TEST_ASSERT_SUCCESS(validate_op_so_chain(soft_output,
  					soft_data_orig),
  					"Soft output buffers (CB=%u) are not equal",
  					i);
@@ -2495,7 +2496,6 @@ validate_ldpc_enc_op(struct rte_bbdev_enc_op **ops, const uint16_t n,
  	return TEST_SUCCESS;
  }
 
-
  static inline int
  validate_op_fft_chain(struct rte_bbdev_op_data *op, struct op_data_entries *orig_op)
  {

app/test-bbdev/test_bbdev_perf.c throughput_intr_lcore_ldpc_dec(void *arg) · line 3188

Quoted 6 lines
app/test-bbdev/test_bbdev_perf.c +1 -2
@@ -3185,11 +3185,11 @@ throughput_intr_lcore_ldpc_dec(void *arg)
  	for (j = 0; j < TEST_REPETITIONS; ++j) {
  		for (i = 0; i < num_to_process; ++i) {
  			if (!loopback)
-				rte_pktmbuf_reset(
-					ops[i]->ldpc_dec.hard_output.data);
+				rte_pktmbuf_reset(ops[i]->ldpc_dec.hard_output.data);

This is not introduced by this patch, but I wonder why not using mbuf_reset() or rte_pktmbuf_reset() everywhere?

Looking at the changes below, it seems mbuf_reset() is used for the !loopback case.

Quoted 47 lines
app/test-bbdev/test_bbdev_perf.c +10 -9
  			if (hc_out || loopback)
-				mbuf_reset(
-				ops[i]->ldpc_dec.harq_combined_output.data);
+				mbuf_reset(ops[i]->ldpc_dec.harq_combined_output.data);
+			if (ops[i]->ldpc_dec.soft_output.data != NULL)
+				rte_pktmbuf_reset(ops[i]->ldpc_dec.soft_output.data);
  		}
 
  		tp->start_time = rte_rdtsc_precise();
@@ -3284,7 +3284,6 @@ throughput_intr_lcore_dec(void *arg)
  				rte_pktmbuf_reset(ops[i]->turbo_dec.soft_output.data);
  		}
 
-
  		tp->start_time = rte_rdtsc_precise();
  		for (enqueued = 0; enqueued < num_to_process;) {
  			num_to_enq = burst_sz;
@@ -3746,10 +3745,11 @@ bler_pmd_lcore_ldpc_dec(void *arg)
  	for (i = 0; i < 1; ++i) { /* Could add more iterations */
  		for (j = 0; j < num_ops; ++j) {
  			if (!loopback)
-				mbuf_reset(
-				ops_enq[j]->ldpc_dec.hard_output.data);
+				mbuf_reset(ops_enq[j]->ldpc_dec.hard_output.data);
  			if (hc_out || loopback)
  				mbuf_reset(ops_enq[j]->ldpc_dec.harq_combined_output.data);
+			if (ops_enq[j]->ldpc_dec.soft_output.data != NULL)
+				mbuf_reset(ops_enq[j]->ldpc_dec.soft_output.data);
  		}
  		if (extDdr)
  			preload_harq_ddr(tp->dev_id, queue_id, ops_enq,
@@ -3981,11 +3981,11 @@ throughput_pmd_lcore_ldpc_dec(void *arg)
  	for (i = 0; i < TEST_REPETITIONS; ++i) {
  		for (j = 0; j < num_ops; ++j) {
  			if (!loopback)
-				mbuf_reset(
-				ops_enq[j]->ldpc_dec.hard_output.data);
+				mbuf_reset(ops_enq[j]->ldpc_dec.hard_output.data);
  			if (hc_out || loopback)
-				mbuf_reset(
-				ops_enq[j]->ldpc_dec.harq_combined_output.data);
+				mbuf_reset(ops_enq[j]->ldpc_dec.harq_combined_output.data);
+			if (ops_enq[j]->ldpc_dec.soft_output.data != NULL)
+				mbuf_reset(ops_enq[j]->ldpc_dec.soft_output.data);
  		}
  		if (extDdr)
  			preload_harq_ddr(tp->dev_id, queue_id, ops_enq,
#30 lore raw

PATCH 11/13 test/bbdev: expose warning counters

In reply to Hernan Vargas

Print warnings reported on queues for offload test. No functional impact.

---
 app/test-bbdev/test_bbdev_perf.c | 3 +++
 1 file changed, 3 insertions(+)
app/test-bbdev/test_bbdev_perf.c +3 -0
index 1d18d9e054..0930786fda 100644
@@ -5679,6 +5679,9 @@ offload_cost_test(struct active_device *ad,
 
 	struct rte_bbdev_stats stats = {0};
 	get_bbdev_queue_stats(ad->dev_id, queue_id, &stats);
+	if (stats.enqueue_warn_count > 0)
+		printf("Warning reported on the queue : %10"PRIu64"\n",
+			stats.enqueue_warn_count);
 	if (op_type != RTE_BBDEV_OP_LDPC_DEC) {
 		TEST_ASSERT_SUCCESS(stats.enqueued_count != num_to_process,
 				"Mismatch in enqueue count %10"PRIu64" %d",
Signature · 1 line
2.37.1
Reviewed-by on v1 11/13
#31 lore raw

Re: [PATCH v1 11/13] test/bbdev: expose warning counters

Quoted 13 lines · Hernan Vargas

Print warnings reported on queues for offload test. No functional impact.

---
  app/test-bbdev/test_bbdev_perf.c | 3 +++
  1 file changed, 3 insertions(+)
app/test-bbdev/test_bbdev_perf.c +0 -0
index 1d18d9e054..0930786fda 100644

app/test-bbdev/test_bbdev_perf.c offload_cost_test(struct active_device *ad, · line 5687

Quoted 9 lines
app/test-bbdev/test_bbdev_perf.c +3 -0
@@ -5679,6 +5679,9 @@ offload_cost_test(struct active_device *ad,
 
  	struct rte_bbdev_stats stats = {0};
  	get_bbdev_queue_stats(ad->dev_id, queue_id, &stats);
+	if (stats.enqueue_warn_count > 0)
+		printf("Warning reported on the queue : %10"PRIu64"\n",
+			stats.enqueue_warn_count);
  	if (op_type != RTE_BBDEV_OP_LDPC_DEC) {
  		TEST_ASSERT_SUCCESS(stats.enqueued_count != num_to_process,
  				"Mismatch in enqueue count %10"PRIu64" %d",

Thanks,
Maxime

#32 lore raw

PATCH 12/13 test/bbdev: remove check for invalid opaque data

In reply to Hernan Vargas

Assert also if the opaque date is invalid.

---
 app/test-bbdev/test_bbdev_perf.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
app/test-bbdev/test_bbdev_perf.c +3 -5
index 0930786fda..81bf2c8b60 100644
@@ -79,7 +79,6 @@
 
 #define SYNC_WAIT 0
 #define SYNC_START 1
-#define INVALID_OPAQUE -1
 
 #define INVALID_QUEUE_ID -1
 /* Increment for next code block in external HARQ memory */
@@ -1998,10 +1997,9 @@ check_enc_status_and_ordering(struct rte_bbdev_enc_op *op,
 			"op_status (%d) != expected_status (%d)",
 			op->status, expected_status);
 
-	if (op->opaque_data != (void *)(uintptr_t)INVALID_OPAQUE)
-		TEST_ASSERT((void *)(uintptr_t)order_idx == op->opaque_data,
-				"Ordering error, expected %p, got %p",
-				(void *)(uintptr_t)order_idx, op->opaque_data);
+	TEST_ASSERT((void *)(uintptr_t)order_idx == op->opaque_data,
+			"Ordering error, expected %p, got %p",
+			(void *)(uintptr_t)order_idx, op->opaque_data);
 
 	return TEST_SUCCESS;
 }
Signature · 1 line
2.37.1
#33 lore raw

Re: [PATCH v1 12/13] test/bbdev: remove check for invalid opaque data

Quoted 1 line · Hernan Vargas

Assert also if the opaque date is invalid.

data*

Quoted 22 lines
---
  app/test-bbdev/test_bbdev_perf.c | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
app/test-bbdev/test_bbdev_perf.c +0 -1
index 0930786fda..81bf2c8b60 100644
@@ -79,7 +79,6 @@
 
  #define SYNC_WAIT 0
  #define SYNC_START 1
-#define INVALID_OPAQUE -1
 
  #define INVALID_QUEUE_ID -1
  /* Increment for next code block in external HARQ memory */
@@ -1998,10 +1997,9 @@ check_enc_status_and_ordering(struct rte_bbdev_enc_op *op,
  			"op_status (%d) != expected_status (%d)",
  			op->status, expected_status);
 

app/test-bbdev/test_bbdev_perf.c check_enc_status_and_ordering(struct rte_bbdev_enc_op *op, · line 2005

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +3 -4
-	if (op->opaque_data != (void *)(uintptr_t)INVALID_OPAQUE)
-		TEST_ASSERT((void *)(uintptr_t)order_idx == op->opaque_data,
-				"Ordering error, expected %p, got %p",
-				(void *)(uintptr_t)order_idx, op->opaque_data);
+	TEST_ASSERT((void *)(uintptr_t)order_idx == op->opaque_data,
+			"Ordering error, expected %p, got %p",
+			(void *)(uintptr_t)order_idx, op->opaque_data);
 
  	return TEST_SUCCESS;
  }

It is a fix, isn't it?

Maxime

#34 lore raw

PATCH 13/13 test/bbdev: remove iteration count check

In reply to Hernan Vargas

To make the test compatible with devices that do not support early termination, the iteration count assert can be removed.

---
 app/test-bbdev/test_bbdev_perf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
app/test-bbdev/test_bbdev_perf.c +1 -5
index 81bf2c8b60..c68d79cf29 100644
@@ -2290,6 +2290,7 @@ static int
 validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
 		struct rte_bbdev_dec_op *ref_op, const int vector_mask)
 {
+	RTE_SET_USED(vector_mask);
 	unsigned int i;
 	int ret;
 	struct op_data_entries *hard_data_orig =
@@ -2299,17 +2300,12 @@ validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
 	struct rte_bbdev_op_turbo_dec *ops_td;
 	struct rte_bbdev_op_data *hard_output;
 	struct rte_bbdev_op_data *soft_output;
-	struct rte_bbdev_op_turbo_dec *ref_td = &ref_op->turbo_dec;
 
 	for (i = 0; i < n; ++i) {
 		ops_td = &ops[i]->turbo_dec;
 		hard_output = &ops_td->hard_output;
 		soft_output = &ops_td->soft_output;
 
-		if (vector_mask & TEST_BBDEV_VF_EXPECTED_ITER_COUNT)
-			TEST_ASSERT(ops_td->iter_count <= ref_td->iter_count,
-					"Returned iter_count (%d) > expected iter_count (%d)",
-					ops_td->iter_count, ref_td->iter_count);
 		ret = check_dec_status_and_ordering(ops[i], i, ref_op->status);
 		TEST_ASSERT_SUCCESS(ret,
 				"Checking status and ordering for decoder failed");
Signature · 1 line
2.37.1
#35 lore raw

Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Quoted 13 lines · Hernan Vargas

To make the test compatible with devices that do not support early termination, the iteration count assert can be removed.

---
  app/test-bbdev/test_bbdev_perf.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index 81bf2c8b60..c68d79cf29 100644

app/test-bbdev/test_bbdev_perf.c static int · line 2293

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
@@ -2290,6 +2290,7 @@ static int
  validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
  		struct rte_bbdev_dec_op *ref_op, const int vector_mask)
  {
+	RTE_SET_USED(vector_mask);

Why not just remove vector_mask if it isn't of any use instead of hiding the warning?

Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +0 -1
  	unsigned int i;
  	int ret;
  	struct op_data_entries *hard_data_orig =
@@ -2299,17 +2300,12 @@ validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
  	struct rte_bbdev_op_turbo_dec *ops_td;
  	struct rte_bbdev_op_data *hard_output;
  	struct rte_bbdev_op_data *soft_output;
-	struct rte_bbdev_op_turbo_dec *ref_td = &ref_op->turbo_dec;
 
  	for (i = 0; i < n; ++i) {
  		ops_td = &ops[i]->turbo_dec;

app/test-bbdev/test_bbdev_perf.c validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n, · line 2311

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +0 -4
  		hard_output = &ops_td->hard_output;
  		soft_output = &ops_td->soft_output;
 
-		if (vector_mask & TEST_BBDEV_VF_EXPECTED_ITER_COUNT)
-			TEST_ASSERT(ops_td->iter_count <= ref_td->iter_count,
-					"Returned iter_count (%d) > expected iter_count (%d)",
-					ops_td->iter_count, ref_td->iter_count);
  		ret = check_dec_status_and_ordering(ops[i], i, ref_op->status);
  		TEST_ASSERT_SUCCESS(ret,
  				"Checking status and ordering for decoder failed");

Maxime

#36 lore raw

RE: [PATCH v1 13/13] test/bbdev: remove iteration count check

Hi Maxime,

We would like to keep the same signature for validate_dec_op because there are functions such as latency_test_dec that have vector_mask on their signatures and they pass it to validate_dec_op. Let me know if you'd like to discuss more.

Thanks,
Hernan

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 6:36 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Quoted 14 lines · Hernan Vargas

To make the test compatible with devices that do not support early termination, the iteration count assert can be removed.

---
  app/test-bbdev/test_bbdev_perf.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index 81bf2c8b60..c68d79cf29 100644

app/test-bbdev/test_bbdev_perf.c static int · line 2293

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
@@ -2290,6 +2290,7 @@ static int
  validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
  		struct rte_bbdev_dec_op *ref_op, const int vector_mask)
  {
+	RTE_SET_USED(vector_mask);

Why not just remove vector_mask if it isn't of any use instead of hiding the warning?

Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
  	unsigned int i;
  	int ret;
  	struct op_data_entries *hard_data_orig = @@ -2299,17 +2300,12 @@ 

validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
struct rte_bbdev_op_turbo_dec *ops_td;
struct rte_bbdev_op_data *hard_output;
struct rte_bbdev_op_data *soft_output;

app/test-bbdev/test_bbdev_perf.c +0 -1
-	struct rte_bbdev_op_turbo_dec *ref_td = &ref_op->turbo_dec;
 
  	for (i = 0; i < n; ++i) {
  		ops_td = &ops[i]->turbo_dec;

app/test-bbdev/test_bbdev_perf.c validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n, · line 2311

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +0 -4
  		hard_output = &ops_td->hard_output;
  		soft_output = &ops_td->soft_output;
 
-		if (vector_mask & TEST_BBDEV_VF_EXPECTED_ITER_COUNT)
-			TEST_ASSERT(ops_td->iter_count <= ref_td->iter_count,
-					"Returned iter_count (%d) > expected iter_count (%d)",
-					ops_td->iter_count, ref_td->iter_count);
  		ret = check_dec_status_and_ordering(ops[i], i, ref_op->status);
  		TEST_ASSERT_SUCCESS(ret,
  				"Checking status and ordering for decoder failed");

Maxime

#37 lore raw

Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Quoted 4 lines · Hernan

Hi Maxime,

We would like to keep the same signature for validate_dec_op because there are functions such as latency_test_dec that have vector_mask on their signatures and they pass it to validate_dec_op. Let me know if you'd like to discuss more.

I think this is not a valid reason, just simplify latency_test_dec too.

Thanks,
Maxime

Quoted 58 lines

Thanks,
Hernan

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 6:36 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Quoted 14 lines · Hernan Vargas

To make the test compatible with devices that do not support early termination, the iteration count assert can be removed.

---
   app/test-bbdev/test_bbdev_perf.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
app/test-bbdev/test_bbdev_perf.c +0 -0
index 81bf2c8b60..c68d79cf29 100644

app/test-bbdev/test_bbdev_perf.c static int · line 2293

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
@@ -2290,6 +2290,7 @@ static int
   validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
   		struct rte_bbdev_dec_op *ref_op, const int vector_mask)
   {
+	RTE_SET_USED(vector_mask);

Why not just remove vector_mask if it isn't of any use instead of hiding the warning?

Quoted 11 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
   	unsigned int i;
   	int ret;
   	struct op_data_entries *hard_data_orig = @@ -2299,17 +2300,12 @@

validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,

   	struct rte_bbdev_op_turbo_dec *ops_td;
   	struct rte_bbdev_op_data *hard_output;
   	struct rte_bbdev_op_data *soft_output;
app/test-bbdev/test_bbdev_perf.c +0 -1
-	struct rte_bbdev_op_turbo_dec *ref_td = &ref_op->turbo_dec;
 
   	for (i = 0; i < n; ++i) {
   		ops_td = &ops[i]->turbo_dec;

app/test-bbdev/test_bbdev_perf.c validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n, · line 2311

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +0 -4
   		hard_output = &ops_td->hard_output;
   		soft_output = &ops_td->soft_output;
 
-		if (vector_mask & TEST_BBDEV_VF_EXPECTED_ITER_COUNT)
-			TEST_ASSERT(ops_td->iter_count <= ref_td->iter_count,
-					"Returned iter_count (%d) > expected iter_count (%d)",
-					ops_td->iter_count, ref_td->iter_count);
   		ret = check_dec_status_and_ordering(ops[i], i, ref_op->status);
   		TEST_ASSERT_SUCCESS(ret,
   				"Checking status and ordering for decoder failed");

Maxime

#38 lore raw

RE: [PATCH v1 13/13] test/bbdev: remove iteration count check

Hi Maxime,

Quoted 12 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Thursday, February 9, 2023 1:11 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

On 2/8/23 21:38, Vargas, Hernan wrote:

Quoted 8 lines
Quoted 3 lines

Hi Maxime,

We would like to keep the same signature for validate_dec_op because there

are functions such as latency_test_dec that have vector_mask on their signatures and they pass it to validate_dec_op.

Quoted 1 line

Let me know if you'd like to discuss more.

I think this is not a valid reason, just simplify latency_test_dec too.

The principle is that all these functions may or may not use that generic operation masks, but we still use a stable (future proof) and consistent prototype for these test functions.
I believe this is valid and better practice for the test functions, but again if you really want to push back, this could be changed.

Thanks!!
Nic

Quoted 71 lines

Thanks,
Maxime

Quoted 23 lines

Thanks,
Hernan

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 6:36 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Quoted 8 lines · Hernan Vargas

To make the test compatible with devices that do not support early termination, the iteration count assert can be removed.

---
   app/test-bbdev/test_bbdev_perf.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
Quoted 12 lines

app/test-bbdev/test_bbdev_perf.c static int · line 2293

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
index 81bf2c8b60..c68d79cf29 100644
@@ -2290,6 +2290,7 @@ static int
   validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
   		struct rte_bbdev_dec_op *ref_op, const int vector_mask)
   {
+	RTE_SET_USED(vector_mask);

Why not just remove vector_mask if it isn't of any use instead of hiding the

warning?

Quoted 4 lines

app/test-bbdev/test_bbdev_perf.c static int

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
   	unsigned int i;
   	int ret;
   	struct op_data_entries *hard_data_orig = @@ -2299,17 +2300,12

@@

Quoted 11 lines
Quoted 11 lines

validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,

   	struct rte_bbdev_op_turbo_dec *ops_td;
   	struct rte_bbdev_op_data *hard_output;
   	struct rte_bbdev_op_data *soft_output;
app/test-bbdev/test_bbdev_perf.c +0 -1
-	struct rte_bbdev_op_turbo_dec *ref_td = &ref_op->turbo_dec;
 
   	for (i = 0; i < n; ++i) {
   		ops_td = &ops[i]->turbo_dec;
   		hard_output = &ops_td->hard_output;
   		soft_output = &ops_td->soft_output;
Quoted 4 lines

app/test-bbdev/test_bbdev_perf.c

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +0 -2
-		if (vector_mask & TEST_BBDEV_VF_EXPECTED_ITER_COUNT)
-			TEST_ASSERT(ops_td->iter_count <= ref_td-

iter_count,

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -1
-					"Returned iter_count (%d) > expected

iter_count (%d)",

Quoted 6 lines

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -1
-					ops_td->iter_count, ref_td-

iter_count);

Quoted 1 line

ret = check_dec_status_and_ordering(ops[i], i, ref_op-

status);

Quoted 2 lines

TEST_ASSERT_SUCCESS(ret,
"Checking status and ordering for decoder

failed");

Quoted 3 lines

Maxime

#39 lore raw

Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Hi Nicolas,

Quoted 17 lines · Nicolas

Hi Maxime,

Quoted 15 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Thursday, February 9, 2023 1:11 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Quoted 3 lines · Hernan

Hi Maxime,

We would like to keep the same signature for validate_dec_op because there

Quoted 8 lines
Quoted 5 lines

are functions such as latency_test_dec that have vector_mask on their signatures and they pass it to validate_dec_op.

Quoted 1 line

Let me know if you'd like to discuss more.

I think this is not a valid reason, just simplify latency_test_dec too.

The principle is that all these functions may or may not use that generic operation masks, but we still use a stable (future proof) and consistent prototype for these test functions.

I would agree that it would be necessary if these were callbacks, but that's not the case.

Quoted 1 line

I believe this is valid and better practice for the test functions, but again if you really want to push back, this could be changed.

I prefer we do not bloat the code with things that could be useful in an hypothetical future.

Thanks,
Maxime

Quoted 75 lines

Thanks!!
Nic

Quoted 71 lines

Thanks,
Maxime

Quoted 23 lines

Thanks,
Hernan

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 6:36 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Quoted 8 lines · Hernan Vargas

To make the test compatible with devices that do not support early termination, the iteration count assert can be removed.

---
    app/test-bbdev/test_bbdev_perf.c | 6 +-----
    1 file changed, 1 insertion(+), 5 deletions(-)
Quoted 12 lines

app/test-bbdev/test_bbdev_perf.c static int · line 2293

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
index 81bf2c8b60..c68d79cf29 100644
@@ -2290,6 +2290,7 @@ static int
    validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
    		struct rte_bbdev_dec_op *ref_op, const int vector_mask)
    {
+	RTE_SET_USED(vector_mask);

Why not just remove vector_mask if it isn't of any use instead of hiding the

warning?

Quoted 4 lines

app/test-bbdev/test_bbdev_perf.c static int

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
    	unsigned int i;
    	int ret;
    	struct op_data_entries *hard_data_orig = @@ -2299,17 +2300,12

@@

Quoted 11 lines
Quoted 11 lines

validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,

    	struct rte_bbdev_op_turbo_dec *ops_td;
    	struct rte_bbdev_op_data *hard_output;
    	struct rte_bbdev_op_data *soft_output;
app/test-bbdev/test_bbdev_perf.c +0 -1
-	struct rte_bbdev_op_turbo_dec *ref_td = &ref_op->turbo_dec;
 
    	for (i = 0; i < n; ++i) {
    		ops_td = &ops[i]->turbo_dec;
    		hard_output = &ops_td->hard_output;
    		soft_output = &ops_td->soft_output;
Quoted 4 lines

app/test-bbdev/test_bbdev_perf.c

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +0 -2
-		if (vector_mask & TEST_BBDEV_VF_EXPECTED_ITER_COUNT)
-			TEST_ASSERT(ops_td->iter_count <= ref_td-

iter_count,

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -1
-					"Returned iter_count (%d) > expected

iter_count (%d)",

Quoted 6 lines

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -1
-					ops_td->iter_count, ref_td-

iter_count);

Quoted 1 line

ret = check_dec_status_and_ordering(ops[i], i, ref_op-

status);

Quoted 2 lines

TEST_ASSERT_SUCCESS(ret,
"Checking status and ordering for decoder

failed");

Quoted 3 lines

Maxime

#40 lore raw

RE: [PATCH v1 13/13] test/bbdev: remove iteration count check

Hi Maxime,

Quoted 41 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Friday, February 10, 2023 6:01 AM
To: Chautru, Nicolas <[email protected]>; Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Hi Nicolas,

Quoted 19 lines · Nicolas

Hi Maxime,

Quoted 17 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Thursday, February 9, 2023 1:11 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Quoted 4 lines · Hernan

Hi Maxime,

We would like to keep the same signature for validate_dec_op because there

Quoted 8 lines
Quoted 5 lines

are functions such as latency_test_dec that have vector_mask on their signatures and they pass it to validate_dec_op.

Quoted 1 line

Let me know if you'd like to discuss more.

I think this is not a valid reason, just simplify latency_test_dec too.

The principle is that all these functions may or may not use that generic operation masks, but we still use a stable (future proof) and

consistent prototype for these test functions.

Quoted 8 lines

I would agree that it would be necessary if these were callbacks, but that's not the case.

Quoted 1 line

I believe this is valid and better practice for the test functions, but again if you

really want to push back, this could be changed.

I prefer we do not bloat the code with things that could be useful in an hypothetical future.

OK, no big deal. Thanks.

Quoted 81 lines

Thanks,
Maxime

Quoted 77 lines

Thanks!!
Nic

Quoted 73 lines

Thanks,
Maxime

Quoted 24 lines

Thanks,
Hernan

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Tuesday, January 31, 2023 6:36 AM
To: Vargas, Hernan <[email protected]>; [email protected]; [email protected]; Rix, Tom <[email protected]>
Cc: Chautru, Nicolas <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v1 13/13] test/bbdev: remove iteration count check

Quoted 8 lines · Hernan Vargas

To make the test compatible with devices that do not support early termination, the iteration count assert can be removed.

---
    app/test-bbdev/test_bbdev_perf.c | 6 +-----
    1 file changed, 1 insertion(+), 5 deletions(-)
Quoted 13 lines

app/test-bbdev/test_bbdev_perf.c static int · line 2293

Quoted 10 lines
app/test-bbdev/test_bbdev_perf.c +1 -0
index 81bf2c8b60..c68d79cf29 100644
@@ -2290,6 +2290,7 @@ static int
    validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,
    		struct rte_bbdev_dec_op *ref_op, const int vector_mask)
    {
+	RTE_SET_USED(vector_mask);

Why not just remove vector_mask if it isn't of any use instead of hiding the

warning?

Quoted 4 lines

app/test-bbdev/test_bbdev_perf.c static int

Quoted 4 lines
app/test-bbdev/test_bbdev_perf.c +0 -0
    	unsigned int i;
    	int ret;
    	struct op_data_entries *hard_data_orig = @@ -2299,17 +2300,12

@@

Quoted 11 lines
Quoted 11 lines

validate_dec_op(struct rte_bbdev_dec_op **ops, const uint16_t n,

    	struct rte_bbdev_op_turbo_dec *ops_td;
    	struct rte_bbdev_op_data *hard_output;
    	struct rte_bbdev_op_data *soft_output;
app/test-bbdev/test_bbdev_perf.c +0 -1
-	struct rte_bbdev_op_turbo_dec *ref_td = &ref_op->turbo_dec;
 
    	for (i = 0; i < n; ++i) {
    		ops_td = &ops[i]->turbo_dec;
    		hard_output = &ops_td->hard_output;
    		soft_output = &ops_td->soft_output;
Quoted 4 lines

app/test-bbdev/test_bbdev_perf.c

Quoted 2 lines
app/test-bbdev/test_bbdev_perf.c +0 -2
-		if (vector_mask & TEST_BBDEV_VF_EXPECTED_ITER_COUNT)
-			TEST_ASSERT(ops_td->iter_count <= ref_td-

iter_count,

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -1
-					"Returned iter_count (%d) > expected

iter_count (%d)",

Quoted 6 lines

app/test-bbdev/test_bbdev_perf.c

Quoted 1 line
app/test-bbdev/test_bbdev_perf.c +0 -1
-					ops_td->iter_count, ref_td-

iter_count);

Quoted 1 line

ret = check_dec_status_and_ordering(ops[i], i, ref_op-

status);

Quoted 2 lines

TEST_ASSERT_SUCCESS(ret,
"Checking status and ordering for decoder

failed");

Quoted 3 lines

Maxime