DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC 1/2] Description: lib/ethdev: change data type in tc_rxq and tc_txq
@ 2020-08-31  3:41 Min Hu(Connor)
  2020-08-31  3:41 ` [dpdk-dev] [RFC 2/2] Description: dpdk: fix compiling errors for more than 256 per-queue statistics Min Hu(Connor)
                   ` (3 more replies)
  0 siblings, 4 replies; 64+ messages in thread
From: Min Hu(Connor) @ 2020-08-31  3:41 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, bruce.richardson, jerin.jacob, linuxarm

From: Huisong Li <lihuisong@huawei.com>

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")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: huwei WX866841 <xavier.huwei@huawei.com>
Reviewed-by: liudongdong 00290354 <liudongdong3@huawei.com>
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index ff82771..f51a688 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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];
 };
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [RFC 2/2] Description: dpdk: fix compiling errors for more than 256 per-queue statistics
  2020-08-31  3:41 [dpdk-dev] [RFC 1/2] Description: lib/ethdev: change data type in tc_rxq and tc_txq Min Hu(Connor)
@ 2020-08-31  3:41 ` Min Hu(Connor)
  2020-09-01  1:33 ` [dpdk-dev] [RFC 1/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 64+ messages in thread
From: Min Hu(Connor) @ 2020-08-31  3:41 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, bruce.richardson, jerin.jacob, linuxarm

From: Huisong Li <lihuisong@huawei.com>

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.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: huwei WX866841 <xavier.huwei@huawei.com>
Reviewed-by: liudongdong 00290354 <liudongdong3@huawei.com>
---
 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(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0a6ed85..40b6b17 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 30bee33..9e7526d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7842c3b..d5503bc 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -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];
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 25a12b1..4ac87b0 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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);
 
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 6ab3ee9..7211505 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -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);
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fd0cb9b..8c418f5 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index c1c7e9f..696475c 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -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;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index e9efe52..8c1cf78 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -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);
diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
index 8aaf270..6efe122 100644
--- a/drivers/net/octeontx2/otx2_stats.c
+++ b/drivers/net/octeontx2/otx2_stats.c
@@ -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);
 
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index dc0093b..8144bb2 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -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;
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 0a96718..74dadb8 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -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));
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index f51a688..71c4662 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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.
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 1f2c414..e42f280 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -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. */
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [RFC 1/2] ethdev: change data type in TC rxq and TC txq
  2020-08-31  3:41 [dpdk-dev] [RFC 1/2] Description: lib/ethdev: change data type in tc_rxq and tc_txq Min Hu(Connor)
  2020-08-31  3:41 ` [dpdk-dev] [RFC 2/2] Description: dpdk: fix compiling errors for more than 256 per-queue statistics Min Hu(Connor)
@ 2020-09-01  1:33 ` Min Hu (Connor)
  2020-09-01  1:33   ` [dpdk-dev] [RFC 2/2] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
  2020-09-01 11:52   ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Min Hu (Connor)
  2020-09-25 12:51 ` [dpdk-dev] [PATCH V4 0/2] change data type in TC queue Min Hu (Connor)
  2020-09-27  3:16 ` [dpdk-dev] [PATCH V5 " Min Hu (Connor)
  3 siblings, 2 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-01  1:33 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bruce.richardson, jerin.jacob, john.mcnamara,
	alvinx.zhang, thomas.monjalon, linuxarm

From: Huisong Li <lihuisong@huawei.com>

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")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: huwei  <xavier.huwei@huawei.com>
Reviewed-by: liudongdong <liudongdong3@huawei.com>
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index ff82771..f51a688 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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];
 };
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [RFC 2/2] ethdev: fix compiling errors for per-queue statistics
  2020-09-01  1:33 ` [dpdk-dev] [RFC 1/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
@ 2020-09-01  1:33   ` Min Hu (Connor)
  2020-09-01  2:23     ` Stephen Hemminger
  2020-09-01 11:52   ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Min Hu (Connor)
  1 sibling, 1 reply; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-01  1:33 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, bruce.richardson, jerin.jacob, john.mcnamara,
	alvinx.zhang, thomas.monjalon, linuxarm

From: Huisong Li <lihuisong@huawei.com>

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/")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: huwei <xavier.huwei@huawei.com>
Reviewed-by: liudongdong <liudongdong3@huawei.com>
---
 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(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0a6ed85..40b6b17 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 30bee33..9e7526d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7842c3b..d5503bc 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -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];
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 25a12b1..4ac87b0 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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);
 
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 6ab3ee9..7211505 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -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);
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fd0cb9b..8c418f5 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index c1c7e9f..696475c 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -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;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index e9efe52..8c1cf78 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -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);
diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
index 8aaf270..6efe122 100644
--- a/drivers/net/octeontx2/otx2_stats.c
+++ b/drivers/net/octeontx2/otx2_stats.c
@@ -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);
 
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index dc0093b..8144bb2 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -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;
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 0a96718..74dadb8 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -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));
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index f51a688..71c4662 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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.
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 1f2c414..e42f280 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -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. */
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [RFC 2/2] ethdev: fix compiling errors for per-queue statistics
  2020-09-01  1:33   ` [dpdk-dev] [RFC 2/2] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
@ 2020-09-01  2:23     ` Stephen Hemminger
  0 siblings, 0 replies; 64+ messages in thread
From: Stephen Hemminger @ 2020-09-01  2:23 UTC (permalink / raw)
  To: Min Hu (Connor)
  Cc: dev, ferruh.yigit, bruce.richardson, jerin.jacob, john.mcnamara,
	alvinx.zhang, thomas.monjalon, linuxarm

On Tue, 1 Sep 2020 09:33:18 +0800
"Min Hu (Connor)" <humin29@huawei.com> wrote:

> From: Huisong Li <lihuisong@huawei.com>
> 
> 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/")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Reviewed-by: huwei <xavier.huwei@huawei.com>
> Reviewed-by: liudongdong <liudongdong3@huawei.com>
> ---

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.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type
  2020-09-01  1:33 ` [dpdk-dev] [RFC 1/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
  2020-09-01  1:33   ` [dpdk-dev] [RFC 2/2] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
@ 2020-09-01 11:52   ` Min Hu (Connor)
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 1/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
                       ` (4 more replies)
  1 sibling, 5 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-01 11:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH 1/4] ethdev: change data type in TC rxq and TC txq
  2020-09-01 11:52   ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Min Hu (Connor)
@ 2020-09-01 11:52     ` Min Hu (Connor)
  2020-09-04 11:32       ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Min Hu (Connor)
  2020-09-09 12:36       ` [dpdk-dev] [PATCH V3 0/3] add FEC support Min Hu (Connor)
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 2/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
                       ` (3 subsequent siblings)
  4 siblings, 2 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-01 11:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 70295d7..b0114bb 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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];
 };
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH 2/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-01 11:52   ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Min Hu (Connor)
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 1/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
@ 2020-09-01 11:52     ` Min Hu (Connor)
  2020-09-01 16:17       ` Ferruh Yigit
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 3/4] doc: announce modified field in DCB TC queue mapping Min Hu (Connor)
                       ` (2 subsequent siblings)
  4 siblings, 1 reply; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-01 11:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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/")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
 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(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0a6ed85..40b6b17 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 30bee33..9e7526d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7842c3b..d5503bc 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -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];
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 25a12b1..4ac87b0 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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);
 
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 6ab3ee9..7211505 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -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);
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fd0cb9b..8c418f5 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index c1c7e9f..696475c 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -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;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index e9efe52..8c1cf78 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -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);
diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
index 8aaf270..6efe122 100644
--- a/drivers/net/octeontx2/otx2_stats.c
+++ b/drivers/net/octeontx2/otx2_stats.c
@@ -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);
 
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index dc0093b..8144bb2 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -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;
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 7858ad5..cf1f5d7 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -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));
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index b0114bb..b4e10e2 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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.
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 32407dd..6061782 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -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. */
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH 3/4] doc: announce modified field in DCB TC queue mapping
  2020-09-01 11:52   ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Min Hu (Connor)
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 1/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 2/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
@ 2020-09-01 11:52     ` Min Hu (Connor)
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 4/4] doc: announce modified field in ethdev API Min Hu (Connor)
  2020-09-01 16:14     ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Ferruh Yigit
  4 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-01 11:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 doc/guides/rel_notes/release_20_11.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index df227a1..e9c87c3 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 ------------
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH 4/4] doc: announce modified field in ethdev API
  2020-09-01 11:52   ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Min Hu (Connor)
                       ` (2 preceding siblings ...)
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 3/4] doc: announce modified field in DCB TC queue mapping Min Hu (Connor)
@ 2020-09-01 11:52     ` Min Hu (Connor)
  2020-09-01 16:14     ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Ferruh Yigit
  4 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-01 11:52 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 doc/guides/rel_notes/release_20_11.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index e9c87c3..8e24d46 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 -----------
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type
  2020-09-01 11:52   ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Min Hu (Connor)
                       ` (3 preceding siblings ...)
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 4/4] doc: announce modified field in ethdev API Min Hu (Connor)
@ 2020-09-01 16:14     ` Ferruh Yigit
  4 siblings, 0 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-01 16:14 UTC (permalink / raw)
  To: Min Hu (Connor), dev
  Cc: stephen, bruce.richardson, jerin.jacob, Thomas Monjalon,
	Andrew Rybchenko, Kinsella, Ray

On 9/1/2020 12:52 PM, Min Hu (Connor) wrote:
> 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.


> 
>  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(-)
> 


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH 2/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 2/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
@ 2020-09-01 16:17       ` Ferruh Yigit
  0 siblings, 0 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-01 16:17 UTC (permalink / raw)
  To: Min Hu (Connor), dev; +Cc: stephen, bruce.richardson, jerin.jacob

