DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Jie Liu <liujie5@linkdatatechnology.com>
Subject: [PATCH v3 10/16] net/sxe2: remove queue stats mapping
Date: Thu, 13 Aug 2026 10:55:09 -0700	[thread overview]
Message-ID: <20260813180402.622784-11-stephen@networkplumber.org> (raw)
In-Reply-To: <20260813180402.622784-1-stephen@networkplumber.org>

The queue stats mapping API is removed in 26.11. Drop the
.queue_stats_mapping_set op and the SXE2_DEV_CAPS_OFFLOAD_Q_MAP
handling, along with the now-unused mapping init/reset helpers.

Per-queue stats are now reported one entry per configured queue
rather than one entry per stat mapping pool, so convert the
multi-process path as well. The qstats member of the shared payload
becomes an array large enough for every queue the primary can
report, and the secondary copies back the queue count in use
instead of a single entry.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/sxe2/sxe2_cmd_chnl.c | 99 --------------------------------
 drivers/net/sxe2/sxe2_cmd_chnl.h | 10 ----
 drivers/net/sxe2/sxe2_ethdev.c   |  5 --
 drivers/net/sxe2/sxe2_mp.c       | 18 +++++-
 drivers/net/sxe2/sxe2_mp.h       |  7 ++-
 drivers/net/sxe2/sxe2_stats.c    | 76 +-----------------------
 drivers/net/sxe2/sxe2_stats.h    |  5 --
 7 files changed, 24 insertions(+), 196 deletions(-)

diff --git a/drivers/net/sxe2/sxe2_cmd_chnl.c b/drivers/net/sxe2/sxe2_cmd_chnl.c
index b09989fe50..050488301c 100644
--- a/drivers/net/sxe2/sxe2_cmd_chnl.c
+++ b/drivers/net/sxe2/sxe2_cmd_chnl.c
@@ -1609,105 +1609,6 @@ int32_t sxe2_drv_queue_info_get_update(struct sxe2_adapter *adapter, struct eth_
 	return ret;
 }
 
