🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16940

Re: [PATCH net-next v5 2/3] ethtool: add a PHY receive byte total

#16940
From: James Hilliard
Date: Mon, 16 Nov 2026 04:12
57 lines
14940 bytes
On Sun, Nov 15, 2026 at 8:25 AM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Sun, Nov 15, 2026 at 12:45:46AM -0700, James Hilliard wrote:
>
> > The generic PHY receive-byte counter describes successfully received
> > traffic. Some PHYs instead count bytes in all received frames,
> > including frames with errors.

That restriction comes from the current kernel-doc definition of
ethtool_phy_stats.rx_bytes: "Total successfully received bytes".
It was the reason for introducing a separate inclusive byte counter.

I checked the PHY statistics callbacks in net-next and couldn't find
any driver populating rx_bytes. The original series [0] introduced
the byte fields, but its initial drivers only populated packet and
error counters.

>
> In the general case, that is wrong. A PHY basically does digital to
> analogue conversion. It takes a stream of bit from the MAC and
> converts them to analogue signals on the media. In the opposite
> direction, it recovers the analogue signals, converts it to digital,
> and passes it to the MAC.
>
> Thinks about SGMII. When running to 10Mbps, the MAC has to duplicate
> the bits 100 times. At 100Mbps, it duplicates the bits 10 times. The
> PHY then puts the bits onto the wire, it has no need to understand the
> duplication, the boundary between the MAC level bits, it is just a
> dumb DAC/ADC.
>
> In order to see frames, not a stream of bits, you need a MAC.
>
> Now, some PHYs do in fact have MACs. Those that implement PTP for
> example need to reassemble the bit stream into frames. Anything which
> does MACSEC. Or rate adaptation.
>
> But in the general case, its just a stream of bits. And the byte
> counters should be for the general case. And for SGMII, the definition
> is a bit more fuzzy, does it include the repetition or not?

Should we instead clarify the existing rx_bytes definition to include
errored traffic and use it for ACx00, dropping rx_bytes_total? That
would leave the existing packet counters unchanged.

For ACx00, the byte counter includes FCS and bytes from CRC-bad
frames. We also tested at 10 and 100 Mb/s over RMII: the byte counts
showed no tenfold inflation at 10 Mb/s despite its repeated interface
cycles.

[0] https://lore.kernel.org/r/20250110060517.711683-1-o.rempel@pengutronix.de/

