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 818B6A0540; Wed, 6 Jul 2022 14:50:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24EE040691; Wed, 6 Jul 2022 14:50:13 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id F38E140150 for ; Wed, 6 Jul 2022 14:50:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657111810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m24AzorNm37OSZ1ris/5oF0gGq3ETFDFU49rwUvTo5A=; b=A8pA4MWfugtElMWKNERuk8ypE8QbKZxUnsfjRsuY1pORRJ9rqeqS96P+FM6Q+7XqTMjSHh kVbjWwvU2AhBkBNl2gnt0rpGXodxM/3bs68PPcE0pIx7ZXqDcM7sCKDbW2Oi0FNWwLLpwf SkXbEKnpkfpQwalkrSmrPNK0IcKZN54= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-491-evy_qfOgN2ONxT9sTK0Wtw-1; Wed, 06 Jul 2022 08:50:09 -0400 X-MC-Unique: evy_qfOgN2ONxT9sTK0Wtw-1 Received: by mail-qk1-f198.google.com with SMTP id z9-20020a376509000000b006af1048e0caso14442093qkb.17 for ; Wed, 06 Jul 2022 05:50:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=m24AzorNm37OSZ1ris/5oF0gGq3ETFDFU49rwUvTo5A=; b=60ozNy9qWbtN2SibHUQd/KjAFKCLm4lOzQ/xEERoQyemKir/tlRFBHvrui5rA9cOH1 VVrRU1Sv+OUDFSKfbo1ojGqD+eMR8nyVI566JRKysJWPhhpupctzK4CTvSmL+LgZ21fb ERH4LFKVp0P2DCmhL5pYYt4F/NX/EkioBec3bkl7lP9fW5WUrIFQaQPohdoMFW1MKQL8 XbgcjP/UqivMTtf+BGat7jk6Z7Zla6skcxnk45cbWyzvHXVcPBq3IZ8jQmL9yBF75Joc EjeESz3DEA2u+QmsmR0QNeQxOMjSxB48nmbGjpHx6xl+MNA/8E7hOcExcO81f2cSIpke 2AVw== X-Gm-Message-State: AJIora+6VDlocDr8yniJ/qhNc/WTDIpDoGtEz4D1W6ZGrzkamYKfTRZc rIjhkhzmPLbJjTkEbyjNvF+q8kKp1VP+PTinEGM/AZS+HlPO0SK9nrw/eiVJZzvJHccaChJDUMJ wpUI= X-Received: by 2002:a05:6214:d41:b0:472:f5cf:1fa6 with SMTP id 1-20020a0562140d4100b00472f5cf1fa6mr12825201qvr.98.1657111808792; Wed, 06 Jul 2022 05:50:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uGbg30mt37otraKTWHJs8T5J5h2DmCAIO9QYahzyHA5JImuKyWG7a+nMZMluiGN5VhbPRstw== X-Received: by 2002:a05:6214:d41:b0:472:f5cf:1fa6 with SMTP id 1-20020a0562140d4100b00472f5cf1fa6mr12825173qvr.98.1657111808431; Wed, 06 Jul 2022 05:50:08 -0700 (PDT) Received: from localhost.localdomain (024-205-208-113.res.spectrum.com. [24.205.208.113]) by smtp.gmail.com with ESMTPSA id d3-20020a05620a240300b006af45243e15sm25259760qkn.114.2022.07.06.05.50.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Jul 2022 05:50:08 -0700 (PDT) Subject: Re: [PATCH v4 1/7] bbdev: allow operation type enum for growth To: Nicolas Chautru , dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com, hemant.agrawal@nxp.com Cc: maxime.coquelin@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <1657067022-54373-1-git-send-email-nicolas.chautru@intel.com> <1657067022-54373-2-git-send-email-nicolas.chautru@intel.com> From: Tom Rix Message-ID: Date: Wed, 6 Jul 2022 05:50:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1657067022-54373-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; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US 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 On 7/5/22 5:23 PM, Nicolas Chautru wrote: > Updating the enum for rte_bbdev_op_type > to allow to keep ABI compatible for enum insertion > while adding padded maximum value for array need. > Removing RTE_BBDEV_OP_TYPE_COUNT and instead exposing > RTE_BBDEV_OP_TYPE_PADDED_MAX. > > Signed-off-by: Nicolas Chautru > --- > app/test-bbdev/test_bbdev.c | 2 +- > app/test-bbdev/test_bbdev_perf.c | 4 ++-- > examples/bbdev_app/main.c | 2 +- > lib/bbdev/rte_bbdev.c | 9 +++++---- > lib/bbdev/rte_bbdev_op.h | 2 +- > 5 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c > index ac06d73..1063f6e 100644 > --- a/app/test-bbdev/test_bbdev.c > +++ b/app/test-bbdev/test_bbdev.c > @@ -521,7 +521,7 @@ struct bbdev_testsuite_params { > rte_mempool_free(mp); > > TEST_ASSERT((mp = rte_bbdev_op_pool_create("Test_INV", > - RTE_BBDEV_OP_TYPE_COUNT, size, cache_size, 0)) == NULL, > + RTE_BBDEV_OP_TYPE_PADDED_MAX, size, cache_size, 0)) == NULL, > "Failed test for rte_bbdev_op_pool_create: " > "returned value is not NULL for invalid type"); > > diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c > index fad3b1e..1abda2d 100644 > --- a/app/test-bbdev/test_bbdev_perf.c > +++ b/app/test-bbdev/test_bbdev_perf.c > @@ -2428,13 +2428,13 @@ typedef int (test_case_function)(struct active_device *ad, > > /* Find capabilities */ > const struct rte_bbdev_op_cap *cap = info.drv.capabilities; > - for (i = 0; i < RTE_BBDEV_OP_TYPE_COUNT; i++) { > + do { > if (cap->type == test_vector.op_type) { > capabilities = cap; > break; > } > cap++; > - } > + } while (cap->type != RTE_BBDEV_OP_NONE); > TEST_ASSERT_NOT_NULL(capabilities, > "Couldn't find capabilities"); > > diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c > index fc7e8b8..ef0ba76 100644 > --- a/examples/bbdev_app/main.c > +++ b/examples/bbdev_app/main.c > @@ -1041,7 +1041,7 @@ uint16_t bbdev_parse_number(const char *mask) > void *sigret; > struct app_config_params app_params = def_app_config; > struct rte_mempool *ethdev_mbuf_mempool, *bbdev_mbuf_mempool; > - struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_COUNT]; > + struct rte_mempool *bbdev_op_pools[RTE_BBDEV_OP_TYPE_PADDED_MAX]; > struct lcore_conf lcore_conf[RTE_MAX_LCORE] = { {0} }; > struct lcore_statistics lcore_stats[RTE_MAX_LCORE] = { {0} }; > struct stats_lcore_params stats_lcore; > diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c > index aaee7b7..22bd894 100644 > --- a/lib/bbdev/rte_bbdev.c > +++ b/lib/bbdev/rte_bbdev.c > @@ -23,6 +23,8 @@ > > #define DEV_NAME "BBDEV" > > +/* Number of supported operation types */ > +#define BBDEV_OP_TYPE_COUNT 5 > > /* BBDev library logging ID */ > RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE); > @@ -890,10 +892,10 @@ struct rte_mempool * > return NULL; > } > > - if (type >= RTE_BBDEV_OP_TYPE_COUNT) { > + if (type >= BBDEV_OP_TYPE_COUNT) { > rte_bbdev_log(ERR, > "Invalid op type (%u), should be less than %u", > - type, RTE_BBDEV_OP_TYPE_COUNT); > + type, BBDEV_OP_TYPE_COUNT); > return NULL; > } > > @@ -1122,10 +1124,9 @@ struct rte_mempool * > "RTE_BBDEV_OP_TURBO_DEC", > "RTE_BBDEV_OP_TURBO_ENC", > "RTE_BBDEV_OP_LDPC_DEC", > - "RTE_BBDEV_OP_LDPC_ENC", > }; > > - if (op_type < RTE_BBDEV_OP_TYPE_COUNT) > + if (op_type < BBDEV_OP_TYPE_COUNT) > return op_types[op_type]; > > rte_bbdev_log(ERR, "Invalid operation type"); > diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h > index 6d56133..cd82418 100644 > --- a/lib/bbdev/rte_bbdev_op.h > +++ b/lib/bbdev/rte_bbdev_op.h > @@ -748,7 +748,7 @@ enum rte_bbdev_op_type { > RTE_BBDEV_OP_TURBO_ENC, /**< Turbo encode */ > RTE_BBDEV_OP_LDPC_DEC, /**< LDPC decode */ > RTE_BBDEV_OP_LDPC_ENC, /**< LDPC encode */ > - RTE_BBDEV_OP_TYPE_COUNT, /**< Count of different op types */ Why not keep this enum so you don't have to make the BBDEV_OP_TYPE_COUNT #define ? Tom > + RTE_BBDEV_OP_TYPE_PADDED_MAX = 8, /**< Maximum op type number including padding */ > }; > > /** Bit indexes of possible errors reported through status field */