* [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures
[not found] <0211007112750.25526-1-konstantin.ananyev@intel.com>
@ 2021-10-13 13:36 ` Konstantin Ananyev
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 1/6] ethdev: allocate max space for internal queue array Konstantin Ananyev
` (6 more replies)
0 siblings, 7 replies; 17+ messages in thread
From: Konstantin Ananyev @ 2021-10-13 13:36 UTC (permalink / raw)
To: dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
andrew.rybchenko, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, thomas, ferruh.yigit, mdr, jay.jayatheerthan,
Konstantin Ananyev
v6 changes:
- Update comments (Andrew)
- Move callback related variables under corresponding ifdefs (Andrew)
- Few nits in rte_eth_macaddrs_get (Andrew)
- Rebased on top of next-net tree
v5 changes:
- Fix spelling (Thomas/David)
- Rename internal helper functions (David)
- Reorder patches and update commit messages (Thomas)
- Update comments (Thomas)
- Changed layout in rte_eth_fp_ops, to group functions and
related data based on their functionality:
first 64B line for Rx, second one for Tx.
Didn't observe any real performance difference comparing to
original layout. Though decided to keep a new one, as it seems
a bit more plausible.
v4 changes:
- Fix secondary process attach (Pavan)
- Fix build failure (Ferruh)
- Update lib/ethdev/verion.map (Ferruh)
Note that moving newly added symbols from EXPERIMENTAL to DPDK_22
section makes checkpatch.sh to complain.
v3 changes:
- Changes in public struct naming (Jerin/Haiyue)
- Split patches
- Update docs
- Shamelessly included Andrew's patch:
https://patches.dpdk.org/project/dpdk/patch/20210928154856.1015020-1-andrew.rybchenko@oktetlabs.ru/
into these series.
I have to do similar thing here, so decided to avoid duplicated effort.
The aim of these patch series is to make rte_ethdev core data structures
(rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback, etc.) internal to
DPDK and not visible to the user.
That should allow future possible changes to core ethdev related structures
to be transparent to the user and help to improve ABI/API stability.
Note that current ethdev API is preserved, but it is a formal ABI break.
The work is based on previous discussions at:
https://www.mail-archive.com/dev@dpdk.org/msg211405.html
https://www.mail-archive.com/dev@dpdk.org/msg216685.html
and consists of the following main points:
1. Copy public 'fast' function pointers (rx_pkt_burst(), etc.) and
related data pointer from rte_eth_dev into a separate flat array.
We keep it public to still be able to use inline functions for these
'fast' calls (like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown.
Note that apart from function pointers itself, each element of this
flat array also contains two opaque pointers for each ethdev:
1) a pointer to an array of internal queue data pointers
2) points to array of queue callback data pointers.
Note that exposing this extra information allows us to avoid extra
changes inside PMD level, plus should help to avoid possible
performance degradation.
2. Change implementation of 'fast' inline ethdev functions
(rte_eth_rx_burst(), etc.) to use new public flat array.
While it is an ABI breakage, this change is intended to be transparent
for both users (no changes in user app is required) and PMD developers
(no changes in PMD is required).
One extra note - with new implementation RX/TX callback invocation
will cost one extra function call with this changes. That might cause
some slowdown for code-path with RX/TX callbacks heavily involved.
Hope such trade-off is acceptable for the community.
3. Move rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback and related
things into internal header: <ethdev_driver.h>.
That approach was selected to:
- Avoid(/minimize) possible performance losses.
- Minimize required changes inside PMDs.
Performance testing results (ICX 2.0GHz, E810 (ice)):
- testpmd macswap fwd mode, plus
a) no RX/TX callbacks:
no actual slowdown observed
b) bpf-load rx 0 0 JM ./dpdk.org/examples/bpf/t3.o:
~2% slowdown
- l3fwd: no actual slowdown observed
Would like to thank everyone who already reviewed and tested previous
versions of these series. All other interested parties please don't be shy
and provide your feedback.
Konstantin Ananyev (6):
ethdev: allocate max space for internal queue array
ethdev: change input parameters for rx_queue_count
ethdev: copy fast-path API into separate structure
ethdev: make fast-path functions to use new flat array
ethdev: add API to retrieve multiple ethernet addresses
ethdev: hide eth dev related structures
app/test-pmd/config.c | 23 +-
doc/guides/rel_notes/release_21_11.rst | 17 +
drivers/common/octeontx2/otx2_sec_idev.c | 2 +-
drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 2 +-
drivers/net/ark/ark_ethdev_rx.c | 4 +-
drivers/net/ark/ark_ethdev_rx.h | 3 +-
drivers/net/atlantic/atl_ethdev.h | 2 +-
drivers/net/atlantic/atl_rxtx.c | 9 +-
drivers/net/bnxt/bnxt_ethdev.c | 8 +-
drivers/net/cxgbe/base/adapter.h | 2 +-
drivers/net/dpaa/dpaa_ethdev.c | 9 +-
drivers/net/dpaa2/dpaa2_ethdev.c | 9 +-
drivers/net/dpaa2/dpaa2_ptp.c | 2 +-
drivers/net/e1000/e1000_ethdev.h | 6 +-
drivers/net/e1000/em_rxtx.c | 4 +-
drivers/net/e1000/igb_rxtx.c | 4 +-
drivers/net/enic/enic_ethdev.c | 12 +-
drivers/net/fm10k/fm10k.h | 2 +-
drivers/net/fm10k/fm10k_rxtx.c | 4 +-
drivers/net/hns3/hns3_rxtx.c | 7 +-
drivers/net/hns3/hns3_rxtx.h | 2 +-
drivers/net/i40e/i40e_rxtx.c | 4 +-
drivers/net/i40e/i40e_rxtx.h | 3 +-
drivers/net/iavf/iavf_rxtx.c | 4 +-
drivers/net/iavf/iavf_rxtx.h | 2 +-
drivers/net/ice/ice_rxtx.c | 4 +-
drivers/net/ice/ice_rxtx.h | 2 +-
drivers/net/igc/igc_txrx.c | 5 +-
drivers/net/igc/igc_txrx.h | 3 +-
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +-
drivers/net/ixgbe/ixgbe_rxtx.c | 4 +-
drivers/net/mlx5/mlx5_rx.c | 26 +-
drivers/net/mlx5/mlx5_rx.h | 2 +-
drivers/net/netvsc/hn_rxtx.c | 4 +-
drivers/net/netvsc/hn_var.h | 3 +-
drivers/net/nfp/nfp_rxtx.c | 4 +-
drivers/net/nfp/nfp_rxtx.h | 3 +-
drivers/net/octeontx2/otx2_ethdev.h | 2 +-
drivers/net/octeontx2/otx2_ethdev_ops.c | 8 +-
drivers/net/sfc/sfc_ethdev.c | 12 +-
drivers/net/thunderx/nicvf_ethdev.c | 3 +-
drivers/net/thunderx/nicvf_rxtx.c | 4 +-
drivers/net/thunderx/nicvf_rxtx.h | 2 +-
drivers/net/txgbe/txgbe_ethdev.h | 3 +-
drivers/net/txgbe/txgbe_rxtx.c | 4 +-
drivers/net/vhost/rte_eth_vhost.c | 4 +-
lib/ethdev/ethdev_driver.h | 154 +++++++++
lib/ethdev/ethdev_private.c | 83 +++++
lib/ethdev/ethdev_private.h | 7 +
lib/ethdev/rte_ethdev.c | 90 ++++--
lib/ethdev/rte_ethdev.h | 291 +++++++++++++-----
lib/ethdev/rte_ethdev_core.h | 177 +++--------
lib/ethdev/version.map | 6 +-
lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
lib/eventdev/rte_event_eth_tx_adapter.c | 2 +-
lib/eventdev/rte_eventdev.c | 2 +-
lib/metrics/rte_metrics_telemetry.c | 2 +-
57 files changed, 694 insertions(+), 373 deletions(-)
--
2.26.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v6 1/6] ethdev: allocate max space for internal queue array
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures Konstantin Ananyev
@ 2021-10-13 13:36 ` Konstantin Ananyev
2021-10-13 14:20 ` Andrew Rybchenko
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 2/6] ethdev: change input parameters for rx_queue_count Konstantin Ananyev
` (5 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Konstantin Ananyev @ 2021-10-13 13:36 UTC (permalink / raw)
To: dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
andrew.rybchenko, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, thomas, ferruh.yigit, mdr, jay.jayatheerthan,
Konstantin Ananyev
At queue configure stage always allocate space for maximum possible
number (RTE_MAX_QUEUES_PER_PORT) of queue pointers.
That will allow 'fast' inline functions (eth_rx_burst, etc.) to refer
pointer to internal queue data without extra checking of current number
of configured queues.
That would help in future to hide rte_eth_dev and related structures.
It means that from now on, each ethdev port will always consume:
((2*sizeof(uintptr_t))* RTE_MAX_QUEUES_PER_PORT)
bytes of memory for its queue pointers.
With RTE_MAX_QUEUES_PER_PORT==1024 (default value) it is 16KB per port.
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
lib/ethdev/rte_ethdev.c | 38 +++++---------------------------------
1 file changed, 5 insertions(+), 33 deletions(-)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 5fae7357c8..e446f3b3f8 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -919,12 +919,12 @@ static int
eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
{
uint16_t old_nb_queues = dev->data->nb_rx_queues;
- void **rxq;
unsigned i;
if (dev->data->rx_queues == NULL && nb_queues != 0) { /* first time configuration */
dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
- sizeof(dev->data->rx_queues[0]) * nb_queues,
+ sizeof(dev->data->rx_queues[0]) *
+ RTE_MAX_QUEUES_PER_PORT,
RTE_CACHE_LINE_SIZE);
if (dev->data->rx_queues == NULL) {
dev->data->nb_rx_queues = 0;
@@ -934,20 +934,6 @@ eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
for (i = nb_queues; i < old_nb_queues; i++)
eth_dev_rxq_release(dev, i);
- rxq = dev->data->rx_queues;
- rxq = rte_realloc(rxq, sizeof(rxq[0]) * nb_queues,
- RTE_CACHE_LINE_SIZE);
- if (rxq == NULL)
- return -(ENOMEM);
- if (nb_queues > old_nb_queues) {
- uint16_t new_qs = nb_queues - old_nb_queues;
-
- memset(rxq + old_nb_queues, 0,
- sizeof(rxq[0]) * new_qs);
- }
-
- dev->data->rx_queues = rxq;
-
} else if (dev->data->rx_queues != NULL && nb_queues == 0) {
for (i = nb_queues; i < old_nb_queues; i++)
eth_dev_rxq_release(dev, i);
@@ -1153,13 +1139,13 @@ static int
eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
{
uint16_t old_nb_queues = dev->data->nb_tx_queues;
- void **txq;
unsigned i;
if (dev->data->tx_queues == NULL && nb_queues != 0) { /* first time configuration */
dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
- sizeof(dev->data->tx_queues[0]) * nb_queues,
- RTE_CACHE_LINE_SIZE);
+ sizeof(dev->data->tx_queues[0]) *
+ RTE_MAX_QUEUES_PER_PORT,
+ RTE_CACHE_LINE_SIZE);
if (dev->data->tx_queues == NULL) {
dev->data->nb_tx_queues = 0;
return -(ENOMEM);
@@ -1168,20 +1154,6 @@ eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
for (i = nb_queues; i < old_nb_queues; i++)
eth_dev_txq_release(dev, i);
- txq = dev->data->tx_queues;
- txq = rte_realloc(txq, sizeof(txq[0]) * nb_queues,
- RTE_CACHE_LINE_SIZE);
- if (txq == NULL)
- return -ENOMEM;
- if (nb_queues > old_nb_queues) {
- uint16_t new_qs = nb_queues - old_nb_queues;
-
- memset(txq + old_nb_queues, 0,
- sizeof(txq[0]) * new_qs);
- }
-
- dev->data->tx_queues = txq;
-
} else if (dev->data->tx_queues != NULL && nb_queues == 0) {
for (i = nb_queues; i < old_nb_queues; i++)
eth_dev_txq_release(dev, i);
--
2.26.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v6 2/6] ethdev: change input parameters for rx_queue_count
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures Konstantin Ananyev
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 1/6] ethdev: allocate max space for internal queue array Konstantin Ananyev
@ 2021-10-13 13:37 ` Konstantin Ananyev
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 3/6] ethdev: copy fast-path API into separate structure Konstantin Ananyev
` (4 subsequent siblings)
6 siblings, 0 replies; 17+ messages in thread
From: Konstantin Ananyev @ 2021-10-13 13:37 UTC (permalink / raw)
To: dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
andrew.rybchenko, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, thomas, ferruh.yigit, mdr, jay.jayatheerthan,
Konstantin Ananyev
Currently majority of fast-path ethdev ops take pointers to internal
queue data structures as an input parameter.
While eth_rx_queue_count() takes a pointer to rte_eth_dev and queue
index.
For future work to hide rte_eth_devices[] and friends it would be
plausible to unify parameters list of all fast-path ethdev ops.
This patch changes eth_rx_queue_count() to accept pointer to internal
queue data as input parameter.
While this change is transparent to user, it still counts as an ABI change,
as eth_rx_queue_count_t is used by ethdev public inline function
rte_eth_rx_queue_count().
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
---
doc/guides/rel_notes/release_21_11.rst | 6 ++++++
drivers/net/ark/ark_ethdev_rx.c | 4 ++--
drivers/net/ark/ark_ethdev_rx.h | 3 +--
drivers/net/atlantic/atl_ethdev.h | 2 +-
drivers/net/atlantic/atl_rxtx.c | 9 ++-------
drivers/net/bnxt/bnxt_ethdev.c | 8 +++++---
drivers/net/dpaa/dpaa_ethdev.c | 9 ++++-----
drivers/net/dpaa2/dpaa2_ethdev.c | 9 ++++-----
drivers/net/e1000/e1000_ethdev.h | 6 ++----
drivers/net/e1000/em_rxtx.c | 4 ++--
drivers/net/e1000/igb_rxtx.c | 4 ++--
drivers/net/enic/enic_ethdev.c | 12 ++++++------
drivers/net/fm10k/fm10k.h | 2 +-
drivers/net/fm10k/fm10k_rxtx.c | 4 ++--
drivers/net/hns3/hns3_rxtx.c | 7 +++++--
drivers/net/hns3/hns3_rxtx.h | 2 +-
drivers/net/i40e/i40e_rxtx.c | 4 ++--
drivers/net/i40e/i40e_rxtx.h | 3 +--
drivers/net/iavf/iavf_rxtx.c | 4 ++--
drivers/net/iavf/iavf_rxtx.h | 2 +-
drivers/net/ice/ice_rxtx.c | 4 ++--
drivers/net/ice/ice_rxtx.h | 2 +-
drivers/net/igc/igc_txrx.c | 5 ++---
drivers/net/igc/igc_txrx.h | 3 +--
drivers/net/ixgbe/ixgbe_ethdev.h | 3 +--
drivers/net/ixgbe/ixgbe_rxtx.c | 4 ++--
drivers/net/mlx5/mlx5_rx.c | 26 ++++++++++++-------------
drivers/net/mlx5/mlx5_rx.h | 2 +-
drivers/net/netvsc/hn_rxtx.c | 4 ++--
drivers/net/netvsc/hn_var.h | 2 +-
drivers/net/nfp/nfp_rxtx.c | 4 ++--
drivers/net/nfp/nfp_rxtx.h | 3 +--
drivers/net/octeontx2/otx2_ethdev.h | 2 +-
drivers/net/octeontx2/otx2_ethdev_ops.c | 8 ++++----
drivers/net/sfc/sfc_ethdev.c | 12 ++++++------
drivers/net/thunderx/nicvf_ethdev.c | 3 +--
drivers/net/thunderx/nicvf_rxtx.c | 4 ++--
drivers/net/thunderx/nicvf_rxtx.h | 2 +-
drivers/net/txgbe/txgbe_ethdev.h | 3 +--
drivers/net/txgbe/txgbe_rxtx.c | 4 ++--
drivers/net/vhost/rte_eth_vhost.c | 4 ++--
lib/ethdev/rte_ethdev.h | 2 +-
lib/ethdev/rte_ethdev_core.h | 3 +--
43 files changed, 103 insertions(+), 110 deletions(-)
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index d5c762df62..bb884f5f32 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -299,6 +299,12 @@ ABI Changes
* bbdev: Added capability related to more comprehensive CRC options,
shifting values of the ``enum rte_bbdev_op_ldpcdec_flag_bitmasks``.
+* ethdev: Input parameters for ``eth_rx_queue_count_t`` was changed.
+ Instead of pointer to ``rte_eth_dev`` and queue index, now it accepts pointer
+ to internal queue data as input parameter. While this change is transparent
+ to user, it still counts as an ABI change, as ``eth_rx_queue_count_t``
+ is used by public inline function ``rte_eth_rx_queue_count``.
+
Known Issues
------------
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index d255f0177b..98658ce621 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -388,11 +388,11 @@ eth_ark_rx_queue_drain(struct ark_rx_queue *queue)
}
uint32_t
-eth_ark_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_id)
+eth_ark_dev_rx_queue_count(void *rx_queue)
{
struct ark_rx_queue *queue;
- queue = dev->data->rx_queues[queue_id];
+ queue = rx_queue;
return (queue->prod_index - queue->cons_index); /* mod arith */
}
diff --git a/drivers/net/ark/ark_ethdev_rx.h b/drivers/net/ark/ark_ethdev_rx.h
index c8dc340a8a..859fcf1e6f 100644
--- a/drivers/net/ark/ark_ethdev_rx.h
+++ b/drivers/net/ark/ark_ethdev_rx.h
@@ -17,8 +17,7 @@ int eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
unsigned int socket_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mp);
-uint32_t eth_ark_dev_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+uint32_t eth_ark_dev_rx_queue_count(void *rx_queue);
int eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t queue_id);
int eth_ark_rx_start_queue(struct rte_eth_dev *dev, uint16_t queue_id);
uint16_t eth_ark_recv_pkts_noop(void *rx_queue, struct rte_mbuf **rx_pkts,
diff --git a/drivers/net/atlantic/atl_ethdev.h b/drivers/net/atlantic/atl_ethdev.h
index a2d1d4397c..fbc9917ed3 100644
--- a/drivers/net/atlantic/atl_ethdev.h
+++ b/drivers/net/atlantic/atl_ethdev.h
@@ -66,7 +66,7 @@ int atl_tx_queue_setup(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);
-uint32_t atl_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+uint32_t atl_rx_queue_count(void *rx_queue);
int atl_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int atl_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
diff --git a/drivers/net/atlantic/atl_rxtx.c b/drivers/net/atlantic/atl_rxtx.c
index fca682d8b0..0d3460383a 100644
--- a/drivers/net/atlantic/atl_rxtx.c
+++ b/drivers/net/atlantic/atl_rxtx.c
@@ -689,18 +689,13 @@ atl_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
/* Return Rx queue avail count */
uint32_t
-atl_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+atl_rx_queue_count(void *rx_queue)
{
struct atl_rx_queue *rxq;
PMD_INIT_FUNC_TRACE();
- if (rx_queue_id >= dev->data->nb_rx_queues) {
- PMD_DRV_LOG(ERR, "Invalid RX queue id=%d", rx_queue_id);
- return 0;
- }
-
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
if (rxq == NULL)
return 0;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index a98f93ab29..ebda74d02f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3154,20 +3154,22 @@ bnxt_dev_led_off_op(struct rte_eth_dev *dev)
}
static uint32_t
-bnxt_rx_queue_count_op(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+bnxt_rx_queue_count_op(void *rx_queue)
{
- struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+ struct bnxt *bp;
struct bnxt_cp_ring_info *cpr;
uint32_t desc = 0, raw_cons, cp_ring_size;
struct bnxt_rx_queue *rxq;
struct rx_pkt_cmpl *rxcmp;
int rc;
+ rxq = rx_queue;
+ bp = rxq->bp;
+
rc = is_bnxt_in_error(bp);
if (rc)
return rc;
- rxq = dev->data->rx_queues[rx_queue_id];
cpr = rxq->cp_ring;
raw_cons = cpr->cp_raw_cons;
cp_ring_size = cpr->cp_ring_struct->ring_size;
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 59f4a93b3e..c087ce6341 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1267,17 +1267,16 @@ int dpaa_eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
}
static uint32_t
-dpaa_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+dpaa_dev_rx_queue_count(void *rx_queue)
{
- struct dpaa_if *dpaa_intf = dev->data->dev_private;
- struct qman_fq *rxq = &dpaa_intf->rx_queues[rx_queue_id];
+ struct qman_fq *rxq = rx_queue;
u32 frm_cnt = 0;
PMD_INIT_FUNC_TRACE();
if (qman_query_fq_frm_cnt(rxq, &frm_cnt) == 0) {
- DPAA_PMD_DEBUG("RX frame count for q(%d) is %u",
- rx_queue_id, frm_cnt);
+ DPAA_PMD_DEBUG("RX frame count for q(%p) is %u",
+ rx_queue, frm_cnt);
}
return frm_cnt;
}
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index ff8ae89922..f2519f0fad 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1007,10 +1007,9 @@ dpaa2_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t rx_queue_id)
}
static uint32_t
-dpaa2_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+dpaa2_dev_rx_queue_count(void *rx_queue)
{
int32_t ret;
- struct dpaa2_dev_priv *priv = dev->data->dev_private;
struct dpaa2_queue *dpaa2_q;
struct qbman_swp *swp;
struct qbman_fq_query_np_rslt state;
@@ -1027,12 +1026,12 @@ dpaa2_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
}
swp = DPAA2_PER_LCORE_PORTAL;
- dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[rx_queue_id];
+ dpaa2_q = rx_queue;
if (qbman_fq_query_state(swp, dpaa2_q->fqid, &state) == 0) {
frame_cnt = qbman_fq_state_frame_count(&state);
- DPAA2_PMD_DP_DEBUG("RX frame count for q(%d) is %u",
- rx_queue_id, frame_cnt);
+ DPAA2_PMD_DP_DEBUG("RX frame count for q(%p) is %u",
+ rx_queue, frame_cnt);
}
return frame_cnt;
}
diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index dafd586b12..050852be79 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -399,8 +399,7 @@ int eth_igb_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
-uint32_t eth_igb_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+uint32_t eth_igb_rx_queue_count(void *rx_queue);
int eth_igb_rx_descriptor_status(void *rx_queue, uint16_t offset);
int eth_igb_tx_descriptor_status(void *tx_queue, uint16_t offset);
@@ -474,8 +473,7 @@ int eth_em_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
-uint32_t eth_em_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+uint32_t eth_em_rx_queue_count(void *rx_queue);
int eth_em_rx_descriptor_status(void *rx_queue, uint16_t offset);
int eth_em_tx_descriptor_status(void *tx_queue, uint16_t offset);
diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c
index 9994703cc2..506b4159a2 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1495,14 +1495,14 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev,
}
uint32_t
-eth_em_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+eth_em_rx_queue_count(void *rx_queue)
{
#define EM_RXQ_SCAN_INTERVAL 4
volatile struct e1000_rx_desc *rxdp;
struct em_rx_queue *rxq;
uint32_t desc = 0;
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
rxdp = &(rxq->rx_ring[rxq->rx_tail]);
while ((desc < rxq->nb_rx_desc) &&
diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c
index 7b2a6b0490..e04c2b41ab 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -1776,14 +1776,14 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev,
}
uint32_t
-eth_igb_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+eth_igb_rx_queue_count(void *rx_queue)
{
#define IGB_RXQ_SCAN_INTERVAL 4
volatile union e1000_adv_rx_desc *rxdp;
struct igb_rx_queue *rxq;
uint32_t desc = 0;
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
rxdp = &(rxq->rx_ring[rxq->rx_tail]);
while ((desc < rxq->nb_rx_desc) &&
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index b03e56bc25..b94332cc86 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -237,18 +237,18 @@ static void enicpmd_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
enic_free_rq(rxq);
}
-static uint32_t enicpmd_dev_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id)
+static uint32_t enicpmd_dev_rx_queue_count(void *rx_queue)
{
- struct enic *enic = pmd_priv(dev);
+ struct enic *enic;
+ struct vnic_rq *sop_rq;
uint32_t queue_count = 0;
struct vnic_cq *cq;
uint32_t cq_tail;
uint16_t cq_idx;
- int rq_num;
- rq_num = enic_rte_rq_idx_to_sop_idx(rx_queue_id);
- cq = &enic->cq[enic_cq_rq(enic, rq_num)];
+ sop_rq = rx_queue;
+ enic = vnic_dev_priv(sop_rq->vdev);
+ cq = &enic->cq[enic_cq_rq(enic, sop_rq->index)];
cq_idx = cq->to_clean;
cq_tail = ioread32(&cq->ctrl->cq_tail);
diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index 2e47ada829..17c73c4dc5 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -324,7 +324,7 @@ uint16_t fm10k_recv_scattered_pkts(void *rx_queue,
struct rte_mbuf **rx_pkts, uint16_t nb_pkts);
uint32_t
-fm10k_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+fm10k_dev_rx_queue_count(void *rx_queue);
int
fm10k_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
diff --git a/drivers/net/fm10k/fm10k_rxtx.c b/drivers/net/fm10k/fm10k_rxtx.c
index d9833505d1..b3515ae96a 100644
--- a/drivers/net/fm10k/fm10k_rxtx.c
+++ b/drivers/net/fm10k/fm10k_rxtx.c
@@ -367,14 +367,14 @@ fm10k_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
}
uint32_t
-fm10k_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+fm10k_dev_rx_queue_count(void *rx_queue)
{
#define FM10K_RXQ_SCAN_INTERVAL 4
volatile union fm10k_rx_desc *rxdp;
struct fm10k_rx_queue *rxq;
uint16_t desc = 0;
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
rxdp = &rxq->hw_ring[rxq->next_dd];
while ((desc < rxq->nb_desc) &&
rxdp->w.status & rte_cpu_to_le_16(FM10K_RXD_STATUS_DD)) {
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 70de0d2b58..02040b84f3 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -4685,7 +4685,7 @@ hns3_dev_tx_descriptor_status(void *tx_queue, uint16_t offset)
}
uint32_t
-hns3_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+hns3_rx_queue_count(void *rx_queue)
{
/*
* Number of BDs that have been processed by the driver
@@ -4693,9 +4693,12 @@ hns3_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
*/
uint32_t driver_hold_bd_num;
struct hns3_rx_queue *rxq;
+ const struct rte_eth_dev *dev;
uint32_t fbd_num;
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
+ dev = &rte_eth_devices[rxq->port_id];
+
fbd_num = hns3_read_dev(rxq, HNS3_RING_RX_FBDNUM_REG);
if (dev->rx_pkt_burst == hns3_recv_pkts_vec ||
dev->rx_pkt_burst == hns3_recv_pkts_vec_sve)
diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h
index bb309d38ed..c8229e9076 100644
--- a/drivers/net/hns3/hns3_rxtx.h
+++ b/drivers/net/hns3/hns3_rxtx.h
@@ -696,7 +696,7 @@ int hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
struct rte_mempool *mp);
int hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc,
unsigned int socket, const struct rte_eth_txconf *conf);
-uint32_t hns3_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+uint32_t hns3_rx_queue_count(void *rx_queue);
int hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);
int hns3_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index ab77ec04b5..3df4e3de18 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2121,14 +2121,14 @@ i40e_rx_queue_release(void *rxq)
}
uint32_t
-i40e_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+i40e_dev_rx_queue_count(void *rx_queue)
{
#define I40E_RXQ_SCAN_INTERVAL 4
volatile union i40e_rx_desc *rxdp;
struct i40e_rx_queue *rxq;
uint16_t desc = 0;
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
rxdp = &(rxq->rx_ring[rxq->rx_tail]);
while ((desc < rxq->nb_rx_desc) &&
((rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len) &
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index 7a24dd6be5..2301e6301d 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -229,8 +229,7 @@ int i40e_tx_done_cleanup(void *txq, uint32_t free_cnt);
int i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq);
void i40e_rx_queue_release_mbufs(struct i40e_rx_queue *rxq);
-uint32_t i40e_dev_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+uint32_t i40e_dev_rx_queue_count(void *rx_queue);
int i40e_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int i40e_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 88661e5d74..88bbd40c10 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2799,14 +2799,14 @@ iavf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
/* Get the number of used descriptors of a rx queue */
uint32_t
-iavf_dev_rxq_count(struct rte_eth_dev *dev, uint16_t queue_id)
+iavf_dev_rxq_count(void *rx_queue)
{
#define IAVF_RXQ_SCAN_INTERVAL 4
volatile union iavf_rx_desc *rxdp;
struct iavf_rx_queue *rxq;
uint16_t desc = 0;
- rxq = dev->data->rx_queues[queue_id];
+ rxq = rx_queue;
rxdp = &rxq->rx_ring[rxq->rx_tail];
while ((desc < rxq->nb_rx_desc) &&
diff --git a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h
index 9591e45cb0..f4ae2fd6e1 100644
--- a/drivers/net/iavf/iavf_rxtx.h
+++ b/drivers/net/iavf/iavf_rxtx.h
@@ -453,7 +453,7 @@ void iavf_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
void iavf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_txq_info *qinfo);
-uint32_t iavf_dev_rxq_count(struct rte_eth_dev *dev, uint16_t queue_id);
+uint32_t iavf_dev_rxq_count(void *rx_queue);
int iavf_dev_rx_desc_status(void *rx_queue, uint16_t offset);
int iavf_dev_tx_desc_status(void *tx_queue, uint16_t offset);
diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c
index 7a2220daa4..b06c2f1438 100644
--- a/drivers/net/ice/ice_rxtx.c
+++ b/drivers/net/ice/ice_rxtx.c
@@ -1460,14 +1460,14 @@ ice_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
}
uint32_t
-ice_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+ice_rx_queue_count(void *rx_queue)
{
#define ICE_RXQ_SCAN_INTERVAL 4
volatile union ice_rx_flex_desc *rxdp;
struct ice_rx_queue *rxq;
uint16_t desc = 0;
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
rxdp = &rxq->rx_ring[rxq->rx_tail];
while ((desc < rxq->nb_rx_desc) &&
rte_le_to_cpu_16(rxdp->wb.status_error0) &
diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h
index c5ec6b7d1a..e1c644fb63 100644
--- a/drivers/net/ice/ice_rxtx.h
+++ b/drivers/net/ice/ice_rxtx.h
@@ -230,7 +230,7 @@ uint16_t ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,
void ice_set_tx_function_flag(struct rte_eth_dev *dev,
struct ice_tx_queue *txq);
void ice_set_tx_function(struct rte_eth_dev *dev);
-uint32_t ice_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+uint32_t ice_rx_queue_count(void *rx_queue);
void ice_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
void ice_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c
index a66ce1d2b7..383bf834f3 100644
--- a/drivers/net/igc/igc_txrx.c
+++ b/drivers/net/igc/igc_txrx.c
@@ -722,8 +722,7 @@ void eth_igc_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
igc_rx_queue_release(dev->data->rx_queues[qid]);
}
-uint32_t eth_igc_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id)
+uint32_t eth_igc_rx_queue_count(void *rx_queue)
{
/**
* Check the DD bit of a rx descriptor of each 4 in a group,
@@ -736,7 +735,7 @@ uint32_t eth_igc_rx_queue_count(struct rte_eth_dev *dev,
struct igc_rx_queue *rxq;
uint16_t desc = 0;
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
rxdp = &rxq->rx_ring[rxq->rx_tail];
while (desc < rxq->nb_rx_desc - rxq->rx_tail) {
diff --git a/drivers/net/igc/igc_txrx.h b/drivers/net/igc/igc_txrx.h
index bb040366f0..535108a868 100644
--- a/drivers/net/igc/igc_txrx.h
+++ b/drivers/net/igc/igc_txrx.h
@@ -22,8 +22,7 @@ int eth_igc_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
const struct rte_eth_rxconf *rx_conf,
struct rte_mempool *mb_pool);
-uint32_t eth_igc_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+uint32_t eth_igc_rx_queue_count(void *rx_queue);
int eth_igc_rx_descriptor_status(void *rx_queue, uint16_t offset);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index c01a74de89..950fb2d245 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -594,8 +594,7 @@ int ixgbe_dev_tx_queue_setup(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);
-uint32_t ixgbe_dev_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+uint32_t ixgbe_dev_rx_queue_count(void *rx_queue);
int ixgbe_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int ixgbe_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 0ac89cb711..4d3d30b662 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -3262,14 +3262,14 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
}
uint32_t
-ixgbe_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+ixgbe_dev_rx_queue_count(void *rx_queue)
{
#define IXGBE_RXQ_SCAN_INTERVAL 4
volatile union ixgbe_adv_rx_desc *rxdp;
struct ixgbe_rx_queue *rxq;
uint32_t desc = 0;
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
rxdp = &(rxq->rx_ring[rxq->rx_tail]);
while ((desc < rxq->nb_rx_desc) &&
diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
index e3b1051ba4..1a9eb35acc 100644
--- a/drivers/net/mlx5/mlx5_rx.c
+++ b/drivers/net/mlx5/mlx5_rx.c
@@ -240,32 +240,32 @@ mlx5_rx_burst_mode_get(struct rte_eth_dev *dev,
/**
* DPDK callback to get the number of used descriptors in a RX queue.
*
- * @param dev
- * Pointer to the device structure.
- *
- * @param rx_queue_id
- * The Rx queue.
+ * @param rx_queue
+ * The Rx queue pointer.
*
* @return
* The number of used rx descriptor.
* -EINVAL if the queue is invalid
*/
uint32_t
-mlx5_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+mlx5_rx_queue_count(void *rx_queue)
{
- struct mlx5_priv *priv = dev->data->dev_private;
- struct mlx5_rxq_data *rxq;
+ struct mlx5_rxq_data *rxq = rx_queue;
+ struct rte_eth_dev *dev;
+
+ if (!rxq) {
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+
+ dev = &rte_eth_devices[rxq->port_id];
if (dev->rx_pkt_burst == NULL ||
dev->rx_pkt_burst == removed_rx_burst) {
rte_errno = ENOTSUP;
return -rte_errno;
}
- rxq = (*priv->rxqs)[rx_queue_id];
- if (!rxq) {
- rte_errno = EINVAL;
- return -rte_errno;
- }
+
return rx_queue_count(rxq);
}
diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h
index 2b7ad3e48b..bdc48f3d9f 100644
--- a/drivers/net/mlx5/mlx5_rx.h
+++ b/drivers/net/mlx5/mlx5_rx.h
@@ -260,7 +260,7 @@ uint16_t mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts,
uint16_t removed_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts,
uint16_t pkts_n);
int mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset);
-uint32_t mlx5_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);
+uint32_t mlx5_rx_queue_count(void *rx_queue);
void mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
int mlx5_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index e880dc2bb2..f8fff1bcd1 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -1018,9 +1018,9 @@ hn_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid)
* For this device that means how many packets are pending in the ring.
*/
uint32_t
-hn_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_id)
+hn_dev_rx_queue_count(void *rx_queue)
{
- struct hn_rx_queue *rxq = dev->data->rx_queues[queue_id];
+ struct hn_rx_queue *rxq = rx_queue;
return rte_ring_count(rxq->rx_ring);
}
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index 2cd1f8a881..18703f99b9 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -215,7 +215,7 @@ int hn_dev_rx_queue_setup(struct rte_eth_dev *dev,
void hn_dev_rx_queue_info(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_rxq_info *qinfo);
void hn_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
-uint32_t hn_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_id);
+uint32_t hn_dev_rx_queue_count(void *rx_queue);
int hn_dev_rx_queue_status(void *rxq, uint16_t offset);
void hn_dev_free_queues(struct rte_eth_dev *dev);
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index feeacb5614..733f81e4b2 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -97,14 +97,14 @@ nfp_net_rx_freelist_setup(struct rte_eth_dev *dev)
}
uint32_t
-nfp_net_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx)
+nfp_net_rx_queue_count(void *rx_queue)
{
struct nfp_net_rxq *rxq;
struct nfp_net_rx_desc *rxds;
uint32_t idx;
uint32_t count;
- rxq = (struct nfp_net_rxq *)dev->data->rx_queues[queue_idx];
+ rxq = rx_queue;
idx = rxq->rd_p;
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index ab49898605..1a813ded15 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -275,8 +275,7 @@ struct nfp_net_rxq {
} __rte_aligned(64);
int nfp_net_rx_freelist_setup(struct rte_eth_dev *dev);
-uint32_t nfp_net_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t queue_idx);
+uint32_t nfp_net_rx_queue_count(void *rx_queue);
uint16_t nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts);
void nfp_net_rx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx);
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 0d73013433..7a8d19d541 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -431,7 +431,7 @@ int otx2_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_burst_mode *mode);
int otx2_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id,
struct rte_eth_burst_mode *mode);
-uint32_t otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t qidx);
+uint32_t otx2_nix_rx_queue_count(void *rx_queue);
int otx2_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
int otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset);
int otx2_nix_tx_descriptor_status(void *tx_queue, uint16_t offset);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index 5cb3905b64..3a763f691b 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -342,13 +342,13 @@ nix_rx_head_tail_get(struct otx2_eth_dev *dev,
}
uint32_t
-otx2_nix_rx_queue_count(struct rte_eth_dev *eth_dev, uint16_t queue_idx)
+otx2_nix_rx_queue_count(void *rx_queue)
{
- struct otx2_eth_rxq *rxq = eth_dev->data->rx_queues[queue_idx];
- struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+ struct otx2_eth_rxq *rxq = rx_queue;
+ struct otx2_eth_dev *dev = otx2_eth_pmd_priv(rxq->eth_dev);
uint32_t head, tail;
- nix_rx_head_tail_get(dev, &head, &tail, queue_idx);
+ nix_rx_head_tail_get(dev, &head, &tail, rxq->rq);
return (tail - head) % rxq->qlen;
}
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index c0d9810fbb..603af6242d 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -1356,19 +1356,19 @@ sfc_tx_queue_info_get(struct rte_eth_dev *dev, uint16_t ethdev_qid,
* use any process-local pointers from the adapter data.
*/
static uint32_t
-sfc_rx_queue_count(struct rte_eth_dev *dev, uint16_t ethdev_qid)
+sfc_rx_queue_count(void *rx_queue)
{
- const struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(dev);
- struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
- sfc_ethdev_qid_t sfc_ethdev_qid = ethdev_qid;
+ struct sfc_dp_rxq *dp_rxq = rx_queue;
+ const struct sfc_dp_rx *dp_rx;
struct sfc_rxq_info *rxq_info;
- rxq_info = sfc_rxq_info_by_ethdev_qid(sas, sfc_ethdev_qid);
+ dp_rx = sfc_dp_rx_by_dp_rxq(dp_rxq);
+ rxq_info = sfc_rxq_info_by_dp_rxq(dp_rxq);
if ((rxq_info->state & SFC_RXQ_STARTED) == 0)
return 0;
- return sap->dp_rx->qdesc_npending(rxq_info->dp);
+ return dp_rx->qdesc_npending(dp_rxq);
}
/*
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index 5502f1ee69..2103f96d5e 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -1060,8 +1060,7 @@ nicvf_rx_queue_release_mbufs(struct rte_eth_dev *dev, struct nicvf_rxq *rxq)
if (dev->rx_pkt_burst == NULL)
return;
- while ((rxq_cnt = nicvf_dev_rx_queue_count(dev,
- nicvf_netdev_qidx(rxq->nic, rxq->queue_id)))) {
+ while ((rxq_cnt = nicvf_dev_rx_queue_count(rxq))) {
nb_pkts = dev->rx_pkt_burst(rxq, rx_pkts,
NICVF_MAX_RX_FREE_THRESH);
PMD_DRV_LOG(INFO, "nb_pkts=%d rxq_cnt=%d", nb_pkts, rxq_cnt);
diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c
index 91e09ff8d5..0d4f4ae87e 100644
--- a/drivers/net/thunderx/nicvf_rxtx.c
+++ b/drivers/net/thunderx/nicvf_rxtx.c
@@ -649,11 +649,11 @@ nicvf_recv_pkts_multiseg_cksum_vlan_strip(void *rx_queue,
}
uint32_t
-nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx)
+nicvf_dev_rx_queue_count(void *rx_queue)
{
struct nicvf_rxq *rxq;
- rxq = dev->data->rx_queues[queue_idx];
+ rxq = rx_queue;
return nicvf_addr_read(rxq->cq_status) & NICVF_CQ_CQE_COUNT_MASK;
}
diff --git a/drivers/net/thunderx/nicvf_rxtx.h b/drivers/net/thunderx/nicvf_rxtx.h
index d6ed660b4e..271f329dc4 100644
--- a/drivers/net/thunderx/nicvf_rxtx.h
+++ b/drivers/net/thunderx/nicvf_rxtx.h
@@ -83,7 +83,7 @@ nicvf_mbuff_init_mseg_update(struct rte_mbuf *pkt, const uint64_t mbuf_init,
*(uint64_t *)(&pkt->rearm_data) = init.value;
}
-uint32_t nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx);
+uint32_t nicvf_dev_rx_queue_count(void *rx_queue);
uint32_t nicvf_dev_rbdr_refill(struct rte_eth_dev *dev, uint16_t queue_idx);
uint16_t nicvf_recv_pkts_no_offload(void *rxq, struct rte_mbuf **rx_pkts,
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index 112567eecc..528f11439b 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -438,8 +438,7 @@ int txgbe_dev_tx_queue_setup(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);
-uint32_t txgbe_dev_rx_queue_count(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+uint32_t txgbe_dev_rx_queue_count(void *rx_queue);
int txgbe_dev_rx_descriptor_status(void *rx_queue, uint16_t offset);
int txgbe_dev_tx_descriptor_status(void *tx_queue, uint16_t offset);
diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c
index b6339fe50b..4849fb385e 100644
--- a/drivers/net/txgbe/txgbe_rxtx.c
+++ b/drivers/net/txgbe/txgbe_rxtx.c
@@ -2688,14 +2688,14 @@ txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
}
uint32_t
-txgbe_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+txgbe_dev_rx_queue_count(void *rx_queue)
{
#define TXGBE_RXQ_SCAN_INTERVAL 4
volatile struct txgbe_rx_desc *rxdp;
struct txgbe_rx_queue *rxq;
uint32_t desc = 0;
- rxq = dev->data->rx_queues[rx_queue_id];
+ rxq = rx_queue;
rxdp = &rxq->rx_ring[rxq->rx_tail];
while ((desc < rxq->nb_rx_desc) &&
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 2e24e5f7ff..a7935a716d 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -1375,11 +1375,11 @@ eth_link_update(struct rte_eth_dev *dev __rte_unused,
}
static uint32_t
-eth_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+eth_rx_queue_count(void *rx_queue)
{
struct vhost_queue *vq;
- vq = dev->data->rx_queues[rx_queue_id];
+ vq = rx_queue;
if (vq == NULL)
return 0;
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index cb847a2c38..4007bd0e73 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -5040,7 +5040,7 @@ rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
dev->data->rx_queues[queue_id] == NULL)
return -EINVAL;
- return (int)(*dev->rx_queue_count)(dev, queue_id);
+ return (int)(*dev->rx_queue_count)(dev->data->rx_queues[queue_id]);
}
/**@{@name Rx hardware descriptor states
diff --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h
index 8aae713af6..af824ef890 100644
--- a/lib/ethdev/rte_ethdev_core.h
+++ b/lib/ethdev/rte_ethdev_core.h
@@ -41,8 +41,7 @@ typedef uint16_t (*eth_tx_prep_t)(void *txq,
/**< @internal Prepare output packets on a transmit queue of an Ethernet device. */
-typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
- uint16_t rx_queue_id);
+typedef uint32_t (*eth_rx_queue_count_t)(void *rxq);
/**< @internal Get number of used descriptors on a receive queue. */
typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
--
2.26.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v6 3/6] ethdev: copy fast-path API into separate structure
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures Konstantin Ananyev
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 1/6] ethdev: allocate max space for internal queue array Konstantin Ananyev
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 2/6] ethdev: change input parameters for rx_queue_count Konstantin Ananyev
@ 2021-10-13 13:37 ` Konstantin Ananyev
2021-10-13 14:25 ` Andrew Rybchenko
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 4/6] ethdev: make fast-path functions to use new flat array Konstantin Ananyev
` (3 subsequent siblings)
6 siblings, 1 reply; 17+ messages in thread
From: Konstantin Ananyev @ 2021-10-13 13:37 UTC (permalink / raw)
To: dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
andrew.rybchenko, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, thomas, ferruh.yigit, mdr, jay.jayatheerthan,
Konstantin Ananyev
Copy public function pointers (rx_pkt_burst(), etc.) and related
pointers to internal data from rte_eth_dev structure into a
separate flat array. That array will remain in a public header.
The intention here is to make rte_eth_dev and related structures internal.
That should allow future possible changes to core eth_dev structures
to be transparent to the user and help to avoid ABI/API breakages.
The plan is to keep minimal part of data from rte_eth_dev public,
so we still can use inline functions for fast-path calls
(like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown.
The whole idea beyond this new schema:
1. PMDs keep to setup fast-path function pointers and related data
inside rte_eth_dev struct in the same way they did it before.
2. Inside rte_eth_dev_start() and inside rte_eth_dev_probing_finish()
(for secondary process) we call eth_dev_fp_ops_setup, which
copies these function and data pointers into rte_eth_fp_ops[port_id].
3. Inside rte_eth_dev_stop() and inside rte_eth_dev_release_port()
we call eth_dev_fp_ops_reset(), which resets rte_eth_fp_ops[port_id]
into some dummy values.
4. fast-path ethdev API (rte_eth_rx_burst(), etc.) will use that new
flat array to call PMD specific functions.
That approach should allow us to make rte_eth_devices[] private
without introducing regression and help to avoid changes in drivers code.
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
lib/ethdev/ethdev_private.c | 52 +++++++++++++++++++++++++++++++
lib/ethdev/ethdev_private.h | 7 +++++
lib/ethdev/rte_ethdev.c | 27 +++++++++++++++++
lib/ethdev/rte_ethdev_core.h | 59 ++++++++++++++++++++++++++++++++++++
4 files changed, 145 insertions(+)
diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c
index 012cf73ca2..d810c3a1d4 100644
--- a/lib/ethdev/ethdev_private.c
+++ b/lib/ethdev/ethdev_private.c
@@ -174,3 +174,55 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
RTE_LOG(ERR, EAL, "wrong representor format: %s\n", str);
return str == NULL ? -1 : 0;
}
+
+static uint16_t
+dummy_eth_rx_burst(__rte_unused void *rxq,
+ __rte_unused struct rte_mbuf **rx_pkts,
+ __rte_unused uint16_t nb_pkts)
+{
+ RTE_ETHDEV_LOG(ERR, "rx_pkt_burst for not ready port\n");
+ rte_errno = ENOTSUP;
+ return 0;
+}
+
+static uint16_t
+dummy_eth_tx_burst(__rte_unused void *txq,
+ __rte_unused struct rte_mbuf **tx_pkts,
+ __rte_unused uint16_t nb_pkts)
+{
+ RTE_ETHDEV_LOG(ERR, "tx_pkt_burst for not ready port\n");
+ rte_errno = ENOTSUP;
+ return 0;
+}
+
+void
+eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo)
+{
+ static void *dummy_data[RTE_MAX_QUEUES_PER_PORT];
+ static const struct rte_eth_fp_ops dummy_ops = {
+ .rx_pkt_burst = dummy_eth_rx_burst,
+ .tx_pkt_burst = dummy_eth_tx_burst,
+ .rxq = {.data = dummy_data, .clbk = dummy_data,},
+ .txq = {.data = dummy_data, .clbk = dummy_data,},
+ };
+
+ *fpo = dummy_ops;
+}
+
+void
+eth_dev_fp_ops_setup(struct rte_eth_fp_ops *fpo,
+ const struct rte_eth_dev *dev)
+{
+ fpo->rx_pkt_burst = dev->rx_pkt_burst;
+ fpo->tx_pkt_burst = dev->tx_pkt_burst;
+ fpo->tx_pkt_prepare = dev->tx_pkt_prepare;
+ fpo->rx_queue_count = dev->rx_queue_count;
+ fpo->rx_descriptor_status = dev->rx_descriptor_status;
+ fpo->tx_descriptor_status = dev->tx_descriptor_status;
+
+ fpo->rxq.data = dev->data->rx_queues;
+ fpo->rxq.clbk = (void **)(uintptr_t)dev->post_rx_burst_cbs;
+
+ fpo->txq.data = dev->data->tx_queues;
+ fpo->txq.clbk = (void **)(uintptr_t)dev->pre_tx_burst_cbs;
+}
diff --git a/lib/ethdev/ethdev_private.h b/lib/ethdev/ethdev_private.h
index 3724429577..5721be7bdc 100644
--- a/lib/ethdev/ethdev_private.h
+++ b/lib/ethdev/ethdev_private.h
@@ -26,4 +26,11 @@ eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp,
/* Parse devargs value for representor parameter. */
int rte_eth_devargs_parse_representor_ports(char *str, void *data);
+/* reset eth fast-path API to dummy values */
+void eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo);
+
+/* setup eth fast-path API to ethdev values */
+void eth_dev_fp_ops_setup(struct rte_eth_fp_ops *fpo,
+ const struct rte_eth_dev *dev);
+
#endif /* _ETH_PRIVATE_H_ */
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index e446f3b3f8..178f5b88b7 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -44,6 +44,9 @@
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
+/* public fast-path API */
+struct rte_eth_fp_ops rte_eth_fp_ops[RTE_MAX_ETHPORTS];
+
/* spinlock for eth device callbacks */
static rte_spinlock_t eth_dev_cb_lock = RTE_SPINLOCK_INITIALIZER;
@@ -579,6 +582,8 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev)
rte_eth_dev_callback_process(eth_dev,
RTE_ETH_EVENT_DESTROY, NULL);
+ eth_dev_fp_ops_reset(rte_eth_fp_ops + eth_dev->data->port_id);
+
rte_spinlock_lock(ð_dev_shared_data->ownership_lock);
eth_dev->state = RTE_ETH_DEV_UNUSED;
@@ -1792,6 +1797,9 @@ rte_eth_dev_start(uint16_t port_id)
(*dev->dev_ops->link_update)(dev, 0);
}
+ /* expose selection of PMD fast-path functions */
+ eth_dev_fp_ops_setup(rte_eth_fp_ops + port_id, dev);
+
rte_ethdev_trace_start(port_id);
return 0;
}
@@ -1814,6 +1822,9 @@ rte_eth_dev_stop(uint16_t port_id)
return 0;
}
+ /* point fast-path functions to dummy ones */
+ eth_dev_fp_ops_reset(rte_eth_fp_ops + port_id);
+
dev->data->dev_started = 0;
ret = (*dev->dev_ops->dev_stop)(dev);
rte_ethdev_trace_stop(port_id, ret);
@@ -4477,6 +4488,14 @@ int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
queue_idx, tx_rate));
}
+RTE_INIT(eth_dev_init_fp_ops)
+{
+ uint32_t i;
+
+ for (i = 0; i != RTE_DIM(rte_eth_fp_ops); i++)
+ eth_dev_fp_ops_reset(rte_eth_fp_ops + i);
+}
+
RTE_INIT(eth_dev_init_cb_lists)
{
uint16_t i;
@@ -4645,6 +4664,14 @@ rte_eth_dev_probing_finish(struct rte_eth_dev *dev)
if (dev == NULL)
return;
+ /*
+ * for secondary process, at that point we expect device
+ * to be already 'usable', so shared data and all function pointers
+ * for fast-path devops have to be setup properly inside rte_eth_dev.
+ */
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+ eth_dev_fp_ops_setup(rte_eth_fp_ops + dev->data->port_id, dev);
+
rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_NEW, NULL);
dev->state = RTE_ETH_DEV_ATTACHED;
diff --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h
index af824ef890..df7168ca4b 100644
--- a/lib/ethdev/rte_ethdev_core.h
+++ b/lib/ethdev/rte_ethdev_core.h
@@ -50,6 +50,65 @@ typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset);
/**< @internal Check the status of a Tx descriptor */
+/**
+ * @internal
+ * Structure used to hold opaque pointers to internal ethdev Rx/Tx
+ * queues data.
+ * The main purpose to expose these pointers at all - allow compiler
+ * to fetch this data for fast-path ethdev inline functions in advance.
+ */
+struct rte_ethdev_qdata {
+ /** points to array of internal queue data pointers */
+ void **data;
+ /** points to array of queue callback data pointers */
+ void **clbk;
+};
+
+/**
+ * @internal
+ * fast-path ethdev functions and related data are hold in a flat array.
+ * One entry per ethdev.
+ * On 64-bit systems contents of this structure occupy exactly two 64B lines.
+ * On 32-bit systems contents of this structure fits into one 64B line.
+ */
+struct rte_eth_fp_ops {
+
+ /**@{*/
+ /**
+ * Rx fast-path functions and related data.
+ * 64-bit systems: occupies first 64B line
+ */
+ /** PMD receive function. */
+ eth_rx_burst_t rx_pkt_burst;
+ /** Get the number of used RX descriptors. */
+ eth_rx_queue_count_t rx_queue_count;
+ /** Check the status of a Rx descriptor. */
+ eth_rx_descriptor_status_t rx_descriptor_status;
+ /** Rx queues data. */
+ struct rte_ethdev_qdata rxq;
+ uintptr_t reserved1[3];
+ /**@}*/
+
+ /**@{*/
+ /**
+ * Tx fast-path functions and related data.
+ * 64-bit systems: occupies second 64B line
+ */
+ /** PMD transmit function. */
+ eth_tx_burst_t tx_pkt_burst;
+ /** PMD transmit prepare function. */
+ eth_tx_prep_t tx_pkt_prepare;
+ /** Check the status of a Tx descriptor. */
+ eth_tx_descriptor_status_t tx_descriptor_status;
+ /** Tx queues data. */
+ struct rte_ethdev_qdata txq;
+ uintptr_t reserved2[3];
+ /**@}*/
+
+} __rte_cache_aligned;
+
+extern struct rte_eth_fp_ops rte_eth_fp_ops[RTE_MAX_ETHPORTS];
+
/**
* @internal
--
2.26.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v6 4/6] ethdev: make fast-path functions to use new flat array
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures Konstantin Ananyev
` (2 preceding siblings ...)
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 3/6] ethdev: copy fast-path API into separate structure Konstantin Ananyev
@ 2021-10-13 13:37 ` Konstantin Ananyev
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 5/6] ethdev: add API to retrieve multiple ethernet addresses Konstantin Ananyev
` (2 subsequent siblings)
6 siblings, 0 replies; 17+ messages in thread
From: Konstantin Ananyev @ 2021-10-13 13:37 UTC (permalink / raw)
To: dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
andrew.rybchenko, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, thomas, ferruh.yigit, mdr, jay.jayatheerthan,
Konstantin Ananyev
Rework fast-path ethdev functions to use rte_eth_fp_ops[].
While it is an API/ABI breakage, this change is intended to be
transparent for both users (no changes in user app is required) and
PMD developers (no changes in PMD is required).
One extra thing to note - RX/TX callback invocation will cause extra
function call with these changes. That might cause some insignificant
slowdown for code-path where RX/TX callbacks are heavily involved.
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
lib/ethdev/ethdev_private.c | 31 +++++
lib/ethdev/rte_ethdev.h | 270 +++++++++++++++++++++++++-----------
lib/ethdev/version.map | 3 +
3 files changed, 226 insertions(+), 78 deletions(-)
diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c
index d810c3a1d4..c905c2df6f 100644
--- a/lib/ethdev/ethdev_private.c
+++ b/lib/ethdev/ethdev_private.c
@@ -226,3 +226,34 @@ eth_dev_fp_ops_setup(struct rte_eth_fp_ops *fpo,
fpo->txq.data = dev->data->tx_queues;
fpo->txq.clbk = (void **)(uintptr_t)dev->pre_tx_burst_cbs;
}
+
+uint16_t
+rte_eth_call_rx_callbacks(uint16_t port_id, uint16_t queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_rx, uint16_t nb_pkts,
+ void *opaque)
+{
+ const struct rte_eth_rxtx_callback *cb = opaque;
+
+ while (cb != NULL) {
+ nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
+ nb_pkts, cb->param);
+ cb = cb->next;
+ }
+
+ return nb_rx;
+}
+
+uint16_t
+rte_eth_call_tx_callbacks(uint16_t port_id, uint16_t queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts, void *opaque)
+{
+ const struct rte_eth_rxtx_callback *cb = opaque;
+
+ while (cb != NULL) {
+ nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts,
+ cb->param);
+ cb = cb->next;
+ }
+
+ return nb_pkts;
+}
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 4007bd0e73..f4c92b3b5e 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -4884,6 +4884,33 @@ int rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features);
#include <rte_ethdev_core.h>
+/**
+ * @internal
+ * Helper routine for rte_eth_rx_burst().
+ * Should be called at exit from PMD's rte_eth_rx_bulk implementation.
+ * Does necessary post-processing - invokes Rx callbacks if any, etc.
+ *
+ * @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.
+ * @param rx_pkts
+ * The address of an array of pointers to *rte_mbuf* structures that
+ * have been retrieved from the device.
+ * @param nb_rx
+ * The number of packets that were retrieved from the device.
+ * @param nb_pkts
+ * The number of elements in @p rx_pkts array.
+ * @param opaque
+ * Opaque pointer of Rx queue callback related data.
+ *
+ * @return
+ * The number of packets effectively supplied to the @p rx_pkts array.
+ */
+uint16_t rte_eth_call_rx_callbacks(uint16_t port_id, uint16_t queue_id,
+ struct rte_mbuf **rx_pkts, uint16_t nb_rx, uint16_t nb_pkts,
+ void *opaque);
+
/**
*
* Retrieve a burst of input packets from a receive queue of an Ethernet
@@ -4975,39 +5002,51 @@ 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];
uint16_t nb_rx;
+ struct rte_eth_fp_ops *p;
+ void *qd;
+
+#ifdef RTE_ETHDEV_DEBUG_RX
+ if (port_id >= RTE_MAX_ETHPORTS ||
+ queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+ RTE_ETHDEV_LOG(ERR,
+ "Invalid port_id=%u or queue_id=%u\n",
+ port_id, queue_id);
+ return 0;
+ }
+#endif
+
+ /* fetch pointer to queue data */
+ p = &rte_eth_fp_ops[port_id];
+ qd = p->rxq.data[queue_id];
#ifdef RTE_ETHDEV_DEBUG_RX
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);
+ if (qd == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u for port_id=%u\n",
+ queue_id, port_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
- struct rte_eth_rxtx_callback *cb;
+ nb_rx = p->rx_pkt_burst(qd, rx_pkts, nb_pkts);
- /* __ATOMIC_RELEASE memory order was used when the
- * call back was inserted into the list.
- * Since there is a clear dependency between loading
- * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
- * not required.
- */
- cb = __atomic_load_n(&dev->post_rx_burst_cbs[queue_id],
+#ifdef RTE_ETHDEV_RXTX_CALLBACKS
+ {
+ void *cb;
+
+ /* __ATOMIC_RELEASE memory order was used when the
+ * call back was inserted into the list.
+ * Since there is a clear dependency between loading
+ * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
+ * not required.
+ */
+ cb = __atomic_load_n((void **)&p->rxq.clbk[queue_id],
__ATOMIC_RELAXED);
-
- if (unlikely(cb != NULL)) {
- do {
- nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
- nb_pkts, cb->param);
- cb = cb->next;
- } while (cb != NULL);
+ if (unlikely(cb != NULL))
+ nb_rx = rte_eth_call_rx_callbacks(port_id, queue_id,
+ rx_pkts, nb_rx, nb_pkts, cb);
}
#endif
@@ -5031,16 +5070,27 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
static inline int
rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
{
- struct rte_eth_dev *dev;
+ struct rte_eth_fp_ops *p;
+ void *qd;
+
+ if (port_id >= RTE_MAX_ETHPORTS ||
+ queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+ RTE_ETHDEV_LOG(ERR,
+ "Invalid port_id=%u or queue_id=%u\n",
+ port_id, queue_id);
+ return -EINVAL;
+ }
+
+ /* fetch pointer to queue data */
+ p = &rte_eth_fp_ops[port_id];
+ qd = p->rxq.data[queue_id];
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
- dev = &rte_eth_devices[port_id];
- RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_queue_count, -ENOTSUP);
- if (queue_id >= dev->data->nb_rx_queues ||
- dev->data->rx_queues[queue_id] == NULL)
+ RTE_FUNC_PTR_OR_ERR_RET(*p->rx_queue_count, -ENOTSUP);
+ if (qd == NULL)
return -EINVAL;
- return (int)(*dev->rx_queue_count)(dev->data->rx_queues[queue_id]);
+ return (int)(*p->rx_queue_count)(qd);
}
/**@{@name Rx hardware descriptor states
@@ -5088,21 +5138,30 @@ static inline int
rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
uint16_t offset)
{
- struct rte_eth_dev *dev;
- void *rxq;
+ struct rte_eth_fp_ops *p;
+ void *qd;
#ifdef RTE_ETHDEV_DEBUG_RX
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ if (port_id >= RTE_MAX_ETHPORTS ||
+ queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+ RTE_ETHDEV_LOG(ERR,
+ "Invalid port_id=%u or queue_id=%u\n",
+ port_id, queue_id);
+ return -EINVAL;
+ }
#endif
- dev = &rte_eth_devices[port_id];
+
+ /* fetch pointer to queue data */
+ p = &rte_eth_fp_ops[port_id];
+ qd = p->rxq.data[queue_id];
+
#ifdef RTE_ETHDEV_DEBUG_RX
- if (queue_id >= dev->data->nb_rx_queues)
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ if (qd == NULL)
return -ENODEV;
#endif
- RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_descriptor_status, -ENOTSUP);
- rxq = dev->data->rx_queues[queue_id];
-
- return (*dev->rx_descriptor_status)(rxq, offset);
+ RTE_FUNC_PTR_OR_ERR_RET(*p->rx_descriptor_status, -ENOTSUP);
+ return (*p->rx_descriptor_status)(qd, offset);
}
/**@{@name Tx hardware descriptor states
@@ -5149,23 +5208,54 @@ rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
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;
+ struct rte_eth_fp_ops *p;
+ void *qd;
#ifdef RTE_ETHDEV_DEBUG_TX
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ if (port_id >= RTE_MAX_ETHPORTS ||
+ queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+ RTE_ETHDEV_LOG(ERR,
+ "Invalid port_id=%u or queue_id=%u\n",
+ port_id, queue_id);
+ return -EINVAL;
+ }
#endif
- dev = &rte_eth_devices[port_id];
+
+ /* fetch pointer to queue data */
+ p = &rte_eth_fp_ops[port_id];
+ qd = p->txq.data[queue_id];
+
#ifdef RTE_ETHDEV_DEBUG_TX
- if (queue_id >= dev->data->nb_tx_queues)
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ if (qd == NULL)
return -ENODEV;
#endif
- RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_descriptor_status, -ENOTSUP);
- txq = dev->data->tx_queues[queue_id];
-
- return (*dev->tx_descriptor_status)(txq, offset);
+ RTE_FUNC_PTR_OR_ERR_RET(*p->tx_descriptor_status, -ENOTSUP);
+ return (*p->tx_descriptor_status)(qd, offset);
}
+/**
+ * @internal
+ * Helper routine for rte_eth_tx_burst().
+ * Should be called before entry PMD's rte_eth_tx_bulk implementation.
+ * Does necessary pre-processing - invokes Tx callbacks if any, etc.
+ *
+ * @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.
+ * @param tx_pkts
+ * The address of an array of *nb_pkts* pointers to *rte_mbuf* structures
+ * which contain the output packets.
+ * @param nb_pkts
+ * The maximum number of packets to transmit.
+ * @return
+ * The number of output packets to transmit.
+ */
+uint16_t rte_eth_call_tx_callbacks(uint16_t port_id, uint16_t queue_id,
+ struct rte_mbuf **tx_pkts, uint16_t nb_pkts, void *opaque);
+
/**
* Send a burst of output packets on a transmit queue of an Ethernet device.
*
@@ -5236,42 +5326,55 @@ 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_fp_ops *p;
+ void *qd;
+
+#ifdef RTE_ETHDEV_DEBUG_TX
+ if (port_id >= RTE_MAX_ETHPORTS ||
+ queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+ RTE_ETHDEV_LOG(ERR,
+ "Invalid port_id=%u or queue_id=%u\n",
+ port_id, queue_id);
+ return 0;
+ }
+#endif
+
+ /* fetch pointer to queue data */
+ p = &rte_eth_fp_ops[port_id];
+ qd = p->txq.data[queue_id];
#ifdef RTE_ETHDEV_DEBUG_TX
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);
+ if (qd == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u for port_id=%u\n",
+ queue_id, port_id);
return 0;
}
#endif
#ifdef RTE_ETHDEV_RXTX_CALLBACKS
- struct rte_eth_rxtx_callback *cb;
-
- /* __ATOMIC_RELEASE memory order was used when the
- * call back was inserted into the list.
- * Since there is a clear dependency between loading
- * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
- * not required.
- */
- cb = __atomic_load_n(&dev->pre_tx_burst_cbs[queue_id],
+ {
+ void *cb;
+
+ /* __ATOMIC_RELEASE memory order was used when the
+ * call back was inserted into the list.
+ * Since there is a clear dependency between loading
+ * cb and cb->fn/cb->next, __ATOMIC_ACQUIRE memory order is
+ * not required.
+ */
+ cb = __atomic_load_n((void **)&p->txq.clbk[queue_id],
__ATOMIC_RELAXED);
-
- 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);
+ if (unlikely(cb != NULL))
+ nb_pkts = rte_eth_call_tx_callbacks(port_id, queue_id,
+ tx_pkts, nb_pkts, cb);
}
#endif
- rte_ethdev_trace_tx_burst(port_id, queue_id, (void **)tx_pkts,
- nb_pkts);
- return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
+ nb_pkts = p->tx_pkt_burst(qd, tx_pkts, nb_pkts);
+
+ rte_ethdev_trace_tx_burst(port_id, queue_id, (void **)tx_pkts, nb_pkts);
+ return nb_pkts;
}
/**
@@ -5334,31 +5437,42 @@ 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_fp_ops *p;
+ void *qd;
#ifdef RTE_ETHDEV_DEBUG_TX
- if (!rte_eth_dev_is_valid_port(port_id)) {
- RTE_ETHDEV_LOG(ERR, "Invalid TX port_id=%u\n", port_id);
+ if (port_id >= RTE_MAX_ETHPORTS ||
+ queue_id >= RTE_MAX_QUEUES_PER_PORT) {
+ RTE_ETHDEV_LOG(ERR,
+ "Invalid port_id=%u or queue_id=%u\n",
+ port_id, queue_id);
rte_errno = ENODEV;
return 0;
}
#endif
- dev = &rte_eth_devices[port_id];
+ /* fetch pointer to queue data */
+ p = &rte_eth_fp_ops[port_id];
+ qd = p->txq.data[queue_id];
#ifdef RTE_ETHDEV_DEBUG_TX
- if (queue_id >= dev->data->nb_tx_queues) {
- RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id);
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ RTE_ETHDEV_LOG(ERR, "Invalid TX port_id=%u\n", port_id);
+ rte_errno = ENODEV;
+ return 0;
+ }
+ if (qd == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u for port_id=%u\n",
+ queue_id, port_id);
rte_errno = EINVAL;
return 0;
}
#endif
- if (!dev->tx_pkt_prepare)
+ if (!p->tx_pkt_prepare)
return nb_pkts;
- return (*dev->tx_pkt_prepare)(dev->data->tx_queues[queue_id],
- tx_pkts, nb_pkts);
+ return p->tx_pkt_prepare(qd, tx_pkts, nb_pkts);
}
#else
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 29fb71f1af..61011b110a 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -7,6 +7,8 @@ DPDK_22 {
rte_eth_allmulticast_disable;
rte_eth_allmulticast_enable;
rte_eth_allmulticast_get;
+ rte_eth_call_rx_callbacks;
+ rte_eth_call_tx_callbacks;
rte_eth_dev_adjust_nb_rx_tx_desc;
rte_eth_dev_callback_register;
rte_eth_dev_callback_unregister;
@@ -76,6 +78,7 @@ DPDK_22 {
rte_eth_find_next_of;
rte_eth_find_next_owned_by;
rte_eth_find_next_sibling;
+ rte_eth_fp_ops;
rte_eth_iterator_cleanup;
rte_eth_iterator_init;
rte_eth_iterator_next;
--
2.26.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v6 5/6] ethdev: add API to retrieve multiple ethernet addresses
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures Konstantin Ananyev
` (3 preceding siblings ...)
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 4/6] ethdev: make fast-path functions to use new flat array Konstantin Ananyev
@ 2021-10-13 13:37 ` Konstantin Ananyev
2021-10-13 14:31 ` Andrew Rybchenko
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 6/6] ethdev: hide eth dev related structures Konstantin Ananyev
2021-10-13 20:16 ` [dpdk-dev] [PATCH v6 0/6] " Ferruh Yigit
6 siblings, 1 reply; 17+ messages in thread
From: Konstantin Ananyev @ 2021-10-13 13:37 UTC (permalink / raw)
To: dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
andrew.rybchenko, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, thomas, ferruh.yigit, mdr, jay.jayatheerthan,
Konstantin Ananyev
Introduce rte_eth_macaddrs_get() to allow user to retrieve all ethernet
addresses assigned to given port.
Change testpmd to use this new function and avoid referencing directly
rte_eth_devices[].
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
app/test-pmd/config.c | 23 +++++++++++------------
doc/guides/rel_notes/release_21_11.rst | 5 +++++
lib/ethdev/rte_ethdev.c | 25 +++++++++++++++++++++++++
lib/ethdev/rte_ethdev.h | 21 +++++++++++++++++++++
lib/ethdev/version.map | 1 +
5 files changed, 63 insertions(+), 12 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 9c66329e96..7221644230 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -5215,20 +5215,20 @@ show_macs(portid_t port_id)
{
char buf[RTE_ETHER_ADDR_FMT_SIZE];
struct rte_eth_dev_info dev_info;
- struct rte_ether_addr *addr;
- uint32_t i, num_macs = 0;
- struct rte_eth_dev *dev;
-
- dev = &rte_eth_devices[port_id];
+ int32_t i, rc, num_macs = 0;
if (eth_dev_info_get_print_err(port_id, &dev_info))
return;
- for (i = 0; i < dev_info.max_mac_addrs; i++) {
- addr = &dev->data->mac_addrs[i];
+ struct rte_ether_addr addr[dev_info.max_mac_addrs];
+ rc = rte_eth_macaddrs_get(port_id, addr, dev_info.max_mac_addrs);
+ if (rc < 0)
+ return;
+
+ for (i = 0; i < rc; i++) {
/* skip zero address */
- if (rte_is_zero_ether_addr(addr))
+ if (rte_is_zero_ether_addr(&addr[i]))
continue;
num_macs++;
@@ -5236,14 +5236,13 @@ show_macs(portid_t port_id)
printf("Number of MAC address added: %d\n", num_macs);
- for (i = 0; i < dev_info.max_mac_addrs; i++) {
- addr = &dev->data->mac_addrs[i];
+ for (i = 0; i < rc; i++) {
/* skip zero address */
- if (rte_is_zero_ether_addr(addr))
+ if (rte_is_zero_ether_addr(&addr[i]))
continue;
- rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, addr);
+ rte_ether_format_addr(buf, RTE_ETHER_ADDR_FMT_SIZE, &addr[i]);
printf(" %s\n", buf);
}
}
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index bb884f5f32..d44c1696cd 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -177,6 +177,11 @@ New Features
* Added tests to verify tunnel header verification in IPsec inbound.
* Added tests to verify inner checksum.
+* **Add new function into ethdev lib.**
+
+ * Added ``rte_eth_macaddrs_get`` to allow user to retrieve all Ethernet
+ addresses assigned to given ethernet port.
+
Removed Items
-------------
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 178f5b88b7..d3f7689ca6 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -3544,6 +3544,31 @@ rte_eth_dev_set_ptypes(uint16_t port_id, uint32_t ptype_mask,
return ret;
}
+int
+rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
+ unsigned int num)
+{
+ int32_t ret;
+ struct rte_eth_dev *dev;
+ struct rte_eth_dev_info dev_info;
+
+ if (ma == NULL) {
+ RTE_ETHDEV_LOG(ERR, "%s: invalid parameters\n", __func__);
+ return -EINVAL;
+ }
+
+ /* will check for us that port_id is a valid one */
+ ret = rte_eth_dev_info_get(port_id, &dev_info);
+ if (ret != 0)
+ return ret;
+
+ dev = &rte_eth_devices[port_id];
+ num = RTE_MIN(dev_info.max_mac_addrs, num);
+ memcpy(ma, dev->data->mac_addrs, num * sizeof(ma[0]));
+
+ return num;
+}
+
int
rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr)
{
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index f4c92b3b5e..dbc14f4a23 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3007,6 +3007,27 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
*/
int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);
+/**
+ * Retrieve the Ethernet addresses of an Ethernet device.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param ma
+ * A pointer to an array of structures of type *ether_addr* to be filled with
+ * the Ethernet addresses of the Ethernet device.
+ * @param num
+ * Number of elements in the @p ma array.
+ * Note that rte_eth_dev_info::max_mac_addrs can be used to retrieve
+ * max number of Ethernet addresses for given port.
+ * @return
+ * - number of retrieved addresses if successful
+ * - (-ENODEV) if *port_id* invalid.
+ * - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
+ unsigned int num);
+
/**
* Retrieve the contextual information of an Ethernet device.
*
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index 61011b110a..ca81f5d237 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -250,6 +250,7 @@ EXPERIMENTAL {
rte_mtr_meter_policy_validate;
# added in 21.11
+ rte_eth_macaddrs_get;
rte_eth_rx_metadata_negotiate;
};
--
2.26.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] [PATCH v6 6/6] ethdev: hide eth dev related structures
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures Konstantin Ananyev
` (4 preceding siblings ...)
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 5/6] ethdev: add API to retrieve multiple ethernet addresses Konstantin Ananyev
@ 2021-10-13 13:37 ` Konstantin Ananyev
2021-10-13 14:32 ` Andrew Rybchenko
2021-10-13 20:16 ` [dpdk-dev] [PATCH v6 0/6] " Ferruh Yigit
6 siblings, 1 reply; 17+ messages in thread
From: Konstantin Ananyev @ 2021-10-13 13:37 UTC (permalink / raw)
To: dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
andrew.rybchenko, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, thomas, ferruh.yigit, mdr, jay.jayatheerthan,
Konstantin Ananyev
Move rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback and related
data into private header (ethdev_driver.h).
Few minor changes to keep DPDK building after that.
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
doc/guides/rel_notes/release_21_11.rst | 6 +
drivers/common/octeontx2/otx2_sec_idev.c | 2 +-
drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 2 +-
drivers/net/cxgbe/base/adapter.h | 2 +-
drivers/net/dpaa2/dpaa2_ptp.c | 2 +-
drivers/net/netvsc/hn_var.h | 1 +
lib/ethdev/ethdev_driver.h | 154 ++++++++++++++++++
lib/ethdev/rte_ethdev_core.h | 149 -----------------
lib/ethdev/version.map | 2 +-
lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
lib/eventdev/rte_event_eth_tx_adapter.c | 2 +-
lib/eventdev/rte_eventdev.c | 2 +-
lib/metrics/rte_metrics_telemetry.c | 2 +-
13 files changed, 170 insertions(+), 158 deletions(-)
diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst
index d44c1696cd..626448988d 100644
--- a/doc/guides/rel_notes/release_21_11.rst
+++ b/doc/guides/rel_notes/release_21_11.rst
@@ -310,6 +310,12 @@ ABI Changes
to user, it still counts as an ABI change, as ``eth_rx_queue_count_t``
is used by public inline function ``rte_eth_rx_queue_count``.
+* ethdev: Made ``rte_eth_dev``, ``rte_eth_dev_data``, ``rte_eth_rxtx_callback``
+ private data structures. ``rte_eth_devices[]`` can't be accessed directly
+ by user any more. While it is an ABI breakage, this change is intended
+ to be transparent for both users (no changes in user app is required) and
+ PMD developers (no changes in PMD is required).
+
Known Issues
------------
diff --git a/drivers/common/octeontx2/otx2_sec_idev.c b/drivers/common/octeontx2/otx2_sec_idev.c
index 6e9643c383..b561b67174 100644
--- a/drivers/common/octeontx2/otx2_sec_idev.c
+++ b/drivers/common/octeontx2/otx2_sec_idev.c
@@ -4,7 +4,7 @@
#include <rte_atomic.h>
#include <rte_bus_pci.h>
-#include <rte_ethdev.h>
+#include <ethdev_driver.h>
#include <rte_spinlock.h>
#include "otx2_common.h"
diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
index 37fad11d91..f0b72e05c2 100644
--- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
+++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c
@@ -6,7 +6,7 @@
#include <cryptodev_pmd.h>
#include <rte_errno.h>
-#include <rte_ethdev.h>
+#include <ethdev_driver.h>
#include <rte_event_crypto_adapter.h>
#include "otx2_cryptodev.h"
diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h
index 01a2a9d147..1c7c8afe16 100644
--- a/drivers/net/cxgbe/base/adapter.h
+++ b/drivers/net/cxgbe/base/adapter.h
@@ -12,7 +12,7 @@
#include <rte_mbuf.h>
#include <rte_io.h>
#include <rte_rwlock.h>
-#include <rte_ethdev.h>
+#include <ethdev_driver.h>
#include "../cxgbe_compat.h"
#include "../cxgbe_ofld.h"
diff --git a/drivers/net/dpaa2/dpaa2_ptp.c b/drivers/net/dpaa2/dpaa2_ptp.c
index 899dd5d442..8d79e39244 100644
--- a/drivers/net/dpaa2/dpaa2_ptp.c
+++ b/drivers/net/dpaa2/dpaa2_ptp.c
@@ -10,7 +10,7 @@
#include <unistd.h>
#include <stdarg.h>
-#include <rte_ethdev.h>
+#include <ethdev_driver.h>
#include <rte_log.h>
#include <rte_eth_ctrl.h>
#include <rte_malloc.h>
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index 18703f99b9..fbb3995507 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -7,6 +7,7 @@
*/
#include <rte_eal_paging.h>
+#include <ethdev_driver.h>
/*
* Tunable ethdev params
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 56db53df1a..0174ba03d7 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -17,6 +17,160 @@
#include <rte_ethdev.h>
+/**
+ * @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.
+ *
+ * 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 {
+ 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. */
+ eth_rx_queue_count_t rx_queue_count;
+ /**< Get the number of used RX descriptors. */
+ 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. */
+
+ /**
+ * points to device data that is shared between
+ * primary and secondary processes.
+ */
+ struct rte_eth_dev_data *data;
+ void *process_private; /**< Pointer to per-process device data. */
+ 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 */
+
+ uint64_t reserved_64s[4]; /**< Reserved for future fields */
+ void *reserved_ptrs[4]; /**< Reserved for future fields */
+} __rte_cache_aligned;
+
+struct rte_eth_dev_sriov;
+struct rte_eth_dev_owner;
+
+/**
+ * @internal
+ * The data part, with no function pointers, associated with each ethernet
+ * device. This structure is safe to place in shared memory to be common
+ * among different processes in a multi-process configuration.
+ */
+struct rte_eth_dev_data {
+ char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
+
+ void **rx_queues; /**< Array of pointers to RX queues. */
+ void **tx_queues; /**< Array of pointers to TX queues. */
+ uint16_t nb_rx_queues; /**< Number of RX queues. */
+ uint16_t nb_tx_queues; /**< Number of TX queues. */
+
+ struct rte_eth_dev_sriov sriov; /**< SRIOV data */
+
+ void *dev_private;
+ /**< PMD-specific private data.
+ * @see rte_eth_dev_release_port()
+ */
+
+ struct rte_eth_link dev_link; /**< Link-level information & status. */
+ struct rte_eth_conf dev_conf; /**< Configuration applied to device. */
+ uint16_t mtu; /**< Maximum Transmission Unit. */
+ uint32_t min_rx_buf_size;
+ /**< Common RX buffer size handled by all queues. */
+
+ uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */
+ struct rte_ether_addr *mac_addrs;
+ /**< Device Ethernet link address.
+ * @see rte_eth_dev_release_port()
+ */
+ uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
+ /**< Bitmap associating MAC addresses to pools. */
+ struct rte_ether_addr *hash_mac_addrs;
+ /**< Device Ethernet MAC addresses of hash filtering.
+ * @see rte_eth_dev_release_port()
+ */
+ uint16_t port_id; /**< Device [external] port identifier. */
+
+ __extension__
+ uint8_t promiscuous : 1,
+ /**< RX promiscuous mode ON(1) / OFF(0). */
+ scattered_rx : 1,
+ /**< RX of scattered packets is ON(1) / OFF(0) */
+ all_multicast : 1,
+ /**< RX all multicast mode ON(1) / OFF(0). */
+ dev_started : 1,
+ /**< Device state: STARTED(1) / STOPPED(0). */
+ lro : 1,
+ /**< RX LRO is ON(1) / OFF(0) */
+ dev_configured : 1;
+ /**< Indicates whether the device is configured.
+ * CONFIGURED(1) / NOT CONFIGURED(0).
+ */
+ uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
+ /**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */
+ uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
+ /**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */
+ uint32_t dev_flags; /**< Capabilities. */
+ int numa_node; /**< NUMA node connection. */
+ struct rte_vlan_filter_conf vlan_filter_conf;
+ /**< VLAN filter configuration. */
+ struct rte_eth_dev_owner owner; /**< The port owner. */
+ uint16_t representor_id;
+ /**< Switch-specific identifier.
+ * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
+ */
+ uint16_t backer_port_id;
+ /**< Port ID of the backing device.
+ * This device will be used to query representor
+ * info and calculate representor IDs.
+ * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
+ */
+
+ pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex. */
+ uint64_t reserved_64s[4]; /**< Reserved for future fields */
+ void *reserved_ptrs[4]; /**< Reserved for future fields */
+} __rte_cache_aligned;
+
+/**
+ * @internal
+ * The pool of *rte_eth_dev* structures. The size of the pool
+ * is configured at compile-time in the <rte_ethdev.c> file.
+ */
+extern struct rte_eth_dev rte_eth_devices[];
+
/**< @internal Declaration of the hairpin peer queue information structure. */
struct rte_hairpin_peer_info;
diff --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h
index df7168ca4b..2b8660c578 100644
--- a/lib/ethdev/rte_ethdev_core.h
+++ b/lib/ethdev/rte_ethdev_core.h
@@ -109,153 +109,4 @@ struct rte_eth_fp_ops {
extern struct rte_eth_fp_ops rte_eth_fp_ops[RTE_MAX_ETHPORTS];
-
-/**
- * @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.
- *
- * 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 {
- 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. */
-
- eth_rx_queue_count_t rx_queue_count; /**< Get the number of used RX descriptors. */
- 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. */
-
- /**
- * Next two fields are per-device data but *data is shared between
- * primary and secondary processes and *process_private is per-process
- * private. The second one is managed by PMDs if necessary.
- */
- struct rte_eth_dev_data *data; /**< Pointer to device data. */
- void *process_private; /**< Pointer to per-process device data. */
- 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 */
-
- uint64_t reserved_64s[4]; /**< Reserved for future fields */
- void *reserved_ptrs[4]; /**< Reserved for future fields */
-} __rte_cache_aligned;
-
-struct rte_eth_dev_sriov;
-struct rte_eth_dev_owner;
-
-/**
- * @internal
- * The data part, with no function pointers, associated with each ethernet device.
- *
- * This structure is safe to place in shared memory to be common among different
- * processes in a multi-process configuration.
- */
-struct rte_eth_dev_data {
- char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
-
- void **rx_queues; /**< Array of pointers to RX queues. */
- void **tx_queues; /**< Array of pointers to TX queues. */
- uint16_t nb_rx_queues; /**< Number of RX queues. */
- uint16_t nb_tx_queues; /**< Number of TX queues. */
-
- struct rte_eth_dev_sriov sriov; /**< SRIOV data */
-
- void *dev_private;
- /**< PMD-specific private data.
- * @see rte_eth_dev_release_port()
- */
-
- struct rte_eth_link dev_link; /**< Link-level information & status. */
- struct rte_eth_conf dev_conf; /**< Configuration applied to device. */
- uint16_t mtu; /**< Maximum Transmission Unit. */
- uint32_t min_rx_buf_size;
- /**< Common RX buffer size handled by all queues. */
-
- uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */
- struct rte_ether_addr *mac_addrs;
- /**< Device Ethernet link address.
- * @see rte_eth_dev_release_port()
- */
- uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
- /**< Bitmap associating MAC addresses to pools. */
- struct rte_ether_addr *hash_mac_addrs;
- /**< Device Ethernet MAC addresses of hash filtering.
- * @see rte_eth_dev_release_port()
- */
- uint16_t port_id; /**< Device [external] port identifier. */
-
- __extension__
- uint8_t promiscuous : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
- scattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */
- all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
- dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */
- lro : 1, /**< RX LRO is ON(1) / OFF(0) */
- dev_configured : 1;
- /**< Indicates whether the device is configured.
- * CONFIGURED(1) / NOT CONFIGURED(0).
- */
- uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
- /**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */
- uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
- /**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */
- uint32_t dev_flags; /**< Capabilities. */
- int numa_node; /**< NUMA node connection. */
- struct rte_vlan_filter_conf vlan_filter_conf;
- /**< VLAN filter configuration. */
- struct rte_eth_dev_owner owner; /**< The port owner. */
- uint16_t representor_id;
- /**< Switch-specific identifier.
- * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
- */
- uint16_t backer_port_id;
- /**< Port ID of the backing device.
- * This device will be used to query representor
- * info and calculate representor IDs.
- * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
- */
-
- pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex. */
- uint64_t reserved_64s[4]; /**< Reserved for future fields */
- void *reserved_ptrs[4]; /**< Reserved for future fields */
-} __rte_cache_aligned;
-
-/**
- * @internal
- * The pool of *rte_eth_dev* structures. The size of the pool
- * is configured at compile-time in the <rte_ethdev.c> file.
- */
-extern struct rte_eth_dev rte_eth_devices[];
-
#endif /* _RTE_ETHDEV_CORE_H_ */
diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map
index ca81f5d237..96ac8abb6b 100644
--- a/lib/ethdev/version.map
+++ b/lib/ethdev/version.map
@@ -73,7 +73,6 @@ DPDK_22 {
rte_eth_dev_udp_tunnel_port_add;
rte_eth_dev_udp_tunnel_port_delete;
rte_eth_dev_vlan_filter;
- rte_eth_devices;
rte_eth_find_next;
rte_eth_find_next_of;
rte_eth_find_next_owned_by;
@@ -269,6 +268,7 @@ INTERNAL {
rte_eth_dev_release_port;
rte_eth_dev_internal_reset;
rte_eth_devargs_parse;
+ rte_eth_devices;
rte_eth_dma_zone_free;
rte_eth_dma_zone_reserve;
rte_eth_hairpin_queue_peer_bind;
diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 13dfb28401..89c4ca5d40 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/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 <ethdev_driver.h>
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_service_component.h>
diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c
index 18c0359db7..1c06c8707c 100644
--- a/lib/eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/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 <ethdev_driver.h>
#include "eventdev_pmd.h"
#include "rte_eventdev_trace.h"
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index e347d6dfd5..ebef5f0906 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/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 <ethdev_driver.h>
#include <rte_cryptodev.h>
#include <cryptodev_pmd.h>
#include <rte_telemetry.h>
diff --git a/lib/metrics/rte_metrics_telemetry.c b/lib/metrics/rte_metrics_telemetry.c
index 269f8ef613..5be21b2e86 100644
--- a/lib/metrics/rte_metrics_telemetry.c
+++ b/lib/metrics/rte_metrics_telemetry.c
@@ -2,7 +2,7 @@
* Copyright(c) 2020 Intel Corporation
*/
-#include <rte_ethdev.h>
+#include <ethdev_driver.h>
#include <rte_string_fns.h>
#ifdef RTE_LIB_TELEMETRY
#include <telemetry_internal.h>
--
2.26.3
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v6 1/6] ethdev: allocate max space for internal queue array
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 1/6] ethdev: allocate max space for internal queue array Konstantin Ananyev
@ 2021-10-13 14:20 ` Andrew Rybchenko
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Rybchenko @ 2021-10-13 14:20 UTC (permalink / raw)
To: Konstantin Ananyev, dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
mczekaj, jiawenwu, jianwang, maxime.coquelin, chenbo.xia, thomas,
ferruh.yigit, mdr, jay.jayatheerthan
On 10/13/21 4:36 PM, Konstantin Ananyev wrote:
> At queue configure stage always allocate space for maximum possible
> number (RTE_MAX_QUEUES_PER_PORT) of queue pointers.
> That will allow 'fast' inline functions (eth_rx_burst, etc.) to refer
> pointer to internal queue data without extra checking of current number
> of configured queues.
> That would help in future to hide rte_eth_dev and related structures.
> It means that from now on, each ethdev port will always consume:
> ((2*sizeof(uintptr_t))* RTE_MAX_QUEUES_PER_PORT)
> bytes of memory for its queue pointers.
> With RTE_MAX_QUEUES_PER_PORT==1024 (default value) it is 16KB per port.
>
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v6 3/6] ethdev: copy fast-path API into separate structure
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 3/6] ethdev: copy fast-path API into separate structure Konstantin Ananyev
@ 2021-10-13 14:25 ` Andrew Rybchenko
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Rybchenko @ 2021-10-13 14:25 UTC (permalink / raw)
To: Konstantin Ananyev, dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
mczekaj, jiawenwu, jianwang, maxime.coquelin, chenbo.xia, thomas,
ferruh.yigit, mdr, jay.jayatheerthan
On 10/13/21 4:37 PM, Konstantin Ananyev wrote:
> Copy public function pointers (rx_pkt_burst(), etc.) and related
> pointers to internal data from rte_eth_dev structure into a
> separate flat array. That array will remain in a public header.
> The intention here is to make rte_eth_dev and related structures internal.
> That should allow future possible changes to core eth_dev structures
> to be transparent to the user and help to avoid ABI/API breakages.
> The plan is to keep minimal part of data from rte_eth_dev public,
> so we still can use inline functions for fast-path calls
> (like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown.
> The whole idea beyond this new schema:
> 1. PMDs keep to setup fast-path function pointers and related data
> inside rte_eth_dev struct in the same way they did it before.
> 2. Inside rte_eth_dev_start() and inside rte_eth_dev_probing_finish()
> (for secondary process) we call eth_dev_fp_ops_setup, which
> copies these function and data pointers into rte_eth_fp_ops[port_id].
> 3. Inside rte_eth_dev_stop() and inside rte_eth_dev_release_port()
> we call eth_dev_fp_ops_reset(), which resets rte_eth_fp_ops[port_id]
> into some dummy values.
> 4. fast-path ethdev API (rte_eth_rx_burst(), etc.) will use that new
> flat array to call PMD specific functions.
> That approach should allow us to make rte_eth_devices[] private
> without introducing regression and help to avoid changes in drivers code.
>
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v6 5/6] ethdev: add API to retrieve multiple ethernet addresses
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 5/6] ethdev: add API to retrieve multiple ethernet addresses Konstantin Ananyev
@ 2021-10-13 14:31 ` Andrew Rybchenko
2021-10-13 18:58 ` Ferruh Yigit
0 siblings, 1 reply; 17+ messages in thread
From: Andrew Rybchenko @ 2021-10-13 14:31 UTC (permalink / raw)
To: Konstantin Ananyev, dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
mczekaj, jiawenwu, jianwang, maxime.coquelin, chenbo.xia, thomas,
ferruh.yigit, mdr, jay.jayatheerthan
On 10/13/21 4:37 PM, Konstantin Ananyev wrote:
> Introduce rte_eth_macaddrs_get() to allow user to retrieve all ethernet
ethernet -> Ethernet
> addresses assigned to given port.
> Change testpmd to use this new function and avoid referencing directly
> rte_eth_devices[].
>
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
except one nit below
[snip]
> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
> index f4c92b3b5e..dbc14f4a23 100644
> --- a/lib/ethdev/rte_ethdev.h
> +++ b/lib/ethdev/rte_ethdev.h
> @@ -3007,6 +3007,27 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
> */
> int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);
>
> +/**
Experimental header is missing
> + * Retrieve the Ethernet addresses of an Ethernet device.
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param ma
> + * A pointer to an array of structures of type *ether_addr* to be filled with
> + * the Ethernet addresses of the Ethernet device.
> + * @param num
> + * Number of elements in the @p ma array.
> + * Note that rte_eth_dev_info::max_mac_addrs can be used to retrieve
> + * max number of Ethernet addresses for given port.
> + * @return
> + * - number of retrieved addresses if successful
> + * - (-ENODEV) if *port_id* invalid.
> + * - (-EINVAL) if bad parameter.
> + */
> +__rte_experimental
> +int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
> + unsigned int num);
> +
> /**
> * Retrieve the contextual information of an Ethernet device.
> *
[snip]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v6 6/6] ethdev: hide eth dev related structures
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 6/6] ethdev: hide eth dev related structures Konstantin Ananyev
@ 2021-10-13 14:32 ` Andrew Rybchenko
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Rybchenko @ 2021-10-13 14:32 UTC (permalink / raw)
To: Konstantin Ananyev, dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
mczekaj, jiawenwu, jianwang, maxime.coquelin, chenbo.xia, thomas,
ferruh.yigit, mdr, jay.jayatheerthan
On 10/13/21 4:37 PM, Konstantin Ananyev wrote:
> Move rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback and related
> data into private header (ethdev_driver.h).
> Few minor changes to keep DPDK building after that.
>
> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Andrew.Rybchenko <andrew.rybchenko@oktetlabs.ru>
I'll do structures documenation cleanup when pathes are in.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v6 5/6] ethdev: add API to retrieve multiple ethernet addresses
2021-10-13 14:31 ` Andrew Rybchenko
@ 2021-10-13 18:58 ` Ferruh Yigit
0 siblings, 0 replies; 17+ messages in thread
From: Ferruh Yigit @ 2021-10-13 18:58 UTC (permalink / raw)
To: Andrew Rybchenko, Konstantin Ananyev, dev
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
mczekaj, jiawenwu, jianwang, maxime.coquelin, chenbo.xia, thomas,
mdr, jay.jayatheerthan
On 10/13/2021 3:31 PM, Andrew Rybchenko wrote:
> On 10/13/21 4:37 PM, Konstantin Ananyev wrote:
>> Introduce rte_eth_macaddrs_get() to allow user to retrieve all ethernet
>
> ethernet -> Ethernet
>
>> addresses assigned to given port.
>> Change testpmd to use this new function and avoid referencing directly
>> rte_eth_devices[].
>>
>> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>
> except one nit below
>
> [snip]
>
>> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
>> index f4c92b3b5e..dbc14f4a23 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -3007,6 +3007,27 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
>> */
>> int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);
>>
>> +/**
>
> Experimental header is missing
>
I can add while merging to next-net.
>> + * Retrieve the Ethernet addresses of an Ethernet device.
>> + *
>> + * @param port_id
>> + * The port identifier of the Ethernet device.
>> + * @param ma
>> + * A pointer to an array of structures of type *ether_addr* to be filled with
>> + * the Ethernet addresses of the Ethernet device.
>> + * @param num
>> + * Number of elements in the @p ma array.
>> + * Note that rte_eth_dev_info::max_mac_addrs can be used to retrieve
>> + * max number of Ethernet addresses for given port.
>> + * @return
>> + * - number of retrieved addresses if successful
>> + * - (-ENODEV) if *port_id* invalid.
>> + * - (-EINVAL) if bad parameter.
>> + */
>> +__rte_experimental
>> +int rte_eth_macaddrs_get(uint16_t port_id, struct rte_ether_addr *ma,
>> + unsigned int num);
>> +
>> /**
>> * Retrieve the contextual information of an Ethernet device.
>> *
>
> [snip]
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures Konstantin Ananyev
` (5 preceding siblings ...)
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 6/6] ethdev: hide eth dev related structures Konstantin Ananyev
@ 2021-10-13 20:16 ` Ferruh Yigit
2021-10-14 10:12 ` [dpdk-dev] 回复: " Feifei Wang
2021-10-18 16:04 ` [dpdk-dev] " Ali Alnubani
6 siblings, 2 replies; 17+ messages in thread
From: Ferruh Yigit @ 2021-10-13 20:16 UTC (permalink / raw)
To: Konstantin Ananyev, dev, jerinj, Ajit Khaparde, Raslan Darawsheh,
Andrew Rybchenko, Qi Zhang, Honnappa Nagarahalli
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
andrew.rybchenko, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, thomas, mdr, jay.jayatheerthan
On 10/13/2021 2:36 PM, Konstantin Ananyev wrote:
> v6 changes:
> - Update comments (Andrew)
> - Move callback related variables under corresponding ifdefs (Andrew)
> - Few nits in rte_eth_macaddrs_get (Andrew)
> - Rebased on top of next-net tree
>
> v5 changes:
> - Fix spelling (Thomas/David)
> - Rename internal helper functions (David)
> - Reorder patches and update commit messages (Thomas)
> - Update comments (Thomas)
> - Changed layout in rte_eth_fp_ops, to group functions and
> related data based on their functionality:
> first 64B line for Rx, second one for Tx.
> Didn't observe any real performance difference comparing to
> original layout. Though decided to keep a new one, as it seems
> a bit more plausible.
>
> v4 changes:
> - Fix secondary process attach (Pavan)
> - Fix build failure (Ferruh)
> - Update lib/ethdev/verion.map (Ferruh)
> Note that moving newly added symbols from EXPERIMENTAL to DPDK_22
> section makes checkpatch.sh to complain.
>
> v3 changes:
> - Changes in public struct naming (Jerin/Haiyue)
> - Split patches
> - Update docs
> - Shamelessly included Andrew's patch:
> https://patches.dpdk.org/project/dpdk/patch/20210928154856.1015020-1-andrew.rybchenko@oktetlabs.ru/
> into these series.
> I have to do similar thing here, so decided to avoid duplicated effort.
>
> The aim of these patch series is to make rte_ethdev core data structures
> (rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback, etc.) internal to
> DPDK and not visible to the user.
> That should allow future possible changes to core ethdev related structures
> to be transparent to the user and help to improve ABI/API stability.
> Note that current ethdev API is preserved, but it is a formal ABI break.
>
> The work is based on previous discussions at:
> https://www.mail-archive.com/dev@dpdk.org/msg211405.html
> https://www.mail-archive.com/dev@dpdk.org/msg216685.html
> and consists of the following main points:
> 1. Copy public 'fast' function pointers (rx_pkt_burst(), etc.) and
> related data pointer from rte_eth_dev into a separate flat array.
> We keep it public to still be able to use inline functions for these
> 'fast' calls (like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown.
> Note that apart from function pointers itself, each element of this
> flat array also contains two opaque pointers for each ethdev:
> 1) a pointer to an array of internal queue data pointers
> 2) points to array of queue callback data pointers.
> Note that exposing this extra information allows us to avoid extra
> changes inside PMD level, plus should help to avoid possible
> performance degradation.
> 2. Change implementation of 'fast' inline ethdev functions
> (rte_eth_rx_burst(), etc.) to use new public flat array.
> While it is an ABI breakage, this change is intended to be transparent
> for both users (no changes in user app is required) and PMD developers
> (no changes in PMD is required).
> One extra note - with new implementation RX/TX callback invocation
> will cost one extra function call with this changes. That might cause
> some slowdown for code-path with RX/TX callbacks heavily involved.
> Hope such trade-off is acceptable for the community.
> 3. Move rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback and related
> things into internal header: <ethdev_driver.h>.
>
> That approach was selected to:
> - Avoid(/minimize) possible performance losses.
> - Minimize required changes inside PMDs.
>
> Performance testing results (ICX 2.0GHz, E810 (ice)):
> - testpmd macswap fwd mode, plus
> a) no RX/TX callbacks:
> no actual slowdown observed
> b) bpf-load rx 0 0 JM ./dpdk.org/examples/bpf/t3.o:
> ~2% slowdown
> - l3fwd: no actual slowdown observed
>
> Would like to thank everyone who already reviewed and tested previous
> versions of these series. All other interested parties please don't be shy
> and provide your feedback.
>
> Konstantin Ananyev (6):
> ethdev: allocate max space for internal queue array
> ethdev: change input parameters for rx_queue_count
> ethdev: copy fast-path API into separate structure
> ethdev: make fast-path functions to use new flat array
> ethdev: add API to retrieve multiple ethernet addresses
> ethdev: hide eth dev related structures
>
For series,
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
No performance regression detected on my testing.
I am merging the series to next-net now which helps testing,
but before merging to main repo it will be good to get more
ack and test results (I can squash new tags later).
@Jerin, @Ajit, @Raslan, @Andrew, @Qi, @Honnappa,
Can you please test this set for any possible regression?
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [dpdk-dev] 回复: [PATCH v6 0/6] hide eth dev related structures
2021-10-13 20:16 ` [dpdk-dev] [PATCH v6 0/6] " Ferruh Yigit
@ 2021-10-14 10:12 ` Feifei Wang
2021-10-18 16:04 ` [dpdk-dev] " Ali Alnubani
1 sibling, 0 replies; 17+ messages in thread
From: Feifei Wang @ 2021-10-14 10:12 UTC (permalink / raw)
To: Ferruh Yigit, Konstantin Ananyev, dev, jerinj,
Ajit Khaparde (ajit.khaparde@broadcom.com),
Raslan Darawsheh, Andrew Rybchenko, Qi Zhang,
Honnappa Nagarahalli
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh,
Ajit Khaparde (ajit.khaparde@broadcom.com),
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
matan, viacheslavo, sthemmin, longli, heinrich.kuhn, kirankumark,
andrew.rybchenko, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, thomas, mdr, jay.jayatheerthan, nd
> -----邮件原件-----
> 发件人: dev <dev-bounces@dpdk.org> 代表 Ferruh Yigit
> 发送时间: Thursday, October 14, 2021 4:16 AM
> 收件人: Konstantin Ananyev <konstantin.ananyev@intel.com>;
> dev@dpdk.org; jerinj@marvell.com; Ajit Khaparde
> (ajit.khaparde@broadcom.com) <ajit.khaparde@broadcom.com>; Raslan
> Darawsheh <rasland@nvidia.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Qi Zhang <qi.z.zhang@intel.com>;
> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> 抄送: xiaoyun.li@intel.com; anoobj@marvell.com; jerinj@marvell.com;
> ndabilpuram@marvell.com; adwivedi@marvell.com;
> shepard.siegel@atomicrules.com; ed.czeck@atomicrules.com;
> john.miller@atomicrules.com; irusskikh@marvell.com; Ajit Khaparde
> (ajit.khaparde@broadcom.com) <ajit.khaparde@broadcom.com>;
> somnath.kotur@broadcom.com; rahul.lakkireddy@chelsio.com;
> hemant.agrawal@nxp.com; sachin.saxena@oss.nxp.com;
> haiyue.wang@intel.com; johndale@cisco.com; hyonkim@cisco.com;
> qi.z.zhang@intel.com; xiao.w.wang@intel.com; humin29@huawei.com;
> yisen.zhuang@huawei.com; oulijun@huawei.com; beilei.xing@intel.com;
> jingjing.wu@intel.com; qiming.yang@intel.com; matan@nvidia.com;
> viacheslavo@nvidia.com; sthemmin@microsoft.com; longli@microsoft.com;
> heinrich.kuhn@corigine.com; kirankumark@marvell.com;
> andrew.rybchenko@oktetlabs.ru; mczekaj@marvell.com;
> jiawenwu@trustnetic.com; jianwang@trustnetic.com;
> maxime.coquelin@redhat.com; chenbo.xia@intel.com;
> thomas@monjalon.net; mdr@ashroe.eu; jay.jayatheerthan@intel.com
> 主题: Re: [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures
>
> On 10/13/2021 2:36 PM, Konstantin Ananyev wrote:
> > v6 changes:
> > - Update comments (Andrew)
> > - Move callback related variables under corresponding ifdefs (Andrew)
> > - Few nits in rte_eth_macaddrs_get (Andrew)
> > - Rebased on top of next-net tree
> >
> > v5 changes:
> > - Fix spelling (Thomas/David)
> > - Rename internal helper functions (David)
> > - Reorder patches and update commit messages (Thomas)
> > - Update comments (Thomas)
> > - Changed layout in rte_eth_fp_ops, to group functions and
> > related data based on their functionality:
> > first 64B line for Rx, second one for Tx.
> > Didn't observe any real performance difference comparing to
> > original layout. Though decided to keep a new one, as it seems
> > a bit more plausible.
> >
> > v4 changes:
> > - Fix secondary process attach (Pavan)
> > - Fix build failure (Ferruh)
> > - Update lib/ethdev/verion.map (Ferruh)
> > Note that moving newly added symbols from EXPERIMENTAL to DPDK_22
> > section makes checkpatch.sh to complain.
> >
> > v3 changes:
> > - Changes in public struct naming (Jerin/Haiyue)
> > - Split patches
> > - Update docs
> > - Shamelessly included Andrew's patch:
> >
> https://patches.dpdk.org/project/dpdk/patch/20210928154856.1015020-1-
> andrew.rybchenko@oktetlabs.ru/
> > into these series.
> > I have to do similar thing here, so decided to avoid duplicated effort.
> >
> > The aim of these patch series is to make rte_ethdev core data
> > structures (rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback,
> > etc.) internal to DPDK and not visible to the user.
> > That should allow future possible changes to core ethdev related
> > structures to be transparent to the user and help to improve ABI/API
> stability.
> > Note that current ethdev API is preserved, but it is a formal ABI break.
> >
> > The work is based on previous discussions at:
> > https://www.mail-archive.com/dev@dpdk.org/msg211405.html
> > https://www.mail-archive.com/dev@dpdk.org/msg216685.html
> > and consists of the following main points:
> > 1. Copy public 'fast' function pointers (rx_pkt_burst(), etc.) and
> > related data pointer from rte_eth_dev into a separate flat array.
> > We keep it public to still be able to use inline functions for these
> > 'fast' calls (like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown.
> > Note that apart from function pointers itself, each element of this
> > flat array also contains two opaque pointers for each ethdev:
> > 1) a pointer to an array of internal queue data pointers
> > 2) points to array of queue callback data pointers.
> > Note that exposing this extra information allows us to avoid extra
> > changes inside PMD level, plus should help to avoid possible
> > performance degradation.
> > 2. Change implementation of 'fast' inline ethdev functions
> > (rte_eth_rx_burst(), etc.) to use new public flat array.
> > While it is an ABI breakage, this change is intended to be transparent
> > for both users (no changes in user app is required) and PMD developers
> > (no changes in PMD is required).
> > One extra note - with new implementation RX/TX callback invocation
> > will cost one extra function call with this changes. That might cause
> > some slowdown for code-path with RX/TX callbacks heavily involved.
> > Hope such trade-off is acceptable for the community.
> > 3. Move rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback and related
> > things into internal header: <ethdev_driver.h>.
> >
> > That approach was selected to:
> > - Avoid(/minimize) possible performance losses.
> > - Minimize required changes inside PMDs.
> >
> > Performance testing results (ICX 2.0GHz, E810 (ice)):
> > - testpmd macswap fwd mode, plus
> > a) no RX/TX callbacks:
> > no actual slowdown observed
> > b) bpf-load rx 0 0 JM ./dpdk.org/examples/bpf/t3.o:
> > ~2% slowdown
> > - l3fwd: no actual slowdown observed
> >
> > Would like to thank everyone who already reviewed and tested previous
> > versions of these series. All other interested parties please don't be
> > shy and provide your feedback.
> >
> > Konstantin Ananyev (6):
> > ethdev: allocate max space for internal queue array
> > ethdev: change input parameters for rx_queue_count
> > ethdev: copy fast-path API into separate structure
> > ethdev: make fast-path functions to use new flat array
> > ethdev: add API to retrieve multiple ethernet addresses
> > ethdev: hide eth dev related structures
> >
>
> For series,
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> No performance regression detected on my testing.
>
> I am merging the series to next-net now which helps testing, but before
> merging to main repo it will be good to get more ack and test results (I can
> squash new tags later).
>
> @Jerin, @Ajit, @Raslan, @Andrew, @Qi, @Honnappa, Can you please test
> this set for any possible regression?
>
> Series applied to dpdk-next-net/main, thanks.
>
For series, there is no performance regression in n1sdp/thunderx2
with i40e and mlx5 40G NIC for l3fwd and testpmd.
Tested-by: Feifei Wang <feifei.wang2@arm.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures
2021-10-13 20:16 ` [dpdk-dev] [PATCH v6 0/6] " Ferruh Yigit
2021-10-14 10:12 ` [dpdk-dev] 回复: " Feifei Wang
@ 2021-10-18 16:04 ` Ali Alnubani
2021-10-18 16:47 ` Ferruh Yigit
1 sibling, 1 reply; 17+ messages in thread
From: Ali Alnubani @ 2021-10-18 16:04 UTC (permalink / raw)
To: Ferruh Yigit, Konstantin Ananyev, dev, jerinj, Ajit Khaparde,
Raslan Darawsheh, Andrew Rybchenko, Qi Zhang,
Honnappa Nagarahalli
Cc: xiaoyun.li, anoobj, jerinj, ndabilpuram, adwivedi,
shepard.siegel, ed.czeck, john.miller, irusskikh, ajit.khaparde,
somnath.kotur, rahul.lakkireddy, hemant.agrawal, sachin.saxena,
haiyue.wang, johndale, hyonkim, qi.z.zhang, xiao.w.wang, humin29,
yisen.zhuang, oulijun, beilei.xing, jingjing.wu, qiming.yang,
Matan Azrad, Slava Ovsiienko, sthemmin, NBU-Contact-longli,
heinrich.kuhn, kirankumark, andrew.rybchenko, mczekaj, jiawenwu,
jianwang, maxime.coquelin, chenbo.xia,
NBU-Contact-Thomas Monjalon, mdr, jay.jayatheerthan
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Ferruh Yigit
> Sent: Wednesday, October 13, 2021 11:16 PM
> To: Konstantin Ananyev <konstantin.ananyev@intel.com>; dev@dpdk.org;
> jerinj@marvell.com; Ajit Khaparde <ajit.khaparde@broadcom.com>; Raslan
> Darawsheh <rasland@nvidia.com>; Andrew Rybchenko
> <andrew.rybchenko@oktetlabs.ru>; Qi Zhang <qi.z.zhang@intel.com>;
> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Cc: xiaoyun.li@intel.com; anoobj@marvell.com; jerinj@marvell.com;
> ndabilpuram@marvell.com; adwivedi@marvell.com;
> shepard.siegel@atomicrules.com; ed.czeck@atomicrules.com;
> john.miller@atomicrules.com; irusskikh@marvell.com;
> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com;
> rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
> sachin.saxena@oss.nxp.com; haiyue.wang@intel.com; johndale@cisco.com;
> hyonkim@cisco.com; qi.z.zhang@intel.com; xiao.w.wang@intel.com;
> humin29@huawei.com; yisen.zhuang@huawei.com; oulijun@huawei.com;
> beilei.xing@intel.com; jingjing.wu@intel.com; qiming.yang@intel.com;
> Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; sthemmin@microsoft.com; NBU-Contact-longli
> <longli@microsoft.com>; heinrich.kuhn@corigine.com;
> kirankumark@marvell.com; andrew.rybchenko@oktetlabs.ru;
> mczekaj@marvell.com; jiawenwu@trustnetic.com;
> jianwang@trustnetic.com; maxime.coquelin@redhat.com;
> chenbo.xia@intel.com; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; mdr@ashroe.eu; jay.jayatheerthan@intel.com
> Subject: Re: [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures
>
> On 10/13/2021 2:36 PM, Konstantin Ananyev wrote:
> > v6 changes:
> > - Update comments (Andrew)
> > - Move callback related variables under corresponding ifdefs (Andrew)
> > - Few nits in rte_eth_macaddrs_get (Andrew)
> > - Rebased on top of next-net tree
> >
> > v5 changes:
> > - Fix spelling (Thomas/David)
> > - Rename internal helper functions (David)
> > - Reorder patches and update commit messages (Thomas)
> > - Update comments (Thomas)
> > - Changed layout in rte_eth_fp_ops, to group functions and
> > related data based on their functionality:
> > first 64B line for Rx, second one for Tx.
> > Didn't observe any real performance difference comparing to
> > original layout. Though decided to keep a new one, as it seems
> > a bit more plausible.
> >
> > v4 changes:
> > - Fix secondary process attach (Pavan)
> > - Fix build failure (Ferruh)
> > - Update lib/ethdev/verion.map (Ferruh)
> > Note that moving newly added symbols from EXPERIMENTAL to DPDK_22
> > section makes checkpatch.sh to complain.
> >
> > v3 changes:
> > - Changes in public struct naming (Jerin/Haiyue)
> > - Split patches
> > - Update docs
> > - Shamelessly included Andrew's patch:
> > https://patches.dpdk.org/project/dpdk/patch/20210928154856.1015020-
> 1-andrew.rybchenko@oktetlabs.ru/
> > into these series.
> > I have to do similar thing here, so decided to avoid duplicated effort.
> >
> > The aim of these patch series is to make rte_ethdev core data structures
> > (rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback, etc.) internal to
> > DPDK and not visible to the user.
> > That should allow future possible changes to core ethdev related structures
> > to be transparent to the user and help to improve ABI/API stability.
> > Note that current ethdev API is preserved, but it is a formal ABI break.
> >
> > The work is based on previous discussions at:
> > https://www.mail-archive.com/dev@dpdk.org/msg211405.html
> > https://www.mail-archive.com/dev@dpdk.org/msg216685.html
> > and consists of the following main points:
> > 1. Copy public 'fast' function pointers (rx_pkt_burst(), etc.) and
> > related data pointer from rte_eth_dev into a separate flat array.
> > We keep it public to still be able to use inline functions for these
> > 'fast' calls (like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown.
> > Note that apart from function pointers itself, each element of this
> > flat array also contains two opaque pointers for each ethdev:
> > 1) a pointer to an array of internal queue data pointers
> > 2) points to array of queue callback data pointers.
> > Note that exposing this extra information allows us to avoid extra
> > changes inside PMD level, plus should help to avoid possible
> > performance degradation.
> > 2. Change implementation of 'fast' inline ethdev functions
> > (rte_eth_rx_burst(), etc.) to use new public flat array.
> > While it is an ABI breakage, this change is intended to be transparent
> > for both users (no changes in user app is required) and PMD developers
> > (no changes in PMD is required).
> > One extra note - with new implementation RX/TX callback invocation
> > will cost one extra function call with this changes. That might cause
> > some slowdown for code-path with RX/TX callbacks heavily involved.
> > Hope such trade-off is acceptable for the community.
> > 3. Move rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback and
> related
> > things into internal header: <ethdev_driver.h>.
> >
> > That approach was selected to:
> > - Avoid(/minimize) possible performance losses.
> > - Minimize required changes inside PMDs.
> >
> > Performance testing results (ICX 2.0GHz, E810 (ice)):
> > - testpmd macswap fwd mode, plus
> > a) no RX/TX callbacks:
> > no actual slowdown observed
> > b) bpf-load rx 0 0 JM ./dpdk.org/examples/bpf/t3.o:
> > ~2% slowdown
> > - l3fwd: no actual slowdown observed
> >
> > Would like to thank everyone who already reviewed and tested previous
> > versions of these series. All other interested parties please don't be shy
> > and provide your feedback.
> >
> > Konstantin Ananyev (6):
> > ethdev: allocate max space for internal queue array
> > ethdev: change input parameters for rx_queue_count
> > ethdev: copy fast-path API into separate structure
> > ethdev: make fast-path functions to use new flat array
> > ethdev: add API to retrieve multiple ethernet addresses
> > ethdev: hide eth dev related structures
> >
>
> For series,
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> No performance regression detected on my testing.
>
> I am merging the series to next-net now which helps testing,
> but before merging to main repo it will be good to get more
> ack and test results (I can squash new tags later).
>
> @Jerin, @Ajit, @Raslan, @Andrew, @Qi, @Honnappa,
> Can you please test this set for any possible regression?
>
> Series applied to dpdk-next-net/main, thanks.
>
Tested (on dpdk-next-net/main) single and multi-core packet forwarding performance with testpmd on both ConnectX-5 and ConnectX-6 Dx. I didn't see any noticeable regressions.
Thanks,
Ali
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures
2021-10-18 16:04 ` [dpdk-dev] " Ali Alnubani
@ 2021-10-18 16:47 ` Ferruh Yigit
2021-10-18 23:47 ` Ajit Khaparde
0 siblings, 1 reply; 17+ messages in thread
From: Ferruh Yigit @ 2021-10-18 16:47 UTC (permalink / raw)
To: Ali Alnubani, Konstantin Ananyev, dev, jerinj, Ajit Khaparde,
Raslan Darawsheh, Andrew Rybchenko, Qi Zhang,
Honnappa Nagarahalli
Cc: xiaoyun.li, anoobj, ndabilpuram, adwivedi, shepard.siegel,
ed.czeck, john.miller, irusskikh, somnath.kotur,
rahul.lakkireddy, hemant.agrawal, sachin.saxena, haiyue.wang,
johndale, hyonkim, xiao.w.wang, humin29, yisen.zhuang, oulijun,
beilei.xing, jingjing.wu, qiming.yang, Matan Azrad,
Slava Ovsiienko, sthemmin, NBU-Contact-longli, heinrich.kuhn,
kirankumark, mczekaj, jiawenwu, jianwang, maxime.coquelin,
chenbo.xia, NBU-Contact-Thomas Monjalon, mdr, jay.jayatheerthan
On 10/18/2021 5:04 PM, Ali Alnubani wrote:
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Ferruh Yigit
>> Sent: Wednesday, October 13, 2021 11:16 PM
>> To: Konstantin Ananyev <konstantin.ananyev@intel.com>; dev@dpdk.org;
>> jerinj@marvell.com; Ajit Khaparde <ajit.khaparde@broadcom.com>; Raslan
>> Darawsheh <rasland@nvidia.com>; Andrew Rybchenko
>> <andrew.rybchenko@oktetlabs.ru>; Qi Zhang <qi.z.zhang@intel.com>;
>> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
>> Cc: xiaoyun.li@intel.com; anoobj@marvell.com; jerinj@marvell.com;
>> ndabilpuram@marvell.com; adwivedi@marvell.com;
>> shepard.siegel@atomicrules.com; ed.czeck@atomicrules.com;
>> john.miller@atomicrules.com; irusskikh@marvell.com;
>> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com;
>> rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
>> sachin.saxena@oss.nxp.com; haiyue.wang@intel.com; johndale@cisco.com;
>> hyonkim@cisco.com; qi.z.zhang@intel.com; xiao.w.wang@intel.com;
>> humin29@huawei.com; yisen.zhuang@huawei.com; oulijun@huawei.com;
>> beilei.xing@intel.com; jingjing.wu@intel.com; qiming.yang@intel.com;
>> Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
>> <viacheslavo@nvidia.com>; sthemmin@microsoft.com; NBU-Contact-longli
>> <longli@microsoft.com>; heinrich.kuhn@corigine.com;
>> kirankumark@marvell.com; andrew.rybchenko@oktetlabs.ru;
>> mczekaj@marvell.com; jiawenwu@trustnetic.com;
>> jianwang@trustnetic.com; maxime.coquelin@redhat.com;
>> chenbo.xia@intel.com; NBU-Contact-Thomas Monjalon
>> <thomas@monjalon.net>; mdr@ashroe.eu; jay.jayatheerthan@intel.com
>> Subject: Re: [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures
>>
>> On 10/13/2021 2:36 PM, Konstantin Ananyev wrote:
>>> v6 changes:
>>> - Update comments (Andrew)
>>> - Move callback related variables under corresponding ifdefs (Andrew)
>>> - Few nits in rte_eth_macaddrs_get (Andrew)
>>> - Rebased on top of next-net tree
>>>
>>> v5 changes:
>>> - Fix spelling (Thomas/David)
>>> - Rename internal helper functions (David)
>>> - Reorder patches and update commit messages (Thomas)
>>> - Update comments (Thomas)
>>> - Changed layout in rte_eth_fp_ops, to group functions and
>>> related data based on their functionality:
>>> first 64B line for Rx, second one for Tx.
>>> Didn't observe any real performance difference comparing to
>>> original layout. Though decided to keep a new one, as it seems
>>> a bit more plausible.
>>>
>>> v4 changes:
>>> - Fix secondary process attach (Pavan)
>>> - Fix build failure (Ferruh)
>>> - Update lib/ethdev/verion.map (Ferruh)
>>> Note that moving newly added symbols from EXPERIMENTAL to DPDK_22
>>> section makes checkpatch.sh to complain.
>>>
>>> v3 changes:
>>> - Changes in public struct naming (Jerin/Haiyue)
>>> - Split patches
>>> - Update docs
>>> - Shamelessly included Andrew's patch:
>>> https://patches.dpdk.org/project/dpdk/patch/20210928154856.1015020-
>> 1-andrew.rybchenko@oktetlabs.ru/
>>> into these series.
>>> I have to do similar thing here, so decided to avoid duplicated effort.
>>>
>>> The aim of these patch series is to make rte_ethdev core data structures
>>> (rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback, etc.) internal to
>>> DPDK and not visible to the user.
>>> That should allow future possible changes to core ethdev related structures
>>> to be transparent to the user and help to improve ABI/API stability.
>>> Note that current ethdev API is preserved, but it is a formal ABI break.
>>>
>>> The work is based on previous discussions at:
>>> https://www.mail-archive.com/dev@dpdk.org/msg211405.html
>>> https://www.mail-archive.com/dev@dpdk.org/msg216685.html
>>> and consists of the following main points:
>>> 1. Copy public 'fast' function pointers (rx_pkt_burst(), etc.) and
>>> related data pointer from rte_eth_dev into a separate flat array.
>>> We keep it public to still be able to use inline functions for these
>>> 'fast' calls (like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown.
>>> Note that apart from function pointers itself, each element of this
>>> flat array also contains two opaque pointers for each ethdev:
>>> 1) a pointer to an array of internal queue data pointers
>>> 2) points to array of queue callback data pointers.
>>> Note that exposing this extra information allows us to avoid extra
>>> changes inside PMD level, plus should help to avoid possible
>>> performance degradation.
>>> 2. Change implementation of 'fast' inline ethdev functions
>>> (rte_eth_rx_burst(), etc.) to use new public flat array.
>>> While it is an ABI breakage, this change is intended to be transparent
>>> for both users (no changes in user app is required) and PMD developers
>>> (no changes in PMD is required).
>>> One extra note - with new implementation RX/TX callback invocation
>>> will cost one extra function call with this changes. That might cause
>>> some slowdown for code-path with RX/TX callbacks heavily involved.
>>> Hope such trade-off is acceptable for the community.
>>> 3. Move rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback and
>> related
>>> things into internal header: <ethdev_driver.h>.
>>>
>>> That approach was selected to:
>>> - Avoid(/minimize) possible performance losses.
>>> - Minimize required changes inside PMDs.
>>>
>>> Performance testing results (ICX 2.0GHz, E810 (ice)):
>>> - testpmd macswap fwd mode, plus
>>> a) no RX/TX callbacks:
>>> no actual slowdown observed
>>> b) bpf-load rx 0 0 JM ./dpdk.org/examples/bpf/t3.o:
>>> ~2% slowdown
>>> - l3fwd: no actual slowdown observed
>>>
>>> Would like to thank everyone who already reviewed and tested previous
>>> versions of these series. All other interested parties please don't be shy
>>> and provide your feedback.
>>>
>>> Konstantin Ananyev (6):
>>> ethdev: allocate max space for internal queue array
>>> ethdev: change input parameters for rx_queue_count
>>> ethdev: copy fast-path API into separate structure
>>> ethdev: make fast-path functions to use new flat array
>>> ethdev: add API to retrieve multiple ethernet addresses
>>> ethdev: hide eth dev related structures
>>>
>>
>> For series,
>> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
>>
>> No performance regression detected on my testing.
>>
>> I am merging the series to next-net now which helps testing,
>> but before merging to main repo it will be good to get more
>> ack and test results (I can squash new tags later).
>>
>> @Jerin, @Ajit, @Raslan, @Andrew, @Qi, @Honnappa,
>> Can you please test this set for any possible regression?
>>
>> Series applied to dpdk-next-net/main, thanks.
>>
>
> Tested (on dpdk-next-net/main) single and multi-core packet forwarding performance with testpmd on both ConnectX-5 and ConnectX-6 Dx. I didn't see any noticeable regressions.
>
Thanks!
At this stage I am putting set to pull request for main repo.
Last day for anyone who wants to test the set.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures
2021-10-18 16:47 ` Ferruh Yigit
@ 2021-10-18 23:47 ` Ajit Khaparde
0 siblings, 0 replies; 17+ messages in thread
From: Ajit Khaparde @ 2021-10-18 23:47 UTC (permalink / raw)
To: Ferruh Yigit
Cc: Ali Alnubani, Konstantin Ananyev, dev, jerinj, Raslan Darawsheh,
Andrew Rybchenko, Qi Zhang, Honnappa Nagarahalli, xiaoyun.li,
anoobj, ndabilpuram, adwivedi, shepard.siegel, ed.czeck,
john.miller, irusskikh, somnath.kotur, rahul.lakkireddy,
hemant.agrawal, sachin.saxena, haiyue.wang, johndale, hyonkim,
xiao.w.wang, humin29, yisen.zhuang, oulijun, beilei.xing,
jingjing.wu, qiming.yang, Matan Azrad, Slava Ovsiienko, sthemmin,
NBU-Contact-longli, heinrich.kuhn, kirankumark, mczekaj,
jiawenwu, jianwang, maxime.coquelin, chenbo.xia,
NBU-Contact-Thomas Monjalon, mdr, jay.jayatheerthan
On Mon, Oct 18, 2021 at 9:47 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 10/18/2021 5:04 PM, Ali Alnubani wrote:
> >> -----Original Message-----
> >> From: dev <dev-bounces@dpdk.org> On Behalf Of Ferruh Yigit
> >> Sent: Wednesday, October 13, 2021 11:16 PM
> >> To: Konstantin Ananyev <konstantin.ananyev@intel.com>; dev@dpdk.org;
> >> jerinj@marvell.com; Ajit Khaparde <ajit.khaparde@broadcom.com>; Raslan
> >> Darawsheh <rasland@nvidia.com>; Andrew Rybchenko
> >> <andrew.rybchenko@oktetlabs.ru>; Qi Zhang <qi.z.zhang@intel.com>;
> >> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> >> Cc: xiaoyun.li@intel.com; anoobj@marvell.com; jerinj@marvell.com;
> >> ndabilpuram@marvell.com; adwivedi@marvell.com;
> >> shepard.siegel@atomicrules.com; ed.czeck@atomicrules.com;
> >> john.miller@atomicrules.com; irusskikh@marvell.com;
> >> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com;
> >> rahul.lakkireddy@chelsio.com; hemant.agrawal@nxp.com;
> >> sachin.saxena@oss.nxp.com; haiyue.wang@intel.com; johndale@cisco.com;
> >> hyonkim@cisco.com; qi.z.zhang@intel.com; xiao.w.wang@intel.com;
> >> humin29@huawei.com; yisen.zhuang@huawei.com; oulijun@huawei.com;
> >> beilei.xing@intel.com; jingjing.wu@intel.com; qiming.yang@intel.com;
> >> Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> >> <viacheslavo@nvidia.com>; sthemmin@microsoft.com; NBU-Contact-longli
> >> <longli@microsoft.com>; heinrich.kuhn@corigine.com;
> >> kirankumark@marvell.com; andrew.rybchenko@oktetlabs.ru;
> >> mczekaj@marvell.com; jiawenwu@trustnetic.com;
> >> jianwang@trustnetic.com; maxime.coquelin@redhat.com;
> >> chenbo.xia@intel.com; NBU-Contact-Thomas Monjalon
> >> <thomas@monjalon.net>; mdr@ashroe.eu; jay.jayatheerthan@intel.com
> >> Subject: Re: [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures
> >>
> >> On 10/13/2021 2:36 PM, Konstantin Ananyev wrote:
> >>> v6 changes:
> >>> - Update comments (Andrew)
> >>> - Move callback related variables under corresponding ifdefs (Andrew)
> >>> - Few nits in rte_eth_macaddrs_get (Andrew)
> >>> - Rebased on top of next-net tree
> >>>
> >>> v5 changes:
> >>> - Fix spelling (Thomas/David)
> >>> - Rename internal helper functions (David)
> >>> - Reorder patches and update commit messages (Thomas)
> >>> - Update comments (Thomas)
> >>> - Changed layout in rte_eth_fp_ops, to group functions and
> >>> related data based on their functionality:
> >>> first 64B line for Rx, second one for Tx.
> >>> Didn't observe any real performance difference comparing to
> >>> original layout. Though decided to keep a new one, as it seems
> >>> a bit more plausible.
> >>>
> >>> v4 changes:
> >>> - Fix secondary process attach (Pavan)
> >>> - Fix build failure (Ferruh)
> >>> - Update lib/ethdev/verion.map (Ferruh)
> >>> Note that moving newly added symbols from EXPERIMENTAL to DPDK_22
> >>> section makes checkpatch.sh to complain.
> >>>
> >>> v3 changes:
> >>> - Changes in public struct naming (Jerin/Haiyue)
> >>> - Split patches
> >>> - Update docs
> >>> - Shamelessly included Andrew's patch:
> >>> https://patches.dpdk.org/project/dpdk/patch/20210928154856.1015020-
> >> 1-andrew.rybchenko@oktetlabs.ru/
> >>> into these series.
> >>> I have to do similar thing here, so decided to avoid duplicated effort.
> >>>
> >>> The aim of these patch series is to make rte_ethdev core data structures
> >>> (rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback, etc.) internal to
> >>> DPDK and not visible to the user.
> >>> That should allow future possible changes to core ethdev related structures
> >>> to be transparent to the user and help to improve ABI/API stability.
> >>> Note that current ethdev API is preserved, but it is a formal ABI break.
> >>>
> >>> The work is based on previous discussions at:
> >>> https://www.mail-archive.com/dev@dpdk.org/msg211405.html
> >>> https://www.mail-archive.com/dev@dpdk.org/msg216685.html
> >>> and consists of the following main points:
> >>> 1. Copy public 'fast' function pointers (rx_pkt_burst(), etc.) and
> >>> related data pointer from rte_eth_dev into a separate flat array.
> >>> We keep it public to still be able to use inline functions for these
> >>> 'fast' calls (like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown.
> >>> Note that apart from function pointers itself, each element of this
> >>> flat array also contains two opaque pointers for each ethdev:
> >>> 1) a pointer to an array of internal queue data pointers
> >>> 2) points to array of queue callback data pointers.
> >>> Note that exposing this extra information allows us to avoid extra
> >>> changes inside PMD level, plus should help to avoid possible
> >>> performance degradation.
> >>> 2. Change implementation of 'fast' inline ethdev functions
> >>> (rte_eth_rx_burst(), etc.) to use new public flat array.
> >>> While it is an ABI breakage, this change is intended to be transparent
> >>> for both users (no changes in user app is required) and PMD developers
> >>> (no changes in PMD is required).
> >>> One extra note - with new implementation RX/TX callback invocation
> >>> will cost one extra function call with this changes. That might cause
> >>> some slowdown for code-path with RX/TX callbacks heavily involved.
> >>> Hope such trade-off is acceptable for the community.
> >>> 3. Move rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback and
> >> related
> >>> things into internal header: <ethdev_driver.h>.
> >>>
> >>> That approach was selected to:
> >>> - Avoid(/minimize) possible performance losses.
> >>> - Minimize required changes inside PMDs.
> >>>
> >>> Performance testing results (ICX 2.0GHz, E810 (ice)):
> >>> - testpmd macswap fwd mode, plus
> >>> a) no RX/TX callbacks:
> >>> no actual slowdown observed
> >>> b) bpf-load rx 0 0 JM ./dpdk.org/examples/bpf/t3.o:
> >>> ~2% slowdown
> >>> - l3fwd: no actual slowdown observed
> >>>
> >>> Would like to thank everyone who already reviewed and tested previous
> >>> versions of these series. All other interested parties please don't be shy
> >>> and provide your feedback.
> >>>
> >>> Konstantin Ananyev (6):
> >>> ethdev: allocate max space for internal queue array
> >>> ethdev: change input parameters for rx_queue_count
> >>> ethdev: copy fast-path API into separate structure
> >>> ethdev: make fast-path functions to use new flat array
> >>> ethdev: add API to retrieve multiple ethernet addresses
> >>> ethdev: hide eth dev related structures
> >>>
> >>
> >> For series,
> >> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> >>
> >> No performance regression detected on my testing.
> >>
> >> I am merging the series to next-net now which helps testing,
> >> but before merging to main repo it will be good to get more
> >> ack and test results (I can squash new tags later).
> >>
> >> @Jerin, @Ajit, @Raslan, @Andrew, @Qi, @Honnappa,
> >> Can you please test this set for any possible regression?
> >>
> >> Series applied to dpdk-next-net/main, thanks.
> >>
> >
> > Tested (on dpdk-next-net/main) single and multi-core packet forwarding performance with testpmd on both ConnectX-5 and ConnectX-6 Dx. I didn't see any noticeable regressions.
> >
>
> Thanks!
>
> At this stage I am putting set to pull request for main repo.
> Last day for anyone who wants to test the set.
I tested dpdk-next-net/main. My testing was limited and did not reveal
any issues.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2021-10-18 23:47 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <0211007112750.25526-1-konstantin.ananyev@intel.com>
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 0/6] hide eth dev related structures Konstantin Ananyev
2021-10-13 13:36 ` [dpdk-dev] [PATCH v6 1/6] ethdev: allocate max space for internal queue array Konstantin Ananyev
2021-10-13 14:20 ` Andrew Rybchenko
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 2/6] ethdev: change input parameters for rx_queue_count Konstantin Ananyev
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 3/6] ethdev: copy fast-path API into separate structure Konstantin Ananyev
2021-10-13 14:25 ` Andrew Rybchenko
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 4/6] ethdev: make fast-path functions to use new flat array Konstantin Ananyev
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 5/6] ethdev: add API to retrieve multiple ethernet addresses Konstantin Ananyev
2021-10-13 14:31 ` Andrew Rybchenko
2021-10-13 18:58 ` Ferruh Yigit
2021-10-13 13:37 ` [dpdk-dev] [PATCH v6 6/6] ethdev: hide eth dev related structures Konstantin Ananyev
2021-10-13 14:32 ` Andrew Rybchenko
2021-10-13 20:16 ` [dpdk-dev] [PATCH v6 0/6] " Ferruh Yigit
2021-10-14 10:12 ` [dpdk-dev] 回复: " Feifei Wang
2021-10-18 16:04 ` [dpdk-dev] " Ali Alnubani
2021-10-18 16:47 ` Ferruh Yigit
2021-10-18 23:47 ` Ajit Khaparde
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).