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

Maxime Coquelin maxime.coquelin at redhat.com
Tue Jan 31 10:48:26 CET 2023



On 1/17/23 17:50, Hernan Vargas wrote:
> Refactor calculation for tb_size.
> No functional impact.
> 
> Signed-off-by: Hernan Vargas <hernan.vargas at intel.com>
> ---
>   app/test-bbdev/test_bbdev_perf.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
> index cc7b5481d6..1a8a6b9f82 100644
> --- a/app/test-bbdev/test_bbdev_perf.c
> +++ b/app/test-bbdev/test_bbdev_perf.c
> @@ -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);

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

>   	}
>   	return tb_size;
>   }



More information about the dev mailing list