>
> If the PHY has a MAC, it can additionally fill in the frame counters.
>
>        Andrew
Technical Details
Message-ID: <CADvTj4qh8Pvss+xEwcjshodwv-yN6haP-9aaeRXg1ydSu5ibVg@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364050-linux-kernel-netdev=dewy.ru
References: <20261115-submit-acx00-phy-stats-v1-v5-0-ed81a7f54373@gmail.com> <20261115-submit-acx00-phy-stats-v1-v5-2-ed81a7f54373@gmail.com> <37e4b9b8-d381-448f-a2b3-b92d7bd9033d@lunn.ch>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364050-linux-kernel-netdev=dewy.ru
From: james.hilliard1@gmail.com (James Hilliard)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 2/3] ethtool: add a PHY receive byte total
Date: Sun, 15 Nov 2026 21:12:35 -0700
Organization: Usenet Network
Message-ID: <CADvTj4qh8Pvss+xEwcjshodwv-yN6haP-9aaeRXg1ydSu5ibVg@mail.gmail.com>
References: <20261115-submit-acx00-phy-stats-v1-v5-0-ed81a7f54373@gmail.com>
 <20261115-submit-acx00-phy-stats-v1-v5-2-ed81a7f54373@gmail.com> <37e4b9b8-d381-448f-a2b3-b92d7bd9033d@lunn.ch>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1976808"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Wzwgeoyk1dgYcN4t3iY8uZR8BFs= sha256:7eqsv9BCZIj4GfXSnJY5HG0FAP1byHG6rs4hws/ZZz0=
	sha1:O988+NWM3nGCarJrVL7PdJaaVY4= sha256:u4XuEUsEzpJjXKHwhuVG62ZJUN07Qc66OOx3ddM5FlU=
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 589C2114B20; Mon, 16 Nov 2026 07:13:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, 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] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
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 vBugVX5A8wEP;
	Mon, 16 Nov 2026 07:13:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364050-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 6E9D81149D9; Mon, 16 Nov 2026 07:13:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7C79029685; Mon, 16 Nov 2026 04:12:50 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794802369;
	b=NdC74IQMYu7IZIINFvCZWbrXz58h2BV6juBAIDfU8wnNHQmgkIV2HXtO5Uc5e+MKxNC0
	 TwhMOKjQjxmFYKCF9J92jdxPrlT09Lmb2M84npL8hilo6IuyZy3PR945GQpTdxUNXKyuB
	 Gey1jthlODP54IUDAfSqfSHvSlSyeLE9dGPVZpWkAPeY8xaWukfqXmcou+60Zg5P1gFCE
	 NV5BAVVB7X2MWwYEAOV/8LbeIDZypUq/kHU7iXtm/Pa+ko2JnaHRTEg8FIQ+nx5+6XNWq
	 EPM2o5eHkFsj1iIFii7Ec7XUFaX1SCdBrckkvD2VqD3dc4A7odq0uzmDXFj+RNeMUSg==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794802369;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 References:In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:
	 Cc:Content-Type:Content-Transfer-Encoding;
	bh=02Znqn8yz/ktSadMwkToSavZ3zbFTsFGNf4SxxWIuWc=;
	b=EF1WTnaaz4+C+1Pb65p+iURMN1rquXWuDt+gDvP1YCWeRaTdOkRBmzxHPysVGdDAH5PN
	 LkXCRboHuusGabBDlFrJjaHyl1y08/DqA1i5cqNirnAFCyP/vgfbK0KKJmuZNGKIw4WhU
	 Xsv2PAhXDFZkKTsNbtqB3qlRxhsavvl8+R+cvKYgF74TI9+krtgNBFIjgaPOat6uqEUSM
	 ma5Y9ItaQmixDHOIOGgvBD4OdVYpg3qg4rTsZdzcBu8R4Zc2bGGu70oHo6cTGfHLakIpU
	 5ngyzTqEq/I14TyGjQ63CbBaVj8wsJfFDKLAPlAcg9M5V+bk9lLhuk+QUas6YHqZ3WQ==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TXuPr6SE;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 B35A0606A331;
	Mon, 16 Nov 2026 04:12:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TXuPr6SE
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.222.42
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794802368;
	b=NepVqSN6Hmo15x94w2HrOLMWKTk9QWbDgsWf1+5yCfuu2N4hYzibKLb5z3N5fdw1Xnaw
	 k40fcZ/BUHGgrRNMcng8wAossoxy2GaXtC7AnqIDsfDTCCHK4XIhARiuL5iYsUnv9lD5p
	 AO2qrTdpVehV2Rdwd0gpRlA88vAZSIqpnpHzflWWxEe5nKSJbWGPsIep+xLaU1APl4Hx3
	 qWhcXedsVa+xiLonZU7f+rCNC2FLTXIXbRv/4LiKyG9ZgLmhz3ZSVJ04Lan6HLmroUlOk
	 MSguFUQGS2yTjsxEf+TEcZFOYOYYVy8/Tmt8KJzJfO3DyIMkKvrYYNOA3baEC7QxLtQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794802368;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 MIME-Version:References:In-Reply-To:From:Date:X-Gm-Features:
	 Message-ID:Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=02Znqn8yz/ktSadMwkToSavZ3zbFTsFGNf4SxxWIuWc=;
	b=VL59DIeOScYeNaOOLHcreH3T9EzZFMUEC0Im4iEsHesij1Gt1i8+qiKySKhjhypL0chB
	 C+M8+qFkwiG66or6+VkXK5EPKF4AiPkTdb0IYtfz+G6WknsJd8ensC46p4aOtxqKt1PM4
	 4O1MCLxbhVjPRSFItflWBewk/P2ftjo4SOtR7l7Um7dG7bWuHZE+0lQ0H/AbqpcDFOMQy
	 nQRtg0mP7WZSKYILZKTx5it5JvUd2XzPREsOKxdqTHCiH3aJ4BAaSs4s+K4trmMgmESBJ
	 DV2+H1UkxqkEZ71F1rVXGsT4CktWQZIqsfrN1oFrm5ypP3UgtusXDJB+ptpDFX7T3+w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=TXuPr6SE;
	arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.222.42