On 9/1/2020 12:52 PM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> 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/")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
>  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


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V2  0/4] ethdev: change the queue ID type
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 1/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
@ 2020-09-04 11:32       ` Min Hu (Connor)
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
                           ` (4 more replies)
  2020-09-09 12:36       ` [dpdk-dev] [PATCH V3 0/3] add FEC support Min Hu (Connor)
  1 sibling, 5 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-04 11:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-04 11:32       ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Min Hu (Connor)
@ 2020-09-04 11:32         ` Min Hu (Connor)
  2020-09-04 18:04           ` Ferruh Yigit
                             ` (2 more replies)
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 2/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
                           ` (3 subsequent siblings)
  4 siblings, 3 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-04 11:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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/")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
 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(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index abeca4a..2c70c33 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 = "########################";
 
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0a6ed85..40b6b17 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 30bee33..9e7526d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 7842c3b..d5503bc 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -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];
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 25a12b1..4ac87b0 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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);
 
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 6ab3ee9..7211505 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -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);
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fd0cb9b..8c418f5 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index c1c7e9f..696475c 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -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;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index e9efe52..8c1cf78 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -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);
diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
index 8aaf270..6efe122 100644
--- a/drivers/net/octeontx2/otx2_stats.c
+++ b/drivers/net/octeontx2/otx2_stats.c
@@ -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);
 
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index dc0093b..8144bb2 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -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;
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 7858ad5..cf1f5d7 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -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));
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 70295d7..e073c0e 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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.
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 32407dd..6061782 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -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. */
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V2 2/4] ethdev: change data type in TC rxq and TC txq
  2020-09-04 11:32       ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Min Hu (Connor)
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
@ 2020-09-04 11:32         ` Min Hu (Connor)
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 3/4] doc: announce modified field in DCB TC queue mapping Min Hu (Connor)
                           ` (2 subsequent siblings)
  4 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-04 11:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index e073c0e..b4e10e2 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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];
 };
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V2 3/4] doc: announce modified field in DCB TC queue mapping
  2020-09-04 11:32       ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Min Hu (Connor)
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 2/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
@ 2020-09-04 11:32         ` Min Hu (Connor)
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 4/4] doc: announce modified field in ethdev API Min Hu (Connor)
  2020-09-04 14:33         ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Ferruh Yigit
  4 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-04 11:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 doc/guides/rel_notes/release_20_11.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index df227a1..e9c87c3 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 ------------
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V2 4/4] doc: announce modified field in ethdev API
  2020-09-04 11:32       ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Min Hu (Connor)
                           ` (2 preceding siblings ...)
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 3/4] doc: announce modified field in DCB TC queue mapping Min Hu (Connor)
@ 2020-09-04 11:32         ` Min Hu (Connor)
  2020-09-04 14:33         ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Ferruh Yigit
  4 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-04 11:32 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 doc/guides/rel_notes/release_20_11.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index e9c87c3..8e24d46 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 -----------
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type
  2020-09-04 11:32       ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Min Hu (Connor)
                           ` (3 preceding siblings ...)
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 4/4] doc: announce modified field in ethdev API Min Hu (Connor)
@ 2020-09-04 14:33         ` Ferruh Yigit
  4 siblings, 0 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-04 14:33 UTC (permalink / raw)
  To: Min Hu (Connor), dev
  Cc: stephen, bruce.richardson, Jerin Jacob Kollanukkaran,
	Thomas Monjalon, Andrew Rybchenko

On 9/4/2020 12:32 PM, Min Hu (Connor) wrote:
> 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.

> 
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
@ 2020-09-04 18:04           ` Ferruh Yigit
  2020-09-04 18:31           ` Ferruh Yigit
  2020-09-23 12:59           ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Min Hu (Connor)
  2 siblings, 0 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-04 18:04 UTC (permalink / raw)
  To: Min Hu (Connor), dev; +Cc: stephen, bruce.richardson, jerin.jacob

On 9/4/2020 12:32 PM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> 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/")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
>  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(-)

<...>

> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 0a6ed85..40b6b17 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -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.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
  2020-09-04 18:04           ` Ferruh Yigit
@ 2020-09-04 18:31           ` Ferruh Yigit
  2020-09-05 16:51             ` Thomas Monjalon
  2020-09-23  2:31             ` Min Hu (Connor)
  2020-09-23 12:59           ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Min Hu (Connor)
  2 siblings, 2 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-04 18:31 UTC (permalink / raw)
  To: Min Hu (Connor), dev
  Cc: stephen, bruce.richardson, Jerin Jacob Kollanukkaran,
	Andrew Rybchenko, Thomas Monjalon, Wenzhuo Lu, Beilei Xing,
	Bernard Iremonger

On 9/4/2020 12:32 PM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> 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/")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>

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


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-04 18:31           ` Ferruh Yigit
@ 2020-09-05 16:51             ` Thomas Monjalon
  2020-09-23  2:31             ` Min Hu (Connor)
  1 sibling, 0 replies; 64+ messages in thread
From: Thomas Monjalon @ 2020-09-05 16:51 UTC (permalink / raw)
  To: Min Hu (Connor), Ferruh Yigit
  Cc: dev, stephen, bruce.richardson, Jerin Jacob Kollanukkaran,
	Andrew Rybchenko, Wenzhuo Lu, Beilei Xing, Bernard Iremonger

04/09/2020 20:31, Ferruh Yigit:
> On 9/4/2020 12:32 PM, Min Hu (Connor) wrote:
> > From: Huisong Li <lihuisong@huawei.com>
> > 
> > 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/")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Huisong Li <lihuisong@huawei.com>
> > Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> > Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> > Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
> 
> 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?

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".



^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V3  0/3] add FEC support
  2020-09-01 11:52     ` [dpdk-dev] [PATCH 1/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
  2020-09-04 11:32       ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Min Hu (Connor)
@ 2020-09-09 12:36       ` Min Hu (Connor)
  2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 1/3] ethdev: introduce FEC API Min Hu (Connor)
                           ` (2 more replies)
  1 sibling, 3 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-09 12:36 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V3  1/3] ethdev: introduce FEC API
  2020-09-09 12:36       ` [dpdk-dev] [PATCH V3 0/3] add FEC support Min Hu (Connor)
@ 2020-09-09 12:36         ` Min Hu (Connor)
  2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 2/3] net/hns3: support FEC Min Hu (Connor)
  2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 3/3] app/testpmd: add FEC command Min Hu (Connor)
  2 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-09 12:36 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: Chengchang Tang <tangchengchang@huawei.com>

---
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(+)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 7858ad5..b7ac791 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -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.
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 70295d7..c353480 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -1511,6 +1511,17 @@ struct rte_eth_dcb_info {
 	struct rte_eth_dcb_tc_queue_mapping tc_queue;
 };
 
+/**
+ * This enum indicates the possible (forward error correction)FEC modes
+ * of an ethdev port.
+ */
+enum rte_fec_mode {
+	ETH_FEC_NOFEC = 0,      /**< FEC is off */
+	ETH_FEC_BASER,          /**< FEC using common algorithm */
+	ETH_FEC_RS,             /**< FEC using RS algorithm */
+	ETH_FEC_AUTO            /**< FEC autonegotiation modes */
+};
+
 #define RTE_ETH_ALL RTE_MAX_ETHPORTS
 
 /* Macros to check for valid port */
@@ -3328,6 +3339,70 @@ int  rte_eth_led_on(uint16_t port_id);
 int  rte_eth_led_off(uint16_t port_id);
 
 /**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Get Forward Error Correction(FEC) capability.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param fec_cap
+ *   returns the FEC capability from the device, as follows:
+ *   bit0: nofec
+ *   bit1: baser
+ *   bit2: rs
+ *   bit3: auto
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if underlying hardware OR driver doesn't support.
+ *     that operation.
+ *   - (-EIO) if device is removed.
+ *   - (-ENODEV)  if *port_id* invalid.
+ */
+__rte_experimental
+int rte_eth_fec_get_capability(uint16_t port_id, uint8_t *fec_cap);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Get current Forward Error Correction(FEC) mode.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param mode
+ *   returns the FEC mode from the device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if underlying hardware OR driver doesn't support.
+ *     that operation.
+ *   - (-EIO) if device is removed.
+ *   - (-ENODEV)  if *port_id* invalid.
+ */
+__rte_experimental
+int rte_eth_fec_get(uint16_t port_id, enum rte_fec_mode *mode);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
+ *
+ * Set Forward Error Correction(FEC) mode.
+ *
+ * @param port_id
+ *   The port identifier of the Ethernet device.
+ * @param mode
+ *   the FEC mode.
+ * @return
+ *   - (0) if successful.
+ *   - (-EINVAL) if the FEC mode is not valid.
+ *   - (-ENOTSUP) if underlying hardware OR driver doesn't support.
+ *   - (-EIO) if device is removed.
+ *   - (-ENODEV)  if *port_id* invalid.
+ */
+__rte_experimental
+int rte_eth_fec_set(uint16_t port_id, enum rte_fec_mode mode);
+
+/**
  * Get current status of the Ethernet link flow control for Ethernet device
  *
  * @param port_id
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 32407dd..df9e18a 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -604,6 +604,76 @@ typedef int (*eth_tx_hairpin_queue_setup_t)
 	 const struct rte_eth_hairpin_conf *hairpin_conf);
 
 /**
+ * @internal
+ * Get Forward Error Correction(FEC) capability.
+ *
+ * @param dev
+ *   ethdev handle of port.
+ * @param fec_cap
+ *   returns the FEC capability from the device.
+ *
+ * @return
+ *   Negative errno value on error, 0 on success.
+ *
+ * @retval 0
+ *   Success, get FEC success.
+ * @retval -ENOTSUP
+ *   operation is not supported.
+ * @retval -EIO
+ *   device is removed.
+ * @retval -ENODEV
+ *   Device is gone.
+ */
+typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev,
+					uint8_t *fec_cap);
+
+/**
+ * @internal
+ * Get Forward Error Correction(FEC) mode.
+ *
+ * @param dev
+ *   ethdev handle of port.
+ * @param mode
+ *   returns the FEC mode from the device.
+ *
+ * @return
+ *   Negative errno value on error, 0 on success.
+ *
+ * @retval 0
+ *   Success, get FEC success.
+ * @retval -ENOTSUP
+ *   operation is not supported.
+ * @retval -EIO
+ *   device is removed.
+ * @retval -ENODEV
+ *   Device is gone.
+ */
+typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev, enum rte_fec_mode *mode);
+
+/**
+ * @internal
+ *   Set Forward Error Correction(FEC) mode.
+ *
+ * @param dev
+ *   ethdev handle of port.
+ * @param mode
+ *   the FEC mode.
+ *
+ * @return
+ *   Negative errno value on error, 0 on success.
+ *
+ * @retval 0
+ *   Success, set FEC success.
+ * @retval -ENOTSUP
+ *   operation is not supported.
+ * @retval -EIO
+ *   device is removed.
+ * @retval -ENODEV
+ *   Device is gone.
+ */
+typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, enum rte_fec_mode mode);
+
+/**
  * @internal A structure containing the functions exported by an Ethernet driver.
  */
 struct eth_dev_ops {
@@ -752,6 +822,13 @@ struct eth_dev_ops {
 	/**< Set up device RX hairpin queue. */
 	eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup;
 	/**< Set up device TX hairpin queue. */
+
+	eth_fec_get_capability_t fec_get_capability;
+	/**< Get Forward Error Correction(FEC) capability; */
+	eth_fec_get_t fec_get;
+	/**< Get Forward Error Correction(FEC) mode; */
+	eth_fec_set_t fec_set;
+	/**< Set Forward Error Correction(FEC) mode; */
 };
 
 /**
diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map
index 1212a17..33cf5e4 100644
--- a/lib/librte_ethdev/rte_ethdev_version.map
+++ b/lib/librte_ethdev/rte_ethdev_version.map
@@ -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 {
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V3  2/3] net/hns3: support FEC
  2020-09-09 12:36       ` [dpdk-dev] [PATCH V3 0/3] add FEC support Min Hu (Connor)
  2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 1/3] ethdev: introduce FEC API Min Hu (Connor)
@ 2020-09-09 12:36         ` Min Hu (Connor)
  2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 3/3] app/testpmd: add FEC command Min Hu (Connor)
  2 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-09 12:36 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: Chengchang Tang <tangchengchang@huawei.com>

---
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(-)

diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
index d70f42e..8b80353 100644
--- a/drivers/net/hns3/hns3_cmd.h
+++ b/drivers/net/hns3/hns3_cmd.h
@@ -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)
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 81e7730..9b5a7c8 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -78,6 +78,8 @@ static int hns3_add_mc_addr(struct hns3_hw *hw,
 			    struct rte_ether_addr *mac_addr);
 static int hns3_remove_mc_addr(struct hns3_hw *hw,
 			    struct rte_ether_addr *mac_addr);
+static int hns3_restore_fec(struct hns3_hw *hw);
+static int hns3_query_dev_fec_info(struct rte_eth_dev *dev);
 
 static void
 hns3_pf_disable_irq0(struct hns3_hw *hw)
@@ -2819,6 +2821,13 @@ hns3_get_capability(struct hns3_hw *hw)
 	    device_id == HNS3_DEV_ID_200G_RDMA)
 		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1);
 
+	ret = hns3_query_dev_fec_info(eth_dev);
+	if (ret) {
+		PMD_INIT_LOG(ERR,
+			     "failed to query FEC information, ret = %d", ret);
+		return ret;
+	}
+
 	/* Get PCI revision id */
 	ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN,
 				  HNS3_PCI_REVISION_ID);
