From patchwork Mon Oct 3 18:00:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 117270 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE2F7A04FD; Mon, 3 Oct 2022 20:33:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 204B241156; Mon, 3 Oct 2022 20:33:39 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 602F140041 for ; Mon, 3 Oct 2022 20:33:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664822017; x=1696358017; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2u70YDsKSVjLUu+OBJTjSDPOpKbNT5usTZAo+LusCEI=; b=lKmOlvhm0rohklI2Xtr3QAP7RhkBBdNU9s28cSNzDw+AyZ07e/pc0Sm0 jRgLR0gPaAJdSahF6jGyWQPyFpvIte0D5PFXQvp6U0GyaW0bGPzgcPAIC bd9B/66e5I50GmTeoLlPCltO5ZE4vPZXiNoaAF2mJYsA5qeCEhb0+70iz 3OP595pQwHUVh3g19SJD5js2oq/8S3jbckVw3CneuaWHyzoXY7Tb/iCCT dxNtBwpcl/lYYRJAS/eKiEYgWHkp7fbgjqkMaR52tqIAIpm8JT8rIwumR LRecU29TnSO70ExvIC4WwjgvBjMJyd3n4e6OLtc1SbwxDyv03Q+2i6euF w==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="285907013" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="285907013" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 11:00:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="618829388" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="618829388" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga007.jf.intel.com with ESMTP; 03 Oct 2022 11:00:35 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com Cc: maxime.coquelin@redhat.com, trix@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, mingshan.zhang@intel.com, hemant.agrawal@nxp.com, Nicolas Chautru Subject: [PATCH v11 1/7] bbdev: allow operation type enum for growth Date: Mon, 3 Oct 2022 11:00:17 -0700 Message-Id: <20221003180023.13362-2-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221003180023.13362-1-nicolas.chautru@intel.com> References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <20221003180023.13362-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 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_SIZE_MAX. Signed-off-by: Nicolas Chautru Acked-by: Maxime Coquelin --- app/test-bbdev/test_bbdev.c | 2 +- app/test-bbdev/test_bbdev_perf.c | 4 ++-- doc/guides/rel_notes/deprecation.rst | 5 +---- doc/guides/rel_notes/release_22_11.rst | 3 +++ examples/bbdev_app/main.c | 2 +- lib/bbdev/rte_bbdev.c | 8 +++++--- lib/bbdev/rte_bbdev_op.h | 14 ++++++++++++-- 7 files changed, 25 insertions(+), 13 deletions(-) diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c index ac06d7320a..65805977ae 100644 --- a/app/test-bbdev/test_bbdev.c +++ b/app/test-bbdev/test_bbdev.c @@ -521,7 +521,7 @@ test_bbdev_op_pool(void) 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_SIZE_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 311e5d1a96..f5eeb735b2 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -2429,13 +2429,13 @@ run_test_case_on_device(test_case_function *test_case_func, uint8_t dev_id, /* 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/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index a991fa14de..e35c86a25c 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -120,10 +120,7 @@ Deprecation Notices ``RTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRY`` and ``RTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRY`` in DPDK 22.11. -* bbdev: ``RTE_BBDEV_OP_TYPE_COUNT`` terminating the ``rte_bbdev_op_type`` - enum will be deprecated and instead use fixed array size when required - to allow for future enum extension. - Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per +* bbdev: Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per this `RFC `__. New members will be added in ``rte_bbdev_driver_info`` to expose PMD queue topology inspired by diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 53fe21453c..e9db53f372 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -317,6 +317,9 @@ ABI Changes * eventdev: Added ``weight`` and ``affinity`` fields to ``rte_event_queue_conf`` structure. +* bbdev: enum ``rte_bbdev_op_type`` was affected to remove ``RTE_BBDEV_OP_TYPE_COUNT`` + and to allow for futureproof enum insertion a padded ``RTE_BBDEV_OP_TYPE_SIZE_MAX`` + macro is added. Known Issues ------------ diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index fc7e8b8174..7e16e16bf8 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -1041,7 +1041,7 @@ main(int argc, char **argv) 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_SIZE_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 aaee7b7872..4da80472a8 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 @@ rte_bbdev_op_pool_create(const char *name, enum rte_bbdev_op_type type, 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; } @@ -1125,7 +1127,7 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type) "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 6d561334e8..a6a6b8b31a 100644 --- a/lib/bbdev/rte_bbdev_op.h +++ b/lib/bbdev/rte_bbdev_op.h @@ -48,6 +48,13 @@ extern "C" { /* LDPC: Maximum number of Code Blocks in Transport Block.*/ #define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256) +/* + * Maximum size to be used to manage the enum rte_bbdev_op_type + * including padding for future enum insertion. + * The enum values must be explicitly kept smaller or equal to this padded maximum size. + */ +#define RTE_BBDEV_OP_TYPE_SIZE_MAX 8 + /** Flags for turbo decoder operation and capability structure */ enum rte_bbdev_op_td_flag_bitmasks { /** If sub block de-interleaving is to be performed. */ @@ -741,14 +748,17 @@ struct rte_bbdev_op_cap_ldpc_enc { uint16_t num_buffers_dst; }; -/** Different operation types supported by the device */ +/** Different operation types supported by the device + * The related macro RTE_BBDEV_OP_TYPE_SIZE_MAX can be used as an absolute maximum for + * notably sizing array while allowing for future enumeration insertion. + */ enum rte_bbdev_op_type { RTE_BBDEV_OP_NONE, /**< Dummy operation that does nothing */ RTE_BBDEV_OP_TURBO_DEC, /**< Turbo decode */ 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 */ + /* Note: RTE_BBDEV_OP_TYPE_SIZE_MAX must be larger or equal to maximum enum value */ }; /** Bit indexes of possible errors reported through status field */ From patchwork Mon Oct 3 18:00:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 117271 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AA8F1A04FD; Mon, 3 Oct 2022 20:33:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DFD03427F1; Mon, 3 Oct 2022 20:33:39 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 2FAEE40041 for ; Mon, 3 Oct 2022 20:33:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664822018; x=1696358018; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CdI0CstKC2Uz/vVgE7ewu7plu0n9zNhVvvvYv5Kswps=; b=B/6oys08FvvQ3H90zzYJlnzf/5NofKg4DxwhOD+yORgPxtg+saFksxah ynMl1gGBChZIOf1M3PAlYHanG5qBNEEwvotDKvt1umhnMImdchWJ1LIE1 FKuUm6c6+RfhlLBn8nfZjeiO2aCjyTt09Tt3mZ4cIJuJTSdbUr4zzDdbj OeQyLlCt/c+dep/qMhkE7QrXARzFhomHBf+GepKTPdWZJZeJPy8lFm4lT xbAgUdLCd7vkY51xnJ1vCWDmRXdGyY/ecH2QYRVd/DBEs+XH6O1lveNOg 3FDV3kUEafI3MZXvlK4cr/d57vdCe6Uf33hQTnZPyg48p0qwTE+J6UeyW Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="285907027" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="285907027" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 11:00:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="618829395" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="618829395" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga007.jf.intel.com with ESMTP; 03 Oct 2022 11:00:36 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com Cc: maxime.coquelin@redhat.com, trix@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, mingshan.zhang@intel.com, hemant.agrawal@nxp.com, Nicolas Chautru Subject: [PATCH v11 2/7] bbdev: add device status info Date: Mon, 3 Oct 2022 11:00:18 -0700 Message-Id: <20221003180023.13362-3-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221003180023.13362-1-nicolas.chautru@intel.com> References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <20221003180023.13362-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 Added device status information, so that the PMD can expose information related to the underlying accelerator device status. Minor order change in structure to fit into padding hole. Signed-off-by: Nicolas Chautru Acked-by: Mingshan Zhang Acked-by: Hemant Agrawal --- doc/guides/rel_notes/deprecation.rst | 3 -- doc/guides/rel_notes/release_22_11.rst | 3 ++ drivers/baseband/acc100/rte_acc100_pmd.c | 1 + .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 1 + drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 1 + drivers/baseband/la12xx/bbdev_la12xx.c | 1 + drivers/baseband/null/bbdev_null.c | 1 + .../baseband/turbo_sw/bbdev_turbo_software.c | 1 + lib/bbdev/rte_bbdev.c | 22 ++++++++++++ lib/bbdev/rte_bbdev.h | 35 +++++++++++++++++-- lib/bbdev/rte_bbdev_op.h | 2 +- lib/bbdev/version.map | 7 ++++ 12 files changed, 72 insertions(+), 6 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index e35c86a25c..3bf5a4a7bd 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -125,9 +125,6 @@ Deprecation Notices New members will be added in ``rte_bbdev_driver_info`` to expose PMD queue topology inspired by this `RFC `__. - New member will be added in ``rte_bbdev_driver_info`` to expose - the device status as per - this `RFC `__. This should be updated in DPDK 22.11. * cryptodev: Hide structures ``rte_cryptodev_sym_session`` and diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index e9db53f372..4a1a7bdc5e 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -321,6 +321,9 @@ ABI Changes and to allow for futureproof enum insertion a padded ``RTE_BBDEV_OP_TYPE_SIZE_MAX`` macro is added. +* bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters + for device status using ``rte_bbdev_device_status``. + Known Issues ------------ diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c index e2d9409185..cdabc0f879 100644 --- a/drivers/baseband/acc100/rte_acc100_pmd.c +++ b/drivers/baseband/acc100/rte_acc100_pmd.c @@ -1061,6 +1061,7 @@ acc100_dev_info_get(struct rte_bbdev *dev, /* Read and save the populated config from ACC100 registers */ fetch_acc100_config(dev); + dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED; /* This isn't ideal because it reports the maximum number of queues but * does not provide info on how many can be uplink/downlink or different 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 51dd090c1b..3c36d09730 100644 --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c @@ -369,6 +369,7 @@ fpga_dev_info_get(struct rte_bbdev *dev, dev_info->capabilities = bbdev_capabilities; dev_info->cpu_flag_reqs = NULL; dev_info->data_endianness = RTE_LITTLE_ENDIAN; + dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED; /* Calculates number of queues assigned to device */ dev_info->max_num_queues = 0; diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c index 036579e3ec..67b44992b2 100644 --- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c @@ -645,6 +645,7 @@ fpga_dev_info_get(struct rte_bbdev *dev, dev_info->capabilities = bbdev_capabilities; dev_info->cpu_flag_reqs = NULL; dev_info->data_endianness = RTE_LITTLE_ENDIAN; + dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED; /* Calculates number of queues assigned to device */ dev_info->max_num_queues = 0; diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c index 5d090c62a0..11a385ef56 100644 --- a/drivers/baseband/la12xx/bbdev_la12xx.c +++ b/drivers/baseband/la12xx/bbdev_la12xx.c @@ -101,6 +101,7 @@ la12xx_info_get(struct rte_bbdev *dev __rte_unused, dev_info->capabilities = bbdev_capabilities; dev_info->cpu_flag_reqs = NULL; dev_info->min_alignment = 64; + dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED; rte_bbdev_log_debug("got device info from %u", dev->data->dev_id); } diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c index 28a0cb5d4e..662663c0c8 100644 --- a/drivers/baseband/null/bbdev_null.c +++ b/drivers/baseband/null/bbdev_null.c @@ -83,6 +83,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info) * here for code completeness. */ dev_info->data_endianness = RTE_LITTLE_ENDIAN; + dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED; rte_bbdev_log_debug("got device info from %u", dev->data->dev_id); } diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c index db96b973af..98489d218b 100644 --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c @@ -255,6 +255,7 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info) dev_info->min_alignment = 64; dev_info->harq_buffer_size = 0; dev_info->data_endianness = RTE_LITTLE_ENDIAN; + dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED; rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id); } diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index 4da80472a8..38630a23f8 100644 --- a/lib/bbdev/rte_bbdev.c +++ b/lib/bbdev/rte_bbdev.c @@ -1133,3 +1133,25 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type) rte_bbdev_log(ERR, "Invalid operation type"); return NULL; } + +const char * +rte_bbdev_device_status_str(enum rte_bbdev_device_status status) +{ + static const char * const dev_sta_string[] = { + "RTE_BBDEV_DEV_NOSTATUS", + "RTE_BBDEV_DEV_NOT_SUPPORTED", + "RTE_BBDEV_DEV_RESET", + "RTE_BBDEV_DEV_CONFIGURED", + "RTE_BBDEV_DEV_ACTIVE", + "RTE_BBDEV_DEV_FATAL_ERR", + "RTE_BBDEV_DEV_RESTART_REQ", + "RTE_BBDEV_DEV_RECONFIG_REQ", + "RTE_BBDEV_DEV_CORRECT_ERR", + }; + + if (status < sizeof(dev_sta_string) / sizeof(char *)) + return dev_sta_string[status]; + + rte_bbdev_log(ERR, "Invalid device status"); + return NULL; +} diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index b88c88167e..3c428c14e9 100644 --- a/lib/bbdev/rte_bbdev.h +++ b/lib/bbdev/rte_bbdev.h @@ -223,6 +223,21 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id); int rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id); +/** + * Flags indicate the status of the device + */ +enum rte_bbdev_device_status { + RTE_BBDEV_DEV_NOSTATUS, /**< Nothing being reported */ + RTE_BBDEV_DEV_NOT_SUPPORTED, /**< Device status is not supported on the PMD */ + RTE_BBDEV_DEV_RESET, /**< Device in reset and un-configured state */ + RTE_BBDEV_DEV_CONFIGURED, /**< Device is configured and ready to use */ + RTE_BBDEV_DEV_ACTIVE, /**< Device is configured and VF is being used */ + RTE_BBDEV_DEV_FATAL_ERR, /**< Device has hit a fatal uncorrectable error */ + RTE_BBDEV_DEV_RESTART_REQ, /**< Device requires application to restart */ + RTE_BBDEV_DEV_RECONFIG_REQ, /**< Device requires application to reconfigure queues */ + RTE_BBDEV_DEV_CORRECT_ERR, /**< Warning of a correctable error event happened */ +}; + /** Device statistics. */ struct rte_bbdev_stats { uint64_t enqueued_count; /**< Count of all operations enqueued */ @@ -284,10 +299,12 @@ struct rte_bbdev_driver_info { uint8_t max_ul_queue_priority; /** Set if device supports per-queue interrupts */ bool queue_intr_supported; - /** Minimum alignment of buffers, in bytes */ - uint16_t min_alignment; + /** Device Status */ + enum rte_bbdev_device_status device_status; /** HARQ memory available in kB */ uint32_t harq_buffer_size; + /** Minimum alignment of buffers, in bytes */ + uint16_t min_alignment; /** Byte endianness (RTE_BIG_ENDIAN/RTE_LITTLE_ENDIAN) supported * for input/output data */ @@ -827,6 +844,20 @@ int rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op, void *data); +/** + * Convert device status from enum to string. + * + * @param status + * Device status as enum. + * + * @returns + * Operation type as string or NULL if op_type is invalid. + * + */ +__rte_experimental +const char* +rte_bbdev_device_status_str(enum rte_bbdev_device_status status); + #ifdef __cplusplus } #endif diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h index a6a6b8b31a..99a7552779 100644 --- a/lib/bbdev/rte_bbdev_op.h +++ b/lib/bbdev/rte_bbdev_op.h @@ -748,7 +748,7 @@ struct rte_bbdev_op_cap_ldpc_enc { uint16_t num_buffers_dst; }; -/** Different operation types supported by the device +/** Different operation types supported by the device. * The related macro RTE_BBDEV_OP_TYPE_SIZE_MAX can be used as an absolute maximum for * notably sizing array while allowing for future enumeration insertion. */ diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map index 25a0a22bd4..addea05f00 100644 --- a/lib/bbdev/version.map +++ b/lib/bbdev/version.map @@ -39,3 +39,10 @@ DPDK_23 { local: *; }; + +EXPERIMENTAL { + global: + + # added in 22.11 + rte_bbdev_device_status_str; +}; From patchwork Mon Oct 3 18:00:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 117272 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1908A04FD; Mon, 3 Oct 2022 20:33:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA0B2427F7; Mon, 3 Oct 2022 20:33:40 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id EC48740F17 for ; Mon, 3 Oct 2022 20:33:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664822019; x=1696358019; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pEh4bWAsPM7WJrtq4vpw3bPcqsV2GNba3a7StCl1TVM=; b=JJHRqwHbX2fFGvlCCCqtDTdMT0tZDNITUzMl6lX8CgVLE1IadF0isT/z AexYJwpCxhRrv6ptr/D1/ly0vrNh4qpAJWON0wiLgaRaUVVYokPTO/Xza D9sciLfIPZ/vUN+5YZhC/dgEWNiiwXelMkYr8HoVKM9eKQL8dsZ9Z3Y31 IJ/gwVQiqPqi5bbEdVUpZxGmBLeoRE6tXcLkrTY3OJ6WeOrFliy6PX2D5 OZ51UvfpFBmYJm3r86HdCFcfSonSPYe6Yu+lkOJAbM18nircy4Rav/rKj gwnku8gB+ur4MFjjnzxG0wSFDcQhS2sfom+fTrwH6yOdyf4VRiFA9fgeX w==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="285907034" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="285907034" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 11:00:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="618829400" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="618829400" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga007.jf.intel.com with ESMTP; 03 Oct 2022 11:00:37 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com Cc: maxime.coquelin@redhat.com, trix@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, mingshan.zhang@intel.com, hemant.agrawal@nxp.com, Nicolas Chautru Subject: [PATCH v11 3/7] bbdev: add device info on queue topology Date: Mon, 3 Oct 2022 11:00:19 -0700 Message-Id: <20221003180023.13362-4-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221003180023.13362-1-nicolas.chautru@intel.com> References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <20221003180023.13362-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 Adding more options in the API to expose the number of queues exposed and related priority. Signed-off-by: Nicolas Chautru Acked-by: Maxime Coquelin --- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_22_11.rst | 2 +- lib/bbdev/rte_bbdev.h | 4 ++++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 3bf5a4a7bd..b6485019d2 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -122,9 +122,6 @@ Deprecation Notices * bbdev: Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per this `RFC `__. - New members will be added in ``rte_bbdev_driver_info`` to expose - PMD queue topology inspired by - this `RFC `__. This should be updated in DPDK 22.11. * cryptodev: Hide structures ``rte_cryptodev_sym_session`` and diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 4a1a7bdc5e..0b4e28f416 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -322,7 +322,7 @@ ABI Changes macro is added. * bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters - for device status using ``rte_bbdev_device_status``. + for queue topology, device status using ``rte_bbdev_device_status``. Known Issues ------------ diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index 3c428c14e9..21d076cd36 100644 --- a/lib/bbdev/rte_bbdev.h +++ b/lib/bbdev/rte_bbdev.h @@ -289,6 +289,10 @@ struct rte_bbdev_driver_info { /** Maximum number of queues supported by the device */ unsigned int max_num_queues; + /** Maximum number of queues supported per operation type */ + unsigned int num_queues[RTE_BBDEV_OP_TYPE_SIZE_MAX]; + /** Priority level supported per operation type */ + unsigned int queue_priority[RTE_BBDEV_OP_TYPE_SIZE_MAX]; /** Queue size limit (queue size must also be power of 2) */ uint32_t queue_size_lim; /** Set if device off-loads operation to hardware */ From patchwork Mon Oct 3 18:00:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 117273 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D91D7A04FD; Mon, 3 Oct 2022 20:34:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ACAB04281C; Mon, 3 Oct 2022 20:33:41 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 0ACD940041 for ; Mon, 3 Oct 2022 20:33:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664822019; x=1696358019; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SDLuC2MBrtA0LF7naxVWBqxP1bRr+sVhmg6BHBzTYKc=; b=l4hazLpQfAXz+RoVYwrJTOZQNNdKPsXcioKhlDqZ1MVm4HfKfgje1VnN DJSaonIcymIoyF8NvFHL3NJwuJ7/Qwfe+Ar4RBY2qwZJU6N4HIhpsBWST XIGV0OswriscFR76IILgU0OGwJ/VWdiqu/El3a8vjk8WMih3ckHvaIlgc 2hGjdT4F6pM2K7sXdc3Rd6xbwd/H0c/4zgMkw9NZl2bffa3l0ZpYTZ/Wa b3/W0y16ZLKm6FDiSnfD13LeIa4GERkB2yuDNHsNWFfp/CpmeWyhPCSM8 iYxD85lYTxkAN5jeLsdiKreeKfs65tyz6KFI0mLhIMrj/Krq7qamWmQr/ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="285907038" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="285907038" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 11:00:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="618829405" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="618829405" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga007.jf.intel.com with ESMTP; 03 Oct 2022 11:00:37 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com Cc: maxime.coquelin@redhat.com, trix@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, mingshan.zhang@intel.com, hemant.agrawal@nxp.com, Nicolas Chautru Subject: [PATCH v11 4/7] drivers/baseband: update PMDs to expose queue per operation Date: Mon, 3 Oct 2022 11:00:20 -0700 Message-Id: <20221003180023.13362-5-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221003180023.13362-1-nicolas.chautru@intel.com> References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <20221003180023.13362-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 Add support in existing bbdev PMDs for the explicit number of queues and priority for each operation type configured on the device. Signed-off-by: Nicolas Chautru Acked-by: Maxime Coquelin Acked-by: Hemant Agrawal --- drivers/baseband/acc100/rte_acc100_pmd.c | 29 +++++++++++-------- .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 8 +++++ drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 8 +++++ drivers/baseband/la12xx/bbdev_la12xx.c | 7 +++++ .../baseband/turbo_sw/bbdev_turbo_software.c | 12 ++++++++ 5 files changed, 52 insertions(+), 12 deletions(-) diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c index cdabc0f879..10272fd149 100644 --- a/drivers/baseband/acc100/rte_acc100_pmd.c +++ b/drivers/baseband/acc100/rte_acc100_pmd.c @@ -967,6 +967,7 @@ acc100_dev_info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info) { struct acc100_device *d = dev->data->dev_private; + int i; static const struct rte_bbdev_op_cap bbdev_capabilities[] = { { @@ -1063,19 +1064,23 @@ acc100_dev_info_get(struct rte_bbdev *dev, fetch_acc100_config(dev); dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED; - /* This isn't ideal because it reports the maximum number of queues but - * does not provide info on how many can be uplink/downlink or different - * priorities - */ - dev_info->max_num_queues = - d->acc100_conf.q_dl_5g.num_aqs_per_groups * - d->acc100_conf.q_dl_5g.num_qgroups + - d->acc100_conf.q_ul_5g.num_aqs_per_groups * - d->acc100_conf.q_ul_5g.num_qgroups + - d->acc100_conf.q_dl_4g.num_aqs_per_groups * - d->acc100_conf.q_dl_4g.num_qgroups + - d->acc100_conf.q_ul_4g.num_aqs_per_groups * + /* Expose number of queues */ + dev_info->num_queues[RTE_BBDEV_OP_NONE] = 0; + dev_info->num_queues[RTE_BBDEV_OP_TURBO_DEC] = d->acc100_conf.q_ul_4g.num_aqs_per_groups * d->acc100_conf.q_ul_4g.num_qgroups; + dev_info->num_queues[RTE_BBDEV_OP_TURBO_ENC] = d->acc100_conf.q_dl_4g.num_aqs_per_groups * + d->acc100_conf.q_dl_4g.num_qgroups; + dev_info->num_queues[RTE_BBDEV_OP_LDPC_DEC] = d->acc100_conf.q_ul_5g.num_aqs_per_groups * + d->acc100_conf.q_ul_5g.num_qgroups; + dev_info->num_queues[RTE_BBDEV_OP_LDPC_ENC] = d->acc100_conf.q_dl_5g.num_aqs_per_groups * + d->acc100_conf.q_dl_5g.num_qgroups; + dev_info->queue_priority[RTE_BBDEV_OP_TURBO_DEC] = d->acc100_conf.q_ul_4g.num_qgroups; + dev_info->queue_priority[RTE_BBDEV_OP_TURBO_ENC] = d->acc100_conf.q_dl_4g.num_qgroups; + dev_info->queue_priority[RTE_BBDEV_OP_LDPC_DEC] = d->acc100_conf.q_ul_5g.num_qgroups; + dev_info->queue_priority[RTE_BBDEV_OP_LDPC_ENC] = d->acc100_conf.q_dl_5g.num_qgroups; + dev_info->max_num_queues = 0; + for (i = RTE_BBDEV_OP_TURBO_DEC; i <= RTE_BBDEV_OP_LDPC_ENC; i++) + dev_info->max_num_queues += dev_info->num_queues[i]; dev_info->queue_size_lim = ACC100_MAX_QUEUE_DEPTH; dev_info->hardware_accelerated = true; dev_info->max_dl_queue_priority = 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 3c36d09730..d520d5238f 100644 --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c @@ -379,6 +379,14 @@ fpga_dev_info_get(struct rte_bbdev *dev, if (hw_q_id != FPGA_INVALID_HW_QUEUE_ID) dev_info->max_num_queues++; } + /* Expose number of queue per operation type */ + dev_info->num_queues[RTE_BBDEV_OP_NONE] = 0; + dev_info->num_queues[RTE_BBDEV_OP_TURBO_DEC] = 0; + dev_info->num_queues[RTE_BBDEV_OP_TURBO_ENC] = 0; + dev_info->num_queues[RTE_BBDEV_OP_LDPC_DEC] = dev_info->max_num_queues / 2; + dev_info->num_queues[RTE_BBDEV_OP_LDPC_ENC] = dev_info->max_num_queues / 2; + dev_info->queue_priority[RTE_BBDEV_OP_LDPC_DEC] = 1; + dev_info->queue_priority[RTE_BBDEV_OP_LDPC_ENC] = 1; } /** diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c index 67b44992b2..fc86f13bee 100644 --- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c @@ -655,6 +655,14 @@ fpga_dev_info_get(struct rte_bbdev *dev, if (hw_q_id != FPGA_INVALID_HW_QUEUE_ID) dev_info->max_num_queues++; } + /* Expose number of queue per operation type */ + dev_info->num_queues[RTE_BBDEV_OP_NONE] = 0; + dev_info->num_queues[RTE_BBDEV_OP_TURBO_DEC] = dev_info->max_num_queues / 2; + dev_info->num_queues[RTE_BBDEV_OP_TURBO_ENC] = dev_info->max_num_queues / 2; + dev_info->num_queues[RTE_BBDEV_OP_LDPC_DEC] = 0; + dev_info->num_queues[RTE_BBDEV_OP_LDPC_ENC] = 0; + dev_info->queue_priority[RTE_BBDEV_OP_TURBO_DEC] = 1; + dev_info->queue_priority[RTE_BBDEV_OP_TURBO_ENC] = 1; } /** diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c index 11a385ef56..bb754a5395 100644 --- a/drivers/baseband/la12xx/bbdev_la12xx.c +++ b/drivers/baseband/la12xx/bbdev_la12xx.c @@ -103,6 +103,13 @@ la12xx_info_get(struct rte_bbdev *dev __rte_unused, dev_info->min_alignment = 64; dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED; + dev_info->num_queues[RTE_BBDEV_OP_NONE] = 0; + dev_info->num_queues[RTE_BBDEV_OP_TURBO_DEC] = 0; + dev_info->num_queues[RTE_BBDEV_OP_TURBO_ENC] = 0; + dev_info->num_queues[RTE_BBDEV_OP_LDPC_DEC] = LA12XX_MAX_QUEUES / 2; + dev_info->num_queues[RTE_BBDEV_OP_LDPC_ENC] = LA12XX_MAX_QUEUES / 2; + dev_info->queue_priority[RTE_BBDEV_OP_LDPC_DEC] = 1; + dev_info->queue_priority[RTE_BBDEV_OP_LDPC_ENC] = 1; rte_bbdev_log_debug("got device info from %u", dev->data->dev_id); } diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c index 98489d218b..7afa298848 100644 --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c @@ -158,6 +158,8 @@ static void info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info) { struct bbdev_private *internals = dev->data->dev_private; + const struct rte_bbdev_op_cap *op_cap; + int num_op_type = 0; static const struct rte_bbdev_op_cap bbdev_capabilities[] = { #ifdef RTE_BBDEV_SDK_AVX2 @@ -257,6 +259,16 @@ info_get(struct rte_bbdev *dev, struct rte_bbdev_driver_info *dev_info) dev_info->data_endianness = RTE_LITTLE_ENDIAN; dev_info->device_status = RTE_BBDEV_DEV_NOT_SUPPORTED; + op_cap = bbdev_capabilities; + for (; op_cap->type != RTE_BBDEV_OP_NONE; ++op_cap) + num_op_type++; + op_cap = bbdev_capabilities; + if (num_op_type > 0) { + int num_queue_per_type = dev_info->max_num_queues / num_op_type; + for (; op_cap->type != RTE_BBDEV_OP_NONE; ++op_cap) + dev_info->num_queues[op_cap->type] = num_queue_per_type; + } + rte_bbdev_log_debug("got device info from %u\n", dev->data->dev_id); } From patchwork Mon Oct 3 18:00:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 117274 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 87047A04FD; Mon, 3 Oct 2022 20:34:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1705342B71; Mon, 3 Oct 2022 20:33:43 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id AAC9C427EC for ; Mon, 3 Oct 2022 20:33:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664822019; x=1696358019; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TGiC6F/zB9tSGMDYUSbG0SAtFux4zZOYYfLImqLD1pE=; b=n4VBNwzEgdbxigavI3gN7nK3qZbMNa4UHVp54gWnPGJQ2EtDif5XPRjz CS8BLbeu9Y6rInOZsy22B3+fElJCq6YWpxCrf8/qhL4e+KG3+xq7wz8Kj o+9u2VlcI50kpHm1St465yXysRgpHcknK6pTNoHEADmiMG+iEd+erYZgn n2fKUvdxeQy5v8eAMDAEZbZ8bBa9U8wX+9FrRTOep4SKh41BTvb98sill MJkqJesI4yAQjcK3iRiwmg+8Gys4gu3OX3pUWbyULoxbJu23MmcMqaaqh TbUPqlnKTdQlf2X21UEzTJUC1PhgT9qzjA0wstPV6NnfNWAeTVAEZKn/3 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="285907051" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="285907051" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 11:00:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="618829409" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="618829409" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga007.jf.intel.com with ESMTP; 03 Oct 2022 11:00:38 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com Cc: maxime.coquelin@redhat.com, trix@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, mingshan.zhang@intel.com, hemant.agrawal@nxp.com, Nicolas Chautru Subject: [PATCH v11 5/7] bbdev: add new operation for FFT processing Date: Mon, 3 Oct 2022 11:00:21 -0700 Message-Id: <20221003180023.13362-6-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221003180023.13362-1-nicolas.chautru@intel.com> References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <20221003180023.13362-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 Extension of bbdev operation to support FFT based operations. Signed-off-by: Nicolas Chautru Acked-by: Hemant Agrawal Acked-by: Maxime Coquelin --- doc/guides/prog_guide/bbdev.rst | 103 +++++++++++++++++ doc/guides/rel_notes/deprecation.rst | 4 - doc/guides/rel_notes/release_22_11.rst | 5 + lib/bbdev/rte_bbdev.c | 10 +- lib/bbdev/rte_bbdev.h | 76 +++++++++++++ lib/bbdev/rte_bbdev_op.h | 149 +++++++++++++++++++++++++ lib/bbdev/version.map | 4 + 7 files changed, 346 insertions(+), 5 deletions(-) diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst index 70fa01ada5..1c7eb24148 100644 --- a/doc/guides/prog_guide/bbdev.rst +++ b/doc/guides/prog_guide/bbdev.rst @@ -1118,6 +1118,109 @@ Figure :numref:`figure_turbo_tb_decode` above showing the Turbo decoding of CBs using BBDEV interface in TB-mode is also valid for LDPC decode. +BBDEV FFT Operation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This operation allows to run a combination of DFT and/or IDFT and/or time-domain windowing. +These can be used in a modular fashion (using bypass modes) or as a processing pipeline +which can be used for FFT-based baseband signal processing. +In more details it allows : +- to process the data first through an IDFT of adjustable size and padding; +- to perform the windowing as a programmable cyclic shift offset of the data followed by a +pointwise multiplication by a time domain window; +- to process the related data through a DFT of adjustable size and de-padding for each such cyclic +shift output. + +A flexible number of Rx antennas are being processed in parallel with the same configuration. +The API allows more generally for flexibility in what the PMD may support (capability flags) and +flexibility to adjust some of the parameters of the processing. + +The operation/capability flags that can be set for each FFT operation are given below. + + **NOTE:** The actual operation flags that may be used with a specific + BBDEV PMD are dependent on the driver capabilities as reported via + ``rte_bbdev_info_get()``, and may be a subset of those below. + ++--------------------------------------------------------------------+ +|Description of FFT capability flags | ++====================================================================+ +|RTE_BBDEV_FFT_WINDOWING | +| Set to enable/support windowing in time domain | ++--------------------------------------------------------------------+ +|RTE_BBDEV_FFT_CS_ADJUSTMENT | +| Set to enable/support the cyclic shift time offset adjustment | ++--------------------------------------------------------------------+ +|RTE_BBDEV_FFT_DFT_BYPASS | +| Set to bypass the DFT and use directly the IDFT as an option | ++--------------------------------------------------------------------+ +|RTE_BBDEV_FFT_IDFT_BYPASS | +| Set to bypass the IDFT and use directly the DFT as an option | ++--------------------------------------------------------------------+ +|RTE_BBDEV_FFT_WINDOWING_BYPASS | +| Set to bypass the time domain windowing as an option | ++--------------------------------------------------------------------+ +|RTE_BBDEV_FFT_POWER_MEAS | +| Set to provide an optional power measurement of the DFT output | ++--------------------------------------------------------------------+ +|RTE_BBDEV_FFT_FP16_INPUT | +| Set if the input data shall use FP16 format instead of INT16 | ++--------------------------------------------------------------------+ +|RTE_BBDEV_FFT_FP16_OUTPUT | +| Set if the output data shall use FP16 format instead of INT16 | ++--------------------------------------------------------------------+ + +The FFT parameters are set out in the table below. + ++-------------------------+--------------------------------------------------------------+ +|Parameter |Description | ++=========================+==============================================================+ +|base_input |input data | ++-------------------------+--------------------------------------------------------------+ +|base_output |output data | ++-------------------------+--------------------------------------------------------------+ +|power_meas_output |optional output data with power measurement on DFT output | ++-------------------------+--------------------------------------------------------------+ +|op_flags |bitmask of all active operation capabilities | ++-------------------------+--------------------------------------------------------------+ +|input_sequence_size |size of the input sequence in 32-bits points per antenna | ++-------------------------+--------------------------------------------------------------+ +|input_leading_padding |number of points padded at the start of input data | ++-------------------------+--------------------------------------------------------------+ +|output_sequence_size |size of the output sequence per antenna and cyclic shift | ++-------------------------+--------------------------------------------------------------+ +|output_leading_depadding |number of points de-padded at the start of output data | ++-------------------------+--------------------------------------------------------------+ +|window_index |optional windowing profile index used for each cyclic shift | ++-------------------------+--------------------------------------------------------------+ +|cs_bitmap |bitmap of the cyclic shift output requested (LSB for index 0) | ++-------------------------+--------------------------------------------------------------+ +|num_antennas_log2 |number of antennas as a log2 (10 maps to 1024...) | ++-------------------------+--------------------------------------------------------------+ +|idft_log2 |iDFT size as a log2 | ++-------------------------+--------------------------------------------------------------+ +|dft_log2 |DFT size as a log2 | ++-------------------------+--------------------------------------------------------------+ +|cs_time_adjustment |adjustment of time position of all the cyclic shift output | ++-------------------------+--------------------------------------------------------------+ +|idft_shift |shift down of signal level post iDFT | ++-------------------------+--------------------------------------------------------------+ +|dft_shift |shift down of signal level post DFT | ++-------------------------+--------------------------------------------------------------+ +|ncs_reciprocal |inverse of max number of CS normalized to 15b (ie. 231 for 12)| ++-------------------------+--------------------------------------------------------------+ +|power_shift |shift down of level of power measurement when enabled | ++-------------------------+--------------------------------------------------------------+ +|fp16_exp_adjust |value added to FP16 exponent at conversion from INT16 | ++-------------------------+--------------------------------------------------------------+ + +The mbuf input ``base_input`` is mandatory for all BBDEV PMDs and is the +incoming data for the processing. Its size may not fit into an actual mbuf, but the +structure is used to pass iova address. +The mbuf output ``output`` is mandatory and is output of the FFT processing chain. +Each point is a complex number of 32bits : either as 2 INT16 or as 2 FP16 based when the option +supported. +The data layout is based on contiguous concatenation of output data first by cyclic shift then +by antenna. Sample code ----------- diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index b6485019d2..28ce054d77 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -120,10 +120,6 @@ Deprecation Notices ``RTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRY`` and ``RTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRY`` in DPDK 22.11. -* bbdev: Will extend API to support new operation type ``RTE_BBDEV_OP_FFT`` as per - this `RFC `__. - This should be updated in DPDK 22.11. - * cryptodev: Hide structures ``rte_cryptodev_sym_session`` and ``rte_cryptodev_asym_session`` to remove unnecessary indirection between session and the private data of session. An opaque pointer can be exposed diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 0b4e28f416..edc50e5647 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -102,6 +102,11 @@ New Features * Added AES-CCM support in lookaside protocol (IPsec) for CN9K & CN10K. * Added AES & DES DOCSIS algorithm support in lookaside crypto for CN9K. +* **Added new operation for FFT processing in bbdev.** + + Added a new operation type in bbdev for FFT processing with new functions + ``rte_bbdev_enqueue_fft_ops`` and ``rte_bbdev_dequeue_fft_ops`` and related structures. + * **Added eventdev adapter instance get API.** * Added ``rte_event_eth_rx_adapter_instance_get`` to get Rx adapter diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index 38630a23f8..9d65ba8cd3 100644 --- a/lib/bbdev/rte_bbdev.c +++ b/lib/bbdev/rte_bbdev.c @@ -24,7 +24,7 @@ #define DEV_NAME "BBDEV" /* Number of supported operation types */ -#define BBDEV_OP_TYPE_COUNT 5 +#define BBDEV_OP_TYPE_COUNT 6 /* BBDev library logging ID */ RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE); @@ -852,6 +852,9 @@ get_bbdev_op_size(enum rte_bbdev_op_type type) case RTE_BBDEV_OP_LDPC_ENC: result = sizeof(struct rte_bbdev_enc_op); break; + case RTE_BBDEV_OP_FFT: + result = sizeof(struct rte_bbdev_fft_op); + break; default: break; } @@ -875,6 +878,10 @@ bbdev_op_init(struct rte_mempool *mempool, void *arg, void *element, struct rte_bbdev_enc_op *op = element; memset(op, 0, mempool->elt_size); op->mempool = mempool; + } else if (type == RTE_BBDEV_OP_FFT) { + struct rte_bbdev_fft_op *op = element; + memset(op, 0, mempool->elt_size); + op->mempool = mempool; } } @@ -1125,6 +1132,7 @@ rte_bbdev_op_type_str(enum rte_bbdev_op_type op_type) "RTE_BBDEV_OP_TURBO_ENC", "RTE_BBDEV_OP_LDPC_DEC", "RTE_BBDEV_OP_LDPC_ENC", + "RTE_BBDEV_OP_FFT", }; if (op_type < BBDEV_OP_TYPE_COUNT) diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index 21d076cd36..2a9d9de79f 100644 --- a/lib/bbdev/rte_bbdev.h +++ b/lib/bbdev/rte_bbdev.h @@ -401,6 +401,12 @@ typedef uint16_t (*rte_bbdev_enqueue_dec_ops_t)( struct rte_bbdev_dec_op **ops, uint16_t num); +/** @internal Enqueue FFT operations for processing on queue of a device. */ +typedef uint16_t (*rte_bbdev_enqueue_fft_ops_t)( + struct rte_bbdev_queue_data *q_data, + struct rte_bbdev_fft_op **ops, + uint16_t num); + /** @internal Dequeue encode operations from a queue of a device. */ typedef uint16_t (*rte_bbdev_dequeue_enc_ops_t)( struct rte_bbdev_queue_data *q_data, @@ -411,6 +417,11 @@ typedef uint16_t (*rte_bbdev_dequeue_dec_ops_t)( struct rte_bbdev_queue_data *q_data, struct rte_bbdev_dec_op **ops, uint16_t num); +/** @internal Dequeue FFT operations from a queue of a device. */ +typedef uint16_t (*rte_bbdev_dequeue_fft_ops_t)( + struct rte_bbdev_queue_data *q_data, + struct rte_bbdev_fft_op **ops, uint16_t num); + #define RTE_BBDEV_NAME_MAX_LEN 64 /**< Max length of device name */ /** @@ -459,6 +470,10 @@ struct __rte_cache_aligned rte_bbdev { rte_bbdev_dequeue_enc_ops_t dequeue_ldpc_enc_ops; /** Dequeue decode function */ rte_bbdev_dequeue_dec_ops_t dequeue_ldpc_dec_ops; + /** Enqueue FFT function */ + rte_bbdev_enqueue_fft_ops_t enqueue_fft_ops; + /** Dequeue FFT function */ + rte_bbdev_dequeue_fft_ops_t dequeue_fft_ops; const struct rte_bbdev_ops *dev_ops; /**< Functions exported by PMD */ struct rte_bbdev_data *data; /**< Pointer to device data */ enum rte_bbdev_state state; /**< If device is currently used or not */ @@ -591,6 +606,36 @@ rte_bbdev_enqueue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id, return dev->enqueue_ldpc_dec_ops(q_data, ops, num_ops); } +/** + * Enqueue a burst of FFT operations to a queue of the device. + * This functions only enqueues as many operations as currently possible and + * does not block until @p num_ops entries in the queue are available. + * This function does not provide any error notification to avoid the + * corresponding overhead. + * + * @param dev_id + * The identifier of the device. + * @param queue_id + * The index of the queue. + * @param ops + * Pointer array containing operations to be enqueued Must have at least + * @p num_ops entries + * @param num_ops + * The maximum number of operations to enqueue. + * + * @return + * The number of operations actually enqueued (this is the number of processed + * entries in the @p ops array). + */ +__rte_experimental +static inline uint16_t +rte_bbdev_enqueue_fft_ops(uint16_t dev_id, uint16_t queue_id, + struct rte_bbdev_fft_op **ops, uint16_t num_ops) +{ + struct rte_bbdev *dev = &rte_bbdev_devices[dev_id]; + struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id]; + return dev->enqueue_fft_ops(q_data, ops, num_ops); +} /** * Dequeue a burst of processed encode operations from a queue of the device. @@ -716,6 +761,37 @@ rte_bbdev_dequeue_ldpc_dec_ops(uint16_t dev_id, uint16_t queue_id, return dev->dequeue_ldpc_dec_ops(q_data, ops, num_ops); } +/** + * Dequeue a burst of FFT operations from a queue of the device. + * This functions returns only the current contents of the queue, and does not + * block until @ num_ops is available. + * This function does not provide any error notification to avoid the + * corresponding overhead. + * + * @param dev_id + * The identifier of the device. + * @param queue_id + * The index of the queue. + * @param ops + * Pointer array where operations will be dequeued to. Must have at least + * @p num_ops entries + * @param num_ops + * The maximum number of operations to dequeue. + * + * @return + * The number of operations actually dequeued (this is the number of entries + * copied into the @p ops array). + */ +__rte_experimental +static inline uint16_t +rte_bbdev_dequeue_fft_ops(uint16_t dev_id, uint16_t queue_id, + struct rte_bbdev_fft_op **ops, uint16_t num_ops) +{ + struct rte_bbdev *dev = &rte_bbdev_devices[dev_id]; + struct rte_bbdev_queue_data *q_data = &dev->data->queues[queue_id]; + return dev->dequeue_fft_ops(q_data, ops, num_ops); +} + /** Definitions of device event types */ enum rte_bbdev_event_type { RTE_BBDEV_EVENT_UNKNOWN, /**< unknown event type */ diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h index 99a7552779..c322d15dd5 100644 --- a/lib/bbdev/rte_bbdev_op.h +++ b/lib/bbdev/rte_bbdev_op.h @@ -47,6 +47,8 @@ extern "C" { #define RTE_BBDEV_TURBO_MAX_CODE_BLOCKS (64) /* LDPC: Maximum number of Code Blocks in Transport Block.*/ #define RTE_BBDEV_LDPC_MAX_CODE_BLOCKS (256) +/* 12 CS maximum */ +#define RTE_BBDEV_MAX_CS_2 (6) /* * Maximum size to be used to manage the enum rte_bbdev_op_type @@ -218,6 +220,26 @@ enum rte_bbdev_op_ldpcenc_flag_bitmasks { RTE_BBDEV_LDPC_ENC_CONCATENATION = (1ULL << 7) }; +/** Flags for DFT operation and capability structure */ +enum rte_bbdev_op_fft_flag_bitmasks { + /** Flexible windowing capability */ + RTE_BBDEV_FFT_WINDOWING = (1ULL << 0), + /** Flexible adjustment of Cyclic Shift time offset */ + RTE_BBDEV_FFT_CS_ADJUSTMENT = (1ULL << 1), + /** Set for bypass the DFT and get directly into iDFT input */ + RTE_BBDEV_FFT_DFT_BYPASS = (1ULL << 2), + /** Set for bypass the IDFT and get directly the DFT output */ + RTE_BBDEV_FFT_IDFT_BYPASS = (1ULL << 3), + /** Set for bypass time domain windowing */ + RTE_BBDEV_FFT_WINDOWING_BYPASS = (1ULL << 4), + /** Set for optional power measurement on DFT output */ + RTE_BBDEV_FFT_POWER_MEAS = (1ULL << 5), + /** Set if the input data used FP16 format */ + RTE_BBDEV_FFT_FP16_INPUT = (1ULL << 6), + /** Set if the output data uses FP16 format */ + RTE_BBDEV_FFT_FP16_OUTPUT = (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 */ @@ -696,6 +718,55 @@ struct rte_bbdev_op_ldpc_enc { }; }; +/** Operation structure for FFT processing. + * + * The operation processes the data for multiple antennas in a single call + * (.i.e for all the REs belonging to a given SRS sequence for instance) + * + * The output mbuf data structure is expected to be allocated by the + * application with enough room for the output data. + */ +struct rte_bbdev_op_fft { + /** Input data starting from first antenna */ + struct rte_bbdev_op_data base_input; + /** Output data starting from first antenna and first cyclic shift */ + struct rte_bbdev_op_data base_output; + /** Optional power measurement output data */ + struct rte_bbdev_op_data power_meas_output; + /** Flags from rte_bbdev_op_fft_flag_bitmasks */ + uint32_t op_flags; + /** Input sequence size in 32-bits points */ + uint16_t input_sequence_size; + /** Padding at the start of the sequence */ + uint16_t input_leading_padding; + /** Output sequence size in 32-bits points */ + uint16_t output_sequence_size; + /** Depadding at the start of the DFT output */ + uint16_t output_leading_depadding; + /** Window index being used for each cyclic shift output */ + uint8_t window_index[RTE_BBDEV_MAX_CS_2]; + /** Bitmap of the cyclic shift output requested */ + uint16_t cs_bitmap; + /** Number of antennas as a log2 – 8 to 128 */ + uint8_t num_antennas_log2; + /** iDFT size as a log2 - 32 to 2048 */ + uint8_t idft_log2; + /** DFT size as a log2 - 8 to 2048 */ + uint8_t dft_log2; + /** Adjustment of position of the cyclic shifts - -31 to 31 */ + int8_t cs_time_adjustment; + /** iDFT shift down */ + int8_t idft_shift; + /** DFT shift down */ + int8_t dft_shift; + /** NCS reciprocal factor */ + uint16_t ncs_reciprocal; + /** power measurement out shift down */ + uint16_t power_shift; + /** Adjust the FP6 exponent for INT<->FP16 conversion */ + uint16_t fp16_exp_adjust; +}; + /** List of the capabilities for the Turbo Decoder */ struct rte_bbdev_op_cap_turbo_dec { /** Flags from rte_bbdev_op_td_flag_bitmasks */ @@ -748,6 +819,16 @@ struct rte_bbdev_op_cap_ldpc_enc { uint16_t num_buffers_dst; }; +/** List of the capabilities for the FFT */ +struct rte_bbdev_op_cap_fft { + /** Flags from rte_bbdev_op_fft_flag_bitmasks */ + uint32_t capability_flags; + /** Num input code block buffers */ + uint16_t num_buffers_src; + /** Num output code block buffers */ + uint16_t num_buffers_dst; +}; + /** Different operation types supported by the device. * The related macro RTE_BBDEV_OP_TYPE_SIZE_MAX can be used as an absolute maximum for * notably sizing array while allowing for future enumeration insertion. @@ -758,6 +839,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_FFT, /**< FFT */ /* Note: RTE_BBDEV_OP_TYPE_SIZE_MAX must be larger or equal to maximum enum value */ }; @@ -801,6 +883,18 @@ struct rte_bbdev_dec_op { }; }; +/** Structure specifying a single FFT operation */ +struct rte_bbdev_fft_op { + /** Status of operation that was performed */ + int status; + /** Mempool which op instance is in */ + struct rte_mempool *mempool; + /** Opaque pointer for user data */ + void *opaque_data; + /** Contains turbo decoder specific parameters */ + struct rte_bbdev_op_fft fft; +}; + /** Operation capabilities supported by a device */ struct rte_bbdev_op_cap { enum rte_bbdev_op_type type; /**< Type of operation */ @@ -809,6 +903,7 @@ struct rte_bbdev_op_cap { struct rte_bbdev_op_cap_turbo_enc turbo_enc; struct rte_bbdev_op_cap_ldpc_dec ldpc_dec; struct rte_bbdev_op_cap_ldpc_enc ldpc_enc; + struct rte_bbdev_op_cap_fft fft; } cap; /**< Operation-type specific capabilities */ }; @@ -927,6 +1022,42 @@ rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool, return 0; } +/** + * Bulk allocate FFT operations from a mempool with parameter defaults reset. + * + * @param mempool + * Operation mempool, created by rte_bbdev_op_pool_create(). + * @param ops + * Output array to place allocated operations + * @param num_ops + * Number of operations to allocate + * + * @returns + * - 0 on success + * - EINVAL if invalid mempool is provided + */ +__rte_experimental +static inline int +rte_bbdev_fft_op_alloc_bulk(struct rte_mempool *mempool, + struct rte_bbdev_fft_op **ops, uint16_t num_ops) +{ + struct rte_bbdev_op_pool_private *priv; + int ret; + + /* Check type */ + priv = (struct rte_bbdev_op_pool_private *) + rte_mempool_get_priv(mempool); + if (unlikely(priv->type != RTE_BBDEV_OP_FFT)) + return -EINVAL; + + /* Get elements */ + ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops); + if (unlikely(ret < 0)) + return ret; + + return 0; +} + /** * Free decode operation structures that were allocated by * rte_bbdev_dec_op_alloc_bulk(). @@ -961,6 +1092,24 @@ rte_bbdev_enc_op_free_bulk(struct rte_bbdev_enc_op **ops, unsigned int num_ops) rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops); } +/** + * Free encode operation structures that were allocated by + * *rte_bbdev_fft_op_alloc_bulk*. + * All structures must belong to the same mempool. + * + * @param ops + * Operation structures + * @param num_ops + * Number of structures + */ +__rte_experimental +static inline void +rte_bbdev_fft_op_free_bulk(struct rte_bbdev_fft_op **ops, unsigned int num_ops) +{ + if (num_ops > 0) + rte_mempool_put_bulk(ops[0]->mempool, (void **)ops, num_ops); +} + #ifdef __cplusplus } #endif diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map index addea05f00..db178917e2 100644 --- a/lib/bbdev/version.map +++ b/lib/bbdev/version.map @@ -44,5 +44,9 @@ EXPERIMENTAL { global: # added in 22.11 + rte_bbdev_dequeue_fft_ops; rte_bbdev_device_status_str; + rte_bbdev_enqueue_fft_ops; + rte_bbdev_fft_op_alloc_bulk; + rte_bbdev_fft_op_free_bulk; }; From patchwork Mon Oct 3 18:00:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 117275 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A2A0CA04FD; Mon, 3 Oct 2022 20:34:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE99642B76; Mon, 3 Oct 2022 20:33:43 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 0C21E427F4 for ; Mon, 3 Oct 2022 20:33:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664822020; x=1696358020; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bpvvvsd1JLScB5AY3WyZm+HEwkpZsDLnLY5H6cLx7rk=; b=oFlRCfIywVeJlIvN8X2kCHT/p/iD1fjWKhfOf1tZUKmEdDXYWl5rNgLV gOP2NvclW9wK2yNowJ1Sw14aRMOMjYI+uVQGqSk3fAAsRCtqxOF3xG3ZH utR+An/VUuyQv42/AaZqgqOY6HMo9sxlqIKKTFc26bRAajkWjchykxAe8 i0u0+JW6ZnRyHL3gA28IQ+OlA3T/taA1KXe8t7H2gBt/LFW2uWaPI+WIZ AusYIiAloNeJeTr9XOzR+W9u9e/+BMK6o2CklQiInCzecuIyE5hlhxcQ/ c6hFSYie7IRSYa+4xBhhsYlh9GiVpBfh2n3fEW4m4g4wpvHZ4RP+WF/In Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="285907055" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="285907055" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 11:00:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="618829413" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="618829413" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga007.jf.intel.com with ESMTP; 03 Oct 2022 11:00:39 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com Cc: maxime.coquelin@redhat.com, trix@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, mingshan.zhang@intel.com, hemant.agrawal@nxp.com, Nicolas Chautru Subject: [PATCH v11 6/7] bbdev: add queue related warning and status information Date: Mon, 3 Oct 2022 11:00:22 -0700 Message-Id: <20221003180023.13362-7-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221003180023.13362-1-nicolas.chautru@intel.com> References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <20221003180023.13362-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 This allows to expose more information with regards to any queue related failure and warning which cannot be supported in existing API. Signed-off-by: Nicolas Chautru Acked-by: Maxime Coquelin --- app/test-bbdev/test_bbdev_perf.c | 2 ++ doc/guides/rel_notes/release_22_11.rst | 3 ++ lib/bbdev/rte_bbdev.c | 19 ++++++++++++ lib/bbdev/rte_bbdev.h | 43 ++++++++++++++++++++++++++ lib/bbdev/version.map | 1 + 5 files changed, 68 insertions(+) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index f5eeb735b2..75f1ca4f14 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -4361,6 +4361,8 @@ get_bbdev_queue_stats(uint16_t dev_id, uint16_t queue_id, stats->dequeued_count = q_stats->dequeued_count; stats->enqueue_err_count = q_stats->enqueue_err_count; stats->dequeue_err_count = q_stats->dequeue_err_count; + stats->enqueue_warning_count = q_stats->enqueue_warning_count; + stats->dequeue_warning_count = q_stats->dequeue_warning_count; stats->acc_offload_cycles = q_stats->acc_offload_cycles; return 0; diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index edc50e5647..c55fb2a861 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -329,6 +329,9 @@ ABI Changes * bbdev: Structure ``rte_bbdev_driver_info`` was updated to add new parameters for queue topology, device status using ``rte_bbdev_device_status``. +* bbdev: Structure ``rte_bbdev_queue_data`` was updated to add new parameter + for enqueue status using ``rte_bbdev_enqueue_status``. + Known Issues ------------ diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index 9d65ba8cd3..bdd7c2f00d 100644 --- a/lib/bbdev/rte_bbdev.c +++ b/lib/bbdev/rte_bbdev.c @@ -721,6 +721,8 @@ get_stats_from_queues(struct rte_bbdev *dev, struct rte_bbdev_stats *stats) stats->dequeued_count += q_stats->dequeued_count; stats->enqueue_err_count += q_stats->enqueue_err_count; stats->dequeue_err_count += q_stats->dequeue_err_count; + stats->enqueue_warn_count += q_stats->enqueue_warn_count; + stats->dequeue_warn_count += q_stats->dequeue_warn_count; } rte_bbdev_log_debug("Got stats on %u", dev->data->dev_id); } @@ -1163,3 +1165,20 @@ rte_bbdev_device_status_str(enum rte_bbdev_device_status status) rte_bbdev_log(ERR, "Invalid device status"); return NULL; } + +const char * +rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status) +{ + static const char * const enq_sta_string[] = { + "RTE_BBDEV_ENQ_STATUS_NONE", + "RTE_BBDEV_ENQ_STATUS_QUEUE_FULL", + "RTE_BBDEV_ENQ_STATUS_RING_FULL", + "RTE_BBDEV_ENQ_STATUS_INVALID_OP", + }; + + if (status < sizeof(enq_sta_string) / sizeof(char *)) + return enq_sta_string[status]; + + rte_bbdev_log(ERR, "Invalid enqueue status"); + return NULL; +} diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index 2a9d9de79f..ed0d72d02a 100644 --- a/lib/bbdev/rte_bbdev.h +++ b/lib/bbdev/rte_bbdev.h @@ -35,6 +35,13 @@ extern "C" { #define RTE_BBDEV_MAX_DEVS 128 /**< Max number of devices */ #endif +/* + * Maximum size to be used to manage the enum rte_bbdev_enqueue_status + * including padding for future enum insertion. + * The enum values must be explicitly kept smaller or equal to this padded maximum size. + */ +#define RTE_BBDEV_ENQ_STATUS_SIZE_MAX 6 + /** Flags indicate current state of BBDEV device */ enum rte_bbdev_state { RTE_BBDEV_UNUSED, @@ -223,6 +230,21 @@ rte_bbdev_queue_start(uint16_t dev_id, uint16_t queue_id); int rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id); +/** + * Flags indicate the reason why a previous enqueue may not have + * consumed all requested operations. + * In case of multiple reasons the latter supersedes a previous one. + * The related macro RTE_BBDEV_ENQ_STATUS_SIZE_MAX can be used as an absolute maximum for + * notably sizing array while allowing for future enumeration insertion. + */ +enum rte_bbdev_enqueue_status { + RTE_BBDEV_ENQ_STATUS_NONE, /**< Nothing to report */ + RTE_BBDEV_ENQ_STATUS_QUEUE_FULL, /**< Not enough room in queue */ + RTE_BBDEV_ENQ_STATUS_RING_FULL, /**< Not enough room in ring */ + RTE_BBDEV_ENQ_STATUS_INVALID_OP, /**< Operation was rejected as invalid */ + /* Note: RTE_BBDEV_ENQ_STATUS_SIZE_MAX must be larger or equal to maximum enum value */ +}; + /** * Flags indicate the status of the device */ @@ -246,6 +268,12 @@ struct rte_bbdev_stats { uint64_t enqueue_err_count; /** Total error count on operations dequeued */ uint64_t dequeue_err_count; + /** Total warning count on operations enqueued */ + uint64_t enqueue_warn_count; + /** Total warning count on operations dequeued */ + uint64_t dequeue_warn_count; + /** Total enqueue status count based on rte_bbdev_enqueue_status enum */ + uint64_t enqueue_status_count[RTE_BBDEV_ENQ_STATUS_SIZE_MAX]; /** CPU cycles consumed by the (HW/SW) accelerator device to offload * the enqueue request to its internal queues. * - For a HW device this is the cycles consumed in MMIO write @@ -386,6 +414,7 @@ struct rte_bbdev_queue_data { void *queue_private; /**< Driver-specific per-queue data */ struct rte_bbdev_queue_conf conf; /**< Current configuration */ struct rte_bbdev_stats queue_stats; /**< Queue statistics */ + enum rte_bbdev_enqueue_status enqueue_status; /**< Enqueue status when op is rejected */ bool started; /**< Queue state */ }; @@ -938,6 +967,20 @@ __rte_experimental const char* rte_bbdev_device_status_str(enum rte_bbdev_device_status status); +/** + * Convert queue status from enum to string. + * + * @param status + * Queue status as enum. + * + * @returns + * Queue status as string or NULL if op_type is invalid. + * + */ +__rte_experimental +const char* +rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status); + #ifdef __cplusplus } #endif diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map index db178917e2..d0bb835255 100644 --- a/lib/bbdev/version.map +++ b/lib/bbdev/version.map @@ -47,6 +47,7 @@ EXPERIMENTAL { rte_bbdev_dequeue_fft_ops; rte_bbdev_device_status_str; rte_bbdev_enqueue_fft_ops; + rte_bbdev_enqueue_status_str; rte_bbdev_fft_op_alloc_bulk; rte_bbdev_fft_op_free_bulk; }; From patchwork Mon Oct 3 18:00:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 117276 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5381FA04FD; Mon, 3 Oct 2022 20:34:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC8DB42B79; Mon, 3 Oct 2022 20:33:44 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 45A24427F7 for ; Mon, 3 Oct 2022 20:33:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664822020; x=1696358020; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AW4pYxMoslSt1j5m4RBeZ7ptBzbL+QohFxXp7ruDp5o=; b=Tz3sqO/wlOi2d8AWTYhpcTiWIzcHP3QgGy+n0VSusdoeYh4kiMZM8bJg WNaU5HfGlF0MitHx77nxwx1yaA44Xj0mj3RQcqRr84cGqRG/288guBQzC kih+pfMFgrmEvJgrXGs+O7PgnQfYkhVAsLb4ulzO3Wxx8+yriIqKtlkvL aflDDnHEZdqlUGZABuYNav2Q1OEI9FYdLdedScPkTir6Zjk+ZNhc9deuG 4yrNoyuWgxGOevKNQOGjU6d55+dt8Rde7rNpKTF1JAQHB51PiOZzf1hGc I1Zx7+w2cRUJMdxjOHV7gAst80FwNb+KjbzBdVxATndCiReAVZ2r28WH6 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="285907059" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="285907059" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2022 11:00:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10489"; a="618829417" X-IronPort-AV: E=Sophos;i="5.93,366,1654585200"; d="scan'208";a="618829417" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga007.jf.intel.com with ESMTP; 03 Oct 2022 11:00:40 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com Cc: maxime.coquelin@redhat.com, trix@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, mingshan.zhang@intel.com, hemant.agrawal@nxp.com, Nicolas Chautru Subject: [PATCH v11 7/7] bbdev: remove unnecessary if-check Date: Mon, 3 Oct 2022 11:00:23 -0700 Message-Id: <20221003180023.13362-8-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221003180023.13362-1-nicolas.chautru@intel.com> References: <1655491040-183649-6-git-send-email-nicolas.chautru@intel.com> <20221003180023.13362-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 Code clean up due to if-check not required Signed-off-by: Nicolas Chautru Acked-by: Maxime Coquelin --- lib/bbdev/rte_bbdev_op.h | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/lib/bbdev/rte_bbdev_op.h b/lib/bbdev/rte_bbdev_op.h index c322d15dd5..e29a18d0e0 100644 --- a/lib/bbdev/rte_bbdev_op.h +++ b/lib/bbdev/rte_bbdev_op.h @@ -969,7 +969,6 @@ rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_enc_op **ops, uint16_t num_ops) { struct rte_bbdev_op_pool_private *priv; - int ret; /* Check type */ priv = (struct rte_bbdev_op_pool_private *) @@ -979,11 +978,7 @@ rte_bbdev_enc_op_alloc_bulk(struct rte_mempool *mempool, return -EINVAL; /* Get elements */ - ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops); - if (unlikely(ret < 0)) - return ret; - - return 0; + return rte_mempool_get_bulk(mempool, (void **)ops, num_ops); } /** @@ -1005,7 +1000,6 @@ rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_dec_op **ops, uint16_t num_ops) { struct rte_bbdev_op_pool_private *priv; - int ret; /* Check type */ priv = (struct rte_bbdev_op_pool_private *) @@ -1015,11 +1009,7 @@ rte_bbdev_dec_op_alloc_bulk(struct rte_mempool *mempool, return -EINVAL; /* Get elements */ - ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops); - if (unlikely(ret < 0)) - return ret; - - return 0; + return rte_mempool_get_bulk(mempool, (void **)ops, num_ops); } /** @@ -1042,20 +1032,14 @@ rte_bbdev_fft_op_alloc_bulk(struct rte_mempool *mempool, struct rte_bbdev_fft_op **ops, uint16_t num_ops) { struct rte_bbdev_op_pool_private *priv; - int ret; /* Check type */ - priv = (struct rte_bbdev_op_pool_private *) - rte_mempool_get_priv(mempool); + priv = (struct rte_bbdev_op_pool_private *) rte_mempool_get_priv(mempool); if (unlikely(priv->type != RTE_BBDEV_OP_FFT)) return -EINVAL; /* Get elements */ - ret = rte_mempool_get_bulk(mempool, (void **)ops, num_ops); - if (unlikely(ret < 0)) - return ret; - - return 0; + return rte_mempool_get_bulk(mempool, (void **)ops, num_ops); } /**