Skip to contentSkip to conversation

Description: lib/ethdev: change data type in tc_rxq and tc_txq

RFC Superseded Min Hu(Connor) 7 participants 64 messages Aug 31, 2020 – Oct 12, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

RFC v4 1/2 Description: lib/ethdev: change data type in tc_rxq and tc_txq

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these datas will be truncated when queue number under a TC is greater than 256. So it is necessay for base and nb_queue to change from uint8_t to uint16_t.

Fixes 01eb53eefeb40e8 ("ethdev: rename folder to library name")
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_ethdev/rte_ethdev.h +4 -4
index ff82771..f51a688 100644
@@ -1489,13 +1489,13 @@ struct rte_eth_xstat_name {
 struct rte_eth_dcb_tc_queue_mapping {
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 };
 
Signature · 1 line
2.7.4
#1 lore raw

RFC v4 1/2 ethdev: change data type in TC rxq and TC txq

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these datas will be truncated when queue number under a TC is greater than 256. So it is necessay for base and nb_queue to change from uint8_t to uint16_t.

Fixes 01eb53eefeb40e8 ("ethdev: rename folder to library name")
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_ethdev/rte_ethdev.h +4 -4
index ff82771..f51a688 100644
@@ -1489,13 +1489,13 @@ struct rte_eth_xstat_name {
 struct rte_eth_dcb_tc_queue_mapping {
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 };
 
Signature · 1 line
2.7.4
#2 lore raw

RFC v4 2/2 ethdev: fix compiling errors for per-queue statistics

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
---
 app/test-pmd/cmdline.c              | 2 +-
 app/test-pmd/config.c               | 4 ++--
 app/test-pmd/testpmd.c              | 2 +-
 app/test-pmd/testpmd.h              | 5 +++--
 drivers/net/igc/igc_ethdev.c        | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c    | 4 ++--
 drivers/net/memif/rte_eth_memif.c   | 2 +-
 drivers/net/octeontx2/otx2_ethdev.h | 2 +-
 drivers/net/octeontx2/otx2_stats.c  | 2 +-
 drivers/net/virtio/virtio_ethdev.c  | 4 ++--
 lib/librte_ethdev/rte_ethdev.c      | 6 +++---
 lib/librte_ethdev/rte_ethdev.h      | 4 ++--
 lib/librte_ethdev/rte_ethdev_core.h | 2 +-
 13 files changed, 22 insertions(+), 21 deletions(-)
app/test-pmd/cmdline.c +1 -1
index 0a6ed85..40b6b17 100644
@@ -8244,7 +8244,7 @@ struct cmd_set_qmap_result {
 	cmdline_fixed_string_t what;
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
 };
 
 static void
app/test-pmd/config.c +2 -2
index 30bee33..9e7526d 100644
@@ -160,7 +160,7 @@ nic_stats_display(portid_t port_id)
 	uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
 	struct rte_eth_stats stats;
 	struct rte_port *port = &ports[port_id];
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
@@ -3623,7 +3623,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
 }
 
 void
-set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
+set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint16_t map_value)
 {
 	uint16_t i;
 	uint8_t existing_mapping_found = 0;
app/test-pmd/testpmd.c +1 -1
index 7842c3b..d5503bc 100644
@@ -1835,7 +1835,7 @@ fwd_stats_display(void)
 #endif
 	}
 	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-		uint8_t j;
+		uint16_t j;
 
 		pt_id = fwd_ports_ids[i];
 		port = &ports[pt_id];
app/test-pmd/testpmd.h +3 -2
index 25a12b1..4ac87b0 100644
@@ -285,7 +285,7 @@ enum dcb_mode_enable
 struct queue_stats_mappings {
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t stats_counter_id;
+	uint16_t stats_counter_id;
 } __rte_cache_aligned;
 
 extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
@@ -768,7 +768,8 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
 void tx_vlan_reset(portid_t port_id);
 void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
 
-void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
+void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id,
+	      uint16_t map_value);
 
 void set_xstats_hide_zero(uint8_t on_off);
 
drivers/net/igc/igc_ethdev.c +2 -2
index 6ab3ee9..7211505 100644
@@ -221,7 +221,7 @@ static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-	uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
+	uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx);
 static int
 eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -2076,7 +2076,7 @@ eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-		uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
+		uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx)
 {
 	struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
 
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index fd0cb9b..8c418f5 100644
@@ -178,7 +178,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
 	unsigned int limit);
 static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 				 size_t fw_size);
@@ -897,7 +897,7 @@ ixgbe_reset_qstat_mappings(struct ixgbe_hw *hw)
 static int
 ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id,
-				  uint8_t stat_idx,
+				  uint16_t stat_idx,
 				  uint8_t is_rx)
 {
 #define QSM_REG_NB_BITS_PER_QMAP_FIELD 8
drivers/net/memif/rte_eth_memif.c +1 -1
index c1c7e9f..696475c 100644
@@ -1341,7 +1341,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct memif_queue *mq;
 	int i;
-	uint8_t tmp, nq;
+	uint16_t tmp, nq;
 
 	stats->ipackets = 0;
 	stats->ibytes = 0;
drivers/net/octeontx2/otx2_ethdev.h +1 -1
index e9efe52..8c1cf78 100644
@@ -476,7 +476,7 @@ int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
 int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
-				 uint16_t queue_id, uint8_t stat_idx,
+				 uint16_t queue_id, uint16_t stat_idx,
 				 uint8_t is_rx);
 int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
 			struct rte_eth_xstat *xstats, unsigned int n);
drivers/net/octeontx2/otx2_stats.c +1 -1
index 8aaf270..6efe122 100644
@@ -145,7 +145,7 @@ otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
 int
 otx2_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
-			     uint8_t stat_idx, uint8_t is_rx)
+			     uint16_t stat_idx, uint8_t is_rx)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 
drivers/net/virtio/virtio_ethdev.c +2 -2
index dc0093b..8144bb2 100644
@@ -82,7 +82,7 @@ static int virtio_intr_disable(struct rte_eth_dev *dev);
 static int virtio_dev_queue_stats_mapping_set(
 	struct rte_eth_dev *eth_dev,
 	uint16_t queue_id,
-	uint8_t stat_idx,
+	uint16_t stat_idx,
 	uint8_t is_rx);
 
 static void virtio_notify_peers(struct rte_eth_dev *dev);
@@ -2647,7 +2647,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
  */
 static int
 virtio_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *eth_dev,
-__rte_unused uint16_t queue_id, __rte_unused uint8_t stat_idx,
+__rte_unused uint16_t queue_id, __rte_unused uint16_t stat_idx,
 __rte_unused uint8_t is_rx)
 {
 	return 0;
lib/librte_ethdev/rte_ethdev.c +3 -3
index 0a96718..74dadb8 100644
@@ -2905,7 +2905,7 @@ rte_eth_xstats_reset(uint16_t port_id)
 }
 
 static int
-set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint16_t stat_idx,
 		uint8_t is_rx)
 {
 	struct rte_eth_dev *dev;
@@ -2932,7 +2932,7 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 
 int
 rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, tx_queue_id,
 						stat_idx, STAT_QMAP_TX));
@@ -2941,7 +2941,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
 
 int
 rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, rx_queue_id,
 						stat_idx, STAT_QMAP_RX));
lib/librte_ethdev/rte_ethdev.h +2 -2
index f51a688..71c4662 100644
@@ -2621,7 +2621,7 @@ int rte_eth_xstats_reset(uint16_t port_id);
  *   Zero if successful. Non-zero otherwise.
  */
 int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);
 
 /**
  *  Set a mapping for the specified receive queue to the specified per-queue
@@ -2642,7 +2642,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
  */
 int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
 					   uint16_t rx_queue_id,
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);
 
 /**
  * Retrieve the Ethernet address of an Ethernet device.
lib/librte_ethdev/rte_ethdev_core.h +1 -1
index 1f2c414..e42f280 100644
@@ -223,7 +223,7 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
 
 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 
Signature · 1 line
2.7.4
#3 lore raw

Re: [dpdk-dev] [RFC 2/2] ethdev: fix compiling errors for per-queue statistics

Quoted 25 lines · On Tue, 1 Sep 2020 09:33:18 +0800 "Min Hu (Connor)" <[email protected]> wrote:

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
Quoted 4 lines

---

This looks like a reasonable way to address this.
But it does break the API, and it wasn't announced previously. Since it is minor and compatible change I am ok with doing it for 20.11. Please update the release notes.

#4 lore raw

cover ethdev: change the queue ID type

In reply to Min Hu (Connor)

This series are minor change the queue ID type from uint8_t to uint16_t.

Huisong Li (2):
ethdev: change data type in TC rxq and TC txq
ethdev: fix compiling errors for per-queue statistics

Min Hu (Connor) (2):
doc: announce modified field in DCB TC queue mapping
doc: announce modified field in ethdev API

 app/test-pmd/cmdline.c                 |  2 +-
 app/test-pmd/config.c                  |  4 ++--
 app/test-pmd/testpmd.c                 |  2 +-
 app/test-pmd/testpmd.h                 |  5 +++--
 doc/guides/rel_notes/release_20_11.rst |  7 +++++++
 drivers/net/igc/igc_ethdev.c           |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/memif/rte_eth_memif.c      |  2 +-
 drivers/net/octeontx2/otx2_ethdev.h    |  2 +-
 drivers/net/octeontx2/otx2_stats.c     |  2 +-
 drivers/net/virtio/virtio_ethdev.c     |  4 ++--
 lib/librte_ethdev/rte_ethdev.c         |  6 +++---
 lib/librte_ethdev/rte_ethdev.h         | 12 ++++++------
 lib/librte_ethdev/rte_ethdev_core.h    |  2 +-
 14 files changed, 33 insertions(+), 25 deletions(-)
Signature · 1 line
2.7.4
#5 lore raw

PATCH 1/4 ethdev: change data type in TC rxq and TC txq

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these datas will be truncated when queue number under a TC is greater than 256. So it is necessay for base and nb_queue to change from uint8_t to uint16_t.

Fixes 01eb53eefeb40e8 ("ethdev: rename folder to library name")
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_ethdev/rte_ethdev.h +4 -4
index 70295d7..b0114bb 100644
@@ -1489,13 +1489,13 @@ struct rte_eth_xstat_name {
 struct rte_eth_dcb_tc_queue_mapping {
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 };
 
Signature · 1 line
2.7.4
#6 lore raw

v2 cover ethdev: change the queue ID type

This series are minor change the queue ID type from uint8_t to uint16_t.

Huisong Li (2):
ethdev: fix compiling errors for per-queue statistics
ethdev: change data type in TC rxq and TC txq

Min Hu (Connor) (2):
doc: announce modified field in DCB TC queue mapping
doc: announce modified field in ethdev API

 app/proc-info/main.c                   |  2 +-
 app/test-pmd/cmdline.c                 |  2 +-
 app/test-pmd/config.c                  |  4 ++--
 app/test-pmd/testpmd.c                 |  2 +-
 app/test-pmd/testpmd.h                 |  5 +++--
 doc/guides/rel_notes/release_20_11.rst |  7 +++++++
 drivers/net/igc/igc_ethdev.c           |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/memif/rte_eth_memif.c      |  2 +-
 drivers/net/octeontx2/otx2_ethdev.h    |  2 +-
 drivers/net/octeontx2/otx2_stats.c     |  2 +-
 drivers/net/virtio/virtio_ethdev.c     |  4 ++--
 lib/librte_ethdev/rte_ethdev.c         |  6 +++---
 lib/librte_ethdev/rte_ethdev.h         | 12 ++++++------
 lib/librte_ethdev/rte_ethdev_core.h    |  2 +-
 15 files changed, 34 insertions(+), 26 deletions(-)
Signature · 1 line
2.7.4
#7 lore raw

PATCH v2 1/4 ethdev: fix compiling errors for per-queue statistics

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
---
 app/proc-info/main.c                | 2 +-
 app/test-pmd/cmdline.c              | 2 +-
 app/test-pmd/config.c               | 4 ++--
 app/test-pmd/testpmd.c              | 2 +-
 app/test-pmd/testpmd.h              | 5 +++--
 drivers/net/igc/igc_ethdev.c        | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c    | 4 ++--
 drivers/net/memif/rte_eth_memif.c   | 2 +-
 drivers/net/octeontx2/otx2_ethdev.h | 2 +-
 drivers/net/octeontx2/otx2_stats.c  | 2 +-
 drivers/net/virtio/virtio_ethdev.c  | 4 ++--
 lib/librte_ethdev/rte_ethdev.c      | 6 +++---
 lib/librte_ethdev/rte_ethdev.h      | 4 ++--
 lib/librte_ethdev/rte_ethdev_core.h | 2 +-
 14 files changed, 23 insertions(+), 22 deletions(-)
app/proc-info/main.c +1 -1
index abeca4a..2c70c33 100644
@@ -348,7 +348,7 @@ static void
 nic_stats_display(uint16_t port_id)
 {
 	struct rte_eth_stats stats;
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
app/test-pmd/cmdline.c +1 -1
index 0a6ed85..40b6b17 100644
@@ -8244,7 +8244,7 @@ struct cmd_set_qmap_result {
 	cmdline_fixed_string_t what;
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
 };
 
 static void
app/test-pmd/config.c +2 -2
index 30bee33..9e7526d 100644
@@ -160,7 +160,7 @@ nic_stats_display(portid_t port_id)
 	uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
 	struct rte_eth_stats stats;
 	struct rte_port *port = &ports[port_id];
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
@@ -3623,7 +3623,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
 }
 
 void
-set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
+set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint16_t map_value)
 {
 	uint16_t i;
 	uint8_t existing_mapping_found = 0;
app/test-pmd/testpmd.c +1 -1
index 7842c3b..d5503bc 100644
@@ -1835,7 +1835,7 @@ fwd_stats_display(void)
 #endif
 	}
 	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-		uint8_t j;
+		uint16_t j;
 
 		pt_id = fwd_ports_ids[i];
 		port = &ports[pt_id];
app/test-pmd/testpmd.h +3 -2
index 25a12b1..4ac87b0 100644
@@ -285,7 +285,7 @@ enum dcb_mode_enable
 struct queue_stats_mappings {
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t stats_counter_id;
+	uint16_t stats_counter_id;
 } __rte_cache_aligned;
 
 extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
@@ -768,7 +768,8 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
 void tx_vlan_reset(portid_t port_id);
 void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
 
-void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
+void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id,
+	      uint16_t map_value);
 
 void set_xstats_hide_zero(uint8_t on_off);
 
drivers/net/igc/igc_ethdev.c +2 -2
index 6ab3ee9..7211505 100644
@@ -221,7 +221,7 @@ static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-	uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
+	uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx);
 static int
 eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -2076,7 +2076,7 @@ eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-		uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
+		uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx)
 {
 	struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
 
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index fd0cb9b..8c418f5 100644
@@ -178,7 +178,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
 	unsigned int limit);
 static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 				 size_t fw_size);
@@ -897,7 +897,7 @@ ixgbe_reset_qstat_mappings(struct ixgbe_hw *hw)
 static int
 ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id,
-				  uint8_t stat_idx,
+				  uint16_t stat_idx,
 				  uint8_t is_rx)
 {
 #define QSM_REG_NB_BITS_PER_QMAP_FIELD 8
drivers/net/memif/rte_eth_memif.c +1 -1
index c1c7e9f..696475c 100644
@@ -1341,7 +1341,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct memif_queue *mq;
 	int i;
-	uint8_t tmp, nq;
+	uint16_t tmp, nq;
 
 	stats->ipackets = 0;
 	stats->ibytes = 0;
drivers/net/octeontx2/otx2_ethdev.h +1 -1
index e9efe52..8c1cf78 100644
@@ -476,7 +476,7 @@ int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
 int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
-				 uint16_t queue_id, uint8_t stat_idx,
+				 uint16_t queue_id, uint16_t stat_idx,
 				 uint8_t is_rx);
 int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
 			struct rte_eth_xstat *xstats, unsigned int n);
drivers/net/octeontx2/otx2_stats.c +1 -1
index 8aaf270..6efe122 100644
@@ -145,7 +145,7 @@ otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
 int
 otx2_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
-			     uint8_t stat_idx, uint8_t is_rx)
+			     uint16_t stat_idx, uint8_t is_rx)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 
drivers/net/virtio/virtio_ethdev.c +2 -2
index dc0093b..8144bb2 100644
@@ -82,7 +82,7 @@ static int virtio_intr_disable(struct rte_eth_dev *dev);
 static int virtio_dev_queue_stats_mapping_set(
 	struct rte_eth_dev *eth_dev,
 	uint16_t queue_id,
-	uint8_t stat_idx,
+	uint16_t stat_idx,
 	uint8_t is_rx);
 
 static void virtio_notify_peers(struct rte_eth_dev *dev);
@@ -2647,7 +2647,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
  */
 static int
 virtio_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *eth_dev,
-__rte_unused uint16_t queue_id, __rte_unused uint8_t stat_idx,
+__rte_unused uint16_t queue_id, __rte_unused uint16_t stat_idx,
 __rte_unused uint8_t is_rx)
 {
 	return 0;
lib/librte_ethdev/rte_ethdev.c +3 -3
index 7858ad5..cf1f5d7 100644
@@ -2905,7 +2905,7 @@ rte_eth_xstats_reset(uint16_t port_id)
 }
 
 static int
-set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint16_t stat_idx,
 		uint8_t is_rx)
 {
 	struct rte_eth_dev *dev;
@@ -2932,7 +2932,7 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 
 int
 rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, tx_queue_id,
 						stat_idx, STAT_QMAP_TX));
@@ -2941,7 +2941,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
 
 int
 rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, rx_queue_id,
 						stat_idx, STAT_QMAP_RX));