@@ -5311,6 +5320,10 @@ hns3_restore_conf(struct hns3_adapter *hns)
 	if (ret)
 		goto err_promisc;
 
+	ret = hns3_restore_fec(hw);
+	if (ret)
+		goto err_promisc;
+
 	if (hns->hw.adapter_state == HNS3_NIC_STARTED) {
 		ret = hns3_do_start(hns, false);
 		if (ret)
@@ -5389,6 +5402,146 @@ hns3_reset_service(void *param)
 		hns3_msix_process(hns, reset_level);
 }
 
+static int
+hns3_fec_get_capability(struct rte_eth_dev *dev, uint8_t *fec_cap)
+{
+	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct hns3_mac *mac = &hw->mac;
+	uint8_t mode;
+
+	switch (mac->link_speed) {
+	case ETH_SPEED_NUM_10G:
+	case ETH_SPEED_NUM_40G:
+		mode = BIT(ETH_FEC_NOFEC) | BIT(ETH_FEC_BASER) |
+			BIT(ETH_FEC_AUTO);
+		break;
+	case ETH_SPEED_NUM_25G:
+	case ETH_SPEED_NUM_50G:
+		mode = BIT(ETH_FEC_NOFEC) | BIT(ETH_FEC_BASER) |
+			BIT(ETH_FEC_RS) | BIT(ETH_FEC_AUTO);
+		break;
+	case ETH_SPEED_NUM_100G:
+	case ETH_SPEED_NUM_200G:
+		mode = BIT(ETH_FEC_NOFEC) | BIT(ETH_FEC_RS) | BIT(ETH_FEC_AUTO);
+		break;
+	default:
+		mode = 0;
+		break;
+	}
+
+	*fec_cap = mode;
+	return 0;
+}
+
+static int
+hns3_fec_get(struct rte_eth_dev *dev, enum rte_fec_mode *mode)
+{
+#define QUERY_ACTIVE_SPEED	1
+	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct hns3_sfp_speed_cmd *resp;
+	struct hns3_cmd_desc desc;
+	int ret;
+
+	hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_SFP_GET_SPEED, true);
+	resp = (struct hns3_sfp_speed_cmd *)desc.data;
+	resp->query_type = QUERY_ACTIVE_SPEED;
+
+	ret = hns3_cmd_send(hw, &desc, 1);
+	if (ret == -EOPNOTSUPP) {
+		hns3_err(hw, "IMP do not support get FEC, ret = %d", ret);
+		return ret;
+	} else if (ret) {
+		hns3_err(hw, "get FEC failed, ret = %d", ret);
+		return ret;
+	}
+
+	*mode = resp->active_fec;
+	return 0;
+}
+
+static int
+hns3_set_fec_hw(struct hns3_hw *hw, enum rte_fec_mode mode)
+{
+	struct hns3_config_fec_cmd *req;
+	struct hns3_cmd_desc desc;
+	int ret;
+
+	hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CONFIG_FEC_MODE, false);
+
+	req = (struct hns3_config_fec_cmd *)desc.data;
+	switch (mode) {
+	case ETH_FEC_NOFEC:
+		hns3_set_field(req->fec_mode, HNS3_MAC_CFG_FEC_MODE_M,
+				HNS3_MAC_CFG_FEC_MODE_S, HNS3_MAC_FEC_OFF);
+		break;
+	case ETH_FEC_BASER:
+		hns3_set_field(req->fec_mode, HNS3_MAC_CFG_FEC_MODE_M,
+				HNS3_MAC_CFG_FEC_MODE_S, HNS3_MAC_FEC_BASER);
+		break;
+	case ETH_FEC_RS:
+		hns3_set_field(req->fec_mode, HNS3_MAC_CFG_FEC_MODE_M,
+				HNS3_MAC_CFG_FEC_MODE_S, HNS3_MAC_FEC_RS);
+		break;
+	case ETH_FEC_AUTO:
+		hns3_set_bit(req->fec_mode, HNS3_MAC_CFG_FEC_AUTO_EN_B, 1);
+		break;
+	default:
+		return 0;
+	}
+	ret = hns3_cmd_send(hw, &desc, 1);
+	if (ret)
+		hns3_err(hw, "set fec mode failed, ret = %d", ret);
+
+	return ret;
+}
+
+static int
+hns3_fec_set(struct rte_eth_dev *dev, enum rte_fec_mode mode)
+{
+	struct hns3_adapter *hns = dev->data->dev_private;
+	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns);
+	struct hns3_pf *pf = &hns->pf;
+	int ret;
+
+	ret = hns3_set_fec_hw(hw, mode);
+	if (ret)
+		return ret;
+
+	pf->fec_mode = mode;
+	return 0;
+}
+
+static int
+hns3_restore_fec(struct hns3_hw *hw)
+{
+	struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
+	struct hns3_pf *pf = &hns->pf;
+	enum rte_fec_mode mode = pf->fec_mode;
+	int ret;
+
+	ret = hns3_set_fec_hw(hw, mode);
+	if (ret)
+		hns3_err(hw, "restore fec mode(%d) failed, ret = %d",
+			 mode, ret);
+
+	return ret;
+}
+
+static int
+hns3_query_dev_fec_info(struct rte_eth_dev *dev)
+{
+	struct hns3_adapter *hns = dev->data->dev_private;
+	struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns);
+	struct hns3_pf *pf = &hns->pf;
+	int ret;
+
+	ret = hns3_fec_get(dev, &pf->fec_mode);
+	if (ret)
+		hns3_err(hw, "query device FEC info failed, ret = %d", ret);
+
+	return ret;
+}
+
 static const struct eth_dev_ops hns3_eth_dev_ops = {
 	.dev_start          = hns3_dev_start,
 	.dev_stop           = hns3_dev_stop,
@@ -5434,6 +5587,9 @@ static const struct eth_dev_ops hns3_eth_dev_ops = {
 	.get_reg                = hns3_get_regs,
 	.get_dcb_info           = hns3_get_dcb_info,
 	.dev_supported_ptypes_get = hns3_dev_supported_ptypes_get,
+	.fec_get_capability     = hns3_fec_get_capability,
+	.fec_get                = hns3_fec_get,
+	.fec_set                = hns3_fec_set,
 };
 
 static const struct hns3_reset_ops hns3_reset_ops = {
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 0e665e5..daf723e 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -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;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V3  3/3] app/testpmd: add FEC command
  2020-09-09 12:36       ` [dpdk-dev] [PATCH V3 0/3] add FEC support Min Hu (Connor)
  2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 1/3] ethdev: introduce FEC API Min Hu (Connor)
  2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 2/3] net/hns3: support FEC Min Hu (Connor)
@ 2020-09-09 12:36         ` Min Hu (Connor)
  2 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-09 12:36 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

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.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: Chengchang Tang <tangchengchang@huawei.com>

----
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(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0a6ed85..072f390 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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,
 };
 
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 30bee33..6048f19 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -138,6 +138,28 @@ const struct rss_type_info rss_type_table[] = {
 	{ NULL, 0 },
 };
 
+static const struct {
+	enum rte_fec_mode mode;
+	const char *name;
+} fec_mode_name[] = {
+	{
+		.mode = ETH_FEC_NOFEC,
+		.name = "off",
+	},
+	{
+		.mode = ETH_FEC_BASER,
+		.name = "baser",
+	},
+	{
+		.mode = ETH_FEC_RS,
+		.name = "rs",
+	},
+	{
+		.mode = ETH_FEC_AUTO,
+		.name = "auto",
+	},
+};
+
 static void
 print_ethaddr(const char *name, struct rte_ether_addr *eth_addr)
 {
@@ -2967,6 +2989,38 @@ set_tx_pkt_split(const char *name)
 	printf("unknown value: \"%s\"\n", name);
 }
 
+int
+parse_fec_mode(const char *name, enum rte_fec_mode *mode)
+{
+	uint8_t i;
+
+	for (i = 0; i < RTE_DIM(fec_mode_name); i++) {
+		if (strcmp(fec_mode_name[i].name, name) == 0) {
+			*mode = fec_mode_name[i].mode;
+			return 0;
+		}
+	}
+	return -1;
+}
+
+void
+show_fec_capability(uint8_t fec_cap)
+{
+	uint8_t i;
+
+	if (fec_cap == 0) {
+		printf("FEC is not supported\n");
+		return;
+	}
+
+	printf("FEC capabilities: ");
+	for (i = ETH_FEC_BASER; i <= ETH_FEC_AUTO; i++) {
+		if (fec_cap & 1U << i)
+			printf("%s ", fec_mode_name[i].name);
+	}
+	printf("\n");
+}
+
 void
 show_tx_pkt_segments(void)
 {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 25a12b1..7ab91ad 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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);
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-04 18:31           ` Ferruh Yigit
  2020-09-05 16:51             ` Thomas Monjalon
@ 2020-09-23  2:31             ` Min Hu (Connor)
  2020-09-23  9:18               ` Ferruh Yigit
  1 sibling, 1 reply; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-23  2:31 UTC (permalink / raw)
  To: Ferruh Yigit, dev
  Cc: stephen, bruce.richardson, Jerin Jacob Kollanukkaran,
	Andrew Rybchenko, Thomas Monjalon, Wenzhuo Lu, Beilei Xing,
	Bernard Iremonger



在 2020/9/5 2:31, Ferruh Yigit 写道:
> On 9/4/2020 12:32 PM, Min Hu (Connor) wrote:
>> From: Huisong Li <lihuisong@huawei.com>
>>
>> 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/")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
> 
> 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?
> 
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.

> Thanks,
> ferruh
> 
> 
> .
> 

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-23  2:31             ` Min Hu (Connor)
@ 2020-09-23  9:18               ` Ferruh Yigit
  2020-09-25  8:58                 ` Min Hu (Connor)
  0 siblings, 1 reply; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-23  9:18 UTC (permalink / raw)
  To: Min Hu (Connor), dev
  Cc: stephen, bruce.richardson, Jerin Jacob Kollanukkaran,
	Andrew Rybchenko, Thomas Monjalon, Wenzhuo Lu, Beilei Xing,
	Bernard Iremonger

On 9/23/2020 3:31 AM, Min Hu (Connor) wrote:
> 
> 
> 在 2020/9/5 2:31, Ferruh Yigit 写道:
>> On 9/4/2020 12:32 PM, Min Hu (Connor) wrote:
>>> From: Huisong Li <lihuisong@huawei.com>
>>>
>>> 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/")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>>> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
>>
>> 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?
>>
> 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.


> 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)'

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V3 0/4] change data type in TC queue
  2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
  2020-09-04 18:04           ` Ferruh Yigit
  2020-09-04 18:31           ` Ferruh Yigit
@ 2020-09-23 12:59           ` Min Hu (Connor)
  2020-09-23 12:59             ` [dpdk-dev] [PATCH V3 1/4] dpdk: fix compiling errors for per-queue statistics Min Hu (Connor)
                               ` (4 more replies)
  2 siblings, 5 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-23 12:59 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V3 1/4] dpdk: fix compiling errors for per-queue statistics
  2020-09-23 12:59           ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Min Hu (Connor)
