DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Chautru, Nicolas" <nicolas.chautru@intel.com>
To: Tom Rix <trix@redhat.com>, "dev@dpdk.org" <dev@dpdk.org>,
	"akhil.goyal@nxp.com" <akhil.goyal@nxp.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>
Subject: Re: [dpdk-dev] [PATCH v1] bbdev: adding explicit enum for code block mode
Date: Wed, 17 Mar 2021 23:44:53 +0000	[thread overview]
Message-ID: <BY5PR11MB44513D21951F582444F810A3F86A9@BY5PR11MB4451.namprd11.prod.outlook.com> (raw)
In-Reply-To: <8cfb92f8-4abc-d15e-3fcf-63b6232bf977@redhat.com>

Hi Akhil, 
Any chance to review this one to be applied?
Thanks

> -----Original Message-----
> From: Tom Rix <trix@redhat.com>
> Sent: Wednesday, March 3, 2021 12:04 PM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> akhil.goyal@nxp.com; thomas@monjalon.net
> Subject: Re: [PATCH v1] bbdev: adding explicit enum for code block mode
> 
> 
> On 2/19/21 4:15 PM, Nicolas Chautru wrote:
> > Using explicit enum instead of ambiguous integer value
> >
> > Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
> > ---
> >  app/test-bbdev/test_bbdev_perf.c                   | 16 ++++-----
> >  app/test-bbdev/test_bbdev_vector.c                 | 16 ++++-----
> >  drivers/baseband/acc100/rte_acc100_pmd.c           | 42 +++++++++++-------
> ----
> >  drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 10 +++---
> >  drivers/baseband/fpga_lte_fec/fpga_lte_fec.c       | 24 +++++++------
> >  drivers/baseband/turbo_sw/bbdev_turbo_software.c   | 18 +++++-----
> >  lib/librte_bbdev/rte_bbdev_op.h                    | 10 +++++-
> >  7 files changed, 73 insertions(+), 63 deletions(-)
> >
> > diff --git a/app/test-bbdev/test_bbdev_perf.c
> > b/app/test-bbdev/test_bbdev_perf.c
> > index 59b37ed..45b85b9 100644
> > --- a/app/test-bbdev/test_bbdev_perf.c
> > +++ b/app/test-bbdev/test_bbdev_perf.c
> > @@ -1258,7 +1258,7 @@ typedef int (test_case_function)(struct
> active_device *ad,
> >  	struct rte_bbdev_op_turbo_dec *turbo_dec = &ref_op->turbo_dec;
> >
> >  	for (i = 0; i < n; ++i) {
> > -		if (turbo_dec->code_block_mode == 0) {
> > +		if (turbo_dec->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  			ops[i]->turbo_dec.tb_params.ea =
> >  					turbo_dec->tb_params.ea;
> >  			ops[i]->turbo_dec.tb_params.eb =
> > @@ -1306,7 +1306,7 @@ typedef int (test_case_function)(struct
> active_device *ad,
> >  	unsigned int i;
> >  	struct rte_bbdev_op_turbo_enc *turbo_enc = &ref_op->turbo_enc;
> >  	for (i = 0; i < n; ++i) {
> > -		if (turbo_enc->code_block_mode == 0) {
> > +		if (turbo_enc->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  			ops[i]->turbo_enc.tb_params.ea =
> >  					turbo_enc->tb_params.ea;
> >  			ops[i]->turbo_enc.tb_params.eb =
> > @@ -1661,7 +1661,7 @@ typedef int (test_case_function)(struct
> active_device *ad,
> >  	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &ref_op->ldpc_dec;
> >
> >  	for (i = 0; i < n; ++i) {
> > -		if (ldpc_dec->code_block_mode == 0) {
> > +		if (ldpc_dec->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  			ops[i]->ldpc_dec.tb_params.ea =
> >  					ldpc_dec->tb_params.ea;
> >  			ops[i]->ldpc_dec.tb_params.eb =
> > @@ -1715,7 +1715,7 @@ typedef int (test_case_function)(struct
> active_device *ad,
> >  	unsigned int i;
> >  	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &ref_op->ldpc_enc;
> >  	for (i = 0; i < n; ++i) {
> > -		if (ldpc_enc->code_block_mode == 0) {
> > +		if (ldpc_enc->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  			ops[i]->ldpc_enc.tb_params.ea = ldpc_enc-
> >tb_params.ea;
> >  			ops[i]->ldpc_enc.tb_params.eb = ldpc_enc-
> >tb_params.eb;
> >  			ops[i]->ldpc_enc.tb_params.cab =
> > @@ -2239,7 +2239,7 @@ typedef int (test_case_function)(struct
> active_device *ad,
> >  	uint8_t i;
> >  	uint32_t c, r, tb_size = 0;
> >
> > -	if (op->turbo_dec.code_block_mode) {
> > +	if (op->turbo_dec.code_block_mode == RTE_BBDEV_CODE_BLOCK) {
> >  		tb_size = op->turbo_dec.tb_params.k_neg;
> >  	} else {
> >  		c = op->turbo_dec.tb_params.c;
> > @@ -2259,7 +2259,7 @@ typedef int (test_case_function)(struct
> active_device *ad,
> >  	uint32_t c, r, tb_size = 0;
> >  	uint16_t sys_cols = (op->ldpc_dec.basegraph == 1) ? 22 : 10;
> >
> > -	if (op->ldpc_dec.code_block_mode) {
> > +	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;
> > @@ -2277,7 +2277,7 @@ typedef int (test_case_function)(struct
> active_device *ad,
> >  	uint8_t i;
> >  	uint32_t c, r, tb_size = 0;
> >
> > -	if (op->turbo_enc.code_block_mode) {
> > +	if (op->turbo_enc.code_block_mode == RTE_BBDEV_CODE_BLOCK) {
> >  		tb_size = op->turbo_enc.tb_params.k_neg;
> >  	} else {
> >  		c = op->turbo_enc.tb_params.c;
> > @@ -2297,7 +2297,7 @@ typedef int (test_case_function)(struct
> active_device *ad,
> >  	uint32_t c, r, tb_size = 0;
> >  	uint16_t sys_cols = (op->ldpc_enc.basegraph == 1) ? 22 : 10;
> >
> > -	if (op->turbo_enc.code_block_mode) {
> > +	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;
> > diff --git a/app/test-bbdev/test_bbdev_vector.c
> > b/app/test-bbdev/test_bbdev_vector.c
> > index 50d1da0..614dbd1 100644
> > --- a/app/test-bbdev/test_bbdev_vector.c
> > +++ b/app/test-bbdev/test_bbdev_vector.c
> > @@ -1052,9 +1052,9 @@
> >  	if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) {
> >  		printf(
> >  			"WARNING: code_block_mode was not specified in
> vector file and will be set to 1 (0 - TB Mode, 1 - CB mode)\n");
> > -		turbo_dec->code_block_mode = 1;
> > +		turbo_dec->code_block_mode = RTE_BBDEV_CODE_BLOCK;
> >  	}
> > -	if (turbo_dec->code_block_mode == 0) {
> > +	if (turbo_dec->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		if (!(mask & TEST_BBDEV_VF_EA))
> >  			printf(
> >  				"WARNING: ea was not specified in vector file
> and will be set to
> > 0\n"); @@ -1142,9 +1142,9 @@
> >  	if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) {
> >  		printf(
> >  			"WARNING: code_block_mode was not specified in
> vector file and will be set to 1 (0 - TB Mode, 1 - CB mode)\n");
> > -		ldpc_dec->code_block_mode = 1;
> > +		ldpc_dec->code_block_mode = RTE_BBDEV_CODE_BLOCK;
> >  	}
> > -	if (ldpc_dec->code_block_mode == 0) {
> > +	if (ldpc_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
> {
> >  		if (!(mask & TEST_BBDEV_VF_EA))
> >  			printf(
> >  				"WARNING: ea was not specified in vector file
> and will be set to
> > 0\n"); @@ -1210,9 +1210,9 @@
> >  	if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) {
> >  		printf(
> >  			"WARNING: code_block_mode was not specified in
> vector file and will be set to 1\n");
> > -		vector->turbo_enc.code_block_mode = 1;
> > +		vector->turbo_enc.code_block_mode =
> RTE_BBDEV_CODE_BLOCK;
> >  	}
> > -	if (vector->turbo_enc.code_block_mode == 0) {
> > +	if (vector->turbo_enc.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> > +{
> >  		if (!(mask & TEST_BBDEV_VF_EA) && (vector-
> >turbo_enc.op_flags &
> >  				RTE_BBDEV_TURBO_RATE_MATCH))
> >  			printf(
> > @@ -1298,9 +1298,9 @@
> >  	if (!(mask & TEST_BBDEV_VF_CODE_BLOCK_MODE)) {
> >  		printf(
> >  			"WARNING: code_block_mode was not specified in
> vector file and will be set to 1\n");
> > -		vector->turbo_enc.code_block_mode = 1;
> > +		vector->turbo_enc.code_block_mode =
> RTE_BBDEV_CODE_BLOCK;
> >  	}
> > -	if (vector->turbo_enc.code_block_mode == 0) {
> > +	if (vector->turbo_enc.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> > +{
> >  	} else {
> >  		if (!(mask & TEST_BBDEV_VF_E) && (vector-
> >turbo_enc.op_flags &
> >  				RTE_BBDEV_TURBO_RATE_MATCH))
> > diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c
> > b/drivers/baseband/acc100/rte_acc100_pmd.c
> > index 5e663a6..ca2703f 100644
> > --- a/drivers/baseband/acc100/rte_acc100_pmd.c
> > +++ b/drivers/baseband/acc100/rte_acc100_pmd.c
> > @@ -1168,7 +1168,7 @@
> >  acc100_fcw_te_fill(const struct rte_bbdev_enc_op *op, struct
> > acc100_fcw_te *fcw)  {
> >  	fcw->code_block_mode = op->turbo_enc.code_block_mode;
> > -	if (fcw->code_block_mode == 0) { /* For TB mode */
> > +	if (fcw->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		fcw->k_neg = op->turbo_enc.tb_params.k_neg;
> >  		fcw->k_pos = op->turbo_enc.tb_params.k_pos;
> >  		fcw->c_neg = op->turbo_enc.tb_params.c_neg; @@ -1271,7
> +1271,7 @@
> > {
> >  	/* Note : Early termination is always enabled for 4GUL */
> >  	fcw->fcw_ver = 1;
> > -	if (op->turbo_dec.code_block_mode == 0)
> > +	if (op->turbo_dec.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  		fcw->k_pos = op->turbo_dec.tb_params.k_pos;
> >  	else
> >  		fcw->k_pos = op->turbo_dec.cb_params.k; @@ -1301,7
> +1301,7 @@
> >  	fcw->ncb = op->ldpc_dec.n_cb;
> >  	fcw->k0 = get_k0(fcw->ncb, fcw->Zc, op->ldpc_dec.basegraph,
> >  			op->ldpc_dec.rv_index);
> > -	if (op->ldpc_dec.code_block_mode == 1)
> > +	if (op->ldpc_dec.code_block_mode == RTE_BBDEV_CODE_BLOCK)
> >  		fcw->rm_e = op->ldpc_dec.cb_params.e;
> >  	else
> >  		fcw->rm_e = (op->ldpc_dec.tb_params.r < @@ -1554,7
> +1554,7 @@
> >  	desc->word3 = 0;
> >  	desc->numCBs = 1;
> >
> > -	if (op->turbo_enc.code_block_mode == 0) {
> > +	if (op->turbo_enc.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		ea = op->turbo_enc.tb_params.ea;
> >  		eb = op->turbo_enc.tb_params.eb;
> >  		cab = op->turbo_enc.tb_params.cab;
> > @@ -1695,7 +1695,7 @@
> >  	desc->word3 = 0;
> >  	desc->numCBs = 1;
> >
> > -	if (op->turbo_dec.code_block_mode == 0) {
> > +	if (op->turbo_dec.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		k = (r < op->turbo_dec.tb_params.c_neg)
> >  			? op->turbo_dec.tb_params.k_neg
> >  			: op->turbo_dec.tb_params.k_pos;
> > @@ -1707,7 +1707,7 @@
> >  		e = op->turbo_dec.cb_params.e;
> >  	}
> >
> > -	if ((op->turbo_dec.code_block_mode == 0)
> > +	if ((op->turbo_dec.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  		&& !check_bit(op->turbo_dec.op_flags,
> >  		RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP))
> >  		crc24_overlap = 24;
> > @@ -2066,15 +2066,15 @@
> >  				turbo_enc->rv_index);
> >  		return -1;
> >  	}
> > -	if (turbo_enc->code_block_mode != 0 &&
> > -			turbo_enc->code_block_mode != 1) {
> > +	if (turbo_enc->code_block_mode !=
> RTE_BBDEV_TRANSPORT_BLOCK &&
> > +			turbo_enc->code_block_mode !=
> RTE_BBDEV_CODE_BLOCK) {
> >  		rte_bbdev_log(ERR,
> >  				"code_block_mode (%u) is out of range 0 <=
> value <= 1",
> >  				turbo_enc->code_block_mode);
> >  		return -1;
> >  	}
> >
> > -	if (turbo_enc->code_block_mode == 0) {
> > +	if (turbo_enc->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		tb = &turbo_enc->tb_params;
> >  		if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE
> >  				|| tb->k_neg >
> RTE_BBDEV_TURBO_MAX_CB_SIZE) @@ -2214,7 +2214,7 @@
> >  				ldpc_enc->rv_index);
> >  		return -1;
> >  	}
> > -	if (ldpc_enc->code_block_mode > 1) {
> > +	if (ldpc_enc->code_block_mode > RTE_BBDEV_CODE_BLOCK) {
> >  		rte_bbdev_log(ERR,
> >  				"code_block_mode (%u) is out of range 0 <=
> value <= 1",
> >  				ldpc_enc->code_block_mode);
> > @@ -2258,7 +2258,7 @@
> >  				ldpc_dec->rv_index);
> >  		return -1;
> >  	}
> > -	if (ldpc_dec->code_block_mode > 1) {
> > +	if (ldpc_dec->code_block_mode > RTE_BBDEV_CODE_BLOCK) {
> >  		rte_bbdev_log(ERR,
> >  				"code_block_mode (%u) is out of range 0 <=
> value <= 1",
> >  				ldpc_dec->code_block_mode);
> > @@ -2581,15 +2581,15 @@
> >  				turbo_dec->iter_min, turbo_dec->iter_max);
> >  		return -1;
> >  	}
> > -	if (turbo_dec->code_block_mode != 0 &&
> > -			turbo_dec->code_block_mode != 1) {
> > +	if (turbo_dec->code_block_mode !=
> RTE_BBDEV_TRANSPORT_BLOCK &&
> > +			turbo_dec->code_block_mode !=
> RTE_BBDEV_CODE_BLOCK) {
> >  		rte_bbdev_log(ERR,
> >  				"code_block_mode (%u) is out of range 0 <=
> value <= 1",
> >  				turbo_dec->code_block_mode);
> >  		return -1;
> >  	}
> >
> > -	if (turbo_dec->code_block_mode == 0) {
> > +	if (turbo_dec->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		tb = &turbo_dec->tb_params;
> >  		if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE
> >  				|| tb->k_neg >
> RTE_BBDEV_TURBO_MAX_CB_SIZE) @@ -3411,7 +3411,7 @@
> > {
> >  	if (unlikely(num == 0))
> >  		return 0;
> > -	if (ops[0]->turbo_enc.code_block_mode == 0)
> > +	if (ops[0]->turbo_enc.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  		return acc100_enqueue_enc_tb(q_data, ops, num);
> >  	else
> >  		return acc100_enqueue_enc_cb(q_data, ops, num); @@ -
> 3424,7 +3424,7
> > @@  {
> >  	if (unlikely(num == 0))
> >  		return 0;
> > -	if (ops[0]->ldpc_enc.code_block_mode == 0)
> > +	if (ops[0]->ldpc_enc.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  		return acc100_enqueue_enc_tb(q_data, ops, num);
> >  	else
> >  		return acc100_enqueue_ldpc_enc_cb(q_data, ops, num);
> @@ -3607,7
> > +3607,7 @@  {
> >  	if (unlikely(num == 0))
> >  		return 0;
> > -	if (ops[0]->turbo_dec.code_block_mode == 0)
> > +	if (ops[0]->turbo_dec.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  		return acc100_enqueue_dec_tb(q_data, ops, num);
> >  	else
> >  		return acc100_enqueue_dec_cb(q_data, ops, num); @@ -
> 3625,7 +3625,7
> > @@
> >  	if (unlikely((aq_avail == 0) || (num == 0)))
> >  		return 0;
> >
> > -	if (ops[0]->ldpc_dec.code_block_mode == 0)
> > +	if (ops[0]->ldpc_dec.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  		return acc100_enqueue_ldpc_dec_tb(q_data, ops, num);
> >  	else
> >  		return acc100_enqueue_ldpc_dec_cb(q_data, ops, num);
> @@ -3966,7
> > +3966,7 @@
> >  	for (i = 0; i < dequeue_num; ++i) {
> >  		op = (q->ring_addr + ((q->sw_ring_tail + dequeued_cbs)
> >  			& q->sw_ring_wrap_mask))->req.op_addr;
> > -		if (op->turbo_enc.code_block_mode == 0)
> > +		if (op->turbo_enc.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  			ret = dequeue_enc_one_op_tb(q, &ops[i],
> dequeued_cbs,
> >  					&aq_dequeued);
> >  		else
> > @@ -4050,7 +4050,7 @@
> >  	for (i = 0; i < dequeue_num; ++i) {
> >  		op = (q->ring_addr + ((q->sw_ring_tail + dequeued_cbs)
> >  			& q->sw_ring_wrap_mask))->req.op_addr;
> > -		if (op->turbo_dec.code_block_mode == 0)
> > +		if (op->turbo_dec.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  			ret = dequeue_dec_one_op_tb(q, &ops[i],
> dequeued_cbs,
> >  					&aq_dequeued);
> >  		else
> > @@ -4095,7 +4095,7 @@
> >  	for (i = 0; i < dequeue_num; ++i) {
> >  		op = (q->ring_addr + ((q->sw_ring_tail + dequeued_cbs)
> >  			& q->sw_ring_wrap_mask))->req.op_addr;
> > -		if (op->ldpc_dec.code_block_mode == 0)
> > +		if (op->ldpc_dec.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  			ret = dequeue_dec_one_op_tb(q, &ops[i],
> dequeued_cbs,
> >  					&aq_dequeued);
> >  		else
> > diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> > b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> > index bd99fb4..026fc89 100644
> > --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> > +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c
> > @@ -1068,14 +1068,14 @@
> >  				ldpc_enc->basegraph);
> >  		return -1;
> >  	}
> > -	if (ldpc_enc->code_block_mode > 1) {
> > +	if (ldpc_enc->code_block_mode > RTE_BBDEV_CODE_BLOCK) {
> >  		rte_bbdev_log(ERR,
> >  				"code_block_mode (%u) is out of range 0:Tb
> 1:CB",
> >  				ldpc_enc->code_block_mode);
> >  		return -1;
> >  	}
> >
> > -	if (ldpc_enc->code_block_mode == 0) {
> > +	if (ldpc_enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
> {
> >  		tb = &ldpc_enc->tb_params;
> >  		if (tb->c == 0) {
> >  			rte_bbdev_log(ERR,
> > @@ -1161,14 +1161,14 @@
> >  		return -1;
> >  	}
> >
> > -	if (ldpc_dec->code_block_mode > 1) {
> > +	if (ldpc_dec->code_block_mode > RTE_BBDEV_CODE_BLOCK) {
> >  		rte_bbdev_log(ERR,
> >  				"code_block_mode (%u) is out of range 0 <=
> value <= 1",
> >  				ldpc_dec->code_block_mode);
> >  		return -1;
> >  	}
> >
> > -	if (ldpc_dec->code_block_mode == 0) {
> > +	if (ldpc_dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK)
> {
> >  		tb = &ldpc_dec->tb_params;
> >  		if (tb->c < 1) {
> >  			rte_bbdev_log(ERR,
> > @@ -1370,7 +1370,7 @@
> >  	if (enc->op_flags & RTE_BBDEV_LDPC_CRC_24B_ATTACH)
> >  		crc24_bits = 24;
> >
> > -	if (enc->code_block_mode == 0) {
> > +	if (enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		/* For Transport Block mode */
> >  		/* FIXME */
> >  		c = enc->tb_params.c;
> > diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> > b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> > index a0fb11c..1a72aa7 100644
> > --- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> > +++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c
> > @@ -1309,7 +1309,7 @@ struct __rte_cache_aligned fpga_queue {
> >  	desc->k = k;
> >  	desc->crc_type = !check_bit(op->turbo_dec.op_flags,
> >  			RTE_BBDEV_TURBO_CRC_TYPE_24B);
> > -	if ((op->turbo_dec.code_block_mode == 0)
> > +	if ((op->turbo_dec.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  		&& !check_bit(op->turbo_dec.op_flags,
> >  		RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP))
> >  		desc->drop_crc = 1;
> > @@ -1366,15 +1366,15 @@ struct __rte_cache_aligned fpga_queue {
> >  				turbo_enc->rv_index);
> >  		return -1;
> >  	}
> > -	if (turbo_enc->code_block_mode != 0 &&
> > -			turbo_enc->code_block_mode != 1) {
> > +	if (turbo_enc->code_block_mode !=
> RTE_BBDEV_TRANSPORT_BLOCK &&
> > +			turbo_enc->code_block_mode !=
> RTE_BBDEV_CODE_BLOCK) {
> >  		rte_bbdev_log(ERR,
> >  				"code_block_mode (%u) is out of range 0 <=
> value <= 1",
> >  				turbo_enc->code_block_mode);
> >  		return -1;
> >  	}
> >
> > -	if (turbo_enc->code_block_mode == 0) {
> > +	if (turbo_enc->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		tb = &turbo_enc->tb_params;
> >  		if ((tb->k_neg < RTE_BBDEV_TURBO_MIN_CB_SIZE
> >  				|| tb->k_neg >
> RTE_BBDEV_TURBO_MAX_CB_SIZE) @@ -1698,15 +1698,15
> > @@ struct __rte_cache_aligned fpga_queue {
> >  				turbo_dec->iter_min, turbo_dec->iter_max);
> >  		return -1;
> >  	}
> > -	if (turbo_dec->code_block_mode != 0 &&
> > -			turbo_dec->code_block_mode != 1) {
> > +	if (turbo_dec->code_block_mode !=
> RTE_BBDEV_TRANSPORT_BLOCK &&
> > +			turbo_dec->code_block_mode !=
> RTE_BBDEV_CODE_BLOCK) {
> >  		rte_bbdev_log(ERR,
> >  				"code_block_mode (%u) is out of range 0 <=
> value <= 1",
> >  				turbo_dec->code_block_mode);
> >  		return -1;
> >  	}
> >
> > -	if (turbo_dec->code_block_mode == 0) {
> > +	if (turbo_dec->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >
> >  		if ((turbo_dec->op_flags &
> >  			RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP) &&
> @@ -1957,7 +1957,8 @@
> > struct __rte_cache_aligned fpga_queue {
> >  		q->ring_ctrl_reg.ring_size + q->head_free_desc - q->tail - 1;
> >
> >  	for (i = 0; i < num; ++i) {
> > -		if (ops[i]->turbo_enc.code_block_mode == 0) {
> > +		if (ops[i]->turbo_enc.code_block_mode ==
> > +				RTE_BBDEV_TRANSPORT_BLOCK) {
> >  			cbs_in_op = get_num_cbs_in_op_enc(&ops[i]-
> >turbo_enc);
> >  			/* Check if there is available space for further
> >  			 * processing
> > @@ -2026,7 +2027,8 @@ struct __rte_cache_aligned fpga_queue {
> >  		q->ring_ctrl_reg.ring_size + q->head_free_desc - q->tail - 1;
> >
> >  	for (i = 0; i < num; ++i) {
> > -		if (ops[i]->turbo_dec.code_block_mode == 0) {
> > +		if (ops[i]->turbo_dec.code_block_mode ==
> > +				RTE_BBDEV_TRANSPORT_BLOCK) {
> >  			cbs_in_op = get_num_cbs_in_op_dec(&ops[i]-
> >turbo_dec);
> >  			/* Check if there is available space for further
> >  			 * processing
> > @@ -2246,7 +2248,7 @@ struct __rte_cache_aligned fpga_queue {
> >  	for (i = 0; (i < num) && (dequeued_cbs < avail); ++i) {
> >  		op = (q->ring_addr + ((q->head_free_desc + dequeued_cbs)
> >  			& q->sw_ring_wrap_mask))->enc_req.op_addr;
> > -		if (op->turbo_enc.code_block_mode == 0)
> > +		if (op->turbo_enc.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  			ret = dequeue_enc_one_op_tb(q, &ops[i],
> dequeued_cbs);
> >  		else
> >  			ret = dequeue_enc_one_op_cb(q, &ops[i],
> dequeued_cbs); @@ -2284,7
> > +2286,7 @@ struct __rte_cache_aligned fpga_queue {
> >  	for (i = 0; (i < num) && (dequeued_cbs < avail); ++i) {
> >  		op = (q->ring_addr + ((q->head_free_desc + dequeued_cbs)
> >  			& q->sw_ring_wrap_mask))->dec_req.op_addr;
> > -		if (op->turbo_dec.code_block_mode == 0)
> > +		if (op->turbo_dec.code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  			ret = dequeue_dec_one_op_tb(q, &ops[i],
> dequeued_cbs);
> >  		else
> >  			ret = dequeue_dec_one_op_cb(q, &ops[i],
> dequeued_cbs); diff --git
> > a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> > b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> > index aa7f122..85cf93d 100644
> > --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> > +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> > @@ -578,7 +578,7 @@ struct turbo_sw_queue {
> >
> >  	/* CRC24A (for TB) */
> >  	if ((enc->op_flags & RTE_BBDEV_TURBO_CRC_24A_ATTACH) &&
> > -		(enc->code_block_mode == 1)) {
> > +		(enc->code_block_mode == RTE_BBDEV_CODE_BLOCK)) {
> >  #ifdef RTE_LIBRTE_BBDEV_DEBUG
> >  		ret = is_enc_input_valid(k - 24, k_idx, in_length);
> >  		if (ret != 0) {
> > @@ -1007,7 +1007,7 @@ struct turbo_sw_queue {
> >  		(enc->op_flags & RTE_BBDEV_TURBO_CRC_24A_ATTACH))
> >  		crc24_bits = 24;
> >
> > -	if (enc->code_block_mode == 0) { /* For Transport Block mode */
> > +	if (enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		c = enc->tb_params.c;
> >  		r = enc->tb_params.r;
> >  	} else {/* For Code Block mode */
> > @@ -1019,7 +1019,7 @@ struct turbo_sw_queue {
> >
> >  		seg_total_left = rte_pktmbuf_data_len(m_in) - in_offset;
> >
> > -		if (enc->code_block_mode == 0) {
> > +		if (enc->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  			k = (r < enc->tb_params.c_neg) ?
> >  				enc->tb_params.k_neg : enc-
> >tb_params.k_pos;
> >  			ncb = (r < enc->tb_params.c_neg) ?
> > @@ -1101,7 +1101,7 @@ struct turbo_sw_queue {
> >  		(enc->op_flags & RTE_BBDEV_TURBO_CRC_24A_ATTACH))
> >  		crc24_bits = 24;
> >
> > -	if (enc->code_block_mode == 0) { /* For Transport Block mode */
> > +	if (enc->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		c = enc->tb_params.c;
> >  		r = enc->tb_params.r;
> >  	} else { /* For Code Block mode */
> > @@ -1113,7 +1113,7 @@ struct turbo_sw_queue {
> >
> >  		seg_total_left = rte_pktmbuf_data_len(m_in) - in_offset;
> >
> > -		if (enc->code_block_mode == 0) {
> > +		if (enc->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK) {
> >  			e = (r < enc->tb_params.cab) ?
> >  				enc->tb_params.ea : enc->tb_params.eb;
> >  		} else {
> > @@ -1570,7 +1570,7 @@ struct turbo_sw_queue {
> >  		return;
> >  	}
> >
> > -	if (dec->code_block_mode == 0) { /* For Transport Block mode */
> > +	if (dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		c = dec->tb_params.c;
> >  	} else { /* For Code Block mode */
> >  		k = dec->cb_params.k;
> > @@ -1582,7 +1582,7 @@ struct turbo_sw_queue {
> >  		crc24_overlap = 24;
> >
> >  	while (mbuf_total_left > 0) {
> > -		if (dec->code_block_mode == 0)
> > +		if (dec->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  			k = (r < dec->tb_params.c_neg) ?
> >  				dec->tb_params.k_neg : dec-
> >tb_params.k_pos;
> >
> > @@ -1658,7 +1658,7 @@ struct turbo_sw_queue {
> >  		return;
> >  	}
> >
> > -	if (dec->code_block_mode == 0) { /* For Transport Block mode */
> > +	if (dec->code_block_mode == RTE_BBDEV_TRANSPORT_BLOCK) {
> >  		c = dec->tb_params.c;
> >  		e = dec->tb_params.ea;
> >  	} else { /* For Code Block mode */
> > @@ -1673,7 +1673,7 @@ struct turbo_sw_queue {
> >  	out_length = ((out_length - crc24_overlap - dec->n_filler) >> 3);
> >
> >  	while (mbuf_total_left > 0) {
> > -		if (dec->code_block_mode == 0)
> > +		if (dec->code_block_mode ==
> RTE_BBDEV_TRANSPORT_BLOCK)
> >  			e = (r < dec->tb_params.cab) ?
> >  				dec->tb_params.ea : dec->tb_params.eb;
> >  		/* Special case handling when overusing mbuf */ diff --git
> > a/lib/librte_bbdev/rte_bbdev_op.h b/lib/librte_bbdev/rte_bbdev_op.h
> > index f726d73..f946842 100644
> > --- a/lib/librte_bbdev/rte_bbdev_op.h
> > +++ b/lib/librte_bbdev/rte_bbdev_op.h
> > @@ -112,7 +112,7 @@ enum rte_bbdev_op_td_flag_bitmasks {
> >  	/** Set if a device supports scatter-gather functionality */
> >  	RTE_BBDEV_TURBO_DEC_SCATTER_GATHER = (1ULL << 15),
> >  	/** Set to keep CRC24B bits appended while decoding. Only usable
> when
> > -	 * decoding Transport Blocks (code_block_mode = 0).
> > +	 * decoding Transport Block mode.
> >  	 */
> >  	RTE_BBDEV_TURBO_DEC_TB_CRC_24B_KEEP = (1ULL << 16)  }; @@ -
> 209,6
> > +209,14 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks {
> >  	RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7)  };
> >
> > +/** Flags for the Code Block/Transport block mode  */ enum
> > +rte_bbdev_op_cb_mode {
> > +	/** One operation is one or fraction of one transport block  */
> > +	RTE_BBDEV_TRANSPORT_BLOCK = 0,
> > +	/** One operation is one code block mode */
> > +	RTE_BBDEV_CODE_BLOCK = 1,
> > +};
> 
> Look good.
> 
> Thanks for the change,
> 
> Reviewed-by: Tom Rix <trix@redhat.com>
> 
> > +
> >  /** Data input and output buffer for BBDEV operations */  struct
> > rte_bbdev_op_data {
> >  	/** The mbuf data structure representing the data for BBDEV
> operation.


  reply	other threads:[~2021-03-17 23:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-20  0:15 Nicolas Chautru
2021-02-20  0:15 ` Nicolas Chautru
2021-03-03 20:03   ` Tom Rix
2021-03-17 23:44     ` Chautru, Nicolas [this message]
2021-03-23 18:49       ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BY5PR11MB44513D21951F582444F810A3F86A9@BY5PR11MB4451.namprd11.prod.outlook.com \
    --to=nicolas.chautru@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).