lib/librte_ethdev/rte_ethdev.h +2 -2
index 70295d7..e073c0e 100644
@@ -2610,7 +2610,7 @@ int rte_eth_xstats_reset(uint16_t port_id);
  *   Zero if successful. Non-zero otherwise.
  */
 int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);
 
 /**
  *  Set a mapping for the specified receive queue to the specified per-queue
@@ -2631,7 +2631,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
  */
 int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
 					   uint16_t rx_queue_id,
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);
 
 /**
  * Retrieve the Ethernet address of an Ethernet device.
lib/librte_ethdev/rte_ethdev_core.h +1 -1
index 32407dd..6061782 100644
@@ -223,7 +223,7 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
 
 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 
Signature · 1 line
2.7.4
#8 lore raw

Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics

Quoted 45 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
---
 app/proc-info/main.c                | 2 +-
 app/test-pmd/cmdline.c              | 2 +-
 app/test-pmd/config.c               | 4 ++--
 app/test-pmd/testpmd.c              | 2 +-
 app/test-pmd/testpmd.h              | 5 +++--
 drivers/net/igc/igc_ethdev.c        | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c    | 4 ++--
 drivers/net/memif/rte_eth_memif.c   | 2 +-
 drivers/net/octeontx2/otx2_ethdev.h | 2 +-
 drivers/net/octeontx2/otx2_stats.c  | 2 +-
 drivers/net/virtio/virtio_ethdev.c  | 4 ++--
 lib/librte_ethdev/rte_ethdev.c      | 6 +++---
 lib/librte_ethdev/rte_ethdev.h      | 4 ++--
 lib/librte_ethdev/rte_ethdev_core.h | 2 +-
 14 files changed, 23 insertions(+), 22 deletions(-)

<...>

app/test-pmd/cmdline.c struct cmd_set_qmap_result { · line 8248

Quoted 11 lines
app/test-pmd/cmdline.c +1 -1
index 0a6ed85..40b6b17 100644
@@ -8244,7 +8244,7 @@ struct cmd_set_qmap_result {
 	cmdline_fixed_string_t what;
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
 };

'cmd_setqmap_mapvalue' should be 'UINT16' instead of 'UINT8', or can't set 'map_value' >= 256 via "set stat_qmap ..." command.

#9 lore raw

Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics

In reply to Min Hu (Connor)
Quoted 25 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
Quoted 4 lines

The patch mostly looks good and it enables build with 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 256.
Only I put a comment for a testpmd change to enable the "set stat_qmap" command for map value > 256.

BUT there are many things to fix in the queue stats mapping, since you are already on it can you help on a few things on testpmd related to it, if you have time for it?

1) Getting queue stats shouldn't require stats mapping, it should be controlled separately. Many PMDs doesn't require/do the stats mapping but they still can collect the per queue stats, which can be displayed independent from mapping.

2) Even you map only one queue, while displaying stats it will display 'RTE_ETHDEV_QUEUE_STAT_CNTRS' queues, and when that number is high it makes hard to see the actual interested values.
If there is no mapping, it should display min(number_of_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS).
If there is mapping it should display queues that mapping done, this may require adding a new 'active' field to 'struct queue_stats_mappings'.

3) Why 'struct queue_stats_mappings' is cache aligned, is it really needed?

4) The mapping arrays, 'tx_queue_stats_mappings_array' & 'rx_queue_stats_mappings_array' are global and their size is based on fixed max port and queue size assumptions, can those mapping array be done per port and 'RTE_ETHDEV_QUEUE_STAT_CNTRS' size per port?

Thanks,
ferruh

#10 lore raw

Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics

04/09/2020 20:31, Ferruh Yigit:

Quoted 53 lines · Min Hu (Connor)
Quoted 25 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
Quoted 4 lines

The patch mostly looks good and it enables build with 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 256.
Only I put a comment for a testpmd change to enable the "set stat_qmap" command for map value > 256.

BUT there are many things to fix in the queue stats mapping, since you are already on it can you help on a few things on testpmd related to it, if you have time for it?

1) Getting queue stats shouldn't require stats mapping, it should be controlled separately. Many PMDs doesn't require/do the stats mapping but they still can collect the per queue stats, which can be displayed independent from mapping.

2) Even you map only one queue, while displaying stats it will display 'RTE_ETHDEV_QUEUE_STAT_CNTRS' queues, and when that number is high it makes hard to see the actual interested values.
If there is no mapping, it should display min(number_of_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS).
If there is mapping it should display queues that mapping done, this may require adding a new 'active' field to 'struct queue_stats_mappings'.

Quoted 6 lines

3) Why 'struct queue_stats_mappings' is cache aligned, is it really needed?

4) The mapping arrays, 'tx_queue_stats_mappings_array' & 'rx_queue_stats_mappings_array' are global and their size is based on fixed max port and queue size assumptions, can those mapping array be done per port and 'RTE_ETHDEV_QUEUE_STAT_CNTRS' size per port?

Yes there are a lot of things to review in this area. For reference, the slides I presented last year:
https://www.dpdk.org/wp-content/uploads/sites/35/2019/10/WhichStandard.pdf

I think we should fix the xstats name "rx_q%u%s" to "rx_q%u_%s".

#11 lore raw

Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics

In reply to Ferruh Yigit
Quoted 53 lines · Ferruh Yigit
Quoted 25 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
Quoted 4 lines

The patch mostly looks good and it enables build with 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 256.
Only I put a comment for a testpmd change to enable the "set stat_qmap" command for map value > 256.

BUT there are many things to fix in the queue stats mapping, since you are already on it can you help on a few things on testpmd related to it, if you have time for it?

1) Getting queue stats shouldn't require stats mapping, it should be controlled separately. Many PMDs doesn't require/do the stats mapping but they still can collect the per queue stats, which can be displayed independent from mapping.

2) Even you map only one queue, while displaying stats it will display 'RTE_ETHDEV_QUEUE_STAT_CNTRS' queues, and when that number is high it makes hard to see the actual interested values.
If there is no mapping, it should display min(number_of_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS).
If there is mapping it should display queues that mapping done, this may require adding a new 'active' field to 'struct queue_stats_mappings'.

Quoted 7 lines

3) Why 'struct queue_stats_mappings' is cache aligned, is it really needed?

4) The mapping arrays, 'tx_queue_stats_mappings_array' & 'rx_queue_stats_mappings_array' are global and their size is based on fixed max port and queue size assumptions, can those mapping array be done per port and 'RTE_ETHDEV_QUEUE_STAT_CNTRS' size per port?

It does seem to be unreasonable. We also try do it, and found that
it is hard to control per queue stats and queue stats mapping, separately. For details, see next V3 patch.
We're working on debugging this stats_mapping setting. During this process, we have a problem that starting testpmd with --rx/tx-queue-stats-mapping parameter fails. log as follows:
[root]$ ./testpmd -l 1,3,4,8,12 -n 4 -w 0000:04:00.0 --file-prefix=lee --log-level=7
-- -i --rxq=6 --txq=6 --burst=64 --rxd=2048 --txd=2048 --nb-cores=4 --rx-queue-stats-mapping=(0,2,2) --tx-queue-stats-mapping=(0,3,3)

-bash: syntax error near unexpected token `('
[root]$

thanks.

Quoted 6 lines

Thanks,
ferruh

.

#12 lore raw

Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics

Quoted 58 lines · Min Hu (Connor)
Quoted 55 lines · Ferruh Yigit
Quoted 25 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
Quoted 4 lines

The patch mostly looks good and it enables build with 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 256.
Only I put a comment for a testpmd change to enable the "set stat_qmap" command for map value > 256.

BUT there are many things to fix in the queue stats mapping, since you are already on it can you help on a few things on testpmd related to it, if you have time for it?

1) Getting queue stats shouldn't require stats mapping, it should be controlled separately. Many PMDs doesn't require/do the stats mapping but they still can collect the per queue stats, which can be displayed independent from mapping.

2) Even you map only one queue, while displaying stats it will display 'RTE_ETHDEV_QUEUE_STAT_CNTRS' queues, and when that number is high it makes hard to see the actual interested values.
If there is no mapping, it should display min(number_of_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS).
If there is mapping it should display queues that mapping done, this may require adding a new 'active' field to 'struct queue_stats_mappings'.

3) Why 'struct queue_stats_mappings' is cache aligned, is it really needed?

Quoted 8 lines
Quoted 5 lines

4) The mapping arrays, 'tx_queue_stats_mappings_array' & 'rx_queue_stats_mappings_array' are global and their size is based on fixed max port and queue size assumptions, can those mapping array be done per port and 'RTE_ETHDEV_QUEUE_STAT_CNTRS' size per port?

It does seem to be unreasonable. We also try do it, and found that it is hard to control per queue stats and queue stats mapping, separately. For details, see next V3 patch.

I will check v3, but as far as know stats mapping exist because of limitations of some NICs, that there are N queues but M stats registers where N > M. So need to map some queues to stat registers, and there is N:1 relation there, so multiple queue stats can be represented in single stat register.

But for rest of the NICs it should be possible to display the queue stats independent from the mapping.

Quoted 10 lines

We're working on debugging this stats_mapping setting. During this process, we have a problem that starting testpmd with --rx/tx-queue-stats-mapping parameter fails. log as follows:
[root]$ ./testpmd -l 1,3,4,8,12 -n 4 -w 0000:04:00.0 --file-prefix=lee --log-level=7
 -- -i --rxq=6 --txq=6 --burst=64 --rxd=2048 --txd=2048 --nb-cores=4 --rx-queue-stats-mapping=(0,2,2) --tx-queue-stats-mapping=(0,3,3)

-bash: syntax error near unexpected token `('
[root]$

Above seems bash error, using '' can help for it, like --rx-queue-stats-mapping='(0,2,2)'

#13 lore raw

Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics

Hi, Ferruh Yigit,

Your method is very practical. Thanks!
But we found that testpmd fails to start with "--rx-queue-stats-mapping" and "--tx-queue-stats-mapping". We've found the cause and modified it. These modifications are being tested.

Currently, the following modifications are related to framework APIs. 1)struct 'rte_eth_dcb_tc_queue_mapping'
2)fix 'rte_eth_dev_set_rx/tx_queue_stats_mapping' function to resolve the problem that DPDK project fails to build when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 256.

According to my current analysis, these modifications for queue stats mapping in testpmd do not involve the modification of framework APIs. Therefore, I think we should give priority to focusing on the current changes to the DPDK framework APIs.

After all, DPDK-20.11 is approaching. What do you think?

Quoted 87 lines · Ferruh Yigit
Quoted 58 lines · Min Hu (Connor)
Quoted 55 lines · Ferruh Yigit
Quoted 25 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
Quoted 4 lines

The patch mostly looks good and it enables build with 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 256.
Only I put a comment for a testpmd change to enable the "set stat_qmap" command for map value > 256.

BUT there are many things to fix in the queue stats mapping, since you are already on it can you help on a few things on testpmd related to it, if you have time for it?

1) Getting queue stats shouldn't require stats mapping, it should be controlled separately. Many PMDs doesn't require/do the stats mapping but they still can collect the per queue stats, which can be displayed independent from mapping.

2) Even you map only one queue, while displaying stats it will display 'RTE_ETHDEV_QUEUE_STAT_CNTRS' queues, and when that number is high it makes hard to see the actual interested values.
If there is no mapping, it should display min(number_of_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS).
If there is mapping it should display queues that mapping done, this may require adding a new 'active' field to 'struct queue_stats_mappings'.

3) Why 'struct queue_stats_mappings' is cache aligned, is it really needed?

Quoted 8 lines
Quoted 5 lines

4) The mapping arrays, 'tx_queue_stats_mappings_array' & 'rx_queue_stats_mappings_array' are global and their size is based on fixed max port and queue size assumptions, can those mapping array be done per port and 'RTE_ETHDEV_QUEUE_STAT_CNTRS' size per port?

It does seem to be unreasonable. We also try do it, and found that it is hard to control per queue stats and queue stats mapping, separately. For details, see next V3 patch.

I will check v3, but as far as know stats mapping exist because of limitations of some NICs, that there are N queues but M stats registers where N > M. So need to map some queues to stat registers, and there is N:1 relation there, so multiple queue stats can be represented in single stat register.

But for rest of the NICs it should be possible to display the queue stats independent from the mapping.

Quoted 10 lines

We're working on debugging this stats_mapping setting. During this process, we have a problem that starting testpmd with --rx/tx-queue-stats-mapping parameter fails. log as follows:
[root]$ ./testpmd -l 1,3,4,8,12 -n 4 -w 0000:04:00.0 --file-prefix=lee --log-level=7
  -- -i --rxq=6 --txq=6 --burst=64 --rxd=2048 --txd=2048 --nb-cores=4 --rx-queue-stats-mapping=(0,2,2) --tx-queue-stats-mapping=(0,3,3)

-bash: syntax error near unexpected token `('
[root]$

Above seems bash error, using '' can help for it, like --rx-queue-stats-mapping='(0,2,2)'
.

#14 lore raw

Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics

Quoted 5 lines · Min Hu (Connor)

Hi, Ferruh Yigit,

Your method is very practical. Thanks!
But we found that testpmd fails to start with "--rx-queue-stats-mapping" and "--tx-queue-stats-mapping". We've found the cause and modified it. These modifications are being tested.

Quoted 9 lines

Currently, the following modifications are related to framework APIs. 1)struct 'rte_eth_dcb_tc_queue_mapping'
2)fix 'rte_eth_dev_set_rx/tx_queue_stats_mapping' function to resolve the problem that DPDK project fails to build when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 256.

According to my current analysis, these modifications for queue stats mapping in testpmd do not involve the modification of framework APIs. Therefore, I think we should give priority to focusing on the current changes to the DPDK framework APIs.

After all, DPDK-20.11 is approaching. What do you think?

Makes sense, agree to continue with this patchset and queue stats mapping related changes can be done later.

Quoted 89 lines · Ferruh Yigit
Quoted 87 lines · Min Hu (Connor)
Quoted 58 lines · Ferruh Yigit
Quoted 55 lines · Min Hu (Connor)
Quoted 25 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
Quoted 4 lines

The patch mostly looks good and it enables build with 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 256.
Only I put a comment for a testpmd change to enable the "set stat_qmap" command for map value > 256.

BUT there are many things to fix in the queue stats mapping, since you are already on it can you help on a few things on testpmd related to it, if you have time for it?

1) Getting queue stats shouldn't require stats mapping, it should be controlled separately. Many PMDs doesn't require/do the stats mapping but they still can collect the per queue stats, which can be displayed independent from mapping.

2) Even you map only one queue, while displaying stats it will display 'RTE_ETHDEV_QUEUE_STAT_CNTRS' queues, and when that number is high it makes hard to see the actual interested values.
If there is no mapping, it should display min(number_of_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS).
If there is mapping it should display queues that mapping done, this may require adding a new 'active' field to 'struct queue_stats_mappings'.

3) Why 'struct queue_stats_mappings' is cache aligned, is it really needed?

Quoted 8 lines
Quoted 5 lines

4) The mapping arrays, 'tx_queue_stats_mappings_array' & 'rx_queue_stats_mappings_array' are global and their size is based on fixed max port and queue size assumptions, can those mapping array be done per port and 'RTE_ETHDEV_QUEUE_STAT_CNTRS' size per port?

It does seem to be unreasonable. We also try do it, and found that it is hard to control per queue stats and queue stats mapping, separately. For details, see next V3 patch.

I will check v3, but as far as know stats mapping exist because of limitations of some NICs, that there are N queues but M stats registers where N > M. So need to map some queues to stat registers, and there is N:1 relation there, so multiple queue stats can be represented in single stat register.

But for rest of the NICs it should be possible to display the queue stats independent from the mapping.

Quoted 10 lines

We're working on debugging this stats_mapping setting. During this process, we have a problem that starting testpmd with --rx/tx-queue-stats-mapping parameter fails. log as follows:
[root]$ ./testpmd -l 1,3,4,8,12 -n 4 -w 0000:04:00.0 --file-prefix=lee --log-level=7
  -- -i --rxq=6 --txq=6 --burst=64 --rxd=2048 --txd=2048 --nb-cores=4 --rx-queue-stats-mapping=(0,2,2) --tx-queue-stats-mapping=(0,3,3)

-bash: syntax error near unexpected token `('
[root]$

Above seems bash error, using '' can help for it, like --rx-queue-stats-mapping='(0,2,2)'
.

#15 lore raw

v3 cover change data type in TC queue

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

This series change data type in TC rxq and TC txq, fix compiling errors for per-queue statistics.

Huisong Li (4):
dpdk: fix compiling errors for per-queue statistics
ethdev: change data type in TC rxq and TC txq
doc: announce modified field in DCB TC queue mapping
doc: announce modified in queue_stats_mapping api

 app/proc-info/main.c                   |  2 +-
 app/test-pmd/cmdline.c                 |  2 +-
 app/test-pmd/config.c                  |  4 ++--
 app/test-pmd/testpmd.c                 |  2 +-
 app/test-pmd/testpmd.h                 |  5 +++--
 doc/guides/rel_notes/deprecation.rst   | 11 +++++++++++
 doc/guides/rel_notes/release_20_11.rst |  8 ++++++++
 drivers/net/igc/igc_ethdev.c           |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/memif/rte_eth_memif.c      |  2 +-
 drivers/net/octeontx2/otx2_ethdev.h    |  2 +-
 drivers/net/octeontx2/otx2_stats.c     |  2 +-
 drivers/net/virtio/virtio_ethdev.c     |  4 ++--
 lib/librte_ethdev/rte_ethdev.c         |  6 +++---
 lib/librte_ethdev/rte_ethdev.h         | 12 ++++++------
 lib/librte_ethdev/rte_ethdev_driver.h  |  2 +-
 16 files changed, 46 insertions(+), 26 deletions(-)
Signature · 1 line
2.7.4
#16 lore raw

PATCH v3 1/4 dpdk: fix compiling errors for per-queue statistics

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")

---
v2->v3:
change 'uint8_t i' to 'uint16_t i' in nic_stats_display function

---
 app/proc-info/main.c                  | 2 +-
 app/test-pmd/cmdline.c                | 2 +-
 app/test-pmd/config.c                 | 4 ++--
 app/test-pmd/testpmd.c                | 2 +-
 app/test-pmd/testpmd.h                | 5 +++--
 drivers/net/igc/igc_ethdev.c          | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c      | 4 ++--
 drivers/net/memif/rte_eth_memif.c     | 2 +-
 drivers/net/octeontx2/otx2_ethdev.h   | 2 +-
 drivers/net/octeontx2/otx2_stats.c    | 2 +-
 drivers/net/virtio/virtio_ethdev.c    | 4 ++--
 lib/librte_ethdev/rte_ethdev.c        | 6 +++---
 lib/librte_ethdev/rte_ethdev.h        | 4 ++--
 lib/librte_ethdev/rte_ethdev_driver.h | 2 +-
 14 files changed, 23 insertions(+), 22 deletions(-)
app/proc-info/main.c +1 -1
index 64fb83b..26d9355 100644
@@ -348,7 +348,7 @@ static void
 nic_stats_display(uint16_t port_id)
 {
 	struct rte_eth_stats stats;
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
app/test-pmd/cmdline.c +1 -1
index 5f93409..200b8a0 100644
@@ -8267,7 +8267,7 @@ struct cmd_set_qmap_result {
 	cmdline_fixed_string_t what;
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
 };
 
 static void
app/test-pmd/config.c +2 -2
index 2d9a456..f23b193 100644
@@ -160,7 +160,7 @@ nic_stats_display(portid_t port_id)
 	uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
 	struct rte_eth_stats stats;
 	struct rte_port *port = &ports[port_id];
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
@@ -3625,7 +3625,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
 }
 
 void
-set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
+set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint16_t map_value)
 {
 	uint16_t i;
 	uint8_t existing_mapping_found = 0;
app/test-pmd/testpmd.c +1 -1
index fe6450c..4b26c5c 100644
@@ -1840,7 +1840,7 @@ fwd_stats_display(void)
 			fwd_cycles += fs->core_cycles;
 	}
 	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-		uint8_t j;
+		uint16_t j;
 
 		pt_id = fwd_ports_ids[i];
 		port = &ports[pt_id];
app/test-pmd/testpmd.h +3 -2
index f139fe7..16aa81c 100644
@@ -279,7 +279,7 @@ enum dcb_mode_enable
 struct queue_stats_mappings {
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t stats_counter_id;
+	uint16_t stats_counter_id;
 } __rte_cache_aligned;
 
 extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
@@ -792,7 +792,8 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
 void tx_vlan_reset(portid_t port_id);
 void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
 
-void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
+void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id,
+	      uint16_t map_value);
 
 void set_xstats_hide_zero(uint8_t on_off);
 
drivers/net/igc/igc_ethdev.c +2 -2
index 810568b..875874e 100644
@@ -221,7 +221,7 @@ static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-	uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
+	uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx);
 static int
 eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -2075,7 +2075,7 @@ eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-		uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
+		uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx)
 {
 	struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
 
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 0f065bb..9850488 100644
@@ -178,7 +178,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
 	unsigned int limit);
 static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 				 size_t fw_size);
@@ -890,7 +890,7 @@ ixgbe_reset_qstat_mappings(struct ixgbe_hw *hw)
 static int
 ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id,
-				  uint8_t stat_idx,
+				  uint16_t stat_idx,
 				  uint8_t is_rx)
 {
 #define QSM_REG_NB_BITS_PER_QMAP_FIELD 8
drivers/net/memif/rte_eth_memif.c +1 -1
index a19c0f3..29cea93 100644
@@ -1356,7 +1356,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct memif_queue *mq;
 	int i;
-	uint8_t tmp, nq;
+	uint16_t tmp, nq;
 
 	stats->ipackets = 0;
 	stats->ibytes = 0;
drivers/net/octeontx2/otx2_ethdev.h +1 -1
index a114112..0c761e3 100644
@@ -476,7 +476,7 @@ int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
 int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
-				 uint16_t queue_id, uint8_t stat_idx,
+				 uint16_t queue_id, uint16_t stat_idx,
 				 uint8_t is_rx);
 int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
 			struct rte_eth_xstat *xstats, unsigned int n);
drivers/net/octeontx2/otx2_stats.c +1 -1
index 8aaf270..6efe122 100644
@@ -145,7 +145,7 @@ otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
 int
 otx2_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
-			     uint8_t stat_idx, uint8_t is_rx)
+			     uint16_t stat_idx, uint8_t is_rx)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 
drivers/net/virtio/virtio_ethdev.c +2 -2
index 013a290..9d26012 100644
@@ -82,7 +82,7 @@ static int virtio_intr_disable(struct rte_eth_dev *dev);
 static int virtio_dev_queue_stats_mapping_set(
 	struct rte_eth_dev *eth_dev,
 	uint16_t queue_id,
-	uint8_t stat_idx,
+	uint16_t stat_idx,
 	uint8_t is_rx);
 
 static void virtio_notify_peers(struct rte_eth_dev *dev);
@@ -2648,7 +2648,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
  */
 static int
 virtio_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *eth_dev,
-__rte_unused uint16_t queue_id, __rte_unused uint8_t stat_idx,
+__rte_unused uint16_t queue_id, __rte_unused uint16_t stat_idx,
 __rte_unused uint8_t is_rx)
 {
 	return 0;
lib/librte_ethdev/rte_ethdev.c +3 -3
index dfe5c1b..749b372 100644
@@ -2942,7 +2942,7 @@ rte_eth_xstats_reset(uint16_t port_id)
 }
 
 static int