@ 2020-09-23 12:59             ` Min Hu (Connor)
  2020-09-23 13:00             ` [dpdk-dev] [PATCH V3 2/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
                               ` (3 subsequent siblings)
  4 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-23 12:59 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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/")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
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(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 64fb83b..26d9355 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 = "########################";
 
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5f93409..200b8a0 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 2d9a456..f23b193 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index fe6450c..4b26c5c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -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];
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index f139fe7..16aa81c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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);
 
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 810568b..875874e 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -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);
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0f065bb..9850488 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index a19c0f3..29cea93 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -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;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index a114112..0c761e3 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -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);
diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
index 8aaf270..6efe122 100644
--- a/drivers/net/octeontx2/otx2_stats.c
+++ b/drivers/net/octeontx2/otx2_stats.c
@@ -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);
 
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 013a290..9d26012 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -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;
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index dfe5c1b..749b372 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -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));
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index eeef52e..fb10836 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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.
diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
index 23cc1e0..c68d465 100644
--- a/lib/librte_ethdev/rte_ethdev_driver.h
+++ b/lib/librte_ethdev/rte_ethdev_driver.h
@@ -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. */
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V3 2/4] ethdev: change data type in TC rxq and TC txq
  2020-09-23 12:59           ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Min Hu (Connor)
  2020-09-23 12:59             ` [dpdk-dev] [PATCH V3 1/4] dpdk: fix compiling errors for per-queue statistics Min Hu (Connor)
@ 2020-09-23 13:00             ` Min Hu (Connor)
  2020-09-23 13:00             ` [dpdk-dev] [PATCH V3 3/4] doc: announce modified field in DCB TC queue mapping Min Hu (Connor)
                               ` (2 subsequent siblings)
  4 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-23 13:00 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index fb10836..6dfe666 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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];
 };
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V3 3/4] doc: announce modified field in DCB TC queue mapping
  2020-09-23 12:59           ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Min Hu (Connor)
  2020-09-23 12:59             ` [dpdk-dev] [PATCH V3 1/4] dpdk: fix compiling errors for per-queue statistics Min Hu (Connor)
  2020-09-23 13:00             ` [dpdk-dev] [PATCH V3 2/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
@ 2020-09-23 13:00             ` Min Hu (Connor)
  2020-09-23 13:00             ` [dpdk-dev] [PATCH V3 4/4] doc: announce modified in queue stats mapping API Min Hu (Connor)
  2020-09-25  9:41             ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Ferruh Yigit
  4 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-23 13:00 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
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(+)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 444dcbe..cc744d8 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -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
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index d4a66d0..3de2895 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 -----------
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V3 4/4] doc: announce modified in queue stats mapping API
  2020-09-23 12:59           ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Min Hu (Connor)
                               ` (2 preceding siblings ...)
  2020-09-23 13:00             ` [dpdk-dev] [PATCH V3 3/4] doc: announce modified field in DCB TC queue mapping Min Hu (Connor)
@ 2020-09-23 13:00             ` Min Hu (Connor)
  2020-09-25  9:41             ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Ferruh Yigit
  4 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-23 13:00 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
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(+)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index cc744d8..82eb959 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -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.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 3de2895..6149199 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 -----------
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-23  9:18               ` Ferruh Yigit
@ 2020-09-25  8:58                 ` Min Hu (Connor)
  2020-09-25  9:36                   ` Ferruh Yigit
  0 siblings, 1 reply; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-25  8:58 UTC (permalink / raw)
  To: Ferruh Yigit, dev
  Cc: stephen, bruce.richardson, Jerin Jacob Kollanukkaran,
	Andrew Rybchenko, Thomas Monjalon, Wenzhuo Lu, Beilei Xing,
	Bernard Iremonger, lihuisong

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?


在 2020/9/23 17:18, Ferruh Yigit 写道:
> On 9/23/2020 3:31 AM, Min Hu (Connor) wrote:
>>
>>
>> 在 2020/9/5 2:31, Ferruh Yigit 写道:
>>> On 9/4/2020 12:32 PM, Min Hu (Connor) wrote:
>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>
>>>> 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/")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>>> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>>>> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
>>>
>>> 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?
>>>
>> 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.
> 
> 
>> 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)'
> .

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics
  2020-09-25  8:58                 ` Min Hu (Connor)
@ 2020-09-25  9:36                   ` Ferruh Yigit
  0 siblings, 0 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-25  9:36 UTC (permalink / raw)
  To: Min Hu (Connor), dev
  Cc: stephen, bruce.richardson, Jerin Jacob Kollanukkaran,
	Andrew Rybchenko, Thomas Monjalon, Wenzhuo Lu, Beilei Xing,
	Bernard Iremonger, lihuisong

On 9/25/2020 9:58 AM, Min Hu (Connor) wrote:
> 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?
> 

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

> 
> 在 2020/9/23 17:18, Ferruh Yigit 写道:
>> On 9/23/2020 3:31 AM, Min Hu (Connor) wrote:
>>>
>>>
>>> 在 2020/9/5 2:31, Ferruh Yigit 写道:
>>>> On 9/4/2020 12:32 PM, Min Hu (Connor) wrote:
>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>
>>>>> 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/")
>>>>> Cc: stable@dpdk.org
>>>>>
>>>>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>>>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>>>> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>>>>> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
>>>>
>>>> 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?
>>>>
>>> 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.
>>
>>
>>> 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)'
>> .


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V3 0/4] change data type in TC queue
  2020-09-23 12:59           ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Min Hu (Connor)
                               ` (3 preceding siblings ...)
  2020-09-23 13:00             ` [dpdk-dev] [PATCH V3 4/4] doc: announce modified in queue stats mapping API Min Hu (Connor)
@ 2020-09-25  9:41             ` Ferruh Yigit
  4 siblings, 0 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-25  9:41 UTC (permalink / raw)
  To: Min Hu (Connor), dev; +Cc: stephen, bruce.richardson, jerin.jacob

On 9/23/2020 1:59 PM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> 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/93479bbe-7ebe-a400-2805-5debd96a0937@intel.com/
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/38b50f43-0b31-02a8-87ec-d937d83d051a@intel.com/


Thanks,
ferruh

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V4 0/2] change data type in TC queue
  2020-08-31  3:41 [dpdk-dev] [RFC 1/2] Description: lib/ethdev: change data type in tc_rxq and tc_txq Min Hu(Connor)
  2020-08-31  3:41 ` [dpdk-dev] [RFC 2/2] Description: dpdk: fix compiling errors for more than 256 per-queue statistics Min Hu(Connor)
  2020-09-01  1:33 ` [dpdk-dev] [RFC 1/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
@ 2020-09-25 12:51 ` Min Hu (Connor)
  2020-09-25 12:51   ` [dpdk-dev] [PATCH V4 1/2] dpdk: resolve compiling errors for per-queue stats Min Hu (Connor)
                     ` (2 more replies)
  2020-09-27  3:16 ` [dpdk-dev] [PATCH V5 " Min Hu (Connor)
  3 siblings, 3 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-25 12:51 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V4 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-25 12:51 ` [dpdk-dev] [PATCH V4 0/2] change data type in TC queue Min Hu (Connor)
@ 2020-09-25 12:51   ` Min Hu (Connor)
  2020-09-25 12:51   ` [dpdk-dev] [PATCH V4 2/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
  2020-09-25 13:14   ` [dpdk-dev] [PATCH V4 0/2] change data type in TC queue Ferruh Yigit
  2 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-25 12:51 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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/")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
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(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 64fb83b..26d9355 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 = "########################";
 
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 08e123f..23e624f 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 17a6efe..dfe5627 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index fe6450c..4b26c5c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -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];
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index c7e7e41..9ad002c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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);
 
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 810568b..875874e 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -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);
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 03aea20..e93f3b8 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index a19c0f3..29cea93 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -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;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index a114112..0c761e3 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -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);
diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
index 8aaf270..6efe122 100644
--- a/drivers/net/octeontx2/otx2_stats.c
+++ b/drivers/net/octeontx2/otx2_stats.c
@@ -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);
 
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 013a290..9d26012 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -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;
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index dfe5c1b..749b372 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -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));
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 645a186..ff3a616 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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.
diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
index 23cc1e0..c68d465 100644
--- a/lib/librte_ethdev/rte_ethdev_driver.h
+++ b/lib/librte_ethdev/rte_ethdev_driver.h
@@ -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. */
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V4 2/2] ethdev: change data type in TC rxq and TC txq
  2020-09-25 12:51 ` [dpdk-dev] [PATCH V4 0/2] change data type in TC queue Min Hu (Connor)
  2020-09-25 12:51   ` [dpdk-dev] [PATCH V4 1/2] dpdk: resolve compiling errors for per-queue stats Min Hu (Connor)
