mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: gongfan1@huawei.com
Cc: wudi234@huawei.com, tengpeisen@huawei.com,
	netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	andrew+netdev@lunn.ch, ioana.ciornei@nxp.com,
	maxime.chevallier@bootlin.com, mohsin.bashr@gmail.com,
	dimitri.daskalakis1@gmail.com, hramamurthy@google.com,
	larysa.zaremba@intel.com, vadim.fedorenko@linux.dev,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	zhoushuai28@huawei.com, wulike1@huawei.com
Subject: Re: [PATCH net-next v17 2/2] hinic3: Add ethtool statistic ops part2
Date: Thu, 22 Oct 2026 03:46:43 +0000	[thread overview]
Message-ID: <179264080395.3135.834074310009074435@kernel.org> (raw)
In-Reply-To: <abc78c964dec55e440f8023db505632186d53d89.1792378301.git.gongfan1@huawei.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] hinic3_get_pause_stats() can never be called.

--

hinic3: Add ethtool statistic ops part2

This commit adds five standard ethtool statistics callbacks to the hinic3
driver: get_eth_phy_stats, get_eth_mac_stats, get_eth_ctrl_stats,
get_rmon_stats and get_pause_stats. Each callback reads the physical port
counters from firmware and copies them into the standard ethtool
structures.

> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c
> index 64c862052f1e8..2ae4d5afe90df 100644
> --- a/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c
> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_ethtool.c

[ ... ]

> +static void hinic3_get_pause_stats(struct net_device *netdev,
> +				   struct ethtool_pause_stats *pause_stats)
> +{

[ ... ]

> +	pause_stats->tx_pause_frames = le64_to_cpu(ps->mac_tx_pause_pkts);
> +	pause_stats->rx_pause_frames = le64_to_cpu(ps->mac_rx_pause_pkts);
> +
> +	kfree(ps);
> +}

[ ... ]

> @@ -707,6 +904,11 @@ static const struct ethtool_ops hinic3_ethtool_ops = {
>  	.get_strings                    = hinic3_get_strings,
>  	.get_sset_count                 = hinic3_get_sset_count,
>  	.get_ethtool_stats              = hinic3_get_ethtool_stats,
> +	.get_eth_phy_stats              = hinic3_get_eth_phy_stats,
> +	.get_eth_mac_stats              = hinic3_get_eth_mac_stats,
> +	.get_eth_ctrl_stats             = hinic3_get_eth_ctrl_stats,
> +	.get_rmon_stats                 = hinic3_get_rmon_stats,
> +	.get_pause_stats                = hinic3_get_pause_stats,

[Severity: Medium]
Can hinic3_get_pause_stats() actually be reached by the ethtool core?

hinic3_ethtool_ops sets .get_pause_stats but has no .get_pauseparam, and
nothing under drivers/net/ethernet/huawei/hinic3/ implements one. The
generic caller of get_pause_stats, pause_prepare_data() in
net/ethtool/pause.c, bails out before it gets to the stats callback:

net/ethtool/pause.c:pause_prepare_data() {
    ...
	if (!dev->ethtool_ops->get_pauseparam)
		return -EOPNOTSUPP;
    ...
	dev->ethtool_ops->get_pauseparam(dev, &data->pauseparam);
	if (req_base->flags & ETHTOOL_FLAG_STATS &&
	    dev->ethtool_ops->get_pause_stats)
		dev->ethtool_ops->get_pause_stats(dev, &data->pausestat);
    ...
}

The only other user, ethtool_aggregate_pause_stats(), is a helper that
MAC-merge-capable drivers call themselves, and hinic3 doesn't call it.
Pause stats also aren't one of the ETHTOOL_MSG_STATS_GET groups.

So "ethtool -I -a <dev>" would fail with -EOPNOTSUPP. That means
mac_tx_pause_pkts and mac_rx_pause_pkts never reach userspace, even though
the commit message lists get_pause_stats as one of the five added
callbacks.

The driver already has hinic3_get_pause_info() in hinic3_nic_cfg.c, which
hinic3_ethtool.c already calls elsewhere. Could that be used to add a
get_pauseparam implementation? Otherwise, could get_pause_stats wait until
one exists?

>  };
>  
>  void hinic3_set_ethtool_ops(struct net_device *netdev)

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1792378301.git.gongfan1%40huawei.com

      reply	other threads:[~2026-10-22  3:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  3:45 [PATCH net-next v17 0/2] net: hinic3: Support ethtool ops Fan Gong
2026-10-19  3:45 ` [PATCH net-next v17 1/2] hinic3: Add ethtool statistic ops part1 Fan Gong
2026-10-21  0:51   ` Jakub Kicinski
2026-10-21  8:21     ` Fan Gong
2026-10-21 23:54       ` Jakub Kicinski
2026-10-22  3:46   ` netdev-bot+sashiko
2026-10-19  3:45 ` [PATCH net-next v17 2/2] hinic3: Add ethtool statistic ops part2 Fan Gong
2026-10-22  3:46   ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179264080395.3135.834074310009074435@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dimitri.daskalakis1@gmail.com \
    --cc=edumazet@google.com \
    --cc=gongfan1@huawei.com \
    --cc=horms@kernel.org \
    --cc=hramamurthy@google.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=kuba@kernel.org \
    --cc=larysa.zaremba@intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tengpeisen@huawei.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=wudi234@huawei.com \
    --cc=wulike1@huawei.com \
    --cc=zhoushuai28@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®