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

From
Andrew Lunn <andrew@lunn.ch>
Date
2026-11-15 15:25:51
Also in
linux-doc, lkml
Reply to
James Hilliard, 2026-11-15
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.
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?

If the PHY has a MAC, it can additionally fill in the frame counters.

       Andrew
Thread (17 messages) 17 messages, 4 authors, last reply 7h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help