@ 2020-09-25 12:51   ` Min Hu (Connor)
  2020-09-25 13:14   ` [dpdk-dev] [PATCH V4 0/2] change data type in TC queue Ferruh Yigit
  2 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-25 12:51 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
 lib/librte_ethdev/rte_ethdev.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index ff3a616..2270460 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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];
 };
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V4 0/2] change data type in TC queue
  2020-09-25 12:51 ` [dpdk-dev] [PATCH V4 0/2] change data type in TC queue Min Hu (Connor)
  2020-09-25 12:51   ` [dpdk-dev] [PATCH V4 1/2] dpdk: resolve compiling errors for per-queue stats Min Hu (Connor)
  2020-09-25 12:51   ` [dpdk-dev] [PATCH V4 2/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
@ 2020-09-25 13:14   ` Ferruh Yigit
  2 siblings, 0 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-25 13:14 UTC (permalink / raw)
  To: Min Hu (Connor), dev; +Cc: stephen, bruce.richardson, jerin.jacob

On 9/25/2020 1:51 PM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> 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(-)
> 

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.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V5 0/2] change data type in TC queue
  2020-08-31  3:41 [dpdk-dev] [RFC 1/2] Description: lib/ethdev: change data type in tc_rxq and tc_txq Min Hu(Connor)
                   ` (2 preceding siblings ...)
  2020-09-25 12:51 ` [dpdk-dev] [PATCH V4 0/2] change data type in TC queue Min Hu (Connor)
@ 2020-09-27  3:16 ` Min Hu (Connor)
  2020-09-27  3:16   ` [dpdk-dev] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats Min Hu (Connor)
  2020-09-27  3:16   ` [dpdk-dev] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
  3 siblings, 2 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-27  3:16 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-27  3:16 ` [dpdk-dev] [PATCH V5 " Min Hu (Connor)
@ 2020-09-27  3:16   ` Min Hu (Connor)
  2020-09-28  8:59     ` Ferruh Yigit
  2020-09-27  3:16   ` [dpdk-dev] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
  1 sibling, 1 reply; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-27  3:16 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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/")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
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(-)

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 64fb83b..26d9355 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -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 = "########################";
 
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 08e123f..23e624f 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -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,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 17a6efe..dfe5627 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -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;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index fe6450c..4b26c5c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -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];
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index c7e7e41..9ad002c 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -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);
 
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 4bcf220..1ef6f0e 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 -----------
diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 810568b..875874e 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -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);
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 8da963a..c6ea83a 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index a19c0f3..29cea93 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -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;
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index a114112..0c761e3 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -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);
diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
index 8aaf270..6efe122 100644
--- a/drivers/net/octeontx2/otx2_stats.c
+++ b/drivers/net/octeontx2/otx2_stats.c
@@ -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);
 
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 013a290..9d26012 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -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;
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index dfe5c1b..749b372 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -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));
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 645a186..ff3a616 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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.
diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
index 23cc1e0..c68d465 100644
--- a/lib/librte_ethdev/rte_ethdev_driver.h
+++ b/lib/librte_ethdev/rte_ethdev_driver.h
@@ -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. */
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* [dpdk-dev] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq
  2020-09-27  3:16 ` [dpdk-dev] [PATCH V5 " Min Hu (Connor)
  2020-09-27  3:16   ` [dpdk-dev] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats Min Hu (Connor)
@ 2020-09-27  3:16   ` Min Hu (Connor)
  2020-09-28  9:04     ` Ferruh Yigit
  1 sibling, 1 reply; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-27  3:16 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, bruce.richardson, jerin.jacob

From: Huisong Li <lihuisong@huawei.com>

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")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
---
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(-)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 1ef6f0e..ad14fd7 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -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
 -----------
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index ff3a616..2270460 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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];
 };
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-27  3:16   ` [dpdk-dev] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats Min Hu (Connor)
@ 2020-09-28  8:59     ` Ferruh Yigit
  2020-09-28  9:16       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
                         ` (2 more replies)
  0 siblings, 3 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-28  8:59 UTC (permalink / raw)
  To: Min Hu (Connor), techboard
  Cc: stephen, bruce.richardson, jerinj, Ray Kinsella, dev

On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> 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/")
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> 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(-)
> 
> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
> index 64fb83b..26d9355 100644
> --- a/app/proc-info/main.c
> +++ b/app/proc-info/main.c
> @@ -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 = "########################";
>   
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 08e123f..23e624f 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -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,
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 17a6efe..dfe5627 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -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;
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index fe6450c..4b26c5c 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -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];
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index c7e7e41..9ad002c 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -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);
>   
> diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
> index 4bcf220..1ef6f0e 100644
> --- a/doc/guides/rel_notes/release_20_11.rst
> +++ b/doc/guides/rel_notes/release_20_11.rst
> @@ -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
>   -----------
> diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
> index 810568b..875874e 100644
> --- a/drivers/net/igc/igc_ethdev.c
> +++ b/drivers/net/igc/igc_ethdev.c
> @@ -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);
>   
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 8da963a..c6ea83a 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -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
> diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
> index a19c0f3..29cea93 100644
> --- a/drivers/net/memif/rte_eth_memif.c
> +++ b/drivers/net/memif/rte_eth_memif.c
> @@ -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;
> diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
> index a114112..0c761e3 100644
> --- a/drivers/net/octeontx2/otx2_ethdev.h
> +++ b/drivers/net/octeontx2/otx2_ethdev.h
> @@ -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);
> diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
> index 8aaf270..6efe122 100644
> --- a/drivers/net/octeontx2/otx2_stats.c
> +++ b/drivers/net/octeontx2/otx2_stats.c
> @@ -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);
>   
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 013a290..9d26012 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -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;
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index dfe5c1b..749b372 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -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));
> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> index 645a186..ff3a616 100644
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -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.
> diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
> index 23cc1e0..c68d465 100644
> --- a/lib/librte_ethdev/rte_ethdev_driver.h
> +++ b/lib/librte_ethdev/rte_ethdev_driver.h
> @@ -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?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq
  2020-09-27  3:16   ` [dpdk-dev] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
@ 2020-09-28  9:04     ` Ferruh Yigit
  2020-09-28  9:21       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
  0 siblings, 1 reply; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-28  9:04 UTC (permalink / raw)
  To: Min Hu (Connor), techboard; +Cc: stephen, bruce.richardson, jerinj, dev

On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> 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")
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> 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(-)
> 
> diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
> index 1ef6f0e..ad14fd7 100644
> --- a/doc/guides/rel_notes/release_20_11.rst
> +++ b/doc/guides/rel_notes/release_20_11.rst
> @@ -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
>   -----------
> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> index ff3a616..2270460 100644
> --- a/lib/librte_ethdev/rte_ethdev.h
> +++ b/lib/librte_ethdev/rte_ethdev.h
> @@ -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];
>   };
>   
> 

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?

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28  8:59     ` Ferruh Yigit
@ 2020-09-28  9:16       ` Thomas Monjalon
  2020-09-28 12:00         ` Ananyev, Konstantin
                           ` (2 more replies)
  2020-09-28 11:52       ` Ananyev, Konstantin
  2020-09-30  8:34       ` [dpdk-dev] " Kinsella, Ray
  2 siblings, 3 replies; 64+ messages in thread
From: Thomas Monjalon @ 2020-09-28  9:16 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Min Hu (Connor),
	techboard, stephen, bruce.richardson, jerinj, Ray Kinsella, dev

28/09/2020 10:59, Ferruh Yigit:
> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> > From: Huisong Li <lihuisong@huawei.com>
> > 
> > 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.

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?

[...]
> > --- a/lib/librte_ethdev/rte_ethdev.h
> > +++ b/lib/librte_ethdev/rte_ethdev.h
> >   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);
[...]
> >   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);
[...]
> 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.

> 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.



^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq
  2020-09-28  9:04     ` Ferruh Yigit
@ 2020-09-28  9:21       ` Thomas Monjalon
  2020-10-05 12:26         ` Ferruh Yigit
  0 siblings, 1 reply; 64+ messages in thread
From: Thomas Monjalon @ 2020-09-28  9:21 UTC (permalink / raw)
  To: Min Hu (Connor), Ferruh Yigit
  Cc: techboard, stephen, bruce.richardson, jerinj, dev

28/09/2020 11:04, Ferruh Yigit:
> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> > From: Huisong Li <lihuisong@huawei.com>
> > 
> > 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.
[...]
> > --- a/lib/librte_ethdev/rte_ethdev.h
> > +++ b/lib/librte_ethdev/rte_ethdev.h
> >   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];
> >   };
> >   
> > 
> 
> 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.

Yes queues are in 16-bit range.

> 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?

Acked-by: Thomas Monjalon <thomas@monjalon.net>



^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28  8:59     ` Ferruh Yigit
  2020-09-28  9:16       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
