Skip to contentSkip to conversation

bbdev: new k0 parameter

PATCH Applied Nicolas Chautru 3 participants 9 messages Jul 1, 2024 – Sep 13, 2024

lore
Share & tools
lore
#0 lore raw

cover bbdev: new k0 parameter

Hi Maxime, Hemant,

Capturing below an extension for 24.11.
This includes bbdev api change and related change for test application and acc/vrb PMD.
This provides the ability which was introduced in 3gPP standard to have an alternate way to compute k0 no longer always computed just from rv_index. When that parameter is set, then it is used a k0 value (starting position in circular index), if null the legacy computation from rv index (more common) is maintained.

Nicolas Chautru (3):
bbdev: new k0 parameter for LDPC decoder operation test/bbdev: add support for k0 parameter baseband/acc: add support for k0 parameter

 app/test-bbdev/test_bbdev_perf.c      | 7 +++++--
 app/test-bbdev/test_bbdev_vector.c    | 4 ++++
 app/test-bbdev/test_bbdev_vector.h    | 1 +
 doc/guides/prog_guide/bbdev.rst       | 2 ++
 drivers/baseband/acc/acc_common.h     | 6 ++++--
 drivers/baseband/acc/rte_acc100_pmd.c | 2 +-
 drivers/baseband/acc/rte_vrb_pmd.c    | 4 ++--
 lib/bbdev/rte_bbdev_op.h              | 4 ++++
 8 files changed, 23 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/3 bbdev: new k0 parameter for LDPC decoder operation

In latest 3GPP 38.212, the k0 value is not necessaraly directly derived from rv_index, in that case a value can be provided in API. When this value is non null this would override the value which would be computed purely from rv_index.

---
 doc/guides/prog_guide/bbdev.rst | 2 ++
 lib/bbdev/rte_bbdev_op.h        | 4 ++++
 2 files changed, 6 insertions(+)
doc/guides/prog_guide/bbdev.rst +2 -0
index 09e5f0d990..e3f356450b 100644
@@ -1021,6 +1021,8 @@ The LDPC decode parameters are set out in the table below.
 +----------------+------------+-------------------------------------------------------+
 |                |eb          |Eb, length of the RM output sequence in bits  r >= cab |
 +----------------+------------+-------------------------------------------------------+
+|                |k0          |Optional k0 Rate matching starting position override   |
++----------------+------------+-------------------------------------------------------+
 
 The mbuf input ``input`` encoded CB data is mandatory for all BBDEV PMDs
 and is the Virtual Circular Buffer data stream with null padding.
lib/bbdev/rte_bbdev_op.h +4 -0
index 459631d0d0..b5dde116ab 100644
@@ -562,6 +562,10 @@ struct rte_bbdev_op_ldpc_dec {
 		/** Struct which stores Transport Block specific parameters */
 		struct rte_bbdev_op_dec_ldpc_tb_params tb_params;
 	};
+	/** Optional k0 Rate matching starting position, overrides rv_index when non null
+	 *  [3GPP TS38.212, section 5.4.2.1]
+	 */
+	uint16_t k0;
 };
 /* >8 End of structure rte_bbdev_op_ldpc_dec. */
 
Signature · 1 line
2.34.1
Reviewed-by Acked-by Hemant Agrawal on v1 1/3
#2 lore raw

Re: [PATCH v1 1/3] bbdev: new k0 parameter for LDPC decoder operation

Hi,

Quoted 1 line · Nicolas Chautru

In latest 3GPP 38.212, the k0 value is not necessaraly directly

necessarily*

Quoted 28 lines

derived from rv_index, in that case a value can be provided in API. When this value is non null this would override the value which would be computed purely from rv_index.

---
  doc/guides/prog_guide/bbdev.rst | 2 ++
  lib/bbdev/rte_bbdev_op.h        | 4 ++++
  2 files changed, 6 insertions(+)
doc/guides/prog_guide/bbdev.rst +2 -0
index 09e5f0d990..e3f356450b 100644
@@ -1021,6 +1021,8 @@ The LDPC decode parameters are set out in the table below.
  +----------------+------------+-------------------------------------------------------+
  |                |eb          |Eb, length of the RM output sequence in bits  r >= cab |
  +----------------+------------+-------------------------------------------------------+
+|                |k0          |Optional k0 Rate matching starting position override   |
++----------------+------------+-------------------------------------------------------+
 
  The mbuf input ``input`` encoded CB data is mandatory for all BBDEV PMDs
  and is the Virtual Circular Buffer data stream with null padding.
lib/bbdev/rte_bbdev_op.h +0 -0
index 459631d0d0..b5dde116ab 100644