-set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint16_t stat_idx,
 		uint8_t is_rx)
 {
 	struct rte_eth_dev *dev;
@@ -2969,7 +2969,7 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 
 int
 rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, tx_queue_id,
 						stat_idx, STAT_QMAP_TX));
@@ -2978,7 +2978,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
 
 int
 rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, rx_queue_id,
 						stat_idx, STAT_QMAP_RX));
lib/librte_ethdev/rte_ethdev.h +2 -2
index eeef52e..fb10836 100644
@@ -2669,7 +2669,7 @@ int rte_eth_xstats_reset(uint16_t port_id);
  *   Zero if successful. Non-zero otherwise.
  */
 int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);
 
 /**
  *  Set a mapping for the specified receive queue to the specified per-queue
@@ -2690,7 +2690,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
  */
 int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
 					   uint16_t rx_queue_id,
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);
 
 /**
  * Retrieve the Ethernet address of an Ethernet device.
lib/librte_ethdev/rte_ethdev_driver.h +1 -1
index 23cc1e0..c68d465 100644
@@ -222,7 +222,7 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
 
 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 
Signature · 1 line
2.7.4
#17 lore raw

PATCH v3 2/4 ethdev: change data type in TC rxq and TC txq

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these data will be truncated when queue number under a TC is greater than 256. So it is necessary for base and nb_queue to change from uint8_t to uint16_t.

Fixes 01eb53eefeb40e8 ("ethdev: rename folder to library name")
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_ethdev/rte_ethdev.h +4 -4
index fb10836..6dfe666 100644
@@ -1519,13 +1519,13 @@ struct rte_eth_xstat_name {
 struct rte_eth_dcb_tc_queue_mapping {
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 };
 
Signature · 1 line
2.7.4
#18 lore raw

PATCH v3 3/4 doc: announce modified field in DCB TC queue mapping

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

Field type of base and nb_queue will be modified from uint8_t to uint16_t in struct "rte_eth_dcb_tc_queue_mapping". As the data of uint8_t will be truncated when queue number under a TC is greater than 256.

---
v2->v3:
add announce modified field in DCB TC queue mapping.

---
 doc/guides/rel_notes/deprecation.rst   | 5 +++++
 doc/guides/rel_notes/release_20_11.rst | 4 ++++
 2 files changed, 9 insertions(+)
doc/guides/rel_notes/deprecation.rst +5 -0
index 444dcbe..cc744d8 100644
@@ -134,6 +134,11 @@ Deprecation Notices
   and the related structures (``rte_fdir_*`` and ``rte_eth_fdir_*``),
   will be removed in DPDK 20.11.
 
+* ethdev: Modified field type of base and nb_queue, from uint8_t to uint16_t in
+  struct ``rte_eth_dcb_tc_queue_mapping``. As the data of uint8_t will be
+  truncated when queue number under a TC is greater than 256. This will be
+  modified in DPDK 20.11.
+
 * ethdev: The legacy L2 tunnel filtering API is deprecated as the rest of
   the legacy filtering API.
   The functions ``rte_eth_dev_l2_tunnel_eth_type_conf`` and
doc/guides/rel_notes/release_20_11.rst +4 -0
index d4a66d0..3de2895 100644
@@ -149,6 +149,10 @@ API Changes
 
 * bpf: ``RTE_BPF_XTYPE_NUM`` has been dropped from ``rte_bpf_xtype``.
 
+* ethdev: Modified field type of base and nb_queue, from uint8_t to uint16_t in
+  struct ``rte_eth_dcb_tc_queue_mapping``. As the data of uint8_t will be
+  truncated when queue number under a TC is greater than 256.
+
 
 ABI Changes
 -----------
Signature · 1 line
2.7.4
#19 lore raw

PATCH v3 4/4 doc: announce modified in queue stats mapping API

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

Data type of stat_idx will be modified, from uint8_t to uint16_t in "set_queue_stats_mapping", "rte_eth_dev_set_tx_queue_stats_mapping", "rte_eth_dev_set_rx_queue_stats_mapping" for meeting the needs use 256 or more than 256 queues and display all statistics of rx/tx queue.

---
v2->v3:
add announce modified queue_stats_mapping API.

---
 doc/guides/rel_notes/deprecation.rst   | 6 ++++++
 doc/guides/rel_notes/release_20_11.rst | 4 ++++
 2 files changed, 10 insertions(+)
doc/guides/rel_notes/deprecation.rst +6 -0
index cc744d8..82eb959 100644
@@ -192,6 +192,12 @@ Deprecation Notices
   following the IPv6 header, as proposed in RFC
   https://mails.dpdk.org/archives/dev/2020-August/177257.html.
 
+* ethdev: Data type of input parameter ``stat_idx`` in ``set_queue_stats_mapping``,
+  ``rte_eth_dev_set_tx_queue_stats_mapping`` and ``rte_eth_dev_set_rx_queue_stats_mapping``
+  function will be change from uint8_t to uint16_t, which supports that the needs
+  use 256 or more than 256 queues and display all statistics of rx/tx queue.
+  The change is planned for 20.11.
+
 * vhost: Vhost-user dequeue zero-copy support will be removed in 20.11.
   The only known user is OVS where the feature is still experimental,
   and has not received any update for 2.5 years.
doc/guides/rel_notes/release_20_11.rst +4 -0
index 3de2895..6149199 100644
@@ -153,6 +153,10 @@ API Changes
   struct ``rte_eth_dcb_tc_queue_mapping``. As the data of uint8_t will be
   truncated when queue number under a TC is greater than 256.
 
+* ethdev: Data type of input parameter ``stat_idx`` in ``set_queue_stats_mapping``,
+  ``rte_eth_dev_set_tx_queue_stats_mapping`` and ``rte_eth_dev_set_rx_queue_stats_mapping``
+  function will be change from uint8_t to uint16_t, which supports that the needs
+  use 256 or more than 256 queues and display all statistics of rx/tx queue.
 
 ABI Changes
 -----------
Signature · 1 line
2.7.4
#20 lore raw

Re: [dpdk-dev] [PATCH V3 0/4] change data type in TC queue

In reply to Min Hu (Connor)
Quoted 11 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

This series change data type in TC rxq and TC txq, fix compiling errors for per-queue statistics.

Huisong Li (4):
dpdk: fix compiling errors for per-queue statistics
ethdev: change data type in TC rxq and TC txq
doc: announce modified field in DCB TC queue mapping
doc: announce modified in queue_stats_mapping api

The change request from previous version seems not addressed, can you please check:
http://inbox.dpdk.org/dev/[email protected]/
Basically it requires following change:
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 4df42dbc28..23e624f442 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -8346,7 +8346,7 @@ cmdline_parse_token_num_t cmd_setqmap_queueid =

                               queue_id, UINT16);

cmdline_parse_token_num_t cmd_setqmap_mapvalue =
TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
- map_value, UINT8);
+ map_value, UINT16);

  cmdline_parse_inst_t cmd_set_qmap = {
         .f = cmd_set_qmap_parsed,

Also you can drop deprecation notes as explained here:
http://inbox.dpdk.org/dev/[email protected]/

Thanks,
ferruh

#21 lore raw

PATCH v2 2/4 ethdev: change data type in TC rxq and TC txq

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these datas will be truncated when queue number under a TC is greater than 256. So it is necessay for base and nb_queue to change from uint8_t to uint16_t.

Fixes 01eb53eefeb40e8 ("ethdev: rename folder to library name")
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_ethdev/rte_ethdev.h +4 -4
index e073c0e..b4e10e2 100644
@@ -1489,13 +1489,13 @@ struct rte_eth_xstat_name {
 struct rte_eth_dcb_tc_queue_mapping {
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 };
 
Signature · 1 line
2.7.4
#22 lore raw

PATCH v2 3/4 doc: announce modified field in DCB TC queue mapping

In reply to Min Hu (Connor)

Field type of base and nb_queue will be modified, from uint8_t to uint16_t in struct ``rte_eth_dcb_tc_queue_mapping``.As the data of uint8_t will be truncated when queue number under a TC is greater than 256.

---
 doc/guides/rel_notes/release_20_11.rst | 3 +++
 1 file changed, 3 insertions(+)
doc/guides/rel_notes/release_20_11.rst +3 -0
index df227a1..e9c87c3 100644
@@ -100,6 +100,9 @@ ABI Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* ethdev: Modified field type of base and nb_queue, from uint8_t to uint16_t  in
+  struct ``rte_eth_dcb_tc_queue_mapping``.As the data of uint8_t will be truncated when
+  queue number under a TC is greater than 256.
 
 Known Issues
 ------------
Signature · 1 line
2.7.4
#23 lore raw

PATCH v2 4/4 doc: announce modified field in ethdev API

In reply to Min Hu (Connor)

Field type of stat_idx will be modified, from uint8_t to uint16_t in "set_queue_stats_mapping", "rte_eth_dev_set_tx_queue_stats_mapping", "rte_eth_dev_set_rx_queue_stats_mapping" for meeting the needs use 256 or more than 256 queues and display all statistics of rx/tx queue.

---
 doc/guides/rel_notes/release_20_11.rst | 4 ++++
 1 file changed, 4 insertions(+)
doc/guides/rel_notes/release_20_11.rst +4 -0
index e9c87c3..8e24d46 100644
@@ -84,6 +84,10 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* ethdev: Modified field type of stat_idx, from uint8_t to uint16_t  in
+  ``set_queue_stats_mapping``, ``rte_eth_dev_set_tx_queue_stats_mapping``,
+  ``rte_eth_dev_set_rx_queue_stats_mapping`` for meeting the needs use 256
+  or more than 256 queues and display all statistics of rx/tx queue.
 
 ABI Changes
 -----------
Signature · 1 line
2.7.4
#24 lore raw

Re: [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type

In reply to Min Hu (Connor)
Quoted 2 lines · Min Hu (Connor)

This series are minor change the queue ID type from uint8_t to uint16_t.

Hi Min Hu,

For the next time, a change log to summarize what has been updated in new version can help to the reviewers, please add it either to commit log or cover letter.

Quoted 8 lines

Huisong Li (2):
ethdev: fix compiling errors for per-queue statistics
ethdev: change data type in TC rxq and TC txq

Min Hu (Connor) (2):
doc: announce modified field in DCB TC queue mapping
doc: announce modified field in ethdev API

As said previously, you can drop the deprecation notice patches from the series. If everything else is good I can drop while merging.

Thanks,
ferruh

#25 lore raw

v3 cover add FEC support

In reply to Min Hu (Connor)

This series add FEC support for ethdev.

Min Hu (Connor) (3):
ethdev: introduce FEC API
net/hns3: support FEC
app/testpmd: add FEC command

 app/test-pmd/cmdline.c                   | 219 +++++++++++++++++++++++++++++++
 app/test-pmd/config.c                    |  54 ++++++++
 app/test-pmd/testpmd.h                   |   2 +
 drivers/net/hns3/hns3_cmd.h              |  19 ++-
 drivers/net/hns3/hns3_ethdev.c           | 156 ++++++++++++++++++++++
 drivers/net/hns3/hns3_ethdev.h           |   1 +
 lib/librte_ethdev/rte_ethdev.c           |  50 +++++++
 lib/librte_ethdev/rte_ethdev.h           |  75 +++++++++++
 lib/librte_ethdev/rte_ethdev_core.h      |  77 +++++++++++
 lib/librte_ethdev/rte_ethdev_version.map |   5 +
 10 files changed, 657 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
#26 lore raw

PATCH v3 1/3 ethdev: introduce FEC API

This patch adds Forward error correction(FEC) support for ethdev. Introduce APIs which support query and config FEC information in hardware.

---
v2->v3:
add function return value "-ENOTSUP" for API

---
 lib/librte_ethdev/rte_ethdev.c           | 50 +++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev.h           | 75 +++++++++++++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev_core.h      | 77 ++++++++++++++++++++++++++++++++
 lib/librte_ethdev/rte_ethdev_version.map |  5 +++
 4 files changed, 207 insertions(+)
lib/librte_ethdev/rte_ethdev.c +50 -0
index 7858ad5..b7ac791 100644
@@ -3642,6 +3642,56 @@ rte_eth_led_off(uint16_t port_id)
 	return eth_err(port_id, (*dev->dev_ops->dev_led_off)(dev));
 }
 
+int
+rte_eth_fec_get_capability(uint16_t port_id, uint8_t *fec_cap)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get_capability, -ENOTSUP);
+	return eth_err(port_id, (*dev->dev_ops->fec_get_capability)(dev,
+								fec_cap));
+}
+
+int
+rte_eth_fec_get(uint16_t port_id, enum rte_fec_mode *mode)
+{
+	struct rte_eth_dev *dev;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	dev = &rte_eth_devices[port_id];
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get, -ENOTSUP);
+	return eth_err(port_id, (*dev->dev_ops->fec_get)(dev, mode));
+}
+
+int
+rte_eth_fec_set(uint16_t port_id, enum rte_fec_mode mode)
+{
+	struct rte_eth_dev *dev;
+	uint8_t fec_mode_mask;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+	ret = rte_eth_fec_get_capability(port_id, &fec_mode_mask);
+	if (ret)
+		return ret;
+
+	/*
+	 * Check whether the configured mode is within the FEC capability.
+	 * If not, the configured mode will not be supported.
+	 */
+	if (!(fec_mode_mask & (1U << (uint8_t)mode))) {
+		RTE_ETHDEV_LOG(ERR, "unsupported fec mode=%d\n", mode);
+		return -EINVAL;
+	}
+
+	dev = &rte_eth_devices[port_id];
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_set, -ENOTSUP);
+	return eth_err(port_id, (*dev->dev_ops->fec_set)(dev, mode));
+}
+
 /*
  * Returns index into MAC address array of addr. Use 00:00:00:00:00:00 to find
  * an empty spot.
lib/librte_ethdev/rte_ethdev.h +75 -0

87 lines not on this page · raw message

lib/librte_ethdev/rte_ethdev_core.h +77 -0

89 lines not on this page · raw message

lib/librte_ethdev/rte_ethdev_version.map +5 -0
index 1212a17..33cf5e4 100644
@@ -241,6 +241,11 @@ EXPERIMENTAL {
 	__rte_ethdev_trace_rx_burst;
 	__rte_ethdev_trace_tx_burst;
 	rte_flow_get_aged_flows;
+
+	# added in 20.11
+	rte_eth_fec_get_capability;
+	rte_eth_fec_get;
+	rte_eth_fec_set;
 };
 
 INTERNAL {
Signature · 1 line
2.7.4
#27 lore raw

PATCH v3 2/3 net/hns3: support FEC

In reply to Min Hu (Connor)

Forward error correction (FEC) is a bit error correction mode. It adds error correction information to data packets at the transmit end, and uses the error correction information to correct the bit errors generated during data packet transmission at the receive end. This improves signal quality but also brings a delay to signals. This function can be enabled or disabled as required.

This patch adds FEC support for ethdev.Introduce ethdev operations which support query and config FEC information in hardware.

---
v2->v3:
adjust the return value of function.

---
 drivers/net/hns3/hns3_cmd.h    |  19 ++++-
 drivers/net/hns3/hns3_ethdev.c | 156 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/hns3/hns3_ethdev.h |   1 +
 3 files changed, 175 insertions(+), 1 deletion(-)
drivers/net/hns3/hns3_cmd.h +18 -1
index d70f42e..8b80353 100644
@@ -99,6 +99,7 @@ enum hns3_opcode_type {
 	HNS3_OPC_CONFIG_MAX_FRM_SIZE    = 0x0308,
 	HNS3_OPC_CONFIG_SPEED_DUP       = 0x0309,
 	HNS3_MAC_COMMON_INT_EN          = 0x030E,
+	HNS3_OPC_CONFIG_FEC_MODE        = 0x031A,
 
 	/* PFC/Pause commands */
 	HNS3_OPC_CFG_MAC_PAUSE_EN       = 0x0701,
@@ -653,9 +654,25 @@ struct hns3_config_auto_neg_cmd {
 	uint8_t   rsv[20];
 };
 
+#define HNS3_MAC_CFG_FEC_AUTO_EN_B	0
+#define HNS3_MAC_CFG_FEC_MODE_S		1
+#define HNS3_MAC_CFG_FEC_MODE_M	GENMASK(3, 1)
+#define HNS3_MAC_FEC_OFF		0
+#define HNS3_MAC_FEC_BASER		1
+#define HNS3_MAC_FEC_RS			2
+
 struct hns3_sfp_speed_cmd {
 	uint32_t  sfp_speed;
-	uint32_t  rsv[5];
+	uint8_t   query_type; /* 0: sfp speed, 1: active fec */
+	uint8_t   active_fec; /* current FEC mode */
+	uint16_t  rsv1;
+	uint32_t  rsv2[4];
+};
+
+/* Configure FEC mode, opcode:0x031A */
+struct hns3_config_fec_cmd {
+	uint8_t fec_mode;
+	uint8_t rsv[23];
 };
 
 #define HNS3_MAC_MGR_MASK_VLAN_B		BIT(0)
drivers/net/hns3/hns3_ethdev.c +156 -0

186 lines not on this page · raw message

drivers/net/hns3/hns3_ethdev.h +1 -0
index 0e665e5..daf723e 100644
@@ -510,6 +510,7 @@ struct hns3_pf {
 	struct hns3_err_msix_intr_stats abn_int_stats;
 
 	bool support_sfp_query;
+	enum rte_fec_mode fec_mode; /* current FEC mode for ethdev */
 
 	struct hns3_vtag_cfg vtag_config;
 	LIST_HEAD(vlan_tbl, hns3_user_vlan_table) vlan_list;
Signature · 1 line
2.7.4
#28 lore raw

PATCH v3 3/3 app/testpmd: add FEC command

In reply to Min Hu (Connor)

This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0 fec_mode
- config FEC mode, example:
testpmd> set port <port_id> 0 <auto|off|rs|baser>

where:

auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.

----
v2->v3:
adjust the display format of FEC capability.

---
 app/test-pmd/cmdline.c | 219 +++++++++++++++++++++++++++++++++++++++++++++++++
 app/test-pmd/config.c  |  54 ++++++++++++
 app/test-pmd/testpmd.h |   2 +
 3 files changed, 275 insertions(+)
app/test-pmd/cmdline.c +219 -0
index 0a6ed85..072f390 100644
@@ -19054,6 +19054,222 @@ cmdline_parse_inst_t cmd_show_tx_metadata = {
 	},
 };
 
