patch 'net/mlx5: fix end condition of reading xstats' has been queued to stable release 21.11.8
Kevin Traynor
ktraynor at redhat.com
Fri Aug 23 18:19:07 CEST 2024
Hi,
FYI, your patch has been queued to stable release 21.11.8
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/28/24. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/6a7d2c982887e5a4730e923cb48797c626a75574
Thanks.
Kevin
---
>From 6a7d2c982887e5a4730e923cb48797c626a75574 Mon Sep 17 00:00:00 2001
From: Bing Zhao <bingz at nvidia.com>
Date: Wed, 17 Jul 2024 19:33:37 +0300
Subject: [PATCH] net/mlx5: fix end condition of reading xstats
[ upstream commit 1be61fe1333cd4a8a4bba6eb0d68780073fe3512 ]
The "mlx5_stats_n" in the "struct mlx5_xstats_ctrl" is the number of
device stats identified by PMD. Right now, the mapping of device
stats to the xstats is not compact. The "input index" of the device
stats would remain UINT16_MAX and be skipped when reading counters.
If some DPDK stats cannot be identified in the middle of the map, the
end condition should be bigger than the "mlx5_stats_n". Or else, some
counters would not be read and calculated.
Using the global const "xstats_n" as the end condition to traverse
the whole array in case some counters are missed. The "xstats_o_idx"
should be used instead of the iteration to check if the statistics
is an IB device counter.
In the meanwhile, adding another field to record the start index of
the IB counters to reduce the redundancy iterations.
Fixes: a687c3e658c2 ("net/mlx5: fix counters map in bonding mode")
Signed-off-by: Bing Zhao <bingz at nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>
---
drivers/net/mlx5/linux/mlx5_ethdev_os.c | 23 +++++++++++++----------
drivers/net/mlx5/mlx5.h | 5 +++++
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index a181a19f29..6d98657917 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -1363,4 +1363,5 @@ _mlx5_os_read_dev_counters(struct rte_eth_dev *dev, int pf, uint64_t *stats)
int ret;
uint16_t i_idx, o_idx;
+ uint32_t total_stats = xstats_n;
et_stats->cmd = ETHTOOL_GSTATS;
@@ -1380,17 +1381,17 @@ _mlx5_os_read_dev_counters(struct rte_eth_dev *dev, int pf, uint64_t *stats)
}
if (pf <= 0) {
- for (i = 0; i != xstats_ctrl->mlx5_stats_n; i++) {
+ for (i = 0; i != total_stats; i++) {
i_idx = xstats_ctrl->dev_table_idx[i];
- if (i_idx == UINT16_MAX || xstats_ctrl->info[i].dev)
- continue;
o_idx = xstats_ctrl->xstats_o_idx[i];
+ if (i_idx == UINT16_MAX || xstats_ctrl->info[o_idx].dev)
+ continue;
stats[o_idx] += (uint64_t)et_stats->data[i_idx];
}
} else {
- for (i = 0; i != xstats_ctrl->mlx5_stats_n; i++) {
+ for (i = 0; i != total_stats; i++) {
i_idx = xstats_ctrl->dev_table_idx_2nd[i];
- if (i_idx == UINT16_MAX)
- continue;
o_idx = xstats_ctrl->xstats_o_idx_2nd[i];
+ if (i_idx == UINT16_MAX || xstats_ctrl->info[o_idx].dev)
+ continue;
stats[o_idx] += (uint64_t)et_stats->data[i_idx];
}
@@ -1435,9 +1436,9 @@ mlx5_os_read_dev_counters(struct rte_eth_dev *dev, bool bond_master, uint64_t *s
}
/*
- * Read IB counters.
- * The counters are unique per IB device but not per net IF.
+ * Read IB dev counters.
+ * The counters are unique per IB device but not per netdev IF.
* In bonding mode, getting the stats name only from 1 port is enough.
*/
- for (i = 0; i != xstats_ctrl->mlx5_stats_n; i++) {
+ for (i = xstats_ctrl->dev_cnt_start; i < xstats_ctrl->mlx5_stats_n; i++) {
if (!xstats_ctrl->info[i].dev)
continue;
@@ -1625,5 +1626,5 @@ static const struct mlx5_counter_ctrl mlx5_counters_init[] = {
};
-static const unsigned int xstats_n = RTE_DIM(mlx5_counters_init);
+const unsigned int xstats_n = RTE_DIM(mlx5_counters_init);
static int
@@ -1671,4 +1672,5 @@ mlx5_os_get_stats_strings(struct rte_eth_dev *dev, bool bond_master,
if (!bond_master) {
/* Add dev counters, unique per IB device. */
+ xstats_ctrl->dev_cnt_start = xstats_ctrl->mlx5_stats_n;
for (j = 0; j != xstats_n; j++) {
if (mlx5_counters_init[j].dev) {
@@ -1712,4 +1714,5 @@ mlx5_os_get_stats_strings(struct rte_eth_dev *dev, bool bond_master,
}
/* Dev counters are always at the last now. */
+ xstats_ctrl->dev_cnt_start = xstats_ctrl->mlx5_stats_n;
for (j = 0; j != xstats_n; j++) {
if (mlx5_counters_init[j].dev) {
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index cddb9435df..80c1c0b7b1 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -204,4 +204,6 @@ struct mlx5_xstats_ctrl {
/* Number of device stats identified by PMD. */
uint16_t mlx5_stats_n;
+ /* First device counters index. */
+ uint16_t dev_cnt_start;
/* Index in the device counters table. */
uint16_t dev_table_idx[MLX5_MAX_XSTATS];
@@ -218,4 +220,7 @@ struct mlx5_xstats_ctrl {
};
+/* xstats array size. */
+extern const unsigned int xstats_n;
+
struct mlx5_stats_ctrl {
/* Base for imissed counter. */
--
2.46.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-08-23 17:18:13.301003997 +0100
+++ 0119-net-mlx5-fix-end-condition-of-reading-xstats.patch 2024-08-23 17:18:09.875430647 +0100
@@ -1 +1 @@
-From 1be61fe1333cd4a8a4bba6eb0d68780073fe3512 Mon Sep 17 00:00:00 2001
+From 6a7d2c982887e5a4730e923cb48797c626a75574 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 1be61fe1333cd4a8a4bba6eb0d68780073fe3512 ]
+
@@ -24 +25,0 @@
-Cc: stable at dpdk.org
@@ -34 +35 @@
-index 82f651f2f3..5d64984022 100644
+index a181a19f29..6d98657917 100644
@@ -37 +38 @@
-@@ -1202,4 +1202,5 @@ _mlx5_os_read_dev_counters(struct rte_eth_dev *dev, int pf, uint64_t *stats)
+@@ -1363,4 +1363,5 @@ _mlx5_os_read_dev_counters(struct rte_eth_dev *dev, int pf, uint64_t *stats)
@@ -43 +44 @@
-@@ -1219,17 +1220,17 @@ _mlx5_os_read_dev_counters(struct rte_eth_dev *dev, int pf, uint64_t *stats)
+@@ -1380,17 +1381,17 @@ _mlx5_os_read_dev_counters(struct rte_eth_dev *dev, int pf, uint64_t *stats)
@@ -67 +68 @@
-@@ -1274,9 +1275,9 @@ mlx5_os_read_dev_counters(struct rte_eth_dev *dev, bool bond_master, uint64_t *s
+@@ -1435,9 +1436,9 @@ mlx5_os_read_dev_counters(struct rte_eth_dev *dev, bool bond_master, uint64_t *s
@@ -80 +81 @@
-@@ -1574,5 +1575,5 @@ static const struct mlx5_counter_ctrl mlx5_counters_init[] = {
+@@ -1625,5 +1626,5 @@ static const struct mlx5_counter_ctrl mlx5_counters_init[] = {
@@ -87 +88 @@
-@@ -1620,4 +1621,5 @@ mlx5_os_get_stats_strings(struct rte_eth_dev *dev, bool bond_master,
+@@ -1671,4 +1672,5 @@ mlx5_os_get_stats_strings(struct rte_eth_dev *dev, bool bond_master,
@@ -93 +94 @@
-@@ -1661,4 +1663,5 @@ mlx5_os_get_stats_strings(struct rte_eth_dev *dev, bool bond_master,
+@@ -1712,4 +1714,5 @@ mlx5_os_get_stats_strings(struct rte_eth_dev *dev, bool bond_master,
@@ -100 +101 @@
-index 75a1e170af..869aac032b 100644
+index cddb9435df..80c1c0b7b1 100644
@@ -103 +104 @@
-@@ -282,4 +282,6 @@ struct mlx5_xstats_ctrl {
+@@ -204,4 +204,6 @@ struct mlx5_xstats_ctrl {
@@ -110 +111 @@
-@@ -296,4 +298,7 @@ struct mlx5_xstats_ctrl {
+@@ -218,4 +220,7 @@ struct mlx5_xstats_ctrl {
More information about the stable
mailing list