🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17461

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

#17461
From: James Hilliard
Date: Mon, 16 Nov 2026 21:20
105 lines
16110 bytes
On Mon, Nov 16, 2026 at 11:12 AM Oleksij Rempel <o.rempel@pengutronix.de> wrote:
>
> On Mon, Nov 16, 2026 at 02:14:38PM +0100, Andrew Lunn wrote:
> > > > Think about it.
> > > >
> > > > If you don't have a MAC, you don't have FCS.
> > >
> > > There are existing mainline PHY drivers exposing this functionality.
> > > The QCA807x/QCA808x drivers use qcom_phy_counter_config() to enable
> > > CRC checking, and qcom_phy_get_stats() reports the RX CRC-error count
> > > through ethtool_phy_stats.rx_errors [0]. The IP101G driver also exposes
> > > a phy_crc_errors counter separately from phy_symbol_errors [1].
> > >
> > > This demonstrates frame-aware diagnostic functionality within these
> > > PHYs, rather than something every PHY necessarily implements.
> > >
> > > The generic byte counter need not require that functionality. My
> > > question was whether rx_bytes should count received bytes without
> > > conditioning the count on FCS validity. ACx00 could then report its
> > > hardware byte total through that field, including bytes from frames
> > > which its separate CRC checker identifies as bad.
> >
> > Read 802.3. What does an 802.3 defined PHY actually allow. That is
> > ideally what the kernel should support with these counters. Lowest
> > common denominator.
> >
> > So i would say RX bytes does not differentiate between the frames the
> > MAC will later throw away because the FCS is wrong. I would say it is
> > also O.K. to include the preamble, and the FCS, any padding up to 64
> > byte frames, etc.
> >
> > Since this counter is not actually defined by 802.3, i would also
> > allow some flexibility in its meaning. Different PHYs might have
> > slightly different meanings.
> >
> > Look at it from the other direction. What is your use case? Does the
> > exact definition actually matter? Does it matter if a different
> > vendors PHY counts it differently? Does your use case require cross
> > device compatibility?
> >
> > You have not actually said what your use case is. For new board
> > bringup, debugging broken networking, the exact definition generally
> > does not matter. The PHY RX counter is going up, the MAC is not,
> > something between the MAC and the PHY. Neither the MAC nor the PHY
> > counters are going up, something between the RJ45 and the PHY. The
> > absolute values don't matter, its that they change which matters. But
> > maybe your use case is different?
>
> I agree that for bring-up the deltas are enough.
>
> In the field the question is usually: is the board broken, or something
> outside of it? The MAC counts FCS errors both when the line is noisy and
> when the xMII corrupts frames. The PHY is the natural place to tell the
> two apart, but only if we know whether its error counter checked the
> FCS. Without that, the wrong part gets replaced.

For ACx00, rx_errors specifically reports Ethernet FCS failures, not
symbol errors. We verified that with PHY loopback and MAC FCS insertion
disabled: a software-generated valid FCS did not increment the PHY
CRC-error counter, while flipping an FCS bit did.

That establishes what this particular counter detects. It does not
distinguish corruption on the link from a peer transmitting an invalid
FCS, but comparing PHY and MAC observations could help locate where
the frame became invalid.

> I have seen a board where MAC and PHY both provided the xMII clock.
> Frames were lost only when the clocks drifted into a bad phase, so
> production tests did not catch it. A PHY that checks the FCS would show
> a clean PHY side, while the MAC counts FCS errors from time to time.
>
> So the meaning has to be known, even if it differs between PHYs. I am
> fine with that, as long as rx_packets and rx_bytes describe the same
> frames and the driver says what they include, for example which errored
> frames are counted and whether rx_errors counts CRC or symbol errors.
> That is the metadata I suggested in the v6 thread. The ACx00 byte total
> also counts frames with a bad CRC, while its rx_packets does not, so it
> does not fit rx_bytes.

In the original v1/v2 implementation, rx_packets and rx_bytes both
reported the inclusive hardware totals, including CRC-bad frames [0].
They described the same traffic, with CRC errors reported separately.