+/* *** show fec capability per port configuration *** */
+struct cmd_show_fec_capability_result {
+	cmdline_fixed_string_t cmd_show;
+	cmdline_fixed_string_t cmd_port;
+	cmdline_fixed_string_t cmd_fec;
+	cmdline_fixed_string_t cmd_keyword;
+	portid_t cmd_pid;
+};
+
+static void
+cmd_show_fec_capability_parsed(void *parsed_result,
+		__rte_unused struct cmdline *cl,
+		__rte_unused void *data)
+{
+	struct cmd_show_fec_capability_result *res = parsed_result;
+	uint8_t fec_cap;
+	int ret;
+
+	if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
+		printf("Invalid port id %u\n", res->cmd_pid);
+		return;
+	}
+
+	ret = rte_eth_fec_get_capability(res->cmd_pid, &fec_cap);
+	if (ret == -ENOTSUP) {
+		printf("Function not implemented\n");
+		return;
+	} else if (ret < 0) {
+		printf("Get FEC capability failed\n");
+		return;
+	}
+
+	show_fec_capability(fec_cap);
+}
+
+cmdline_parse_token_string_t cmd_show_fec_capability_show =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result,
+			cmd_show, "show");
+cmdline_parse_token_string_t cmd_show_fec_capability_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result,
+			cmd_port, "port");
+cmdline_parse_token_num_t cmd_show_fec_capability_pid =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_fec_capability_result,
+			cmd_pid, UINT16);
+cmdline_parse_token_string_t cmd_show_fec_capability_fec =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result,
+			cmd_fec, "fec");
+cmdline_parse_token_string_t cmd_show_fec_capability_keyword =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result,
+			cmd_keyword, "capabilities");
+
+cmdline_parse_inst_t cmd_show_capability = {
+	.f = cmd_show_fec_capability_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> fec capabilities",
+	.tokens = {
+		(void *)&cmd_show_fec_capability_show,
+		(void *)&cmd_show_fec_capability_port,
+		(void *)&cmd_show_fec_capability_pid,
+		(void *)&cmd_show_fec_capability_fec,
+		(void *)&cmd_show_fec_capability_keyword,
+		NULL,
+	},
+};
+
+/* *** show fec mode per port configuration *** */
+struct cmd_show_fec_metadata_result {
+	cmdline_fixed_string_t cmd_show;
+	cmdline_fixed_string_t cmd_port;
+	cmdline_fixed_string_t cmd_keyword;
+	portid_t cmd_pid;
+};
+
+static void
+cmd_show_fec_mode_parsed(void *parsed_result,
+		__rte_unused struct cmdline *cl,
+		__rte_unused void *data)
+{
+#define FEC_NAME_SIZE 16
+	struct cmd_show_fec_metadata_result *res = parsed_result;
+	enum rte_fec_mode mode;
+	char buf[FEC_NAME_SIZE];
+	int ret;
+
+	if (!rte_eth_dev_is_valid_port(res->cmd_pid)) {
+		printf("Invalid port id %u\n", res->cmd_pid);
+		return;
+	}
+	ret = rte_eth_fec_get(res->cmd_pid, &mode);
+	if (ret == -ENOTSUP) {
+		printf("Function not implemented\n");
+		return;
+	} else if (ret < 0) {
+		printf("Get FEC mode failed\n");
+		return;
+	}
+
+	switch (mode) {
+	case ETH_FEC_NOFEC:
+		strlcpy(buf, "off", sizeof(buf));
+		break;
+	case ETH_FEC_BASER:
+		strlcpy(buf, "baser", sizeof(buf));
+		break;
+	case ETH_FEC_RS:
+		strlcpy(buf, "rs", sizeof(buf));
+		break;
+	case ETH_FEC_AUTO:
+		strlcpy(buf, "auto", sizeof(buf));
+		break;
+	default:
+		return;
+	}
+
+	printf("%s\n", buf);
+}
+
+cmdline_parse_token_string_t cmd_show_fec_mode_show =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result,
+			cmd_show, "show");
+cmdline_parse_token_string_t cmd_show_fec_mode_port =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result,
+			cmd_port, "port");
+cmdline_parse_token_num_t cmd_show_fec_mode_pid =
+	TOKEN_NUM_INITIALIZER(struct cmd_show_fec_metadata_result,
+			cmd_pid, UINT16);
+cmdline_parse_token_string_t cmd_show_fec_mode_keyword =
+	TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result,
+			cmd_keyword, "fec_mode");
+
+cmdline_parse_inst_t cmd_show_fec_mode = {
+	.f = cmd_show_fec_mode_parsed,
+	.data = NULL,
+	.help_str = "show port <port_id> fec_mode",
+	.tokens = {
+		(void *)&cmd_show_fec_mode_show,
+		(void *)&cmd_show_fec_mode_port,
+		(void *)&cmd_show_fec_mode_pid,
+		(void *)&cmd_show_fec_mode_keyword,
+		NULL,
+	},
+};
+
+/* *** set fec mode per port configuration *** */
+struct cmd_set_port_fec_mode {
+	cmdline_fixed_string_t set;
+	cmdline_fixed_string_t port;
+	portid_t port_id;
+	cmdline_fixed_string_t fec_mode;
+	cmdline_fixed_string_t fec_value;
+};
+
+/* Common CLI fields for set fec mode */
+cmdline_parse_token_string_t cmd_set_port_fec_mode_set =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_port_fec_mode,
+		 set, "set");
+cmdline_parse_token_string_t cmd_set_port_fec_mode_port =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_port_fec_mode,
+		 port, "port");
+cmdline_parse_token_num_t cmd_set_port_fec_mode_port_id =
+	TOKEN_NUM_INITIALIZER
+		(struct cmd_set_port_fec_mode,
+		 port_id, UINT16);
+cmdline_parse_token_string_t cmd_set_port_fec_mode_str =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_port_fec_mode,
+		 fec_mode, "fec_mode");
+cmdline_parse_token_string_t cmd_set_port_fec_mode_value =
+	TOKEN_STRING_INITIALIZER
+		(struct cmd_set_port_fec_mode,
+		 fec_value, NULL);
+
+static void
+cmd_set_port_fec_mode_parsed(
+	void *parsed_result,
+	__rte_unused struct cmdline *cl,
+	__rte_unused void *data)
+{
+	struct cmd_set_port_fec_mode *res = parsed_result;
+	uint16_t port_id = res->port_id;
+	enum rte_fec_mode mode;
+	int ret;
+
+	ret = parse_fec_mode(res->fec_value, &mode);
+	if (ret < 0) {
+		printf("Unknown fec mode: %s for Port %d", res->fec_value,
+			port_id);
+		return;
+	}
+
+	ret = rte_eth_fec_set(port_id, mode);
+	if (ret == -ENOTSUP) {
+		printf("Function not implemented\n");
+		return;
+	} else if (ret < 0) {
+		printf("Set FEC mode failed\n");
+		return;
+	}
+}
+
+cmdline_parse_inst_t cmd_set_fec_mode = {
+	.f = cmd_set_port_fec_mode_parsed,
+	.data = NULL,
+	.help_str = "set port <port_id> fec_mode <auto|off|rs|baser>",
+	.tokens = {
+		(void *)&cmd_set_port_fec_mode_set,
+		(void *)&cmd_set_port_fec_mode_port,
+		(void *)&cmd_set_port_fec_mode_port_id,
+		(void *)&cmd_set_port_fec_mode_str,
+		(void *)&cmd_set_port_fec_mode_value,
+		NULL,
+	},
+};
+
 /* show port supported ptypes */
 
 /* Common result structure for show port ptypes */
@@ -19685,6 +19901,9 @@ cmdline_parse_ctx_t main_ctx[] = {
 	(cmdline_parse_inst_t *)&cmd_show_set_raw,
 	(cmdline_parse_inst_t *)&cmd_show_set_raw_all,
 	(cmdline_parse_inst_t *)&cmd_config_tx_dynf_specific,
+	(cmdline_parse_inst_t *)&cmd_show_fec_mode,
+	(cmdline_parse_inst_t *)&cmd_set_fec_mode,
+	(cmdline_parse_inst_t *)&cmd_show_capability,
 	NULL,
 };
 
app/test-pmd/config.c +54 -0

66 lines not on this page · raw message

app/test-pmd/testpmd.h +2 -0
index 25a12b1..7ab91ad 100644
@@ -778,6 +778,8 @@ void show_tx_pkt_segments(void);
 void set_tx_pkt_times(unsigned int *tx_times);
 void show_tx_pkt_times(void);
 void set_tx_pkt_split(const char *name);
+int parse_fec_mode(const char *name, enum rte_fec_mode *mode);
+void show_fec_capability(uint8_t fec_cap);
 void set_nb_pkt_per_burst(uint16_t pkt_burst);
 char *list_pkt_forwarding_modes(void);
 char *list_pkt_forwarding_retry_modes(void);
Signature · 1 line
2.7.4
#29 lore raw

PATCH 2/4 ethdev: fix compiling errors for per-queue statistics

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
---
 app/test-pmd/cmdline.c              | 2 +-
 app/test-pmd/config.c               | 4 ++--
 app/test-pmd/testpmd.c              | 2 +-
 app/test-pmd/testpmd.h              | 5 +++--
 drivers/net/igc/igc_ethdev.c        | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c    | 4 ++--
 drivers/net/memif/rte_eth_memif.c   | 2 +-
 drivers/net/octeontx2/otx2_ethdev.h | 2 +-
 drivers/net/octeontx2/otx2_stats.c  | 2 +-
 drivers/net/virtio/virtio_ethdev.c  | 4 ++--
 lib/librte_ethdev/rte_ethdev.c      | 6 +++---
 lib/librte_ethdev/rte_ethdev.h      | 4 ++--
 lib/librte_ethdev/rte_ethdev_core.h | 2 +-
 13 files changed, 22 insertions(+), 21 deletions(-)
app/test-pmd/cmdline.c +1 -1
index 0a6ed85..40b6b17 100644
@@ -8244,7 +8244,7 @@ struct cmd_set_qmap_result {
 	cmdline_fixed_string_t what;
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
 };
 
 static void
app/test-pmd/config.c +2 -2
index 30bee33..9e7526d 100644
@@ -160,7 +160,7 @@ nic_stats_display(portid_t port_id)
 	uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
 	struct rte_eth_stats stats;
 	struct rte_port *port = &ports[port_id];
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
@@ -3623,7 +3623,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
 }
 
 void
-set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
+set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint16_t map_value)
 {
 	uint16_t i;
 	uint8_t existing_mapping_found = 0;
app/test-pmd/testpmd.c +1 -1
index 7842c3b..d5503bc 100644
@@ -1835,7 +1835,7 @@ fwd_stats_display(void)
 #endif
 	}
 	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-		uint8_t j;
+		uint16_t j;
 
 		pt_id = fwd_ports_ids[i];
 		port = &ports[pt_id];
app/test-pmd/testpmd.h +3 -2
index 25a12b1..4ac87b0 100644
@@ -285,7 +285,7 @@ enum dcb_mode_enable
 struct queue_stats_mappings {
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t stats_counter_id;
+	uint16_t stats_counter_id;
 } __rte_cache_aligned;
 
 extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
@@ -768,7 +768,8 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
 void tx_vlan_reset(portid_t port_id);
 void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
 
-void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
+void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id,
+	      uint16_t map_value);
 
 void set_xstats_hide_zero(uint8_t on_off);
 
drivers/net/igc/igc_ethdev.c +2 -2
index 6ab3ee9..7211505 100644
@@ -221,7 +221,7 @@ static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-	uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
+	uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx);
 static int
 eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -2076,7 +2076,7 @@ eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-		uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
+		uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx)
 {
 	struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
 
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index fd0cb9b..8c418f5 100644
@@ -178,7 +178,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
 	unsigned int limit);
 static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 				 size_t fw_size);
@@ -897,7 +897,7 @@ ixgbe_reset_qstat_mappings(struct ixgbe_hw *hw)
 static int
 ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id,
-				  uint8_t stat_idx,
+				  uint16_t stat_idx,
 				  uint8_t is_rx)
 {
 #define QSM_REG_NB_BITS_PER_QMAP_FIELD 8
drivers/net/memif/rte_eth_memif.c +1 -1
index c1c7e9f..696475c 100644
@@ -1341,7 +1341,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct memif_queue *mq;
 	int i;
-	uint8_t tmp, nq;
+	uint16_t tmp, nq;
 
 	stats->ipackets = 0;
 	stats->ibytes = 0;
drivers/net/octeontx2/otx2_ethdev.h +1 -1
index e9efe52..8c1cf78 100644
@@ -476,7 +476,7 @@ int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
 int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
-				 uint16_t queue_id, uint8_t stat_idx,
+				 uint16_t queue_id, uint16_t stat_idx,
 				 uint8_t is_rx);
 int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
 			struct rte_eth_xstat *xstats, unsigned int n);
drivers/net/octeontx2/otx2_stats.c +1 -1
index 8aaf270..6efe122 100644
@@ -145,7 +145,7 @@ otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
 int
 otx2_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
-			     uint8_t stat_idx, uint8_t is_rx)
+			     uint16_t stat_idx, uint8_t is_rx)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 
drivers/net/virtio/virtio_ethdev.c +2 -2
index dc0093b..8144bb2 100644
@@ -82,7 +82,7 @@ static int virtio_intr_disable(struct rte_eth_dev *dev);
 static int virtio_dev_queue_stats_mapping_set(
 	struct rte_eth_dev *eth_dev,
 	uint16_t queue_id,
-	uint8_t stat_idx,
+	uint16_t stat_idx,
 	uint8_t is_rx);
 
 static void virtio_notify_peers(struct rte_eth_dev *dev);
@@ -2647,7 +2647,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
  */
 static int
 virtio_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *eth_dev,
-__rte_unused uint16_t queue_id, __rte_unused uint8_t stat_idx,
+__rte_unused uint16_t queue_id, __rte_unused uint16_t stat_idx,
 __rte_unused uint8_t is_rx)
 {
 	return 0;
lib/librte_ethdev/rte_ethdev.c +3 -3
index 7858ad5..cf1f5d7 100644
@@ -2905,7 +2905,7 @@ rte_eth_xstats_reset(uint16_t port_id)
 }
 
 static int
-set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint16_t stat_idx,
 		uint8_t is_rx)
 {
 	struct rte_eth_dev *dev;
@@ -2932,7 +2932,7 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 
 int
 rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, tx_queue_id,
 						stat_idx, STAT_QMAP_TX));
@@ -2941,7 +2941,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
 
 int
 rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, rx_queue_id,
 						stat_idx, STAT_QMAP_RX));
lib/librte_ethdev/rte_ethdev.h +2 -2
index b0114bb..b4e10e2 100644
@@ -2610,7 +2610,7 @@ int rte_eth_xstats_reset(uint16_t port_id);
  *   Zero if successful. Non-zero otherwise.
  */
 int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);
 
 /**
  *  Set a mapping for the specified receive queue to the specified per-queue
@@ -2631,7 +2631,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
  */
 int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
 					   uint16_t rx_queue_id,
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);
 
 /**
  * Retrieve the Ethernet address of an Ethernet device.
lib/librte_ethdev/rte_ethdev_core.h +1 -1
index 32407dd..6061782 100644
@@ -223,7 +223,7 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
 
 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 
Signature · 1 line
2.7.4
#30 lore raw

Re: [dpdk-dev] [PATCH 2/4] ethdev: fix compiling errors for per-queue statistics

Quoted 29 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")
Quoted 15 lines
---
 app/test-pmd/cmdline.c              | 2 +-
 app/test-pmd/config.c               | 4 ++--
 app/test-pmd/testpmd.c              | 2 +-
 app/test-pmd/testpmd.h              | 5 +++--
 drivers/net/igc/igc_ethdev.c        | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c    | 4 ++--
 drivers/net/memif/rte_eth_memif.c   | 2 +-
 drivers/net/octeontx2/otx2_ethdev.h | 2 +-
 drivers/net/octeontx2/otx2_stats.c  | 2 +-
 drivers/net/virtio/virtio_ethdev.c  | 4 ++--
 lib/librte_ethdev/rte_ethdev.c      | 6 +++---
 lib/librte_ethdev/rte_ethdev.h      | 4 ++--
 lib/librte_ethdev/rte_ethdev_core.h | 2 +-
 13 files changed, 22 insertions(+), 21 deletions(-)

I didn't check the details yet, but with a very quick check 'app/proc-info/main.c' also causing build error when "RTE_ETHDEV_QUEUE_STAT_CNTRS > 256", can you please check that too?

Thanks,
ferruh

#31 lore raw

PATCH 3/4 doc: announce modified field in DCB TC queue mapping

In reply to Min Hu (Connor)

Field type of base and nb_queue will be modified, from uint8_t to uint16_t in struct ``rte_eth_dcb_tc_queue_mapping``.As the data of uint8_t will be truncated when queue number under a TC is greater than 256.

---
 doc/guides/rel_notes/release_20_11.rst | 3 +++
 1 file changed, 3 insertions(+)
doc/guides/rel_notes/release_20_11.rst +3 -0
index df227a1..e9c87c3 100644
@@ -100,6 +100,9 @@ ABI Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* ethdev: Modified field type of base and nb_queue, from uint8_t to uint16_t  in
+  struct ``rte_eth_dcb_tc_queue_mapping``.As the data of uint8_t will be truncated when
+  queue number under a TC is greater than 256.
 
 Known Issues
 ------------
Signature · 1 line
2.7.4
#32 lore raw

PATCH 4/4 doc: announce modified field in ethdev API

In reply to Min Hu (Connor)

Field type of stat_idx will be modified, from uint8_t to uint16_t in "set_queue_stats_mapping", "rte_eth_dev_set_tx_queue_stats_mapping", "rte_eth_dev_set_rx_queue_stats_mapping" for meeting the needs use 256 or more than 256 queues and display all statistics of rx/tx queue.

---
 doc/guides/rel_notes/release_20_11.rst | 4 ++++
 1 file changed, 4 insertions(+)
doc/guides/rel_notes/release_20_11.rst +4 -0
index e9c87c3..8e24d46 100644
@@ -84,6 +84,10 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* ethdev: Modified field type of stat_idx, from uint8_t to uint16_t  in
+  ``set_queue_stats_mapping``, ``rte_eth_dev_set_tx_queue_stats_mapping``,
+  ``rte_eth_dev_set_rx_queue_stats_mapping`` for meeting the needs use 256
+  or more than 256 queues and display all statistics of rx/tx queue.
 
 ABI Changes
 -----------
Signature · 1 line
2.7.4
#33 lore raw

Re: [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type

In reply to Min Hu (Connor)
Quoted 10 lines · Min Hu (Connor)

This series are minor change the queue ID type from uint8_t to uint16_t.

Huisong Li (2):
ethdev: change data type in TC rxq and TC txq
ethdev: fix compiling errors for per-queue statistics

Min Hu (Connor) (2):
doc: announce modified field in DCB TC queue mapping
doc: announce modified field in ethdev API

Hi Min, Huisong,

deprecation notices are part of the process and it should be prepared one release before current release, it is good for two things:
- requiring three ack ensures ABI/API breakage is really necessary and approved by multiple parties
- it notifies the breakage to the users at least one release in advance to give them time to prepare for it.

It doesn't really have a benefit to add and remove the deprecation notice in the same release.

For the patches above both are ABI breakages and normally requires deprecation notice to be announced from previous release to be able to change them in this release.

BUT, both are fixes and and I guess there is nothing controversial to update them, also if they are not fixed in this release they will need to wait for at least a year, so I am for getting them without deprecation notice in place.

Unless there is a strong objection to it, lets continue without deprecation notices, and you can drop those patches from the set.

Quoted 17 lines
 app/test-pmd/cmdline.c                 |  2 +-
 app/test-pmd/config.c                  |  4 ++--
 app/test-pmd/testpmd.c                 |  2 +-
 app/test-pmd/testpmd.h                 |  5 +++--
 doc/guides/rel_notes/release_20_11.rst |  7 +++++++
 drivers/net/igc/igc_ethdev.c           |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/memif/rte_eth_memif.c      |  2 +-
 drivers/net/octeontx2/otx2_ethdev.h    |  2 +-
 drivers/net/octeontx2/otx2_stats.c     |  2 +-
 drivers/net/virtio/virtio_ethdev.c     |  4 ++--
 lib/librte_ethdev/rte_ethdev.c         |  6 +++---
 lib/librte_ethdev/rte_ethdev.h         | 12 ++++++------
 lib/librte_ethdev/rte_ethdev_core.h    |  2 +-
 14 files changed, 33 insertions(+), 25 deletions(-)
#34 lore raw

RFC v4 2/2 Description: dpdk: fix compiling errors for more than 256 per-queue statistics

In reply to Min Hu(Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD driver and librte_ethdev during compiling dpdk project. But it is possible and permited that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

---
 app/test-pmd/cmdline.c              | 2 +-
 app/test-pmd/config.c               | 4 ++--
 app/test-pmd/testpmd.c              | 2 +-
 app/test-pmd/testpmd.h              | 5 +++--
 drivers/net/igc/igc_ethdev.c        | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c    | 4 ++--
 drivers/net/memif/rte_eth_memif.c   | 2 +-
 drivers/net/octeontx2/otx2_ethdev.h | 2 +-
 drivers/net/octeontx2/otx2_stats.c  | 2 +-
 drivers/net/virtio/virtio_ethdev.c  | 4 ++--
 lib/librte_ethdev/rte_ethdev.c      | 6 +++---
 lib/librte_ethdev/rte_ethdev.h      | 4 ++--
 lib/librte_ethdev/rte_ethdev_core.h | 2 +-
 13 files changed, 22 insertions(+), 21 deletions(-)
app/test-pmd/cmdline.c +1 -1
index 0a6ed85..40b6b17 100644
@@ -8244,7 +8244,7 @@ struct cmd_set_qmap_result {
 	cmdline_fixed_string_t what;
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
 };
 
 static void
app/test-pmd/config.c +2 -2
index 30bee33..9e7526d 100644
@@ -160,7 +160,7 @@ nic_stats_display(portid_t port_id)
 	uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
 	struct rte_eth_stats stats;
 	struct rte_port *port = &ports[port_id];
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
@@ -3623,7 +3623,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
 }
 
 void
-set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
+set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint16_t map_value)
 {
 	uint16_t i;
 	uint8_t existing_mapping_found = 0;
app/test-pmd/testpmd.c +1 -1
index 7842c3b..d5503bc 100644
@@ -1835,7 +1835,7 @@ fwd_stats_display(void)
 #endif
 	}
 	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-		uint8_t j;
+		uint16_t j;
 
 		pt_id = fwd_ports_ids[i];
 		port = &ports[pt_id];
app/test-pmd/testpmd.h +3 -2
index 25a12b1..4ac87b0 100644
@@ -285,7 +285,7 @@ enum dcb_mode_enable
 struct queue_stats_mappings {
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t stats_counter_id;
+	uint16_t stats_counter_id;
 } __rte_cache_aligned;
 
 extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
@@ -768,7 +768,8 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
 void tx_vlan_reset(portid_t port_id);
 void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
 
-void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
+void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id,
+	      uint16_t map_value);
 
 void set_xstats_hide_zero(uint8_t on_off);
 
drivers/net/igc/igc_ethdev.c +2 -2
index 6ab3ee9..7211505 100644
@@ -221,7 +221,7 @@ static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-	uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
+	uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx);
 static int
 eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -2076,7 +2076,7 @@ eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-		uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
+		uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx)
 {
 	struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
 
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index fd0cb9b..8c418f5 100644
@@ -178,7 +178,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
 	unsigned int limit);
 static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 				 size_t fw_size);
@@ -897,7 +897,7 @@ ixgbe_reset_qstat_mappings(struct ixgbe_hw *hw)
 static int
 ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id,
-				  uint8_t stat_idx,
+				  uint16_t stat_idx,
 				  uint8_t is_rx)
 {
 #define QSM_REG_NB_BITS_PER_QMAP_FIELD 8
drivers/net/memif/rte_eth_memif.c +1 -1
index c1c7e9f..696475c 100644
@@ -1341,7 +1341,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct memif_queue *mq;
 	int i;
-	uint8_t tmp, nq;
+	uint16_t tmp, nq;
 
 	stats->ipackets = 0;
 	stats->ibytes = 0;
drivers/net/octeontx2/otx2_ethdev.h +1 -1
index e9efe52..8c1cf78 100644
@@ -476,7 +476,7 @@ int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
 int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
-				 uint16_t queue_id, uint8_t stat_idx,
+				 uint16_t queue_id, uint16_t stat_idx,
 				 uint8_t is_rx);
 int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
 			struct rte_eth_xstat *xstats, unsigned int n);
drivers/net/octeontx2/otx2_stats.c +1 -1
index 8aaf270..6efe122 100644
@@ -145,7 +145,7 @@ otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
 int
 otx2_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
-			     uint8_t stat_idx, uint8_t is_rx)
+			     uint16_t stat_idx, uint8_t is_rx)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 
drivers/net/virtio/virtio_ethdev.c +2 -2
index dc0093b..8144bb2 100644
@@ -82,7 +82,7 @@ static int virtio_intr_disable(struct rte_eth_dev *dev);
 static int virtio_dev_queue_stats_mapping_set(
 	struct rte_eth_dev *eth_dev,
 	uint16_t queue_id,
-	uint8_t stat_idx,
+	uint16_t stat_idx,
 	uint8_t is_rx);
 
 static void virtio_notify_peers(struct rte_eth_dev *dev);
@@ -2647,7 +2647,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
  */
 static int
 virtio_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *eth_dev,
