[v2,03/16] test/bbdev: refactor TB throughput report

Message ID 20230215170949.60569-4-hernan.vargas@intel.com (mailing list archive)
State Superseded, 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 Feb. 15, 2023, 5:09 p.m. UTC
  Refactor calculation for tb_size.
No functional impact.

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

Comments

Maxime Coquelin Feb. 20, 2023, 4:10 p.m. UTC | #1
On 2/15/23 18:09, Hernan Vargas wrote:
> Refactor calculation for tb_size.
> No functional impact.
> 
> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
>   app/test-bbdev/test_bbdev_perf.c | 38 ++++++++++++++------------------
>   1 file changed, 16 insertions(+), 22 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  

Patch

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 74e7e13940..19b9a5b119 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -2580,19 +2580,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;
 }
 
@@ -2618,19 +2615,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;
 }