[v3,04/17] test/bbdev: refactor TB throughput report

Message ID 20230302202211.170017-5-hernan.vargas@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series test/bbdev: changes for 23.03 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Hernan Vargas March 2, 2023, 8:21 p.m. UTC
  Refactor calculation for tb_size.
No functional impact.

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 app/test-bbdev/test_bbdev_perf.c | 38 ++++++++++++++------------------
 1 file changed, 16 insertions(+), 22 deletions(-)
  

Patch

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 95d63a3548f5..088fc055a148 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -2578,19 +2578,16 @@  calc_dec_TB_size(struct rte_bbdev_dec_op *op)
 static uint32_t
 calc_ldpc_dec_TB_size(struct rte_bbdev_dec_op *op)
 {
-	uint8_t i;
-	uint32_t c, r, tb_size = 0;
+	uint8_t num_cbs = 0;
+	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) {
-		tb_size = sys_cols * op->ldpc_dec.z_c - op->ldpc_dec.n_filler;
-	} else {
-		c = op->ldpc_dec.tb_params.c;
-		r = op->ldpc_dec.tb_params.r;
-		for (i = 0; i < c-r; i++)
-			tb_size += sys_cols * op->ldpc_dec.z_c
-					- op->ldpc_dec.n_filler;
-	}
+	if (op->ldpc_dec.code_block_mode == RTE_BBDEV_CODE_BLOCK)
+		num_cbs = 1;
+	else
+		num_cbs = 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) * num_cbs;
 	return tb_size;
 }
 
@@ -2616,19 +2613,16 @@  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;
+	uint8_t num_cbs = 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;
-	}
+	if (op->ldpc_enc.code_block_mode == RTE_BBDEV_CODE_BLOCK)
+		num_cbs = 1;
+	else
+		num_cbs = op->ldpc_enc.tb_params.c - op->ldpc_enc.tb_params.r;
+
+	tb_size = (sys_cols * op->ldpc_enc.z_c - op->ldpc_enc.n_filler) * num_cbs;
 	return tb_size;
 }