From patchwork Wed Jun 22 10:37:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kundapura, Ganapati" X-Patchwork-Id: 113233 X-Patchwork-Delegate: jerinj@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 6A0D2A04FD; Wed, 22 Jun 2022 12:38:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12E1440A8B; Wed, 22 Jun 2022 12:38:02 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id AFEA640689 for ; Wed, 22 Jun 2022 12:38:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655894280; x=1687430280; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=afWRgM/Wdx0g3Co62il6PODHaSgJfrFSHeGGLTgxM1s=; b=R2+I13aHz/O3MmtoeV4X7NgWqN+gVDObhmh++1BDf6+IW6UJBj5cShQp jJC958s2unw1yVBVw5KLLMyyxFg+dRyQ+ehjZtapi4sZBad4SqqdcWutk hus3wlrahyLdevRvJ/IzKDe2tHOFx4ysvpIn6Cr2oP+37tiTfYcaTJS79 0gJL7tkRnGK59GAvwz/Boli3aVzL61C89TWGyGv7SIPwrr/+XEiAF+fad 8SsMYwtS2jgF7C64TUJpZLitXyMJChBKmon0EEt++1Hg6IzSmKN2c4C8s 9cfBmxWjDJGi3sFpCfhdrLGNg2fhWdYBoZ1iv1VtdBtmywUnuGsRaoU9U g==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="281112369" X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="281112369" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 03:37:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="677472080" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2022 03:37:58 -0700 From: Ganapati Kundapura To: dev@dpdk.org, jerinj@marvell.com, jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com Subject: [PATCH v7 1/7] eventdev/eth_rx: add adapter instance get API Date: Wed, 22 Jun 2022 05:37:50 -0500 Message-Id: <20220622103756.421869-1-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220608121400.3954603-1-ganapati.kundapura@intel.com> References: <20220608121400.3954603-1-ganapati.kundapura@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 rte_event_eth_rx_adapter_instance_get() to get adapter instance id for specified ethernet device id and rx queue index. Signed-off-by: Ganapati Kundapura --- v7: * Remove allocation of instance array and storage of instnace id * in instance array * Use Rx adapter instance data to query instance id for specified * eth_dev_id and rx_queue_id v6: * rx adapter changes removed from patch4 and moved to patch1 v5: * patch is split into saperate patches v4: * Moved instance array allocation and instance id storage before adapter's nb_queue updation for handling the error case properly v3: * Fixed checkpatch error v2: * Fixed build issues * Added telemetry support for rte_event_eth_rx_adapter_instance_get * arranged functions in alphabetical order in version.map --- lib/eventdev/eventdev_pmd.h | 22 +++++ lib/eventdev/rte_event_eth_rx_adapter.c | 141 +++++++++++++++++++++++++++++--- lib/eventdev/rte_event_eth_rx_adapter.h | 24 ++++++ lib/eventdev/version.map | 1 + 4 files changed, 178 insertions(+), 10 deletions(-) diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h index 6940266..c58ba05 100644 --- a/lib/eventdev/eventdev_pmd.h +++ b/lib/eventdev/eventdev_pmd.h @@ -888,6 +888,26 @@ typedef int (*eventdev_eth_rx_adapter_vector_limits_get_t)( const struct rte_eventdev *dev, const struct rte_eth_dev *eth_dev, struct rte_event_eth_rx_adapter_vector_limits *limits); +/** + * Get Rx adapter instance id for Rx queue + * + * @param eth_dev_id + * Port identifier of ethernet device + * + * @param rx_queue_id + * Ethernet device Rx queue index + * + * @param[out] rxa_inst_id + * Pointer to Rx adapter instance identifier. + * Contains valid Rx adapter instance id when return value is 0 + * + * @return + * - 0: Success + * - <0: Error code on failure + */ +typedef int (*eventdev_eth_rx_adapter_instance_get_t) + (uint16_t eth_dev_id, uint16_t rx_queue_id, uint8_t *rxa_inst_id); + typedef uint32_t rte_event_pmd_selftest_seqn_t; extern int rte_event_pmd_selftest_seqn_dynfield_offset; @@ -1321,6 +1341,8 @@ struct eventdev_ops { eventdev_eth_rx_adapter_vector_limits_get_t eth_rx_adapter_vector_limits_get; /**< Get event vector limits for the Rx adapter */ + eventdev_eth_rx_adapter_instance_get_t eth_rx_adapter_instance_get; + /**< Get Rx adapter instance id for Rx queue */ eventdev_timer_adapter_caps_get_t timer_adapter_caps_get; /**< Get timer adapter capabilities */ diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index bf8741d..ebfa6ef 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -6,6 +6,7 @@ #include #endif #include +#include #include #include @@ -1415,15 +1416,13 @@ rxa_service_func(void *args) return 0; } -static int -rte_event_eth_rx_adapter_init(void) +static void * +rxa_memzone_array_get(const char *name, unsigned int elt_size, int nb_elems) { - const char *name = RXA_ADAPTER_ARRAY; const struct rte_memzone *mz; unsigned int sz; - sz = sizeof(*event_eth_rx_adapter) * - RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE; + sz = elt_size * nb_elems; sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE); mz = rte_memzone_lookup(name); @@ -1431,13 +1430,34 @@ rte_event_eth_rx_adapter_init(void) mz = rte_memzone_reserve_aligned(name, sz, rte_socket_id(), 0, RTE_CACHE_LINE_SIZE); if (mz == NULL) { - RTE_EDEV_LOG_ERR("failed to reserve memzone err = %" - PRId32, rte_errno); - return -rte_errno; + RTE_EDEV_LOG_ERR("failed to reserve memzone" + " name = %s, err = %" + PRId32, name, rte_errno); + return NULL; } } - event_eth_rx_adapter = mz->addr; + return mz->addr; +} + +static int +rte_event_eth_rx_adapter_init(void) +{ + uint8_t i; + + if (event_eth_rx_adapter == NULL) { + event_eth_rx_adapter = + rxa_memzone_array_get(RXA_ADAPTER_ARRAY, + sizeof(*event_eth_rx_adapter), + RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE); + if (event_eth_rx_adapter == NULL) + return -ENOMEM; + + for (i = 0; i < RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE; i++) + event_eth_rx_adapter[i] = NULL; + + } + return 0; } @@ -1450,6 +1470,7 @@ rxa_memzone_lookup(void) mz = rte_memzone_lookup(RXA_ADAPTER_ARRAY); if (mz == NULL) return -ENOMEM; + event_eth_rx_adapter = mz->addr; } @@ -1951,7 +1972,6 @@ rxa_sw_del(struct event_eth_rx_adapter *rx_adapter, int intrq; int sintrq; - if (rx_adapter->nb_queues == 0) return; @@ -2524,6 +2544,9 @@ rte_event_eth_rx_adapter_free(uint8_t id) { struct event_eth_rx_adapter *rx_adapter; + if (rxa_memzone_lookup()) + return -ENOMEM; + RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); rx_adapter = rxa_id_to_adapter(id); @@ -2561,6 +2584,9 @@ rte_event_eth_rx_adapter_queue_add(uint8_t id, struct eth_device_info *dev_info; struct rte_event_eth_rx_adapter_vector_limits limits; + if (rxa_memzone_lookup()) + return -ENOMEM; + RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); RTE_ETH_VALID_PORTID_OR_ERR_RET(eth_dev_id, -EINVAL); @@ -2726,6 +2752,9 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id, uint32_t *rx_wrr = NULL; int num_intr_vec; + if (rxa_memzone_lookup()) + return -ENOMEM; + RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(id, -EINVAL); RTE_ETH_VALID_PORTID_OR_ERR_RET(eth_dev_id, -EINVAL); @@ -2832,6 +2861,7 @@ rte_event_eth_rx_adapter_queue_del(uint8_t id, uint16_t eth_dev_id, rte_eventdev_trace_eth_rx_adapter_queue_del(id, eth_dev_id, rx_queue_id, ret); + return ret; } @@ -3286,6 +3316,97 @@ rte_event_eth_rx_adapter_queue_conf_get(uint8_t id, return 0; } +static int +rxa_is_queue_added(struct event_eth_rx_adapter *rx_adapter, + uint16_t eth_dev_id, + uint16_t rx_queue_id) +{ + struct eth_device_info *dev_info; + struct eth_rx_queue_info *queue_info; + + if (!rx_adapter->eth_devices) + return 0; + + dev_info = &rx_adapter->eth_devices[eth_dev_id]; + if (!dev_info || !dev_info->rx_queue) + return 0; + + queue_info = &dev_info->rx_queue[rx_queue_id]; + + return queue_info && queue_info->queue_enabled; +} + +#define rxa_evdev(rx_adapter) (&rte_eventdevs[(rx_adapter)->eventdev_id]) + +#define rxa_dev_instance_get(rx_adapter) \ + rxa_evdev((rx_adapter))->dev_ops->eth_rx_adapter_instance_get + +int +rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id, + uint16_t rx_queue_id, + uint8_t *rxa_inst_id) +{ + uint8_t id; + int ret = -EINVAL; + uint32_t caps; + struct event_eth_rx_adapter *rx_adapter; + + if (rxa_memzone_lookup()) + return -ENOMEM; + + if (eth_dev_id >= rte_eth_dev_count_avail()) { + RTE_EDEV_LOG_ERR("Invalid ethernet port id %u", eth_dev_id); + return -EINVAL; + } + + if (rx_queue_id >= rte_eth_devices[eth_dev_id].data->nb_rx_queues) { + RTE_EDEV_LOG_ERR("Invalid Rx queue %u", rx_queue_id); + return -EINVAL; + } + + if (rxa_inst_id == NULL) { + RTE_EDEV_LOG_ERR("rxa_inst_id cannot be NULL"); + return -EINVAL; + } + + /* Iterate through all adapter instances */ + for (id = 0; id < RTE_EVENT_ETH_RX_ADAPTER_MAX_INSTANCE; id++) { + rx_adapter = rxa_id_to_adapter(id); + if (!rx_adapter) + continue; + + if (rxa_is_queue_added(rx_adapter, eth_dev_id, rx_queue_id)) { + *rxa_inst_id = rx_adapter->id; + ret = 0; + } + + /* Rx adapter internally mainatains queue information + * for both internal port and DPDK service port. + * Eventdev PMD callback is called for future proof only and + * overrides the above return value if defined. + */ + caps = 0; + if (!rte_event_eth_rx_adapter_caps_get(rx_adapter->eventdev_id, + eth_dev_id, + &caps)) { + if (caps & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT) { + ret = rxa_dev_instance_get(rx_adapter) ? + rxa_dev_instance_get(rx_adapter) + (eth_dev_id, + rx_queue_id, + rxa_inst_id) + : -EINVAL; + } + } + + /* return if entry found */ + if (ret == 0) + return ret; + } + + return -EINVAL; +} + #define RXA_ADD_DICT(stats, s) rte_tel_data_add_dict_u64(d, #s, stats.s) static int diff --git a/lib/eventdev/rte_event_eth_rx_adapter.h b/lib/eventdev/rte_event_eth_rx_adapter.h index 3608a7b..a3313c8 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.h +++ b/lib/eventdev/rte_event_eth_rx_adapter.h @@ -38,6 +38,7 @@ * - rte_event_eth_rx_adapter_queue_stats_get() * - rte_event_eth_rx_adapter_queue_stats_reset() * - rte_event_eth_rx_adapter_event_port_get() + * - rte_event_eth_rx_adapter_instance_get() * * The application creates an ethernet to event adapter using * rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create() @@ -704,6 +705,29 @@ __rte_experimental int rte_event_eth_rx_adapter_event_port_get(uint8_t id, uint8_t *event_port_id); +/** + * Get RX adapter instance ID for a RX queue + * + * @param eth_dev_id + * Port identifier of Ethernet device. + * + * @param rx_queue_id + * Ethernet device receive queue index. + * + * @param[out] rxa_inst_id + * Pointer to store RX adapter instance identifier. + * Contains valid Rx adapter instance id when return value is 0 + * + * @return + * - 0: Success + * - <0: Error code on failure + */ +__rte_experimental +int +rte_event_eth_rx_adapter_instance_get(uint16_t eth_dev_id, + uint16_t rx_queue_id, + uint8_t *rxa_inst_id); + #ifdef __cplusplus } #endif diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index 886e2ec..d1ecda4 100644 --- a/lib/eventdev/version.map +++ b/lib/eventdev/version.map @@ -110,6 +110,7 @@ EXPERIMENTAL { rte_event_eth_rx_adapter_event_port_get; # added in 22.07 + rte_event_eth_rx_adapter_instance_get; rte_event_port_quiesce; rte_event_queue_attr_set; }; From patchwork Wed Jun 22 10:37:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kundapura, Ganapati" X-Patchwork-Id: 113234 X-Patchwork-Delegate: jerinj@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 E4475A04FD; Wed, 22 Jun 2022 12:38:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F261D4069C; Wed, 22 Jun 2022 12:38:05 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 8144D40689 for ; Wed, 22 Jun 2022 12:38:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655894281; x=1687430281; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=8xa+L8aRYOrn2NZa8kegqUZxl6Owp4RBk26f6ByIWTE=; b=TJLeoZpsotyUeAziX6MCLKiSW0mqMoLdeBD5pcquRvT42xEc4oBvuLZU QU8QPtmKib48hbEH5zIJwpkXPXuT4HwEIaB+D331SE5sY7Sn+S/CkW4hl VRsNuKFjEAJlE8FhT4iioNnaPjnlupf2P+AJUh7XCbRWgcoetUxTaWaaQ BcrND/Y/UHVExt+dJKG+kypZiZC/C9x4cin8kpDzFtU1eKhwDlG8o99/P iKFaAby/Pwb9oLfKlDySNpadMW2LrxdJUFh7Wi1Yi41KO9L698GXDK/9U /Dsaz6R6Ef5L7glweneiBjGq2qh/7OfnDKafAEEHP92IpG4HCeqLEMdom A==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="281112371" X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="281112371" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 03:37:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="677472087" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2022 03:37:59 -0700 From: Ganapati Kundapura To: dev@dpdk.org, jerinj@marvell.com, jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com Subject: [PATCH v7 2/7] eventdev/eth_rx: add telemetry callback for instance get Date: Wed, 22 Jun 2022 05:37:51 -0500 Message-Id: <20220622103756.421869-2-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220622103756.421869-1-ganapati.kundapura@intel.com> References: <20220608121400.3954603-1-ganapati.kundapura@intel.com> <20220622103756.421869-1-ganapati.kundapura@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 telemetry handler for rte_event_eth_rx_adapter_instance_get() to retrieve adapter instance id for specified ethernet device id and rx queue index. Signed-off-by: Ganapati Kundapura --- lib/eventdev/rte_event_eth_rx_adapter.c | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index ebfa6ef..d653550 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -3675,6 +3675,68 @@ handle_rxa_queue_stats_reset(const char *cmd __rte_unused, return ret; } +static int +handle_rxa_instance_get(const char *cmd __rte_unused, + const char *params, + struct rte_tel_data *d) +{ + uint8_t instance_id; + uint16_t rx_queue_id; + int eth_dev_id, ret = -1; + char *token, *l_params; + + if (params == NULL || strlen(params) == 0 || !isdigit(*params)) + return -1; + + l_params = strdup(params); + if (l_params == NULL) + return -ENOMEM; + token = strtok(l_params, ","); + RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1); + + /* Get device ID from parameter string */ + eth_dev_id = strtoul(token, NULL, 10); + RTE_ETH_VALID_PORTID_OR_GOTO_ERR_RET(eth_dev_id, -EINVAL); + + token = strtok(NULL, ","); + RTE_EVENT_ETH_RX_ADAPTER_TOKEN_VALID_OR_GOTO_ERR_RET(token, -1); + + /* Get Rx queue ID from parameter string */ + rx_queue_id = strtoul(token, NULL, 10); + if (rx_queue_id >= rte_eth_devices[eth_dev_id].data->nb_rx_queues) { + RTE_EDEV_LOG_ERR("Invalid rx queue_id %u", rx_queue_id); + ret = -EINVAL; + goto error; + } + + token = strtok(NULL, "\0"); + if (token != NULL) + RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" + " telemetry command, ignoring"); + + /* Parsing parameter finished */ + free(l_params); + + if (rte_event_eth_rx_adapter_instance_get(eth_dev_id, + rx_queue_id, + &instance_id)) { + RTE_EDEV_LOG_ERR("Failed to get RX adapter instance ID " + " for rx_queue_id = %d", rx_queue_id); + return -1; + } + + rte_tel_data_start_dict(d); + rte_tel_data_add_dict_u64(d, "eth_dev_id", eth_dev_id); + rte_tel_data_add_dict_u64(d, "rx_queue_id", rx_queue_id); + rte_tel_data_add_dict_u64(d, "rxa_instance_id", instance_id); + + return 0; + +error: + free(l_params); + return ret; +} + RTE_INIT(rxa_init_telemetry) { rte_telemetry_register_cmd("/eventdev/rxa_stats", @@ -3696,4 +3758,8 @@ RTE_INIT(rxa_init_telemetry) rte_telemetry_register_cmd("/eventdev/rxa_queue_stats_reset", handle_rxa_queue_stats_reset, "Reset Rx queue stats. Parameter: rxa_id, dev_id, queue_id"); + + rte_telemetry_register_cmd("/eventdev/rxa_rxq_instance_get", + handle_rxa_instance_get, + "Returns Rx adapter instance id. Parameter: dev_id, queue_id"); } From patchwork Wed Jun 22 10:37:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kundapura, Ganapati" X-Patchwork-Id: 113236 X-Patchwork-Delegate: jerinj@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 A67A2A04FD; Wed, 22 Jun 2022 12:38:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1694F4281C; Wed, 22 Jun 2022 12:38:08 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 039614069C for ; Wed, 22 Jun 2022 12:38:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655894282; x=1687430282; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Eq/HCc1H2oBQEyRORUbiN0o0f/CcolqfoqV+MOYu4XE=; b=YVq4KLcE+RzaEJLYT99MBSE+zLX+6ppShnAqpz3dfRmzK23YI8qc778W HJjW7SNhROgIdZ6FA6QzfHnCZGYbfnvMTkAImJyvMJIex5Grl6nIIscy3 jK4fC+CYrSx+cm/fRUgdNrFBfLHPuiGMY27+mj59ze1M5XRTOUOsRe9Vm CIkiz+7eRBYMKTJzLpTWY9+vWWuBf9IzYOE2vmCwBlYyEtu485VtgSg7r aEN0oA3Qj+fjMdSw7zxoucE5Fft45gsInGkirXeVvvXBz0bKZIs9bk3Ih IUl490t0z8WO157NfR5mf+6zUJZKCpITHatnfnmPkUtag5NXRS9qTa21t g==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="281112375" X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="281112375" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 03:38:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="677472093" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2022 03:37:59 -0700 From: Ganapati Kundapura To: dev@dpdk.org, jerinj@marvell.com, jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com Subject: [PATCH v7 3/7] test/eth_rx: add test case for instance get API Date: Wed, 22 Jun 2022 05:37:52 -0500 Message-Id: <20220622103756.421869-3-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220622103756.421869-1-ganapati.kundapura@intel.com> References: <20220608121400.3954603-1-ganapati.kundapura@intel.com> <20220622103756.421869-1-ganapati.kundapura@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 test case for rte_event_eth_rx_adapter_instance_get() Signed-off-by: Ganapati Kundapura --- app/test/test_event_eth_rx_adapter.c | 203 ++++++++++++++++++++++++++++++++++- 1 file changed, 202 insertions(+), 1 deletion(-) diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c index e358a70..1da7782 100644 --- a/app/test/test_event_eth_rx_adapter.c +++ b/app/test/test_event_eth_rx_adapter.c @@ -39,6 +39,7 @@ test_event_eth_rx_intr_adapter_common(void) #define TEST_INST_ID 0 #define TEST_DEV_ID 0 #define TEST_ETHDEV_ID 0 +#define TEST_ETH_QUEUE_ID 0 struct event_eth_rx_adapter_test_params { struct rte_mempool *mp; @@ -1001,6 +1002,202 @@ adapter_queue_conf(void) return TEST_SUCCESS; } +static int +adapter_pollq_instance_get(void) +{ + int err; + uint8_t inst_id; + uint16_t eth_dev_id; + struct rte_eth_dev_info dev_info; + struct rte_event_eth_rx_adapter_queue_conf queue_conf = {0}; + + /* Case 1: Test without configuring eth */ + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 2: Test with wrong eth port */ + eth_dev_id = rte_eth_dev_count_total() + 1; + err = rte_event_eth_rx_adapter_instance_get(eth_dev_id, + TEST_ETH_QUEUE_ID, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 3: Test with wrong rx queue */ + err = rte_eth_dev_info_get(TEST_ETHDEV_ID, &dev_info); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + dev_info.max_rx_queues + 1, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 4: Test with right instance, port & rxq */ + /* Add queue 1 to Rx adapter */ + queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID; + queue_conf.ev.sched_type = RTE_SCHED_TYPE_ATOMIC; + queue_conf.ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL; + queue_conf.servicing_weight = 1; /* poll queue */ + + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID, + &queue_conf); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID, + &inst_id); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d", + TEST_INST_ID, err); + + /* Add queue 2 to Rx adapter */ + queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID + 1; + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 1, + &queue_conf); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 1, + &inst_id); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d", + TEST_INST_ID, err); + + /* Add queue 3 to Rx adapter */ + queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID + 2; + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 2, + &queue_conf); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 2, + &inst_id); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d", + TEST_INST_ID, err); + + /* Case 5: Test with right instance, port & wrong rxq */ + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 3, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Delete all queues from the Rx adapter */ + err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, + -1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + return TEST_SUCCESS; +} + +static int +adapter_intrq_instance_get(void) +{ + int err; + uint8_t inst_id; + uint16_t eth_dev_id; + struct rte_eth_dev_info dev_info; + struct rte_event_eth_rx_adapter_queue_conf queue_conf = {0}; + + /* Case 1: Test without configuring eth */ + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 2: Test with wrong eth port */ + eth_dev_id = rte_eth_dev_count_total() + 1; + err = rte_event_eth_rx_adapter_instance_get(eth_dev_id, + TEST_ETH_QUEUE_ID, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 3: Test with wrong rx queue */ + err = rte_eth_dev_info_get(TEST_ETHDEV_ID, &dev_info); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + dev_info.max_rx_queues + 1, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 4: Test with right instance, port & rxq */ + /* Intr enabled eth device can have both polled and intr queues. + * Add polled queue 1 to Rx adapter + */ + queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID; + queue_conf.ev.sched_type = RTE_SCHED_TYPE_ATOMIC; + queue_conf.ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL; + queue_conf.servicing_weight = 1; /* poll queue */ + + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID, + &queue_conf); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID, + &inst_id); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d", + TEST_INST_ID, err); + + /* Add intr queue 2 to Rx adapter */ + queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID + 1; + queue_conf.servicing_weight = 0; /* intr queue */ + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 1, + &queue_conf); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 1, + &inst_id); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d", + TEST_INST_ID, err); + + /* Add intr queue 3 to Rx adapter */ + queue_conf.ev.queue_id = TEST_ETH_QUEUE_ID + 2; + queue_conf.servicing_weight = 0; /* intr queue */ + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 2, + &queue_conf); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 2, + &inst_id); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d", + TEST_INST_ID, err); + + /* Case 5: Test with right instance, port & wrong rxq */ + err = rte_event_eth_rx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 3, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Delete all queues from the Rx adapter */ + err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, + -1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + return TEST_SUCCESS; +} + static struct unit_test_suite event_eth_rx_tests = { .suite_name = "rx event eth adapter test suite", .setup = testsuite_setup, @@ -1019,6 +1216,8 @@ static struct unit_test_suite event_eth_rx_tests = { adapter_queue_event_buf_test), TEST_CASE_ST(adapter_create_with_params, adapter_free, adapter_queue_stats_test), + TEST_CASE_ST(adapter_create, adapter_free, + adapter_pollq_instance_get), TEST_CASES_END() /**< NULL terminate unit test array */ } }; @@ -1029,7 +1228,9 @@ static struct unit_test_suite event_eth_rx_intr_tests = { .teardown = testsuite_teardown_rx_intr, .unit_test_cases = { TEST_CASE_ST(adapter_create, adapter_free, - adapter_intr_queue_add_del), + adapter_intr_queue_add_del), + TEST_CASE_ST(adapter_create, adapter_free, + adapter_intrq_instance_get), TEST_CASES_END() /**< NULL terminate unit test array */ } }; From patchwork Wed Jun 22 10:37:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kundapura, Ganapati" X-Patchwork-Id: 113235 X-Patchwork-Delegate: jerinj@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 5DD2FA04FD; Wed, 22 Jun 2022 12:38:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 11A164280B; Wed, 22 Jun 2022 12:38:07 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 25787427EE for ; Wed, 22 Jun 2022 12:38:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655894282; x=1687430282; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HF8rspENHf8njPePyfB9atWn+EfhubG6RzA8Zxbmxus=; b=kSabAtN/W1QZLzBG+bEYNYGbEPs/DAYDUAzodDf//9j0IZVKEQ3MvP2o FdoU+rdC4yKt8SPEdJsQDRL2pZzYNkGU0WChMWPcI+6qiLnxEji7zzdCG wdppNzs8amsCKwoMto/If+JcLed+mjyyKrJHnxCRVklEGyiZqS63gNPvO ZozRCAkPUvrWZf2cHK71UdeTbjqXBlA89NCuKH7fGE+Hjj6mn/eWGfawg rX0oamCzoQCTFeo/VWCKg0c8s1zdtIVyvJuemIzHR+lxyCW7CIwrIX/Ga rQYAJobJHEGBSG9wON2lIH8uszK5I5pJFZzRTYrx0bZIJyPm5TUkay1QX A==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="281112378" X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="281112378" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 03:38:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="677472097" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2022 03:38:00 -0700 From: Ganapati Kundapura To: dev@dpdk.org, jerinj@marvell.com, jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com Subject: [PATCH v7 4/7] eventdev/eth_tx: add instance get API Date: Wed, 22 Jun 2022 05:37:53 -0500 Message-Id: <20220622103756.421869-4-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220622103756.421869-1-ganapati.kundapura@intel.com> References: <20220608121400.3954603-1-ganapati.kundapura@intel.com> <20220622103756.421869-1-ganapati.kundapura@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 rte_event_eth_tx_adapter_instance_get() to get the adapter instance id for specified ethernet device id and tx queue index. Signed-off-by: Ganapati Kundapura --- lib/eventdev/eventdev_pmd.h | 23 +++++++ lib/eventdev/rte_event_eth_tx_adapter.c | 102 +++++++++++++++++++++++++++++++- lib/eventdev/rte_event_eth_tx_adapter.h | 24 ++++++++ lib/eventdev/version.map | 1 + 4 files changed, 148 insertions(+), 2 deletions(-) diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h index c58ba05..f514a37 100644 --- a/lib/eventdev/eventdev_pmd.h +++ b/lib/eventdev/eventdev_pmd.h @@ -1274,6 +1274,27 @@ typedef int (*eventdev_eth_tx_adapter_stats_get_t)( typedef int (*eventdev_eth_tx_adapter_stats_reset_t)(uint8_t id, const struct rte_eventdev *dev); +/** + * Get TX adapter instance id for TX queue + * + * @param eth_dev_id + * Port identifier of Ethernet device + * + * @param tx_queue_id + * Ethernet device TX queue index + * + * @param[out] txa_inst_id + * Pointer to TX adapter instance identifier + * Contains valid Tx adapter instance id when return value is 0 + * + * @return + * - 0: Success + * - <0: Error code on failure + */ +typedef int (*eventdev_eth_tx_adapter_instance_get_t) + (uint16_t eth_dev_id, uint16_t tx_queue_id, uint8_t *txa_inst_id); + + /** Event device operations function pointer table */ struct eventdev_ops { eventdev_info_get_t dev_infos_get; /**< Get device info. */ @@ -1386,6 +1407,8 @@ struct eventdev_ops { /**< Get eth Tx adapter statistics */ eventdev_eth_tx_adapter_stats_reset_t eth_tx_adapter_stats_reset; /**< Reset eth Tx adapter statistics */ + eventdev_eth_tx_adapter_instance_get_t eth_tx_adapter_instance_get; + /**< Get Tx adapter instance id for Tx queue */ eventdev_selftest dev_selftest; /**< Start eventdev Selftest */ diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c index c700fb7..44a60cc 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.c +++ b/lib/eventdev/rte_event_eth_tx_adapter.c @@ -18,6 +18,9 @@ #define TXA_INVALID_DEV_ID INT32_C(-1) #define TXA_INVALID_SERVICE_ID INT64_C(-1) +#define TXA_ADAPTER_ARRAY "txa_adapter_array" +#define TXA_SERVICE_DATA_ARRAY "txa_service_data_array" + #define txa_evdev(id) (&rte_eventdevs[txa_dev_id_array[(id)]]) #define txa_dev_caps_get(id) txa_evdev((id))->dev_ops->eth_tx_adapter_caps_get @@ -41,6 +44,9 @@ #define txa_dev_stats_get(t) txa_evdev(t)->dev_ops->eth_tx_adapter_stats_get +#define txa_dev_instance_get(id) \ + txa_evdev(id)->dev_ops->eth_tx_adapter_instance_get + #define RTE_EVENT_ETH_TX_ADAPTER_ID_VALID_OR_ERR_RET(id, retval) \ do { \ if (!txa_valid_id(id)) { \ @@ -194,12 +200,34 @@ txa_memzone_array_get(const char *name, unsigned int elt_size, int nb_elems) } static int +txa_lookup(void) +{ + const struct rte_memzone *mz; + + if (txa_dev_id_array == NULL) { + mz = rte_memzone_lookup(TXA_ADAPTER_ARRAY); + if (mz == NULL) + return -ENOMEM; + txa_dev_id_array = mz->addr; + } + + if (txa_service_data_array == NULL) { + mz = rte_memzone_lookup(TXA_SERVICE_DATA_ARRAY); + if (mz == NULL) + return -ENOMEM; + txa_service_data_array = mz->addr; + } + + return 0; +} + +static int txa_dev_id_array_init(void) { if (txa_dev_id_array == NULL) { int i; - txa_dev_id_array = txa_memzone_array_get("txa_adapter_array", + txa_dev_id_array = txa_memzone_array_get(TXA_ADAPTER_ARRAY, sizeof(int), RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE); if (txa_dev_id_array == NULL) @@ -222,12 +250,18 @@ static int txa_service_data_init(void) { if (txa_service_data_array == NULL) { + int i; + txa_service_data_array = - txa_memzone_array_get("txa_service_data_array", + txa_memzone_array_get(TXA_SERVICE_DATA_ARRAY, sizeof(*txa_service_data_array), RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE); if (txa_service_data_array == NULL) return -ENOMEM; + + /* Reset the txa service pointers */ + for (i = 0; i < RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE; i++) + txa_service_data_array[i] = NULL; } return 0; @@ -1218,3 +1252,67 @@ rte_event_eth_tx_adapter_stop(uint8_t id) rte_eventdev_trace_eth_tx_adapter_stop(id, ret); return ret; } + +int +rte_event_eth_tx_adapter_instance_get(uint16_t eth_dev_id, + uint16_t tx_queue_id, + uint8_t *txa_inst_id) +{ + uint8_t id; + int ret = -EINVAL; + uint32_t caps; + struct txa_service_data *txa; + + if (txa_lookup()) + return -ENOMEM; + + if (eth_dev_id >= rte_eth_dev_count_avail()) { + RTE_EDEV_LOG_ERR("Invalid ethernet port id %u", eth_dev_id); + return -EINVAL; + } + + if (tx_queue_id >= rte_eth_devices[eth_dev_id].data->nb_tx_queues) { + RTE_EDEV_LOG_ERR("Invalid tx queue id %u", tx_queue_id); + return -EINVAL; + } + + if (txa_inst_id == NULL) { + RTE_EDEV_LOG_ERR("txa_instance_id cannot be NULL"); + return -EINVAL; + } + + /* Iterate through all Tx adapter instances */ + for (id = 0; id < RTE_EVENT_ETH_TX_ADAPTER_MAX_INSTANCE; id++) { + txa = txa_service_id_to_data(id); + if (!txa) + continue; + + caps = 0; + if (rte_event_eth_tx_adapter_caps_get(txa->eventdev_id, + eth_dev_id, + &caps)) + continue; + + if (caps & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT) { + ret = txa_dev_instance_get(id) ? + txa_dev_instance_get(id)(eth_dev_id, + tx_queue_id, + txa_inst_id) + : -EINVAL; + if (ret == 0) + return ret; + } else { + struct rte_eth_dev *eth_dev; + + eth_dev = &rte_eth_devices[eth_dev_id]; + + if (txa_service_is_queue_added(txa, eth_dev, + tx_queue_id)) { + *txa_inst_id = txa->id; + return 0; + } + } + } + + return -EINVAL; +} diff --git a/lib/eventdev/rte_event_eth_tx_adapter.h b/lib/eventdev/rte_event_eth_tx_adapter.h index 3908c2d..9432b74 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.h +++ b/lib/eventdev/rte_event_eth_tx_adapter.h @@ -34,6 +34,7 @@ * - rte_event_eth_tx_adapter_enqueue() * - rte_event_eth_tx_adapter_event_port_get() * - rte_event_eth_tx_adapter_service_id_get() + * - rte_event_eth_tx_adapter_instance_get() * * The application creates the adapter using * rte_event_eth_tx_adapter_create() or rte_event_eth_tx_adapter_create_ext(). @@ -423,6 +424,29 @@ rte_event_eth_tx_adapter_stats_reset(uint8_t id); int rte_event_eth_tx_adapter_service_id_get(uint8_t id, uint32_t *service_id); +/** + * Get TX adapter instance id for TX queue + * + * @param eth_dev_id + * Port identifier of Ethernet device + * + * @param tx_queue_id + * Etherdev device TX queue index + * + * @param[out] txa_inst_id + * Pointer to TX adapter instance identifier + * Contains valid Tx adapter instance id when return value is 0 + * + * @return + * - 0: Success + * - <0: Error code on failure + */ +__rte_experimental +int +rte_event_eth_tx_adapter_instance_get(uint16_t eth_dev_id, + uint16_t tx_queue_id, + uint8_t *txa_inst_id); + #ifdef __cplusplus } #endif diff --git a/lib/eventdev/version.map b/lib/eventdev/version.map index d1ecda4..dd9255c 100644 --- a/lib/eventdev/version.map +++ b/lib/eventdev/version.map @@ -111,6 +111,7 @@ EXPERIMENTAL { # added in 22.07 rte_event_eth_rx_adapter_instance_get; + rte_event_eth_tx_adapter_instance_get; rte_event_port_quiesce; rte_event_queue_attr_set; }; From patchwork Wed Jun 22 10:37:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kundapura, Ganapati" X-Patchwork-Id: 113237 X-Patchwork-Delegate: jerinj@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 3043BA04FD; Wed, 22 Jun 2022 12:38:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24A7E4282A; Wed, 22 Jun 2022 12:38:09 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id C8E21427F3 for ; Wed, 22 Jun 2022 12:38:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655894283; x=1687430283; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=UQv1w6d4dfRauLfCcjDC5vnTtbeYhgAjCm4v9V4OWeg=; b=nVIB10wXTXeg3uwM+o+1A91lPvtRyJLvpW9UQ/d4oHK+dbIFXgdR8Dur K+ir2wnZTexeKrg/LpXv0EC4/IV2mUP4KcpCrfRrp2NYcVRxrlgbJzYYh rf9EHcZJgZjNndOGusYcpSqOndfJ9Z5B3PFktzdvUGMaYCT4QEVT3mtqX VuUELxXoeusZDKQS9/Ej6DUEY1owv6HSaa6HmCmM2EfHddmjAO6JGokH3 5MtSCkvbuTwM1Z+KDo+JN19eEKKl8L0W6QsOXf+LaclWoilf09mGZf3N0 xYDxIHy/+NIAIJlkVYLTFKdsGCBb8BPi3HmwViGJorRXidGrc5Vml/bEA g==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="281112381" X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="281112381" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 03:38:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="677472102" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2022 03:38:00 -0700 From: Ganapati Kundapura To: dev@dpdk.org, jerinj@marvell.com, jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com Subject: [PATCH v7 5/7] test/eth_tx: add testcase for instance get API Date: Wed, 22 Jun 2022 05:37:54 -0500 Message-Id: <20220622103756.421869-5-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220622103756.421869-1-ganapati.kundapura@intel.com> References: <20220608121400.3954603-1-ganapati.kundapura@intel.com> <20220622103756.421869-1-ganapati.kundapura@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 testcase for rte_event_eth_tx_adapter_instance_get() Signed-off-by: Ganapati Kundapura --- app/test/test_event_eth_tx_adapter.c | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c index 2900532..98debfd 100644 --- a/app/test/test_event_eth_tx_adapter.c +++ b/app/test/test_event_eth_tx_adapter.c @@ -29,6 +29,7 @@ test_event_eth_tx_adapter_common(void) #define MAX_NUM_QUEUE RTE_PMD_RING_MAX_RX_RINGS #define TEST_INST_ID 0 #define TEST_DEV_ID 0 +#define TEST_ETH_QUEUE_ID 0 #define SOCKET0 0 #define RING_SIZE 256 #define ETH_NAME_LEN 32 @@ -639,6 +640,78 @@ tx_adapter_service(void) } static int +tx_adapter_instance_get(void) +{ + int err; + uint8_t inst_id; + uint16_t eth_dev_id; + struct rte_eth_dev_info dev_info; + + /* Case 1: Test without configuring eth */ + err = rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 2: Test with wrong eth port */ + eth_dev_id = rte_eth_dev_count_total() + 1; + err = rte_event_eth_tx_adapter_instance_get(eth_dev_id, + TEST_ETH_QUEUE_ID, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 3: Test with wrong tx queue */ + err = rte_eth_dev_info_get(TEST_ETHDEV_ID, &dev_info); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, + dev_info.max_tx_queues + 1, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 4: Test with right instance, port & rxq */ + /* Add queue to tx adapter */ + err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID, + &inst_id); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d", + TEST_INST_ID, err); + + /* Add another queue to tx adapter */ + err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 1, + &inst_id); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + TEST_ASSERT(inst_id == TEST_INST_ID, "Expected %d got %d", + TEST_INST_ID, err); + + /* Case 5: Test with right instance, port & wrong rxq */ + err = rte_event_eth_tx_adapter_instance_get(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 2, + &inst_id); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Delete all queues from the Tx adapter */ + err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, + -1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + return TEST_SUCCESS; +} + +static int tx_adapter_dynamic_device(void) { uint16_t port_id = rte_eth_dev_count_avail(); @@ -695,6 +768,8 @@ static struct unit_test_suite event_eth_tx_tests = { tx_adapter_start_stop), TEST_CASE_ST(tx_adapter_create, tx_adapter_free, tx_adapter_service), + TEST_CASE_ST(tx_adapter_create, tx_adapter_free, + tx_adapter_instance_get), TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device), TEST_CASES_END() /**< NULL terminate unit test array */ } From patchwork Wed Jun 22 10:37:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kundapura, Ganapati" X-Patchwork-Id: 113238 X-Patchwork-Delegate: jerinj@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 B65B8A04FD; Wed, 22 Jun 2022 12:38:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2472E42847; Wed, 22 Jun 2022 12:38:10 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 6B176427F3 for ; Wed, 22 Jun 2022 12:38:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655894284; x=1687430284; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=VJGEymrS++m5x3kJdyF96z+okocOJiO4ocNau7lPKVw=; b=AR9aDt2woTqXuzhZtoaBjSSNjcTVzPdav7StECAYGZvwxDjgR/fILkvJ J21YpvP+lW2j2V2cbbyCb3m4ezEBpHJEpoagy9vIFcn2dxi1FzZpHZ2V/ YSpSJh8GYZWIzw09/tg1GrS94kSfSi/gOIYQm+SIzLZGrV769eW9H/Mac dWV/NtzYasg6+Df+vkCIWHsR/BQvqNrzD/i9+D6kvaj15wNSRAMoY9Yvz VpAOx4Iu8lV9oVZiuXCuZqvJ/CnZVH9ZLX8tpDBA9kOpmmm6XUtI/LW3h 3rScfQ1+DiJ3db9G0XO/fEHvYXx1b7k8tUuMPEXDKQUCNkAdg3vZdWad5 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="281112392" X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="281112392" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 03:38:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="677472109" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2022 03:38:02 -0700 From: Ganapati Kundapura To: dev@dpdk.org, jerinj@marvell.com, jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com Subject: [PATCH v7 6/7] doc/eth_rx: update instance get API Date: Wed, 22 Jun 2022 05:37:55 -0500 Message-Id: <20220622103756.421869-6-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220622103756.421869-1-ganapati.kundapura@intel.com> References: <20220608121400.3954603-1-ganapati.kundapura@intel.com> <20220622103756.421869-1-ganapati.kundapura@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 rte_event_eth_rx_adapter_instance_get() details Signed-off-by: Ganapati Kundapura --- doc/guides/prog_guide/event_ethernet_rx_adapter.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst index 3b4ef50..5b9d0cf 100644 --- a/doc/guides/prog_guide/event_ethernet_rx_adapter.rst +++ b/doc/guides/prog_guide/event_ethernet_rx_adapter.rst @@ -177,6 +177,12 @@ used otherwise it returns -EINVAL. The ``rte_event_eth_rx_adapter_queue_stats_reset`` function can be used to reset queue level stats when queue level event buffer is in use. +Getting Adapter instance id +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``rte_event_eth_rx_adapter_instance_get()`` function reports +rx adapter instance id for a specified ethernet device id and rx queue index. + Interrupt Based Rx Queues ~~~~~~~~~~~~~~~~~~~~~~~~~~ From patchwork Wed Jun 22 10:37:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kundapura, Ganapati" X-Patchwork-Id: 113239 X-Patchwork-Delegate: jerinj@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 26470A04FD; Wed, 22 Jun 2022 12:38:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 371E142B6D; Wed, 22 Jun 2022 12:38:11 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 667E04069C for ; Wed, 22 Jun 2022 12:38:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655894284; x=1687430284; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=nJpJAtacN7Irn0ary9f1iARDbX7sesaZefViBAX1f04=; b=V+GDotCGwDP58yu0wHkrsudYaZ/jPOEQ/RLBoh/zte8i2+llkM0HXX0m on/L5MZG20NhAyNGdrDeuZAO0Uz+Bpqttgf3Nav9AWGHK0p+mKpAXXHWn Ac/8bjUVx4jaynHxasyj09zZHQtlBPpnezR8LEv+Af9tRogCfEVDEf+gL 45D1NVsdHg3e8xU5rTG7z4ZO8p1HWKm/qXzqlDC3Xcw4gpYroiuLBgzTj Q85XOHa7GdgBJa6H8JK+f3R0FA7XnVPduUB7CtUuc0AT2gIOqzDXtQQMI yCyuwe7L73ayG3WFLJvZbJuve11mNj0zqk+tkWcCT22d5fFcKbbkDijmC w==; X-IronPort-AV: E=McAfee;i="6400,9594,10385"; a="277929441" X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="277929441" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 03:38:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="677472115" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2022 03:38:02 -0700 From: Ganapati Kundapura To: dev@dpdk.org, jerinj@marvell.com, jay.jayatheerthan@intel.com, s.v.naga.harish.k@intel.com Subject: [PATCH v7 7/7] doc/eth_tx: update instance get API Date: Wed, 22 Jun 2022 05:37:56 -0500 Message-Id: <20220622103756.421869-7-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220622103756.421869-1-ganapati.kundapura@intel.com> References: <20220608121400.3954603-1-ganapati.kundapura@intel.com> <20220622103756.421869-1-ganapati.kundapura@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 rte_event_eth_tx_adapter_instance_get() details. Signed-off-by: Ganapati Kundapura --- doc/guides/prog_guide/event_ethernet_tx_adapter.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst index f80d226..dc3e6a1 100644 --- a/doc/guides/prog_guide/event_ethernet_tx_adapter.rst +++ b/doc/guides/prog_guide/event_ethernet_tx_adapter.rst @@ -165,6 +165,12 @@ in struct ``rte_event_eth_tx_adapter_stats``. The counter values are the sum of the counts from the eventdev PMD callback if the callback is supported, and the counts maintained by the service function, if one exists. +Getting Adapter instance id +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``rte_event_eth_tx_adapter_instanceget()`` function reports +tx adapter instance id for a specified ethernet device id and tx queue index. + Tx event vectorization ~~~~~~~~~~~~~~~~~~~~~~