[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YlA7yQ0NZi94ob/Q@lunn.ch>
Date: Fri, 8 Apr 2022 15:42:33 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Lorenzo Bianconi <lorenzo@...nel.org>
Cc: netdev@...r.kernel.org, lorenzo.bianconi@...hat.com,
davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
thomas.petazzoni@...tlin.com, ilias.apalodimas@...aro.org,
jbrouer@...hat.com, jdamato@...tly.com
Subject: Re: [PATCH v2 net-next 2/2] net: mvneta: add support for
page_pool_get_stats
> @@ -4732,9 +4732,13 @@ static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
> if (sset == ETH_SS_STATS) {
> int i;
>
> - for (i = 0; i < ARRAY_SIZE(mvneta_statistics); i++)
> - memcpy(data + i * ETH_GSTRING_LEN,
> - mvneta_statistics[i].name, ETH_GSTRING_LEN);
> + for (i = 0; i < ARRAY_SIZE(mvneta_statistics); i++) {
> + memcpy(data, mvneta_statistics[i].name,
> + ETH_GSTRING_LEN);
> + data += ETH_GSTRING_LEN;
> + }
You don't need to touch this loop, you can just do:
> +
> + page_pool_ethtool_stats_get_strings(data +
ETH_GSTRING_LEN * ARRAY_SIZE(mvneta_staticstics)));
> }
> }
>
> @@ -5392,6 +5412,14 @@ static int mvneta_probe(struct platform_device *pdev)
> pp->rxq_def = rxq_def;
> pp->indir[0] = rxq_def;
>
> + stats_len = ARRAY_SIZE(mvneta_statistics) +
> + page_pool_ethtool_stats_get_count();
> + pp->ethtool_stats = devm_kzalloc(&pdev->dev,
> + sizeof(*pp->ethtool_stats) * stats_len,
> + GFP_KERNEL);
Why do you do this? The page_pool stats are never stored in
pp->ethtool_stats.
Andrew
Powered by blists - more mailing lists