The packet count was later changed to subtract CRC errors to match
the existing "Total successfully received frames" definition. That
introduced the mismatch: the hardware does not separately count bytes
in CRC-bad frames, so the equivalent subtraction is unavailable for
rx_bytes.

Should we revisit the original approach, with both rx_packets and
rx_bytes reporting inclusive totals and rx_errors reporting CRC
failures separately?

That would keep the packet and byte counts covering the same frames,
but would also mean revisiting the documented successful-only meaning
of rx_packets, rather than changing only rx_bytes as proposed in v6.

[0] https://lore.kernel.org/r/20261102-submit-acx00-phy-stats-v1-v2-1-3c8a664407c1@gmail.com/

>
> Oleksij
Technical Details
Message-ID: <CADvTj4ocz9_rMDbDG1xOPALNw1yx9ypXp0S59sh04wSv_YMyrg@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364732-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> <CADvTj4qh8Pvss+xEwcjshodwv-yN6haP-9aaeRXg1ydSu5ibVg@mail.gmail.com> <d3f2dc1c-9daf-4b5f-903b-657ae3f32647@lunn.ch> <CADvTj4opiu_vhat12BRzk61b7ymG+g12c2aoK+rcZHjpWZjL4Q@mail.gmail.com> <b84021aa-f843-4668-8172-0afcbb97c27f@lunn.ch> <avtHbulALsI61uVr@pengutronix.de>

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-364732-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: Mon, 16 Nov 2026 14:20:50 -0700
Organization: Usenet Network
Message-ID: <CADvTj4ocz9_rMDbDG1xOPALNw1yx9ypXp0S59sh04wSv_YMyrg@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> <CADvTj4qh8Pvss+xEwcjshodwv-yN6haP-9aaeRXg1ydSu5ibVg@mail.gmail.com>
 <d3f2dc1c-9daf-4b5f-903b-657ae3f32647@lunn.ch> <CADvTj4opiu_vhat12BRzk61b7ymG+g12c2aoK+rcZHjpWZjL4Q@mail.gmail.com>
 <b84021aa-f843-4668-8172-0afcbb97c27f@lunn.ch> <avtHbulALsI61uVr@pengutronix.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="2171481"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:eDWuYC+8fDL7aBEvOBgSegjzTEs= sha256:JSfM3QI2K3om3XKOXbVUWstJi3D5I0hSpWShF87phAY=
	sha1:Pdo0AH0WuGdblt+LkTludpAlasg= sha256:ClnVGrHcu8i/9nUhUeiP9oJOFRrnKvdvMu2ySWcLCgM=
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 1654C114D7B; Tue, 17 Nov 2026 00:21:27 +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 dh17hV0QbjoM;
	Tue, 17 Nov 2026 00:21:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-364732-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id CCB68114D79; Tue, 17 Nov 2026 00:21:10 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 5C28F26D18; Mon, 16 Nov 2026 21:21:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=fail 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 5C0FF606A338;
	Mon, 16 Nov 2026 21:21:04 +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=qY1lLZWh