@ 2020-09-28 11:52       ` Ananyev, Konstantin
  2020-09-30  8:34       ` [dpdk-dev] " Kinsella, Ray
  2 siblings, 0 replies; 64+ messages in thread
From: Ananyev, Konstantin @ 2020-09-28 11:52 UTC (permalink / raw)
  To: Yigit, Ferruh, Min Hu (Connor), techboard
  Cc: stephen, Richardson, Bruce, jerinj, Ray Kinsella, dev

> 
> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> > From: Huisong Li <lihuisong@huawei.com>
> >
> > 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/")
> >
> > Signed-off-by: Huisong Li <lihuisong@huawei.com>
> > Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> > Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
> > Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
> > ---
> > 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(-)
> >
> > diff --git a/app/proc-info/main.c b/app/proc-info/main.c
> > index 64fb83b..26d9355 100644
> > --- a/app/proc-info/main.c
> > +++ b/app/proc-info/main.c
> > @@ -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 = "########################";
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> > index 08e123f..23e624f 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -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,
> > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> > index 17a6efe..dfe5627 100644
> > --- a/app/test-pmd/config.c
> > +++ b/app/test-pmd/config.c
> > @@ -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;
> > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> > index fe6450c..4b26c5c 100644
> > --- a/app/test-pmd/testpmd.c
> > +++ b/app/test-pmd/testpmd.c
> > @@ -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];
> > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> > index c7e7e41..9ad002c 100644
> > --- a/app/test-pmd/testpmd.h
> > +++ b/app/test-pmd/testpmd.h
> > @@ -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);
> >
> > diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
> > index 4bcf220..1ef6f0e 100644
> > --- a/doc/guides/rel_notes/release_20_11.rst
> > +++ b/doc/guides/rel_notes/release_20_11.rst
> > @@ -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
> >   -----------
> > diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
> > index 810568b..875874e 100644
> > --- a/drivers/net/igc/igc_ethdev.c
> > +++ b/drivers/net/igc/igc_ethdev.c
> > @@ -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);
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 8da963a..c6ea83a 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -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
> > diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
> > index a19c0f3..29cea93 100644
> > --- a/drivers/net/memif/rte_eth_memif.c
> > +++ b/drivers/net/memif/rte_eth_memif.c
> > @@ -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;
> > diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
> > index a114112..0c761e3 100644
> > --- a/drivers/net/octeontx2/otx2_ethdev.h
> > +++ b/drivers/net/octeontx2/otx2_ethdev.h
> > @@ -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);
> > diff --git a/drivers/net/octeontx2/otx2_stats.c b/drivers/net/octeontx2/otx2_stats.c
> > index 8aaf270..6efe122 100644
> > --- a/drivers/net/octeontx2/otx2_stats.c
> > +++ b/drivers/net/octeontx2/otx2_stats.c
> > @@ -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);
> >
> > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> > index 013a290..9d26012 100644
> > --- a/drivers/net/virtio/virtio_ethdev.c
> > +++ b/drivers/net/virtio/virtio_ethdev.c
> > @@ -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;
> > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> > index dfe5c1b..749b372 100644
> > --- a/lib/librte_ethdev/rte_ethdev.c
> > +++ b/lib/librte_ethdev/rte_ethdev.c
> > @@ -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));
> > diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
> > index 645a186..ff3a616 100644
> > --- a/lib/librte_ethdev/rte_ethdev.h
> > +++ b/lib/librte_ethdev/rte_ethdev.h
> > @@ -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.
> > diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
> > index 23cc1e0..c68d465 100644
> > --- a/lib/librte_ethdev/rte_ethdev_driver.h
> > +++ b/lib/librte_ethdev/rte_ethdev_driver.h
> > @@ -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?

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28  9:16       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
@ 2020-09-28 12:00         ` Ananyev, Konstantin
  2020-09-28 13:47         ` Min Hu (Connor)
  2020-09-28 13:53         ` Ferruh Yigit
  2 siblings, 0 replies; 64+ messages in thread
From: Ananyev, Konstantin @ 2020-09-28 12:00 UTC (permalink / raw)
  To: Thomas Monjalon, Yigit, Ferruh
  Cc: Min Hu (Connor),
	techboard, stephen, Richardson, Bruce, jerinj, Ray Kinsella, dev

> 28/09/2020 10:59, Ferruh Yigit:
> > On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> > > From: Huisong Li <lihuisong@huawei.com>
> > >
> > > 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.
> 
> 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?
> 
> [...]
> > > --- a/lib/librte_ethdev/rte_ethdev.h
> > > +++ b/lib/librte_ethdev/rte_ethdev.h
> > >   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);
> [...]
> > >   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);
> [...]
> > 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.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:
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

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


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28  9:16       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
  2020-09-28 12:00         ` Ananyev, Konstantin
@ 2020-09-28 13:47         ` Min Hu (Connor)
  2020-09-28 15:35           ` Thomas Monjalon
  2020-09-28 13:53         ` Ferruh Yigit
  2 siblings, 1 reply; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-28 13:47 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit
  Cc: techboard, stephen, bruce.richardson, jerinj, Ray Kinsella, dev



在 2020/9/28 17:16, Thomas Monjalon 写道:
> 28/09/2020 10:59, Ferruh Yigit:
>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>>> From: Huisong Li <lihuisong@huawei.com>
>>>
>>> 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.
> 
> 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.

> [...]
>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>>    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);
> [...]
>>>    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);
> [...]
>> 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.
> 
>> 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.

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28  9:16       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
  2020-09-28 12:00         ` Ananyev, Konstantin
  2020-09-28 13:47         ` Min Hu (Connor)
@ 2020-09-28 13:53         ` Ferruh Yigit
  2020-09-28 15:24           ` Thomas Monjalon
  2020-09-29  4:49           ` Min Hu (Connor)
  2 siblings, 2 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-09-28 13:53 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Min Hu (Connor),
	techboard, stephen, bruce.richardson, jerinj, Ray Kinsella, dev

On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
> 28/09/2020 10:59, Ferruh Yigit:
>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>>> From: Huisong Li <lihuisong@huawei.com>
>>>
>>> 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.
> 
> 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?
> 
> [...]
>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>>    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);
> [...]
>>>    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);
> [...]
>> 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.
> 

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

>> 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.


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28 13:53         ` Ferruh Yigit
@ 2020-09-28 15:24           ` Thomas Monjalon
  2020-09-28 15:43             ` Stephen Hemminger
  2020-09-29  4:49           ` Min Hu (Connor)
  1 sibling, 1 reply; 64+ messages in thread
From: Thomas Monjalon @ 2020-09-28 15:24 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Min Hu (Connor),
	techboard, stephen, bruce.richardson, jerinj, Ray Kinsella, dev

28/09/2020 15:53, Ferruh Yigit:
> On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
> > 28/09/2020 10:59, Ferruh Yigit:
> >> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> >>> From: Huisong Li <lihuisong@huawei.com>
> >>>
> >>> 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.
> > 
> > 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?
> > 
> > [...]
> >>> --- a/lib/librte_ethdev/rte_ethdev.h
> >>> +++ b/lib/librte_ethdev/rte_ethdev.h
> >>>    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);
> > [...]
> >>>    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);
> > [...]
> >> 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.
> > 
> 
> Right, it is not related to the port id, it is fixing the storage type for index 
> used to map the queue stats.
> 
> >> 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.

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.



^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28 13:47         ` Min Hu (Connor)
@ 2020-09-28 15:35           ` Thomas Monjalon
  0 siblings, 0 replies; 64+ messages in thread
From: Thomas Monjalon @ 2020-09-28 15:35 UTC (permalink / raw)
  To: Ferruh Yigit, Min Hu (Connor)
  Cc: techboard, stephen, bruce.richardson, jerinj, Ray Kinsella, dev

28/09/2020 15:47, Min Hu (Connor):
> 
> 在 2020/9/28 17:16, Thomas Monjalon 写道:
> > 28/09/2020 10:59, Ferruh Yigit:
> >> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> >>> From: Huisong Li <lihuisong@huawei.com>
> >>>
> >>> 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.
> > 
> > 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++) {
> 		...
> 	}
> 	...
> }

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

> 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.

> So these "*_queue_stats_mapping" API also trigger 
> errors or warning.
> 
> > [...]
> >>> --- a/lib/librte_ethdev/rte_ethdev.h
> >>> +++ b/lib/librte_ethdev/rte_ethdev.h
> >>>    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);
> > [...]
> >>>    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);
> > [...]
> >> 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.
> > 
> >> 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.

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

>   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).

> > 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.



^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28 15:24           ` Thomas Monjalon
@ 2020-09-28 15:43             ` Stephen Hemminger
  2020-10-05 12:23               ` Ferruh Yigit
  0 siblings, 1 reply; 64+ messages in thread
From: Stephen Hemminger @ 2020-09-28 15:43 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Ferruh Yigit, Min Hu (Connor),
	techboard, bruce.richardson, jerinj, Ray Kinsella, dev

On Mon, 28 Sep 2020 17:24:26 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:

> 28/09/2020 15:53, Ferruh Yigit:
> > On 9/28/2020 10:16 AM, Thomas Monjalon wrote:  
> > > 28/09/2020 10:59, Ferruh Yigit:  
> > >> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:  
> > >>> From: Huisong Li <lihuisong@huawei.com>
> > >>>
> > >>> 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.  
> > > 
> > > 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?
> > > 
> > > [...]  
> > >>> --- a/lib/librte_ethdev/rte_ethdev.h
> > >>> +++ b/lib/librte_ethdev/rte_ethdev.h
> > >>>    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);  
> > > [...]  
> > >>>    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);  
> > > [...]  
> > >> 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.
> > >   
> > 
> > Right, it is not related to the port id, it is fixing the storage type for index 
> > used to map the queue stats.
> >   
> > >> 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.  
> 
> 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"

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28 13:53         ` Ferruh Yigit
  2020-09-28 15:24           ` Thomas Monjalon
@ 2020-09-29  4:49           ` Min Hu (Connor)
  2020-09-29  9:33             ` Thomas Monjalon
  1 sibling, 1 reply; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-29  4:49 UTC (permalink / raw)
  To: Ferruh Yigit, Thomas Monjalon
  Cc: techboard, stephen, bruce.richardson, jerinj, Ray Kinsella, dev



在 2020/9/28 21:53, Ferruh Yigit 写道:
> On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
>> 28/09/2020 10:59, Ferruh Yigit:
>>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>
>>>> 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.
>>
>> 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?
>>
>> [...]
>>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>>>    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);
>> [...]
>>>>    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);
>> [...]
>>> 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.
>>
> 
> Right, it is not related to the port id, it is fixing the storage type 
> for index used to map the queue stats.
> 
>>> 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.

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.






^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-29  4:49           ` Min Hu (Connor)
@ 2020-09-29  9:33             ` Thomas Monjalon
  2020-09-29 13:46               ` Min Hu (Connor)
  0 siblings, 1 reply; 64+ messages in thread
