[v1,2/3] test/bbdev: add support for k0 parameter

Message ID 20240701212703.417094-3-nicolas.chautru@intel.com (mailing list archive)
State Awaiting Upstream
Delegated to: Maxime Coquelin
Headers
Series bbdev: new k0 parameter |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chautru, Nicolas July 1, 2024, 9:27 p.m. UTC
New k0 added in LDPC decoder structure can be parsed
by the bbdev test application.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 app/test-bbdev/test_bbdev_perf.c   | 7 +++++--
 app/test-bbdev/test_bbdev_vector.c | 4 ++++
 app/test-bbdev/test_bbdev_vector.h | 1 +
 3 files changed, 10 insertions(+), 2 deletions(-)
  

Comments

Maxime Coquelin Aug. 29, 2024, 8:01 a.m. UTC | #1
On 7/1/24 23:27, Nicolas Chautru wrote:
> New k0 added in LDPC decoder structure can be parsed
> by the bbdev test application.
> 
> Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
> ---
>   app/test-bbdev/test_bbdev_perf.c   | 7 +++++--
>   app/test-bbdev/test_bbdev_vector.c | 4 ++++
>   app/test-bbdev/test_bbdev_vector.h | 1 +
>   3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
> index 3a94f15a30..67c55605fd 100644
> --- a/app/test-bbdev/test_bbdev_perf.c
> +++ b/app/test-bbdev/test_bbdev_perf.c
> @@ -1923,6 +1923,7 @@ copy_reference_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned int n,
>   		ops[i]->ldpc_dec.n_cb = ldpc_dec->n_cb;
>   		ops[i]->ldpc_dec.iter_max = ldpc_dec->iter_max;
>   		ops[i]->ldpc_dec.rv_index = ldpc_dec->rv_index;
> +		ops[i]->ldpc_dec.k0 = ldpc_dec->k0;
>   		ops[i]->ldpc_dec.op_flags = ldpc_dec->op_flags;
>   		ops[i]->ldpc_dec.code_block_mode = ldpc_dec->code_block_mode;
>   
> @@ -2171,8 +2172,10 @@ validate_op_chain(struct rte_bbdev_op_data *op,
>    * As per definition in 3GPP 38.212 Table 5.4.2.1-2
>    */
>   static inline uint16_t
> -get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index)
> +get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index, uint16_t k0)
>   {
> +	if (k0 > 0)
> +		return k0;
>   	if (rv_index == 0)
>   		return 0;
>   	uint16_t n = (bg == 1 ? N_ZC_1 : N_ZC_2) * z_c;
> @@ -2202,7 +2205,7 @@ compute_harq_len(struct rte_bbdev_op_ldpc_dec *ops_ld)
>   {
>   	uint16_t k0 = 0;
>   	uint8_t max_rv = (ops_ld->rv_index == 1) ? 3 : ops_ld->rv_index;
> -	k0 = get_k0(ops_ld->n_cb, ops_ld->z_c, ops_ld->basegraph, max_rv);
> +	k0 = get_k0(ops_ld->n_cb, ops_ld->z_c, ops_ld->basegraph, max_rv, ops_ld->k0);
>   	/* Compute RM out size and number of rows */
>   	uint16_t parity_offset = (ops_ld->basegraph == 1 ? 20 : 8)
>   			* ops_ld->z_c - ops_ld->n_filler;
> diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c
> index e48947b211..8b32850982 100644
> --- a/app/test-bbdev/test_bbdev_vector.c
> +++ b/app/test-bbdev/test_bbdev_vector.c
> @@ -865,6 +865,10 @@ parse_ldpc_decoder_params(const char *key_token, char *token,
>   		vector->mask |= TEST_BBDEV_VF_RV_INDEX;
>   		ldpc_dec->rv_index = (uint8_t) strtoul(token, &err, 0);
>   		ret = ((err == NULL) || (*err != '\0')) ? -1 : 0;
> +	} else if (!strcmp(key_token, "k0")) {
> +		vector->mask |= TEST_BBDEV_VF_K0;
> +		ldpc_dec->k0 = (uint16_t) strtoul(token, &err, 0);
> +		ret = ((err == NULL) || (*err != '\0')) ? -1 : 0;
>   	} else if (!strcmp(key_token, "n_cb")) {
>   		vector->mask |= TEST_BBDEV_VF_NCB;
>   		ldpc_dec->n_cb = (uint16_t) strtoul(token, &err, 0);
> diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-bbdev/test_bbdev_vector.h
> index ba1d0d20f9..9a2942132b 100644
> --- a/app/test-bbdev/test_bbdev_vector.h
> +++ b/app/test-bbdev/test_bbdev_vector.h
> @@ -34,6 +34,7 @@ enum {
>   	TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23),
>   	TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24),
>   	TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25),
> +	TEST_BBDEV_VF_K0 = (1ULL << 26),
>   };
>   
>   enum op_data_type {


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

Also reporting Hemant's Ack on the cover letter as patchwork doesn't
report them:
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Thanks,
Maxime
  

Patch

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 3a94f15a30..67c55605fd 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -1923,6 +1923,7 @@  copy_reference_ldpc_dec_op(struct rte_bbdev_dec_op **ops, unsigned int n,
 		ops[i]->ldpc_dec.n_cb = ldpc_dec->n_cb;
 		ops[i]->ldpc_dec.iter_max = ldpc_dec->iter_max;
 		ops[i]->ldpc_dec.rv_index = ldpc_dec->rv_index;
+		ops[i]->ldpc_dec.k0 = ldpc_dec->k0;
 		ops[i]->ldpc_dec.op_flags = ldpc_dec->op_flags;
 		ops[i]->ldpc_dec.code_block_mode = ldpc_dec->code_block_mode;
 
@@ -2171,8 +2172,10 @@  validate_op_chain(struct rte_bbdev_op_data *op,
  * As per definition in 3GPP 38.212 Table 5.4.2.1-2
  */
 static inline uint16_t
-get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index)
+get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index, uint16_t k0)
 {
+	if (k0 > 0)
+		return k0;
 	if (rv_index == 0)
 		return 0;
 	uint16_t n = (bg == 1 ? N_ZC_1 : N_ZC_2) * z_c;
@@ -2202,7 +2205,7 @@  compute_harq_len(struct rte_bbdev_op_ldpc_dec *ops_ld)
 {
 	uint16_t k0 = 0;
 	uint8_t max_rv = (ops_ld->rv_index == 1) ? 3 : ops_ld->rv_index;
-	k0 = get_k0(ops_ld->n_cb, ops_ld->z_c, ops_ld->basegraph, max_rv);
+	k0 = get_k0(ops_ld->n_cb, ops_ld->z_c, ops_ld->basegraph, max_rv, ops_ld->k0);
 	/* Compute RM out size and number of rows */
 	uint16_t parity_offset = (ops_ld->basegraph == 1 ? 20 : 8)
 			* ops_ld->z_c - ops_ld->n_filler;
diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c
index e48947b211..8b32850982 100644
--- a/app/test-bbdev/test_bbdev_vector.c
+++ b/app/test-bbdev/test_bbdev_vector.c
@@ -865,6 +865,10 @@  parse_ldpc_decoder_params(const char *key_token, char *token,
 		vector->mask |= TEST_BBDEV_VF_RV_INDEX;
 		ldpc_dec->rv_index = (uint8_t) strtoul(token, &err, 0);
 		ret = ((err == NULL) || (*err != '\0')) ? -1 : 0;
+	} else if (!strcmp(key_token, "k0")) {
+		vector->mask |= TEST_BBDEV_VF_K0;
+		ldpc_dec->k0 = (uint16_t) strtoul(token, &err, 0);
+		ret = ((err == NULL) || (*err != '\0')) ? -1 : 0;
 	} else if (!strcmp(key_token, "n_cb")) {
 		vector->mask |= TEST_BBDEV_VF_NCB;
 		ldpc_dec->n_cb = (uint16_t) strtoul(token, &err, 0);
diff --git a/app/test-bbdev/test_bbdev_vector.h b/app/test-bbdev/test_bbdev_vector.h
index ba1d0d20f9..9a2942132b 100644
--- a/app/test-bbdev/test_bbdev_vector.h
+++ b/app/test-bbdev/test_bbdev_vector.h
@@ -34,6 +34,7 @@  enum {
 	TEST_BBDEV_VF_CODE_BLOCK_MODE = (1ULL << 23),
 	TEST_BBDEV_VF_OP_FLAGS = (1ULL << 24),
 	TEST_BBDEV_VF_EXPECTED_STATUS = (1ULL << 25),
+	TEST_BBDEV_VF_K0 = (1ULL << 26),
 };
 
 enum op_data_type {