net/mlx5: add Rx drop counters to xstats
PATCH 1/1 net/mlx5: add Rx drop counters to xstats
Add two kinds of Rx drop counters to DPDK xstats which are physical port scope.
1. rx_prio[0-7]_buf_discard
The number of unicast packets dropped due to lack of shared buffer resources.
2. rx_prio[0-7]_cong_discard
The number of packets that is dropped by the Weighted Random Early Detection (WRED) function.
Prio[0-7] is determined by VLAN PCP value which is 0 by default. Both counters are retrieved from kernel ethtool API which calls PRM command finally.
--- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 66 ++++++++++++++++++++++++- drivers/net/mlx5/mlx5_defs.h | 2 +- 2 files changed, 66 insertions(+), 2 deletions(-)
drivers/net/mlx5/linux/mlx5_ethdev_os.c +65 -1
@@ -1526,6 +1526,70 @@ static const struct mlx5_counter_ctrl mlx5_counters_init[] = { .dpdk_name = "rx_phy_discard_packets", .ctr_name = "rx_discards_phy", }, + { + .dpdk_name = "rx_prio0_buf_discard_packets", + .ctr_name = "rx_prio0_buf_discard", + }, + { + .dpdk_name = "rx_prio1_buf_discard_packets", + .ctr_name = "rx_prio1_buf_discard", + }, + { + .dpdk_name = "rx_prio2_buf_discard_packets", + .ctr_name = "rx_prio2_buf_discard", + }, + { + .dpdk_name = "rx_prio3_buf_discard_packets", + .ctr_name = "rx_prio3_buf_discard", + }, + { + .dpdk_name = "rx_prio4_buf_discard_packets", + .ctr_name = "rx_prio4_buf_discard", + }, + { + .dpdk_name = "rx_prio5_buf_discard_packets", + .ctr_name = "rx_prio5_buf_discard", + }, + { + .dpdk_name = "rx_prio6_buf_discard_packets", + .ctr_name = "rx_prio6_buf_discard", + }, + { + .dpdk_name = "rx_prio7_buf_discard_packets", + .ctr_name = "rx_prio7_buf_discard", + }, + { + .dpdk_name = "rx_prio0_cong_discard_packets", + .ctr_name = "rx_prio0_cong_discard", + }, + { + .dpdk_name = "rx_prio1_cong_discard_packets", + .ctr_name = "rx_prio1_cong_discard", + }, + { + .dpdk_name = "rx_prio2_cong_discard_packets", + .ctr_name = "rx_prio2_cong_discard", + }, + { + .dpdk_name = "rx_prio3_cong_discard_packets", + .ctr_name = "rx_prio3_cong_discard", + }, + { + .dpdk_name = "rx_prio4_cong_discard_packets", + .ctr_name = "rx_prio4_cong_discard", + }, + { + .dpdk_name = "rx_prio5_cong_discard_packets", + .ctr_name = "rx_prio5_cong_discard", + }, + { + .dpdk_name = "rx_prio6_cong_discard_packets", + .ctr_name = "rx_prio6_cong_discard", + }, + { + .dpdk_name = "rx_prio7_cong_discard_packets", + .ctr_name = "rx_prio7_cong_discard", + }, { .dpdk_name = "tx_phy_bytes", .ctr_name = "tx_bytes_phy",
@@ -1625,6 +1689,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev) } }/* Add dev counters. */ +MLX5_ASSERT (xstats_ctrl->mlx5_stats_n <=MLX5_MAX_XSTATS );for (i =0 ; i != xstats_n; ++i) {if (mlx5_counters_init[i].dev) {unsigned int idx = xstats_ctrl->mlx5_stats_n++;
@@ -1633,7 +1698,6 @@ mlx5_os_stats_init(struct rte_eth_dev *dev) xstats_ctrl->hw_stats[idx] =0 ; } } -MLX5_ASSERT (xstats_ctrl->mlx5_stats_n <=MLX5_MAX_XSTATS ); xstats_ctrl->stats_n = dev_stats_n;/* Copy to base at first time. */ ret =mlx5_os_read_dev_counters (dev, xstats_ctrl->base);
drivers/net/mlx5/mlx5_defs.h +1 -1
@@ -47,7 +47,7 @@#define MLX5_ALARM_TIMEOUT_US 100000/* Maximum number of extended statistics counters. */ -#define MLX5_MAX_XSTATS 32 +#define MLX5_MAX_XSTATS 64/* Maximum Packet headers size (L2+L3+L4) for TSO. */ #define MLX5_MAX_TSO_HEADER 192U
Signature · 1 line
2.27.0
Hi,
Quoted 19 lines
-----Original Message-----
From: Rongwei Liu <[email protected]>
Sent: Thursday, May 26, 2022 5:50 AM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; NBU-Contact- Thomas Monjalon (EXTERNAL) <[email protected]>
Cc: [email protected]; Raslan Darawsheh <[email protected]>
Subject: [PATCH v1] net/mlx5: add Rx drop counters to xstatsAdd two kinds of Rx drop counters to DPDK xstats which are physical port scope.
1. rx_prio[0-7]_buf_discard
The number of unicast packets dropped due to lack of shared buffer resources.
2. rx_prio[0-7]_cong_discard
The number of packets that is dropped by the Weighted Random Early Detection (WRED) function.
Quoted 6 lines
Prio[0-7] is determined by VLAN PCP value which is 0 by default. Both counters are retrieved from kernel ethtool API which calls PRM command finally.
Signed-off-by Rongwei Liu <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh