From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1C317A0524; Sat, 20 Feb 2021 01:16:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F34722A24A; Sat, 20 Feb 2021 01:16:26 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 8CD5540141 for ; Sat, 20 Feb 2021 01:16:23 +0100 (CET) IronPort-SDR: F3kwBOSr2Qcu+FIrQzE2Bt6cGDw+XrxTohlltJzy2ZpT01MAW5HR1IOhi1xgpc6qWnmMCoIkGf Sc5LFcQk/jlA== X-IronPort-AV: E=McAfee;i="6000,8403,9900"; a="203304763" X-IronPort-AV: E=Sophos;i="5.81,191,1610438400"; d="scan'208";a="203304763" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2021 16:16:20 -0800 IronPort-SDR: HLNpRl9BmYBS2XtPPPL5AM+HfHmbmKacQU+o/H2Sr98Y4VflaB29kk5nvJUMiiCcabyRNZE+i+ fG/QNnLX6cUg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,191,1610438400"; d="scan'208";a="440484047" Received: from skx-5gnr-sc12-4.sc.intel.com ([172.25.69.210]) by orsmga001.jf.intel.com with ESMTP; 19 Feb 2021 16:16:16 -0800 From: Nicolas Chautru To: dev@dpdk.org, akhil.goyal@nxp.com, thomas@monjalon.net, trix@redhat.com Cc: Nicolas Chautru Date: Fri, 19 Feb 2021 16:15:05 -0800 Message-Id: <1613780105-110079-2-git-send-email-nicolas.chautru@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1613780105-110079-1-git-send-email-nicolas.chautru@intel.com> References: <1613780105-110079-1-git-send-email-nicolas.chautru@intel.com> Subject: [dpdk-dev] [PATCH v1] bbdev: adding explicit enum for code block mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Using explicit enum instead of ambiguous integer value Signed-off-by: Nicolas Chautru --- 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, +}; + /** Data input and output buffer for BBDEV operations */ struct rte_bbdev_op_data { /** The mbuf data structure representing the data for BBDEV operation. -- 1.8.3.1