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 96A53A0564; Wed, 3 Mar 2021 21:03:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A1EE40692; Wed, 3 Mar 2021 21:03:49 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mails.dpdk.org (Postfix) with ESMTP id 70F5C40683 for ; Wed, 3 Mar 2021 21:03:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614801827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e7kZ03LPg444R0bWk/wYXPjfZuTn6JYeSJC+FViyyGg=; b=U3MKJ7siVaTrR7EVpL5gx3Qu/J4Q57YGbkuiQMwtqMq55mS1Rs7i0TRvjUMtF69urjoEiW irYTRj8vaDQjh8PBe+piu1OJrokrRYb2W9EGKWwhV1S+hS+ihJhIhGgwlLj5pFRkMCEihG ZXBkebExZFtZQok5vPSJ3Pmsx+hVPWc= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-N7uzdRAbPOuQH7x2tqESsw-1; Wed, 03 Mar 2021 15:03:45 -0500 X-MC-Unique: N7uzdRAbPOuQH7x2tqESsw-1 Received: by mail-qk1-f199.google.com with SMTP id i69so11299838qke.19 for ; Wed, 03 Mar 2021 12:03:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=e7kZ03LPg444R0bWk/wYXPjfZuTn6JYeSJC+FViyyGg=; b=FVM6algZ9OfPduz3699r+fcVoGIIAH6zOy8OsWB1ABEMfleyWVQLbiWGT7xmtiD88D S0T9sKydr/HiO9gQZviTi0yVfBcDnLV3cVLRIJUZzrdEwKQt8P1bKdyCKgDz3L/SvVQK eYj0GXEVe96o3NffMqaS+7arM9T4fxvw3d0AesZgKy4V19aDRYny0aFCSjM3dk3M24sj TLWF9tg9iANPi7JoAf4SE4Cb7nW6SqHQT0A97+50MeyTYGgu9rXEBKcZqSElBfU06GYm 921KaDde3gAkvOT+QaUp9yKNnlItchPUNoJIE8v8BjzoigE2CYNKzWR2Sj6weDMWohwk EwfA== X-Gm-Message-State: AOAM533SzPcOcrlL6bVmPvNQPO4KhOlXwWkr3tXYuJntbPwjRJzl0F1u fxMUUivazMvS3BWMwpTuLYkliCdYfuw9L0uejZV6EfXMhHllxm9UfO3sLqaFwGVWR5S3feqJ4b8 pdRM= X-Received: by 2002:a0c:a5e2:: with SMTP id z89mr879437qvz.37.1614801824458; Wed, 03 Mar 2021 12:03:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvfNPQu5EYE2WljWjUpxap2kKFmnZH29FGH1h2S0hNGIPRshlSms4AHqe3/y/U8v7wkIVDvQ== X-Received: by 2002:a0c:a5e2:: with SMTP id z89mr879400qvz.37.1614801824048; Wed, 03 Mar 2021 12:03:44 -0800 (PST) Received: from trix.remote.csb (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id y20sm15342587qtw.32.2021.03.03.12.03.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Mar 2021 12:03:43 -0800 (PST) To: Nicolas Chautru , dev@dpdk.org, akhil.goyal@nxp.com, thomas@monjalon.net References: <1613780105-110079-1-git-send-email-nicolas.chautru@intel.com> <1613780105-110079-2-git-send-email-nicolas.chautru@intel.com> From: Tom Rix Message-ID: <8cfb92f8-4abc-d15e-3fcf-63b6232bf977@redhat.com> Date: Wed, 3 Mar 2021 12:03:42 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <1613780105-110079-2-git-send-email-nicolas.chautru@intel.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=trix@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [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" On 2/19/21 4:15 PM, Nicolas Chautru wrote: > 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, > +}; Look good. Thanks for the change, Reviewed-by: Tom Rix > + > /** Data input and output buffer for BBDEV operations */ > struct rte_bbdev_op_data { > /** The mbuf data structure representing the data for BBDEV operation.