[PATCH v4 1/7] bbdev: allow operation type enum for growth
Tom Rix
trix at redhat.com
Wed Jul 6 14:50:04 CEST 2022
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 <nicolas.chautru at intel.com>
> ---
> 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 */
More information about the dev
mailing list