-__rte_unused uint16_t queue_id, __rte_unused uint8_t stat_idx,
+__rte_unused uint16_t queue_id, __rte_unused uint16_t stat_idx,
 __rte_unused uint8_t is_rx)
 {
 	return 0;
lib/librte_ethdev/rte_ethdev.c +3 -3
index 0a96718..74dadb8 100644
@@ -2905,7 +2905,7 @@ rte_eth_xstats_reset(uint16_t port_id)
 }
 
 static int
-set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint16_t stat_idx,
 		uint8_t is_rx)
 {
 	struct rte_eth_dev *dev;
@@ -2932,7 +2932,7 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 
 int
 rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, tx_queue_id,
 						stat_idx, STAT_QMAP_TX));
@@ -2941,7 +2941,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
 
 int
 rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, rx_queue_id,
 						stat_idx, STAT_QMAP_RX));
lib/librte_ethdev/rte_ethdev.h +2 -2
index f51a688..71c4662 100644
@@ -2621,7 +2621,7 @@ int rte_eth_xstats_reset(uint16_t port_id);
  *   Zero if successful. Non-zero otherwise.
  */
 int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);
 
 /**
  *  Set a mapping for the specified receive queue to the specified per-queue
@@ -2642,7 +2642,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
  */
 int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
 					   uint16_t rx_queue_id,
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);
 
 /**
  * Retrieve the Ethernet address of an Ethernet device.
lib/librte_ethdev/rte_ethdev_core.h +1 -1
index 1f2c414..e42f280 100644
@@ -223,7 +223,7 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
 
 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 
Signature · 1 line
2.7.4
#35 lore raw

v4 cover change data type in TC queue

In reply to Min Hu(Connor)

From: Huisong Li <[email protected]>

This series change data type in TC rxq and TC txq, fix compiling errors for per-queue statistics.

Huisong Li (2):
dpdk: resolve compiling errors for per-queue stats
ethdev: change data type in TC rxq and TC txq

 app/proc-info/main.c                  |  2 +-
 app/test-pmd/cmdline.c                |  4 ++--
 app/test-pmd/config.c                 |  4 ++--
 app/test-pmd/testpmd.c                |  2 +-
 app/test-pmd/testpmd.h                |  5 +++--
 drivers/net/igc/igc_ethdev.c          |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c      |  4 ++--
 drivers/net/memif/rte_eth_memif.c     |  2 +-
 drivers/net/octeontx2/otx2_ethdev.h   |  2 +-
 drivers/net/octeontx2/otx2_stats.c    |  2 +-
 drivers/net/virtio/virtio_ethdev.c    |  4 ++--
 lib/librte_ethdev/rte_ethdev.c        |  6 +++---
 lib/librte_ethdev/rte_ethdev.h        | 12 ++++++------
 lib/librte_ethdev/rte_ethdev_driver.h |  2 +-
 14 files changed, 28 insertions(+), 27 deletions(-)
Signature · 1 line
2.7.4
#36 lore raw

PATCH v4 1/2 dpdk: resolve compiling errors for per-queue stats

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")

---
v3->v4:
add a change in cmd_setqmap_mapvalue.

---
v2->v3:
change 'uint8_t i' to 'uint16_t i' in nic_stats_display function

---
 app/proc-info/main.c                  | 2 +-
 app/test-pmd/cmdline.c                | 4 ++--
 app/test-pmd/config.c                 | 4 ++--
 app/test-pmd/testpmd.c                | 2 +-
 app/test-pmd/testpmd.h                | 5 +++--
 drivers/net/igc/igc_ethdev.c          | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c      | 4 ++--
 drivers/net/memif/rte_eth_memif.c     | 2 +-
 drivers/net/octeontx2/otx2_ethdev.h   | 2 +-
 drivers/net/octeontx2/otx2_stats.c    | 2 +-
 drivers/net/virtio/virtio_ethdev.c    | 4 ++--
 lib/librte_ethdev/rte_ethdev.c        | 6 +++---
 lib/librte_ethdev/rte_ethdev.h        | 4 ++--
 lib/librte_ethdev/rte_ethdev_driver.h | 2 +-
 14 files changed, 24 insertions(+), 23 deletions(-)
app/proc-info/main.c +1 -1
index 64fb83b..26d9355 100644
@@ -348,7 +348,7 @@ static void
 nic_stats_display(uint16_t port_id)
 {
 	struct rte_eth_stats stats;
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
app/test-pmd/cmdline.c +2 -2
index 08e123f..23e624f 100644
@@ -8315,7 +8315,7 @@ struct cmd_set_qmap_result {
 	cmdline_fixed_string_t what;
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
 };
 
 static void
@@ -8346,7 +8346,7 @@ cmdline_parse_token_num_t cmd_setqmap_queueid =
 			      queue_id, UINT16);
 cmdline_parse_token_num_t cmd_setqmap_mapvalue =
 	TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
-			      map_value, UINT8);
+			      map_value, UINT16);
 
 cmdline_parse_inst_t cmd_set_qmap = {
 	.f = cmd_set_qmap_parsed,
app/test-pmd/config.c +2 -2
index 17a6efe..dfe5627 100644
@@ -161,7 +161,7 @@ nic_stats_display(portid_t port_id)
 	uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
 	struct rte_eth_stats stats;
 	struct rte_port *port = &ports[port_id];
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
@@ -3742,7 +3742,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
 }
 
 void
-set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
+set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint16_t map_value)
 {
 	uint16_t i;
 	uint8_t existing_mapping_found = 0;
app/test-pmd/testpmd.c +1 -1
index fe6450c..4b26c5c 100644
@@ -1840,7 +1840,7 @@ fwd_stats_display(void)
 			fwd_cycles += fs->core_cycles;
 	}
 	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-		uint8_t j;
+		uint16_t j;
 
 		pt_id = fwd_ports_ids[i];
 		port = &ports[pt_id];
app/test-pmd/testpmd.h +3 -2
index c7e7e41..9ad002c 100644
@@ -279,7 +279,7 @@ enum dcb_mode_enable
 struct queue_stats_mappings {
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t stats_counter_id;
+	uint16_t stats_counter_id;
 } __rte_cache_aligned;
 
 extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
@@ -794,7 +794,8 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
 void tx_vlan_reset(portid_t port_id);
 void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
 
-void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
+void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id,
+	      uint16_t map_value);
 
 void set_xstats_hide_zero(uint8_t on_off);
 
drivers/net/igc/igc_ethdev.c +2 -2
index 810568b..875874e 100644
@@ -221,7 +221,7 @@ static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-	uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
+	uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx);
 static int
 eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -2075,7 +2075,7 @@ eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-		uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
+		uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx)
 {
 	struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
 
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 03aea20..e93f3b8 100644
@@ -178,7 +178,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
 	unsigned int limit);
 static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 				 size_t fw_size);
@@ -890,7 +890,7 @@ ixgbe_reset_qstat_mappings(struct ixgbe_hw *hw)
 static int
 ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id,
-				  uint8_t stat_idx,
+				  uint16_t stat_idx,
 				  uint8_t is_rx)
 {
 #define QSM_REG_NB_BITS_PER_QMAP_FIELD 8
drivers/net/memif/rte_eth_memif.c +1 -1
index a19c0f3..29cea93 100644
@@ -1356,7 +1356,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct memif_queue *mq;
 	int i;
-	uint8_t tmp, nq;
+	uint16_t tmp, nq;
 
 	stats->ipackets = 0;
 	stats->ibytes = 0;
drivers/net/octeontx2/otx2_ethdev.h +1 -1
index a114112..0c761e3 100644
@@ -476,7 +476,7 @@ int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
 int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
-				 uint16_t queue_id, uint8_t stat_idx,
+				 uint16_t queue_id, uint16_t stat_idx,
 				 uint8_t is_rx);
 int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
 			struct rte_eth_xstat *xstats, unsigned int n);
drivers/net/octeontx2/otx2_stats.c +1 -1
index 8aaf270..6efe122 100644
@@ -145,7 +145,7 @@ otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
 int
 otx2_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
-			     uint8_t stat_idx, uint8_t is_rx)
+			     uint16_t stat_idx, uint8_t is_rx)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 
drivers/net/virtio/virtio_ethdev.c +2 -2
index 013a290..9d26012 100644
@@ -82,7 +82,7 @@ static int virtio_intr_disable(struct rte_eth_dev *dev);
 static int virtio_dev_queue_stats_mapping_set(
 	struct rte_eth_dev *eth_dev,
 	uint16_t queue_id,
-	uint8_t stat_idx,
+	uint16_t stat_idx,
 	uint8_t is_rx);
 
 static void virtio_notify_peers(struct rte_eth_dev *dev);
@@ -2648,7 +2648,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
  */
 static int
 virtio_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *eth_dev,
-__rte_unused uint16_t queue_id, __rte_unused uint8_t stat_idx,
+__rte_unused uint16_t queue_id, __rte_unused uint16_t stat_idx,
 __rte_unused uint8_t is_rx)
 {
 	return 0;
lib/librte_ethdev/rte_ethdev.c +3 -3
index dfe5c1b..749b372 100644
@@ -2942,7 +2942,7 @@ rte_eth_xstats_reset(uint16_t port_id)
 }
 
 static int
-set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint16_t stat_idx,
 		uint8_t is_rx)
 {
 	struct rte_eth_dev *dev;
@@ -2969,7 +2969,7 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 
 int
 rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, tx_queue_id,
 						stat_idx, STAT_QMAP_TX));
@@ -2978,7 +2978,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
 
 int
 rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, rx_queue_id,
 						stat_idx, STAT_QMAP_RX));
lib/librte_ethdev/rte_ethdev.h +2 -2
index 645a186..ff3a616 100644
@@ -2679,7 +2679,7 @@ int rte_eth_xstats_reset(uint16_t port_id);
  *   Zero if successful. Non-zero otherwise.
  */
 int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);
 
 /**
  *  Set a mapping for the specified receive queue to the specified per-queue
@@ -2700,7 +2700,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
  */
 int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
 					   uint16_t rx_queue_id,
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);
 
 /**
  * Retrieve the Ethernet address of an Ethernet device.
lib/librte_ethdev/rte_ethdev_driver.h +1 -1
index 23cc1e0..c68d465 100644
@@ -222,7 +222,7 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
 
 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 
Signature · 1 line
2.7.4
#37 lore raw

PATCH v4 2/2 ethdev: change data type in TC rxq and TC txq

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these data will be truncated when queue number under a TC is greater than 256. So it is necessary for base and nb_queue to change from uint8_t to uint16_t.

Fixes 01eb53eefeb40e8 ("ethdev: rename folder to library name")
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_ethdev/rte_ethdev.h +4 -4
index ff3a616..2270460 100644
@@ -1522,13 +1522,13 @@ struct rte_eth_xstat_name {
 struct rte_eth_dcb_tc_queue_mapping {
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 };
 
Signature · 1 line
2.7.4
#38 lore raw

Re: [dpdk-dev] [PATCH V4 0/2] change data type in TC queue

In reply to Min Hu (Connor)
Quoted 9 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

This series change data type in TC rxq and TC txq, fix compiling errors for per-queue statistics.

Huisong Li (2):
dpdk: resolve compiling errors for per-queue stats
ethdev: change data type in TC rxq and TC txq

Quoted 16 lines
  app/proc-info/main.c                  |  2 +-
  app/test-pmd/cmdline.c                |  4 ++--
  app/test-pmd/config.c                 |  4 ++--
  app/test-pmd/testpmd.c                |  2 +-
  app/test-pmd/testpmd.h                |  5 +++--
  drivers/net/igc/igc_ethdev.c          |  4 ++--
  drivers/net/ixgbe/ixgbe_ethdev.c      |  4 ++--
  drivers/net/memif/rte_eth_memif.c     |  2 +-
  drivers/net/octeontx2/otx2_ethdev.h   |  2 +-
  drivers/net/octeontx2/otx2_stats.c    |  2 +-
  drivers/net/virtio/virtio_ethdev.c    |  4 ++--
  lib/librte_ethdev/rte_ethdev.c        |  6 +++---
  lib/librte_ethdev/rte_ethdev.h        | 12 ++++++------
  lib/librte_ethdev/rte_ethdev_driver.h |  2 +-
  14 files changed, 28 insertions(+), 27 deletions(-)

While you are dropping the deprecation notice, it seems dropped the release notes updates too, they were good to have.

If you don't mind can you add the release notes updated back, and instead of making them separate patch they can be be squashed into existing patches.

Thanks again.

#39 lore raw

v5 cover change data type in TC queue

In reply to Min Hu(Connor)

From: Huisong Li <[email protected]>

This series change data type in TC rxq and TC txq, fix compiling errors for per-queue statistics.

Huisong Li (2):
dpdk: resolve compiling errors for per-queue stats
ethdev: change data type in TC rxq and TC txq

 app/proc-info/main.c                   |  2 +-
 app/test-pmd/cmdline.c                 |  4 ++--
 app/test-pmd/config.c                  |  4 ++--
 app/test-pmd/testpmd.c                 |  2 +-
 app/test-pmd/testpmd.h                 |  5 +++--
 doc/guides/rel_notes/release_20_11.rst |  5 +++++
 drivers/net/igc/igc_ethdev.c           |  4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c       |  4 ++--
 drivers/net/memif/rte_eth_memif.c      |  2 +-
 drivers/net/octeontx2/otx2_ethdev.h    |  2 +-
 drivers/net/octeontx2/otx2_stats.c     |  2 +-
 drivers/net/virtio/virtio_ethdev.c     |  4 ++--
 lib/librte_ethdev/rte_ethdev.c         |  6 +++---
 lib/librte_ethdev/rte_ethdev.h         | 12 ++++++------
 lib/librte_ethdev/rte_ethdev_driver.h  |  2 +-
 15 files changed, 33 insertions(+), 27 deletions(-)
Signature · 1 line
2.7.4
#40 lore raw

PATCH v5 1/2 dpdk: resolve compiling errors for per-queue stats

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")

---
V4 -> V5:
add release notes updated.

---
v3->v4:
add a change in cmd_setqmap_mapvalue.

---
v2->v3:
change 'uint8_t i' to 'uint16_t i' in nic_stats_display function.

---
 app/proc-info/main.c                   | 2 +-
 app/test-pmd/cmdline.c                 | 4 ++--
 app/test-pmd/config.c                  | 4 ++--
 app/test-pmd/testpmd.c                 | 2 +-
 app/test-pmd/testpmd.h                 | 5 +++--
 doc/guides/rel_notes/release_20_11.rst | 5 +++++
 drivers/net/igc/igc_ethdev.c           | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c       | 4 ++--
 drivers/net/memif/rte_eth_memif.c      | 2 +-
 drivers/net/octeontx2/otx2_ethdev.h    | 2 +-
 drivers/net/octeontx2/otx2_stats.c     | 2 +-
 drivers/net/virtio/virtio_ethdev.c     | 4 ++--
 lib/librte_ethdev/rte_ethdev.c         | 6 +++---
 lib/librte_ethdev/rte_ethdev.h         | 4 ++--
 lib/librte_ethdev/rte_ethdev_driver.h  | 2 +-
 15 files changed, 29 insertions(+), 23 deletions(-)
app/proc-info/main.c +1 -1
index 64fb83b..26d9355 100644
@@ -348,7 +348,7 @@ static void
 nic_stats_display(uint16_t port_id)
 {
 	struct rte_eth_stats stats;
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
app/test-pmd/cmdline.c +2 -2
index 08e123f..23e624f 100644
@@ -8315,7 +8315,7 @@ struct cmd_set_qmap_result {
 	cmdline_fixed_string_t what;
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
 };
 
 static void
@@ -8346,7 +8346,7 @@ cmdline_parse_token_num_t cmd_setqmap_queueid =
 			      queue_id, UINT16);
 cmdline_parse_token_num_t cmd_setqmap_mapvalue =
 	TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
-			      map_value, UINT8);
+			      map_value, UINT16);
 
 cmdline_parse_inst_t cmd_set_qmap = {
 	.f = cmd_set_qmap_parsed,
app/test-pmd/config.c +2 -2
index 17a6efe..dfe5627 100644
@@ -161,7 +161,7 @@ nic_stats_display(portid_t port_id)
 	uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
 	struct rte_eth_stats stats;
 	struct rte_port *port = &ports[port_id];
-	uint8_t i;
+	uint16_t i;
 
 	static const char *nic_stats_border = "########################";
 
@@ -3742,7 +3742,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
 }
 
 void
-set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
+set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint16_t map_value)
 {
 	uint16_t i;
 	uint8_t existing_mapping_found = 0;
app/test-pmd/testpmd.c +1 -1
index fe6450c..4b26c5c 100644
@@ -1840,7 +1840,7 @@ fwd_stats_display(void)
 			fwd_cycles += fs->core_cycles;
 	}
 	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-		uint8_t j;
+		uint16_t j;
 
 		pt_id = fwd_ports_ids[i];
 		port = &ports[pt_id];
app/test-pmd/testpmd.h +3 -2
index c7e7e41..9ad002c 100644
@@ -279,7 +279,7 @@ enum dcb_mode_enable
 struct queue_stats_mappings {
 	portid_t port_id;
 	uint16_t queue_id;
-	uint8_t stats_counter_id;
+	uint16_t stats_counter_id;
 } __rte_cache_aligned;
 
 extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
@@ -794,7 +794,8 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
 void tx_vlan_reset(portid_t port_id);
 void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
 
-void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
+void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id,
+	      uint16_t map_value);
 
 void set_xstats_hide_zero(uint8_t on_off);
 
doc/guides/rel_notes/release_20_11.rst +5 -0
index 4bcf220..1ef6f0e 100644
@@ -178,6 +178,11 @@ API Changes
 
 * bpf: ``RTE_BPF_XTYPE_NUM`` has been dropped from ``rte_bpf_xtype``.
 
+* ethdev: Data type of input parameter ``stat_idx`` in ``set_queue_stats_mapping``,
+  ``rte_eth_dev_set_tx_queue_stats_mapping`` and ``rte_eth_dev_set_rx_queue_stats_mapping``
+  function will be changed from ``uint8_t`` to ``uint16_t``, which supports for
+  using 256 or more than 256 queues and displaying all statistics of rx/tx queue.
+
 
 ABI Changes
 -----------
drivers/net/igc/igc_ethdev.c +2 -2
index 810568b..875874e 100644
@@ -221,7 +221,7 @@ static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
 static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-	uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
+	uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx);
 static int
 eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
 static int
@@ -2075,7 +2075,7 @@ eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 
 static int
 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-		uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
+		uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx)
 {
 	struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
 
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 8da963a..c6ea83a 100644
@@ -178,7 +178,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
 	unsigned int limit);
 static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
 				 size_t fw_size);
@@ -890,7 +890,7 @@ ixgbe_reset_qstat_mappings(struct ixgbe_hw *hw)
 static int
 ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
 				  uint16_t queue_id,
-				  uint8_t stat_idx,
+				  uint16_t stat_idx,
 				  uint8_t is_rx)
 {
 #define QSM_REG_NB_BITS_PER_QMAP_FIELD 8
drivers/net/memif/rte_eth_memif.c +1 -1
index a19c0f3..29cea93 100644
@@ -1356,7 +1356,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct memif_queue *mq;
 	int i;
-	uint8_t tmp, nq;
+	uint16_t tmp, nq;
 
 	stats->ipackets = 0;
 	stats->ibytes = 0;
drivers/net/octeontx2/otx2_ethdev.h +1 -1
index a114112..0c761e3 100644
@@ -476,7 +476,7 @@ int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
 int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
 int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
-				 uint16_t queue_id, uint8_t stat_idx,
+				 uint16_t queue_id, uint16_t stat_idx,
 				 uint8_t is_rx);
 int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
 			struct rte_eth_xstat *xstats, unsigned int n);
drivers/net/octeontx2/otx2_stats.c +1 -1
index 8aaf270..6efe122 100644
@@ -145,7 +145,7 @@ otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
 int
 otx2_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
-			     uint8_t stat_idx, uint8_t is_rx)
+			     uint16_t stat_idx, uint8_t is_rx)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 
drivers/net/virtio/virtio_ethdev.c +2 -2
index 013a290..9d26012 100644
@@ -82,7 +82,7 @@ static int virtio_intr_disable(struct rte_eth_dev *dev);
 static int virtio_dev_queue_stats_mapping_set(
 	struct rte_eth_dev *eth_dev,
 	uint16_t queue_id,
-	uint8_t stat_idx,
+	uint16_t stat_idx,
 	uint8_t is_rx);
 
 static void virtio_notify_peers(struct rte_eth_dev *dev);
@@ -2648,7 +2648,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
  */
 static int
 virtio_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *eth_dev,
