[dpdk-stable] patch 'net/mlx5: fix xstats reset reinitialization' has been queued to stable release 19.11.6
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Mon Nov 9 19:40:17 CET 2020
Hi,
FYI, your patch has been queued to stable release 19.11.6
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/11/20. 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/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/d0f1f4bd45a3e2ea9490ea49d6ec8a0373ab21b5
Thanks.
Luca Boccassi
---
>From d0f1f4bd45a3e2ea9490ea49d6ec8a0373ab21b5 Mon Sep 17 00:00:00 2001
From: Shiri Kuzin <shirik at nvidia.com>
Date: Mon, 19 Oct 2020 09:36:50 +0300
Subject: [PATCH] net/mlx5: fix xstats reset reinitialization
[ upstream commit 42dcd453d9b63841a5460a6ca3872eb7648d73bd ]
The mlx5_xstats_reset clears the device extended statistics.
In this function the driver may reinitialize the structures
that are used to read device counters.
In case of reinitialization, the number of counters may
change, which wouldn't be taken into account by the
reset API callback and can cause a segmentation fault.
This issue is fixed by allocating the counters size after
the reinitialization.
Fixes: a4193ae3bc4f ("net/mlx5: support extended statistics")
Reported-by: Ralf Hoffmann <ralf.hoffmann at allegro-packets.com>
Signed-off-by: Shiri Kuzin <shirik at nvidia.com>
Acked-by: Matan Azrad <matan at nvidia.com>
---
drivers/net/mlx5/mlx5_stats.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index f3ec9543fe..ccdcdcfff6 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -536,8 +536,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
int stats_n;
unsigned int i;
- unsigned int n = xstats_ctrl->mlx5_stats_n;
- uint64_t counters[n];
+ uint64_t *counters;
int ret;
stats_n = mlx5_ethtool_get_stats_n(dev);
@@ -548,17 +547,26 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
}
if (xstats_ctrl->stats_n != stats_n)
mlx5_stats_init(dev);
+ counters = malloc(sizeof(*counters) * xstats_ctrl->mlx5_stats_n);
+ if (!counters) {
+ DRV_LOG(WARNING, "port %u unable to allocate memory for xstats "
+ "counters",
+ dev->data->port_id);
+ rte_errno = ENOMEM;
+ return -rte_errno;
+ }
ret = mlx5_read_dev_counters(dev, counters);
if (ret) {
DRV_LOG(ERR, "port %u cannot read device counters: %s",
dev->data->port_id, strerror(rte_errno));
+ free(counters);
return ret;
}
- for (i = 0; i != n; ++i) {
+ for (i = 0; i != xstats_ctrl->mlx5_stats_n; ++i) {
xstats_ctrl->base[i] = counters[i];
xstats_ctrl->hw_stats[i] = 0;
}
-
+ free(counters);
return 0;
}
--
2.27.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2020-11-09 18:40:12.380967135 +0000
+++ 0029-net-mlx5-fix-xstats-reset-reinitialization.patch 2020-11-09 18:40:11.131311282 +0000
@@ -1 +1 @@
-From 42dcd453d9b63841a5460a6ca3872eb7648d73bd Mon Sep 17 00:00:00 2001
+From d0f1f4bd45a3e2ea9490ea49d6ec8a0373ab21b5 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 42dcd453d9b63841a5460a6ca3872eb7648d73bd ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -24,2 +25,2 @@
- drivers/net/mlx5/mlx5_stats.c | 18 +++++++++++++++---
- 1 file changed, 15 insertions(+), 3 deletions(-)
+ drivers/net/mlx5/mlx5_stats.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
@@ -28 +29 @@
-index e30542e984..82d4d4a745 100644
+index f3ec9543fe..ccdcdcfff6 100644
@@ -31,9 +32 @@
-@@ -17,6 +17,7 @@
- #include "mlx5_defs.h"
- #include "mlx5.h"
- #include "mlx5_rxtx.h"
-+#include "mlx5_malloc.h"
-
- /**
- * DPDK callback to get extended device statistics.
-@@ -216,8 +217,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
+@@ -536,8 +536,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
@@ -48,2 +41,2 @@
- stats_n = mlx5_os_get_stats_n(dev);
-@@ -228,17 +228,29 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
+ stats_n = mlx5_ethtool_get_stats_n(dev);
+@@ -548,17 +547,26 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
@@ -52,4 +45,2 @@
- mlx5_os_stats_init(dev);
-+ counters = mlx5_malloc(MLX5_MEM_SYS, sizeof(*counters) *
-+ xstats_ctrl->mlx5_stats_n, 0,
-+ SOCKET_ID_ANY);
+ mlx5_stats_init(dev);
++ counters = malloc(sizeof(*counters) * xstats_ctrl->mlx5_stats_n);
@@ -63 +54 @@
- ret = mlx5_os_read_dev_counters(dev, counters);
+ ret = mlx5_read_dev_counters(dev, counters);
@@ -67 +58 @@
-+ mlx5_free(counters);
++ free(counters);
@@ -75,2 +66,2 @@
- mlx5_txpp_xstats_reset(dev);
-+ mlx5_free(counters);
+-
++ free(counters);
More information about the stable
mailing list