From: Thomas Monjalon @ 2020-09-29  9:33 UTC (permalink / raw)
  To: Ferruh Yigit, Min Hu (Connor)
  Cc: techboard, stephen, bruce.richardson, jerinj, Ray Kinsella, dev

29/09/2020 06:49, Min Hu (Connor):
> 
> 在 2020/9/28 21:53, Ferruh Yigit 写道:
> > On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
> >> 28/09/2020 10:59, Ferruh Yigit:
> >>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> >>>> From: Huisong Li <lihuisong@huawei.com>
> >>>>
> >>>> 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.
> >>
> >> 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?
> >>
> >> [...]
> >>>> --- a/lib/librte_ethdev/rte_ethdev.h
> >>>> +++ b/lib/librte_ethdev/rte_ethdev.h
> >>>>    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);
> >> [...]
> >>>>    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);
> >> [...]
> >>> 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.
> >>
> > 
> > Right, it is not related to the port id, it is fixing the storage type 
> > for index used to map the queue stats.
> > 
> >>> 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.
> 
> 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.

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.

> 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 I would prefer deprecating RTE_ETHDEV_QUEUE_STAT_CNTRS,
instead of increasing size of the mapping API.

> 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".



^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-29  9:33             ` Thomas Monjalon
@ 2020-09-29 13:46               ` Min Hu (Connor)
  0 siblings, 0 replies; 64+ messages in thread
From: Min Hu (Connor) @ 2020-09-29 13:46 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit
  Cc: techboard, stephen, bruce.richardson, jerinj, Ray Kinsella, dev

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.
	Acked-by: Thomas Monjalon <thomas@monjalon.net>
	
	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.
	
在 2020/9/29 17:33, Thomas Monjalon 写道:
> 29/09/2020 06:49, Min Hu (Connor):
>>
>> 在 2020/9/28 21:53, Ferruh Yigit 写道:
>>> On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
>>>> 28/09/2020 10:59, Ferruh Yigit:
>>>>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>
>>>>>> 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.
>>>>
>>>> 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?
>>>>
>>>> [...]
>>>>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>>>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>>>>>     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);
>>>> [...]
>>>>>>     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);
>>>> [...]
>>>>> 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.
>>>>
>>>
>>> Right, it is not related to the port id, it is fixing the storage type
>>> for index used to map the queue stats.
>>>
>>>>> 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.
>>
>> 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.
> 
> 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.
> 
>> 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 I would prefer deprecating RTE_ETHDEV_QUEUE_STAT_CNTRS,
> instead of increasing size of the mapping API.
> 
>> 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".
> 
> 
> .
> 

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28  8:59     ` Ferruh Yigit
  2020-09-28  9:16       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
  2020-09-28 11:52       ` Ananyev, Konstantin
@ 2020-09-30  8:34       ` Kinsella, Ray
  2 siblings, 0 replies; 64+ messages in thread
From: Kinsella, Ray @ 2020-09-30  8:34 UTC (permalink / raw)
  To: Ferruh Yigit, Min Hu (Connor), techboard
  Cc: stephen, bruce.richardson, jerinj, dev



On 28/09/2020 09:59, Ferruh Yigit wrote:
> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>> From: Huisong Li <lihuisong@huawei.com>
>>
>> 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/")
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
>> Reviewed-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> 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]
> 
> 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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-09-28 15:43             ` Stephen Hemminger
@ 2020-10-05 12:23               ` Ferruh Yigit
  2020-10-06  8:33                 ` Olivier Matz
  0 siblings, 1 reply; 64+ messages in thread
From: Ferruh Yigit @ 2020-10-05 12:23 UTC (permalink / raw)
  To: Stephen Hemminger, Thomas Monjalon
  Cc: Min Hu (Connor), techboard, bruce.richardson, jerinj, Ray Kinsella, dev

On 9/28/2020 4:43 PM, Stephen Hemminger wrote:
> On Mon, 28 Sep 2020 17:24:26 +0200
> Thomas Monjalon <thomas@monjalon.net> wrote:
> 
>> 28/09/2020 15:53, Ferruh Yigit:
>>> On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
>>>> 28/09/2020 10:59, Ferruh Yigit:
>>>>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>
>>>>>> 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.
>>>>
>>>> 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?
>>>>
>>>> [...]
>>>>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>>>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>>>>>     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);
>>>> [...]
>>>>>>     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);
>>>> [...]
>>>>> 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.
>>>>    
>>>
>>> Right, it is not related to the port id, it is fixing the storage type for index
>>> used to map the queue stats.
>>>    
>>>>> 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.
>>
>> 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)
       |               ^~

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq
  2020-09-28  9:21       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
@ 2020-10-05 12:26         ` Ferruh Yigit
  2020-10-06 12:04           ` Ferruh Yigit
  0 siblings, 1 reply; 64+ messages in thread
From: Ferruh Yigit @ 2020-10-05 12:26 UTC (permalink / raw)
  To: Thomas Monjalon, Min Hu (Connor)
  Cc: techboard, stephen, bruce.richardson, jerinj, dev

On 9/28/2020 10:21 AM, Thomas Monjalon wrote:
> 28/09/2020 11:04, Ferruh Yigit:
>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>>> From: Huisong Li <lihuisong@huawei.com>
>>>
>>> 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.
> [...]
>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>>    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];
>>>    };
>>>    
>>>
>>
>> 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.
> 
> Yes queues are in 16-bit range.
> 
>> 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?
> 
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> 
> 

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

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

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-10-05 12:23               ` Ferruh Yigit
@ 2020-10-06  8:33                 ` Olivier Matz
  2020-10-09 20:32                   ` Ferruh Yigit
  0 siblings, 1 reply; 64+ messages in thread
From: Olivier Matz @ 2020-10-06  8:33 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Stephen Hemminger, Thomas Monjalon, Min Hu (Connor),
	techboard, bruce.richardson, jerinj, Ray Kinsella, dev

Hi,

On Mon, Oct 05, 2020 at 01:23:08PM +0100, Ferruh Yigit wrote:
> On 9/28/2020 4:43 PM, Stephen Hemminger wrote:
> > On Mon, 28 Sep 2020 17:24:26 +0200
> > Thomas Monjalon <thomas@monjalon.net> wrote:
> > 
> > > 28/09/2020 15:53, Ferruh Yigit:
> > > > On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
> > > > > 28/09/2020 10:59, Ferruh Yigit:
> > > > > > On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> > > > > > > From: Huisong Li <lihuisong@huawei.com>
> > > > > > > 
> > > > > > > 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.
> > > > > 
> > > > > 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?
> > > > > 
> > > > > [...]
> > > > > > > --- a/lib/librte_ethdev/rte_ethdev.h
> > > > > > > +++ b/lib/librte_ethdev/rte_ethdev.h
> > > > > > >     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);
> > > > > [...]
> > > > > > >     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);
> > > > > [...]
> > > > > > 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.
> > > > 
> > > > Right, it is not related to the port id, it is fixing the storage type for index
> > > > used to map the queue stats.
> > > > > > 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.
> > > 
> > > 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?

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.


> 
> 
> [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)
>       |               ^~

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq
  2020-10-05 12:26         ` Ferruh Yigit
@ 2020-10-06 12:04           ` Ferruh Yigit
  0 siblings, 0 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-10-06 12:04 UTC (permalink / raw)
  To: Thomas Monjalon, Min Hu (Connor)
  Cc: techboard, stephen, bruce.richardson, jerinj, dev

On 10/5/2020 1:26 PM, Ferruh Yigit wrote:
> On 9/28/2020 10:21 AM, Thomas Monjalon wrote:
>> 28/09/2020 11:04, Ferruh Yigit:
>>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>
>>>> 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.
>> [...]
>>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>>>    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];
>>>>    };
>>>>
>>>
>>> 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.
>>
>> Yes queues are in 16-bit range.
>>
>>> 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?
>>
>> Acked-by: Thomas Monjalon <thomas@monjalon.net>
>>
>>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> 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.

^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-10-06  8:33                 ` Olivier Matz
@ 2020-10-09 20:32                   ` Ferruh Yigit
  2020-10-10  8:09                     ` Thomas Monjalon
  0 siblings, 1 reply; 64+ messages in thread
From: Ferruh Yigit @ 2020-10-09 20:32 UTC (permalink / raw)
  To: Min Hu (Connor), Thomas Monjalon, Honnappa Nagarahalli
  Cc: Olivier Matz, Stephen Hemminger, techboard, bruce.richardson,
	jerinj, Ray Kinsella, dev

On 10/6/2020 9:33 AM, Olivier Matz wrote:
> Hi,
> 
> On Mon, Oct 05, 2020 at 01:23:08PM +0100, Ferruh Yigit wrote:
>> On 9/28/2020 4:43 PM, Stephen Hemminger wrote:
>>> On Mon, 28 Sep 2020 17:24:26 +0200
>>> Thomas Monjalon <thomas@monjalon.net> wrote:
>>>
>>>> 28/09/2020 15:53, Ferruh Yigit:
>>>>> On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
>>>>>> 28/09/2020 10:59, Ferruh Yigit:
>>>>>>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>>>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>>>
>>>>>>>> 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.
>>>>>>
>>>>>> 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?
>>>>>>
>>>>>> [...]
>>>>>>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>>>>>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>>>>>>>      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);
>>>>>> [...]
>>>>>>>>      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);
>>>>>> [...]
>>>>>>> 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.
>>>>>
>>>>> Right, it is not related to the port id, it is fixing the storage type for index
>>>>> used to map the queue stats.
>>>>>>> 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.
>>>>
>>>> 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?
> 
> 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