-__rte_unused uint16_t queue_id, __rte_unused uint8_t stat_idx,
+__rte_unused uint16_t queue_id, __rte_unused uint16_t stat_idx,
 __rte_unused uint8_t is_rx)
 {
 	return 0;
lib/librte_ethdev/rte_ethdev.c +3 -3
index dfe5c1b..749b372 100644
@@ -2942,7 +2942,7 @@ rte_eth_xstats_reset(uint16_t port_id)
 }
 
 static int
-set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint16_t stat_idx,
 		uint8_t is_rx)
 {
 	struct rte_eth_dev *dev;
@@ -2969,7 +2969,7 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 
 int
 rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, tx_queue_id,
 						stat_idx, STAT_QMAP_TX));
@@ -2978,7 +2978,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
 
 int
 rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
 {
 	return eth_err(port_id, set_queue_stats_mapping(port_id, rx_queue_id,
 						stat_idx, STAT_QMAP_RX));
lib/librte_ethdev/rte_ethdev.h +2 -2
index 645a186..ff3a616 100644
@@ -2679,7 +2679,7 @@ int rte_eth_xstats_reset(uint16_t port_id);
  *   Zero if successful. Non-zero otherwise.
  */
 int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);
 
 /**
  *  Set a mapping for the specified receive queue to the specified per-queue
@@ -2700,7 +2700,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
  */
 int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
 					   uint16_t rx_queue_id,
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);
 
 /**
  * Retrieve the Ethernet address of an Ethernet device.
lib/librte_ethdev/rte_ethdev_driver.h +1 -1
index 23cc1e0..c68d465 100644
@@ -222,7 +222,7 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
 
 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
 					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
 					     uint8_t is_rx);
 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 
Signature · 1 line
2.7.4
#41 lore raw

Re: [dpdk-dev] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

Quoted 331 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")

---
V4 -> V5:
add release notes updated.

---
v3->v4:
add a change in cmd_setqmap_mapvalue.

---
v2->v3:
change 'uint8_t i' to 'uint16_t i' in nic_stats_display function.

---
  app/proc-info/main.c                   | 2 +-
  app/test-pmd/cmdline.c                 | 4 ++--
  app/test-pmd/config.c                  | 4 ++--
  app/test-pmd/testpmd.c                 | 2 +-
  app/test-pmd/testpmd.h                 | 5 +++--
  doc/guides/rel_notes/release_20_11.rst | 5 +++++
  drivers/net/igc/igc_ethdev.c           | 4 ++--
  drivers/net/ixgbe/ixgbe_ethdev.c       | 4 ++--
  drivers/net/memif/rte_eth_memif.c      | 2 +-
  drivers/net/octeontx2/otx2_ethdev.h    | 2 +-
  drivers/net/octeontx2/otx2_stats.c     | 2 +-
  drivers/net/virtio/virtio_ethdev.c     | 4 ++--
  lib/librte_ethdev/rte_ethdev.c         | 6 +++---
  lib/librte_ethdev/rte_ethdev.h         | 4 ++--
  lib/librte_ethdev/rte_ethdev_driver.h  | 2 +-
  15 files changed, 29 insertions(+), 23 deletions(-)
app/proc-info/main.c +1 -1
index 64fb83b..26d9355 100644
@@ -348,7 +348,7 @@ static void
  nic_stats_display(uint16_t port_id)
  {
  	struct rte_eth_stats stats;
-	uint8_t i;
+	uint16_t i;
 
  	static const char *nic_stats_border = "########################";
 
app/test-pmd/cmdline.c +2 -2
index 08e123f..23e624f 100644
@@ -8315,7 +8315,7 @@ struct cmd_set_qmap_result {
  	cmdline_fixed_string_t what;
  	portid_t port_id;
  	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
  };
 
  static void
@@ -8346,7 +8346,7 @@ cmdline_parse_token_num_t cmd_setqmap_queueid =
  			      queue_id, UINT16);
  cmdline_parse_token_num_t cmd_setqmap_mapvalue =
  	TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
-			      map_value, UINT8);
+			      map_value, UINT16);
 
  cmdline_parse_inst_t cmd_set_qmap = {
  	.f = cmd_set_qmap_parsed,
app/test-pmd/config.c +2 -2
index 17a6efe..dfe5627 100644
@@ -161,7 +161,7 @@ nic_stats_display(portid_t port_id)
  	uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
  	struct rte_eth_stats stats;
  	struct rte_port *port = &ports[port_id];
-	uint8_t i;
+	uint16_t i;
 
  	static const char *nic_stats_border = "########################";
 
@@ -3742,7 +3742,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
  }
 
  void
-set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
+set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint16_t map_value)
  {
  	uint16_t i;
  	uint8_t existing_mapping_found = 0;
app/test-pmd/testpmd.c +1 -1
index fe6450c..4b26c5c 100644
@@ -1840,7 +1840,7 @@ fwd_stats_display(void)
  			fwd_cycles += fs->core_cycles;
  	}
  	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-		uint8_t j;
+		uint16_t j;
 
  		pt_id = fwd_ports_ids[i];
  		port = &ports[pt_id];
app/test-pmd/testpmd.h +3 -2
index c7e7e41..9ad002c 100644
@@ -279,7 +279,7 @@ enum dcb_mode_enable
  struct queue_stats_mappings {
  	portid_t port_id;
  	uint16_t queue_id;
-	uint8_t stats_counter_id;
+	uint16_t stats_counter_id;
  } __rte_cache_aligned;
 
  extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
@@ -794,7 +794,8 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
  void tx_vlan_reset(portid_t port_id);
  void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
 
-void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
+void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id,
+	      uint16_t map_value);
 
  void set_xstats_hide_zero(uint8_t on_off);
 
doc/guides/rel_notes/release_20_11.rst +5 -0
index 4bcf220..1ef6f0e 100644
@@ -178,6 +178,11 @@ API Changes
 
  * bpf: ``RTE_BPF_XTYPE_NUM`` has been dropped from ``rte_bpf_xtype``.
 
+* ethdev: Data type of input parameter ``stat_idx`` in ``set_queue_stats_mapping``,
+  ``rte_eth_dev_set_tx_queue_stats_mapping`` and ``rte_eth_dev_set_rx_queue_stats_mapping``
+  function will be changed from ``uint8_t`` to ``uint16_t``, which supports for
+  using 256 or more than 256 queues and displaying all statistics of rx/tx queue.
+
 
  ABI Changes
  -----------
drivers/net/igc/igc_ethdev.c +2 -2
index 810568b..875874e 100644
@@ -221,7 +221,7 @@ static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
  static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
  static int
  eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-	uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
+	uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx);
  static int
  eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
  static int
@@ -2075,7 +2075,7 @@ eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 
  static int
  eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-		uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
+		uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx)
  {
  	struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
 
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 8da963a..c6ea83a 100644
@@ -178,7 +178,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
  	unsigned int limit);
  static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
  					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
  					     uint8_t is_rx);
  static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
  				 size_t fw_size);
@@ -890,7 +890,7 @@ ixgbe_reset_qstat_mappings(struct ixgbe_hw *hw)
  static int
  ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
  				  uint16_t queue_id,
-				  uint8_t stat_idx,
+				  uint16_t stat_idx,
  				  uint8_t is_rx)
  {
  #define QSM_REG_NB_BITS_PER_QMAP_FIELD 8
drivers/net/memif/rte_eth_memif.c +1 -1
index a19c0f3..29cea93 100644
@@ -1356,7 +1356,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
  	struct pmd_internals *pmd = dev->data->dev_private;
  	struct memif_queue *mq;
  	int i;
-	uint8_t tmp, nq;
+	uint16_t tmp, nq;
 
  	stats->ipackets = 0;
  	stats->ibytes = 0;
drivers/net/octeontx2/otx2_ethdev.h +1 -1
index a114112..0c761e3 100644
@@ -476,7 +476,7 @@ int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
  int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
  int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
-				 uint16_t queue_id, uint8_t stat_idx,
+				 uint16_t queue_id, uint16_t stat_idx,
  				 uint8_t is_rx);
  int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
  			struct rte_eth_xstat *xstats, unsigned int n);
drivers/net/octeontx2/otx2_stats.c +1 -1
index 8aaf270..6efe122 100644
@@ -145,7 +145,7 @@ otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
  int
  otx2_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
-			     uint8_t stat_idx, uint8_t is_rx)
+			     uint16_t stat_idx, uint8_t is_rx)
  {
  	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 
drivers/net/virtio/virtio_ethdev.c +2 -2
index 013a290..9d26012 100644
@@ -82,7 +82,7 @@ static int virtio_intr_disable(struct rte_eth_dev *dev);
  static int virtio_dev_queue_stats_mapping_set(
  	struct rte_eth_dev *eth_dev,
  	uint16_t queue_id,
-	uint8_t stat_idx,
+	uint16_t stat_idx,
  	uint8_t is_rx);
 
  static void virtio_notify_peers(struct rte_eth_dev *dev);
@@ -2648,7 +2648,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
   */
  static int
  virtio_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *eth_dev,
-__rte_unused uint16_t queue_id, __rte_unused uint8_t stat_idx,
+__rte_unused uint16_t queue_id, __rte_unused uint16_t stat_idx,
  __rte_unused uint8_t is_rx)
  {
  	return 0;
lib/librte_ethdev/rte_ethdev.c +3 -3
index dfe5c1b..749b372 100644
@@ -2942,7 +2942,7 @@ rte_eth_xstats_reset(uint16_t port_id)
  }
 
  static int