X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=209.85.217.48
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail;
	t=1794864063;
	b=RM9sVJlt+4ZSUGhDfVYrQHYjL+Or0fkiji3I6sT/5QzrzWjMeaVBc87H85PWB00980yv
	 Ld9MwGXzyleXAx4QQ8q3dpw7UJ2dwbOcuHA6IWSZlWif4fi5RVHxUySeREAGKxswLgYLi
	 Hic10eCF4blLGkkwZxrdX/1jfwOnfnfhA1baaaL9vLv8v8N6axXX/9HWAXZX+QKAvXZrB
	 3mDLAnIurFuR5rN1CPbBl4sEz9I+yCOO2a4Pgz2UN3Zn3V3LvbFeE51NJYoMeaKvQvSZX
	 2DBhjH4JjZ6eXK1NZu/FzD5T388yicVkiZsi+NhdKiGT3r4rHmxA8uTgc+5WRdx5hgg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794864063;
	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=1xGZrJjN0Ny2SZfb7cMMUTGUER0EysqnRYr07qyNESE=;
	b=5oI5+nw99QYyYHk/Zgow+vD5AZ5JsfW6Ih90OQyWOHkl4/jaiAONqRcYAlRy5vCEJZlU
	 0y/GUP2pRKQUkRxkSF7m4qwsu8OohjD0+/ulmpe5HT/TKQXWusJ3KUFOVTLRHyogALlmA
	 rc1ut6uhp7YUYHFdn83bOdT7383o5+ePWUXjpGDFLlsbsV8ZVHPR1MYy7MR02jgHen05q
	 wvtOhs1y83xHRkvLhFzKnZWhOM4IbIilpu2/P3X3FGBGjiP0UTw3pdSMj5ZMajbZPJdkV
	 I3BwTCvDxpum3/K5PSDiaNKZESDuM4CkfxtOzNR/J66jX6hghNylqeOAmj8jBSLgG8A==
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=qY1lLZWh;
	arc=fail smtp.remote-ip=209.85.217.48
