From patchwork Tue Jul 30 12:49:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Zapolski X-Patchwork-Id: 57268 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C577B1C11B; Tue, 30 Jul 2019 15:09:29 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8E6C11C114 for ; Tue, 30 Jul 2019 15:09:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2019 06:09:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,326,1559545200"; d="scan'208";a="190862034" Received: from marcinzx-mobl.ger.corp.intel.com ([10.103.104.107]) by fmsmga001.fm.intel.com with ESMTP; 30 Jul 2019 06:09:24 -0700 From: Marcin Zapolski To: dev@dpdk.org Cc: Marcin Zapolski Date: Tue, 30 Jul 2019 14:49:49 +0200 Message-Id: <20190730124950.1293-2-marcinx.a.zapolski@intel.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20190730124950.1293-1-marcinx.a.zapolski@intel.com> References: <20190730124950.1293-1-marcinx.a.zapolski@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Make rte_eth_rx_burst, rte_eth_tx_burst and other static inline ethdev functions not inline. They are referencing DPDK internal structures and inlining forces those structures to be exposed to user applications. In internal testing with i40e NICs a performance drop of about 2% was observed with testpmd. Signed-off-by: Marcin Zapolski --- lib/librte_ethdev/rte_ethdev.c | 168 +++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev.h | 166 ++-------------------- lib/librte_ethdev/rte_ethdev_version.map | 12 ++ 3 files changed, 195 insertions(+), 151 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 17d183e1f..31432a956 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -749,6 +749,174 @@ rte_eth_dev_get_sec_ctx(uint16_t port_id) return rte_eth_devices[port_id].security_ctx; } +uint16_t +rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + uint16_t nb_rx; + +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); + RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0); + + if (queue_id >= dev->data->nb_rx_queues) { + RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", queue_id); + return 0; + } +#endif + nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id], + rx_pkts, nb_pkts); + +#ifdef RTE_ETHDEV_RXTX_CALLBACKS + if (unlikely(dev->post_rx_burst_cbs[queue_id] != NULL)) { + struct rte_eth_rxtx_callback *cb = + dev->post_rx_burst_cbs[queue_id]; + + do { + nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx, + nb_pkts, cb->param); + cb = cb->next; + } while (cb != NULL); + } +#endif + + return nb_rx; +} + +int +rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); + dev = &rte_eth_devices[port_id]; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP); + if (queue_id >= dev->data->nb_rx_queues) + return -EINVAL; + + return (int)(*dev->dev_ops->rx_queue_count)(dev, queue_id); +} + +int +rte_eth_rx_descriptor_done(uint16_t port_id, uint16_t queue_id, uint16_t offset) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP); + return (*dev->dev_ops->rx_descriptor_done)( + dev->data->rx_queues[queue_id], offset); +} + +int +rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id, + uint16_t offset) +{ + struct rte_eth_dev *dev; + void *rxq; + +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); +#endif + dev = &rte_eth_devices[port_id]; +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + if (queue_id >= dev->data->nb_rx_queues) + return -ENODEV; +#endif + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_status, -ENOTSUP); + rxq = dev->data->rx_queues[queue_id]; + + return (*dev->dev_ops->rx_descriptor_status)(rxq, offset); +} + +int +rte_eth_tx_descriptor_status(uint16_t port_id, + uint16_t queue_id, uint16_t offset) +{ + struct rte_eth_dev *dev; + void *txq; + +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); +#endif + dev = &rte_eth_devices[port_id]; +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + if (queue_id >= dev->data->nb_tx_queues) + return -ENODEV; +#endif + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_descriptor_status, -ENOTSUP); + txq = dev->data->tx_queues[queue_id]; + + return (*dev->dev_ops->tx_descriptor_status)(txq, offset); +} + +uint16_t +rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) +{ + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; + +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); + RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0); + + if (queue_id >= dev->data->nb_tx_queues) { + RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id); + return 0; + } +#endif + +#ifdef RTE_ETHDEV_RXTX_CALLBACKS + struct rte_eth_rxtx_callback *cb = dev->pre_tx_burst_cbs[queue_id]; + + if (unlikely(cb != NULL)) { + do { + nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts, + cb->param); + cb = cb->next; + } while (cb != NULL); + } +#endif + + return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], + tx_pkts, nb_pkts); +} + +#ifndef RTE_ETHDEV_TX_PREPARE_NOOP + +uint16_t +rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) +{ + struct rte_eth_dev *dev; + +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + if (!rte_eth_dev_is_valid_port(port_id)) { + RTE_ETHDEV_LOG(ERR, "Invalid TX port_id=%u\n", port_id); + rte_errno = EINVAL; + return 0; + } +#endif + + dev = &rte_eth_devices[port_id]; + +#ifdef RTE_LIBRTE_ETHDEV_DEBUG + if (queue_id >= dev->data->nb_tx_queues) { + RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id); + rte_errno = EINVAL; + return 0; + } +#endif + + if (!dev->tx_pkt_prepare) + return nb_pkts; + + return (*dev->tx_pkt_prepare)(dev->data->tx_queues[queue_id], + tx_pkts, nb_pkts); +} + +#endif + uint16_t rte_eth_dev_count(void) { diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index dc6596bc9..3438cb681 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -4078,40 +4078,9 @@ rte_eth_dev_get_sec_ctx(uint16_t port_id); * of pointers to *rte_mbuf* structures effectively supplied to the * *rx_pkts* array. */ -static inline uint16_t +uint16_t rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) -{ - struct rte_eth_dev *dev = &rte_eth_devices[port_id]; - uint16_t nb_rx; - -#ifdef RTE_LIBRTE_ETHDEV_DEBUG - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); - RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0); - - if (queue_id >= dev->data->nb_rx_queues) { - RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", queue_id); - return 0; - } -#endif - nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id], - rx_pkts, nb_pkts); - -#ifdef RTE_ETHDEV_RXTX_CALLBACKS - if (unlikely(dev->post_rx_burst_cbs[queue_id] != NULL)) { - struct rte_eth_rxtx_callback *cb = - dev->post_rx_burst_cbs[queue_id]; - - do { - nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx, - nb_pkts, cb->param); - cb = cb->next; - } while (cb != NULL); - } -#endif - - return nb_rx; -} + struct rte_mbuf **rx_pkts, const uint16_t nb_pkts); /** * Get the number of used descriptors of a rx queue @@ -4125,19 +4094,8 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id, * (-EINVAL) if *port_id* or *queue_id* is invalid * (-ENOTSUP) if the device does not support this function */ -static inline int -rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id) -{ - struct rte_eth_dev *dev; - - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); - dev = &rte_eth_devices[port_id]; - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP); - if (queue_id >= dev->data->nb_rx_queues) - return -EINVAL; - - return (int)(*dev->dev_ops->rx_queue_count)(dev, queue_id); -} +int +rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id); /** * Check if the DD bit of the specific RX descriptor in the queue has been set @@ -4154,15 +4112,9 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id) * - (-ENODEV) if *port_id* invalid. * - (-ENOTSUP) if the device does not support this function */ -static inline int -rte_eth_rx_descriptor_done(uint16_t port_id, uint16_t queue_id, uint16_t offset) -{ - struct rte_eth_dev *dev = &rte_eth_devices[port_id]; - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP); - return (*dev->dev_ops->rx_descriptor_done)( \ - dev->data->rx_queues[queue_id], offset); -} +int +rte_eth_rx_descriptor_done(uint16_t port_id, uint16_t queue_id, + uint16_t offset); #define RTE_ETH_RX_DESC_AVAIL 0 /**< Desc available for hw. */ #define RTE_ETH_RX_DESC_DONE 1 /**< Desc done, filled by hw. */ @@ -4201,26 +4153,9 @@ rte_eth_rx_descriptor_done(uint16_t port_id, uint16_t queue_id, uint16_t offset) * - (-ENOTSUP) if the device does not support this function. * - (-ENODEV) bad port or queue (only if compiled with debug). */ -static inline int +int rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id, - uint16_t offset) -{ - struct rte_eth_dev *dev; - void *rxq; - -#ifdef RTE_LIBRTE_ETHDEV_DEBUG - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); -#endif - dev = &rte_eth_devices[port_id]; -#ifdef RTE_LIBRTE_ETHDEV_DEBUG - if (queue_id >= dev->data->nb_rx_queues) - return -ENODEV; -#endif - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_status, -ENOTSUP); - rxq = dev->data->rx_queues[queue_id]; - - return (*dev->dev_ops->rx_descriptor_status)(rxq, offset); -} + uint16_t offset); #define RTE_ETH_TX_DESC_FULL 0 /**< Desc filled for hw, waiting xmit. */ #define RTE_ETH_TX_DESC_DONE 1 /**< Desc done, packet is transmitted. */ @@ -4259,25 +4194,8 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id, * - (-ENOTSUP) if the device does not support this function. * - (-ENODEV) bad port or queue (only if compiled with debug). */ -static inline int rte_eth_tx_descriptor_status(uint16_t port_id, - uint16_t queue_id, uint16_t offset) -{ - struct rte_eth_dev *dev; - void *txq; - -#ifdef RTE_LIBRTE_ETHDEV_DEBUG - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); -#endif - dev = &rte_eth_devices[port_id]; -#ifdef RTE_LIBRTE_ETHDEV_DEBUG - if (queue_id >= dev->data->nb_tx_queues) - return -ENODEV; -#endif - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_descriptor_status, -ENOTSUP); - txq = dev->data->tx_queues[queue_id]; - - return (*dev->dev_ops->tx_descriptor_status)(txq, offset); -} +int rte_eth_tx_descriptor_status(uint16_t port_id, + uint16_t queue_id, uint16_t offset); /** * Send a burst of output packets on a transmit queue of an Ethernet device. @@ -4345,36 +4263,9 @@ static inline int rte_eth_tx_descriptor_status(uint16_t port_id, * the transmit ring. The return value can be less than the value of the * *tx_pkts* parameter when the transmit ring is full or has been filled up. */ -static inline uint16_t +uint16_t rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **tx_pkts, uint16_t nb_pkts) -{ - struct rte_eth_dev *dev = &rte_eth_devices[port_id]; - -#ifdef RTE_LIBRTE_ETHDEV_DEBUG - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); - RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0); - - if (queue_id >= dev->data->nb_tx_queues) { - RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id); - return 0; - } -#endif - -#ifdef RTE_ETHDEV_RXTX_CALLBACKS - struct rte_eth_rxtx_callback *cb = dev->pre_tx_burst_cbs[queue_id]; - - if (unlikely(cb != NULL)) { - do { - nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts, - cb->param); - cb = cb->next; - } while (cb != NULL); - } -#endif - - return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts); -} + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); /** * Process a burst of output packets on a transmit queue of an Ethernet device. @@ -4431,36 +4322,9 @@ rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id, #ifndef RTE_ETHDEV_TX_PREPARE_NOOP -static inline uint16_t +uint16_t rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id, - struct rte_mbuf **tx_pkts, uint16_t nb_pkts) -{ - struct rte_eth_dev *dev; - -#ifdef RTE_LIBRTE_ETHDEV_DEBUG - if (!rte_eth_dev_is_valid_port(port_id)) { - RTE_ETHDEV_LOG(ERR, "Invalid TX port_id=%u\n", port_id); - rte_errno = EINVAL; - return 0; - } -#endif - - dev = &rte_eth_devices[port_id]; - -#ifdef RTE_LIBRTE_ETHDEV_DEBUG - if (queue_id >= dev->data->nb_tx_queues) { - RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id); - rte_errno = EINVAL; - return 0; - } -#endif - - if (!dev->tx_pkt_prepare) - return nb_pkts; - - return (*dev->tx_pkt_prepare)(dev->data->tx_queues[queue_id], - tx_pkts, nb_pkts); -} + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); #else diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index df9141825..ab590bb71 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -236,6 +236,18 @@ DPDK_19.05 { } DPDK_18.11; +DPDK_19.11 { + global: + + rte_eth_rx_burst; + rte_eth_rx_descriptor_done; + rte_eth_rx_descriptor_status; + rte_eth_rx_queue_count; + rte_eth_tx_burst; + rte_eth_tx_descriptor_status; + rte_eth_tx_prepare; +} DPDK_19.05; + EXPERIMENTAL { global: From patchwork Tue Jul 30 12:49:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Zapolski X-Patchwork-Id: 57269 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5CB981C126; Tue, 30 Jul 2019 15:09:34 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 566B41C027 for ; Tue, 30 Jul 2019 15:09:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2019 06:09:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,326,1559545200"; d="scan'208";a="190862038" Received: from marcinzx-mobl.ger.corp.intel.com ([10.103.104.107]) by fmsmga001.fm.intel.com with ESMTP; 30 Jul 2019 06:09:25 -0700 From: Marcin Zapolski To: dev@dpdk.org Cc: Marcin Zapolski Date: Tue, 30 Jul 2019 14:49:50 +0200 Message-Id: <20190730124950.1293-3-marcinx.a.zapolski@intel.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20190730124950.1293-1-marcinx.a.zapolski@intel.com> References: <20190730124950.1293-1-marcinx.a.zapolski@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [RFC 19.11 2/2] ethdev: hide DPDK internal struct from public API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Remove rte_eth_dev, rte_eth_dev_data and rte_eth_dev_ops from public API (make rte_ethdev_core APIs private). They are DPDK internal structures and as such should not be accessed by user applications directly. Signed-off-by: Marcin Zapolski --- drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/netvsc/hn_nvs.c | 1 + drivers/net/netvsc/hn_rxtx.c | 1 + lib/librte_ethdev/ethdev_private.h | 1 + lib/librte_ethdev/ethdev_profile.h | 1 + lib/librte_ethdev/rte_ethdev.h | 3 --- lib/librte_ethdev/rte_ethdev_driver.h | 1 + lib/librte_ethdev/rte_flow.c | 1 + lib/librte_ethdev/rte_flow_driver.h | 1 + lib/librte_ethdev/rte_mtr.c | 1 + lib/librte_ethdev/rte_mtr_driver.h | 1 + lib/librte_ethdev/rte_tm.c | 1 + lib/librte_ethdev/rte_tm_driver.h | 1 + lib/librte_eventdev/rte_event_eth_rx_adapter.c | 1 + lib/librte_eventdev/rte_event_eth_tx_adapter.c | 1 + lib/librte_eventdev/rte_eventdev.c | 1 + lib/librte_telemetry/rte_telemetry.c | 1 + 17 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index e548f9f63..f303030ab 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "../cxgbe_compat.h" #include "../cxgbe_ofld.h" diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c index 6b518685a..1c1a5cf05 100644 --- a/drivers/net/netvsc/hn_nvs.c +++ b/drivers/net/netvsc/hn_nvs.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index 7212780c1..d744976dc 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include diff --git a/lib/librte_ethdev/ethdev_private.h b/lib/librte_ethdev/ethdev_private.h index 7b787bf97..9dca7600b 100644 --- a/lib/librte_ethdev/ethdev_private.h +++ b/lib/librte_ethdev/ethdev_private.h @@ -6,6 +6,7 @@ #define _RTE_ETH_PRIVATE_H_ #include "rte_ethdev.h" +#include "rte_ethdev_core.h" #ifdef __cplusplus extern "C" { diff --git a/lib/librte_ethdev/ethdev_profile.h b/lib/librte_ethdev/ethdev_profile.h index 65031e6f3..99edb96b0 100644 --- a/lib/librte_ethdev/ethdev_profile.h +++ b/lib/librte_ethdev/ethdev_profile.h @@ -6,6 +6,7 @@ #define _RTE_ETHDEV_PROFILE_H_ #include "rte_ethdev.h" +#include "rte_ethdev_core.h" /** * Initialization of the Ethernet device profiling. diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 3438cb681..a8559ca2d 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -3993,9 +3993,6 @@ rte_eth_dev_pool_ops_supported(uint16_t port_id, const char *pool); void * rte_eth_dev_get_sec_ctx(uint16_t port_id); - -#include - /** * * Retrieve a burst of input packets from a receive queue of an Ethernet diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index 936ff8c98..be6720949 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -16,6 +16,7 @@ */ #include +#include #ifdef __cplusplus extern "C" { diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 18fcb018e..1ecc03fef 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -13,6 +13,7 @@ #include #include #include "rte_ethdev.h" +#include "rte_ethdev_core.h" #include "rte_flow_driver.h" #include "rte_flow.h" diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h index a0359853e..ad6eb7b5a 100644 --- a/lib/librte_ethdev/rte_flow_driver.h +++ b/lib/librte_ethdev/rte_flow_driver.h @@ -18,6 +18,7 @@ #include #include "rte_ethdev.h" +#include "rte_ethdev_core.h" #include "rte_flow.h" #ifdef __cplusplus diff --git a/lib/librte_ethdev/rte_mtr.c b/lib/librte_ethdev/rte_mtr.c index 3073ac03f..485489262 100644 --- a/lib/librte_ethdev/rte_mtr.c +++ b/lib/librte_ethdev/rte_mtr.c @@ -7,6 +7,7 @@ #include #include "rte_compat.h" #include "rte_ethdev.h" +#include "rte_ethdev_core.h" #include "rte_mtr_driver.h" #include "rte_mtr.h" diff --git a/lib/librte_ethdev/rte_mtr_driver.h b/lib/librte_ethdev/rte_mtr_driver.h index 3ec7ffa2a..2fae4cace 100644 --- a/lib/librte_ethdev/rte_mtr_driver.h +++ b/lib/librte_ethdev/rte_mtr_driver.h @@ -18,6 +18,7 @@ #include #include "rte_ethdev.h" +#include "rte_ethdev_core.h" #include "rte_mtr.h" #ifdef __cplusplus diff --git a/lib/librte_ethdev/rte_tm.c b/lib/librte_ethdev/rte_tm.c index 9709454f3..b32329060 100644 --- a/lib/librte_ethdev/rte_tm.c +++ b/lib/librte_ethdev/rte_tm.c @@ -6,6 +6,7 @@ #include #include "rte_ethdev.h" +#include "rte_ethdev_core.h" #include "rte_tm_driver.h" #include "rte_tm.h" diff --git a/lib/librte_ethdev/rte_tm_driver.h b/lib/librte_ethdev/rte_tm_driver.h index 90114ff53..675e0c371 100644 --- a/lib/librte_ethdev/rte_tm_driver.h +++ b/lib/librte_ethdev/rte_tm_driver.h @@ -18,6 +18,7 @@ #include #include "rte_ethdev.h" +#include "rte_ethdev_core.h" #include "rte_tm.h" #ifdef __cplusplus diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index 95dd47820..b0b642eb6 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c index d02ef57f4..52f3f3c55 100644 --- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "rte_eventdev_pmd.h" #include "rte_event_eth_tx_adapter.h" diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index f44c869cb..d29a8d7d9 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c index eb20cc651..a544728e1 100644 --- a/lib/librte_telemetry/rte_telemetry.c +++ b/lib/librte_telemetry/rte_telemetry.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include From patchwork Fri Sep 6 13:18:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Zapolski X-Patchwork-Id: 58876 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8D7B41F411; Fri, 6 Sep 2019 15:22:07 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 9C3AA1F3F7 for ; Fri, 6 Sep 2019 15:22:02 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2019 06:22:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,473,1559545200"; d="scan'208";a="199518065" Received: from marcinzx-mobl.ger.corp.intel.com ([10.103.104.109]) by fmsmga001.fm.intel.com with ESMTP; 06 Sep 2019 06:22:01 -0700 From: Marcin Zapolski To: dev@dpdk.org Cc: Marcin Zapolski Date: Fri, 6 Sep 2019 15:18:13 +0200 Message-Id: <20190906131813.1343-4-marcinx.a.zapolski@intel.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20190730124950.1293-1-marcinx.a.zapolski@intel.com> References: <20190730124950.1293-1-marcinx.a.zapolski@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [RFC 19.11 v2 3/3] ixgbe: make driver compatible with changes in ethdev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Modify ixgbe to be compatible with new rte_eth_dev structures layout. Signed-off-by: Marcin Zapolski --- drivers/net/ixgbe/ixgbe_ethdev.c | 30 +++--- drivers/net/ixgbe/ixgbe_ethdev.h | 23 ++--- drivers/net/ixgbe/ixgbe_rxtx.c | 111 +++++++++++++---------- drivers/net/ixgbe/ixgbe_rxtx.h | 9 +- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 22 +++-- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 23 +++-- drivers/net/ixgbe/ixgbe_vf_representor.c | 10 +- 7 files changed, 127 insertions(+), 101 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 03fc1f717..32b0bee12 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1086,9 +1086,9 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) PMD_INIT_FUNC_TRACE(); eth_dev->dev_ops = &ixgbe_eth_dev_ops; - eth_dev->rx_pkt_burst = &ixgbe_recv_pkts; - eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts; - eth_dev->tx_pkt_prepare = &ixgbe_prep_pkts; + eth_dev->fcns.rx_pkt_burst = &ixgbe_recv_pkts; + eth_dev->fcns.tx_pkt_burst = &ixgbe_xmit_pkts; + eth_dev->fcns.tx_pkt_prepare = &ixgbe_prep_pkts; /* * For secondary processes, we don't initialise any further as primary @@ -1328,8 +1328,8 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev) ixgbe_dev_close(eth_dev); eth_dev->dev_ops = NULL; - eth_dev->rx_pkt_burst = NULL; - eth_dev->tx_pkt_burst = NULL; + eth_dev->fcns.rx_pkt_burst = NULL; + eth_dev->fcns.tx_pkt_burst = NULL; /* Unlock any pending hardware semaphore */ ixgbe_swfw_lock_reset(hw); @@ -1619,8 +1619,8 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(); eth_dev->dev_ops = &ixgbevf_eth_dev_ops; - eth_dev->rx_pkt_burst = &ixgbe_recv_pkts; - eth_dev->tx_pkt_burst = &ixgbe_xmit_pkts; + eth_dev->fcns.rx_pkt_burst = &ixgbe_recv_pkts; + eth_dev->fcns.tx_pkt_burst = &ixgbe_xmit_pkts; /* for secondary processes, we don't initialise any further as primary * has already done this work. Only check we don't need a different @@ -1777,8 +1777,8 @@ eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev) ixgbevf_dev_close(eth_dev); eth_dev->dev_ops = NULL; - eth_dev->rx_pkt_burst = NULL; - eth_dev->tx_pkt_burst = NULL; + eth_dev->fcns.rx_pkt_burst = NULL; + eth_dev->fcns.tx_pkt_burst = NULL; /* Disable the interrupts for VF */ ixgbevf_intr_disable(eth_dev); @@ -3888,15 +3888,15 @@ ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_UNKNOWN }; - if (dev->rx_pkt_burst == ixgbe_recv_pkts || - dev->rx_pkt_burst == ixgbe_recv_pkts_lro_single_alloc || - dev->rx_pkt_burst == ixgbe_recv_pkts_lro_bulk_alloc || - dev->rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc) + if (dev->fcns.rx_pkt_burst == ixgbe_recv_pkts || + dev->fcns.rx_pkt_burst == ixgbe_recv_pkts_lro_single_alloc || + dev->fcns.rx_pkt_burst == ixgbe_recv_pkts_lro_bulk_alloc || + dev->fcns.rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc) return ptypes; #if defined(RTE_ARCH_X86) - if (dev->rx_pkt_burst == ixgbe_recv_pkts_vec || - dev->rx_pkt_burst == ixgbe_recv_scattered_pkts_vec) + if (dev->fcns.rx_pkt_burst == ixgbe_recv_pkts_vec || + dev->fcns.rx_pkt_burst == ixgbe_recv_scattered_pkts_vec) return ptypes; #endif return NULL; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 6e9ed2e10..d3010b99d 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -619,25 +619,26 @@ void ixgbevf_dev_tx_init(struct rte_eth_dev *dev); void ixgbevf_dev_rxtx_start(struct rte_eth_dev *dev); -uint16_t ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts); +uint16_t ixgbe_recv_pkts(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts); -uint16_t ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, +uint16_t ixgbe_recv_pkts_bulk_alloc(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts); -uint16_t ixgbe_recv_pkts_lro_single_alloc(void *rx_queue, +uint16_t ixgbe_recv_pkts_lro_single_alloc(void *eth_dev, uint16_t rx_queue_id, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); -uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue, +uint16_t ixgbe_recv_pkts_lro_bulk_alloc(void *eth_dev, uint16_t rx_queue_id, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); -uint16_t ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts); +uint16_t ixgbe_xmit_pkts(void *eth_dev, uint16_t tx_queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); -uint16_t ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts); +uint16_t ixgbe_xmit_pkts_simple(void *eth_dev, uint16_t tx_queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); -uint16_t ixgbe_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts); +uint16_t ixgbe_prep_pkts(void *eth_dev, uint16_t tx_queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); int ixgbe_dev_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index edcfa60ce..8d8d2a912 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -88,7 +88,8 @@ #endif #ifdef RTE_IXGBE_INC_VECTOR -uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t ixgbe_xmit_fixed_burst_vec(void *eth_dev, uint16_t tx_queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); #endif @@ -233,10 +234,11 @@ ixgbe_tx_fill_hw_ring(struct ixgbe_tx_queue *txq, struct rte_mbuf **pkts, } static inline uint16_t -tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, +tx_xmit_pkts(void *eth_dev, uint16_t tx_queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_tx_queue *txq = dev->data->tx_queues[tx_queue_id]; volatile union ixgbe_adv_tx_desc *tx_r = txq->tx_ring; uint16_t n = 0; @@ -319,14 +321,14 @@ tx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, } uint16_t -ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, +ixgbe_xmit_pkts_simple(void *eth_dev, uint16_t tx_queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { uint16_t nb_tx; /* Try to transmit at least chunks of TX_MAX_BURST pkts */ if (likely(nb_pkts <= RTE_PMD_IXGBE_TX_MAX_BURST)) - return tx_xmit_pkts(tx_queue, tx_pkts, nb_pkts); + return tx_xmit_pkts(eth_dev, tx_queue_id, tx_pkts, nb_pkts); /* transmit more than the max burst, in chunks of TX_MAX_BURST */ nb_tx = 0; @@ -334,7 +336,7 @@ ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t ret, n; n = (uint16_t)RTE_MIN(nb_pkts, RTE_PMD_IXGBE_TX_MAX_BURST); - ret = tx_xmit_pkts(tx_queue, &(tx_pkts[nb_tx]), n); + ret = tx_xmit_pkts(eth_dev, tx_queue_id, &(tx_pkts[nb_tx]), n); nb_tx = (uint16_t)(nb_tx + ret); nb_pkts = (uint16_t)(nb_pkts - ret); if (ret < n) @@ -346,18 +348,19 @@ ixgbe_xmit_pkts_simple(void *tx_queue, struct rte_mbuf **tx_pkts, #ifdef RTE_IXGBE_INC_VECTOR static uint16_t -ixgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts) +ixgbe_xmit_pkts_vec(void *eth_dev, uint16_t tx_queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { uint16_t nb_tx = 0; - struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_tx_queue *txq = dev->data->tx_queues[tx_queue_id]; while (nb_pkts) { uint16_t ret, num; num = (uint16_t)RTE_MIN(nb_pkts, txq->tx_rs_thresh); - ret = ixgbe_xmit_fixed_burst_vec(tx_queue, &tx_pkts[nb_tx], - num); + ret = ixgbe_xmit_fixed_burst_vec(eth_dev, tx_queue_id, + &tx_pkts[nb_tx], num); nb_tx += ret; nb_pkts -= ret; if (ret < num) @@ -628,10 +631,11 @@ ixgbe_xmit_cleanup(struct ixgbe_tx_queue *txq) } uint16_t -ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, +ixgbe_xmit_pkts(void *eth_dev, uint16_t tx_queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - struct ixgbe_tx_queue *txq; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_tx_queue *txq = dev->data->tx_queues[tx_queue_id]; struct ixgbe_tx_entry *sw_ring; struct ixgbe_tx_entry *txe, *txn; volatile union ixgbe_adv_tx_desc *txr; @@ -658,7 +662,6 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, tx_offload.data[0] = 0; tx_offload.data[1] = 0; - txq = tx_queue; sw_ring = txq->sw_ring; txr = txq->tx_ring; tx_id = txq->tx_tail; @@ -965,12 +968,14 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, * **********************************************************************/ uint16_t -ixgbe_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) +ixgbe_prep_pkts(void *eth_dev, uint16_t tx_queue_id, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts) { int i, ret; uint64_t ol_flags; struct rte_mbuf *m; - struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_tx_queue *txq = dev->data->tx_queues[tx_queue_id]; for (i = 0; i < nb_pkts; i++) { m = tx_pkts[i]; @@ -1647,10 +1652,11 @@ ixgbe_rx_fill_from_stage(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, } static inline uint16_t -rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, +rx_recv_pkts(void *eth_dev, uint16_t rx_queue_id, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - struct ixgbe_rx_queue *rxq = (struct ixgbe_rx_queue *)rx_queue; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_rx_queue *rxq = dev->data->rx_queues[rx_queue_id]; uint16_t nb_rx = 0; /* Any previously recv'd pkts will be returned from the Rx stage */ @@ -1709,8 +1715,8 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, /* split requests into chunks of size RTE_PMD_IXGBE_RX_MAX_BURST */ uint16_t -ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +ixgbe_recv_pkts_bulk_alloc(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { uint16_t nb_rx; @@ -1718,7 +1724,7 @@ ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, return 0; if (likely(nb_pkts <= RTE_PMD_IXGBE_RX_MAX_BURST)) - return rx_recv_pkts(rx_queue, rx_pkts, nb_pkts); + return rx_recv_pkts(eth_dev, rx_queue_id, rx_pkts, nb_pkts); /* request is relatively large, chunk it up */ nb_rx = 0; @@ -1726,7 +1732,7 @@ ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t ret, n; n = (uint16_t)RTE_MIN(nb_pkts, RTE_PMD_IXGBE_RX_MAX_BURST); - ret = rx_recv_pkts(rx_queue, &rx_pkts[nb_rx], n); + ret = rx_recv_pkts(eth_dev, rx_queue_id, &rx_pkts[nb_rx], n); nb_rx = (uint16_t)(nb_rx + ret); nb_pkts = (uint16_t)(nb_pkts - ret); if (ret < n) @@ -1737,10 +1743,11 @@ ixgbe_recv_pkts_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, } uint16_t -ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, +ixgbe_recv_pkts(void *eth_dev, uint16_t rx_queue_id, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - struct ixgbe_rx_queue *rxq; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_rx_queue *rxq = dev->data->rx_queues[rx_queue_id]; volatile union ixgbe_adv_rx_desc *rx_ring; volatile union ixgbe_adv_rx_desc *rxdp; struct ixgbe_rx_entry *sw_ring; @@ -1760,7 +1767,6 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, nb_rx = 0; nb_hold = 0; - rxq = rx_queue; rx_id = rxq->rx_tail; rx_ring = rxq->rx_ring; sw_ring = rxq->sw_ring; @@ -2012,10 +2018,12 @@ ixgbe_fill_cluster_head_buf( * receive" interface). */ static inline uint16_t -ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, +ixgbe_recv_pkts_lro(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts, bool bulk_alloc) { - struct ixgbe_rx_queue *rxq = rx_queue; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_rx_queue *rxq = dev->data->rx_queues[rx_queue_id]; volatile union ixgbe_adv_rx_desc *rx_ring = rxq->rx_ring; struct ixgbe_rx_entry *sw_ring = rxq->sw_ring; struct ixgbe_scattered_rx_entry *sw_sc_ring = rxq->sw_sc_ring; @@ -2272,17 +2280,18 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, } uint16_t -ixgbe_recv_pkts_lro_single_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +ixgbe_recv_pkts_lro_single_alloc(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - return ixgbe_recv_pkts_lro(rx_queue, rx_pkts, nb_pkts, false); + return ixgbe_recv_pkts_lro(eth_dev, rx_queue_id, rx_pkts, nb_pkts, + false); } uint16_t -ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +ixgbe_recv_pkts_lro_bulk_alloc(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - return ixgbe_recv_pkts_lro(rx_queue, rx_pkts, nb_pkts, true); + return ixgbe_recv_pkts_lro(eth_dev, rx_queue_id, rx_pkts, nb_pkts, true); } /********************************************************************* @@ -2391,16 +2400,16 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) #endif (txq->tx_rs_thresh >= RTE_PMD_IXGBE_TX_MAX_BURST)) { PMD_INIT_LOG(DEBUG, "Using simple tx code path"); - dev->tx_pkt_prepare = NULL; + dev->fcns.tx_pkt_prepare = NULL; #ifdef RTE_IXGBE_INC_VECTOR if (txq->tx_rs_thresh <= RTE_IXGBE_TX_MAX_FREE_BUF_SZ && (rte_eal_process_type() != RTE_PROC_PRIMARY || ixgbe_txq_vec_setup(txq) == 0)) { PMD_INIT_LOG(DEBUG, "Vector tx enabled."); - dev->tx_pkt_burst = ixgbe_xmit_pkts_vec; + dev->fcns.tx_pkt_burst = ixgbe_xmit_pkts_vec; } else #endif - dev->tx_pkt_burst = ixgbe_xmit_pkts_simple; + dev->fcns.tx_pkt_burst = ixgbe_xmit_pkts_simple; } else { PMD_INIT_LOG(DEBUG, "Using full-featured tx code path"); PMD_INIT_LOG(DEBUG, @@ -2410,8 +2419,8 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq) " - tx_rs_thresh = %lu " "[RTE_PMD_IXGBE_TX_MAX_BURST=%lu]", (unsigned long)txq->tx_rs_thresh, (unsigned long)RTE_PMD_IXGBE_TX_MAX_BURST); - dev->tx_pkt_burst = ixgbe_xmit_pkts; - dev->tx_pkt_prepare = ixgbe_prep_pkts; + dev->fcns.tx_pkt_burst = ixgbe_xmit_pkts; + dev->fcns.tx_pkt_prepare = ixgbe_prep_pkts; } } @@ -4655,11 +4664,11 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev) if (adapter->rx_bulk_alloc_allowed) { PMD_INIT_LOG(DEBUG, "LRO is requested. Using a bulk " "allocation version"); - dev->rx_pkt_burst = ixgbe_recv_pkts_lro_bulk_alloc; + dev->fcns.rx_pkt_burst = ixgbe_recv_pkts_lro_bulk_alloc; } else { PMD_INIT_LOG(DEBUG, "LRO is requested. Using a single " "allocation version"); - dev->rx_pkt_burst = ixgbe_recv_pkts_lro_single_alloc; + dev->fcns.rx_pkt_burst = ixgbe_recv_pkts_lro_single_alloc; } } else if (dev->data->scattered_rx) { /* @@ -4671,12 +4680,12 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev) "callback (port=%d).", dev->data->port_id); - dev->rx_pkt_burst = ixgbe_recv_scattered_pkts_vec; + dev->fcns.rx_pkt_burst = ixgbe_recv_scattered_pkts_vec; } else if (adapter->rx_bulk_alloc_allowed) { PMD_INIT_LOG(DEBUG, "Using a Scattered with bulk " "allocation callback (port=%d).", dev->data->port_id); - dev->rx_pkt_burst = ixgbe_recv_pkts_lro_bulk_alloc; + dev->fcns.rx_pkt_burst = ixgbe_recv_pkts_lro_bulk_alloc; } else { PMD_INIT_LOG(DEBUG, "Using Regualr (non-vector, " "single allocation) " @@ -4684,7 +4693,7 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev) "(port=%d).", dev->data->port_id); - dev->rx_pkt_burst = ixgbe_recv_pkts_lro_single_alloc; + dev->fcns.rx_pkt_burst = ixgbe_recv_pkts_lro_single_alloc; } /* * Below we set "simple" callbacks according to port/queues parameters. @@ -4700,28 +4709,28 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev) RTE_IXGBE_DESCS_PER_LOOP, dev->data->port_id); - dev->rx_pkt_burst = ixgbe_recv_pkts_vec; + dev->fcns.rx_pkt_burst = ixgbe_recv_pkts_vec; } else if (adapter->rx_bulk_alloc_allowed) { PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions are " "satisfied. Rx Burst Bulk Alloc function " "will be used on port=%d.", dev->data->port_id); - dev->rx_pkt_burst = ixgbe_recv_pkts_bulk_alloc; + dev->fcns.rx_pkt_burst = ixgbe_recv_pkts_bulk_alloc; } else { PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions are not " "satisfied, or Scattered Rx is requested " "(port=%d).", dev->data->port_id); - dev->rx_pkt_burst = ixgbe_recv_pkts; + dev->fcns.rx_pkt_burst = ixgbe_recv_pkts; } /* Propagate information about RX function choice through all queues. */ rx_using_sse = - (dev->rx_pkt_burst == ixgbe_recv_scattered_pkts_vec || - dev->rx_pkt_burst == ixgbe_recv_pkts_vec); + (dev->fcns.rx_pkt_burst == ixgbe_recv_scattered_pkts_vec || + dev->fcns.rx_pkt_burst == ixgbe_recv_pkts_vec); for (i = 0; i < dev->data->nb_rx_queues; i++) { struct ixgbe_rx_queue *rxq = dev->data->rx_queues[i]; @@ -5817,7 +5826,8 @@ ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev __rte_unused *dev) __rte_weak uint16_t ixgbe_recv_pkts_vec( - void __rte_unused *rx_queue, + void __rte_unused *eth_dev, + uint16_t __rte_unused rx_queue_id, struct rte_mbuf __rte_unused **rx_pkts, uint16_t __rte_unused nb_pkts) { @@ -5826,7 +5836,8 @@ ixgbe_recv_pkts_vec( __rte_weak uint16_t ixgbe_recv_scattered_pkts_vec( - void __rte_unused *rx_queue, + void __rte_unused *eth_dev, + uint16_t __rte_unused rx_queue_id, struct rte_mbuf __rte_unused **rx_pkts, uint16_t __rte_unused nb_pkts) { diff --git a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index 505d344b9..0f11a2bf2 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.h +++ b/drivers/net/ixgbe/ixgbe_rxtx.h @@ -277,9 +277,9 @@ void ixgbe_set_tx_function(struct rte_eth_dev *dev, struct ixgbe_tx_queue *txq); void ixgbe_set_rx_function(struct rte_eth_dev *dev); int ixgbe_check_supported_loopback_mode(struct rte_eth_dev *dev); -uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts); -uint16_t ixgbe_recv_scattered_pkts_vec(void *rx_queue, +uint16_t ixgbe_recv_pkts_vec(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts); +uint16_t ixgbe_recv_scattered_pkts_vec(void *eth_dev, uint16_t rx_queue_id, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); int ixgbe_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev); int ixgbe_rxq_vec_setup(struct ixgbe_rx_queue *rxq); @@ -290,7 +290,8 @@ extern const uint32_t ptype_table_tn[IXGBE_PACKET_TYPE_TN_MAX]; #ifdef RTE_IXGBE_INC_VECTOR -uint16_t ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, +uint16_t ixgbe_xmit_fixed_burst_vec(void *eth_dev, uint16_t tx_queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts); int ixgbe_txq_vec_setup(struct ixgbe_tx_queue *txq); #endif /* RTE_IXGBE_INC_VECTOR */ diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c index edb138354..59045035a 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c @@ -331,10 +331,12 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, * - don't support ol_flags for rss and csum err */ uint16_t -ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +ixgbe_recv_pkts_vec(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - return _recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL); + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_rx_queue *rxq = dev->data->rx_queues[rx_queue_id]; + return _recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts, NULL); } /* @@ -348,10 +350,11 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, * - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two */ uint16_t -ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +ixgbe_recv_scattered_pkts_vec(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - struct ixgbe_rx_queue *rxq = rx_queue; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_rx_queue *rxq = dev->data->rx_queues[rx_queue_id]; uint8_t split_flags[RTE_IXGBE_MAX_RX_BURST] = {0}; /* get some new buffers */ @@ -402,10 +405,11 @@ vtx(volatile union ixgbe_adv_tx_desc *txdp, } uint16_t -ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts) +ixgbe_xmit_fixed_burst_vec(void *eth_dev, uint16_t tx_queue_id, + struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_tx_queue *txq = dev->data->tx_queues[tx_queue_id]; volatile union ixgbe_adv_tx_desc *txdp; struct ixgbe_tx_entry_v *txep; uint16_t n, nb_commit, tx_id; diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c index c9ba48246..697561298 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c @@ -566,10 +566,14 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, * - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two */ uint16_t -ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +ixgbe_recv_pkts_vec(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) { - return _recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL); + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_rx_queue *rxq = dev->data->rx_queues[rx_queue_id]; + + return _recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts, NULL); } /* @@ -582,10 +586,12 @@ ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, * - floor align nb_pkts to a RTE_IXGBE_DESC_PER_LOOP power-of-two */ uint16_t -ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +ixgbe_recv_scattered_pkts_vec(void *eth_dev, uint16_t rx_queue_id, + struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) { - struct ixgbe_rx_queue *rxq = rx_queue; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_rx_queue *rxq = dev->data->rx_queues[rx_queue_id]; uint8_t split_flags[RTE_IXGBE_MAX_RX_BURST] = {0}; /* get some new buffers */ @@ -635,10 +641,11 @@ vtx(volatile union ixgbe_adv_tx_desc *txdp, } uint16_t -ixgbe_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts, +ixgbe_xmit_fixed_burst_vec(void *eth_dev, uint16_t tx_queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - struct ixgbe_tx_queue *txq = (struct ixgbe_tx_queue *)tx_queue; + struct rte_eth_dev *dev = eth_dev; + struct ixgbe_tx_queue *txq = dev->data->tx_queues[tx_queue_id]; volatile union ixgbe_adv_tx_desc *txdp; struct ixgbe_tx_entry_v *txep; uint16_t n, nb_commit, tx_id; diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c index 2c01f6e33..1a575398a 100644 --- a/drivers/net/ixgbe/ixgbe_vf_representor.c +++ b/drivers/net/ixgbe/ixgbe_vf_representor.c @@ -154,14 +154,16 @@ static const struct eth_dev_ops ixgbe_vf_representor_dev_ops = { }; static uint16_t -ixgbe_vf_representor_rx_burst(__rte_unused void *rx_queue, +ixgbe_vf_representor_rx_burst(__rte_unused void *eth_dev, + __rte_unused uint16_t rx_queue_id, __rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts) { return 0; } static uint16_t -ixgbe_vf_representor_tx_burst(__rte_unused void *tx_queue, +ixgbe_vf_representor_tx_burst(__rte_unused void *eth_dev, + __rte_unused uint16_t tx_queue_id, __rte_unused struct rte_mbuf **tx_pkts, __rte_unused uint16_t nb_pkts) { return 0; @@ -200,8 +202,8 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) /* No data-path, but need stub Rx/Tx functions to avoid crash * when testing with the likes of testpmd. */ - ethdev->rx_pkt_burst = ixgbe_vf_representor_rx_burst; - ethdev->tx_pkt_burst = ixgbe_vf_representor_tx_burst; + ethdev->fcns.rx_pkt_burst = ixgbe_vf_representor_rx_burst; + ethdev->fcns.tx_pkt_burst = ixgbe_vf_representor_tx_burst; /* Setting the number queues allocated to the VF */ ethdev->data->nb_rx_queues = IXGBE_VF_MAX_RX_QUEUES;