From a88352c36665e10663c08acee8c1d28b7ce1e446 Mon Sep 17 00:00:00 2001 From: Nicolas Chautru Date: Tue, 7 Sep 2021 18:15:37 -0700 Subject: [PATCH] baseband/turbo_sw: support CRC16 This is to support the case for operation where CRC16 is to be appended or checked. Signed-off-by: Nicolas Chautru Reviewed-by: Tom Rix --- doc/guides/rel_notes/release_21_11.rst | 4 ++++ drivers/baseband/turbo_sw/bbdev_turbo_software.c | 16 ++++++++++++++++ 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 fdffc4890e..e0e12d2ed8 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -122,6 +122,10 @@ New Features * Added PDCP short MAC-I support. +* **Updated the turbo_sw bbdev PMD.** + + Added support for more comprehensive CRC options. + * **Added multi-process support for testpmd.** Added command-line options to specify total number of processes and diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c index 77e9a2ecbc..e1db2bf205 100644 --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c @@ -199,6 +199,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info) .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 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info) .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 @@ process_ldpc_enc_cb(struct turbo_sw_queue *q, struct rte_bbdev_enc_op *op, 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) { + 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); @@ -1491,6 +1499,14 @@ process_ldpc_dec_cb(struct turbo_sw_queue *q, struct rte_bbdev_dec_op *op, bblib_lte_crc24a_check(&crc_req, &crc_resp); if (!crc_resp.check_passed) op->status |= 1 << RTE_BBDEV_CRC_ERROR; + } else if (check_bit(dec->op_flags, RTE_BBDEV_LDPC_CRC_TYPE_16_CHECK)) { + 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 -- 2.20.1