Article View: linux.kernel.netdev
Article #17164Re: [PATCH net-next v5 2/3] ethtool: add a PHY receive byte total
From: Andrew Lunn
Date: Mon, 16 Nov 2026 13:14
Date: Mon, 16 Nov 2026 13:14
47 lines
10892 bytes
10892 bytes
> > 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? Andrew
Technical Details
Message-ID:
<b84021aa-f843-4668-8172-0afcbb97c27f@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-364328-linux-kernel-netdev=dewy.ruReferences:
<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>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-364328-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) 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:14:38 +0100 Organization: Usenet Network Message-ID: <b84021aa-f843-4668-8172-0afcbb97c27f@lunn.ch> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2069888"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:8/sCW4gpclTpTzfgrc2j6iD9WA0= sha256:ZZsGDIOMwOOmaIhUaj5dz0hrApCuCKHhSUpPY+L03aA= sha1:0vq15qzlUhCu/ZnszR5qIMXLv+U= sha256:g/H44WeadQMovLELCZv7RWxN85CCbY04K2hWg1+hPaQ= 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 D7919114BD2; Mon, 16 Nov 2026 16:15:21 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 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] 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 U79ok5E6YBsQ; Mon, 16 Nov 2026 16:15:17 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364328-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 1A129114C1C; Mon, 16 Nov 2026 16:15:08 +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 62A002EF6E; Mon, 16 Nov 2026 13:15:04 +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=1794834900; b=UcjRIQhHdSxEUsrJ2AVNlR9kPg8XSp0pzqM7NsHY+inFEdmIoZC582kxDjN8cYEKTNdE g+3hxB2sunxKMJv4s6AipvlvMqwFrhfRcJmPjM0FdwbFPIwGQR526tUvDTNMpKOyp0zoW CDJjLbEPwlqcfcg1eNDabEYepVpiN3uUzVo50xcQ7bhj5tlSqt1NIPWSWmyii4Jg0RTrV SrrjoHWm/EHu3TkK+StDz4UndlPU7PghPOr0WKF5eUWL4X0XMbN+QPvBJprZdHnJ9ELkq yZJJMkWMS4ZpvG8fKklFtMkAU6f0RdYkN/r48hoEHrf8Mhu8SMIqlWjhSiq5j4b3Rfg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794834900; 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=saSSu8OJb34DRRyfzx+SMprQFdVlTOpbeYoIc7lod+g=; b=kj33LaZUFm0suycG3SrxP0t8v4DL8sJi3tmU7z65X+Yzjt3ZOsu9P/ucmAYhTBjepZjw g2+OyRRGDhZvwZS0eqVKskLUOkI88lG7pyB3bNklhLBS1iIBLwDMKeRUIOJQyhZBnrcPX kMkb0ZIMqPur9aC3cHNehzi0VczJzsDCBbhbk6Qel/Q7OupTn5roKYoUV3p8OSvv4kc/0 vscQBaN4rF6vuUvTAPOqUgsq9cpuGoKa50TCKHDIapT62WSQoAP4Hk29FRGzj4DMy/niq YPG24WEDtztMuOQ+pTmmaQ3tIGgr1xOBwkiOrG1LlA7h7Xe93ObERW286DpwlwGUkIw== 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=5SfnfT0w; 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 EC125606A893; Mon, 16 Nov 2026 13:14:59 +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=5SfnfT0w 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=1794834894; b=TxpzXCNTE1zcMHy4e+Npt3/MosCPyImRE1w5T96VvA9ZU4zVJqhFNghS0+QmI+PIStdi NgaKriqjcoVTyQdzkg9rJKEjCc08LMJ4GNcKD6cam4/hsDoKxHWKiyL6cBHQXo6qvbI/N zE7RJDwmU0HI07rZ5mOaovzgbQK2MdmHjQIH+9XwYTsqIaSvPePUCR1M+te5NbNGZ+N6F Imq5AuPk1mqLyVdvh3fEKAxhJdNbMpoDElDzYky5fnxo7vi5IWM8AIndnqd4PCRLZY8CP TbPTKr7PnUTBZSUKdJQCgLj34uONVnjNKUTp/IDThjqlg9uLz3E+ccJhECC+lXYrbpg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794834894; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=saSSu8OJb34DRRyfzx+SMprQFdVlTOpbeYoIc7lod+g=; b=UywmHcNLEEIm/TALGrUROvQDMmyRwDHZVt7bdGZYDbjVzXw9z5bWpwdhBylzblnzS9AN RxuxKR9EumEu5UAzQubuf7gNLAtmyfTGpZ4JdObWbV2n4CZjP4/+QWMO/McfeAw69wmDh 9ajINgTn0lh8ObOT+Nj7FlNrDxP2zuJ7YxSvmnbkhR5kww00crJJhkwSI2Hc2wj1Zr+ha lVH+PCAj7gL5W0vPokiYYEjZm3NrD5lWjYrJQto2HhIWVpens0WM1q/WCtBy7z7DuLhg9 3bxvSCXgf6ZfdxhT0fZhTM3ypr/T6b5HXnf3HZAPvxmOm/CCYWkvwsGuIgQXAylLmOw== 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=5SfnfT0w; 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 9F033606A330; Mon, 16 Nov 2026 13:14:53 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9F033606A330 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=saSSu8OJb34DRRyfzx+SMprQFdVlTOpbeYoIc7lod+g=; b=5SfnfT0wIk+W2UiIuxKOPa3AId p7ln8yC2lcl7g3wnoflEQwJnz+p/UTqrARj3M4+SWPwpaREJ7WGoc9kxhkW0UjTdQOAPTsuwO70MU fVB/oyTcNczdTMnSdNiuaWCGppqdmMF7rmRHMEf3Pa9ujbd7xGzlEehWj3FW2zE/cXe8=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xSwXe-00Guz6-3Q; Mon, 16 Nov 2026 14:14:38 +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: <CADvTj4opiu_vhat12BRzk61b7ymG+g12c2aoK+rcZHjpWZjL4Q@mail.gmail.com>