X-Received: from mail-ua1-f42.google.com (mail-ua1-f42.google.com [209.85.222.42])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8053F606A32A
	for <netdev@vger.kernel.org>; Mon, 16 Nov 2026 04:12:48 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8053F606A32A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-ua1-f42.google.com with SMTP id a1e0cc1a2514c-99bf7b97f12so2771177241.0
        for <netdev@vger.kernel.org>; Sun, 15 Nov 2026 20:12:48 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1794802367; cv=none;
        d=google.com; s=arc-20260327;
        b=cj3XyLjnL5aJE0Fqxrky8/E3iKGyl5LGLl5iGlWh35LVd9f9FUEXzvVLGLSMFAEZvK
         E5loZhGEOaRsQXhRhj3WzJelvwi6YDH7Uf6vi2Pv2aTn1mu4iXiZyyWeDjUo9XsqogUU
         R9DM0PX7QYw5fwlpUW8uQoYDlHmMfiytxRsZhM0uKXKzPLb1iqesnso2Hna0BNlmNpbe
         yPPngmLTSFIi+Z9Fy7Ylp8gkTgmv9CrX/iJofsuSEvXp+T4ubNAzA3AwXZAIhhZrK13V
         lmWAjDtEQi1g7rFslegKJNaHPHvwCJEjMTtGNWjcsrsSnCnT3mGdHoXPG2QefOvc483d
         PNuQ==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:dkim-signature;
        bh=02Znqn8yz/ktSadMwkToSavZ3zbFTsFGNf4SxxWIuWc=;
        fh=J0GeS0+jCywP2SNOYpmzvFSzvUigKMN79gNIHpASZNk=;
        b=NRhpZ9s2C6Ycoh+3SXLRrp2IYmGmNUh395P5bSYjOj7eKxmNauBZJIIRQH8ncL4RkF
         orDwQSR173FMmbDhxcjQUeZMYfydVjaAmQtVRkcLLIe0SoxmwTQQnKxOXThkGiRSE7q0
         2PgDVaQf6HIXQHsqDDpD3fBPQpJgbE1nlktGarb7vBHmP6M3snRKvwKNmEW4oIWfEogD
         +P9v9/el3gWaa66/zU9eUjFBSjd1ny/szIDFC60QagBdHTe6/UG3pULWRLLVWZGFpHVc
         AToUHjMXjV1hfQp6rN3rPIt84jdV/rfGP/RKiDPDpgiuUIH2B0eVRNZj1lsc7Aj97MiE
         tHhQ==;
        darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794802367; x=1795407167; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=02Znqn8yz/ktSadMwkToSavZ3zbFTsFGNf4SxxWIuWc=;
        b=TXuPr6SEkNx59MeEiBxkERt5f4mWr/KLQDwLa2jrvJYieaT+qwMYtqe9ZaojTHhZHG
         AJ7lHgR8xxpjk51JCJIadB37QGvLRiP0FBhk3yEvDf2lPtFkkJLF90wQu2Nb4O6kIf4n
         zZTlOkFImdMHRYpm3Uy2EfdKdMtJfA/3jteb9E4VGVwYJMWXf9j9hzcoPZu/AaDp2LFa
         0cDrWZEbL6WdhqLbjlTg/btbj0ILHRNIJZJYgX0J7h+us/HHw5W40QvqwH9YTLQRNAfF
         fTZ2SCX5ooqvF/KXBuYoINgxOHsrXPaKwcKZzhWOjTqLOZjq+6bIkxVBjdmcC8NhevmQ
         qkiA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794802367; x=1795407167;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=02Znqn8yz/ktSadMwkToSavZ3zbFTsFGNf4SxxWIuWc=;
        b=FGscerDHAv+PJ9eboiRbdYhR/WoBqSUKQOXcz3m3iimAQHvd4j8ix7vD4k4DEeZqjd
         5S3glaGQJ8FMyvk5ASDm7VxBTh46K/Gn4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PwiA7R407/bNhyG
	DlVsHJlopg9d8VI3cV0MpNxa9BTxg==
X-Received: by 2002:a05:6102:6050:b0:7bb:64cc:1362 with SMTP id
 ada2fe7eead31-7d64d727889mr1664247137.6.1794802367378; Sun, 15 Nov 2026
 20:12:47 -0800 (PST)
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: <37e4b9b8-d381-448f-a2b3-b92d7bd9033d@lunn.ch>
X-Gm-Features: Aa3M54rSYwnxbv99PItlCP4qZptsSVG-Nk2eGb_2dwgIzFKw24XwIBCbb3Igc1g
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