[dpdk-stable] patch 'net/mlx5: cleanup allocation of ethtool stats' has been queued to LTS release 17.11.1
Yuanhan Liu
yliu at fridaylinux.org
Wed Jan 24 16:31:37 CET 2018
Hi,
FYI, your patch has been queued to LTS release 17.11.1
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 01/26/18. So please
shout if anyone has objections.
Thanks.
--yliu
---
>From c6a459eb512872e357fb3ad82f4e02b06d75a6c5 Mon Sep 17 00:00:00 2001
From: Thierry Herbelot <thierry.herbelot at 6wind.com>
Date: Fri, 17 Nov 2017 14:51:34 +0100
Subject: [PATCH] net/mlx5: cleanup allocation of ethtool stats
[ upstream commit 25b73ba6f3ea0894bf3cfc64e999f71a7e4f6787 ]
Simplify the computation for the needed size:
- exact size for the structure header,
- exact size for a number of 64-bit counters.
Fixes: a4193ae3bc4f ("net/mlx5: support extended statistics")
Signed-off-by: Thierry Herbelot <thierry.herbelot at 6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
---
drivers/net/mlx5/mlx5_stats.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 5e225d3..2427585 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -143,11 +143,9 @@ priv_read_dev_counters(struct priv *priv, uint64_t *stats)
struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
unsigned int i;
struct ifreq ifr;
- unsigned int stats_sz = (xstats_ctrl->stats_n * sizeof(uint64_t)) +
- sizeof(struct ethtool_stats);
- struct ethtool_stats et_stats[(stats_sz + (
- sizeof(struct ethtool_stats) - 1)) /
- sizeof(struct ethtool_stats)];
+ unsigned int stats_sz = xstats_ctrl->stats_n * sizeof(uint64_t);
+ unsigned char et_stat_buf[sizeof(struct ethtool_stats) + stats_sz];
+ struct ethtool_stats *et_stats = (struct ethtool_stats *)et_stat_buf;
et_stats->cmd = ETHTOOL_GSTATS;
et_stats->n_stats = xstats_ctrl->stats_n;
--
2.7.4
More information about the stable
mailing list