X-Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48])
	(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 29241606A323
	for <netdev@vger.kernel.org>; Mon, 16 Nov 2026 21:21:02 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 29241606A323
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-vs1-f48.google.com with SMTP id ada2fe7eead31-7d2d95c5d81so184305137.0
        for <netdev@vger.kernel.org>; Mon, 16 Nov 2026 13:21:02 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1794864062; cv=none;
        d=google.com; s=arc-20260327;
        b=l5stZgF3PKkPLbK67gV3h2SmUil8u/GzM6OKufzwyqr/yWKJMD+wjUt+9zm9zV/p/N
         jqzW5LnRWIpaxT59RCfAHwIBWxpG4PfUOAGa5HTSeR+xHd1FwzP2KjcHMOgO2ptIYCHa
         SfbSS1nPT2gO6+QC+vSUJnWjfxZATYqmApQ00Xhaefqr6RfvXpgCPVQolLaSYZIQYxVv
         XHqanKbT81gGrcSqrN8sTGTZuXVO0bUuHa4wdVLrizL5OCA0VwqiriCypUCZHw2JgKNH
         jJTyDyHlTcRCNaK4y5unpj2SfAGIXf2rQ3eZwlx2P+B2gtOpqbSvtHMn+R5rBviNSrMS
         Xyxw==
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=1xGZrJjN0Ny2SZfb7cMMUTGUER0EysqnRYr07qyNESE=;
        fh=fi7COCzJNWkpzjV5H/oVeCc1GWzDpQ96zCrIMiuZgzI=;
        b=E5wozpql0cTIfLH04qJIzQdZP3MOskNouxhCttHyELqjlHYLdWKvVk5IXcGwfh8vgD
         cmjH6Ju8knS2pkz+WRq/8MWainxQ3wF5DKnwtreQjlbwsiwmeihK26vSyiKWhEXIIqSq
         qFBnu1GapFDHOWBaBe06zuJBM+jyme9fKyqcwrQ0EAdHDTjGTW9WED0FkS7hmJW1vh/S
         JA3AvB3rmIfnZJk1aEk8iD5O6goRnfv37yD3ced0+XP80rurfVlo3UQhQNRW3RxhExEQ
         KQuEw0T1L1clzK+46LMuscKHHQAl7yUXyHqLh4OaoiqDlh5vJNmFXChesPD+85jAjILd
         23VQ==;
        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=1794864062; x=1795468862; 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=1xGZrJjN0Ny2SZfb7cMMUTGUER0EysqnRYr07qyNESE=;
        b=qY1lLZWh4E2ksVTzSI/w/4gmWXpLiN8e9pCkUuUqbIAlJ1Isr/o8FtS1E9OVUt927h
         8lrZDLehu+xaxCMk4umpQ2y3a8L/lP48x9DxfZm4eilmqgPlTOTF1EtGi/yHOBENX+tf
         znGC75QwsAM9FJZ+T8XfLduHdCtnqqq0AgjxP6cWb5R97HibLRwLPGH8BUornoICNxaq
         aw+0w89WjRVnnLIu0jKpDD55BIpbVpqWwynaxQM89X5sh9+C0EpR1Qa8sNHPhD8uKqFF
         8BPO9HvPBovbQAAb6PaM4jm+UnDrbOrDdpepqLRQmtxRqUNc4a25u4QBb3lyBVmUg7XP
         ofmQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794864062; x=1795468862;
        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=1xGZrJjN0Ny2SZfb7cMMUTGUER0EysqnRYr07qyNESE=;
        b=BDvvfwSegN9S8BMvK9lRgGuf289toFF+7/tYfDkN4w3y1pkucXgzFad+ZYsL71jnEu
         XqXhW+CaPdlhdFkhs+v/NURPMxR96HjLDkskVUFrlT6GeAlCOIJiHeTKusJxngQKvZ6W
         bpcb9ShPIco+NeQG1+mH+Lb7/VKI+qJJzk1BuDWOogfqx4OTj3IT/02jb7Kk+1Egsziw
         xXSJyqsFCeDN2/H8vtL76AdFzVqU+XxpfHqPvqNnIGx3t4gxye/sqpWD6+1RHKZPBd9Y
         Bu3MwHiVRKBBhAUsUtJCTn7EHX1r4UxvlB65oq1HVlXjDtVme3bRIzms2nDiZ+oECZQZ
         sj4w==
X-Forwarded-Encrypted: i=1; AL+hErEX2JyXwFomXZ8Y2UOzmNSsV2PkfMy1WqRUm8dhkh/yMf+KIMyAInMjHN1xe+Idqfg5+6x756I=@vger.kernel.org
X-Gm-Message-State: APuU4Z9ZFFu6egOSBDzSDHCMjhyNTLZBzMoylciev4KVc+q0tH5DF3bv
	7qV/kLInBQ76wPH02vfwgDSvKVg1h8YUhxPueBQXdaHlKOICWwj1D6uENh595fQuGaa47l/Vknm
	iqLVzEPygdPSe1VG02vdAY3OJ5qajVWY=
X-Gm-Gg: AYBFou3wPKAZnQesc5WH2tplpDXqXb5dxEjQ+LtWckGruR3OwhnQPEht28QN3WffaRw
	cdYB7G+D7dQbweqNoc+sB4IdU5YykHkuPfhepplMJdj3pcqQcIhX0EgUpexTPqdgr2s69sc6XQT
	5H8f6D03oqRdHVezoENY/xnTrhdbddMcIKyPB03qrzeo4iUo8T9gKr4oWv543n+wmAlEvC2mh7n
	JeTzSoZGDI3vuuGDL5JRwQSj9YH91RlJLg3xlA5md4te/W3ZbprV56DLVsl4A7rh7AOR2wDpRWh
	yx8c4+E44zncY3RPn0pKMcfXu4Bnp+iISZqaQuvtTiCZHzwLRriVkS0hn/0dfI33YZmPFVrmqop
	t4Tdc0yP95d0TjYfj+9HYcdvLVJCqAKdPiDggez0YIPnOP6CpE+nXntbzOZwxlCXTOAZKAE+xre
	HEdb0a95iEOsWzJTLajOl19131fHuFfD4+aDZ05D4Prbv9r5eN5t7poyFf6GnTfVC1k1taOL2mA
	ORlPVymMbe7Rv1r8Mis1esj1T3zHA==
X-Received: by 2002:a05:6102:5cc1:b0:7c2:b741:2391 with SMTP id
 ada2fe7eead31-7d69f80fb58mr226923137.30.1794864062032; Mon, 16 Nov 2026
 13:21:02 -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: <avtHbulALsI61uVr@pengutronix.de>
X-Gm-Features: Aa3M54pcMPyc2OFOg6Y0wv-UQ8kqAdneoXXulLAwNvDypq3EhsaVTtW6oHSJWpI
X-Cc: Andrew Lunn <andrew@lunn.ch>, 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>, 
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 
	linux-doc@vger.kernel.org