> -----Original Message-----
> From: Tom Rix <t...@redhat.com>
> Sent: Wednesday, September 1, 2021 7:01 AM
> To: Chautru, Nicolas <nicolas.chau...@intel.com>; dev@dpdk.org;
> gak...@marvell.com
> Cc: tho...@monjalon.net; hemant.agra...@nxp.com; Zhang, Mingshan
> <mingshan.zh...@intel.com>; Joshi, Arun <arun.jo...@intel.com>
> Subject: Re: [PATCH v2 2/6] baseband/turbo_sw: add support for CRC16
> 
> 
> On 8/19/21 2:10 PM, Nicolas Chautru wrote:
> > This is to support the case for operation where CRC16 is to be
> > appended or checked.
> >
> > Signed-off-by: Nicolas Chautru <nicolas.chau...@intel.com>
> > ---
> >   doc/guides/rel_notes/release_21_11.rst           |  3 +++
> >   drivers/baseband/turbo_sw/bbdev_turbo_software.c | 17
> +++++++++++++++++
> >   2 files changed, 20 insertions(+)
> >
> > diff --git a/doc/guides/rel_notes/release_21_11.rst
> > b/doc/guides/rel_notes/release_21_11.rst
> > index 69dd518..8ca59b7 100644
> > --- a/doc/guides/rel_notes/release_21_11.rst
> > +++ b/doc/guides/rel_notes/release_21_11.rst
> > @@ -55,6 +55,9 @@ New Features
> >        Also, make sure to start the actual text at the margin.
> >
> =======================================================
> >
> > +* **Updated the turbo_sw bbdev PMD.**
> > +
> > +  Added support for more comprehensive CRC options.
> >
> >   Removed Items
> >   -------------
> > diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> > b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> > index 77e9a2e..e570044 100644
> > --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> > +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c
> > @@ -199,6 +199,7 @@ struct turbo_sw_queue {
> >                     .cap.ldpc_enc = {
> >                             .capability_flags =
> >
>       RTE_BBDEV_LDPC_RATE_MATCH |
> > +
>       RTE_BBDEV_LDPC_CRC_16_ATTACH |
> >
>       RTE_BBDEV_LDPC_CRC_24A_ATTACH |
> >
>       RTE_BBDEV_LDPC_CRC_24B_ATTACH,
> >                             .num_buffers_src =
> > @@ -211,6 +212,7 @@ struct turbo_sw_queue {
> >             .type   = RTE_BBDEV_OP_LDPC_DEC,
> >             .cap.ldpc_dec = {
> >                     .capability_flags =
> > +
>       RTE_BBDEV_LDPC_CRC_TYPE_16_CHECK |
> >
>       RTE_BBDEV_LDPC_CRC_TYPE_24B_CHECK |
> >
>       RTE_BBDEV_LDPC_CRC_TYPE_24A_CHECK |
> >
>       RTE_BBDEV_LDPC_CRC_TYPE_24B_DROP | @@ -880,6 +882,12 @@
> struct
> > turbo_sw_queue {
> >             crc_req.len = in_length_in_bits - 24;
> >             crc_resp.data = q->enc_in;
> >             bblib_lte_crc24b_gen(&crc_req, &crc_resp);
> > +   } else if (enc->op_flags & RTE_BBDEV_LDPC_CRC_16_ATTACH) {
> 
> The 'else if' assumes the new flag is mutually exclusive wrt the other crc 
> flags.
> 
> At least a debug check should be added to verify.

There is typically not a validation of the input API in these PMD to report 
invalid operations mix. 
There may be other combination of operation which may be invalid. 

> 
> > +           rte_memcpy(q->enc_in, in, in_length_in_bytes - 2);
> > +           crc_req.data = in;
> > +           crc_req.len = in_length_in_bits - 16;
> > +           crc_resp.data = q->enc_in;
> > +           bblib_lte_crc16_gen(&crc_req, &crc_resp);
> >     } else
> >             rte_memcpy(q->enc_in, in, in_length_in_bytes);
> >
> > @@ -1492,6 +1500,15 @@ struct turbo_sw_queue {
> >             if (!crc_resp.check_passed)
> >                     op->status |= 1 << RTE_BBDEV_CRC_ERROR;
> >     }
> > +   if (check_bit(dec->op_flags,
> RTE_BBDEV_LDPC_CRC_TYPE_16_CHECK)) {
> 
> The series of 'if-statements' means the new flag is not mutually exclusive wrt
> the other crc flags.
> 
> doing both 24a and 16 would create a mess.
> 
> this should likely change to an else-if-statement similar to above.

Ok, I will change this as this is indeed mutually exclusive and to match 
similar snippet above. Thanks
> 
> Tom
> 
> > +           crc_req.data = adapter_input;
> > +           crc_req.len  = K - dec->n_filler - 16;
> > +           crc_resp.check_passed = false;
> > +           crc_resp.data = adapter_input;
> > +           bblib_lte_crc16_check(&crc_req, &crc_resp);
> > +           if (!crc_resp.check_passed)
> > +                   op->status |= 1 << RTE_BBDEV_CRC_ERROR;
> > +   }
> >
> >   #ifdef RTE_BBDEV_OFFLOAD_COST
> >     q_stats->acc_offload_cycles += rte_rdtsc_precise() - start_time;

Reply via email to