lib/bbdev/rte_bbdev_op.h struct rte_bbdev_op_ldpc_dec { · line 571

Quoted 10 lines
lib/bbdev/rte_bbdev_op.h +4 -0
@@ -562,6 +562,10 @@ struct rte_bbdev_op_ldpc_dec {
  		/** Struct which stores Transport Block specific parameters */
  		struct rte_bbdev_op_dec_ldpc_tb_params tb_params;
  	};
+	/** Optional k0 Rate matching starting position, overrides rv_index when non null
+	 *  [3GPP TS38.212, section 5.4.2.1]
+	 */
+	uint16_t k0;
  };
  /* >8 End of structure rte_bbdev_op_ldpc_dec. */
 

Will fix the typo while applying.

Also reporting Hemant's Ack on the cover letter as patchwork doesn't report them:

Thanks,
Maxime

#3 lore raw

PATCH 2/3 test/bbdev: add support for k0 parameter

In reply to Nicolas Chautru

New k0 added in LDPC decoder structure can be parsed by the bbdev test application.

---
 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(-)
app/test-bbdev/test_bbdev_perf.c +5 -2
index 3a94f15a30..67c55605fd 100644
@@ -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;
app/test-bbdev/test_bbdev_vector.c +4 -0
index e48947b211..8b32850982 100644
@@ -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);
app/test-bbdev/test_bbdev_vector.h +1 -0
index ba1d0d20f9..9a2942132b 100644
@@ -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 {
Signature · 1 line
2.34.1
Reviewed-by Acked-by Hemant Agrawal on v1 2/3
#4 lore raw

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

Quoted 63 lines · Nicolas Chautru

New k0 added in LDPC decoder structure can be parsed by the bbdev test application.

---
  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(-)
app/test-bbdev/test_bbdev_perf.c +5 -2
index 3a94f15a30..67c55605fd 100644
@@ -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;
app/test-bbdev/test_bbdev_vector.c +4 -0
index e48947b211..8b32850982 100644
@@ -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);
app/test-bbdev/test_bbdev_vector.h +0 -0
index ba1d0d20f9..9a2942132b 100644