-int32_t sxe2_drv_rxq_mapping_set(struct rte_eth_dev *eth_dev, uint16_t queue_id, uint8_t pool_idx)
-{
-	struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(eth_dev);
-	int32_t ret = 0;
-	struct sxe2_common_device *cdev = adapter->cdev;
-	struct sxe2_drv_cmd_params param = {0};
-	struct sxe2_drv_rx_map_req req = {0};
-	struct sxe2_rx_queue *rxq = NULL;
-
-	rxq = eth_dev->data->rx_queues[queue_id];
-	if (rxq == NULL) {
-		PMD_LOG_ERR(DRV, "Rx queue %u is not available or setup",
-				queue_id);
-		ret = -EINVAL;
-		goto l_end;
-	}
-
-	req.queue_id = rxq->queue_id;
-	req.pool_idx = pool_idx;
-
-	sxe2_drv_cmd_params_fill(adapter, &param, SXE2_DRV_CMD_RX_MAP_SET,
-				 &req, sizeof(req),
-				 NULL, 0);
-
-	ret = sxe2_drv_cmd_exec(cdev, &param);
-	if (ret)
-		PMD_LOG_ERR(DRV, "get dev caps failed, ret=%d", ret);
-
-l_end:
-	return ret;
-}
-
-int32_t sxe2_drv_txq_mapping_set(struct rte_eth_dev *eth_dev, uint16_t queue_id, uint8_t pool_idx)
-{
-	struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(eth_dev);
-	int32_t ret = 0;
-	struct sxe2_common_device *cdev = adapter->cdev;
-	struct sxe2_drv_cmd_params param = {0};
-	struct sxe2_drv_tx_map_req req = {0};
-	struct sxe2_tx_queue *txq = NULL;
-
-	txq = eth_dev->data->tx_queues[queue_id];
-	if (txq == NULL) {
-		PMD_LOG_ERR(DRV, "Rx queue %u is not available or setup", queue_id);
-		ret = -EINVAL;
-		goto l_end;
-	}
-
-	req.queue_id = txq->queue_id;
-	req.pool_idx = pool_idx;
-
-	sxe2_drv_cmd_params_fill(adapter, &param, SXE2_DRV_CMD_TX_MAP_SET,
-				 &req, sizeof(req),
-				 NULL, 0);
-
-	ret = sxe2_drv_cmd_exec(cdev, &param);
-	if (ret)
-		PMD_LOG_ERR(DRV, "get dev caps failed, ret=%d", ret);
-
-l_end:
-	return ret;
-}
-
-int32_t sxe2_drv_mapping_reset(struct rte_eth_dev *eth_dev)
-{
-	struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(eth_dev);
-	struct sxe2_drv_cmd_params param = {0};
-	struct sxe2_common_device *cdev = adapter->cdev;
-	int32_t ret;
-
-	sxe2_drv_cmd_params_fill(adapter, &param, SXE2_DRV_CMD_TX_RX_MAP_RESET,
-				 NULL, 0,
-				 NULL, 0);
-
-	ret = sxe2_drv_cmd_exec(cdev, &param);
-	if (ret)
-		PMD_LOG_ERR(DRV, "Reset queue mapping failed, ret=%d", ret);
-
-	return ret;
-}
-
-int32_t sxe2_drv_mapping_stats_info_clear(struct rte_eth_dev *eth_dev)
-{
-	struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(eth_dev);
-	struct sxe2_drv_cmd_params param = {0};
-	struct sxe2_common_device *cdev = adapter->cdev;
-	int32_t ret;
-
-	sxe2_drv_cmd_params_fill(adapter, &param, SXE2_DRV_CMD_TX_RX_MAP_INFO_CLEAR,
-				 NULL, 0,
-				 NULL, 0);
-
-	ret = sxe2_drv_cmd_exec(cdev, &param);
-	if (ret)
-		PMD_LOG_ERR(DRV, "Clear map stats info failed, ret=%d", ret);
-
-	return ret;
-}
-
 int32_t sxe2_drv_flow_filter_add(struct sxe2_adapter *adapter, struct sxe2_flow *flow)
 {
 	struct sxe2_drv_flow_filter_req req = { 0 };
diff --git a/drivers/net/sxe2/sxe2_cmd_chnl.h b/drivers/net/sxe2/sxe2_cmd_chnl.h
index d63caad526..f43dcc8e7a 100644
--- a/drivers/net/sxe2/sxe2_cmd_chnl.h
+++ b/drivers/net/sxe2/sxe2_cmd_chnl.h
@@ -102,16 +102,6 @@ int32_t sxe2_drv_queue_info_get_update(struct sxe2_adapter *adapter,
 int32_t sxe2_drv_fc_state_get(struct sxe2_adapter *adapter,
 			      struct sxe2_drv_vsi_fc_get_resp *dev_fc_state_resp);
 
-int32_t sxe2_drv_rxq_mapping_set(struct rte_eth_dev *eth_dev, uint16_t queue_id, uint8_t pool_idx);
-
-int32_t sxe2_drv_txq_mapping_set(struct rte_eth_dev *eth_dev, uint16_t queue_id, uint8_t pool_idx);
-
-int32_t sxe2_drv_mapping_reset(struct rte_eth_dev *eth_dev);
-
-int32_t sxe2_drv_mapping_stats_info_clear(struct rte_eth_dev *eth_dev);
-
-int32_t sxe2_drv_rxq_mapping_set(struct rte_eth_dev *eth_dev, uint16_t queue_id, uint8_t pool_idx);
-
 int32_t sxe2_drv_allmulti_config(struct sxe2_adapter *adapter, bool set);
 
 int32_t sxe2_drv_uc_config(struct sxe2_adapter *adapter, struct rte_ether_addr *addr, bool add);
diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c
index 8bbfdc3a15..440411a65a 100644
--- a/drivers/net/sxe2/sxe2_ethdev.c
+++ b/drivers/net/sxe2/sxe2_ethdev.c
@@ -194,8 +194,6 @@ static const struct eth_dev_ops sxe2_eth_dev_ops = {
 	.xstats_get_names           = sxe2_xstats_names_get,
 	.xstats_reset               = sxe2_stats_info_reset,
 
-	.queue_stats_mapping_set    = sxe2_queue_stats_mapping_set,
-
 	.fw_version_get             = sxe2_fw_version_string_get,
 
 	.get_monitor_addr           = sxe2_get_monitor_addr,
@@ -1309,9 +1307,6 @@ static void sxe2_drv_dev_caps_set(struct sxe2_adapter *adapter,
 	if (dev_caps->cap_flags & SXE2_DEV_CAPS_OFFLOAD_PTP)
 		adapter->cap_flags |= SXE2_DEV_CAPS_OFFLOAD_PTP;
 
-	if (dev_caps->cap_flags & SXE2_DEV_CAPS_OFFLOAD_Q_MAP)
-		adapter->cap_flags |= SXE2_DEV_CAPS_OFFLOAD_Q_MAP;
-
 	if (dev_caps->cap_flags & SXE2_DEV_CAPS_OFFLOAD_FC_STATE)
 		adapter->cap_flags |= SXE2_DEV_CAPS_OFFLOAD_FC_STATE;
 }
diff --git a/drivers/net/sxe2/sxe2_mp.c b/drivers/net/sxe2/sxe2_mp.c
index a9598b6dd6..298a95ac7a 100644
--- a/drivers/net/sxe2/sxe2_mp.c
+++ b/drivers/net/sxe2/sxe2_mp.c
@@ -15,6 +15,11 @@
 #include "sxe2_stats.h"
 #include "sxe2_common_log.h"
 
+/* The shared qstats array must hold every queue the primary may write. */
+static_assert(SXE2_RXQ_STATS_MAP_MAX_NUM <= SXE2_MP_MAX_QSTATS &&
+	      SXE2_TXQ_STATS_MAP_MAX_NUM <= SXE2_MP_MAX_QSTATS,
+	      "shared qstats array too small for per-queue stats");
+
 static RTE_ATOMIC(uint16_t)primary_ethdev_cnt;
 static RTE_ATOMIC(uint16_t)secondary_ethdev_cnt;
 static const struct rte_memzone *sxe2_mp_mz;
@@ -65,9 +70,11 @@ sxe2_mp_primary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
 
 	switch (param->type) {
 	case SXE2_MP_REQ_GET_STATS:
+		memset(mz_data->payload.stats_blk.qstats, 0,
+		       sizeof(mz_data->payload.stats_blk.qstats));
 		ret = sxe2_stats_info_get(dev,
 					  &mz_data->payload.stats_blk.stats,
-					  &mz_data->payload.stats_blk.qstats);
+					  mz_data->payload.stats_blk.qstats);
 		break;
 	case SXE2_MP_REQ_GET_XSTATS:
 		cnt = sxe2_xstats_info_get(dev,
@@ -325,8 +332,13 @@ int32_t sxe2_mp_req_get_stats(struct rte_eth_dev *dev,
 
 	mz_data = (struct sxe2_mp_shared_data *)sxe2_mp_mz->addr;
 	memcpy(stats, &mz_data->payload.stats_blk.stats, sizeof(*stats));
-	if (qstats != NULL)
-		memcpy(qstats, &mz_data->payload.stats_blk.qstats, sizeof(*qstats));
+	if (qstats != NULL) {
+		uint16_t nb_queues = RTE_MAX(dev->data->nb_rx_queues,
+					     dev->data->nb_tx_queues);
+
+		memcpy(qstats, mz_data->payload.stats_blk.qstats,
+		       RTE_MIN(nb_queues, SXE2_MP_MAX_QSTATS) * sizeof(*qstats));
+	}
 	PMD_LOG_DEBUG(DRV, "sxe2_mp: stats received via IPC for port %u",
 			  dev->data->port_id);
 	ret = 0;
diff --git a/drivers/net/sxe2/sxe2_mp.h b/drivers/net/sxe2/sxe2_mp.h
index da9cc91d8d..aafe3cb1ba 100644
--- a/drivers/net/sxe2/sxe2_mp.h
+++ b/drivers/net/sxe2/sxe2_mp.h
@@ -10,6 +10,8 @@
 #include <rte_memzone.h>
 #include <rte_stdatomic.h>
 
+#include "sxe2_drv_cmd.h"
+
 #define SXE2_MP_NAME		"sxe2_mp_msg"
 #define SXE2_MP_MZ_NAME		"sxe2_stats_mz"
 
@@ -17,6 +19,9 @@
 
 #define SXE2_MP_MAX_XSTATS	128
 
+/* Must cover every queue the primary can report per-queue stats for. */
+#define SXE2_MP_MAX_QSTATS	SXE2_TXQ_STATS_MAP_MAX_NUM
+
 #define SXE2_MP_MAX_SPIN	100000
 
 enum sxe2_mp_req_type {
@@ -34,7 +39,7 @@ struct sxe2_mp_param {
 union sxe2_mp_shared_payload {
 	struct {
 		struct rte_eth_stats stats;
-		struct eth_queue_stats qstats;
+		struct eth_queue_stats qstats[SXE2_MP_MAX_QSTATS];
 	} stats_blk;
 	struct {
 		struct rte_eth_xstat xstats[SXE2_MP_MAX_XSTATS];
diff --git a/drivers/net/sxe2/sxe2_stats.c b/drivers/net/sxe2/sxe2_stats.c
index 0e4857a906..74a2594099 100644
--- a/drivers/net/sxe2/sxe2_stats.c
+++ b/drivers/net/sxe2/sxe2_stats.c
@@ -499,90 +499,20 @@ int32_t sxe2_stats_hw_reset(struct rte_eth_dev *dev)
 
 int32_t sxe2_stats_info_reset(struct rte_eth_dev *dev)
 {
-	int32_t ret;
-	struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(dev);
-
 	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
 		return sxe2_mp_req_reset_stats(dev);
 
-	if (adapter->cap_flags & SXE2_DEV_CAPS_OFFLOAD_Q_MAP) {
-		ret = sxe2_drv_mapping_stats_info_clear(dev);
-		if (ret)
-			goto l_end;
-	}
-
-	ret = sxe2_stats_hw_reset(dev);
-	if (ret)
-		goto l_end;
-
-l_end:
-	return ret;
+	return sxe2_stats_hw_reset(dev);
 }
 
 int32_t sxe2_stats_init(struct rte_eth_dev *dev)
 {
 	PMD_INIT_FUNC_TRACE();
-	int32_t ret;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	ret = sxe2_queue_stats_map_init(dev);
-	if (ret)
-		goto l_end;
-
-	ret = sxe2_stats_hw_reset(dev);
-	if (ret)
-		goto l_end;
-
-l_end:
-	return ret;
-}
-
-int32_t sxe2_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
-				  uint16_t queue_id, uint8_t pool_idx, uint8_t is_rx)
-{
-	int32_t ret = -1;
-	struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(eth_dev);
-
-	if (!(adapter->cap_flags & SXE2_DEV_CAPS_OFFLOAD_Q_MAP)) {
-		PMD_LOG_ERR(DRV, "VF does not support queue mapping! ");
-		goto l_end;
-	}
-
-	if (is_rx)
-		ret = sxe2_drv_rxq_mapping_set(eth_dev, queue_id, pool_idx);
-	else
-		ret = sxe2_drv_txq_mapping_set(eth_dev, queue_id, pool_idx);
-
-	if (ret) {
-		PMD_LOG_ERR(DRV, "Queue stats mapping failed ! "
-			"queue_id:%u pool_idx:%u", queue_id, pool_idx);
-		goto l_end;
-	}
-
-	PMD_LOG_DEBUG(DRV, "port %u %s queue_id %d stat map to pool[%u] ",
-		     (uint16_t)(eth_dev->data->port_id), is_rx ? "RX" : "TX",
-		     queue_id, pool_idx);
-l_end:
-	return ret;
-}
+	dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
-int32_t sxe2_queue_stats_map_init(struct rte_eth_dev *dev)
-{
-	int32_t ret = 0;
-	struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(dev);
-
-	if (adapter->cap_flags & SXE2_DEV_CAPS_OFFLOAD_Q_MAP) {
-		dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
-
-		ret = sxe2_drv_mapping_reset(dev);
-		if (ret) {
-			PMD_LOG_ERR(DRV, "Queue stats mapping init failed !");
-			goto l_end;
-		}
-	}
-
-l_end:
-	return ret;
+	return sxe2_stats_hw_reset(dev);
 }
diff --git a/drivers/net/sxe2/sxe2_stats.h b/drivers/net/sxe2/sxe2_stats.h
index 64ac2bb11d..f9cb5a8225 100644
--- a/drivers/net/sxe2/sxe2_stats.h
+++ b/drivers/net/sxe2/sxe2_stats.h
@@ -31,9 +31,4 @@ int32_t sxe2_stats_info_reset(struct rte_eth_dev *dev);
 
 int32_t sxe2_stats_init(struct rte_eth_dev *dev);
 
-int32_t sxe2_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
-				  uint16_t queue_id, uint8_t pool_idx, uint8_t is_rx);
-
-int32_t sxe2_queue_stats_map_init(struct rte_eth_dev *dev);
-
 #endif
-- 
2.53.0


  parent reply	other threads:[~2026-08-13 18:05 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-30 16:09 [RFC 0/7] Complete removal of queue stats mapping Stephen Hemminger
2026-05-30 16:09 ` [RFC 1/7] net/virtio: remove unused " Stephen Hemminger
2026-05-30 16:09 ` [RFC 2/7] net/enic: remove queue_stats_mapping ethdev_op Stephen Hemminger
2026-05-30 16:09 ` [RFC 3/7] net/cnxk: remove queue stats mapping Stephen Hemminger
2026-05-30 16:09 ` [RFC 4/7] net/e1000: " Stephen Hemminger
2026-05-30 16:10 ` [RFC 5/7] net/ixgbe: " Stephen Hemminger
2026-05-30 16:10 ` [RFC 6/7] net/txgbe: " Stephen Hemminger
2026-05-30 16:10 ` [RFC 7/7] ethdev: remove support for " Stephen Hemminger
2026-06-01  1:56   ` fengchengwen
2026-06-01  8:45   ` Andrew Rybchenko
2026-07-23 20:28 ` [PATCH v2 0/9] Complete removal of " Stephen Hemminger
2026-07-23 20:28   ` [PATCH v2 1/9] net/virtio: remove unused " Stephen Hemminger
2026-07-23 20:28   ` [PATCH v2 2/9] app/testpmd: remove unused function prototype Stephen Hemminger
2026-07-23 20:28   ` [PATCH v2 3/9] net/enic: remove unneeded ops initialization Stephen Hemminger
2026-07-24  1:52     ` Hyong Youb Kim (hyonkim)
2026-07-23 20:28   ` [PATCH v2 4/9] net/cnxk: remove queue stats mapping Stephen Hemminger
2026-07-24  7:26     ` David Marchand
2026-07-24 15:20       ` Stephen Hemminger
2026-07-23 20:28   ` [PATCH v2 5/9] net/e1000: " Stephen Hemminger
2026-07-24  7:31     ` David Marchand
2026-08-13 12:26       ` Bruce Richardson
2026-07-23 20:28   ` [PATCH v2 6/9] net/ixgbe: " Stephen Hemminger
2026-07-23 20:28   ` [PATCH v2 7/9] net/txgbe: " Stephen Hemminger
2026-07-23 20:28   ` [PATCH v2 8/9] net/sxe2: " Stephen Hemminger
2026-07-23 20:28   ` [PATCH v2 9/9] ethdev: remove support for " Stephen Hemminger
2026-07-24  7:39   ` [PATCH v2 0/9] Complete removal of " David Marchand
2026-07-24  7:42   ` David Marchand
2026-07-24 15:28     ` Stephen Hemminger
2026-08-13 17:54 ` [PATCH v3 00/16] remove stats mapping an RTE_ETHDEV_QUEUE_STAT_CNTRS Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 01/16] net/virtio: remove unused queue stats mapping Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 02/16] app/testpmd: remove leftover set qmap Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 03/16] net/enic: remove unneeded ops initialization Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 04/16] net/cnxk: fix Tx drops added to Rx queue errors Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 05/16] net/cnxk: remove queue stats mapping Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 06/16] net/e1000: " Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 07/16] net/ixgbe: " Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 08/16] net/txgbe: " Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 09/16] net/sxe2: fix null dereference in stats get Stephen Hemminger
2026-08-13 17:55   ` Stephen Hemminger [this message]
2026-08-13 17:55   ` [PATCH v3 11/16] ethdev: remove support for queue stats mapping Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 12/16] net/mvpp2: fix out of range Tx queue stats write Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 13/16] net/ntnic: fix Tx errors reported as Rx queue errors Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 14/16] net/xsc: fix Tx errors added to " Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 15/16] ethdev: remove queue stats counter limit Stephen Hemminger
2026-08-13 17:55   ` [PATCH v3 16/16] test/pmd_ring: test per-queue xstats Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260813180402.622784-11-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=liujie5@linkdatatechnology.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox