Article View: linux.kernel.netdev
Article #10007Re: [PATCH net-next v2] net: phy: acx00: report receive statistics
From: Andrew Lunn
Date: Tue, 03 Nov 2026 01:25
Date: Tue, 03 Nov 2026 01:25
34 lines
9966 bytes
9966 bytes
On Mon, Nov 02, 2026 at 04:28:28PM -0700, James Hilliard wrote:
> Expose receive frame and byte totals through the generic PHY statistics
> interface as rx_packets and rx_bytes, alongside CRC errors in rx_errors.
> Report the hardware totals directly: the packet and byte counters include
> errored frames as well as successfully received traffic.
>
> Collect the free-running 32-bit counters through phylib's
> update_stats callback and accumulate wrap-safe deltas in 64-bit totals.
> Read the high half on either side of the low half and retry until both
> high-half reads agree.
>
> Hardware testing confirmed that the receive-byte counter wraps at
> 4,000,000,000, while the receive-packet and CRC-error counters wrap at
> 2^32. Use the corresponding modulus for each counter so rollover does
> not inflate the software totals.
>
> Serialize collection and reporting with the package-state mutex so reads
> cannot race reset or power-off, and the totals are safe on 32-bit systems.
> Commit a sample only after all counter reads and page restoration succeed.
> The reporting callback returns cached totals without accessing MDIO.
>
> Take a best-effort final snapshot before soft reset and suspend. Invalidate
> the hardware baseline before reset or power-off, including failed power-off
> attempts, and establish a fresh baseline after configuration. Preserve the
> software totals across these transitions and retain the live baseline when
> resume reconfigures an already active PHY. A failed initial snapshot can be
> retried by the periodic collector without preventing initialization.
>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
Technical Details
Message-ID:
<1e9d3060-81f9-4d22-a72c-de3af4f8f196@lunn.ch>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355141-linux-kernel-netdev=dewy.ruReferences:
<20261102-submit-acx00-phy-stats-v1-v2-1-3c8a664407c1@gmail.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-355141-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2] net: phy: acx00: report receive statistics Date: Tue, 3 Nov 2026 02:25:26 +0100 Organization: Usenet Network Message-ID: <1e9d3060-81f9-4d22-a72c-de3af4f8f196@lunn.ch> References: <20261102-submit-acx00-phy-stats-v1-v2-1-3c8a664407c1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3072099"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:BCk0++oPg6ouNM3NSrFBn1X1ER0= sha256:FEJlPgRUP42kVyQBftoaxfZK1KEIavgyyv8EOMvcVfc= sha1:5aSX1kkLDmjQlfRd3xtEnvUdnk0= sha256:zCjVKVa0tRhRyjwkIkvoa+DnOoevVPipS8hrNT3vHJo= 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 0B9401126CB; Tue, 3 Nov 2026 04:26:07 +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 dDzE_mebYjZP; Tue, 3 Nov 2026 04:26:04 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-355141-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 6D8CB1123AC; Tue, 3 Nov 2026 04:25:56 +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 0A55E2A1F3; Tue, 3 Nov 2026 01:25:40 +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=1793669139; b=wzW6UawgFy0zJSv0BjpOlmwnO6VomIhaj8lvOA2I5GizlE147Qwdh3tTuRr/DxYFpS6l sg4sZD2z4V7Q10s8EAZ2eppo/EG0sKo4UpKFyBeZJeWeUx48jryJAUH/i0jX0hJsyYrwc Y6BDkxJrUpVojmx1FP4zgKrpifZ1zOuqzgI1+Xh4C448fw76xbhE7P5Jrq0LDq4QIAi+F F/f8kdSrAbKylnMQRGRAiEniUlLCt8R2CBVtvhClQ20GOrlY8taKBmM9orSfyuyE/HNC3 xAdfbfvvVumEdSzA+pSGsWdOxrVMRHkuV+WSPGndqkhVccTywjuwy5Xl0jzYf4Ved7A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793669139; 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=OTzg4Bp5wkAPLL8TAcLUbsA24w/kgYQwIZKdSllPUZA=; b=ob+LGjejD5wYNPiDcFvELuawVy5dUzHmELMJ1r82xpYEcdhLzWDPB1A7ZwG0Hnx6GXJj 6gYe30ZyBiZf5Ksat9ZcDkWWJItCmB1CFUA+bNiRvHUyF97R3ZJW1g4qyx2JiKEGO08lj fMpyFDf6ZkpI+low5pMXoQPQYg8eLL7Y31bqfYFa5R9xJR0seuY9PXB1bA47I8ag7YZ3A d8iS/SYhHNemsSBF1vBYHZm5IdlgHor8BzDVJWrV5nriNe/qlPR7kkiuJO0XbkVdBoRtd myIJ/lpwxmguQZ1hLR7UYiYRkZ9NSKUBlFTBODV/NTXSnY21U1PSCDc3/jYELShB3Ww== 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=sXYeMUZ3; 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 888BE606A32F; Tue, 3 Nov 2026 01:25:39 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=sXYeMUZ3 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=1793669133; b=QilvyMxTg/cRstNX7vIIWcoFBSQjKA6EEruGVJMn26vU28YVHGH+UCFbrhs/o21PU5sC EeoMsOsDQc1g4ZroNe5KSXAMZhdw/caoOZPcnDNqLV8dRAdVcCM3OAlbFGtFUULYQ80xZ zyyvhAb65L0kGoQrnT4fbJqZ1GFkkt68/uA64GQwt0SaEU9OfH8Dwvw1tzHUFTu+gzVKh ws7vBvasdl5fufcy41UUFuU5Ep9cMdE3CPqmIOzdWr1YwMSpa/mjPBURVP7QjPFH80i4j zW1QNSPM6WWGfv2ZoIbwKSQpAh8+VKyhNNe16DhwSUvUkcleyUZD1ChNd/GlK5iGYoQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793669133; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=OTzg4Bp5wkAPLL8TAcLUbsA24w/kgYQwIZKdSllPUZA=; b=lxd5ZCIQzlU4yj1XvedOrVwofuMrO7mZ1GBF9+0ABr9Jchc/NmPM20L9hB4jY2/Ea0E6 +xd4gX4+tHrq4SjcvP2xPtJJyy6GUvDr8FQqHrNIM+E6exIKD3hkpw2EC+UJcGjaDu2SP BQeMGt5KFwmLtn4Ji/1LC5ZFxsDqQjdTCOJwAeecg3FoEZD6Z1h587Gk0oN1R+PZyc7UB 31YPyPSi7WeU6ngmDx/2HpKvG2cOaWWkOptLUiZXltnn7N1U5FbIOrCDhRgFp49UlcRnO 0ynIF2wT/pj4vI6epldzCqUUpgkmUfoTOOLF57GW8LbVYOAVr5BaMvFg4rmStYW5C0g== 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=sXYeMUZ3; 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 C9EE8606A324; Tue, 3 Nov 2026 01:25:32 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C9EE8606A324 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=OTzg4Bp5wkAPLL8TAcLUbsA24w/kgYQwIZKdSllPUZA=; b=sXYeMUZ3zU61vV6VBsT/w5UwLp kt7+FBHGBw9zqTijv5/VuQQCcV2kdMCBaJPS5Cn50KaZQPqW5l/g3/jzu3zQXUGaEFKY52EWcw0e7 TLbgOGx7d+9eHoRhV4K+OLwcgzWzMhCStwuf9Ar4B6bliGiCayaeUw9wAXrTucG/DMZs=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xO3HC-00DvyF-UK; Tue, 03 Nov 2026 02:25:26 +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>, netdev@vger.kernel.org, linux-kernel@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: <20261102-submit-acx00-phy-stats-v1-v2-1-3c8a664407c1@gmail.com>