app/test-bbdev/test_bbdev_vector.h enum { · line 40

Quoted 7 lines
app/test-bbdev/test_bbdev_vector.h +1 -0
@@ -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 {

Also reporting Hemant's Ack on the cover letter as patchwork doesn't report them:

Thanks,
Maxime

#5 lore raw

PATCH 3/3 baseband/acc: add support for k0 parameter

In reply to Nicolas Chautru

The k0 may be provided to the PMD, which would be used as the circular buffer starting position instead of value which would be computed from legacy rv_index derived computation.

---
 drivers/baseband/acc/acc_common.h     | 6 ++++--
 drivers/baseband/acc/rte_acc100_pmd.c | 2 +-
 drivers/baseband/acc/rte_vrb_pmd.c    | 4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/baseband/acc/acc_common.h +4 -2
index e249f37e38..46b564ce65 100644
@@ -982,8 +982,10 @@ acc_fcw_te_fill(const struct rte_bbdev_enc_op *op, struct acc_fcw_te *fcw)
  * Starting position of different redundancy versions, k0
  */
 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 ? ACC_N_ZC_1 : ACC_N_ZC_2) * z_c;
@@ -1020,7 +1022,7 @@ acc_fcw_le_fill(const struct rte_bbdev_enc_op *op,
 	fcw->Zc = op->ldpc_enc.z_c;
 	fcw->ncb = op->ldpc_enc.n_cb;
 	fcw->k0 = get_k0(fcw->ncb, fcw->Zc, op->ldpc_enc.basegraph,
-			op->ldpc_enc.rv_index);
+			op->ldpc_enc.rv_index, 0);
 	fcw->rm_e = (default_e == 0) ? op->ldpc_enc.cb_params.e : default_e;
 	fcw->crc_select = check_bit(op->ldpc_enc.op_flags,
 			RTE_BBDEV_LDPC_CRC_24B_ATTACH);
drivers/baseband/acc/rte_acc100_pmd.c +1 -1
index ab69350080..7da421e26c 100644
@@ -1159,7 +1159,7 @@ acc100_fcw_ld_fill(struct rte_bbdev_dec_op *op, struct acc_fcw_ld *fcw,
 	fcw->Zc = op->ldpc_dec.z_c;
 	fcw->ncb = op->ldpc_dec.n_cb;
 	fcw->k0 = get_k0(fcw->ncb, fcw->Zc, op->ldpc_dec.basegraph,
-			op->ldpc_dec.rv_index);
+			op->ldpc_dec.rv_index, op->ldpc_dec.k0);
 	if (op->ldpc_dec.code_block_mode == RTE_BBDEV_CODE_BLOCK)
 		fcw->rm_e = op->ldpc_dec.cb_params.e;
 	else
drivers/baseband/acc/rte_vrb_pmd.c +2 -2
index 585dc49bd6..ef34fc1c57 100644
@@ -1550,7 +1550,7 @@ vrb_fcw_ld_fill(struct rte_bbdev_dec_op *op, struct acc_fcw_ld *fcw,
 	fcw->Zc = op->ldpc_dec.z_c;
 	fcw->ncb = op->ldpc_dec.n_cb;
 	fcw->k0 = get_k0(fcw->ncb, fcw->Zc, op->ldpc_dec.basegraph,
-			op->ldpc_dec.rv_index);
+			op->ldpc_dec.rv_index, op->ldpc_dec.k0);
 	if (op->ldpc_dec.code_block_mode == RTE_BBDEV_CODE_BLOCK)
 		fcw->rm_e = op->ldpc_dec.cb_params.e;
 	else
@@ -2274,7 +2274,7 @@ vrb2_fcw_letb_fill(const struct rte_bbdev_enc_op *op, struct acc_fcw_le *fcw)
 	fcw->Zc = op->ldpc_enc.z_c;
 	fcw->ncb = op->ldpc_enc.n_cb;
 	fcw->k0 = get_k0(fcw->ncb, fcw->Zc, op->ldpc_enc.basegraph,
-			op->ldpc_enc.rv_index);
+			op->ldpc_enc.rv_index, 0);
 	fcw->rm_e = op->ldpc_enc.tb_params.ea;
 	fcw->rm_e_b = op->ldpc_enc.tb_params.eb;
 	fcw->crc_select = check_bit(op->ldpc_enc.op_flags,
Signature · 1 line
2.34.1
Reviewed-by Acked-by Hemant Agrawal on v1 3/3
#6 lore raw

Re: [PATCH v1 3/3] baseband/acc: add support for k0 parameter

Quoted 5 lines · Nicolas Chautru

The k0 may be provided to the PMD, which would be used as the circular buffer starting position instead of value which would be computed from legacy rv_index derived computation.

Quoted 7 lines
---
  drivers/baseband/acc/acc_common.h     | 6 ++++--
  drivers/baseband/acc/rte_acc100_pmd.c | 2 +-
  drivers/baseband/acc/rte_vrb_pmd.c    | 4 ++--
  3 files changed, 7 insertions(+), 5 deletions(-)

Also reporting Hemant's Ack on the cover letter as patchwork doesn't report them:

Thanks,
Maxime

Acked-by on the v1 series
#7 lore raw
In reply to Nicolas Chautru
Quoted 17 lines · Nicolas Chautru

Hi Maxime, Hemant,

Capturing below an extension for 24.11.
This includes bbdev api change and related change for test application and acc/vrb PMD.
This provides the ability which was introduced in 3gPP standard to have an alternate way to compute k0 no longer always computed just from rv_index. When that parameter is set, then it is used a k0 value (starting position in circular index), if null the legacy computation from rv index (more common) is maintained.

Nicolas Chautru (3):
bbdev: new k0 parameter for LDPC decoder operation test/bbdev: add support for k0 parameter baseband/acc: add support for k0 parameter

Quoted 9 lines
  app/test-bbdev/test_bbdev_perf.c      | 7 +++++--
  app/test-bbdev/test_bbdev_vector.c    | 4 ++++
  app/test-bbdev/test_bbdev_vector.h    | 1 +
  doc/guides/prog_guide/bbdev.rst       | 2 ++
  drivers/baseband/acc/acc_common.h     | 6 ++++--
  drivers/baseband/acc/rte_acc100_pmd.c | 2 +-
  drivers/baseband/acc/rte_vrb_pmd.c    | 4 ++--
  lib/bbdev/rte_bbdev_op.h              | 4 ++++
  8 files changed, 23 insertions(+), 7 deletions(-)

looks ok to me

Series-

#8 lore raw
In reply to Nicolas Chautru
Quoted 17 lines · Nicolas Chautru

Hi Maxime, Hemant,

Capturing below an extension for 24.11.
This includes bbdev api change and related change for test application and acc/vrb PMD.
This provides the ability which was introduced in 3gPP standard to have an alternate way to compute k0 no longer always computed just from rv_index. When that parameter is set, then it is used a k0 value (starting position in circular index), if null the legacy computation from rv index (more common) is maintained.

Nicolas Chautru (3):
bbdev: new k0 parameter for LDPC decoder operation test/bbdev: add support for k0 parameter baseband/acc: add support for k0 parameter

Quoted 10 lines
  app/test-bbdev/test_bbdev_perf.c      | 7 +++++--
  app/test-bbdev/test_bbdev_vector.c    | 4 ++++
  app/test-bbdev/test_bbdev_vector.h    | 1 +
  doc/guides/prog_guide/bbdev.rst       | 2 ++
  drivers/baseband/acc/acc_common.h     | 6 ++++--
  drivers/baseband/acc/rte_acc100_pmd.c | 2 +-
  drivers/baseband/acc/rte_vrb_pmd.c    | 4 ++--
  lib/bbdev/rte_bbdev_op.h              | 4 ++++
  8 files changed, 23 insertions(+), 7 deletions(-)

Applied to dpdk-next-baseband/for-main

Thanks,
Maxime