* [dpdk-dev] [RFC 19.11 0/2] Hide DPDK internal struct from public API
@ 2019-07-30 12:49 Marcin Zapolski
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline Marcin Zapolski
` (5 more replies)
0 siblings, 6 replies; 33+ messages in thread
From: Marcin Zapolski @ 2019-07-30 12:49 UTC (permalink / raw)
To: dev; +Cc: Marcin Zapolski
Several DPDK internal structures are exposed to direct access by user
applications. This patch removes them from public API, and makes core DPDK
functions that use them non-inline.
Marcin Zapolski (2):
ethdev: make DPDK core functions non-inline
ethdev: hide DPDK internal struct from public API
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.c | 168 +++++++++++++++++
lib/librte_ethdev/rte_ethdev.h | 169 ++----------------
lib/librte_ethdev/rte_ethdev_driver.h | 1 +
lib/librte_ethdev/rte_ethdev_version.map | 12 ++
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 +
.../rte_event_eth_rx_adapter.c | 1 +
.../rte_event_eth_tx_adapter.c | 1 +
lib/librte_eventdev/rte_eventdev.c | 1 +
lib/librte_telemetry/rte_telemetry.c | 1 +
19 files changed, 211 insertions(+), 154 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 33+ messages in thread
* [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 12:49 [dpdk-dev] [RFC 19.11 0/2] Hide DPDK internal struct from public API Marcin Zapolski
@ 2019-07-30 12:49 ` Marcin Zapolski
2019-07-30 15:01 ` Jerin Jacob Kollanukkaran
2019-07-30 15:25 ` Stephen Hemminger
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 2/2] ethdev: hide DPDK internal struct from public API Marcin Zapolski
` (4 subsequent siblings)
5 siblings, 2 replies; 33+ messages in thread
From: Marcin Zapolski @ 2019-07-30 12:49 UTC (permalink / raw)
To: dev; +Cc: Marcin Zapolski
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 <marcinx.a.zapolski@intel.com>
---
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:
--
2.17.1
^ permalink raw reply [flat|nested] 33+ messages in thread
* [dpdk-dev] [RFC 19.11 2/2] ethdev: hide DPDK internal struct from public API
2019-07-30 12:49 [dpdk-dev] [RFC 19.11 0/2] Hide DPDK internal struct from public API Marcin Zapolski
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline Marcin Zapolski
@ 2019-07-30 12:49 ` Marcin Zapolski
2019-07-30 14:53 ` Ferruh Yigit
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 0/3] Hide " Marcin Zapolski
` (3 subsequent siblings)
5 siblings, 1 reply; 33+ messages in thread
From: Marcin Zapolski @ 2019-07-30 12:49 UTC (permalink / raw)
To: dev; +Cc: Marcin Zapolski
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 <marcinx.a.zapolski@intel.com>
---
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 <rte_io.h>
#include <rte_rwlock.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#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 <unistd.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_string_fns.h>
#include <rte_memzone.h>
#include <rte_malloc.h>
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 <malloc.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_memcpy.h>
#include <rte_string_fns.h>
#include <rte_memzone.h>
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 <rte_ethdev_core.h>
-
/**
*
* 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 <rte_ethdev.h>
+#include <rte_ethdev_core.h>
#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 <rte_branch_prediction.h>
#include <rte_string_fns.h>
#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 <stdint.h>
#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 <rte_errno.h>
#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 <rte_errno.h>
#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 <rte_errno.h>
#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 <rte_errno.h>
#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 <rte_dev.h>
#include <rte_errno.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_service_component.h>
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 <rte_spinlock.h>
#include <rte_service_component.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
#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 <rte_malloc.h>
#include <rte_errno.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
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 <rte_eal.h>
#include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
#include <rte_metrics.h>
#include <rte_option.h>
#include <rte_string_fns.h>
--
2.17.1
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 2/2] ethdev: hide DPDK internal struct from public API
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 2/2] ethdev: hide DPDK internal struct from public API Marcin Zapolski
@ 2019-07-30 14:53 ` Ferruh Yigit
0 siblings, 0 replies; 33+ messages in thread
From: Ferruh Yigit @ 2019-07-30 14:53 UTC (permalink / raw)
To: Marcin Zapolski, dev
On 7/30/2019 1:49 PM, Marcin Zapolski wrote:
> 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 <marcinx.a.zapolski@intel.com>
Hi Marcin,
"rte_ethdev_core.h" has been created explicitly to hold the code that should be
private but needs to be public because of the static inline functions.
Since static inline functions removed, I think we should remove
"rte_ethdev_core.h" too.
And split its content to "ethdev_private.h" & "rte_ethdev_driver.h".
I didn't investigate details but code should go as much as possible to
"ethdev_private.h" and if it has to it should go to "rte_ethdev_driver.h"
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline Marcin Zapolski
@ 2019-07-30 15:01 ` Jerin Jacob Kollanukkaran
2019-07-30 15:32 ` Bruce Richardson
2019-07-30 15:25 ` Stephen Hemminger
1 sibling, 1 reply; 33+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-07-30 15:01 UTC (permalink / raw)
To: Marcin Zapolski, dev
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Marcin Zapolski
> Sent: Tuesday, July 30, 2019 6:20 PM
> To: dev@dpdk.org
> Cc: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> Subject: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-
> inline
>
> 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.
I tested on two class of arm64 machines(Highend and lowend) one has 1.4% drop
And other one has 3.6% drop.
I second to not expose internal data structure to avoid ABI break.
IMO, This patch has performance issue due to it is fixing it in simple way.
It is not worth two have function call overhead to call the driver function.
Some thoughts below to reduce the performance impact without exposing internal
structures.
And I think, We need to follow the similar mechanism for cryptodev, Eventdev, rawdev
Etc so bring the common scheme to address this semantics will be use full.
>
> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> ---
> 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;
I think, we only need to store 3 function pointers per port.
IMO, Let have structure for that.
i.e split the struct rte_eth_dev content as public and private.
I think, We nee only following elements in rte_eth_dev
struct rte_eth_dev_fns {
eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function. */
eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
eth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. *
};
struct rte_eth_dev {
struct rte_eth_dev_fns fns; // make it as first item allows type cast to struct rte_eth_dev_fns from struct rte_eth_dev
private ones
}
> +
> +#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],
I think, if we make driver funtions as (*dev->rx_pkt_burst)(dev, rx_pkts, nb_pkts)
Then no need to deference data from inline function.
Lets expose a helper function from driver layer and let PMD use to access queue memory.
No need to expose that helper to user app.
> + rx_pkts, nb_pkts);
> +
> +#ifdef RTE_ETHDEV_RXTX_CALLBACKS
# If we have ethdev driver helper function for the same and PMD can call it as well no need
to call this inline function.
# I think, it make sense to as RX_OFFLOAD_FLAGS so that when app needs only
It can be included in fastpath.
# lastly we are not exposing rte_eth_dev to application then I think we can
Remove rte_ from name.
> + 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;
> +}
> +
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline Marcin Zapolski
2019-07-30 15:01 ` Jerin Jacob Kollanukkaran
@ 2019-07-30 15:25 ` Stephen Hemminger
2019-07-30 15:33 ` Bruce Richardson
1 sibling, 1 reply; 33+ messages in thread
From: Stephen Hemminger @ 2019-07-30 15:25 UTC (permalink / raw)
To: Marcin Zapolski; +Cc: dev
On Tue, 30 Jul 2019 14:49:49 +0200
Marcin Zapolski <marcinx.a.zapolski@intel.com> wrote:
> 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 <marcinx.a.zapolski@intel.com>
Sorry 2% matters.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 15:01 ` Jerin Jacob Kollanukkaran
@ 2019-07-30 15:32 ` Bruce Richardson
0 siblings, 0 replies; 33+ messages in thread
From: Bruce Richardson @ 2019-07-30 15:32 UTC (permalink / raw)
To: Jerin Jacob Kollanukkaran; +Cc: Marcin Zapolski, dev
On Tue, Jul 30, 2019 at 03:01:00PM +0000, Jerin Jacob Kollanukkaran wrote:
> > -----Original Message----- From: dev <dev-bounces@dpdk.org> On Behalf
> > Of Marcin Zapolski Sent: Tuesday, July 30, 2019 6:20 PM To:
> > dev@dpdk.org Cc: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> > Subject: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions
> > non- inline
> >
> > 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.
>
> I tested on two class of arm64 machines(Highend and lowend) one has 1.4%
> drop And other one has 3.6% drop.
>
This is with testpmd only right? I'd just point out that we need to
remember that these numbers need to be scaled down appropriately for a
realworld app where IO is only a (hopefully small) proportion of the packet
processing budget. For example, I would expect the ~2% drop we saw in
testpmd to correspond to <0.5% drop in something like OVS.
> I second to not expose internal data structure to avoid ABI break.
>
> IMO, This patch has performance issue due to it is fixing it in simple
> way.
>
> It is not worth two have function call overhead to call the driver
> function. Some thoughts below to reduce the performance impact without
> exposing internal structures.
>
The big concern I have with what you propose is that would involve changing
each and every ethdev driver in DPDK! I'd prefer to make sure that the
impact of this change is actually felt in real-world apps before we start
looking to make such updates across the DPDK codebase.
> And I think, We need to follow the similar mechanism for cryptodev, Eventdev, rawdev
> Etc so bring the common scheme to address this semantics will be use full.
>
Agreed.
Regards,
/Bruce
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 15:25 ` Stephen Hemminger
@ 2019-07-30 15:33 ` Bruce Richardson
2019-07-30 15:54 ` Stephen Hemminger
0 siblings, 1 reply; 33+ messages in thread
From: Bruce Richardson @ 2019-07-30 15:33 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Marcin Zapolski, dev
On Tue, Jul 30, 2019 at 08:25:34AM -0700, Stephen Hemminger wrote:
> On Tue, 30 Jul 2019 14:49:49 +0200
> Marcin Zapolski <marcinx.a.zapolski@intel.com> wrote:
>
> > 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 <marcinx.a.zapolski@intel.com>
>
> Sorry 2% matters.
Note that this is with testpmd. Are there many apps out there where a 2%
drop in IO cost would be noticable?
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 15:33 ` Bruce Richardson
@ 2019-07-30 15:54 ` Stephen Hemminger
2019-07-30 16:04 ` Wiles, Keith
2019-07-30 16:11 ` Bruce Richardson
0 siblings, 2 replies; 33+ messages in thread
From: Stephen Hemminger @ 2019-07-30 15:54 UTC (permalink / raw)
To: Bruce Richardson; +Cc: Marcin Zapolski, dev
On Tue, 30 Jul 2019 16:33:55 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:
> On Tue, Jul 30, 2019 at 08:25:34AM -0700, Stephen Hemminger wrote:
> > On Tue, 30 Jul 2019 14:49:49 +0200
> > Marcin Zapolski <marcinx.a.zapolski@intel.com> wrote:
> >
> > > 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 <marcinx.a.zapolski@intel.com>
> >
> > Sorry 2% matters.
>
> Note that this is with testpmd. Are there many apps out there where a 2%
> drop in IO cost would be noticable?
Why not find a way to get the 2% back elsewhere? Maybe analyzing the code/cache
in more detail. Perhaps some prefetching could help, or getting rid of
indirect calls elsewhere in the code. At the extreme, maybe implementing
something like the kernel static branches (self-modifying code) would
get a lot back.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 15:54 ` Stephen Hemminger
@ 2019-07-30 16:04 ` Wiles, Keith
2019-07-30 16:11 ` Bruce Richardson
1 sibling, 0 replies; 33+ messages in thread
From: Wiles, Keith @ 2019-07-30 16:04 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Richardson, Bruce, Zapolski, MarcinX A, dev
> On Jul 30, 2019, at 10:54 AM, Stephen Hemminger <stephen@networkplumber.org> wrote:
>
> On Tue, 30 Jul 2019 16:33:55 +0100
> Bruce Richardson <bruce.richardson@intel.com> wrote:
>
>> On Tue, Jul 30, 2019 at 08:25:34AM -0700, Stephen Hemminger wrote:
>>> On Tue, 30 Jul 2019 14:49:49 +0200
>>> Marcin Zapolski <marcinx.a.zapolski@intel.com> wrote:
>>>
>>>> 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 <marcinx.a.zapolski@intel.com>
>>>
>>> Sorry 2% matters.
>>
>> Note that this is with testpmd. Are there many apps out there where a 2%
>> drop in IO cost would be noticable?
>
> Why not find a way to get the 2% back elsewhere? Maybe analyzing the code/cache
> in more detail. Perhaps some prefetching could help, or getting rid of
> indirect calls elsewhere in the code. At the extreme, maybe implementing
> something like the kernel static branches (self-modifying code) would
> get a lot back.
+1, I discussed something very similar internally or at least let's not reduce DPDK performance by 2% and find a different way.
Regards,
Keith
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 15:54 ` Stephen Hemminger
2019-07-30 16:04 ` Wiles, Keith
@ 2019-07-30 16:11 ` Bruce Richardson
2019-07-30 16:23 ` Stephen Hemminger
1 sibling, 1 reply; 33+ messages in thread
From: Bruce Richardson @ 2019-07-30 16:11 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Marcin Zapolski, dev
On Tue, Jul 30, 2019 at 08:54:13AM -0700, Stephen Hemminger wrote:
> On Tue, 30 Jul 2019 16:33:55 +0100
> Bruce Richardson <bruce.richardson@intel.com> wrote:
>
> > On Tue, Jul 30, 2019 at 08:25:34AM -0700, Stephen Hemminger wrote:
> > > On Tue, 30 Jul 2019 14:49:49 +0200
> > > Marcin Zapolski <marcinx.a.zapolski@intel.com> wrote:
> > >
> > > > 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 <marcinx.a.zapolski@intel.com>
> > >
> > > Sorry 2% matters.
> >
> > Note that this is with testpmd. Are there many apps out there where a 2%
> > drop in IO cost would be noticable?
>
> Why not find a way to get the 2% back elsewhere? Maybe analyzing the code/cache
> in more detail. Perhaps some prefetching could help, or getting rid of
> indirect calls elsewhere in the code. At the extreme, maybe implementing
> something like the kernel static branches (self-modifying code) would
> get a lot back.
I'm all for getting it back, but the most likely place is in individual
drivers themselves. Do you have a link on the static branches that the rest
of us could read up on, since I, for one, am not familiar with the term.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 16:11 ` Bruce Richardson
@ 2019-07-30 16:23 ` Stephen Hemminger
0 siblings, 0 replies; 33+ messages in thread
From: Stephen Hemminger @ 2019-07-30 16:23 UTC (permalink / raw)
To: Bruce Richardson; +Cc: Marcin Zapolski, dev
On Tue, 30 Jul 2019 17:11:31 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:
> On Tue, Jul 30, 2019 at 08:54:13AM -0700, Stephen Hemminger wrote:
> > On Tue, 30 Jul 2019 16:33:55 +0100
> > Bruce Richardson <bruce.richardson@intel.com> wrote:
> >
> > > On Tue, Jul 30, 2019 at 08:25:34AM -0700, Stephen Hemminger wrote:
> > > > On Tue, 30 Jul 2019 14:49:49 +0200
> > > > Marcin Zapolski <marcinx.a.zapolski@intel.com> wrote:
> > > >
> > > > > 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 <marcinx.a.zapolski@intel.com>
> > > >
> > > > Sorry 2% matters.
> > >
> > > Note that this is with testpmd. Are there many apps out there where a 2%
> > > drop in IO cost would be noticable?
> >
> > Why not find a way to get the 2% back elsewhere? Maybe analyzing the code/cache
> > in more detail. Perhaps some prefetching could help, or getting rid of
> > indirect calls elsewhere in the code. At the extreme, maybe implementing
> > something like the kernel static branches (self-modifying code) would
> > get a lot back.
>
> I'm all for getting it back, but the most likely place is in individual
> drivers themselves. Do you have a link on the static branches that the rest
> of us could read up on, since I, for one, am not familiar with the term.
https://www.kernel.org/doc/Documentation/static-keys.txt
^ permalink raw reply [flat|nested] 33+ messages in thread
* [dpdk-dev] [RFC 19.11 v2 0/3] Hide DPDK internal struct from public API
2019-07-30 12:49 [dpdk-dev] [RFC 19.11 0/2] Hide DPDK internal struct from public API Marcin Zapolski
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline Marcin Zapolski
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 2/2] ethdev: hide DPDK internal struct from public API Marcin Zapolski
@ 2019-09-06 13:18 ` Marcin Zapolski
2019-09-06 14:00 ` Bruce Richardson
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures " Marcin Zapolski
` (2 subsequent siblings)
5 siblings, 1 reply; 33+ messages in thread
From: Marcin Zapolski @ 2019-09-06 13:18 UTC (permalink / raw)
To: dev; +Cc: Marcin Zapolski
Several DPDK internal structures are exposed to direct access by user
applications. This patch removes them from public API, and makes core DPDK
functions that use them non-inline.
v2:
This patch set no longer makes internal DPDK functions non-inline. Instead
it splits the rte_eth_dev structure to private and public part and modifies
function arguments of rx and tx functions. This should bring less performance
impact, but at the cost of needing to modify every PMD to use new rx and tx
functions.
For testing purposes, the ixgbe and i40e drivers are modified to acommodate for
the changes.
Marcin Zapolski (3):
ethdev: hide key ethdev structures from public API
i40e: make driver compatible with changes in ethdev
ixgbe: make driver compatible with changes in ethdev
drivers/net/i40e/i40e_ethdev.c | 10 +-
drivers/net/i40e/i40e_ethdev.h | 1 +
drivers/net/i40e/i40e_ethdev_vf.c | 8 +-
drivers/net/i40e/i40e_rxtx.c | 119 ++--
drivers/net/i40e/i40e_rxtx.h | 33 +-
drivers/net/i40e/i40e_rxtx_vec_altivec.c | 23 +-
drivers/net/i40e/i40e_rxtx_vec_avx2.c | 45 +-
drivers/net/i40e/i40e_rxtx_vec_neon.c | 23 +-
drivers/net/i40e/i40e_rxtx_vec_sse.c | 23 +-
drivers/net/i40e/i40e_vf_representor.c | 12 +-
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 +-
lib/librte_bitratestats/rte_bitrate.c | 2 +-
lib/librte_bpf/bpf_pkt.c | 2 +-
lib/librte_ethdev/ethdev_private.c | 1 +
lib/librte_ethdev/ethdev_profile.h | 1 +
lib/librte_ethdev/rte_ethdev.c | 122 +++-
lib/librte_ethdev/rte_ethdev.h | 222 +++++---
lib/librte_ethdev/rte_ethdev_core.h | 531 +-----------------
lib/librte_ethdev/rte_ethdev_driver.h | 482 ++++++++++++++++
lib/librte_ethdev/rte_ethdev_version.map | 11 +
lib/librte_ethdev/rte_flow.c | 2 +-
lib/librte_ethdev/rte_mtr.c | 2 +-
lib/librte_ethdev/rte_tm.c | 2 +-
lib/librte_ethdev/rte_tm_driver.h | 1 +
.../rte_event_eth_rx_adapter.c | 2 +-
.../rte_event_eth_tx_adapter.c | 2 +-
lib/librte_eventdev/rte_eventdev.c | 2 +-
lib/librte_flow_classify/rte_flow_classify.h | 2 +-
.../rte_flow_classify_parse.h | 2 +-
lib/librte_gro/gro_tcp4.c | 2 +-
lib/librte_gro/gro_vxlan_tcp4.c | 2 +-
lib/librte_gro/rte_gro.c | 2 +-
lib/librte_gso/rte_gso.c | 2 +-
lib/librte_kni/rte_kni.c | 2 +-
lib/librte_latencystats/rte_latencystats.c | 2 +-
lib/librte_pdump/rte_pdump.c | 2 +-
lib/librte_port/rte_port_ethdev.c | 2 +-
lib/librte_telemetry/rte_telemetry.c | 2 +-
lib/librte_telemetry/rte_telemetry_parser.c | 2 +-
lib/librte_vhost/vhost.c | 2 +-
46 files changed, 1053 insertions(+), 885 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 33+ messages in thread
* [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-07-30 12:49 [dpdk-dev] [RFC 19.11 0/2] Hide DPDK internal struct from public API Marcin Zapolski
` (2 preceding siblings ...)
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 0/3] Hide " Marcin Zapolski
@ 2019-09-06 13:18 ` Marcin Zapolski
2019-09-06 14:37 ` Ferruh Yigit
` (2 more replies)
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 2/3] i40e: make driver compatible with changes in ethdev Marcin Zapolski
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 3/3] ixgbe: " Marcin Zapolski
5 siblings, 3 replies; 33+ messages in thread
From: Marcin Zapolski @ 2019-09-06 13:18 UTC (permalink / raw)
To: dev; +Cc: Marcin Zapolski
Split rte_eth_dev structure to two parts: head that is available for
user applications, and rest which is DPDK internal.
Make an array of pointers to rte_eth_dev structures available for user
applications.
Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
---
lib/librte_bitratestats/rte_bitrate.c | 2 +-
lib/librte_bpf/bpf_pkt.c | 2 +-
lib/librte_ethdev/ethdev_private.c | 1 +
lib/librte_ethdev/ethdev_profile.h | 1 +
lib/librte_ethdev/rte_ethdev.c | 122 +++-
lib/librte_ethdev/rte_ethdev.h | 222 +++++---
lib/librte_ethdev/rte_ethdev_core.h | 531 +-----------------
lib/librte_ethdev/rte_ethdev_driver.h | 482 ++++++++++++++++
lib/librte_ethdev/rte_ethdev_version.map | 11 +
lib/librte_ethdev/rte_flow.c | 2 +-
lib/librte_ethdev/rte_mtr.c | 2 +-
lib/librte_ethdev/rte_tm.c | 2 +-
lib/librte_ethdev/rte_tm_driver.h | 1 +
.../rte_event_eth_rx_adapter.c | 2 +-
.../rte_event_eth_tx_adapter.c | 2 +-
lib/librte_eventdev/rte_eventdev.c | 2 +-
lib/librte_flow_classify/rte_flow_classify.h | 2 +-
.../rte_flow_classify_parse.h | 2 +-
lib/librte_gro/gro_tcp4.c | 2 +-
lib/librte_gro/gro_vxlan_tcp4.c | 2 +-
lib/librte_gro/rte_gro.c | 2 +-
lib/librte_gso/rte_gso.c | 2 +-
lib/librte_kni/rte_kni.c | 2 +-
lib/librte_latencystats/rte_latencystats.c | 2 +-
lib/librte_pdump/rte_pdump.c | 2 +-
lib/librte_port/rte_port_ethdev.c | 2 +-
lib/librte_telemetry/rte_telemetry.c | 2 +-
lib/librte_telemetry/rte_telemetry_parser.c | 2 +-
lib/librte_vhost/vhost.c | 2 +-
29 files changed, 760 insertions(+), 653 deletions(-)
diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c
index 639e47547..82d469514 100644
--- a/lib/librte_bitratestats/rte_bitrate.c
+++ b/lib/librte_bitratestats/rte_bitrate.c
@@ -3,7 +3,7 @@
*/
#include <rte_common.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_malloc.h>
#include <rte_metrics.h>
#include <rte_bitrate.h>
diff --git a/lib/librte_bpf/bpf_pkt.c b/lib/librte_bpf/bpf_pkt.c
index 6e8248f0d..f813d1e45 100644
--- a/lib/librte_bpf/bpf_pkt.c
+++ b/lib/librte_bpf/bpf_pkt.c
@@ -26,7 +26,7 @@
#include <rte_lcore.h>
#include <rte_atomic.h>
#include <rte_mbuf.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_bpf_ethdev.h>
#include "bpf_impl.h"
diff --git a/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c
index 162a502fe..f183accc7 100644
--- a/lib/librte_ethdev/ethdev_private.c
+++ b/lib/librte_ethdev/ethdev_private.c
@@ -3,6 +3,7 @@
*/
#include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
#include "rte_ethdev_driver.h"
#include "ethdev_private.h"
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.c b/lib/librte_ethdev/rte_ethdev.c
index 17d183e1f..5c6cc640a 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -40,6 +40,7 @@
#include "rte_ether.h"
#include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
#include "rte_ethdev_driver.h"
#include "ethdev_profile.h"
#include "ethdev_private.h"
@@ -48,6 +49,16 @@ int rte_eth_dev_logtype;
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
+struct rte_eth_dev_fcns *rte_eth_dev_functions[RTE_MAX_ETHPORTS];
+
+RTE_INIT(rte_eth_dev_init)
+{
+ int i;
+
+ for (i = 0; i < RTE_MAX_ETHPORTS; i++)
+ rte_eth_dev_functions[i] =
+ (struct rte_eth_dev_fcns *)(&rte_eth_devices[i]);
+}
/* spinlock for eth device callbacks */
static rte_spinlock_t rte_eth_dev_cb_lock = RTE_SPINLOCK_INITIALIZER;
@@ -581,6 +592,22 @@ rte_eth_dev_is_valid_port(uint16_t port_id)
return 1;
}
+int
+rte_eth_dev_is_valid_rx_queue_id(uint16_t port_id, uint16_t queue_id)
+{
+ if (queue_id >= rte_eth_devices[port_id].data->nb_rx_queues)
+ return 0;
+ return 1;
+}
+
+int
+rte_eth_dev_is_valid_tx_queue_id(uint16_t port_id, uint16_t queue_id)
+{
+ if (queue_id >= rte_eth_devices[port_id].data->nb_tx_queues)
+ return 0;
+ return 1;
+}
+
static int
rte_eth_is_valid_owner_id(uint64_t owner_id)
{
@@ -3405,7 +3432,7 @@ RTE_INIT(eth_dev_init_cb_lists)
int i;
for (i = 0; i < RTE_MAX_ETHPORTS; i++)
- TAILQ_INIT(&rte_eth_devices[i].link_intr_cbs);
+ TAILQ_INIT(&rte_eth_devices[i].fcns.link_intr_cbs);
}
int
@@ -3438,7 +3465,7 @@ rte_eth_dev_callback_register(uint16_t port_id,
do {
dev = &rte_eth_devices[next_port];
- TAILQ_FOREACH(user_cb, &(dev->link_intr_cbs), next) {
+ TAILQ_FOREACH(user_cb, &(dev->fcns.link_intr_cbs), next) {
if (user_cb->cb_fn == cb_fn &&
user_cb->cb_arg == cb_arg &&
user_cb->event == event) {
@@ -3454,7 +3481,7 @@ rte_eth_dev_callback_register(uint16_t port_id,
user_cb->cb_fn = cb_fn;
user_cb->cb_arg = cb_arg;
user_cb->event = event;
- TAILQ_INSERT_TAIL(&(dev->link_intr_cbs),
+ TAILQ_INSERT_TAIL(&(dev->fcns.link_intr_cbs),
user_cb, next);
} else {
rte_spinlock_unlock(&rte_eth_dev_cb_lock);
@@ -3501,7 +3528,7 @@ rte_eth_dev_callback_unregister(uint16_t port_id,
do {
dev = &rte_eth_devices[next_port];
ret = 0;
- for (cb = TAILQ_FIRST(&dev->link_intr_cbs); cb != NULL;
+ for (cb = TAILQ_FIRST(&dev->fcns.link_intr_cbs); cb != NULL;
cb = next) {
next = TAILQ_NEXT(cb, next);
@@ -3515,7 +3542,8 @@ rte_eth_dev_callback_unregister(uint16_t port_id,
* then remove it.
*/
if (cb->active == 0) {
- TAILQ_REMOVE(&(dev->link_intr_cbs), cb, next);
+ TAILQ_REMOVE(&(dev->fcns.link_intr_cbs),
+ cb, next);
rte_free(cb);
} else {
ret = -EAGAIN;
@@ -3536,7 +3564,7 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
int rc = 0;
rte_spinlock_lock(&rte_eth_dev_cb_lock);
- TAILQ_FOREACH(cb_lst, &(dev->link_intr_cbs), next) {
+ TAILQ_FOREACH(cb_lst, &(dev->fcns.link_intr_cbs), next) {
if (cb_lst->cb_fn == NULL || cb_lst->event != event)
continue;
dev_cb = *cb_lst;
@@ -3872,10 +3900,10 @@ rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
rte_spinlock_lock(&rte_eth_rx_cb_lock);
/* Add the callbacks in fifo order. */
struct rte_eth_rxtx_callback *tail =
- rte_eth_devices[port_id].post_rx_burst_cbs[queue_id];
+ rte_eth_devices[port_id].fcns.post_rx_burst_cbs[queue_id];
if (!tail) {
- rte_eth_devices[port_id].post_rx_burst_cbs[queue_id] = cb;
+ rte_eth_devices[port_id].fcns.post_rx_burst_cbs[queue_id] = cb;
} else {
while (tail->next)
@@ -3914,9 +3942,9 @@ rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
rte_spinlock_lock(&rte_eth_rx_cb_lock);
/* Add the callbacks at fisrt position*/
- cb->next = rte_eth_devices[port_id].post_rx_burst_cbs[queue_id];
+ cb->next = rte_eth_devices[port_id].fcns.post_rx_burst_cbs[queue_id];
rte_smp_wmb();
- rte_eth_devices[port_id].post_rx_burst_cbs[queue_id] = cb;
+ rte_eth_devices[port_id].fcns.post_rx_burst_cbs[queue_id] = cb;
rte_spinlock_unlock(&rte_eth_rx_cb_lock);
return cb;
@@ -3950,10 +3978,10 @@ rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
rte_spinlock_lock(&rte_eth_tx_cb_lock);
/* Add the callbacks in fifo order. */
struct rte_eth_rxtx_callback *tail =
- rte_eth_devices[port_id].pre_tx_burst_cbs[queue_id];
+ rte_eth_devices[port_id].fcns.pre_tx_burst_cbs[queue_id];
if (!tail) {
- rte_eth_devices[port_id].pre_tx_burst_cbs[queue_id] = cb;
+ rte_eth_devices[port_id].fcns.pre_tx_burst_cbs[queue_id] = cb;
} else {
while (tail->next)
@@ -3984,7 +4012,7 @@ rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id,
int ret = -EINVAL;
rte_spinlock_lock(&rte_eth_rx_cb_lock);
- prev_cb = &dev->post_rx_burst_cbs[queue_id];
+ prev_cb = &dev->fcns.post_rx_burst_cbs[queue_id];
for (; *prev_cb != NULL; prev_cb = &cb->next) {
cb = *prev_cb;
if (cb == user_cb) {
@@ -4018,7 +4046,7 @@ rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id,
struct rte_eth_rxtx_callback **prev_cb;
rte_spinlock_lock(&rte_eth_tx_cb_lock);
- prev_cb = &dev->pre_tx_burst_cbs[queue_id];
+ prev_cb = &dev->fcns.pre_tx_burst_cbs[queue_id];
for (; *prev_cb != NULL; prev_cb = &cb->next) {
cb = *prev_cb;
if (cb == user_cb) {
@@ -4550,6 +4578,72 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)
return result;
}
+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);
+}
+
RTE_INIT(ethdev_init_log)
{
rte_eth_dev_logtype = rte_log_register("lib.ethdev");
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index dc6596bc9..a72046fc8 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1295,6 +1295,21 @@ struct rte_eth_dcb_info {
} \
} while (0)
+/* Macros to check for valid queue ids */
+#define RTE_ETH_VALID_RX_QUEUEID_OR_ERR_RET(port_id, queue_id, retval) do { \
+ if (!rte_eth_dev_is_valid_rx_queue_id(port_id, queue_id)) { \
+ RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", queue_id); \
+ return retval; \
+ } \
+} while (0)
+
+#define RTE_ETH_VALID_TX_QUEUEID_OR_ERR_RET(port_id, queue_id, retval) do { \
+ if (!rte_eth_dev_is_valid_tx_queue_id(port_id, queue_id)) { \
+ RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id); \
+ return retval; \
+ } \
+} while (0)
+
/**
* l2 tunnel configuration.
*/
@@ -1308,6 +1323,24 @@ struct rte_eth_dcb_info {
/**< l2 tunnel forwarding mask */
#define ETH_L2_TUNNEL_FORWARDING_MASK 0x00000008
+typedef uint16_t (*eth_rx_burst_t)(void *dev,
+ uint16_t rx_queue_id,
+ struct rte_mbuf **rx_pkts,
+ uint16_t nb_pkts);
+/**< @internal Retrieve input packets from a receive queue of an Ethernet device. */
+
+typedef uint16_t (*eth_tx_burst_t)(void *dev,
+ uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts,
+ uint16_t nb_pkts);
+/**< @internal Send output packets on a transmit queue of an Ethernet device. */
+
+typedef uint16_t (*eth_tx_prep_t)(void *dev,
+ uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts,
+ uint16_t nb_pkts);
+/**< @internal Prepare output packets on a transmit queue of an Ethernet device. */
+
/**
* Function type used for RX packet processing packet callbacks.
*
@@ -1843,6 +1876,33 @@ int rte_eth_dev_socket_id(uint16_t port_id);
*/
int rte_eth_dev_is_valid_port(uint16_t port_id);
+/**
+ * Check if rx_queue_id of device is not exceeding nb_rx_queues
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device
+ * @param queue_id
+ * The index of the receive queue from which to retrieve input packets.
+ * @return
+ * - 0 if queue is out of range
+ * - 1 if queue is within range
+ */
+int rte_eth_dev_is_valid_rx_queue_id(uint16_t port_id, uint16_t queue_id);
+
+/**
+ * Check if tx_queue_id of device is not exceeding nb_tx_queues
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device
+ * @param queue_id
+ * The index of the transmit queue through which output packets must be
+ * sent.
+ * @return
+ * - 0 if queue is out of range
+ * - 1 if queue is within range
+ */
+int rte_eth_dev_is_valid_tx_queue_id(uint16_t port_id, uint16_t queue_id);
+
/**
* Start specified RX queue of a port. It is used when rx_deferred_start
* flag of the specified queue is true.
@@ -3994,7 +4054,55 @@ void *
rte_eth_dev_get_sec_ctx(uint16_t port_id);
-#include <rte_ethdev_core.h>
+struct rte_eth_dev_callback;
+/** Structure to keep track of registered callbacks */
+TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
+
+/**
+ * Structure used to hold information about the callbacks to be called for a
+ * queue on RX and TX.
+ */
+struct rte_eth_rxtx_callback {
+ struct rte_eth_rxtx_callback *next;
+ union{
+ rte_rx_callback_fn rx;
+ rte_tx_callback_fn tx;
+ } fn;
+ void *param;
+};
+
+/**
+ * The generic data structure associated with each ethernet device.
+ *
+ * Pointers to burst-oriented packet receive and transmit functions are
+ * located at the beginning of the structure, along with the pointer to
+ * where all the data elements for the particular device are stored in shared
+ * memory. This split allows the function pointer and driver data to be per-
+ * process, while the actual configuration data for the device is shared.
+ */
+struct rte_eth_dev_fcns {
+ eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function. */
+ eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
+ eth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. */
+ /** User application callbacks for NIC interrupts */
+ struct rte_eth_dev_cb_list link_intr_cbs;
+ /**
+ * User-supplied functions called from rx_burst to post-process
+ * received packets before passing them to the user
+ */
+ struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
+ /**
+ * User-supplied functions called from tx_burst to pre-process
+ * received packets before passing them to the driver for transmission.
+ */
+ struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
+} __rte_cache_aligned;
+
+/**
+ * The pool of pointers to *rte_eth_dev_fcn* structures. The size of the pool
+ * is configured at compile-time in the <rte_ethdev.c> file.
+ */
+extern struct rte_eth_dev_fcns *rte_eth_dev_functions[];
/**
*
@@ -4082,25 +4190,21 @@ static inline 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];
+ struct rte_eth_dev_fcns *dev_fcns = rte_eth_dev_functions[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;
- }
+ RTE_FUNC_PTR_OR_ERR_RET(*dev_fcns->rx_pkt_burst, 0);
+ RTE_ETH_VALID_RX_QUEUEID_OR_ERR_RET(port_id, queue_id, 0);
#endif
- nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
+ nb_rx = (*dev_fcns->rx_pkt_burst)((void *)dev_fcns, queue_id,
rx_pkts, nb_pkts);
#ifdef RTE_ETHDEV_RXTX_CALLBACKS
- if (unlikely(dev->post_rx_burst_cbs[queue_id] != NULL)) {
+ if (unlikely(dev_fcns->post_rx_burst_cbs[queue_id] != NULL)) {
struct rte_eth_rxtx_callback *cb =
- dev->post_rx_burst_cbs[queue_id];
+ dev_fcns->post_rx_burst_cbs[queue_id];
do {
nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
@@ -4125,19 +4229,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 +4247,8 @@ 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 +4287,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 +4328,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.
@@ -4349,20 +4401,16 @@ static inline 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];
+ struct rte_eth_dev_fcns *dev_fcns = rte_eth_dev_functions[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;
- }
+ RTE_FUNC_PTR_OR_ERR_RET(dev_fcns->tx_pkt_burst, 0);
+ RTE_ETH_VALID_TX_QUEUEID_OR_ERR_RET(port_id, queue_id, 0);
#endif
#ifdef RTE_ETHDEV_RXTX_CALLBACKS
- struct rte_eth_rxtx_callback *cb = dev->pre_tx_burst_cbs[queue_id];
+ struct rte_eth_rxtx_callback *cb = dev_fcns->pre_tx_burst_cbs[queue_id];
if (unlikely(cb != NULL)) {
do {
@@ -4373,7 +4421,7 @@ rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
}
#endif
- return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
+ return (*dev_fcns->tx_pkt_burst)((void *)dev_fcns, queue_id, tx_pkts, nb_pkts);
}
/**
@@ -4435,7 +4483,7 @@ static inline 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;
+ struct rte_eth_dev_fcns *dev_fcns;
#ifdef RTE_LIBRTE_ETHDEV_DEBUG
if (!rte_eth_dev_is_valid_port(port_id)) {
@@ -4445,20 +4493,16 @@ rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
}
#endif
- dev = &rte_eth_devices[port_id];
+ dev_fcns = rte_eth_dev_functions[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;
- }
+ RTE_ETH_VALID_TX_QUEUEID_OR_ERR_RET(port_id, queue_id, 0);
#endif
- if (!dev->tx_pkt_prepare)
+ if (!dev_fcns->tx_pkt_prepare)
return nb_pkts;
- return (*dev->tx_pkt_prepare)(dev->data->tx_queues[queue_id],
+ return (*dev_fcns->tx_pkt_prepare)((void *)dev_fcns, queue_id,
tx_pkts, nb_pkts);
}
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 2922d5b7c..013fbdc30 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -17,520 +17,6 @@
*
*/
-struct rte_eth_dev_callback;
-/** @internal Structure to keep track of registered callbacks */
-TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
-
-/*
- * Definitions of all functions exported by an Ethernet driver through the
- * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
- * structure associated with an Ethernet device.
- */
-struct rte_eth_dev;
-
-typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
-/**< @internal Ethernet device configuration. */
-
-typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to start a configured Ethernet device. */
-
-typedef void (*eth_dev_stop_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to stop a configured Ethernet device. */
-
-typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to link up a configured Ethernet device. */
-
-typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to link down a configured Ethernet device. */
-
-typedef void (*eth_dev_close_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to close a configured Ethernet device. */
-
-typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
-/** <@internal Function used to reset a configured Ethernet device. */
-
-typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to detect an Ethernet device removal. */
-
-typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
-
-typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */
-
-typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
-/**< @internal Enable the receipt of all multicast packets by an Ethernet device. */
-
-typedef void (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
-/**< @internal Disable the receipt of all multicast packets by an Ethernet device. */
-
-typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
- int wait_to_complete);
-/**< @internal Get link speed, duplex mode and state (up/down) of an Ethernet device. */
-
-typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
- struct rte_eth_stats *igb_stats);
-/**< @internal Get global I/O statistics of an Ethernet device. */
-
-typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
-/**< @internal Reset global I/O statistics of an Ethernet device to 0. */
-
-typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
- struct rte_eth_xstat *stats, unsigned n);
-/**< @internal Get extended stats of an Ethernet device. */
-
-typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
- const uint64_t *ids,
- uint64_t *values,
- unsigned int n);
-/**< @internal Get extended stats of an Ethernet device. */
-
-typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
-/**< @internal Reset extended stats of an Ethernet device. */
-
-typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names, unsigned size);
-/**< @internal Get names of extended stats of an Ethernet device. */
-
-typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
- struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
- unsigned int size);
-/**< @internal Get names of extended stats of an Ethernet device. */
-
-typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
- uint16_t queue_id,
- uint8_t stat_idx,
- uint8_t is_rx);
-/**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
-
-typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
- struct rte_eth_dev_info *dev_info);
-/**< @internal Get specific information of an Ethernet device. */
-
-typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
-/**< @internal Get supported ptypes of an Ethernet device. */
-
-typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
- uint16_t queue_id);
-/**< @internal Start rx and tx of a queue of an Ethernet device. */
-
-typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
- uint16_t queue_id);
-/**< @internal Stop rx and tx of a queue of an Ethernet device. */
-
-typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
- uint16_t rx_queue_id,
- uint16_t nb_rx_desc,
- unsigned int socket_id,
- const struct rte_eth_rxconf *rx_conf,
- struct rte_mempool *mb_pool);
-/**< @internal Set up a receive queue of an Ethernet device. */
-
-typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
- uint16_t tx_queue_id,
- uint16_t nb_tx_desc,
- unsigned int socket_id,
- const struct rte_eth_txconf *tx_conf);
-/**< @internal Setup a transmit queue of an Ethernet device. */
-
-typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
-/**< @internal Enable interrupt of a receive queue of an Ethernet device. */
-
-typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
-/**< @internal Disable interrupt of a receive queue of an Ethernet device. */
-
-typedef void (*eth_queue_release_t)(void *queue);
-/**< @internal Release memory resources allocated by given RX/TX queue. */
-
-typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
-/**< @internal Get number of used descriptors on a receive queue. */
-
-typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
-/**< @internal Check DD bit of specific RX descriptor */
-
-typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
-/**< @internal Check the status of a Rx descriptor */
-
-typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset);
-/**< @internal Check the status of a Tx descriptor */
-
-typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
- char *fw_version, size_t fw_size);
-/**< @internal Get firmware information of an Ethernet device. */
-
-typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
-/**< @internal Force mbufs to be from TX ring. */
-
-typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
- uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
-
-typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
- uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
-
-typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
-/**< @internal Set MTU. */
-
-typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
- uint16_t vlan_id,
- int on);
-/**< @internal filtering of a VLAN Tag Identifier by an Ethernet device. */
-
-typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
- enum rte_vlan_type type, uint16_t tpid);
-/**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */
-
-typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
-/**< @internal set VLAN offload function by an Ethernet device. */
-
-typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
- uint16_t vlan_id,
- int on);
-/**< @internal set port based TX VLAN insertion by an Ethernet device. */
-
-typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
- uint16_t rx_queue_id,
- int on);
-/**< @internal VLAN stripping enable/disable by an queue of Ethernet device. */
-
-typedef uint16_t (*eth_rx_burst_t)(void *rxq,
- struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts);
-/**< @internal Retrieve input packets from a receive queue of an Ethernet device. */
-
-typedef uint16_t (*eth_tx_burst_t)(void *txq,
- struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts);
-/**< @internal Send output packets on a transmit queue of an Ethernet device. */
-
-typedef uint16_t (*eth_tx_prep_t)(void *txq,
- struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts);
-/**< @internal Prepare output packets on a transmit queue of an Ethernet device. */
-
-typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
- struct rte_eth_fc_conf *fc_conf);
-/**< @internal Get current flow control parameter on an Ethernet device */
-
-typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
- struct rte_eth_fc_conf *fc_conf);
-/**< @internal Setup flow control parameter on an Ethernet device */
-
-typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
- struct rte_eth_pfc_conf *pfc_conf);
-/**< @internal Setup priority flow control parameter on an Ethernet device */
-
-typedef int (*reta_update_t)(struct rte_eth_dev *dev,
- struct rte_eth_rss_reta_entry64 *reta_conf,
- uint16_t reta_size);
-/**< @internal Update RSS redirection table on an Ethernet device */
-
-typedef int (*reta_query_t)(struct rte_eth_dev *dev,
- struct rte_eth_rss_reta_entry64 *reta_conf,
- uint16_t reta_size);
-/**< @internal Query RSS redirection table on an Ethernet device */
-
-typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
- struct rte_eth_rss_conf *rss_conf);
-/**< @internal Update RSS hash configuration of an Ethernet device */
-
-typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
- struct rte_eth_rss_conf *rss_conf);
-/**< @internal Get current RSS hash configuration of an Ethernet device */
-
-typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
-/**< @internal Turn on SW controllable LED on an Ethernet device */
-
-typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
-/**< @internal Turn off SW controllable LED on an Ethernet device */
-
-typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
-/**< @internal Remove MAC address from receive address register */
-
-typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
- struct rte_ether_addr *mac_addr,
- uint32_t index,
- uint32_t vmdq);
-/**< @internal Set a MAC address into Receive Address Address Register */
-
-typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
- struct rte_ether_addr *mac_addr);
-/**< @internal Set a MAC address into Receive Address Address Register */
-
-typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
- struct rte_ether_addr *mac_addr,
- uint8_t on);
-/**< @internal Set a Unicast Hash bitmap */
-
-typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
- uint8_t on);
-/**< @internal Set all Unicast Hash bitmap */
-
-typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
- uint16_t queue_idx,
- uint16_t tx_rate);
-/**< @internal Set queue TX rate */
-
-typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev,
- struct rte_eth_mirror_conf *mirror_conf,
- uint8_t rule_id,
- uint8_t on);
-/**< @internal Add a traffic mirroring rule on an Ethernet device */
-
-typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev,
- uint8_t rule_id);
-/**< @internal Remove a traffic mirroring rule on an Ethernet device */
-
-typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
- struct rte_eth_udp_tunnel *tunnel_udp);
-/**< @internal Add tunneling UDP port */
-
-typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
- struct rte_eth_udp_tunnel *tunnel_udp);
-/**< @internal Delete tunneling UDP port */
-
-typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
- struct rte_ether_addr *mc_addr_set,
- uint32_t nb_mc_addr);
-/**< @internal set the list of multicast addresses on an Ethernet device */
-
-typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to enable IEEE1588/802.1AS timestamping. */
-
-typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to disable IEEE1588/802.1AS timestamping. */
-
-typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
- struct timespec *timestamp,
- uint32_t flags);
-/**< @internal Function used to read an RX IEEE1588/802.1AS timestamp. */
-
-typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
- struct timespec *timestamp);
-/**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */
-
-typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
-/**< @internal Function used to adjust the device clock */
-
-typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
- struct timespec *timestamp);
-/**< @internal Function used to get time from the device clock. */
-
-typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
- const struct timespec *timestamp);
-/**< @internal Function used to get time from the device clock */
-
-typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
- uint64_t *timestamp);
-/**< @internal Function used to get the current value of the device clock. */
-
-typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
- struct rte_dev_reg_info *info);
-/**< @internal Retrieve registers */
-
-typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
-/**< @internal Retrieve eeprom size */
-
-typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
- struct rte_dev_eeprom_info *info);
-/**< @internal Retrieve eeprom data */
-
-typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
- struct rte_dev_eeprom_info *info);
-/**< @internal Program eeprom data */
-
-typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
- struct rte_eth_dev_module_info *modinfo);
-/**< @internal Retrieve type and size of plugin module eeprom */
-
-typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
- struct rte_dev_eeprom_info *info);
-/**< @internal Retrieve plugin module eeprom data */
-
-typedef int (*eth_l2_tunnel_eth_type_conf_t)
- (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
-/**< @internal config l2 tunnel ether type */
-
-typedef int (*eth_l2_tunnel_offload_set_t)
- (struct rte_eth_dev *dev,
- struct rte_eth_l2_tunnel_conf *l2_tunnel,
- uint32_t mask,
- uint8_t en);
-/**< @internal enable/disable the l2 tunnel offload functions */
-
-
-typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
- enum rte_filter_type filter_type,
- enum rte_filter_op filter_op,
- void *arg);
-/**< @internal Take operations to assigned filter type on an Ethernet device */
-
-typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
-/**< @internal Get Traffic Management (TM) operations on an Ethernet device */
-
-typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
-/**< @internal Get Traffic Metering and Policing (MTR) operations */
-
-typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
- struct rte_eth_dcb_info *dcb_info);
-/**< @internal Get dcb information on an Ethernet device */
-
-typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
- const char *pool);
-/**< @internal Test if a port supports specific mempool ops */
-
-/**
- * @internal A structure containing the functions exported by an Ethernet driver.
- */
-struct eth_dev_ops {
- eth_dev_configure_t dev_configure; /**< Configure device. */
- eth_dev_start_t dev_start; /**< Start device. */
- eth_dev_stop_t dev_stop; /**< Stop device. */
- eth_dev_set_link_up_t dev_set_link_up; /**< Device link up. */
- eth_dev_set_link_down_t dev_set_link_down; /**< Device link down. */
- eth_dev_close_t dev_close; /**< Close device. */
- eth_dev_reset_t dev_reset; /**< Reset device. */
- eth_link_update_t link_update; /**< Get device link state. */
- eth_is_removed_t is_removed;
- /**< Check if the device was physically removed. */
-
- eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON. */
- eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF. */
- eth_allmulticast_enable_t allmulticast_enable;/**< RX multicast ON. */
- eth_allmulticast_disable_t allmulticast_disable;/**< RX multicast OFF. */
- eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address. */
- eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address. */
- eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address. */
- eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs. */
- mtu_set_t mtu_set; /**< Set MTU. */
-
- eth_stats_get_t stats_get; /**< Get generic device statistics. */
- eth_stats_reset_t stats_reset; /**< Reset generic device statistics. */
- eth_xstats_get_t xstats_get; /**< Get extended device statistics. */
- eth_xstats_reset_t xstats_reset; /**< Reset extended device statistics. */
- eth_xstats_get_names_t xstats_get_names;
- /**< Get names of extended statistics. */
- eth_queue_stats_mapping_set_t queue_stats_mapping_set;
- /**< Configure per queue stat counter mapping. */
-
- eth_dev_infos_get_t dev_infos_get; /**< Get device info. */
- eth_rxq_info_get_t rxq_info_get; /**< retrieve RX queue information. */
- eth_txq_info_get_t txq_info_get; /**< retrieve TX queue information. */
- eth_fw_version_get_t fw_version_get; /**< Get firmware version. */
- eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
- /**< Get packet types supported and identified by device. */
-
- vlan_filter_set_t vlan_filter_set; /**< Filter VLAN Setup. */
- vlan_tpid_set_t vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */
- vlan_strip_queue_set_t vlan_strip_queue_set; /**< VLAN Stripping on queue. */
- vlan_offload_set_t vlan_offload_set; /**< Set VLAN Offload. */
- vlan_pvid_set_t vlan_pvid_set; /**< Set port based TX VLAN insertion. */
-
- eth_queue_start_t rx_queue_start;/**< Start RX for a queue. */
- eth_queue_stop_t rx_queue_stop; /**< Stop RX for a queue. */
- eth_queue_start_t tx_queue_start;/**< Start TX for a queue. */
- eth_queue_stop_t tx_queue_stop; /**< Stop TX for a queue. */
- eth_rx_queue_setup_t rx_queue_setup;/**< Set up device RX queue. */
- eth_queue_release_t rx_queue_release; /**< Release RX queue. */
- eth_rx_queue_count_t rx_queue_count;
- /**< Get the number of used RX descriptors. */
- eth_rx_descriptor_done_t rx_descriptor_done; /**< Check rxd DD bit. */
- eth_rx_descriptor_status_t rx_descriptor_status;
- /**< Check the status of a Rx descriptor. */
- eth_tx_descriptor_status_t tx_descriptor_status;
- /**< Check the status of a Tx descriptor. */
- eth_rx_enable_intr_t rx_queue_intr_enable; /**< Enable Rx queue interrupt. */
- eth_rx_disable_intr_t rx_queue_intr_disable; /**< Disable Rx queue interrupt. */
- eth_tx_queue_setup_t tx_queue_setup;/**< Set up device TX queue. */
- eth_queue_release_t tx_queue_release; /**< Release TX queue. */
- eth_tx_done_cleanup_t tx_done_cleanup;/**< Free tx ring mbufs */
-
- eth_dev_led_on_t dev_led_on; /**< Turn on LED. */
- eth_dev_led_off_t dev_led_off; /**< Turn off LED. */
-
- flow_ctrl_get_t flow_ctrl_get; /**< Get flow control. */
- flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control. */
- priority_flow_ctrl_set_t priority_flow_ctrl_set; /**< Setup priority flow control. */
-
- eth_uc_hash_table_set_t uc_hash_table_set; /**< Set Unicast Table Array. */
- eth_uc_all_hash_table_set_t uc_all_hash_table_set; /**< Set Unicast hash bitmap. */
-
- eth_mirror_rule_set_t mirror_rule_set; /**< Add a traffic mirror rule. */
- eth_mirror_rule_reset_t mirror_rule_reset; /**< reset a traffic mirror rule. */
-
- eth_udp_tunnel_port_add_t udp_tunnel_port_add; /** Add UDP tunnel port. */
- eth_udp_tunnel_port_del_t udp_tunnel_port_del; /** Del UDP tunnel port. */
- eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
- /** Config ether type of l2 tunnel. */
- eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
- /** Enable/disable l2 tunnel offload functions. */
-
- eth_set_queue_rate_limit_t set_queue_rate_limit; /**< Set queue rate limit. */
-
- rss_hash_update_t rss_hash_update; /** Configure RSS hash protocols. */
- rss_hash_conf_get_t rss_hash_conf_get; /** Get current RSS hash configuration. */
- reta_update_t reta_update; /** Update redirection table. */
- reta_query_t reta_query; /** Query redirection table. */
-
- eth_get_reg_t get_reg; /**< Get registers. */
- eth_get_eeprom_length_t get_eeprom_length; /**< Get eeprom length. */
- eth_get_eeprom_t get_eeprom; /**< Get eeprom data. */
- eth_set_eeprom_t set_eeprom; /**< Set eeprom. */
-
- eth_get_module_info_t get_module_info;
- /** Get plugin module eeprom attribute. */
- eth_get_module_eeprom_t get_module_eeprom;
- /** Get plugin module eeprom data. */
-
- eth_filter_ctrl_t filter_ctrl; /**< common filter control. */
-
- eth_get_dcb_info get_dcb_info; /** Get DCB information. */
-
- eth_timesync_enable_t timesync_enable;
- /** Turn IEEE1588/802.1AS timestamping on. */
- eth_timesync_disable_t timesync_disable;
- /** Turn IEEE1588/802.1AS timestamping off. */
- eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
- /** Read the IEEE1588/802.1AS RX timestamp. */
- eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
- /** Read the IEEE1588/802.1AS TX timestamp. */
- eth_timesync_adjust_time timesync_adjust_time; /** Adjust the device clock. */
- eth_timesync_read_time timesync_read_time; /** Get the device clock time. */
- eth_timesync_write_time timesync_write_time; /** Set the device clock time. */
-
- eth_read_clock read_clock;
-
- eth_xstats_get_by_id_t xstats_get_by_id;
- /**< Get extended device statistic values by ID. */
- eth_xstats_get_names_by_id_t xstats_get_names_by_id;
- /**< Get name of extended device statistics by ID. */
-
- eth_tm_ops_get_t tm_ops_get;
- /**< Get Traffic Management (TM) operations. */
-
- eth_mtr_ops_get_t mtr_ops_get;
- /**< Get Traffic Metering and Policing (MTR) operations. */
-
- eth_pool_ops_supported_t pool_ops_supported;
- /**< Test if a port supports specific mempool ops */
-};
-
-/**
- * @internal
- * Structure used to hold information about the callbacks to be called for a
- * queue on RX and TX.
- */
-struct rte_eth_rxtx_callback {
- struct rte_eth_rxtx_callback *next;
- union{
- rte_rx_callback_fn rx;
- rte_tx_callback_fn tx;
- } fn;
- void *param;
-};
-
/**
* @internal
* The generic data structure associated with each ethernet device.
@@ -542,9 +28,7 @@ struct rte_eth_rxtx_callback {
* process, while the actual configuration data for the device is shared.
*/
struct rte_eth_dev {
- eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function. */
- eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
- eth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. */
+ struct rte_eth_dev_fcns fcns; /**< Public eth device functions */
/**
* Next two fields are per-device data but *data is shared between
* primary and secondary processes and *process_private is per-process
@@ -555,18 +39,6 @@ struct rte_eth_dev {
const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
struct rte_device *device; /**< Backing device */
struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
- /** User application callbacks for NIC interrupts */
- struct rte_eth_dev_cb_list link_intr_cbs;
- /**
- * User-supplied functions called from rx_burst to post-process
- * received packets before passing them to the user
- */
- struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
- /**
- * User-supplied functions called from tx_burst to pre-process
- * received packets before passing them to the driver for transmission.
- */
- struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
enum rte_eth_dev_state state; /**< Flag indicating the port state */
void *security_ctx; /**< Context for security ops */
} __rte_cache_aligned;
@@ -645,3 +117,4 @@ struct rte_eth_dev_data {
extern struct rte_eth_dev rte_eth_devices[];
#endif /* _RTE_ETHDEV_CORE_H_ */
+
diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
index 936ff8c98..6265d2fae 100644
--- a/lib/librte_ethdev/rte_ethdev_driver.h
+++ b/lib/librte_ethdev/rte_ethdev_driver.h
@@ -16,11 +16,493 @@
*/
#include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
#ifdef __cplusplus
extern "C" {
#endif
+/*
+ * Definitions of all functions exported by an Ethernet driver through the
+ * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
+ * structure associated with an Ethernet device.
+ */
+struct rte_eth_dev;
+
+typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
+/**< @internal Ethernet device configuration. */
+
+typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to start a configured Ethernet device. */
+
+typedef void (*eth_dev_stop_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to stop a configured Ethernet device. */
+
+typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to link up a configured Ethernet device. */
+
+typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to link down a configured Ethernet device. */
+
+typedef void (*eth_dev_close_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to close a configured Ethernet device. */
+
+typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
+/** <@internal Function used to reset a configured Ethernet device. */
+
+typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to detect an Ethernet device removal. */
+
+typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
+
+typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */
+
+typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
+/**< @internal Enable the receipt of all multicast packets by an Ethernet device. */
+
+typedef void (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
+/**< @internal Disable the receipt of all multicast packets by an Ethernet device. */
+
+typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
+ int wait_to_complete);
+/**< @internal Get link speed, duplex mode and state (up/down) of an Ethernet device. */
+
+typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
+ struct rte_eth_stats *igb_stats);
+/**< @internal Get global I/O statistics of an Ethernet device. */
+
+typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
+/**< @internal Reset global I/O statistics of an Ethernet device to 0. */
+
+typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
+ struct rte_eth_xstat *stats, unsigned n);
+/**< @internal Get extended stats of an Ethernet device. */
+
+typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
+ const uint64_t *ids,
+ uint64_t *values,
+ unsigned int n);
+/**< @internal Get extended stats of an Ethernet device. */
+
+typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
+/**< @internal Reset extended stats of an Ethernet device. */
+
+typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names, unsigned size);
+/**< @internal Get names of extended stats of an Ethernet device. */
+
+typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
+ struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
+ unsigned int size);
+/**< @internal Get names of extended stats of an Ethernet device. */
+
+typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
+ uint16_t queue_id,
+ uint8_t stat_idx,
+ uint8_t is_rx);
+/**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
+
+typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
+ struct rte_eth_dev_info *dev_info);
+/**< @internal Get specific information of an Ethernet device. */
+
+typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
+/**< @internal Get supported ptypes of an Ethernet device. */
+
+typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
+ uint16_t queue_id);
+/**< @internal Start rx and tx of a queue of an Ethernet device. */
+
+typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
+ uint16_t queue_id);
+/**< @internal Stop rx and tx of a queue of an Ethernet device. */
+
+typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
+ uint16_t rx_queue_id,
+ uint16_t nb_rx_desc,
+ unsigned int socket_id,
+ const struct rte_eth_rxconf *rx_conf,
+ struct rte_mempool *mb_pool);
+/**< @internal Set up a receive queue of an Ethernet device. */
+
+typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
+ uint16_t tx_queue_id,
+ uint16_t nb_tx_desc,
+ unsigned int socket_id,
+ const struct rte_eth_txconf *tx_conf);
+/**< @internal Setup a transmit queue of an Ethernet device. */
+
+typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
+ uint16_t rx_queue_id);
+/**< @internal Enable interrupt of a receive queue of an Ethernet device. */
+
+typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
+ uint16_t rx_queue_id);
+/**< @internal Disable interrupt of a receive queue of an Ethernet device. */
+
+typedef void (*eth_queue_release_t)(void *queue);
+/**< @internal Release memory resources allocated by given RX/TX queue. */
+
+typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
+ uint16_t rx_queue_id);
+/**< @internal Get number of used descriptors on a receive queue. */
+
+typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
+/**< @internal Check DD bit of specific RX descriptor */
+
+typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
+/**< @internal Check the status of a Rx descriptor */
+
+typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset);
+/**< @internal Check the status of a Tx descriptor */
+
+typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
+ char *fw_version, size_t fw_size);
+/**< @internal Get firmware information of an Ethernet device. */
+
+typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
+/**< @internal Force mbufs to be from TX ring. */
+
+typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
+ uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
+
+typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
+ uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
+
+typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
+/**< @internal Set MTU. */
+
+typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
+ uint16_t vlan_id,
+ int on);
+/**< @internal filtering of a VLAN Tag Identifier by an Ethernet device. */
+
+typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
+ enum rte_vlan_type type, uint16_t tpid);
+/**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */
+
+typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
+/**< @internal set VLAN offload function by an Ethernet device. */
+
+typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
+ uint16_t vlan_id,
+ int on);
+/**< @internal set port based TX VLAN insertion by an Ethernet device. */
+
+typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
+ uint16_t rx_queue_id,
+ int on);
+/**< @internal VLAN stripping enable/disable by an queue of Ethernet device. */
+
+typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
+ struct rte_eth_fc_conf *fc_conf);
+/**< @internal Get current flow control parameter on an Ethernet device */
+
+typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
+ struct rte_eth_fc_conf *fc_conf);
+/**< @internal Setup flow control parameter on an Ethernet device */
+
+typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
+ struct rte_eth_pfc_conf *pfc_conf);
+/**< @internal Setup priority flow control parameter on an Ethernet device */
+
+typedef int (*reta_update_t)(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+/**< @internal Update RSS redirection table on an Ethernet device */
+
+typedef int (*reta_query_t)(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf,
+ uint16_t reta_size);
+/**< @internal Query RSS redirection table on an Ethernet device */
+
+typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf);
+/**< @internal Update RSS hash configuration of an Ethernet device */
+
+typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf);
+/**< @internal Get current RSS hash configuration of an Ethernet device */
+
+typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
+/**< @internal Turn on SW controllable LED on an Ethernet device */
+
+typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
+/**< @internal Turn off SW controllable LED on an Ethernet device */
+
+typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
+/**< @internal Remove MAC address from receive address register */
+
+typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
+ struct rte_ether_addr *mac_addr,
+ uint32_t index,
+ uint32_t vmdq);
+/**< @internal Set a MAC address into Receive Address Address Register */
+
+typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
+ struct rte_ether_addr *mac_addr);
+/**< @internal Set a MAC address into Receive Address Address Register */
+
+typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
+ struct rte_ether_addr *mac_addr,
+ uint8_t on);
+/**< @internal Set a Unicast Hash bitmap */
+
+typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
+ uint8_t on);
+/**< @internal Set all Unicast Hash bitmap */
+
+typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
+ uint16_t queue_idx,
+ uint16_t tx_rate);
+/**< @internal Set queue TX rate */
+
+typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev,
+ struct rte_eth_mirror_conf *mirror_conf,
+ uint8_t rule_id,
+ uint8_t on);
+/**< @internal Add a traffic mirroring rule on an Ethernet device */
+
+typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev,
+ uint8_t rule_id);
+/**< @internal Remove a traffic mirroring rule on an Ethernet device */
+
+typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
+ struct rte_eth_udp_tunnel *tunnel_udp);
+/**< @internal Add tunneling UDP port */
+
+typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
+ struct rte_eth_udp_tunnel *tunnel_udp);
+/**< @internal Delete tunneling UDP port */
+
+typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
+ struct rte_ether_addr *mc_addr_set,
+ uint32_t nb_mc_addr);
+/**< @internal set the list of multicast addresses on an Ethernet device */
+
+typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to enable IEEE1588/802.1AS timestamping. */
+
+typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
+/**< @internal Function used to disable IEEE1588/802.1AS timestamping. */
+
+typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
+ struct timespec *timestamp,
+ uint32_t flags);
+/**< @internal Function used to read an RX IEEE1588/802.1AS timestamp. */
+
+typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
+ struct timespec *timestamp);
+/**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */
+
+typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
+/**< @internal Function used to adjust the device clock */
+
+typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
+ struct timespec *timestamp);
+/**< @internal Function used to get time from the device clock. */
+
+typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
+ const struct timespec *timestamp);
+/**< @internal Function used to get time from the device clock */
+
+typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
+ uint64_t *timestamp);
+/**< @internal Function used to get the current value of the device clock. */
+
+typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
+ struct rte_dev_reg_info *info);
+/**< @internal Retrieve registers */
+
+typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
+/**< @internal Retrieve eeprom size */
+
+typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
+ struct rte_dev_eeprom_info *info);
+/**< @internal Retrieve eeprom data */
+
+typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
+ struct rte_dev_eeprom_info *info);
+/**< @internal Program eeprom data */
+
+typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
+ struct rte_eth_dev_module_info *modinfo);
+/**< @internal Retrieve type and size of plugin module eeprom */
+
+typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
+ struct rte_dev_eeprom_info *info);
+/**< @internal Retrieve plugin module eeprom data */
+
+typedef int (*eth_l2_tunnel_eth_type_conf_t)
+ (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
+/**< @internal config l2 tunnel ether type */
+
+typedef int (*eth_l2_tunnel_offload_set_t)
+ (struct rte_eth_dev *dev,
+ struct rte_eth_l2_tunnel_conf *l2_tunnel,
+ uint32_t mask,
+ uint8_t en);
+/**< @internal enable/disable the l2 tunnel offload functions */
+
+
+typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
+ enum rte_filter_type filter_type,
+ enum rte_filter_op filter_op,
+ void *arg);
+/**< @internal Take operations to assigned filter type on an Ethernet device */
+
+typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
+/**< @internal Get Traffic Management (TM) operations on an Ethernet device */
+
+typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
+/**< @internal Get Traffic Metering and Policing (MTR) operations */
+
+typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
+ struct rte_eth_dcb_info *dcb_info);
+/**< @internal Get dcb information on an Ethernet device */
+
+typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
+ const char *pool);
+/**< @internal Test if a port supports specific mempool ops */
+
+/**
+ * @internal A structure containing the functions exported by an Ethernet driver.
+ */
+struct eth_dev_ops {
+ eth_dev_configure_t dev_configure; /**< Configure device. */
+ eth_dev_start_t dev_start; /**< Start device. */
+ eth_dev_stop_t dev_stop; /**< Stop device. */
+ eth_dev_set_link_up_t dev_set_link_up; /**< Device link up. */
+ eth_dev_set_link_down_t dev_set_link_down; /**< Device link down. */
+ eth_dev_close_t dev_close; /**< Close device. */
+ eth_dev_reset_t dev_reset; /**< Reset device. */
+ eth_link_update_t link_update; /**< Get device link state. */
+ eth_is_removed_t is_removed;
+ /**< Check if the device was physically removed. */
+
+ eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON. */
+ eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF. */
+ eth_allmulticast_enable_t allmulticast_enable;/**< RX multicast ON. */
+ eth_allmulticast_disable_t allmulticast_disable;/**< RX multicast OFF. */
+ eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address. */
+ eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address. */
+ eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address. */
+ eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs. */
+ mtu_set_t mtu_set; /**< Set MTU. */
+
+ eth_stats_get_t stats_get; /**< Get generic device statistics. */
+ eth_stats_reset_t stats_reset; /**< Reset generic device statistics. */
+ eth_xstats_get_t xstats_get; /**< Get extended device statistics. */
+ eth_xstats_reset_t xstats_reset; /**< Reset extended device statistics. */
+ eth_xstats_get_names_t xstats_get_names;
+ /**< Get names of extended statistics. */
+ eth_queue_stats_mapping_set_t queue_stats_mapping_set;
+ /**< Configure per queue stat counter mapping. */
+
+ eth_dev_infos_get_t dev_infos_get; /**< Get device info. */
+ eth_rxq_info_get_t rxq_info_get; /**< retrieve RX queue information. */
+ eth_txq_info_get_t txq_info_get; /**< retrieve TX queue information. */
+ eth_fw_version_get_t fw_version_get; /**< Get firmware version. */
+ eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
+ /**< Get packet types supported and identified by device. */
+
+ vlan_filter_set_t vlan_filter_set; /**< Filter VLAN Setup. */
+ vlan_tpid_set_t vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */
+ vlan_strip_queue_set_t vlan_strip_queue_set; /**< VLAN Stripping on queue. */
+ vlan_offload_set_t vlan_offload_set; /**< Set VLAN Offload. */
+ vlan_pvid_set_t vlan_pvid_set; /**< Set port based TX VLAN insertion. */
+
+ eth_queue_start_t rx_queue_start;/**< Start RX for a queue. */
+ eth_queue_stop_t rx_queue_stop; /**< Stop RX for a queue. */
+ eth_queue_start_t tx_queue_start;/**< Start TX for a queue. */
+ eth_queue_stop_t tx_queue_stop; /**< Stop TX for a queue. */
+ eth_rx_queue_setup_t rx_queue_setup;/**< Set up device RX queue. */
+ eth_queue_release_t rx_queue_release; /**< Release RX queue. */
+ eth_rx_queue_count_t rx_queue_count;
+ /**< Get the number of used RX descriptors. */
+ eth_rx_descriptor_done_t rx_descriptor_done; /**< Check rxd DD bit. */
+ eth_rx_descriptor_status_t rx_descriptor_status;
+ /**< Check the status of a Rx descriptor. */
+ eth_tx_descriptor_status_t tx_descriptor_status;
+ /**< Check the status of a Tx descriptor. */
+ eth_rx_enable_intr_t rx_queue_intr_enable; /**< Enable Rx queue interrupt. */
+ eth_rx_disable_intr_t rx_queue_intr_disable; /**< Disable Rx queue interrupt. */
+ eth_tx_queue_setup_t tx_queue_setup;/**< Set up device TX queue. */
+ eth_queue_release_t tx_queue_release; /**< Release TX queue. */
+ eth_tx_done_cleanup_t tx_done_cleanup;/**< Free tx ring mbufs */
+
+ eth_dev_led_on_t dev_led_on; /**< Turn on LED. */
+ eth_dev_led_off_t dev_led_off; /**< Turn off LED. */
+
+ flow_ctrl_get_t flow_ctrl_get; /**< Get flow control. */
+ flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control. */
+ priority_flow_ctrl_set_t priority_flow_ctrl_set; /**< Setup priority flow control. */
+
+ eth_uc_hash_table_set_t uc_hash_table_set; /**< Set Unicast Table Array. */
+ eth_uc_all_hash_table_set_t uc_all_hash_table_set; /**< Set Unicast hash bitmap. */
+
+ eth_mirror_rule_set_t mirror_rule_set; /**< Add a traffic mirror rule. */
+ eth_mirror_rule_reset_t mirror_rule_reset; /**< reset a traffic mirror rule. */
+
+ eth_udp_tunnel_port_add_t udp_tunnel_port_add; /** Add UDP tunnel port. */
+ eth_udp_tunnel_port_del_t udp_tunnel_port_del; /** Del UDP tunnel port. */
+ eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
+ /** Config ether type of l2 tunnel. */
+ eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
+ /** Enable/disable l2 tunnel offload functions. */
+
+ eth_set_queue_rate_limit_t set_queue_rate_limit; /**< Set queue rate limit. */
+
+ rss_hash_update_t rss_hash_update; /** Configure RSS hash protocols. */
+ rss_hash_conf_get_t rss_hash_conf_get; /** Get current RSS hash configuration. */
+ reta_update_t reta_update; /** Update redirection table. */
+ reta_query_t reta_query; /** Query redirection table. */
+
+ eth_get_reg_t get_reg; /**< Get registers. */
+ eth_get_eeprom_length_t get_eeprom_length; /**< Get eeprom length. */
+ eth_get_eeprom_t get_eeprom; /**< Get eeprom data. */
+ eth_set_eeprom_t set_eeprom; /**< Set eeprom. */
+
+ eth_get_module_info_t get_module_info;
+ /** Get plugin module eeprom attribute. */
+ eth_get_module_eeprom_t get_module_eeprom;
+ /** Get plugin module eeprom data. */
+
+ eth_filter_ctrl_t filter_ctrl; /**< common filter control. */
+
+ eth_get_dcb_info get_dcb_info; /** Get DCB information. */
+
+ eth_timesync_enable_t timesync_enable;
+ /** Turn IEEE1588/802.1AS timestamping on. */
+ eth_timesync_disable_t timesync_disable;
+ /** Turn IEEE1588/802.1AS timestamping off. */
+ eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
+ /** Read the IEEE1588/802.1AS RX timestamp. */
+ eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
+ /** Read the IEEE1588/802.1AS TX timestamp. */
+ eth_timesync_adjust_time timesync_adjust_time; /** Adjust the device clock. */
+ eth_timesync_read_time timesync_read_time; /** Get the device clock time. */
+ eth_timesync_write_time timesync_write_time; /** Set the device clock time. */
+
+ eth_read_clock read_clock;
+
+ eth_xstats_get_by_id_t xstats_get_by_id;
+ /**< Get extended device statistic values by ID. */
+ eth_xstats_get_names_by_id_t xstats_get_names_by_id;
+ /**< Get name of extended device statistics by ID. */
+
+ eth_tm_ops_get_t tm_ops_get;
+ /**< Get Traffic Management (TM) operations. */
+
+ eth_mtr_ops_get_t mtr_ops_get;
+ /**< Get Traffic Metering and Policing (MTR) operations. */
+
+ eth_pool_ops_supported_t pool_ops_supported;
+ /**< Test if a port supports specific mempool ops */
+};
+
/**
* @internal
* Returns a ethdev slot specified by the unique identifier name.
diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map
index 6df42a47b..137c2f91a 100644
--- a/lib/librte_ethdev/rte_ethdev_version.map
+++ b/lib/librte_ethdev/rte_ethdev_version.map
@@ -236,6 +236,17 @@ DPDK_19.05 {
} DPDK_18.11;
+DPDK_19.11 {
+ global:
+ rte_eth_rx_queue_count;
+ rte_eth_rx_descriptor_done;
+ rte_eth_rx_descriptor_status;
+ rte_eth_tx_descriptor_status;
+ rte_eth_dev_functions;
+ rte_eth_dev_is_valid_tx_queue_id;
+ rte_eth_dev_is_valid_rx_queue_id;
+} DPDK_19.05;
+
EXPERIMENTAL {
global:
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 18fcb018e..532d6c1ea 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -12,7 +12,7 @@
#include <rte_errno.h>
#include <rte_branch_prediction.h>
#include <rte_string_fns.h>
-#include "rte_ethdev.h"
+#include "rte_ethdev_driver.h"
#include "rte_flow_driver.h"
#include "rte_flow.h"
diff --git a/lib/librte_ethdev/rte_mtr.c b/lib/librte_ethdev/rte_mtr.c
index 3073ac03f..17d95a6d3 100644
--- a/lib/librte_ethdev/rte_mtr.c
+++ b/lib/librte_ethdev/rte_mtr.c
@@ -6,7 +6,7 @@
#include <rte_errno.h>
#include "rte_compat.h"
-#include "rte_ethdev.h"
+#include "rte_ethdev_driver.h"
#include "rte_mtr_driver.h"
#include "rte_mtr.h"
diff --git a/lib/librte_ethdev/rte_tm.c b/lib/librte_ethdev/rte_tm.c
index 9709454f3..23a0470f5 100644
--- a/lib/librte_ethdev/rte_tm.c
+++ b/lib/librte_ethdev/rte_tm.c
@@ -5,7 +5,7 @@
#include <stdint.h>
#include <rte_errno.h>
-#include "rte_ethdev.h"
+#include "rte_ethdev_driver.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 <rte_errno.h>
#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..82818da8d 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
@@ -11,7 +11,7 @@
#include <rte_common.h>
#include <rte_dev.h>
#include <rte_errno.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_service_component.h>
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
index d02ef57f4..8eb7caffd 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
@@ -3,7 +3,7 @@
*/
#include <rte_spinlock.h>
#include <rte_service_component.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#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..d9daa34d3 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -29,7 +29,7 @@
#include <rte_common.h>
#include <rte_malloc.h>
#include <rte_errno.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_cryptodev.h>
#include <rte_cryptodev_pmd.h>
diff --git a/lib/librte_flow_classify/rte_flow_classify.h b/lib/librte_flow_classify/rte_flow_classify.h
index 74d1ecaf5..808a9caf2 100644
--- a/lib/librte_flow_classify/rte_flow_classify.h
+++ b/lib/librte_flow_classify/rte_flow_classify.h
@@ -43,7 +43,7 @@
#include <rte_compat.h>
#include <rte_common.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_ether.h>
#include <rte_flow.h>
#include <rte_acl.h>
diff --git a/lib/librte_flow_classify/rte_flow_classify_parse.h b/lib/librte_flow_classify/rte_flow_classify_parse.h
index 365a07bd6..91d632fbd 100644
--- a/lib/librte_flow_classify/rte_flow_classify_parse.h
+++ b/lib/librte_flow_classify/rte_flow_classify_parse.h
@@ -5,7 +5,7 @@
#ifndef _RTE_FLOW_CLASSIFY_PARSE_H_
#define _RTE_FLOW_CLASSIFY_PARSE_H_
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_ether.h>
#include <rte_flow.h>
#include <stdbool.h>
diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c
index feb585514..223e45318 100644
--- a/lib/librte_gro/gro_tcp4.c
+++ b/lib/librte_gro/gro_tcp4.c
@@ -5,7 +5,7 @@
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_cycles.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include "gro_tcp4.h"
diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c
index f3b6e603b..edd3b40f4 100644
--- a/lib/librte_gro/gro_vxlan_tcp4.c
+++ b/lib/librte_gro/gro_vxlan_tcp4.c
@@ -5,7 +5,7 @@
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_cycles.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_udp.h>
#include "gro_vxlan_tcp4.h"
diff --git a/lib/librte_gro/rte_gro.c b/lib/librte_gro/rte_gro.c
index 6618f4d32..6595848da 100644
--- a/lib/librte_gro/rte_gro.c
+++ b/lib/librte_gro/rte_gro.c
@@ -5,7 +5,7 @@
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_cycles.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include "rte_gro.h"
#include "gro_tcp4.h"
diff --git a/lib/librte_gso/rte_gso.c b/lib/librte_gso/rte_gso.c
index 751b5b625..5729bb0c5 100644
--- a/lib/librte_gso/rte_gso.c
+++ b/lib/librte_gso/rte_gso.c
@@ -5,7 +5,7 @@
#include <errno.h>
#include <rte_log.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include "rte_gso.h"
#include "gso_common.h"
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index 4b51fb4fe..8e5606189 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -13,7 +13,7 @@
#include <rte_spinlock.h>
#include <rte_string_fns.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_malloc.h>
#include <rte_log.h>
#include <rte_kni.h>
diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c
index 06c62831b..84ff9e422 100644
--- a/lib/librte_latencystats/rte_latencystats.c
+++ b/lib/librte_latencystats/rte_latencystats.c
@@ -11,7 +11,7 @@
#include <rte_mbuf.h>
#include <rte_log.h>
#include <rte_cycles.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_metrics.h>
#include <rte_memzone.h>
#include <rte_lcore.h>
diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index cd24dd010..28a9be277 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -4,7 +4,7 @@
#include <rte_memcpy.h>
#include <rte_mbuf.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_lcore.h>
#include <rte_log.h>
#include <rte_errno.h>
diff --git a/lib/librte_port/rte_port_ethdev.c b/lib/librte_port/rte_port_ethdev.c
index 0da789026..1a8819a35 100644
--- a/lib/librte_port/rte_port_ethdev.c
+++ b/lib/librte_port/rte_port_ethdev.c
@@ -5,7 +5,7 @@
#include <stdint.h>
#include <rte_mbuf.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_malloc.h>
#include "rte_port_ethdev.h"
diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c
index eb20cc651..4256758c9 100644
--- a/lib/librte_telemetry/rte_telemetry.c
+++ b/lib/librte_telemetry/rte_telemetry.c
@@ -10,7 +10,7 @@
#include <jansson.h>
#include <rte_eal.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_metrics.h>
#include <rte_option.h>
#include <rte_string_fns.h>
diff --git a/lib/librte_telemetry/rte_telemetry_parser.c b/lib/librte_telemetry/rte_telemetry_parser.c
index 960132397..c649995e1 100644
--- a/lib/librte_telemetry/rte_telemetry_parser.c
+++ b/lib/librte_telemetry/rte_telemetry_parser.c
@@ -10,7 +10,7 @@
#include <rte_metrics.h>
#include <rte_common.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include "rte_telemetry_internal.h"
#include "rte_telemetry_parser.h"
diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index 981837b5d..a5f4bc0b8 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -13,7 +13,7 @@
#endif
#include <rte_errno.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_log.h>
#include <rte_string_fns.h>
#include <rte_memory.h>
--
2.17.1
^ permalink raw reply [flat|nested] 33+ messages in thread
* [dpdk-dev] [RFC 19.11 v2 2/3] i40e: make driver compatible with changes in ethdev
2019-07-30 12:49 [dpdk-dev] [RFC 19.11 0/2] Hide DPDK internal struct from public API Marcin Zapolski
` (3 preceding siblings ...)
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures " Marcin Zapolski
@ 2019-09-06 13:18 ` Marcin Zapolski
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 3/3] ixgbe: " Marcin Zapolski
5 siblings, 0 replies; 33+ messages in thread
From: Marcin Zapolski @ 2019-09-06 13:18 UTC (permalink / raw)
To: dev; +Cc: Marcin Zapolski
Modify i40e to be compatible with new rte_eth_dev structures layout.
Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
---
drivers/net/i40e/i40e_ethdev.c | 10 +-
drivers/net/i40e/i40e_ethdev.h | 1 +
drivers/net/i40e/i40e_ethdev_vf.c | 8 +-
drivers/net/i40e/i40e_rxtx.c | 119 ++++++++++++-----------
drivers/net/i40e/i40e_rxtx.h | 33 ++++---
drivers/net/i40e/i40e_rxtx_vec_altivec.c | 23 +++--
drivers/net/i40e/i40e_rxtx_vec_avx2.c | 45 +++++----
drivers/net/i40e/i40e_rxtx_vec_neon.c | 23 +++--
drivers/net/i40e/i40e_rxtx_vec_sse.c | 23 +++--
drivers/net/i40e/i40e_vf_representor.c | 12 ++-
10 files changed, 166 insertions(+), 131 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4e40b7ab5..08c3a7cc3 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1273,9 +1273,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
PMD_INIT_FUNC_TRACE();
dev->dev_ops = &i40e_eth_dev_ops;
- dev->rx_pkt_burst = i40e_recv_pkts;
- dev->tx_pkt_burst = i40e_xmit_pkts;
- dev->tx_pkt_prepare = i40e_prep_pkts;
+ dev->fcns.rx_pkt_burst = i40e_recv_pkts;
+ dev->fcns.tx_pkt_burst = i40e_xmit_pkts;
+ dev->fcns.tx_pkt_prepare = i40e_prep_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
@@ -1717,8 +1717,8 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
i40e_dev_close(dev);
dev->dev_ops = NULL;
- dev->rx_pkt_burst = NULL;
- dev->tx_pkt_burst = NULL;
+ dev->fcns.rx_pkt_burst = NULL;
+ dev->fcns.tx_pkt_burst = NULL;
/* Clear PXE mode */
i40e_clear_pxe_mode(hw);
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 38ac3ead6..a64857dab 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <rte_time.h>
+#include <rte_ethdev_driver.h>
#include <rte_kvargs.h>
#include <rte_hash.h>
#include <rte_flow.h>
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 308fb9835..c0db43444 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1473,8 +1473,8 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
/* assign ops func pointer */
eth_dev->dev_ops = &i40evf_eth_dev_ops;
- eth_dev->rx_pkt_burst = &i40e_recv_pkts;
- eth_dev->tx_pkt_burst = &i40e_xmit_pkts;
+ eth_dev->fcns.rx_pkt_burst = &i40e_recv_pkts;
+ eth_dev->fcns.tx_pkt_burst = &i40e_xmit_pkts;
/*
* For secondary processes, we don't initialise any further as primary
@@ -1535,8 +1535,8 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
return -EPERM;
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;
if (i40evf_uninit_vf(eth_dev) != 0) {
PMD_INIT_LOG(ERR, "i40evf_uninit_vf failed");
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 692c3bab4..4181d4fc8 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -576,10 +576,11 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq)
}
static inline uint16_t
-rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
+rx_recv_pkts(void *eth_dev, uint16_t rx_queue_id, struct rte_mbuf **rx_pkts,
+ uint16_t nb_pkts)
{
- struct i40e_rx_queue *rxq = (struct i40e_rx_queue *)rx_queue;
- struct rte_eth_dev *dev;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
uint16_t nb_rx = 0;
if (!nb_pkts)
@@ -597,7 +598,6 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
if (i40e_rx_alloc_bufs(rxq) != 0) {
uint16_t i, j;
- dev = I40E_VSI_TO_ETH_DEV(rxq->vsi);
dev->data->rx_mbuf_alloc_failed +=
rxq->rx_free_thresh;
@@ -620,7 +620,7 @@ rx_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
}
static uint16_t
-i40e_recv_pkts_bulk_alloc(void *rx_queue,
+i40e_recv_pkts_bulk_alloc(void *eth_dev, uint16_t rx_queue_id,
struct rte_mbuf **rx_pkts,
uint16_t nb_pkts)
{
@@ -630,11 +630,11 @@ i40e_recv_pkts_bulk_alloc(void *rx_queue,
return 0;
if (likely(nb_pkts <= RTE_PMD_I40E_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);
while (nb_pkts) {
n = RTE_MIN(nb_pkts, RTE_PMD_I40E_RX_MAX_BURST);
- count = rx_recv_pkts(rx_queue, &rx_pkts[nb_rx], n);
+ count = rx_recv_pkts(eth_dev, rx_queue_id, &rx_pkts[nb_rx], n);
nb_rx = (uint16_t)(nb_rx + count);
nb_pkts = (uint16_t)(nb_pkts - count);
if (count < n)
@@ -645,7 +645,8 @@ i40e_recv_pkts_bulk_alloc(void *rx_queue,
}
#else
static uint16_t
-i40e_recv_pkts_bulk_alloc(void __rte_unused *rx_queue,
+i40e_recv_pkts_bulk_alloc(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)
{
@@ -654,15 +655,16 @@ i40e_recv_pkts_bulk_alloc(void __rte_unused *rx_queue,
#endif /* RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC */
uint16_t
-i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
+i40e_recv_pkts(void *eth_dev, uint16_t rx_queue_id, struct rte_mbuf **rx_pkts,
+ uint16_t nb_pkts)
{
- struct i40e_rx_queue *rxq;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
volatile union i40e_rx_desc *rx_ring;
volatile union i40e_rx_desc *rxdp;
union i40e_rx_desc rxd;
struct i40e_rx_entry *sw_ring;
struct i40e_rx_entry *rxe;
- struct rte_eth_dev *dev;
struct rte_mbuf *rxm;
struct rte_mbuf *nmb;
uint16_t nb_rx;
@@ -676,7 +678,6 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_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;
@@ -694,7 +695,6 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
nmb = rte_mbuf_raw_alloc(rxq->mp);
if (unlikely(!nmb)) {
- dev = I40E_VSI_TO_ETH_DEV(rxq->vsi);
dev->data->rx_mbuf_alloc_failed++;
break;
}
@@ -776,11 +776,12 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
}
uint16_t
-i40e_recv_scattered_pkts(void *rx_queue,
+i40e_recv_scattered_pkts(void *eth_dev, uint16_t rx_queue_id,
struct rte_mbuf **rx_pkts,
uint16_t nb_pkts)
{
- struct i40e_rx_queue *rxq = rx_queue;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
volatile union i40e_rx_desc *rx_ring = rxq->rx_ring;
volatile union i40e_rx_desc *rxdp;
union i40e_rx_desc rxd;
@@ -791,7 +792,6 @@ i40e_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf *nmb, *rxm;
uint16_t rx_id = rxq->rx_tail;
uint16_t nb_rx = 0, nb_hold = 0, rx_packet_len;
- struct rte_eth_dev *dev;
uint32_t rx_status;
uint64_t qword1;
uint64_t dma_addr;
@@ -810,7 +810,6 @@ i40e_recv_scattered_pkts(void *rx_queue,
nmb = rte_mbuf_raw_alloc(rxq->mp);
if (unlikely(!nmb)) {
- dev = I40E_VSI_TO_ETH_DEV(rxq->vsi);
dev->data->rx_mbuf_alloc_failed++;
break;
}
@@ -997,9 +996,11 @@ i40e_set_tso_ctx(struct rte_mbuf *mbuf, union i40e_tx_offload tx_offload)
}
uint16_t
-i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+i40e_xmit_pkts(void *eth_dev, uint16_t tx_queue_id, struct rte_mbuf **tx_pkts,
+ uint16_t nb_pkts)
{
- struct i40e_tx_queue *txq;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_tx_queue *txq = dev->data->tx_queues[tx_queue_id];
struct i40e_tx_entry *sw_ring;
struct i40e_tx_entry *txe, *txn;
volatile struct i40e_tx_desc *txd;
@@ -1020,7 +1021,6 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
uint64_t buf_dma_addr;
union i40e_tx_offload tx_offload = {0};
- txq = tx_queue;
sw_ring = txq->sw_ring;
txr = txq->tx_ring;
tx_id = txq->tx_tail;
@@ -1372,11 +1372,14 @@ tx_xmit_pkts(struct i40e_tx_queue *txq,
}
static uint16_t
-i40e_xmit_pkts_simple(void *tx_queue,
+i40e_xmit_pkts_simple(void *eth_dev,
+ uint16_t tx_queue_id,
struct rte_mbuf **tx_pkts,
uint16_t nb_pkts)
{
uint16_t nb_tx = 0;
+ struct rte_eth_dev *dev = eth_dev;
+ void *tx_queue = dev->data->tx_queues[tx_queue_id];
if (likely(nb_pkts <= I40E_TX_MAX_BURST))
return tx_xmit_pkts((struct i40e_tx_queue *)tx_queue,
@@ -1398,17 +1401,18 @@ i40e_xmit_pkts_simple(void *tx_queue,
}
static uint16_t
-i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts)
+i40e_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 i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_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 = i40e_xmit_fixed_burst_vec(tx_queue, &tx_pkts[nb_tx],
+ ret = i40e_xmit_fixed_burst_vec(eth_dev, tx_queue_id, &tx_pkts[nb_tx],
num);
nb_tx += ret;
nb_pkts -= ret;
@@ -1425,8 +1429,8 @@ i40e_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
*
**********************************************************************/
uint16_t
-i40e_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts)
+i40e_prep_pkts(__rte_unused void *eth_dev, __rte_unused uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
int i, ret;
uint64_t ol_flags;
@@ -1674,15 +1678,15 @@ i40e_dev_supported_ptypes_get(struct rte_eth_dev *dev)
RTE_PTYPE_UNKNOWN
};
- if (dev->rx_pkt_burst == i40e_recv_pkts ||
+ if (dev->fcns.rx_pkt_burst == i40e_recv_pkts ||
#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
- dev->rx_pkt_burst == i40e_recv_pkts_bulk_alloc ||
+ dev->fcns.rx_pkt_burst == i40e_recv_pkts_bulk_alloc ||
#endif
- dev->rx_pkt_burst == i40e_recv_scattered_pkts ||
- dev->rx_pkt_burst == i40e_recv_scattered_pkts_vec ||
- dev->rx_pkt_burst == i40e_recv_pkts_vec ||
- dev->rx_pkt_burst == i40e_recv_scattered_pkts_vec_avx2 ||
- dev->rx_pkt_burst == i40e_recv_pkts_vec_avx2)
+ dev->fcns.rx_pkt_burst == i40e_recv_scattered_pkts ||
+ dev->fcns.rx_pkt_burst == i40e_recv_scattered_pkts_vec ||
+ dev->fcns.rx_pkt_burst == i40e_recv_pkts_vec ||
+ dev->fcns.rx_pkt_burst == i40e_recv_scattered_pkts_vec_avx2 ||
+ dev->fcns.rx_pkt_burst == i40e_recv_pkts_vec_avx2)
return ptypes;
return NULL;
}
@@ -2443,8 +2447,8 @@ i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq)
* vPMD tx will not set sw_ring's mbuf to NULL after free,
* so need to free remains more carefully.
*/
- if (dev->tx_pkt_burst == i40e_xmit_pkts_vec_avx2 ||
- dev->tx_pkt_burst == i40e_xmit_pkts_vec) {
+ if (dev->fcns.tx_pkt_burst == i40e_xmit_pkts_vec_avx2 ||
+ dev->fcns.tx_pkt_burst == i40e_xmit_pkts_vec) {
i = txq->tx_next_dd - txq->tx_rs_thresh + 1;
if (txq->tx_tail < i) {
for (; i < txq->nb_tx_desc; i++) {
@@ -2990,10 +2994,10 @@ i40e_set_rx_function(struct rte_eth_dev *dev)
PMD_INIT_LOG(DEBUG, "Vector Rx path will be used on port=%d.",
dev->data->port_id);
if (ad->use_latest_vec)
- dev->rx_pkt_burst =
+ dev->fcns.rx_pkt_burst =
i40e_get_latest_rx_vec(dev->data->scattered_rx);
else
- dev->rx_pkt_burst =
+ dev->fcns.rx_pkt_burst =
i40e_get_recommend_rx_vec(dev->data->scattered_rx);
} else if (!dev->data->scattered_rx && ad->rx_bulk_alloc_allowed) {
PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions are "
@@ -3001,12 +3005,12 @@ i40e_set_rx_function(struct rte_eth_dev *dev)
"will be used on port=%d.",
dev->data->port_id);
- dev->rx_pkt_burst = i40e_recv_pkts_bulk_alloc;
+ dev->fcns.rx_pkt_burst = i40e_recv_pkts_bulk_alloc;
} else {
/* Simple Rx Path. */
PMD_INIT_LOG(DEBUG, "Simple Rx path will be used on port=%d.",
dev->data->port_id);
- dev->rx_pkt_burst = dev->data->scattered_rx ?
+ dev->fcns.rx_pkt_burst = dev->data->scattered_rx ?
i40e_recv_scattered_pkts :
i40e_recv_pkts;
}
@@ -3014,10 +3018,10 @@ i40e_set_rx_function(struct rte_eth_dev *dev)
/* Propagate information about RX function choice through all queues. */
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
rx_using_sse =
- (dev->rx_pkt_burst == i40e_recv_scattered_pkts_vec ||
- dev->rx_pkt_burst == i40e_recv_pkts_vec ||
- dev->rx_pkt_burst == i40e_recv_scattered_pkts_vec_avx2 ||
- dev->rx_pkt_burst == i40e_recv_pkts_vec_avx2);
+ (dev->fcns.rx_pkt_burst == i40e_recv_scattered_pkts_vec ||
+ dev->fcns.rx_pkt_burst == i40e_recv_pkts_vec ||
+ dev->fcns.rx_pkt_burst == i40e_recv_scattered_pkts_vec_avx2 ||
+ dev->fcns.rx_pkt_burst == i40e_recv_pkts_vec_avx2);
for (i = 0; i < dev->data->nb_rx_queues; i++) {
struct i40e_rx_queue *rxq = dev->data->rx_queues[i];
@@ -3104,20 +3108,20 @@ i40e_set_tx_function(struct rte_eth_dev *dev)
if (ad->tx_vec_allowed) {
PMD_INIT_LOG(DEBUG, "Vector tx finally be used.");
if (ad->use_latest_vec)
- dev->tx_pkt_burst =
+ dev->fcns.tx_pkt_burst =
i40e_get_latest_tx_vec();
else
- dev->tx_pkt_burst =
+ dev->fcns.tx_pkt_burst =
i40e_get_recommend_tx_vec();
} else {
PMD_INIT_LOG(DEBUG, "Simple tx finally be used.");
- dev->tx_pkt_burst = i40e_xmit_pkts_simple;
+ dev->fcns.tx_pkt_burst = i40e_xmit_pkts_simple;
}
- dev->tx_pkt_prepare = NULL;
+ dev->fcns.tx_pkt_prepare = NULL;
} else {
PMD_INIT_LOG(DEBUG, "Xmit tx finally be used.");
- dev->tx_pkt_burst = i40e_xmit_pkts;
- dev->tx_pkt_prepare = i40e_prep_pkts;
+ dev->fcns.tx_pkt_burst = i40e_xmit_pkts;
+ dev->fcns.tx_pkt_prepare = i40e_prep_pkts;
}
}
@@ -3201,7 +3205,8 @@ i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev __rte_unused *dev)
uint16_t
i40e_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)
{
@@ -3210,7 +3215,8 @@ i40e_recv_pkts_vec(
uint16_t
i40e_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)
{
@@ -3236,7 +3242,8 @@ i40e_rx_queue_release_mbufs_vec(struct i40e_rx_queue __rte_unused*rxq)
}
uint16_t
-i40e_xmit_fixed_burst_vec(void __rte_unused * tx_queue,
+i40e_xmit_fixed_burst_vec(void __rte_unused * eth_dev,
+ uint16_t __rte_unused tx_queue_id,
struct rte_mbuf __rte_unused **tx_pkts,
uint16_t __rte_unused nb_pkts)
{
@@ -3246,7 +3253,8 @@ i40e_xmit_fixed_burst_vec(void __rte_unused * tx_queue,
#ifndef CC_AVX2_SUPPORT
uint16_t
-i40e_recv_pkts_vec_avx2(void __rte_unused *rx_queue,
+i40e_recv_pkts_vec_avx2(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)
{
@@ -3254,7 +3262,8 @@ i40e_recv_pkts_vec_avx2(void __rte_unused *rx_queue,
}
uint16_t
-i40e_recv_scattered_pkts_vec_avx2(void __rte_unused *rx_queue,
+i40e_recv_scattered_pkts_vec_avx2(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/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index 3fc619af9..35a0196be 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -184,17 +184,20 @@ int i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
const struct rte_eth_txconf *tx_conf);
void i40e_dev_rx_queue_release(void *rxq);
void i40e_dev_tx_queue_release(void *txq);
-uint16_t i40e_recv_pkts(void *rx_queue,
+uint16_t i40e_recv_pkts(void *eth_dev,
+ uint16_t rx_queue_id,
struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
-uint16_t i40e_recv_scattered_pkts(void *rx_queue,
+uint16_t i40e_recv_scattered_pkts(void *eth_dev,
+ uint16_t rx_queue_id,
struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
-uint16_t i40e_xmit_pkts(void *tx_queue,
+uint16_t i40e_xmit_pkts(void *eth_dev,
+ uint16_t tx_queue_id,
struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
-uint16_t i40e_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts);
+uint16_t i40e_prep_pkts(void *eth_dev, uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
int i40e_tx_queue_init(struct i40e_tx_queue *txq);
int i40e_rx_queue_init(struct i40e_rx_queue *rxq);
void i40e_free_tx_resources(struct i40e_tx_queue *txq);
@@ -213,29 +216,29 @@ int i40e_dev_rx_descriptor_done(void *rx_queue, uint16_t offset);
int i40e_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int i40e_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
-uint16_t i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts);
-uint16_t i40e_recv_scattered_pkts_vec(void *rx_queue,
+uint16_t i40e_recv_pkts_vec(void *eth_dev, uint16_t rx_queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+uint16_t i40e_recv_scattered_pkts_vec(void *eth_dev, uint16_t rx_queue_id,
struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
int i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev);
int i40e_rxq_vec_setup(struct i40e_rx_queue *rxq);
int i40e_txq_vec_setup(struct i40e_tx_queue *txq);
void i40e_rx_queue_release_mbufs_vec(struct i40e_rx_queue *rxq);
-uint16_t i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts);
+uint16_t i40e_xmit_fixed_burst_vec(void *eth_dev, uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
void i40e_set_rx_function(struct rte_eth_dev *dev);
void i40e_set_tx_function_flag(struct rte_eth_dev *dev,
struct i40e_tx_queue *txq);
void i40e_set_tx_function(struct rte_eth_dev *dev);
void i40e_set_default_ptype_table(struct rte_eth_dev *dev);
void i40e_set_default_pctype_table(struct rte_eth_dev *dev);
-uint16_t i40e_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts);
-uint16_t i40e_recv_scattered_pkts_vec_avx2(void *rx_queue,
+uint16_t i40e_recv_pkts_vec_avx2(void *eth_dev, uint16_t rx_queue_id,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
-uint16_t i40e_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts);
+uint16_t i40e_recv_scattered_pkts_vec_avx2(void *eth_dev, uint16_t rx_queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
+uint16_t i40e_xmit_pkts_vec_avx2(void *eth_dev, uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts);
/* For each value it means, datasheet of hardware can tell more details
*
diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
index 310ce1ee2..787314475 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c
@@ -453,10 +453,12 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
* numbers of DD bits
*/
uint16_t
-i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+i40e_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 i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
+{ return _recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts, NULL);
}
/* vPMD receive routine that reassembles scattered packets
@@ -466,10 +468,12 @@ i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
* numbers of DD bits
*/
uint16_t
-i40e_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+i40e_recv_scattered_pkts_vec(void *eth_dev, uint16_t rx_queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
{
- struct i40e_rx_queue *rxq = rx_queue;
+
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
uint8_t split_flags[RTE_I40E_VPMD_RX_BURST] = {0};
/* get some new buffers */
@@ -524,10 +528,11 @@ vtx(volatile struct i40e_tx_desc *txdp,
}
uint16_t
-i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *eth_dev, uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
- struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_tx_queue *txq = dev->data->tx_queues[tx_queue_id];
volatile struct i40e_tx_desc *txdp;
struct i40e_tx_entry *txep;
uint16_t n, nb_commit, tx_id;
diff --git a/drivers/net/i40e/i40e_rxtx_vec_avx2.c b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
index c4dc990e0..599c21a0c 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_avx2.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_avx2.c
@@ -549,10 +549,12 @@ _recv_raw_pkts_vec_avx2(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet
*/
uint16_t
-i40e_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+i40e_recv_pkts_vec_avx2(void *eth_dev, uint16_t rx_queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
{
- return _recv_raw_pkts_vec_avx2(rx_queue, rx_pkts, nb_pkts, NULL);
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
+ return _recv_raw_pkts_vec_avx2(rxq, rx_pkts, nb_pkts, NULL);
}
/*
@@ -561,10 +563,11 @@ i40e_recv_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet
*/
static uint16_t
-i40e_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+i40e_recv_scattered_burst_vec_avx2(void *eth_dev, uint16_t rx_queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
{
- struct i40e_rx_queue *rxq = rx_queue;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
uint8_t split_flags[RTE_I40E_VPMD_RX_BURST] = {0};
/* get some new buffers */
@@ -602,20 +605,21 @@ i40e_recv_scattered_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet
*/
uint16_t
-i40e_recv_scattered_pkts_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+i40e_recv_scattered_pkts_vec_avx2(void *eth_dev, uint16_t rx_queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
{
uint16_t retval = 0;
while (nb_pkts > RTE_I40E_VPMD_RX_BURST) {
- uint16_t burst = i40e_recv_scattered_burst_vec_avx2(rx_queue,
- rx_pkts + retval, RTE_I40E_VPMD_RX_BURST);
+ uint16_t burst = i40e_recv_scattered_burst_vec_avx2(eth_dev,
+ rx_queue_id, rx_pkts + retval,
+ RTE_I40E_VPMD_RX_BURST);
retval += burst;
nb_pkts -= burst;
if (burst < RTE_I40E_VPMD_RX_BURST)
return retval;
}
- return retval + i40e_recv_scattered_burst_vec_avx2(rx_queue,
- rx_pkts + retval, nb_pkts);
+ return retval + i40e_recv_scattered_burst_vec_avx2(eth_dev,
+ rx_queue_id, rx_pkts + retval, nb_pkts);
}
@@ -674,10 +678,12 @@ vtx(volatile struct i40e_tx_desc *txdp,
}
static inline uint16_t
-i40e_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec_avx2(void *eth_dev, uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
- struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_tx_queue *txq = dev->data->tx_queues[tx_queue_id];
volatile struct i40e_tx_desc *txdp;
struct i40e_tx_entry *txep;
uint16_t n, nb_commit, tx_id;
@@ -741,18 +747,19 @@ i40e_xmit_fixed_burst_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
}
uint16_t
-i40e_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts,
+i40e_xmit_pkts_vec_avx2(void *eth_dev, uint16_t tx_queue_id, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts)
{
uint16_t nb_tx = 0;
- struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_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 = i40e_xmit_fixed_burst_vec_avx2(tx_queue, &tx_pkts[nb_tx],
- num);
+ ret = i40e_xmit_fixed_burst_vec_avx2(eth_dev, tx_queue_id,
+ &tx_pkts[nb_tx], num);
nb_tx += ret;
nb_pkts -= ret;
if (ret < num)
diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c
index 83572ef84..eb91db503 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c
@@ -435,12 +435,15 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
* numbers of DD bits
*/
uint16_t
-i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+i40e_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 i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
+{ return _recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts, NULL);
}
+
/* vPMD receive routine that reassembles scattered packets
* Notice:
* - nb_pkts < RTE_I40E_DESCS_PER_LOOP, just return no packet
@@ -448,11 +451,12 @@ i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
* numbers of DD bits
*/
uint16_t
-i40e_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+i40e_recv_scattered_pkts_vec(void *eth_dev, uint16_t rx_queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
{
- struct i40e_rx_queue *rxq = rx_queue;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
uint8_t split_flags[RTE_I40E_VPMD_RX_BURST] = {0};
/* get some new buffers */
@@ -506,10 +510,11 @@ vtx(volatile struct i40e_tx_desc *txdp,
}
uint16_t
-i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *eth_dev, uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
- struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_tx_queue *txq = dev->data->tx_queues[tx_queue_id];
volatile struct i40e_tx_desc *txdp;
struct i40e_tx_entry *txep;
uint16_t n, nb_commit, tx_id;
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 3b22588c5..3f594aae3 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -463,10 +463,12 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
* numbers of DD bits
*/
uint16_t
-i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+i40e_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 i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
+ return _recv_raw_pkts_vec(rxq, rx_pkts, nb_pkts, NULL);
}
/* vPMD receive routine that reassembles scattered packets
@@ -476,11 +478,11 @@ i40e_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
* numbers of DD bits
*/
uint16_t
-i40e_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
- uint16_t nb_pkts)
+i40e_recv_scattered_pkts_vec(void *eth_dev, uint16_t rx_queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
{
-
- struct i40e_rx_queue *rxq = rx_queue;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_rx_queue *rxq = dev->data->rx_queues[rx_queue_id];
uint8_t split_flags[RTE_I40E_VPMD_RX_BURST] = {0};
/* get some new buffers */
@@ -535,10 +537,11 @@ vtx(volatile struct i40e_tx_desc *txdp,
}
uint16_t
-i40e_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
- uint16_t nb_pkts)
+i40e_xmit_fixed_burst_vec(void *eth_dev, uint16_t tx_queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
{
- struct i40e_tx_queue *txq = (struct i40e_tx_queue *)tx_queue;
+ struct rte_eth_dev *dev = eth_dev;
+ struct i40e_tx_queue *txq = dev->data->tx_queues[tx_queue_id];
volatile struct i40e_tx_desc *txdp;
struct i40e_tx_entry *txep;
uint16_t n, nb_commit, tx_id;
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 633dca6c3..ae7c3af05 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -3,7 +3,7 @@
*/
#include <rte_bus_pci.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
#include <rte_pci.h>
#include <rte_malloc.h>
@@ -452,14 +452,16 @@ static const struct eth_dev_ops i40e_representor_dev_ops = {
};
static uint16_t
-i40e_vf_representor_rx_burst(__rte_unused void *rx_queue,
+i40e_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
-i40e_vf_representor_tx_burst(__rte_unused void *tx_queue,
+i40e_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;
@@ -493,8 +495,8 @@ i40e_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 = i40e_vf_representor_rx_burst;
- ethdev->tx_pkt_burst = i40e_vf_representor_tx_burst;
+ ethdev->fcns.rx_pkt_burst = i40e_vf_representor_rx_burst;
+ ethdev->fcns.tx_pkt_burst = i40e_vf_representor_tx_burst;
vf = &pf->vfs[representor->vf_id];
--
2.17.1
^ permalink raw reply [flat|nested] 33+ messages in thread
* [dpdk-dev] [RFC 19.11 v2 3/3] ixgbe: make driver compatible with changes in ethdev
2019-07-30 12:49 [dpdk-dev] [RFC 19.11 0/2] Hide DPDK internal struct from public API Marcin Zapolski
` (4 preceding siblings ...)
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 2/3] i40e: make driver compatible with changes in ethdev Marcin Zapolski
@ 2019-09-06 13:18 ` Marcin Zapolski
5 siblings, 0 replies; 33+ messages in thread
From: Marcin Zapolski @ 2019-09-06 13:18 UTC (permalink / raw)
To: dev; +Cc: Marcin Zapolski
Modify ixgbe to be compatible with new rte_eth_dev structures layout.
Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
---
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;
--
2.17.1
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 0/3] Hide DPDK internal struct from public API
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 0/3] Hide " Marcin Zapolski
@ 2019-09-06 14:00 ` Bruce Richardson
0 siblings, 0 replies; 33+ messages in thread
From: Bruce Richardson @ 2019-09-06 14:00 UTC (permalink / raw)
To: Marcin Zapolski; +Cc: dev, jerinj
On Fri, Sep 06, 2019 at 03:18:10PM +0200, Marcin Zapolski wrote:
> Several DPDK internal structures are exposed to direct access by user
> applications. This patch removes them from public API, and makes core DPDK
> functions that use them non-inline.
>
> v2:
> This patch set no longer makes internal DPDK functions non-inline. Instead
> it splits the rte_eth_dev structure to private and public part and modifies
> function arguments of rx and tx functions. This should bring less performance
> impact, but at the cost of needing to modify every PMD to use new rx and tx
> functions.
> For testing purposes, the ixgbe and i40e drivers are modified to acommodate for
> the changes.
>
> Marcin Zapolski (3):
> ethdev: hide key ethdev structures from public API
> i40e: make driver compatible with changes in ethdev
> ixgbe: make driver compatible with changes in ethdev
>
Thanks for testing this out Marcin. The performance impact seems lower
alright. The amount of changes needed I still am not particularly happy
about, so I'd like to propose a third option for consideration.
How about leaving the existing inline functions as they are, but also
providing the uninline functions for backward compatibility, with a
build-time switch to select between the two? Standard builds could use the
uninline versions for API/ABI compatibility, while any builds which
absolutely need the most performance can switch to using the inline
versions at the cost of compatibility. We could even make the build-switch
generic to indicate across all components a preference for absolute
performance over compatibility.
Regards,
/Bruce
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures " Marcin Zapolski
@ 2019-09-06 14:37 ` Ferruh Yigit
2019-09-09 8:07 ` Zapolski, MarcinX A
2019-09-06 17:24 ` Stephen Hemminger
2019-09-10 9:59 ` Zapolski, MarcinX A
2 siblings, 1 reply; 33+ messages in thread
From: Ferruh Yigit @ 2019-09-06 14:37 UTC (permalink / raw)
To: Marcin Zapolski, dev
On 9/6/2019 2:18 PM, Marcin Zapolski wrote:
> Split rte_eth_dev structure to two parts: head that is available for
> user applications, and rest which is DPDK internal.
> Make an array of pointers to rte_eth_dev structures available for user
> applications.
>
> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
<...>
> diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c
> index 639e47547..82d469514 100644
> --- a/lib/librte_bitratestats/rte_bitrate.c
> +++ b/lib/librte_bitratestats/rte_bitrate.c
> @@ -3,7 +3,7 @@
> */
>
> #include <rte_common.h>
> -#include <rte_ethdev.h>
> +#include <rte_ethdev_driver.h>
This is in the library, not sure if libraries should include the header file for
the drivers, can you please explain why this change is needed?
<...>
> @@ -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.c b/lib/librte_ethdev/rte_ethdev.c
> index 17d183e1f..5c6cc640a 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -40,6 +40,7 @@
>
> #include "rte_ether.h"
> #include "rte_ethdev.h"
> +#include "rte_ethdev_core.h"
> #include "rte_ethdev_driver.h"
> #include "ethdev_profile.h"
> #include "ethdev_private.h"
I was hoping "rte_ethdev_core.h" can be removed completely by distributing its
content to "ethdev_private.h", "rte_ethdev_driver.h" and perhaps even to
"rte_ethdev.h".
Can you please explain what prevents removing "rte_ethdev_core.h"?
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures " Marcin Zapolski
2019-09-06 14:37 ` Ferruh Yigit
@ 2019-09-06 17:24 ` Stephen Hemminger
2019-09-09 9:01 ` Zapolski, MarcinX A
2019-09-10 9:59 ` Zapolski, MarcinX A
2 siblings, 1 reply; 33+ messages in thread
From: Stephen Hemminger @ 2019-09-06 17:24 UTC (permalink / raw)
To: Marcin Zapolski; +Cc: dev
On Fri, 6 Sep 2019 15:18:11 +0200
Marcin Zapolski <marcinx.a.zapolski@intel.com> wrote:
> +RTE_INIT(rte_eth_dev_init)
> +{
> + int i;
> +
> + for (i = 0; i < RTE_MAX_ETHPORTS; i++)
> + rte_eth_dev_functions[i] =
> + (struct rte_eth_dev_fcns *)(&rte_eth_devices[i]);
Casts are error prone. Is it possible to use container_of instead of direct cast.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-06 14:37 ` Ferruh Yigit
@ 2019-09-09 8:07 ` Zapolski, MarcinX A
2019-09-09 9:59 ` Ferruh Yigit
0 siblings, 1 reply; 33+ messages in thread
From: Zapolski, MarcinX A @ 2019-09-09 8:07 UTC (permalink / raw)
To: Yigit, Ferruh, dev
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Friday, September 6, 2019 4:38 PM
> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> structures from public API
>
> On 9/6/2019 2:18 PM, Marcin Zapolski wrote:
> > Split rte_eth_dev structure to two parts: head that is available for
> > user applications, and rest which is DPDK internal.
> > Make an array of pointers to rte_eth_dev structures available for user
> > applications.
> >
> > Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
>
> <...>
>
> > diff --git a/lib/librte_bitratestats/rte_bitrate.c
> > b/lib/librte_bitratestats/rte_bitrate.c
> > index 639e47547..82d469514 100644
> > --- a/lib/librte_bitratestats/rte_bitrate.c
> > +++ b/lib/librte_bitratestats/rte_bitrate.c
> > @@ -3,7 +3,7 @@
> > */
> >
> > #include <rte_common.h>
> > -#include <rte_ethdev.h>
> > +#include <rte_ethdev_driver.h>
>
> This is in the library, not sure if libraries should include the header file for the
> drivers, can you please explain why this change is needed?
>
It is needed to make rte_eth_dev structure available. But yes, I agree that it will be more appropriate to include rte_ethdev.h and rte_ethdev_core.h separately. I probably wanted less includes, silly me.
> <...>
>
> > @@ -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.c
> > b/lib/librte_ethdev/rte_ethdev.c index 17d183e1f..5c6cc640a 100644
> > --- a/lib/librte_ethdev/rte_ethdev.c
> > +++ b/lib/librte_ethdev/rte_ethdev.c
> > @@ -40,6 +40,7 @@
> >
> > #include "rte_ether.h"
> > #include "rte_ethdev.h"
> > +#include "rte_ethdev_core.h"
> > #include "rte_ethdev_driver.h"
> > #include "ethdev_profile.h"
> > #include "ethdev_private.h"
>
> I was hoping "rte_ethdev_core.h" can be removed completely by
> distributing its content to "ethdev_private.h", "rte_ethdev_driver.h" and
> perhaps even to "rte_ethdev.h".
>
> Can you please explain what prevents removing "rte_ethdev_core.h"?
I could rename it to rte_ethdev_private. There is just rte_eth_dev and rte_eth_dev_data left in it.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-06 17:24 ` Stephen Hemminger
@ 2019-09-09 9:01 ` Zapolski, MarcinX A
0 siblings, 0 replies; 33+ messages in thread
From: Zapolski, MarcinX A @ 2019-09-09 9:01 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Friday, September 6, 2019 7:24 PM
> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> structures from public API
>
> On Fri, 6 Sep 2019 15:18:11 +0200
> Marcin Zapolski <marcinx.a.zapolski@intel.com> wrote:
>
> > +RTE_INIT(rte_eth_dev_init)
> > +{
> > + int i;
> > +
> > + for (i = 0; i < RTE_MAX_ETHPORTS; i++)
> > + rte_eth_dev_functions[i] =
> > + (struct rte_eth_dev_fcns *)(&rte_eth_devices[i]);
>
> Casts are error prone. Is it possible to use container_of instead of direct cast.
I could if I had a pointer to struct rte_eth_dev_functions and needed to get struct rte_eth_dev which is a container structure in this case. But I could use offsetof instead.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-09 8:07 ` Zapolski, MarcinX A
@ 2019-09-09 9:59 ` Ferruh Yigit
2019-09-09 10:02 ` Zapolski, MarcinX A
0 siblings, 1 reply; 33+ messages in thread
From: Ferruh Yigit @ 2019-09-09 9:59 UTC (permalink / raw)
To: Zapolski, MarcinX A, dev
On 9/9/2019 9:07 AM, Zapolski, MarcinX A wrote:
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Friday, September 6, 2019 4:38 PM
>> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
>> structures from public API
>>
>> On 9/6/2019 2:18 PM, Marcin Zapolski wrote:
>>> Split rte_eth_dev structure to two parts: head that is available for
>>> user applications, and rest which is DPDK internal.
>>> Make an array of pointers to rte_eth_dev structures available for user
>>> applications.
>>>
>>> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
>>
>> <...>
>>
>>> diff --git a/lib/librte_bitratestats/rte_bitrate.c
>>> b/lib/librte_bitratestats/rte_bitrate.c
>>> index 639e47547..82d469514 100644
>>> --- a/lib/librte_bitratestats/rte_bitrate.c
>>> +++ b/lib/librte_bitratestats/rte_bitrate.c
>>> @@ -3,7 +3,7 @@
>>> */
>>>
>>> #include <rte_common.h>
>>> -#include <rte_ethdev.h>
>>> +#include <rte_ethdev_driver.h>
>>
>> This is in the library, not sure if libraries should include the header file for the
>> drivers, can you please explain why this change is needed?
>>
> It is needed to make rte_eth_dev structure available. But yes, I agree that it will be more appropriate to include rte_ethdev.h and rte_ethdev_core.h separately. I probably wanted less includes, silly me.
>> <...>
>>
>>> @@ -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.c
>>> b/lib/librte_ethdev/rte_ethdev.c index 17d183e1f..5c6cc640a 100644
>>> --- a/lib/librte_ethdev/rte_ethdev.c
>>> +++ b/lib/librte_ethdev/rte_ethdev.c
>>> @@ -40,6 +40,7 @@
>>>
>>> #include "rte_ether.h"
>>> #include "rte_ethdev.h"
>>> +#include "rte_ethdev_core.h"
>>> #include "rte_ethdev_driver.h"
>>> #include "ethdev_profile.h"
>>> #include "ethdev_private.h"
>>
>> I was hoping "rte_ethdev_core.h" can be removed completely by
>> distributing its content to "ethdev_private.h", "rte_ethdev_driver.h" and
>> perhaps even to "rte_ethdev.h".
>>
>> Can you please explain what prevents removing "rte_ethdev_core.h"?
> I could rename it to rte_ethdev_private. There is just rte_eth_dev and rte_eth_dev_data left in it.
>
I think drivers access to both 'rte_eth_dev' and 'rte_eth_dev_data' so can't
move them to 'ethdev_private.h' why not move it to 'rte_ethdev_driver.h'?
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-09 9:59 ` Ferruh Yigit
@ 2019-09-09 10:02 ` Zapolski, MarcinX A
2019-09-09 10:24 ` Ferruh Yigit
0 siblings, 1 reply; 33+ messages in thread
From: Zapolski, MarcinX A @ 2019-09-09 10:02 UTC (permalink / raw)
To: Yigit, Ferruh, dev
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Monday, September 9, 2019 12:00 PM
> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> structures from public API
>
> On 9/9/2019 9:07 AM, Zapolski, MarcinX A wrote:
> >> -----Original Message-----
> >> From: Yigit, Ferruh
> >> Sent: Friday, September 6, 2019 4:38 PM
> >> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
> >> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> >> structures from public API
> >>
> >> On 9/6/2019 2:18 PM, Marcin Zapolski wrote:
> >>> Split rte_eth_dev structure to two parts: head that is available for
> >>> user applications, and rest which is DPDK internal.
> >>> Make an array of pointers to rte_eth_dev structures available for
> >>> user applications.
> >>>
> >>> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> >>
> >> <...>
> >>
> >>> diff --git a/lib/librte_bitratestats/rte_bitrate.c
> >>> b/lib/librte_bitratestats/rte_bitrate.c
> >>> index 639e47547..82d469514 100644
> >>> --- a/lib/librte_bitratestats/rte_bitrate.c
> >>> +++ b/lib/librte_bitratestats/rte_bitrate.c
> >>> @@ -3,7 +3,7 @@
> >>> */
> >>>
> >>> #include <rte_common.h>
> >>> -#include <rte_ethdev.h>
> >>> +#include <rte_ethdev_driver.h>
> >>
> >> This is in the library, not sure if libraries should include the
> >> header file for the drivers, can you please explain why this change is
> needed?
> >>
> > It is needed to make rte_eth_dev structure available. But yes, I agree that
> it will be more appropriate to include rte_ethdev.h and rte_ethdev_core.h
> separately. I probably wanted less includes, silly me.
> >> <...>
> >>
> >>> @@ -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.c
> >>> b/lib/librte_ethdev/rte_ethdev.c index 17d183e1f..5c6cc640a 100644
> >>> --- a/lib/librte_ethdev/rte_ethdev.c
> >>> +++ b/lib/librte_ethdev/rte_ethdev.c
> >>> @@ -40,6 +40,7 @@
> >>>
> >>> #include "rte_ether.h"
> >>> #include "rte_ethdev.h"
> >>> +#include "rte_ethdev_core.h"
> >>> #include "rte_ethdev_driver.h"
> >>> #include "ethdev_profile.h"
> >>> #include "ethdev_private.h"
> >>
> >> I was hoping "rte_ethdev_core.h" can be removed completely by
> >> distributing its content to "ethdev_private.h", "rte_ethdev_driver.h"
> >> and perhaps even to "rte_ethdev.h".
> >>
> >> Can you please explain what prevents removing "rte_ethdev_core.h"?
> > I could rename it to rte_ethdev_private. There is just rte_eth_dev and
> rte_eth_dev_data left in it.
> >
>
> I think drivers access to both 'rte_eth_dev' and 'rte_eth_dev_data' so can't
> move them to 'ethdev_private.h' why not move it to 'rte_ethdev_driver.h'?
Because the libraries use them as well.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-09 10:02 ` Zapolski, MarcinX A
@ 2019-09-09 10:24 ` Ferruh Yigit
2019-09-09 11:41 ` Zapolski, MarcinX A
2019-09-14 10:34 ` Jerin Jacob
0 siblings, 2 replies; 33+ messages in thread
From: Ferruh Yigit @ 2019-09-09 10:24 UTC (permalink / raw)
To: Zapolski, MarcinX A, dev; +Cc: Jerin Jacob, Laatz, Kevin
On 9/9/2019 11:02 AM, Zapolski, MarcinX A wrote:
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Monday, September 9, 2019 12:00 PM
>> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
>> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
>> structures from public API
>>
>> On 9/9/2019 9:07 AM, Zapolski, MarcinX A wrote:
>>>> -----Original Message-----
>>>> From: Yigit, Ferruh
>>>> Sent: Friday, September 6, 2019 4:38 PM
>>>> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
>>>> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
>>>> structures from public API
>>>>
>>>> On 9/6/2019 2:18 PM, Marcin Zapolski wrote:
>>>>> Split rte_eth_dev structure to two parts: head that is available for
>>>>> user applications, and rest which is DPDK internal.
>>>>> Make an array of pointers to rte_eth_dev structures available for
>>>>> user applications.
>>>>>
>>>>> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
>>>>
>>>> <...>
>>>>
>>>>> diff --git a/lib/librte_bitratestats/rte_bitrate.c
>>>>> b/lib/librte_bitratestats/rte_bitrate.c
>>>>> index 639e47547..82d469514 100644
>>>>> --- a/lib/librte_bitratestats/rte_bitrate.c
>>>>> +++ b/lib/librte_bitratestats/rte_bitrate.c
>>>>> @@ -3,7 +3,7 @@
>>>>> */
>>>>>
>>>>> #include <rte_common.h>
>>>>> -#include <rte_ethdev.h>
>>>>> +#include <rte_ethdev_driver.h>
>>>>
>>>> This is in the library, not sure if libraries should include the
>>>> header file for the drivers, can you please explain why this change is
>> needed?
>>>>
>>> It is needed to make rte_eth_dev structure available. But yes, I agree that
>> it will be more appropriate to include rte_ethdev.h and rte_ethdev_core.h
>> separately. I probably wanted less includes, silly me.
>>>> <...>
>>>>
>>>>> @@ -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.c
>>>>> b/lib/librte_ethdev/rte_ethdev.c index 17d183e1f..5c6cc640a 100644
>>>>> --- a/lib/librte_ethdev/rte_ethdev.c
>>>>> +++ b/lib/librte_ethdev/rte_ethdev.c
>>>>> @@ -40,6 +40,7 @@
>>>>>
>>>>> #include "rte_ether.h"
>>>>> #include "rte_ethdev.h"
>>>>> +#include "rte_ethdev_core.h"
>>>>> #include "rte_ethdev_driver.h"
>>>>> #include "ethdev_profile.h"
>>>>> #include "ethdev_private.h"
>>>>
>>>> I was hoping "rte_ethdev_core.h" can be removed completely by
>>>> distributing its content to "ethdev_private.h", "rte_ethdev_driver.h"
>>>> and perhaps even to "rte_ethdev.h".
>>>>
>>>> Can you please explain what prevents removing "rte_ethdev_core.h"?
>>> I could rename it to rte_ethdev_private. There is just rte_eth_dev and
>> rte_eth_dev_data left in it.
>>>
>>
>> I think drivers access to both 'rte_eth_dev' and 'rte_eth_dev_data' so can't
>> move them to 'ethdev_private.h' why not move it to 'rte_ethdev_driver.h'?
>
> Because the libraries use them as well.
>
These are 'librte_ethdev' library internal data, I think other libraries
shouldn't access them directly.
As far as I can see,
librte_eventdev => rte_eth_dev_data
librte_eventdev => rte_eth_dev
librte_telemetry => rte_eth_dev
Can you see any other library accessing 'rte_eth_dev' and 'rte_eth_dev_data' ?
I am not sure about 'eventdev', specially because of the Rx/Tx adapters of it,
perhaps they can include the "rte_ethdev_driver.h", cc'ed Jerin.
I didn't check the telemetry code, but I assume it can be fixed too, but for now
"rte_ethdev_driver.h" can be included to highlight something is wrong there.
And related "ethdev_private.h", as far as I understand it is not private to all
libraries, it is private to the ethdev library, which means only should be used
to share the definitions withing ethdev library .c files. So no other library
should include it.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-09 10:24 ` Ferruh Yigit
@ 2019-09-09 11:41 ` Zapolski, MarcinX A
2019-09-14 10:34 ` Jerin Jacob
1 sibling, 0 replies; 33+ messages in thread
From: Zapolski, MarcinX A @ 2019-09-09 11:41 UTC (permalink / raw)
To: Yigit, Ferruh, dev; +Cc: Jerin Jacob, Laatz, Kevin
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Monday, September 9, 2019 12:24 PM
> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
> Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>; Laatz, Kevin
> <kevin.laatz@intel.com>
> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> structures from public API
>
> On 9/9/2019 11:02 AM, Zapolski, MarcinX A wrote:
> >> -----Original Message-----
> >> From: Yigit, Ferruh
> >> Sent: Monday, September 9, 2019 12:00 PM
> >> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
> >> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> >> structures from public API
> >>
> >> On 9/9/2019 9:07 AM, Zapolski, MarcinX A wrote:
> >>>> -----Original Message-----
> >>>> From: Yigit, Ferruh
> >>>> Sent: Friday, September 6, 2019 4:38 PM
> >>>> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>;
> >>>> dev@dpdk.org
> >>>> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> >>>> structures from public API
> >>>>
> >>>> On 9/6/2019 2:18 PM, Marcin Zapolski wrote:
> >>>>> Split rte_eth_dev structure to two parts: head that is available
> >>>>> for user applications, and rest which is DPDK internal.
> >>>>> Make an array of pointers to rte_eth_dev structures available for
> >>>>> user applications.
> >>>>>
> >>>>> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> >>>>
> >>>> <...>
> >>>>
> >>>>> diff --git a/lib/librte_bitratestats/rte_bitrate.c
> >>>>> b/lib/librte_bitratestats/rte_bitrate.c
> >>>>> index 639e47547..82d469514 100644
> >>>>> --- a/lib/librte_bitratestats/rte_bitrate.c
> >>>>> +++ b/lib/librte_bitratestats/rte_bitrate.c
> >>>>> @@ -3,7 +3,7 @@
> >>>>> */
> >>>>>
> >>>>> #include <rte_common.h>
> >>>>> -#include <rte_ethdev.h>
> >>>>> +#include <rte_ethdev_driver.h>
> >>>>
> >>>> This is in the library, not sure if libraries should include the
> >>>> header file for the drivers, can you please explain why this change
> >>>> is
> >> needed?
> >>>>
> >>> It is needed to make rte_eth_dev structure available. But yes, I
> >>> agree that
> >> it will be more appropriate to include rte_ethdev.h and
> >> rte_ethdev_core.h separately. I probably wanted less includes, silly me.
> >>>> <...>
> >>>>
> >>>>> @@ -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.c
> >>>>> b/lib/librte_ethdev/rte_ethdev.c index 17d183e1f..5c6cc640a 100644
> >>>>> --- a/lib/librte_ethdev/rte_ethdev.c
> >>>>> +++ b/lib/librte_ethdev/rte_ethdev.c
> >>>>> @@ -40,6 +40,7 @@
> >>>>>
> >>>>> #include "rte_ether.h"
> >>>>> #include "rte_ethdev.h"
> >>>>> +#include "rte_ethdev_core.h"
> >>>>> #include "rte_ethdev_driver.h"
> >>>>> #include "ethdev_profile.h"
> >>>>> #include "ethdev_private.h"
> >>>>
> >>>> I was hoping "rte_ethdev_core.h" can be removed completely by
> >>>> distributing its content to "ethdev_private.h", "rte_ethdev_driver.h"
> >>>> and perhaps even to "rte_ethdev.h".
> >>>>
> >>>> Can you please explain what prevents removing "rte_ethdev_core.h"?
> >>> I could rename it to rte_ethdev_private. There is just rte_eth_dev
> >>> and
> >> rte_eth_dev_data left in it.
> >>>
> >>
> >> I think drivers access to both 'rte_eth_dev' and 'rte_eth_dev_data'
> >> so can't move them to 'ethdev_private.h' why not move it to
> 'rte_ethdev_driver.h'?
> >
> > Because the libraries use them as well.
> >
>
> These are 'librte_ethdev' library internal data, I think other libraries shouldn't
> access them directly.
>
> As far as I can see,
> librte_eventdev => rte_eth_dev_data
> librte_eventdev => rte_eth_dev
> librte_telemetry => rte_eth_dev
>
> Can you see any other library accessing 'rte_eth_dev' and
> 'rte_eth_dev_data' ?
>
No, no others.
>
> I am not sure about 'eventdev', specially because of the Rx/Tx adapters of it,
> perhaps they can include the "rte_ethdev_driver.h", cc'ed Jerin.
>
> I didn't check the telemetry code, but I assume it can be fixed too, but for
> now "rte_ethdev_driver.h" can be included to highlight something is wrong
> there.
>
> And related "ethdev_private.h", as far as I understand it is not private to all
> libraries, it is private to the ethdev library, which means only should be used
> to share the definitions withing ethdev library .c files. So no other library
> should include it.
>
Agreed, will take it into account for v3.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures " Marcin Zapolski
2019-09-06 14:37 ` Ferruh Yigit
2019-09-06 17:24 ` Stephen Hemminger
@ 2019-09-10 9:59 ` Zapolski, MarcinX A
2019-09-10 10:06 ` Bruce Richardson
2 siblings, 1 reply; 33+ messages in thread
From: Zapolski, MarcinX A @ 2019-09-10 9:59 UTC (permalink / raw)
To: dev
<...>
> @@ -3994,7 +4054,55 @@ void *
> rte_eth_dev_get_sec_ctx(uint16_t port_id);
>
>
> -#include <rte_ethdev_core.h>
> +struct rte_eth_dev_callback;
> +/** Structure to keep track of registered callbacks */
> +TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
> +
> +/**
> + * Structure used to hold information about the callbacks to be called for a
> + * queue on RX and TX.
> + */
> +struct rte_eth_rxtx_callback {
> + struct rte_eth_rxtx_callback *next;
> + union{
> + rte_rx_callback_fn rx;
> + rte_tx_callback_fn tx;
> + } fn;
> + void *param;
> +};
> +
> +/**
> + * The generic data structure associated with each ethernet device.
> + *
> + * Pointers to burst-oriented packet receive and transmit functions are
> + * located at the beginning of the structure, along with the pointer to
> + * where all the data elements for the particular device are stored in shared
> + * memory. This split allows the function pointer and driver data to be per-
> + * process, while the actual configuration data for the device is shared.
> + */
I would like to raise one more concern (maybe not the smartest thing to do
involving my own patch, but I will sleep better when this is resolved).
Does anyone know what the author of this comment had in mind? I could not find
any code that utilizes this split, and this patch clearly breaks it. If it is
obsolete, I guess this comment could be removed.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-10 9:59 ` Zapolski, MarcinX A
@ 2019-09-10 10:06 ` Bruce Richardson
2019-09-10 10:13 ` Zapolski, MarcinX A
0 siblings, 1 reply; 33+ messages in thread
From: Bruce Richardson @ 2019-09-10 10:06 UTC (permalink / raw)
To: Zapolski, MarcinX A; +Cc: dev
On Tue, Sep 10, 2019 at 09:59:51AM +0000, Zapolski, MarcinX A wrote:
> <...>
> > @@ -3994,7 +4054,55 @@ void *
> > rte_eth_dev_get_sec_ctx(uint16_t port_id);
> >
> >
> > -#include <rte_ethdev_core.h>
> > +struct rte_eth_dev_callback;
> > +/** Structure to keep track of registered callbacks */
> > +TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
> > +
> > +/**
> > + * Structure used to hold information about the callbacks to be called for a
> > + * queue on RX and TX.
> > + */
> > +struct rte_eth_rxtx_callback {
> > + struct rte_eth_rxtx_callback *next;
> > + union{
> > + rte_rx_callback_fn rx;
> > + rte_tx_callback_fn tx;
> > + } fn;
> > + void *param;
> > +};
> > +
> > +/**
> > + * The generic data structure associated with each ethernet device.
> > + *
> > + * Pointers to burst-oriented packet receive and transmit functions are
> > + * located at the beginning of the structure, along with the pointer to
> > + * where all the data elements for the particular device are stored in shared
> > + * memory. This split allows the function pointer and driver data to be per-
> > + * process, while the actual configuration data for the device is shared.
> > + */
> I would like to raise one more concern (maybe not the smartest thing to do
> involving my own patch, but I will sleep better when this is resolved).
> Does anyone know what the author of this comment had in mind? I could not find
> any code that utilizes this split, and this patch clearly breaks it. If it is
> obsolete, I guess this comment could be removed.
As the comment suggest the split is for multi-process suport. The data
structures for the RX/TX queues etc. all need to be common across
processes, while the function pointers need to be per-process. Originally,
in very early versions of DPDK there was no rte_eth_dev_data structure, all
fields - both data and function pointers - were in rte_eth_dev itself.
/Bruce
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-10 10:06 ` Bruce Richardson
@ 2019-09-10 10:13 ` Zapolski, MarcinX A
2019-09-10 12:19 ` Bruce Richardson
0 siblings, 1 reply; 33+ messages in thread
From: Zapolski, MarcinX A @ 2019-09-10 10:13 UTC (permalink / raw)
To: Richardson, Bruce; +Cc: dev
> -----Original Message-----
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Tuesday, September 10, 2019 12:07 PM
> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> structures from public API
>
> On Tue, Sep 10, 2019 at 09:59:51AM +0000, Zapolski, MarcinX A wrote:
> > <...>
> > > @@ -3994,7 +4054,55 @@ void *
> > > rte_eth_dev_get_sec_ctx(uint16_t port_id);
> > >
> > >
> > > -#include <rte_ethdev_core.h>
> > > +struct rte_eth_dev_callback;
> > > +/** Structure to keep track of registered callbacks */
> > > +TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
> > > +
> > > +/**
> > > + * Structure used to hold information about the callbacks to be
> > > +called for a
> > > + * queue on RX and TX.
> > > + */
> > > +struct rte_eth_rxtx_callback {
> > > + struct rte_eth_rxtx_callback *next;
> > > + union{
> > > + rte_rx_callback_fn rx;
> > > + rte_tx_callback_fn tx;
> > > + } fn;
> > > + void *param;
> > > +};
> > > +
> > > +/**
> > > + * The generic data structure associated with each ethernet device.
> > > + *
> > > + * Pointers to burst-oriented packet receive and transmit functions
> > > +are
> > > + * located at the beginning of the structure, along with the
> > > +pointer to
> > > + * where all the data elements for the particular device are stored
> > > +in shared
> > > + * memory. This split allows the function pointer and driver data
> > > +to be per-
> > > + * process, while the actual configuration data for the device is shared.
> > > + */
> > I would like to raise one more concern (maybe not the smartest thing
> > to do involving my own patch, but I will sleep better when this is resolved).
> > Does anyone know what the author of this comment had in mind? I could
> > not find any code that utilizes this split, and this patch clearly
> > breaks it. If it is obsolete, I guess this comment could be removed.
>
> As the comment suggest the split is for multi-process suport. The data
> structures for the RX/TX queues etc. all need to be common across
> processes, while the function pointers need to be per-process. Originally, in
> very early versions of DPDK there was no rte_eth_dev_data structure, all
> fields - both data and function pointers - were in rte_eth_dev itself.
>
> /Bruce
Yes, I see the need to have the elements separated. But the comment suggests
that the order of variables in structure is important. I just want to make
sure that it is not.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-10 10:13 ` Zapolski, MarcinX A
@ 2019-09-10 12:19 ` Bruce Richardson
2019-09-10 12:22 ` Zapolski, MarcinX A
0 siblings, 1 reply; 33+ messages in thread
From: Bruce Richardson @ 2019-09-10 12:19 UTC (permalink / raw)
To: Zapolski, MarcinX A; +Cc: dev
On Tue, Sep 10, 2019 at 11:13:50AM +0100, Zapolski, MarcinX A wrote:
> > -----Original Message-----
> > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > Sent: Tuesday, September 10, 2019 12:07 PM
> > To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>
> > Cc: dev@dpdk.org
> > Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> > structures from public API
> >
> > On Tue, Sep 10, 2019 at 09:59:51AM +0000, Zapolski, MarcinX A wrote:
> > > <...>
> > > > @@ -3994,7 +4054,55 @@ void *
> > > > rte_eth_dev_get_sec_ctx(uint16_t port_id);
> > > >
> > > >
> > > > -#include <rte_ethdev_core.h>
> > > > +struct rte_eth_dev_callback;
> > > > +/** Structure to keep track of registered callbacks */
> > > > +TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
> > > > +
> > > > +/**
> > > > + * Structure used to hold information about the callbacks to be
> > > > +called for a
> > > > + * queue on RX and TX.
> > > > + */
> > > > +struct rte_eth_rxtx_callback {
> > > > + struct rte_eth_rxtx_callback *next;
> > > > + union{
> > > > + rte_rx_callback_fn rx;
> > > > + rte_tx_callback_fn tx;
> > > > + } fn;
> > > > + void *param;
> > > > +};
> > > > +
> > > > +/**
> > > > + * The generic data structure associated with each ethernet device.
> > > > + *
> > > > + * Pointers to burst-oriented packet receive and transmit functions
> > > > +are
> > > > + * located at the beginning of the structure, along with the
> > > > +pointer to
> > > > + * where all the data elements for the particular device are stored
> > > > +in shared
> > > > + * memory. This split allows the function pointer and driver data
> > > > +to be per-
> > > > + * process, while the actual configuration data for the device is shared.
> > > > + */
> > > I would like to raise one more concern (maybe not the smartest thing
> > > to do involving my own patch, but I will sleep better when this is resolved).
> > > Does anyone know what the author of this comment had in mind? I could
> > > not find any code that utilizes this split, and this patch clearly
> > > breaks it. If it is obsolete, I guess this comment could be removed.
> >
> > As the comment suggest the split is for multi-process suport. The data
> > structures for the RX/TX queues etc. all need to be common across
> > processes, while the function pointers need to be per-process. Originally, in
> > very early versions of DPDK there was no rte_eth_dev_data structure, all
> > fields - both data and function pointers - were in rte_eth_dev itself.
> >
> > /Bruce
>
> Yes, I see the need to have the elements separated. But the comment suggests
> that the order of variables in structure is important. I just want to make
> sure that it is not.
I don't believe it's particularly significant. The main thing was to ensure
that we kept the fast-path accessed data on the same cacheline.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-10 12:19 ` Bruce Richardson
@ 2019-09-10 12:22 ` Zapolski, MarcinX A
0 siblings, 0 replies; 33+ messages in thread
From: Zapolski, MarcinX A @ 2019-09-10 12:22 UTC (permalink / raw)
To: Richardson, Bruce; +Cc: dev
> -----Original Message-----
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Tuesday, September 10, 2019 2:20 PM
> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> structures from public API
>
> On Tue, Sep 10, 2019 at 11:13:50AM +0100, Zapolski, MarcinX A wrote:
> > > -----Original Message-----
> > > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > > Sent: Tuesday, September 10, 2019 12:07 PM
> > > To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>
> > > Cc: dev@dpdk.org
> > > Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> > > structures from public API
> > >
> > > On Tue, Sep 10, 2019 at 09:59:51AM +0000, Zapolski, MarcinX A wrote:
> > > > <...>
> > > > > @@ -3994,7 +4054,55 @@ void *
> > > > > rte_eth_dev_get_sec_ctx(uint16_t port_id);
> > > > >
> > > > >
> > > > > -#include <rte_ethdev_core.h>
> > > > > +struct rte_eth_dev_callback;
> > > > > +/** Structure to keep track of registered callbacks */
> > > > > +TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
> > > > > +
> > > > > +/**
> > > > > + * Structure used to hold information about the callbacks to be
> > > > > +called for a
> > > > > + * queue on RX and TX.
> > > > > + */
> > > > > +struct rte_eth_rxtx_callback {
> > > > > + struct rte_eth_rxtx_callback *next;
> > > > > + union{
> > > > > + rte_rx_callback_fn rx;
> > > > > + rte_tx_callback_fn tx;
> > > > > + } fn;
> > > > > + void *param;
> > > > > +};
> > > > > +
> > > > > +/**
> > > > > + * The generic data structure associated with each ethernet device.
> > > > > + *
> > > > > + * Pointers to burst-oriented packet receive and transmit
> > > > > +functions are
> > > > > + * located at the beginning of the structure, along with the
> > > > > +pointer to
> > > > > + * where all the data elements for the particular device are
> > > > > +stored in shared
> > > > > + * memory. This split allows the function pointer and driver
> > > > > +data to be per-
> > > > > + * process, while the actual configuration data for the device is
> shared.
> > > > > + */
> > > > I would like to raise one more concern (maybe not the smartest
> > > > thing to do involving my own patch, but I will sleep better when this is
> resolved).
> > > > Does anyone know what the author of this comment had in mind? I
> > > > could not find any code that utilizes this split, and this patch
> > > > clearly breaks it. If it is obsolete, I guess this comment could be
> removed.
> > >
> > > As the comment suggest the split is for multi-process suport. The
> > > data structures for the RX/TX queues etc. all need to be common
> > > across processes, while the function pointers need to be
> > > per-process. Originally, in very early versions of DPDK there was no
> > > rte_eth_dev_data structure, all fields - both data and function pointers -
> were in rte_eth_dev itself.
> > >
> > > /Bruce
> >
> > Yes, I see the need to have the elements separated. But the comment
> > suggests that the order of variables in structure is important. I just
> > want to make sure that it is not.
>
> I don't believe it's particularly significant. The main thing was to ensure that
> we kept the fast-path accessed data on the same cacheline.
Thank you for clarifying.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures from public API
2019-09-09 10:24 ` Ferruh Yigit
2019-09-09 11:41 ` Zapolski, MarcinX A
@ 2019-09-14 10:34 ` Jerin Jacob
1 sibling, 0 replies; 33+ messages in thread
From: Jerin Jacob @ 2019-09-14 10:34 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Zapolski, MarcinX A, dev, Jerin Jacob, Laatz, Kevin
On Mon, Sep 9, 2019 at 3:54 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 9/9/2019 11:02 AM, Zapolski, MarcinX A wrote:
> >> -----Original Message-----
> >> From: Yigit, Ferruh
> >> Sent: Monday, September 9, 2019 12:00 PM
> >> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
> >> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> >> structures from public API
> >>
> >> On 9/9/2019 9:07 AM, Zapolski, MarcinX A wrote:
> >>>> -----Original Message-----
> >>>> From: Yigit, Ferruh
> >>>> Sent: Friday, September 6, 2019 4:38 PM
> >>>> To: Zapolski, MarcinX A <marcinx.a.zapolski@intel.com>; dev@dpdk.org
> >>>> Subject: Re: [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev
> >>>> structures from public API
> >>>>
> >>>> On 9/6/2019 2:18 PM, Marcin Zapolski wrote:
> >>>>> Split rte_eth_dev structure to two parts: head that is available for
> >>>>> user applications, and rest which is DPDK internal.
> >>>>> Make an array of pointers to rte_eth_dev structures available for
> >>>>> user applications.
> >>>>>
> >>>>> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> >>>>
> >>>> <...>
> >>>>
> >>>>> diff --git a/lib/librte_bitratestats/rte_bitrate.c
> >>>>> b/lib/librte_bitratestats/rte_bitrate.c
> >>>>> index 639e47547..82d469514 100644
> >>>>> --- a/lib/librte_bitratestats/rte_bitrate.c
> >>>>> +++ b/lib/librte_bitratestats/rte_bitrate.c
> >>>>> @@ -3,7 +3,7 @@
> >>>>> */
> >>>>>
> >>>>> #include <rte_common.h>
> >>>>> -#include <rte_ethdev.h>
> >>>>> +#include <rte_ethdev_driver.h>
> >>>>
> >>>> This is in the library, not sure if libraries should include the
> >>>> header file for the drivers, can you please explain why this change is
> >> needed?
> >>>>
> >>> It is needed to make rte_eth_dev structure available. But yes, I agree that
> >> it will be more appropriate to include rte_ethdev.h and rte_ethdev_core.h
> >> separately. I probably wanted less includes, silly me.
> >>>> <...>
> >>>>
> >>>>> @@ -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.c
> >>>>> b/lib/librte_ethdev/rte_ethdev.c index 17d183e1f..5c6cc640a 100644
> >>>>> --- a/lib/librte_ethdev/rte_ethdev.c
> >>>>> +++ b/lib/librte_ethdev/rte_ethdev.c
> >>>>> @@ -40,6 +40,7 @@
> >>>>>
> >>>>> #include "rte_ether.h"
> >>>>> #include "rte_ethdev.h"
> >>>>> +#include "rte_ethdev_core.h"
> >>>>> #include "rte_ethdev_driver.h"
> >>>>> #include "ethdev_profile.h"
> >>>>> #include "ethdev_private.h"
> >>>>
> >>>> I was hoping "rte_ethdev_core.h" can be removed completely by
> >>>> distributing its content to "ethdev_private.h", "rte_ethdev_driver.h"
> >>>> and perhaps even to "rte_ethdev.h".
> >>>>
> >>>> Can you please explain what prevents removing "rte_ethdev_core.h"?
> >>> I could rename it to rte_ethdev_private. There is just rte_eth_dev and
> >> rte_eth_dev_data left in it.
> >>>
> >>
> >> I think drivers access to both 'rte_eth_dev' and 'rte_eth_dev_data' so can't
> >> move them to 'ethdev_private.h' why not move it to 'rte_ethdev_driver.h'?
> >
> > Because the libraries use them as well.
> >
>
> These are 'librte_ethdev' library internal data, I think other libraries
> shouldn't access them directly.
>
> As far as I can see,
> librte_eventdev => rte_eth_dev_data
> librte_eventdev => rte_eth_dev
> librte_telemetry => rte_eth_dev
>
> Can you see any other library accessing 'rte_eth_dev' and 'rte_eth_dev_data' ?
>
>
> I am not sure about 'eventdev', specially because of the Rx/Tx adapters of it,
> perhaps they can include the "rte_ethdev_driver.h", cc'ed Jerin.
Yes.
Overall this patch theme looks good to me. I will wait for v3 to
change PMDs I maintains.
My only comment is, We should make rte_ethdev_driver.h as private
i.e it should not be included by applications.
Currently. On dpdk install, the private header file is copied to prefix
ie
make install T=x86_64-native-linux-gcc DESTDIR=install
[master][dpdk.org] $ ls install/include/dpdk/rte_ethdev_driver.h
install/include/dpdk/rte_ethdev_driver.h
The internal libraries can access the header file through the
following scheme without exposing it as public.
CFLAGS += -I$(RTE_SDK)/lib/librte_ethdev/
in .c file
#include "ethdev_driver.h"
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
2019-07-30 15:45 [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline Jerin Jacob Kollanukkaran
@ 2019-07-30 16:05 ` Bruce Richardson
0 siblings, 0 replies; 33+ messages in thread
From: Bruce Richardson @ 2019-07-30 16:05 UTC (permalink / raw)
To: Jerin Jacob Kollanukkaran; +Cc: Marcin Zapolski, dev
On Tue, Jul 30, 2019 at 03:45:38PM +0000, Jerin Jacob Kollanukkaran wrote:
> > -----Original Message-----
> > From: Bruce Richardson <bruce.richardson@intel.com>
> > Sent: Tuesday, July 30, 2019 9:02 PM
> > To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> > Cc: Marcin Zapolski <marcinx.a.zapolski@intel.com>; dev@dpdk.org
> > Subject: [EXT] Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions
> > non-inline
> >
> > ----------------------------------------------------------------------
> > On Tue, Jul 30, 2019 at 03:01:00PM +0000, Jerin Jacob Kollanukkaran wrote:
> > > > -----Original Message----- From: dev <dev-bounces@dpdk.org> On
> > > > Behalf Of Marcin Zapolski Sent: Tuesday, July 30, 2019 6:20 PM To:
> > > > dev@dpdk.org Cc: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> > > > Subject: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions
> > > > non- inline
> > > >
> > > > 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.
> > >
> > > I tested on two class of arm64 machines(Highend and lowend) one has
> > > 1.4% drop And other one has 3.6% drop.
> > >
> > This is with testpmd only right? I'd just point out that we need to remember that
> > these numbers need to be scaled down appropriately for a realworld app where
> > IO is only a (hopefully small) proportion of the packet processing budget. For
> > example, I would expect the ~2% drop we saw in testpmd to correspond to
> > <0.5% drop in something like OVS.
>
> I see it as bit different view, Cycles saved infrastructure layer, cycles gained in
> application. So IMO it vary between end user application need what kind of
> machine it runs.
>
Sure. My thinking more is that to get ABI compatibility involves some
tradeoffs and spending one more cycle per-packet when an app workload is
typically hundreds of cycles, I believe, is a small cost worth paying.
> >
> > > I second to not expose internal data structure to avoid ABI break.
> > >
> > > IMO, This patch has performance issue due to it is fixing it in simple
> > > way.
> > >
> > > It is not worth two have function call overhead to call the driver
> > > function. Some thoughts below to reduce the performance impact
> > > without exposing internal structures.
> > >
> > The big concern I have with what you propose is that would involve changing
> > each and every ethdev driver in DPDK! I'd prefer to make sure that the impact of
> > this change is actually felt in real-world apps before we start looking to make
> > such updates across the DPDK codebase.
>
> I see those changes are NO BRAINER from driver POV. Once we add in one driver, individual
> PMD Maintainer can update easily. I think, we can do it once for all.
Ok, if it's doable in one go then sure. The issue is that if even one driver
is not updated we can't switch over, all have to effectively be done
simultaneously. [It would also make backporting fixes trickier, but I
wouldn't be concerned about that particularly.]
Have you tried out making the changes to a driver or two, to see how large
the delta is? [And to verify it doesn't affect performance]
> I am sure, you must aware of How hard is make 2% improvement in driver. I can spend time in
> This NO brainer to get 2% improvement back. I prefer later.
>
The other alternative I see is to leave the inline functions there, just
disabled by default, and put in a build-time option for reduced ABI
compatibility. That way the standard-built packages are all ABI compatible,
but for those who absolutely need max perf and are rolling-their-own-build
to get it can disable that ABI compatibility.
/Bruce
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline
@ 2019-07-30 15:45 Jerin Jacob Kollanukkaran
2019-07-30 16:05 ` Bruce Richardson
0 siblings, 1 reply; 33+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-07-30 15:45 UTC (permalink / raw)
To: Bruce Richardson; +Cc: Marcin Zapolski, dev
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Tuesday, July 30, 2019 9:02 PM
> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> Cc: Marcin Zapolski <marcinx.a.zapolski@intel.com>; dev@dpdk.org
> Subject: [EXT] Re: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions
> non-inline
>
> ----------------------------------------------------------------------
> On Tue, Jul 30, 2019 at 03:01:00PM +0000, Jerin Jacob Kollanukkaran wrote:
> > > -----Original Message----- From: dev <dev-bounces@dpdk.org> On
> > > Behalf Of Marcin Zapolski Sent: Tuesday, July 30, 2019 6:20 PM To:
> > > dev@dpdk.org Cc: Marcin Zapolski <marcinx.a.zapolski@intel.com>
> > > Subject: [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions
> > > non- inline
> > >
> > > 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.
> >
> > I tested on two class of arm64 machines(Highend and lowend) one has
> > 1.4% drop And other one has 3.6% drop.
> >
> This is with testpmd only right? I'd just point out that we need to remember that
> these numbers need to be scaled down appropriately for a realworld app where
> IO is only a (hopefully small) proportion of the packet processing budget. For
> example, I would expect the ~2% drop we saw in testpmd to correspond to
> <0.5% drop in something like OVS.
I see it as bit different view, Cycles saved infrastructure layer, cycles gained in
application. So IMO it vary between end user application need what kind of
machine it runs.
>
> > I second to not expose internal data structure to avoid ABI break.
> >
> > IMO, This patch has performance issue due to it is fixing it in simple
> > way.
> >
> > It is not worth two have function call overhead to call the driver
> > function. Some thoughts below to reduce the performance impact
> > without exposing internal structures.
> >
> The big concern I have with what you propose is that would involve changing
> each and every ethdev driver in DPDK! I'd prefer to make sure that the impact of
> this change is actually felt in real-world apps before we start looking to make
> such updates across the DPDK codebase.
I see those changes are NO BRAINER from driver POV. Once we add in one driver, individual
PMD Maintainer can update easily. I think, we can do it once for all.
I am sure, you must aware of How hard is make 2% improvement in driver. I can spend time in
This NO brainer to get 2% improvement back. I prefer later.
>
> > And I think, We need to follow the similar mechanism for cryptodev,
> > Eventdev, rawdev Etc so bring the common scheme to address this semantics
> will be use full.
> >
> Agreed.
>
> Regards,
> /Bruce
^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2019-09-14 10:34 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 12:49 [dpdk-dev] [RFC 19.11 0/2] Hide DPDK internal struct from public API Marcin Zapolski
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline Marcin Zapolski
2019-07-30 15:01 ` Jerin Jacob Kollanukkaran
2019-07-30 15:32 ` Bruce Richardson
2019-07-30 15:25 ` Stephen Hemminger
2019-07-30 15:33 ` Bruce Richardson
2019-07-30 15:54 ` Stephen Hemminger
2019-07-30 16:04 ` Wiles, Keith
2019-07-30 16:11 ` Bruce Richardson
2019-07-30 16:23 ` Stephen Hemminger
2019-07-30 12:49 ` [dpdk-dev] [RFC 19.11 2/2] ethdev: hide DPDK internal struct from public API Marcin Zapolski
2019-07-30 14:53 ` Ferruh Yigit
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 0/3] Hide " Marcin Zapolski
2019-09-06 14:00 ` Bruce Richardson
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 1/3] ethdev: hide key ethdev structures " Marcin Zapolski
2019-09-06 14:37 ` Ferruh Yigit
2019-09-09 8:07 ` Zapolski, MarcinX A
2019-09-09 9:59 ` Ferruh Yigit
2019-09-09 10:02 ` Zapolski, MarcinX A
2019-09-09 10:24 ` Ferruh Yigit
2019-09-09 11:41 ` Zapolski, MarcinX A
2019-09-14 10:34 ` Jerin Jacob
2019-09-06 17:24 ` Stephen Hemminger
2019-09-09 9:01 ` Zapolski, MarcinX A
2019-09-10 9:59 ` Zapolski, MarcinX A
2019-09-10 10:06 ` Bruce Richardson
2019-09-10 10:13 ` Zapolski, MarcinX A
2019-09-10 12:19 ` Bruce Richardson
2019-09-10 12:22 ` Zapolski, MarcinX A
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 2/3] i40e: make driver compatible with changes in ethdev Marcin Zapolski
2019-09-06 13:18 ` [dpdk-dev] [RFC 19.11 v2 3/3] ixgbe: " Marcin Zapolski
2019-07-30 15:45 [dpdk-dev] [RFC 19.11 1/2] ethdev: make DPDK core functions non-inline Jerin Jacob Kollanukkaran
2019-07-30 16:05 ` Bruce Richardson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).