-set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint16_t stat_idx,
  		uint8_t is_rx)
  {
  	struct rte_eth_dev *dev;
@@ -2969,7 +2969,7 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 
  int
  rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
  {
  	return eth_err(port_id, set_queue_stats_mapping(port_id, tx_queue_id,
  						stat_idx, STAT_QMAP_TX));
@@ -2978,7 +2978,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
 
  int
  rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
  {
  	return eth_err(port_id, set_queue_stats_mapping(port_id, rx_queue_id,
  						stat_idx, STAT_QMAP_RX));
lib/librte_ethdev/rte_ethdev.h +2 -2
index 645a186..ff3a616 100644
@@ -2679,7 +2679,7 @@ int rte_eth_xstats_reset(uint16_t port_id);
   *   Zero if successful. Non-zero otherwise.
   */
  int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);
 
  /**
   *  Set a mapping for the specified receive queue to the specified per-queue
@@ -2700,7 +2700,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
   */
  int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
  					   uint16_t rx_queue_id,
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);
 
  /**
   * Retrieve the Ethernet address of an Ethernet device.
lib/librte_ethdev/rte_ethdev_driver.h +0 -0
index 23cc1e0..c68d465 100644

lib/librte_ethdev/rte_ethdev_driver.h typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev, · line 228

Quoted 8 lines
lib/librte_ethdev/rte_ethdev_driver.h +1 -1
@@ -222,7 +222,7 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
 
  typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
  					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
  					     uint8_t is_rx);
  /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

Can you please review the patch, is there any objectio to proceed with it?

#42 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
  int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 9 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

#43 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

Quoted 40 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
  int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 8 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.it it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

It is probably a bit unusual specially for modern NICs,
but I think it still possible in principle.
Let say NIC has up to 16K queues, but can map stats only for 1K, or so.
So formally - yes, I think both queue_idx and stats_idx have to be same type. Also I can't foresee problems such change could introduce (except formal API/ABI break). So:

Quoted 4 lines

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

#44 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

In reply to Thomas Monjalon
Quoted 19 lines · Thomas Monjalon

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Quoted 4 lines

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

Hi, Thomas,
you may misunderstand it.
The goal of this patch is that resolving some errors or warnings when compiling code with RTE_ETHDEV_QUEUE_STAT_CNTRS > 256. The reson is some vlaue(uint8_t) will never catch over RTE_ETHDEV_QUEUE_STAT_CNTRS, as
uint8_t ranges from 0-255. e.g.,
static void
nic_stats_display(uint16_t port_id)

{
		uint8_t i;
	for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
		...
	}
	...
}

RTE_ETHDEV_QUEUE_STAT_CNTRS can be increased to more than 256, which is reasonable in principle. Because the number of queue statistics is controlled by it. And mapping queue to queue statistics counter is also
controlled by it. So these "*_queue_stats_mapping" API also trigger errors or warning.

Quoted 22 lines

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
   int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 9 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

Quoted 9 lines

No, it is not related to the port id, but the number of limited stats.

Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

First, my modification for "stat_idx" data type is resonable and it does not cause some problems. Both queue id and stat_idx have same
type, which is also reasoable in usage.
Then, "*_queue_stats_mapping" these API is not only invented for ixgbe. other net drivers also implements the API, like enic, igc, octeontx2 etc.

Quoted 6 lines

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

.

#45 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

28/09/2020 15:47, Min Hu (Connor):

Quoted 33 lines · Thomas Monjalon
Quoted 19 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Quoted 4 lines

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

Hi, Thomas,
you may misunderstand it.
The goal of this patch is that resolving some errors or warnings when compiling code with RTE_ETHDEV_QUEUE_STAT_CNTRS > 256. The reson is some vlaue(uint8_t) will never catch over RTE_ETHDEV_QUEUE_STAT_CNTRS, as uint8_t ranges from 0-255. e.g.,
static void
nic_stats_display(uint16_t port_id)

Quoted 7 lines
{
		uint8_t i;
	for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
		...
	}
	...
}

What you are describing is not a problem, it is the API:
queue stats mapping is to map few queues (less than 256).

Quoted 4 lines

RTE_ETHDEV_QUEUE_STAT_CNTRS can be increased to more than 256, which is reasonable in principle. Because the number of queue statistics is controlled by it. And mapping queue to queue statistics counter is also controlled by it.

No, queue statistics ID should be the queue ID (1:1 mapping), except for rare limited HW.

Quoted 30 lines

So these "*_queue_stats_mapping" API also trigger
errors or warning.

Quoted 27 lines

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
   int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 9 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

Quoted 6 lines
Quoted 4 lines

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

First, my modification for "stat_idx" data type is resonable and it does not cause some problems.

Why do you think it is reasonnable?
What is the use case?

Quoted 4 lines

Both queue id and stat_idx have same
type, which is also reasoable in usage.
Then, "*_queue_stats_mapping" these API is not only invented for ixgbe. other net drivers also implements the API, like enic, igc, octeontx2 etc.

I don't think enic implements it,
and I don't know what is the intent in igc and octeontx2 (maybe just a copy/paste).

Quoted 2 lines
Quoted 2 lines

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

We should start from the beginning: why do you increase this value?

Or we can go directly to the real issue:
testpmd shows queues statistics only if a mapping is defined. This testpmd behaviour is absolutely wrong and should be fixed.

#46 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

In reply to Thomas Monjalon
Quoted 40 lines · Thomas Monjalon

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
   int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 7 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 10 lines
Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

#47 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

28/09/2020 15:53, Ferruh Yigit:

Quoted 63 lines · Thomas Monjalon
Quoted 40 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
   int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 7 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 10 lines
Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

Quoted 6 lines

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

It is not said this API is supposed to manage more than 256 queues mapping. In general we should not need this API.
I think it is solving the wrong problem.

#48 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

Quoted 67 lines · On Mon, 28 Sep 2020 17:24:26 +0200 Thomas Monjalon <[email protected]> wrote:

28/09/2020 15:53, Ferruh Yigit:

Quoted 66 lines · Thomas Monjalon
Quoted 40 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
   int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);  

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);  

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 7 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 10 lines
Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

Quoted 7 lines
Quoted 3 lines

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

It is not said this API is supposed to manage more than 256 queues mapping. In general we should not need this API.
I think it is solving the wrong problem.

The original API is a band aid for the limited number of statistics counters in the Intel IXGBE hardware. It crept into to the DPDK as an API. I would rather have per-queue statistics and make ixgbe say "not supported"

#49 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

Quoted 74 lines · Stephen Hemminger
Quoted 71 lines · On Mon, 28 Sep 2020 17:24:26 +0200 Thomas Monjalon <[email protected]> wrote:

28/09/2020 15:53, Ferruh Yigit:

Quoted 69 lines · Thomas Monjalon
Quoted 40 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
    int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 7 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 10 lines
Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Quoted 9 lines
Quoted 3 lines

It is not said this API is supposed to manage more than 256 queues mapping. In general we should not need this API.
I think it is solving the wrong problem.

The original API is a band aid for the limited number of statistics counters in the Intel IXGBE hardware. It crept into to the DPDK as an API. I would rather have per-queue statistics and make ixgbe say "not supported"

The current issue is not directly related to '*_queue_stats_mapping' APIs.

Problem is not able to set 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255.
User may need to set the 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, since it is used to define size of the stats counter. "uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];"

When 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, it gives multiple build errors, the one in the ethdev is like [1].

This can be fixed two ways,
a) increase the size of 'stat_idx' storage type to u16 in the '*_queue_stats_mapping' APIs, this is what this patch does.
b) Fix with a casting in the comparison, without changing the APIs.

I think both are OK, but is (b) more preferable?

[1]
../lib/librte_ethdev/rte_ethdev.c: In function ‘set_queue_stats_mapping’:
../lib/librte_ethdev/rte_ethdev.c:2943:15: warning: comparison is always false due to limited range of data type [-Wtype-limits]
2943 | if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
| ^~

#50 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

Hi,

Quoted 92 lines · Ferruh Yigit
Quoted 71 lines · Stephen Hemminger
Quoted 68 lines · On Mon, 28 Sep 2020 17:24:26 +0200 Thomas Monjalon <[email protected]> wrote:

28/09/2020 15:53, Ferruh Yigit:

Quoted 66 lines · Thomas Monjalon
Quoted 40 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
    int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 6 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 9 lines
Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Quoted 9 lines
Quoted 3 lines

It is not said this API is supposed to manage more than 256 queues mapping. In general we should not need this API.
I think it is solving the wrong problem.

The original API is a band aid for the limited number of statistics counters in the Intel IXGBE hardware. It crept into to the DPDK as an API. I would rather have per-queue statistics and make ixgbe say "not supported"

The current issue is not directly related to '*_queue_stats_mapping' APIs.

Problem is not able to set 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255. User may need to set the 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, since it is used to define size of the stats counter.
"uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];"

When 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, it gives multiple build errors, the one in the ethdev is like [1].

Quoted 6 lines

This can be fixed two ways,
a) increase the size of 'stat_idx' storage type to u16 in the '*_queue_stats_mapping' APIs, this is what this patch does.
b) Fix with a casting in the comparison, without changing the APIs.

I think both are OK, but is (b) more preferable?

I think the patch (a) is ok, knowing that RTE_ETHDEV_QUEUE_STAT_CNTRS is not modified.

On the substance, I agree with Thomas that the queue_stats_mapping API should be replaced by xstats.

Quoted 8 lines

[1]
../lib/librte_ethdev/rte_ethdev.c: In function ‘set_queue_stats_mapping’:
../lib/librte_ethdev/rte_ethdev.c:2943:15: warning: comparison is always false due to limited range of data type [-Wtype-limits]
2943 | if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
| ^~

#51 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

Quoted 100 lines · Olivier Matz

Hi,

Quoted 97 lines · Ferruh Yigit
Quoted 71 lines · Stephen Hemminger
Quoted 68 lines · On Mon, 28 Sep 2020 17:24:26 +0200 Thomas Monjalon <[email protected]> wrote:

28/09/2020 15:53, Ferruh Yigit:

Quoted 66 lines · Thomas Monjalon
Quoted 40 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
     int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 6 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 9 lines
Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Quoted 9 lines
Quoted 3 lines

It is not said this API is supposed to manage more than 256 queues mapping. In general we should not need this API.
I think it is solving the wrong problem.

The original API is a band aid for the limited number of statistics counters in the Intel IXGBE hardware. It crept into to the DPDK as an API. I would rather have per-queue statistics and make ixgbe say "not supported"

The current issue is not directly related to '*_queue_stats_mapping' APIs.

Problem is not able to set 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255. User may need to set the 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, since it is used to define size of the stats counter.
"uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];"

When 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, it gives multiple build errors, the one in the ethdev is like [1].

This can be fixed two ways,
a) increase the size of 'stat_idx' storage type to u16 in the '*_queue_stats_mapping' APIs, this is what this patch does.
b) Fix with a casting in the comparison, without changing the APIs.

Quoted 8 lines
Quoted 1 line

I think both are OK, but is (b) more preferable?

I think the patch (a) is ok, knowing that RTE_ETHDEV_QUEUE_STAT_CNTRS is not modified.

On the substance, I agree with Thomas that the queue_stats_mapping API should be replaced by xstats.

This has been discussed in the last technical board meeting, the decision was to use xstats to get queue related statistics [2].

But after second look, even if xstats is used to get statistics, 'RTE_ETHDEV_QUEUE_STAT_CNTRS' is used, since xstats uses 'rte_eth_stats_get()' to get queue statistics. So for the case device has more than 255 queues, 'RTE_ETHDEV_QUEUE_STAT_CNTRS' still needs to be set > 255 which will cause the build error.

I have an AR to send a deprecation notice to current method to get the queue statistics, and limit the old method to 256 queues. But since xstats is just a wrapped to old method, I am not quite sure how deprecating it will work.

@Thomas, @Honnappa, can you give some more insight on the issue?

[2]
https://mails.dpdk.org/archives/dev/2020-October/185299.html

Quoted 9 lines
Quoted 9 lines

[1]
../lib/librte_ethdev/rte_ethdev.c: In function ‘set_queue_stats_mapping’:
../lib/librte_ethdev/rte_ethdev.c:2943:15: warning: comparison is always false due to limited range of data type [-Wtype-limits]
2943 | if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
| ^~

#52 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

09/10/2020 22:32, Ferruh Yigit:

Quoted 107 lines · Olivier Matz
Quoted 97 lines · Ferruh Yigit
Quoted 96 lines · Stephen Hemminger
Quoted 70 lines
Quoted 68 lines · On Mon, 28 Sep 2020 17:24:26 +0200 Thomas Monjalon <[email protected]> wrote:

28/09/2020 15:53, Ferruh Yigit:

Quoted 66 lines · Thomas Monjalon
Quoted 40 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
     int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 6 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 9 lines
Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Quoted 9 lines
Quoted 3 lines

It is not said this API is supposed to manage more than 256 queues mapping. In general we should not need this API.
I think it is solving the wrong problem.

The original API is a band aid for the limited number of statistics counters in the Intel IXGBE hardware. It crept into to the DPDK as an API. I would rather have per-queue statistics and make ixgbe say "not supported"

The current issue is not directly related to '*_queue_stats_mapping' APIs.

Problem is not able to set 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255. User may need to set the 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, since it is used to define size of the stats counter.
"uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];"

When 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, it gives multiple build errors, the one in the ethdev is like [1].

This can be fixed two ways,
a) increase the size of 'stat_idx' storage type to u16 in the '*_queue_stats_mapping' APIs, this is what this patch does.
b) Fix with a casting in the comparison, without changing the APIs.

Quoted 8 lines
Quoted 1 line

I think both are OK, but is (b) more preferable?

I think the patch (a) is ok, knowing that RTE_ETHDEV_QUEUE_STAT_CNTRS is not modified.

On the substance, I agree with Thomas that the queue_stats_mapping API should be replaced by xstats.

Quoted 8 lines

This has been discussed in the last technical board meeting, the decision was to use xstats to get queue related statistics [2].

But after second look, even if xstats is used to get statistics, 'RTE_ETHDEV_QUEUE_STAT_CNTRS' is used, since xstats uses 'rte_eth_stats_get()' to get queue statistics.
So for the case device has more than 255 queues, 'RTE_ETHDEV_QUEUE_STAT_CNTRS' still needs to be set > 255 which will cause the build error.

You're right, when using the old API in xstats implementation, we are limited to RTE_ETHDEV_QUEUE_STAT_CNTRS queues.

Quoted 5 lines

I have an AR to send a deprecation notice to current method to get the queue statistics, and limit the old method to 256 queues. But since xstats is just a wrapped to old method, I am not quite sure how deprecating it will work.

@Thomas, @Honnappa, can you give some more insight on the issue?

It becomes a PMD issue. The PMD implementation of xstats must complete the statistics for the queues above RTE_ETHDEV_QUEUE_STAT_CNTRS.

In order to prepare the removal of the old method smoothly, we could add a driver flag which indicates whether the PMD relies on a pre-fill of xstats from old stats per queue conversion or not.

Quoted 2 lines

[2]
https://mails.dpdk.org/archives/dev/2020-October/185299.html

#53 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

Quoted 124 lines · Thomas Monjalon

09/10/2020 22:32, Ferruh Yigit:

Quoted 107 lines · Olivier Matz
Quoted 97 lines · Ferruh Yigit
Quoted 96 lines · Stephen Hemminger
Quoted 70 lines
Quoted 68 lines · On Mon, 28 Sep 2020 17:24:26 +0200 Thomas Monjalon <[email protected]> wrote:

28/09/2020 15:53, Ferruh Yigit:

Quoted 66 lines · Thomas Monjalon
Quoted 40 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
      int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 6 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 9 lines
Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Quoted 9 lines
Quoted 3 lines

It is not said this API is supposed to manage more than 256 queues mapping. In general we should not need this API.
I think it is solving the wrong problem.

The original API is a band aid for the limited number of statistics counters in the Intel IXGBE hardware. It crept into to the DPDK as an API. I would rather have per-queue statistics and make ixgbe say "not supported"

The current issue is not directly related to '*_queue_stats_mapping' APIs.

Problem is not able to set 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255. User may need to set the 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, since it is used to define size of the stats counter.
"uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];"

When 'RTE_ETHDEV_QUEUE_STAT_CNTRS' > 255, it gives multiple build errors, the one in the ethdev is like [1].

This can be fixed two ways,
a) increase the size of 'stat_idx' storage type to u16 in the '*_queue_stats_mapping' APIs, this is what this patch does.
b) Fix with a casting in the comparison, without changing the APIs.

Quoted 8 lines
Quoted 1 line

I think both are OK, but is (b) more preferable?

I think the patch (a) is ok, knowing that RTE_ETHDEV_QUEUE_STAT_CNTRS is not modified.

On the substance, I agree with Thomas that the queue_stats_mapping API should be replaced by xstats.

Quoted 8 lines

This has been discussed in the last technical board meeting, the decision was to use xstats to get queue related statistics [2].

But after second look, even if xstats is used to get statistics, 'RTE_ETHDEV_QUEUE_STAT_CNTRS' is used, since xstats uses 'rte_eth_stats_get()' to get queue statistics.
So for the case device has more than 255 queues, 'RTE_ETHDEV_QUEUE_STAT_CNTRS' still needs to be set > 255 which will cause the build error.

You're right, when using the old API in xstats implementation, we are limited to RTE_ETHDEV_QUEUE_STAT_CNTRS queues.

Quoted 4 lines

I have an AR to send a deprecation notice to current method to get the queue statistics, and limit the old method to 256 queues. But since xstats is just a wrapped to old method, I am not quite sure how deprecating it will work.

Quoted 9 lines
Quoted 1 line

@Thomas, @Honnappa, can you give some more insight on the issue?

It becomes a PMD issue. The PMD implementation of xstats must complete the statistics for the queues above RTE_ETHDEV_QUEUE_STAT_CNTRS.

In order to prepare the removal of the old method smoothly, we could add a driver flag which indicates whether the PMD relies on a pre-fill of xstats from old stats per queue conversion or not.

I have sent an RFC, can you please check:
https://patches.dpdk.org/patch/80390/

Connor,

Does this proposal make sense?
If you have more than 256 queues to get stats, can you please implement xstats for the queue stats?

You don't need to wait for the above RFC accepted, you can implement the xstats, but it will have some duplication, if the above RFC accepted you can set the 'RTE_ETH_DEV_QUEUE_STATS_IN_XSTATS' flag to remove the duplication.

Quoted 6 lines
Quoted 3 lines

[2]
https://mails.dpdk.org/archives/dev/2020-October/185299.html

#54 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

In reply to Ferruh Yigit
Quoted 58 lines · Ferruh Yigit
Quoted 40 lines · Thomas Monjalon

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 8 lines
Quoted 8 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +0 -0

   int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, -        uint16_t tx_queue_id, uint8_t stat_idx);
+        uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

   int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-                       uint8_t stat_idx);
+                       uint16_t stat_idx);

[...]

Quoted 5 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

Quoted 7 lines
Quoted 4 lines

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 7 lines
Quoted 2 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

Quoted 7 lines
Quoted 3 lines

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Yes, Ferruh is right.

Hi, Thomas,
Let me desribe the background again.

There exists a certain application scenario: it needs to use 256 or more than 256 queues and display all statistics of rx/tx queues. In this scenario, RTE_ETHDEV_QUEUE_STAT_CNTRS should be modifed to 256 or more for the NICs supporting per-queue statistics.

While if we did this, compiling codes will cause warnings or errors.
WHY? one reson occures in this API: rte_eth_dev_set_tx_queue_stats_mapping(or rte_eth_dev_set_rx_queue_stats_mapping), this is:

rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,uint16_t tx_queue_id, uint8_t stat_idx):

	set_queue_stats_mapping:
			...
			if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
			return -EINVAL;
			....

As above, stat_idx is uint8_t, range from 0-255, but RTE_ETHDEV_QUEUE_STAT_CNTRS is 256 (ever larger). So compiling will catch warnings or errors, and failed.

So, as Ferruh said,
this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Really, seting queue stats mapping in testpmd also has some problems that is come up by Ferruh. In addition, we also modify other unreasonable something about it and we are testing. But it will only modify testpmd, not related to API.

Hope for your reply, thanks.

#55 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

29/09/2020 06:49, Min Hu (Connor):

Quoted 78 lines · Ferruh Yigit
Quoted 67 lines · Thomas Monjalon
Quoted 42 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 9 lines
Quoted 9 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable
to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
   int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-        uint16_t tx_queue_id, uint8_t stat_idx);
+        uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,

                          uint16_t rx_queue_id,
lib/librte_ethdev/rte_ethdev.h +1 -1
-                       uint8_t stat_idx);
+                       uint16_t stat_idx);

[...]

Quoted 6 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous
release(s).

Quoted 8 lines
Quoted 5 lines

It is mainly a fix to the port_id storage type, which we have updated from
uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 11 lines
Quoted 3 lines

Since the ethdev library already heavily breaks the ABI this release, I am for
getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

Quoted 6 lines

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Yes, Ferruh is right.

Quoted 7 lines

Hi, Thomas,
Let me desribe the background again.

There exists a certain application scenario: it needs to use 256 or more than 256 queues and display all statistics of rx/tx queues. In this scenario, RTE_ETHDEV_QUEUE_STAT_CNTRS should be modifed to 256 or more for the NICs supporting per-queue statistics.

No, RTE_ETHDEV_QUEUE_STAT_CNTRS does not have to be changed. The queue statistics should be retrieved with xstats, and abandoned in rte_eth_stats.

But yes nothing is currently forbidding increasing RTE_ETHDEV_QUEUE_STAT_CNTRS, except build issues.

Quoted 13 lines

While if we did this, compiling codes will cause warnings or errors. WHY? one reson occures in this API:
rte_eth_dev_set_tx_queue_stats_mapping(or rte_eth_dev_set_rx_queue_stats_mapping), this is:

rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,uint16_t tx_queue_id, uint8_t stat_idx):

	set_queue_stats_mapping:
			...
			if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
			return -EINVAL;
			....
Quoted 8 lines

As above, stat_idx is uint8_t, range from 0-255, but RTE_ETHDEV_QUEUE_STAT_CNTRS is 256 (ever larger). So compiling will catch warnings or errors, and failed.

So, as Ferruh said,
this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Really I would prefer deprecating RTE_ETHDEV_QUEUE_STAT_CNTRS, instead of increasing size of the mapping API.

Quoted 6 lines

Really, seting queue stats mapping in testpmd also has some problems that is come up by Ferruh. In addition, we also modify other unreasonable something about it and we are testing.
But it will only modify testpmd, not related to API.

Hope for your reply, thanks.

I understand the issue, you're right raising it, but I think the usage of these APIs is wrong. I would prefer we work on xstats instead of allowing more ugly stuff with legacy stats per queues.

2 problems with increasing RTE_ETHDEV_QUEUE_STAT_CNTRS:
- it makes basic stats huge and slow to retrieve
- it needs to recompile DPDK

I proposed a scheme for stats per queue in this presentation:
https://www.dpdk.org/wp-content/uploads/sites/35/2019/10/WhichStandard.pdf

If we were at breaking something, we should change the xstats scheme from "rx_q%u%s" to "rx_q%u_%s".

author Acked-by Thomas Monjalon
#56 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

Hi, Thomas,
I think what you suggest is resonable and helpful. But I should have time to fix it about this patch. So, this patch will be sent to community in future.

By the way, the other patch is acked by you.

This patch is :
"[V5,2/2] ethdev: change data type in TC rxq and TC txq"
https://patches.dpdk.org/patch/78888/

Because we will have National Day Holiday from 10/1 to 10/8, I will have no time to handle the patch. So, I wish that patch can be merged into V20.11 soon.

Thanks very much.

Quoted 144 lines · Thomas Monjalon

29/09/2020 06:49, Min Hu (Connor):

Quoted 78 lines · Ferruh Yigit
Quoted 67 lines · Thomas Monjalon
Quoted 42 lines

28/09/2020 10:59, Ferruh Yigit:

Quoted 9 lines · Min Hu (Connor)
Quoted 8 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

Quoted 9 lines
Quoted 9 lines

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable
to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

The explanation is too much complex and misleading. You mean you cannot increase RTE_ETHDEV_QUEUE_STAT_CNTRS above 256 because it is an 8-bit type?

[...]

Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +1 -1
    int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-        uint16_t tx_queue_id, uint8_t stat_idx);
+        uint16_t tx_queue_id, uint16_t stat_idx);

[...]

Quoted 4 lines
Quoted 4 lines

int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
uint16_t rx_queue_id,

lib/librte_ethdev/rte_ethdev.h +1 -1
-                       uint8_t stat_idx);
+                       uint16_t stat_idx);

[...]

Quoted 6 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous
release(s).

Quoted 8 lines
Quoted 5 lines

It is mainly a fix to the port_id storage type, which we have updated from
uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

No, it is not related to the port id, but the number of limited stats.

Right, it is not related to the port id, it is fixing the storage type for index used to map the queue stats.

Quoted 11 lines
Quoted 3 lines

Since the ethdev library already heavily breaks the ABI this release, I am for
getting this fix, instead of waiting the fix for one more year.

If stats can be managed for more than 256 queues, I think it means it is not limited. In this case, we probably don't need the API *_queue_stats_mapping which was invented for a limitation of ixgbe.

The problem is probably somewhere else (in testpmd), that's why I am against this patch.

Quoted 6 lines

This patch is not to fix queue stats mapping, I agree there are problems related to it, already shared as comment to this set.

But this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Yes, Ferruh is right.

Quoted 7 lines

Hi, Thomas,
Let me desribe the background again.

There exists a certain application scenario: it needs to use 256 or more than 256 queues and display all statistics of rx/tx queues. In this scenario, RTE_ETHDEV_QUEUE_STAT_CNTRS should be modifed to 256 or more for the NICs supporting per-queue statistics.

No, RTE_ETHDEV_QUEUE_STAT_CNTRS does not have to be changed. The queue statistics should be retrieved with xstats, and abandoned in rte_eth_stats.

But yes nothing is currently forbidding increasing RTE_ETHDEV_QUEUE_STAT_CNTRS, except build issues.

Quoted 13 lines

While if we did this, compiling codes will cause warnings or errors. WHY? one reson occures in this API:
rte_eth_dev_set_tx_queue_stats_mapping(or rte_eth_dev_set_rx_queue_stats_mapping), this is:

rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,uint16_t tx_queue_id, uint8_t stat_idx):

	set_queue_stats_mapping:
			...
			if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
			return -EINVAL;
			....
Quoted 8 lines

As above, stat_idx is uint8_t, range from 0-255, but RTE_ETHDEV_QUEUE_STAT_CNTRS is 256 (ever larger). So compiling will catch warnings or errors, and failed.

So, as Ferruh said,
this patch is to fix the build errors when 'RTE_ETHDEV_QUEUE_STAT_CNTRS' needs to set more than 255. Where the build errors seems around the stats_mapping APIs.

Really I would prefer deprecating RTE_ETHDEV_QUEUE_STAT_CNTRS, instead of increasing size of the mapping API.

Quoted 6 lines

Really, seting queue stats mapping in testpmd also has some problems that is come up by Ferruh. In addition, we also modify other unreasonable something about it and we are testing.
But it will only modify testpmd, not related to API.

Hope for your reply, thanks.

I understand the issue, you're right raising it, but I think the usage of these APIs is wrong. I would prefer we work on xstats instead of allowing more ugly stuff with legacy stats per queues.

2 problems with increasing RTE_ETHDEV_QUEUE_STAT_CNTRS:
- it makes basic stats huge and slow to retrieve
- it needs to recompile DPDK

I proposed a scheme for stats per queue in this presentation:
https://www.dpdk.org/wp-content/uploads/sites/35/2019/10/WhichStandard.pdf

If we were at breaking something, we should change the xstats scheme from "rx_q%u%s" to "rx_q%u_%s".

.

#57 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

In reply to Ferruh Yigit
Quoted 352 lines · Min Hu (Connor)
Quoted 331 lines

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")

---
V4 -> V5:
add release notes updated.

---
v3->v4:
add a change in cmd_setqmap_mapvalue.

---
v2->v3:
change 'uint8_t i' to 'uint16_t i' in nic_stats_display function.

---
  app/proc-info/main.c                   | 2 +-
  app/test-pmd/cmdline.c                 | 4 ++--
  app/test-pmd/config.c                  | 4 ++--
  app/test-pmd/testpmd.c                 | 2 +-
  app/test-pmd/testpmd.h                 | 5 +++--
  doc/guides/rel_notes/release_20_11.rst | 5 +++++
  drivers/net/igc/igc_ethdev.c           | 4 ++--
  drivers/net/ixgbe/ixgbe_ethdev.c       | 4 ++--
  drivers/net/memif/rte_eth_memif.c      | 2 +-
  drivers/net/octeontx2/otx2_ethdev.h    | 2 +-
  drivers/net/octeontx2/otx2_stats.c     | 2 +-
  drivers/net/virtio/virtio_ethdev.c     | 4 ++--
  lib/librte_ethdev/rte_ethdev.c         | 6 +++---
  lib/librte_ethdev/rte_ethdev.h         | 4 ++--
  lib/librte_ethdev/rte_ethdev_driver.h  | 2 +-
  15 files changed, 29 insertions(+), 23 deletions(-)
app/proc-info/main.c +1 -1
index 64fb83b..26d9355 100644
@@ -348,7 +348,7 @@ static void
  nic_stats_display(uint16_t port_id)
  {
  	struct rte_eth_stats stats;
-	uint8_t i;
+	uint16_t i;
 
  	static const char *nic_stats_border = "########################";
 
app/test-pmd/cmdline.c +2 -2
index 08e123f..23e624f 100644
@@ -8315,7 +8315,7 @@ struct cmd_set_qmap_result {
  	cmdline_fixed_string_t what;
  	portid_t port_id;
  	uint16_t queue_id;
-	uint8_t map_value;
+	uint16_t map_value;
  };
 
  static void
@@ -8346,7 +8346,7 @@ cmdline_parse_token_num_t cmd_setqmap_queueid =
  			      queue_id, UINT16);
  cmdline_parse_token_num_t cmd_setqmap_mapvalue =
  	TOKEN_NUM_INITIALIZER(struct cmd_set_qmap_result,
-			      map_value, UINT8);
+			      map_value, UINT16);
 
  cmdline_parse_inst_t cmd_set_qmap = {
  	.f = cmd_set_qmap_parsed,
app/test-pmd/config.c +2 -2
index 17a6efe..dfe5627 100644
@@ -161,7 +161,7 @@ nic_stats_display(portid_t port_id)
  	uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx;
  	struct rte_eth_stats stats;
  	struct rte_port *port = &ports[port_id];
-	uint8_t i;
+	uint16_t i;
 
  	static const char *nic_stats_border = "########################";
 
@@ -3742,7 +3742,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on)
  }
 
  void
-set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value)
+set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint16_t map_value)
  {
  	uint16_t i;
  	uint8_t existing_mapping_found = 0;
app/test-pmd/testpmd.c +1 -1
index fe6450c..4b26c5c 100644
@@ -1840,7 +1840,7 @@ fwd_stats_display(void)
  			fwd_cycles += fs->core_cycles;
  	}
  	for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) {
-		uint8_t j;
+		uint16_t j;
 
  		pt_id = fwd_ports_ids[i];
  		port = &ports[pt_id];
app/test-pmd/testpmd.h +3 -2
index c7e7e41..9ad002c 100644
@@ -279,7 +279,7 @@ enum dcb_mode_enable
  struct queue_stats_mappings {
  	portid_t port_id;
  	uint16_t queue_id;
-	uint8_t stats_counter_id;
+	uint16_t stats_counter_id;
  } __rte_cache_aligned;
 
  extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
@@ -794,7 +794,8 @@ void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
  void tx_vlan_reset(portid_t port_id);
  void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
 
-void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
+void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id,
+	      uint16_t map_value);
 
  void set_xstats_hide_zero(uint8_t on_off);
 
doc/guides/rel_notes/release_20_11.rst +5 -0
index 4bcf220..1ef6f0e 100644
@@ -178,6 +178,11 @@ API Changes
 
  * bpf: ``RTE_BPF_XTYPE_NUM`` has been dropped from ``rte_bpf_xtype``.
 
+* ethdev: Data type of input parameter ``stat_idx`` in ``set_queue_stats_mapping``,
+  ``rte_eth_dev_set_tx_queue_stats_mapping`` and ``rte_eth_dev_set_rx_queue_stats_mapping``
+  function will be changed from ``uint8_t`` to ``uint16_t``, which supports for
+  using 256 or more than 256 queues and displaying all statistics of rx/tx queue.
+
 
  ABI Changes
  -----------
drivers/net/igc/igc_ethdev.c +2 -2
index 810568b..875874e 100644
@@ -221,7 +221,7 @@ static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
  static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
  static int
  eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-	uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
+	uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx);
  static int
  eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
  static int
@@ -2075,7 +2075,7 @@ eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 
  static int
  eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
-		uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
+		uint16_t queue_id, uint16_t stat_idx, uint8_t is_rx)
  {
  	struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
 
drivers/net/ixgbe/ixgbe_ethdev.c +2 -2
index 8da963a..c6ea83a 100644
@@ -178,7 +178,7 @@ static int ixgbe_dev_xstats_get_names_by_id(
  	unsigned int limit);
  static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
  					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
  					     uint8_t is_rx);
  static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
  				 size_t fw_size);
@@ -890,7 +890,7 @@ ixgbe_reset_qstat_mappings(struct ixgbe_hw *hw)
  static int
  ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
  				  uint16_t queue_id,
-				  uint8_t stat_idx,
+				  uint16_t stat_idx,
  				  uint8_t is_rx)
  {
  #define QSM_REG_NB_BITS_PER_QMAP_FIELD 8
drivers/net/memif/rte_eth_memif.c +1 -1
index a19c0f3..29cea93 100644
@@ -1356,7 +1356,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
  	struct pmd_internals *pmd = dev->data->dev_private;
  	struct memif_queue *mq;
  	int i;
-	uint8_t tmp, nq;
+	uint16_t tmp, nq;
 
  	stats->ipackets = 0;
  	stats->ibytes = 0;
drivers/net/octeontx2/otx2_ethdev.h +1 -1
index a114112..0c761e3 100644
@@ -476,7 +476,7 @@ int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
  int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
 
  int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
-				 uint16_t queue_id, uint8_t stat_idx,
+				 uint16_t queue_id, uint16_t stat_idx,
  				 uint8_t is_rx);
  int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
  			struct rte_eth_xstat *xstats, unsigned int n);
drivers/net/octeontx2/otx2_stats.c +1 -1
index 8aaf270..6efe122 100644
@@ -145,7 +145,7 @@ otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
  int
  otx2_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
-			     uint8_t stat_idx, uint8_t is_rx)
+			     uint16_t stat_idx, uint8_t is_rx)
  {
  	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 
drivers/net/virtio/virtio_ethdev.c +2 -2
index 013a290..9d26012 100644
@@ -82,7 +82,7 @@ static int virtio_intr_disable(struct rte_eth_dev *dev);
  static int virtio_dev_queue_stats_mapping_set(
  	struct rte_eth_dev *eth_dev,
  	uint16_t queue_id,
-	uint8_t stat_idx,
+	uint16_t stat_idx,
  	uint8_t is_rx);
 
  static void virtio_notify_peers(struct rte_eth_dev *dev);
@@ -2648,7 +2648,7 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
   */
  static int
  virtio_dev_queue_stats_mapping_set(__rte_unused struct rte_eth_dev *eth_dev,
-__rte_unused uint16_t queue_id, __rte_unused uint8_t stat_idx,
+__rte_unused uint16_t queue_id, __rte_unused uint16_t stat_idx,
  __rte_unused uint8_t is_rx)
  {
  	return 0;
lib/librte_ethdev/rte_ethdev.c +3 -3
index dfe5c1b..749b372 100644
@@ -2942,7 +2942,7 @@ rte_eth_xstats_reset(uint16_t port_id)
  }
 
  static int
-set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
+set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint16_t stat_idx,
  		uint8_t is_rx)
  {
  	struct rte_eth_dev *dev;
@@ -2969,7 +2969,7 @@ set_queue_stats_mapping(uint16_t port_id, uint16_t queue_id, uint8_t stat_idx,
 
  int
  rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
  {
  	return eth_err(port_id, set_queue_stats_mapping(port_id, tx_queue_id,
  						stat_idx, STAT_QMAP_TX));
@@ -2978,7 +2978,7 @@ rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
 
  int
  rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
-		uint8_t stat_idx)
+		uint16_t stat_idx)
  {
  	return eth_err(port_id, set_queue_stats_mapping(port_id, rx_queue_id,
  						stat_idx, STAT_QMAP_RX));
lib/librte_ethdev/rte_ethdev.h +2 -2
index 645a186..ff3a616 100644
@@ -2679,7 +2679,7 @@ int rte_eth_xstats_reset(uint16_t port_id);
   *   Zero if successful. Non-zero otherwise.
   */
  int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
-		uint16_t tx_queue_id, uint8_t stat_idx);
+		uint16_t tx_queue_id, uint16_t stat_idx);
 
  /**
   *  Set a mapping for the specified receive queue to the specified per-queue
@@ -2700,7 +2700,7 @@ int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
   */
  int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
  					   uint16_t rx_queue_id,
