Article View: linux.kernel.netdev
Article #14053Re: [PATCH net-next v3 1/3] ethtool: add PHY receive frame and byte totals
From: Andrew Lunn
Date: Tue, 10 Nov 2026 16:42
Date: Tue, 10 Nov 2026 16:42
71 lines
12269 bytes
12269 bytes
On Mon, Nov 09, 2026 at 07:48:32PM -0700, James Hilliard wrote:
> The generic PHY receive packet and byte counters describe successfully
> received traffic. Some PHYs instead count all received frames and bytes,
> including frames with errors. A frame error count cannot recover the
> number of successfully received bytes because damaged frames have
> different lengths.
>
> Add optional receive-total counters to ethtool_phy_stats and the phydev
> statistics group. Count frame bytes including the Ethernet header, padding
> and FCS, and excluding the preamble and start frame delimiter. These
> counters describe reception at the PHY, before MAC or host filtering.
>
> Append the new attributes so existing statistic IDs and their meanings
> remain unchanged. Publish the names through the existing statistics string
> set, and retain the unset-counter convention so drivers can report either
> set of counters independently.
>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
> Documentation/networking/ethtool-netlink.rst | 16 +++++++++++++++-
> include/linux/ethtool.h | 6 ++++++
> include/uapi/linux/ethtool_netlink.h | 2 ++
> net/ethtool/stats.c | 8 +++++++-
> 4 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst
> index eba226c79ec3..5528d0f7afdd 100644
> --- a/Documentation/networking/ethtool-netlink.rst
> +++ b/Documentation/networking/ethtool-netlink.rst
> @@ -1665,7 +1665,7 @@ the ``ETHTOOL_A_STATS_GROUPS`` bitset. Currently defined values are:
> ETHTOOL_STATS_ETH_PHY eth-phy Basic IEEE 802.3 PHY statistics (30.3.2.1.*)
> ETHTOOL_STATS_ETH_CTRL eth-ctrl Basic IEEE 802.3 MAC Ctrl statistics (30.3.3.*)
> ETHTOOL_STATS_RMON rmon RMON (RFC 2819) statistics
> - ETHTOOL_STATS_PHY phy Additional PHY statistics, not defined by IEEE
> + ETHTOOL_STATS_PHY phydev Additional PHY statistics, not defined by IEEE
> ====================== ======== ===============================================
>
> Each group should have a corresponding ``ETHTOOL_A_STATS_GRP`` in the reply.
> @@ -1683,6 +1683,20 @@ by ``ETHTOOL_A_STATS_GRP_SS_ID``. Complex statistics (such as RMON histogram
> entries) are also listed inside ``ETHTOOL_A_STATS_GRP`` and do not have
> a string defined in the string set.
>
> +The ``phydev`` group provides separate counters for successfully received
> +traffic and total received traffic.
You need to be careful with naming here. This is a
kAPI. phydev/phylib/phylink are implementation details, a set of
helpers which some MAC drivers use to implement PHYs. But MAC driver
can implement PHYs in different ways, and don't need to use a phydev.
``ETHTOOL_A_STATS_PHY_RX_PKTS``
> +(``RxFrames``) and ``ETHTOOL_A_STATS_PHY_RX_BYTES`` (``RxOctets``) count
> +successfully received frames and bytes. ``ETHTOOL_A_STATS_PHY_RX_PKTS_TOTAL``
> +(``RxFramesTotal``) and ``ETHTOOL_A_STATS_PHY_RX_BYTES_TOTAL`` (``RxOctetsTotal``)
> +include frames with errors. The total byte count includes the Ethernet header,
> +padding and FCS, but excludes the preamble and start frame delimiter.
And what would you call it when the counter does include the preamble
and start frame delimiter?
Take a step back. Just because this PHY has these counters, do we need
to support them? And what happens when the next PHY comes along with
slightly different counters? Do we add them as well?
It is vendor SDK syndrome. The hardware can do this, so lets expose
it.
What is your use case here which justifies these specific counters.
Andrew
Technical Details
Message-ID:
<348f19e7-120e-4b41-adab-be016c7a6083@lunn.ch>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360434-linux-kernel-netdev=dewy.ruReferences:
<20261109-submit-acx00-phy-stats-v1-v3-0-fbc6327c5be4@gmail.com> <20261109-submit-acx00-phy-stats-v1-v3-1-fbc6327c5be4@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360434-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v3 1/3] ethtool: add PHY receive frame and byte totals Date: Tue, 10 Nov 2026 17:42:33 +0100 Organization: Usenet Network Message-ID: <348f19e7-120e-4b41-adab-be016c7a6083@lunn.ch> References: <20261109-submit-acx00-phy-stats-v1-v3-0-fbc6327c5be4@gmail.com> <20261109-submit-acx00-phy-stats-v1-v3-1-fbc6327c5be4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="656938"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ukxkOSQE4UZZE/SIna4HB51DpuQ= sha256:TFWugfBwcMjyyBZznjuV0ZHdNCCPU8Ye6Kqwm1ghGio= sha1:hH6aPsTCH2GySr3L5c2+9Oq3Gf4= sha256:C8QA4rgaQyGf1MBG0Jld4/jr9EW8sRSJr0yHYZauAAo= Content-Disposition: inline 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 AE5ED113C72; Tue, 10 Nov 2026 20:11:22 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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 (1024-bit key) header.d=lunn.ch 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 APhj65RSFjmj; Tue, 10 Nov 2026 20:11:19 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-360434-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 682D6113C6F; Tue, 10 Nov 2026 20:11:11 +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 2486F208635; Tue, 10 Nov 2026 16:43:12 +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=1794328972; b=LsVOpzop9ebVDPsI7loC+IMU0zQMFgN2EBXPGfOBrYCzlz50kjvncj4EnkUvcWbFuiBW xPB9j3O7bErbivyAnfXU7qrCUBbyv+BP6a/5/xWgtFJUk+tntiuHvFY/0UYHoEVVdGYgg VXgOnXritFSPoyumPcD2kqtRq6LZrcT6BBk3L5ZXhi9K3iU66uvLA/bQkQKbOlgXTmaJH JA48SUMZJ/5gRFBJ83JJEkaucuzmMOBbuPH9U4p6JGKfX24kDKKr8YE5LllHCj6b15VVL 921ipfNpQjdxyt19Iza4/qTx10HLAIazTIC2STd2CWgPf9AwvaSpYs6xV1gZoYj74eg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794328972; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=bp69TPRSxmVUxIsWkPtU2k8L0z3qUF36utw3VQSvJ5E=; b=MuJInwUU+NbXT6XbPbOdCmkJTDXuUBdSozl+WICStNEub6l3CRMZCX3si1OShp0LmHkF 9xl2X8Nt+n3ahHfkw1YTv7eoUoso8jeDE3uI2+c6UHN+NgBLCRe6gnIQNfLNhBwa6Nbi5 lOZPTuup+mss5QJSGxiN8sLjgF6k+jrx42IusWuAX63QcObCKlF+Dx7OKm7b1egp2F0Bz L9HtivH1qDpp/aGFLs4gRq5lKDKaArnd9itBvj2vM9eqAG15uWRm+EvT3OiLINPS3eGBG hsfbPh/JAhTcrMyT7U5C21Rdes4rS5Zfylc7+4Pe+S20EjZcYAcMif3rTSTS+K5VSRw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=C8pkaIt2; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; 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 46E0B606A208; Tue, 10 Nov 2026 16:42:52 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=C8pkaIt2 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794328966; b=WbyGyS8Wn4KDTv0TIMj0rsYPDdfvvN0We1E5TVaDwA41lI2lCyudA5zem/JwAnDC8MBD C5rML9xr5huwNcER/NP9v8YIMyypT6MwDWGGEv7cusb++EwqyqnmNJNAEUa9aiwHazeX0 5mcpqF5xOfLePK8hZSnbFlo8M2D4RxULZbPjoUlYXRB3njSG4SKk0CagrPD3HfedA6tNO s8QJqyIx33KFMwFBXhRhy4/k7c0NZdb9+QIg8rgt8sbKMDR1j2DlyLkH9Dp/lCCwi8EpF R0ppiO+WU5OoeBLKBgSRj7Fn48URxtMDQMiBQWXXkGblnyIOovtkkU/gCXunhder7bw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794328966; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=bp69TPRSxmVUxIsWkPtU2k8L0z3qUF36utw3VQSvJ5E=; b=MzG11RzpZuR3iLszfGINCXVDXGiMgBfnJ1uxnNswuxLqge4BJlNW3+uCLDiXxzh+AMzr I2zC+Jzk2ky7qSbwd2J93SLX+Q/x/bNHcmT4Kyi2zrpDidvh0cdLg1Z7argcGuDViPqEN j3TVH0p/V/H8mkFALxBb+4/RTlIx1DK0lkelHjxRkcSXb2Q5ESav/yZlZJkGOjBpPSHQa AKM66e22ijaLMKGOU6HLbGHIw4qEt1G00v/H+vNBL7JioKMbSsCw5HWpuNHx8+RgxFqJL Ziy+ZMdtJz9/DmYiWIsiKaBaiw0yoN5BB2KOLF6/0X+icmhsEzz5051YkC85d+EV58A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=C8pkaIt2; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A0C7606A236; Tue, 10 Nov 2026 16:42:45 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0A0C7606A236 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=bp69TPRSxmVUxIsWkPtU2k8L0z3qUF36utw3VQSvJ5E=; b=C8pkaIt2kjYJ8mK+4vELN482bW RYHAoB7wnGI1eEbq6lTaLl8z+eylhw9AYvrxOdMvHvgMDwJYr1QF0CFLtsLVf7q5qLGs94W8h8myS RH8Mtli9SPynf8ybpt0oa/M2yu2+oah+Iy2t5YLcR3h3Axdh+PKq5LnnERwo4DB0szVI=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xQovZ-00FX6P-8l; Tue, 10 Nov 2026 17:42:33 +0100 X-Cc: Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>, Shuah Khan <skhan@linuxfoundation.org>, Randy Dunlap <rdunlap@infradead.org>, Oleksij Rempel <o.rempel@pengutronix.de>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org 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 X-In-Reply-To: <20261109-submit-acx00-phy-stats-v1-v3-1-fbc6327c5be4@gmail.com>