From: Andrew Lunn <andrew@lunn.ch>
To: James Hilliard <james.hilliard1@gmail.com>
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
Subject: Re: [PATCH net-next v2] net: phy: acx00: report receive statistics
Date: Tue, 3 Nov 2026 02:25:26 +0100 [thread overview]
Message-ID: <1e9d3060-81f9-4d22-a72c-de3af4f8f196@lunn.ch> (raw)
In-Reply-To: <20261102-submit-acx00-phy-stats-v1-v2-1-3c8a664407c1@gmail.com>
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
prev parent reply other threads:[~2026-11-03 1:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 23:28 James Hilliard
2026-11-03 1:25 ` Andrew Lunn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1e9d3060-81f9-4d22-a72c-de3af4f8f196@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=james.hilliard1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®