๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6284

Re: [PATCH net-next v17 2/2] hinic3: Add ethtool statistic ops part2

#6284
From: netdev-bot+sashiko
Date: Thu, 22 Oct 2026 03:46
95 lines
11737 bytes
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
Technical Details
Message-ID: <179264080395.3135.834074310009074435@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350367-linux-kernel-netdev=dewy.ru
References: <abc78c964dec55e440f8023db505632186d53d89.1792378301.git.gongfan1@huawei.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350367-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v17 2/2] hinic3: Add ethtool statistic ops part2
Date: Thu, 22 Oct 2026 03:46:43 +0000
Organization: Usenet Network
Message-ID: <179264080395.3135.834074310009074435@kernel.org>
References: <abc78c964dec55e440f8023db505632186d53d89.1792378301.git.gongfan1@huawei.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="121747"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ETtphmoJqoFaur189axLNvjq1g4= sha256:EBie++NYqUXu3kOsNGtImHuPK7m/uG60sveEy3LuyW4=
	sha1:ObAF1g87BqObxd138r3gdHFMG58= sha256:lvd8liT1enTziCSQak32UJjcsUs2u8Xr2/qBv9FAnco=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id EA1A3111199; Thu, 22 Oct 2026 06:47:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id wDbDVHZCZSMW;
	Thu, 22 Oct 2026 06:47:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-350367-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id B1AAF111194; Thu, 22 Oct 2026 06:47:21 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id CCBEC34D7B; Thu, 22 Oct 2026 03:46:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792640812;
	b=itIE7H2yyryekvHkg0MLEWedt5COaS4E7RTHsARffOLoZUFIkDYsA9YJUlyhwknoJMn+
	 t0wbUfRnG438Z9hzoYf3RU8R+0TEvq7s2tLeSh3dcEy018+6dB8GqLxLZNt5hgIl9O640
	 Rhi950XGYhnct5xfO50Y6WeNPWehLhcrBFYJ+k4L1Zj3llDYb3Vym1E90zwQZfluqd+B8
	 DxlOFAJoUPjnRDcx0E9OYt/UJZWXkev3xEq641heBNFAKM3PbQrOnBfBRBErb8E0P94aS
	 rKU2ieDs/ld3UHl94D4wOIEONtb1wHl8v0qT9AIh60/sLbQjDVIEFd+EGhAogS9vYsg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792640812;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=4fcTMVzHIhmN5IoyyVLlVIfM3MPNNXbJtiu5nB9jYtM=;
	b=SLvEUh01Xyyju2TwOtYuurTojDticzn0FP+IfRzJX5Ct7x5xiA/PkGd1f2mjHKo6KKci
	 YrF1DqptUoqGnSsx2pCB/2Vmd/goer7aocWAYIHWZNfK7sVjdFDwTow0qZJc2G4D1ok5H
	 EVS7OXw5h7cw3it+n+1pstDfbCACB4NCCLFzrQ9MMxfmo+zKNi06bGuk04BUjguJHsOdf
	 PoMwi/pUq2eGOzNazSMtm2bXdjvILLAn/+d/bImjx+bA5Yxo++DySac1caqLuiiuITsGM
	 a5kEzr7vcJ36U0A0e7TlyN8rDxBrS92+bah+kBDfauDy+FW8c8ofQlz8rNteAiO6g0w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ghz0bZcF;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id EDC8F606A328;
	Thu, 22 Oct 2026 03:46:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ghz0bZcF
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792640806;
	b=Vp0Hvnv8ocmFdrDvUbXZMqa8sP0IogxRHjzMDT5Lm4M8R+xDolPj9jODbZP8ioX1NTVM
	 v0+iixDbuHOra8qXfGmGQtBnKJV7VkArLQ0nluyJN3Ce6cFW87JK8z+mNjJBiVfh67D2d
	 EdOW+YK7s6bKM3+nAP8CuiiBrZM4aitNGhpD0URsKLdrLTfDEfydiQNe3NqwWk7P2zRpJ
	 l2rVtnPgyuyje0A9jj+EWouB7Ptkn+DQPy9Y/yg76kk/KPQT672sNHZCkfJSMDhc3+AXO
	 d2rd4il5E2VLgMtRyM/05XXOqqaqzKU3C5oCw/+jWnHF984ZrjjZ0ZlkcgqHgVbKykg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792640806;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=4fcTMVzHIhmN5IoyyVLlVIfM3MPNNXbJtiu5nB9jYtM=;
	b=XEkxw1lIcry9NiTsGtCTwxNHqf5vmsul2Hgj1828mXByMn1WlNMl5T3vE/pExAuau5fb
	 PFVIHijfGPvv+MXXQRP3ZbfwJAmLSGZMotZI52WX0BmB2WUXBf7UwsdilsqhDlVFEtESi
	 7uTu9eu/CHM6ZG3X36s2AH+QGOiWaOp+Dhi1zKgcaMxBBmOSatzBJDCN+B9tfNADWL61o
	 OnW//q7L8x3ObOWQeOm09IDFe/flEjxoUcNTJeZQXN1omPIxjHX4Ndv0/wlpvHHa3L5Pb
	 q4bCCbCCXUd2BevkyjV2RILCPiBZQWtLXiZpN7KI01AjupvYf3HDyA4MmXVfhJoMP5Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ghz0bZcF;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7FB0606A332;
	Thu, 22 Oct 2026 03:46:45 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D3601F000C1;
	Thu, 22 Oct 2026 03:46:44 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792640805;
	bh=4fcTMVzHIhmN5IoyyVLlVIfM3MPNNXbJtiu5nB9jYtM=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=ghz0bZcFO2ICLR9nS07ZUgDU767zCaPKEsyCKqsacmuuH8982hXAxsATTzSaaW0ZN
	 JTw7DZP834wt0E4BgbJr4MP1UZ7tpbfuhHw0h1FhHdBt9HAiQepHpzmA5OX5TKVf9f
	 v27UtsWzvdJTfAEyEglRy40Aabu/0KU5Wgafn3CVNEc3D1TZV3kRILqZ7MeZS/D7UW
	 0GUyCCR6dQArj7wv0HB9vs4JUW38vt7wNKrZpFpPKDUcJ1WO5g7jY6ustHCwrgK8OB
	 oV3XE93uK8DpGpj4L6o4s2iQHscSob73JCNciJv3ixdmHVIr+UOkdi7+fjGUyG0MX8
	 WS2a8fZjKmtUA==
X-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
X-In-Reply-To:  <abc78c964dec55e440f8023db505632186d53d89.1792378301.git.gongfan1@huawei.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list