-					   uint8_t stat_idx);
+					   uint16_t stat_idx);
 
  /**
   * Retrieve the Ethernet address of an Ethernet device.
lib/librte_ethdev/rte_ethdev_driver.h +0 -0
index 23cc1e0..c68d465 100644

lib/librte_ethdev/rte_ethdev_driver.h typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev, · line 228

Quoted 8 lines
lib/librte_ethdev/rte_ethdev_driver.h +1 -1
@@ -222,7 +222,7 @@ typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
 
  typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
  					     uint16_t queue_id,
-					     uint8_t stat_idx,
+					     uint16_t stat_idx,
  					     uint8_t is_rx);
  /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
 

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

Quoted 4 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

Can you please review the patch, is there any objectio to proceed with it?

#58 lore raw

Re: [dpdk-dev] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats

In reply to Ferruh Yigit
Quoted 59 lines · Ferruh Yigit
Quoted 58 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, only statistics of rx/tx queues with queue_id less than RTE_ETHDEV_QUEUE_STAT_CNTRS can be displayed. If there is a certain application scenario that it needs to use 256 or more than 256 queues and display all statistics of rx/tx queue. At this moment, we have to change the macro to be equaled to the queue number.

However, modifying the macro to be greater than 256 will trigger many errors and warnings from test-pmd, PMD drivers and librte_ethdev during compiling dpdk project. But it is possible and permitted that rx/tx queue number is greater than 256 and all statistics of rx/tx queue need to be displayed. In addition, the data type of rx/tx queue number in rte_eth_dev_configure API is 'uint16_t'. So It is unreasonable to use the 'uint8_t' type for variables that control which per-queue statistics can be displayed.

Fixes ed30d9b691b2 ("app/testpmd: add stats per queue")
Fixes 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes abf7275bbaa2 ("ixgbe: move to drivers/net/")
Fixes e6defdfddc3b ("net/igc: enable statistics")
Fixes 2265e4b4e84b ("net/octeontx2: add basic stats operation")
Fixes 6c3169a3dc04 ("virtio: move to drivers/net/")

---
V4 -> V5:
add release notes updated.

---
v3->v4:
add a change in cmd_setqmap_mapvalue.

---
v2->v3:
change 'uint8_t i' to 'uint16_t i' in nic_stats_display function.

---
  app/proc-info/main.c                   | 2 +- app/test-pmd/cmdline.c                 | 4 ++-- app/test-pmd/config.c                  | 4 ++-- app/test-pmd/testpmd.c                 | 2 +- app/test-pmd/testpmd.h                 | 5 +++-- doc/guides/rel_notes/release_20_11.rst | 5 +++++ drivers/net/igc/igc_ethdev.c           | 4 ++-- drivers/net/ixgbe/ixgbe_ethdev.c       | 4 ++-- drivers/net/memif/rte_eth_memif.c      | 2 +- drivers/net/octeontx2/otx2_ethdev.h    | 2 +- drivers/net/octeontx2/otx2_stats.c     | 2 +- drivers/net/virtio/virtio_ethdev.c     | 4 ++-- lib/librte_ethdev/rte_ethdev.c         | 6 +++--- lib/librte_ethdev/rte_ethdev.h         | 4 ++-- lib/librte_ethdev/rte_ethdev_driver.h  | 2 +-

  15 files changed, 29 insertions(+), 23 deletions(-)

[SNIP]

Quoted 10 lines

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is mainly a fix to the port_id storage type, which we have updated from uint8_t to uint16_t in past but some seems remained for 'rte_eth_dev_set_tx_queue_stats_mapping()' & 'rte_eth_dev_set_rx_queue_stats_mapping()' APIs.

Since the ethdev library already heavily breaks the ABI this release, I am for getting this fix, instead of waiting the fix for one more year.

Can you please review the patch, is there any objectio to proceed with it?

After reading the rest of the thread, I understand that Thomas has suggested depreciating this entire API and using xstats instead. My 2c is that if changing this value requires an ABI breakage and rebuild, its probably the wrong API.

Ray K

#59 lore raw

PATCH v5 2/2 ethdev: change data type in TC rxq and TC txq

In reply to Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these data will be truncated when queue number under a TC is greater than 256. So it is necessary for base and nb_queue to change from uint8_t to uint16_t.

Fixes 01eb53eefeb40e8 ("ethdev: rename folder to library name")

---
V4 -> V5:
add release notes updated.

---
 doc/guides/rel_notes/release_20_11.rst | 5 +++++
 lib/librte_ethdev/rte_ethdev.h         | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
doc/guides/rel_notes/release_20_11.rst +5 -0
index 1ef6f0e..ad14fd7 100644
@@ -183,6 +183,11 @@ API Changes
   function will be changed from ``uint8_t`` to ``uint16_t``, which supports for
   using 256 or more than 256 queues and displaying all statistics of rx/tx queue.
 
+* ethdev: Modified field type of base and nb_queue in struct
+  ``rte_eth_dcb_tc_queue_mapping`` from ``uint8_t`` to ``uint16_t``.
+  As the data of uint8_t will be truncated when queue number under
+  a TC is greater than 256.
+
 
 ABI Changes
 -----------
lib/librte_ethdev/rte_ethdev.h +4 -4
index ff3a616..2270460 100644
@@ -1522,13 +1522,13 @@ struct rte_eth_xstat_name {
 struct rte_eth_dcb_tc_queue_mapping {
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 	/** rx queues assigned to tc per Pool */
 	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
 	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
 };
 
Signature · 1 line
2.7.4
#60 lore raw

Re: [dpdk-dev] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq

Quoted 52 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these data will be truncated when queue number under a TC is greater than 256. So it is necessary for base and nb_queue to change from uint8_t to uint16_t.

Fixes 01eb53eefeb40e8 ("ethdev: rename folder to library name")

---
V4 -> V5:
add release notes updated.

---
  doc/guides/rel_notes/release_20_11.rst | 5 +++++
  lib/librte_ethdev/rte_ethdev.h         | 8 ++++----
  2 files changed, 9 insertions(+), 4 deletions(-)
doc/guides/rel_notes/release_20_11.rst +5 -0
index 1ef6f0e..ad14fd7 100644
@@ -183,6 +183,11 @@ API Changes
    function will be changed from ``uint8_t`` to ``uint16_t``, which supports for
    using 256 or more than 256 queues and displaying all statistics of rx/tx queue.
 
+* ethdev: Modified field type of base and nb_queue in struct
+  ``rte_eth_dcb_tc_queue_mapping`` from ``uint8_t`` to ``uint16_t``.
+  As the data of uint8_t will be truncated when queue number under
+  a TC is greater than 256.
+
 
  ABI Changes
  -----------
lib/librte_ethdev/rte_ethdev.h +2 -2
index ff3a616..2270460 100644
@@ -1522,13 +1522,13 @@ struct rte_eth_xstat_name {
  struct rte_eth_dcb_tc_queue_mapping {
  	/** rx queues assigned to tc per Pool */
  	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;

lib/librte_ethdev/rte_ethdev.h struct rte_eth_xstat_name { · line 1534

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +2 -2
  	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
  	/** rx queues assigned to tc per Pool */
  	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
  	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
  };
 

cc'ed tech-board,

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is increasing the storage size of the fields to support more than 255 queues.

Since the ethdev library already heavily breaks the ABI this release, I am for getting this patch, instead of waiting for one more year for the update.

Can you please review the patch, is there any objection to proceed with it?

#61 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq

28/09/2020 11:04, Ferruh Yigit:

Quoted 8 lines · Min Hu (Connor)
Quoted 7 lines

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these data will be truncated when queue number under a TC is greater than 256. So it is necessary for base and nb_queue to change from uint8_t to uint16_t.

[...]

Quoted 23 lines
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +1 -2
  struct rte_eth_dcb_tc_queue_mapping {
  	/** rx queues assigned to tc per Pool */
  	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;

lib/librte_ethdev/rte_ethdev.h struct rte_eth_xstat_name { · line 1533

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +3 -2
+		uint16_t nb_queue;
  	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
  	/** rx queues assigned to tc per Pool */
  	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
  	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
  };

cc'ed tech-board,

Quoted 4 lines

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is increasing the storage size of the fields to support more than 255 queues.

Yes queues are in 16-bit range.

Quoted 4 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this patch, instead of waiting for one more year for the update.

Can you please review the patch, is there any objection to proceed with it?

Reviewed-by
#62 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq

Quoted 38 lines · Thomas Monjalon

28/09/2020 11:04, Ferruh Yigit:

Quoted 8 lines · Min Hu (Connor)
Quoted 7 lines

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these data will be truncated when queue number under a TC is greater than 256. So it is necessary for base and nb_queue to change from uint8_t to uint16_t.

[...]

Quoted 23 lines
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +1 -2
   struct rte_eth_dcb_tc_queue_mapping {
   	/** rx queues assigned to tc per Pool */
   	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;

lib/librte_ethdev/rte_ethdev.h struct rte_eth_xstat_name { · line 1533

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +3 -2
+		uint16_t nb_queue;
   	} tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
   	/** rx queues assigned to tc per Pool */
   	struct {
-		uint8_t base;
-		uint8_t nb_queue;
+		uint16_t base;
+		uint16_t nb_queue;
   	} tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
   };

cc'ed tech-board,

Quoted 4 lines

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is increasing the storage size of the fields to support more than 255 queues.

Quoted 10 lines

Yes queues are in 16-bit range.

Quoted 4 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this patch, instead of waiting for one more year for the update.

Can you please review the patch, is there any objection to proceed with it?

I will continue with this patch (not patchset) if there is no objection.

Applied
#63 lore raw

Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq

Quoted 45 lines · Ferruh Yigit
Quoted 44 lines · Thomas Monjalon

28/09/2020 11:04, Ferruh Yigit:

Quoted 8 lines · Min Hu (Connor)
Quoted 7 lines

From: Huisong Li <[email protected]>

Currently, base and nb_queue in the tc_rxq and tc_txq information of queue and TC mapping on both TX and RX paths are uint8_t. However, these data will be truncated when queue number under a TC is greater than 256. So it is necessary for base and nb_queue to change from uint8_t to uint16_t.

[...]

Quoted 22 lines
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +0 -0

   struct rte_eth_dcb_tc_queue_mapping {
       /** rx queues assigned to tc per Pool */ struct {
-        uint8_t base;
-        uint8_t nb_queue;
+        uint16_t base;
+        uint16_t nb_queue;
       } tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];

Quoted 9 lines

       /** rx queues assigned to tc per Pool */ struct {
-        uint8_t base;
-        uint8_t nb_queue;
+        uint16_t base;
+        uint16_t nb_queue;
       } tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS]; };

cc'ed tech-board,

Quoted 4 lines

The patch breaks the ethdev ABI without a deprecation notice from previous release(s).

It is increasing the storage size of the fields to support more than 255 queues.

Yes queues are in 16-bit range.

Quoted 4 lines

Since the ethdev library already heavily breaks the ABI this release, I am for getting this patch, instead of waiting for one more year for the update.

Can you please review the patch, is there any objection to proceed with it?

Quoted 8 lines
Quoted 3 lines

I will continue with this patch (not patchset) if there is no objection.

Applied to dpdk-next-net/main, thanks.

Only this patch in the patchset merged, discussion is going on the 1/2 one, since the issues are separate, it can continue on its own.