[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <43ff0071f0ce4b958f27427acebcf2c6ace52ba0.camel@redhat.com>
Date: Tue, 19 Jul 2022 11:26:36 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Lorenzo Bianconi <lorenzo@...nel.org>, netdev@...r.kernel.org
Cc: nbd@....name, john@...ozen.org, sean.wang@...iatek.com,
Mark-MC.Lee@...iatek.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, matthias.bgg@...il.com,
linux-mediatek@...ts.infradead.org, ilias.apalodimas@...aro.org,
lorenzo.bianconi@...hat.com, jbrouer@...hat.com
Subject: Re: [PATCH v3 net-next 5/5] net: ethernet: mtk_eth_soc: add support
for page_pool_get_stats
On Sat, 2022-07-16 at 09:34 +0200, Lorenzo Bianconi wrote:
> Introduce support for the page_pool stats API into mtk_eth_soc driver.
> Report page_pool stats through ethtool.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> ---
> drivers/net/ethernet/mediatek/Kconfig | 1 +
> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 40 +++++++++++++++++++--
> 2 files changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/mediatek/Kconfig b/drivers/net/ethernet/mediatek/Kconfig
> index d2422c7b31b0..97374fb3ee79 100644
> --- a/drivers/net/ethernet/mediatek/Kconfig
> +++ b/drivers/net/ethernet/mediatek/Kconfig
> @@ -18,6 +18,7 @@ config NET_MEDIATEK_SOC
> select PHYLINK
> select DIMLIB
> select PAGE_POOL
> + select PAGE_POOL_STATS
> help
> This driver supports the gigabit ethernet MACs in the
> MediaTek SoC family.
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index abb8bc281015..eba95a86086d 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -3517,11 +3517,19 @@ static void mtk_get_strings(struct net_device *dev, u32 stringset, u8 *data)
> int i;
>
> switch (stringset) {
> - case ETH_SS_STATS:
> + case ETH_SS_STATS: {
> + struct mtk_mac *mac = netdev_priv(dev);
> + struct mtk_eth *eth = mac->hw;
> +
> for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) {
> memcpy(data, mtk_ethtool_stats[i].str, ETH_GSTRING_LEN);
> data += ETH_GSTRING_LEN;
> }
> + if (!eth->hwlro)
I see the page_pool is enabled if and only if !hwlro, but I think it
would be more clear if you explicitly check for page_pool here (and in
a few other places below), so that if the condition to enable page_pool
someday will change, this code will still be fine.
Thanks!
Paolo
Powered by blists - more mailing lists