> 
>>
>>
>> [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)
>>        |               ^~


^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-10-09 20:32                   ` Ferruh Yigit
@ 2020-10-10  8:09                     ` Thomas Monjalon
  2020-10-12 17:02                       ` Ferruh Yigit
  0 siblings, 1 reply; 64+ messages in thread
From: Thomas Monjalon @ 2020-10-10  8:09 UTC (permalink / raw)
  To: Min Hu (Connor), Honnappa Nagarahalli, Ferruh Yigit
  Cc: Olivier Matz, Stephen Hemminger, techboard, bruce.richardson,
	jerinj, Ray Kinsella, dev

09/10/2020 22:32, Ferruh Yigit:
> On 10/6/2020 9:33 AM, Olivier Matz wrote:
> > On Mon, Oct 05, 2020 at 01:23:08PM +0100, Ferruh Yigit wrote:
> >> On 9/28/2020 4:43 PM, Stephen Hemminger wrote:
> >>> On Mon, 28 Sep 2020 17:24:26 +0200
> >>> Thomas Monjalon <thomas@monjalon.net> wrote:
> >>>> 28/09/2020 15:53, Ferruh Yigit:
> >>>>> On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
> >>>>>> 28/09/2020 10:59, Ferruh Yigit:
> >>>>>>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
> >>>>>>>> From: Huisong Li <lihuisong@huawei.com>
> >>>>>>>>
> >>>>>>>> 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.
> >>>>>>
> >>>>>> 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?
> >>>>>>
> >>>>>> [...]
> >>>>>>>> --- a/lib/librte_ethdev/rte_ethdev.h
> >>>>>>>> +++ b/lib/librte_ethdev/rte_ethdev.h
> >>>>>>>>      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);
> >>>>>> [...]
> >>>>>>>>      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);
> >>>>>> [...]
> >>>>>>> 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.
> >>>>>
> >>>>> Right, it is not related to the port id, it is fixing the storage type for index
> >>>>> used to map the queue stats.
> >>>>>>> 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.
> >>>>
> >>>> 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?
> > 
> > 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.

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

> 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.


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




^ permalink raw reply	[flat|nested] 64+ messages in thread

* Re: [dpdk-dev] [dpdk-techboard] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats
  2020-10-10  8:09                     ` Thomas Monjalon
@ 2020-10-12 17:02                       ` Ferruh Yigit
  0 siblings, 0 replies; 64+ messages in thread
From: Ferruh Yigit @ 2020-10-12 17:02 UTC (permalink / raw)
  To: Thomas Monjalon, Min Hu (Connor), Honnappa Nagarahalli
  Cc: Olivier Matz, Stephen Hemminger, techboard, bruce.richardson,
	jerinj, Ray Kinsella, dev

On 10/10/2020 9:09 AM, Thomas Monjalon wrote:
> 09/10/2020 22:32, Ferruh Yigit:
>> On 10/6/2020 9:33 AM, Olivier Matz wrote:
>>> On Mon, Oct 05, 2020 at 01:23:08PM +0100, Ferruh Yigit wrote:
>>>> On 9/28/2020 4:43 PM, Stephen Hemminger wrote:
>>>>> On Mon, 28 Sep 2020 17:24:26 +0200
>>>>> Thomas Monjalon <thomas@monjalon.net> wrote:
>>>>>> 28/09/2020 15:53, Ferruh Yigit:
>>>>>>> On 9/28/2020 10:16 AM, Thomas Monjalon wrote:
>>>>>>>> 28/09/2020 10:59, Ferruh Yigit:
>>>>>>>>> On 9/27/2020 4:16 AM, Min Hu (Connor) wrote:
>>>>>>>>>> From: Huisong Li <lihuisong@huawei.com>
>>>>>>>>>>
>>>>>>>>>> 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.
>>>>>>>>
>>>>>>>> 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?
>>>>>>>>
>>>>>>>> [...]
>>>>>>>>>> --- a/lib/librte_ethdev/rte_ethdev.h
>>>>>>>>>> +++ b/lib/librte_ethdev/rte_ethdev.h
>>>>>>>>>>       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);
>>>>>>>> [...]
>>>>>>>>>>       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);
>>>>>>>> [...]
>>>>>>>>> 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.
>>>>>>>
>>>>>>> Right, it is not related to the port id, it is fixing the storage type for index
>>>>>>> used to map the queue stats.
>>>>>>>>> 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.
>>>>>>
>>>>>> 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?
>>>
>>> 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.
> 
> You're right, when using the old API in xstats implementation,
> we are limited to RTE_ETHDEV_QUEUE_STAT_CNTRS queues.
> 
>> 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.
> 

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.

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


^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2020-10-12 17:02 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31  3:41 [dpdk-dev] [RFC 1/2] Description: lib/ethdev: change data type in tc_rxq and tc_txq Min Hu(Connor)
2020-08-31  3:41 ` [dpdk-dev] [RFC 2/2] Description: dpdk: fix compiling errors for more than 256 per-queue statistics Min Hu(Connor)
2020-09-01  1:33 ` [dpdk-dev] [RFC 1/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
2020-09-01  1:33   ` [dpdk-dev] [RFC 2/2] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
2020-09-01  2:23     ` Stephen Hemminger
2020-09-01 11:52   ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Min Hu (Connor)
2020-09-01 11:52     ` [dpdk-dev] [PATCH 1/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
2020-09-04 11:32       ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Min Hu (Connor)
2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 1/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
2020-09-04 18:04           ` Ferruh Yigit
2020-09-04 18:31           ` Ferruh Yigit
2020-09-05 16:51             ` Thomas Monjalon
2020-09-23  2:31             ` Min Hu (Connor)
2020-09-23  9:18               ` Ferruh Yigit
2020-09-25  8:58                 ` Min Hu (Connor)
2020-09-25  9:36                   ` Ferruh Yigit
2020-09-23 12:59           ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Min Hu (Connor)
2020-09-23 12:59             ` [dpdk-dev] [PATCH V3 1/4] dpdk: fix compiling errors for per-queue statistics Min Hu (Connor)
2020-09-23 13:00             ` [dpdk-dev] [PATCH V3 2/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
2020-09-23 13:00             ` [dpdk-dev] [PATCH V3 3/4] doc: announce modified field in DCB TC queue mapping Min Hu (Connor)
2020-09-23 13:00             ` [dpdk-dev] [PATCH V3 4/4] doc: announce modified in queue stats mapping API Min Hu (Connor)
2020-09-25  9:41             ` [dpdk-dev] [PATCH V3 0/4] change data type in TC queue Ferruh Yigit
2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 2/4] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 3/4] doc: announce modified field in DCB TC queue mapping Min Hu (Connor)
2020-09-04 11:32         ` [dpdk-dev] [PATCH V2 4/4] doc: announce modified field in ethdev API Min Hu (Connor)
2020-09-04 14:33         ` [dpdk-dev] [PATCH V2 0/4] ethdev: change the queue ID type Ferruh Yigit
2020-09-09 12:36       ` [dpdk-dev] [PATCH V3 0/3] add FEC support Min Hu (Connor)
2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 1/3] ethdev: introduce FEC API Min Hu (Connor)
2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 2/3] net/hns3: support FEC Min Hu (Connor)
2020-09-09 12:36         ` [dpdk-dev] [PATCH V3 3/3] app/testpmd: add FEC command Min Hu (Connor)
2020-09-01 11:52     ` [dpdk-dev] [PATCH 2/4] ethdev: fix compiling errors for per-queue statistics Min Hu (Connor)
2020-09-01 16:17       ` Ferruh Yigit
2020-09-01 11:52     ` [dpdk-dev] [PATCH 3/4] doc: announce modified field in DCB TC queue mapping Min Hu (Connor)
2020-09-01 11:52     ` [dpdk-dev] [PATCH 4/4] doc: announce modified field in ethdev API Min Hu (Connor)
2020-09-01 16:14     ` [dpdk-dev] [PATCH 0/4] ethdev: change the queue ID type Ferruh Yigit
2020-09-25 12:51 ` [dpdk-dev] [PATCH V4 0/2] change data type in TC queue Min Hu (Connor)
2020-09-25 12:51   ` [dpdk-dev] [PATCH V4 1/2] dpdk: resolve compiling errors for per-queue stats Min Hu (Connor)
2020-09-25 12:51   ` [dpdk-dev] [PATCH V4 2/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
2020-09-25 13:14   ` [dpdk-dev] [PATCH V4 0/2] change data type in TC queue Ferruh Yigit
2020-09-27  3:16 ` [dpdk-dev] [PATCH V5 " Min Hu (Connor)
2020-09-27  3:16   ` [dpdk-dev] [PATCH V5 1/2] dpdk: resolve compiling errors for per-queue stats Min Hu (Connor)
2020-09-28  8:59     ` Ferruh Yigit
2020-09-28  9:16       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
2020-09-28 12:00         ` Ananyev, Konstantin
2020-09-28 13:47         ` Min Hu (Connor)
2020-09-28 15:35           ` Thomas Monjalon
2020-09-28 13:53         ` Ferruh Yigit
2020-09-28 15:24           ` Thomas Monjalon
2020-09-28 15:43             ` Stephen Hemminger
2020-10-05 12:23               ` Ferruh Yigit
2020-10-06  8:33                 ` Olivier Matz
2020-10-09 20:32                   ` Ferruh Yigit
2020-10-10  8:09                     ` Thomas Monjalon
2020-10-12 17:02                       ` Ferruh Yigit
2020-09-29  4:49           ` Min Hu (Connor)
2020-09-29  9:33             ` Thomas Monjalon
2020-09-29 13:46               ` Min Hu (Connor)
2020-09-28 11:52       ` Ananyev, Konstantin
2020-09-30  8:34       ` [dpdk-dev] " Kinsella, Ray
2020-09-27  3:16   ` [dpdk-dev] [PATCH V5 2/2] ethdev: change data type in TC rxq and TC txq Min Hu (Connor)
2020-09-28  9:04     ` Ferruh Yigit
2020-09-28  9:21       ` [dpdk-dev] [dpdk-techboard] " Thomas Monjalon
2020-10-05 12:26         ` Ferruh Yigit
2020-10-06 12:04           ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).