Re: [PATCH net-next v6 2/3] ethtool: include errored frames in PHY receive byte counts

From: Oleksij Rempel

Date: Mon Nov 16 2026 - 08:13:10 EST


On Mon, Nov 16, 2026 at 01:59:58AM -0700, James Hilliard wrote:
> Some PHYs count bytes in all received frames, including frames with
> errors. A successful-byte count cannot be derived by subtracting a frame
> error count because the lengths of damaged frames are not available
> separately.
>
> No in-tree PHY driver currently reports rx_bytes. Define this existing
> counter to include bytes in frames with errors so drivers can report
> their hardware byte count through it.

I do not think we should change rx_bytes.

Comparing PHY and MAC counters, for example to find frames lost between
PHY and MAC, only works if both count the same kind of frames.
rx_packets counts good frames only ("Total successfully received
frames"), and so do the 802.3 MAC counters aFramesReceivedOK and
aOctetsReceivedOK (30.3.1.1.5, 30.3.1.1.14). With this patch, rx_bytes
would also count bad frames, so two counters in the same group describe
different frames. A PHY without a CRC checker cannot fill either of
them. A PHY that has one, like ACx00, should keep them consistent.

A separate counter for bad frames, as in v5, does not solve this either,
because "bad frame" is not one thing. 802.3 counts symbol errors at the
PHY (30.3.2.1.5) and FCS, alignment, length and frame-too-long errors at
the MAC (30.3.1.1.6, .7, .23 to .25). A symbol error points at this
link. A frame with a bad CRC can also come from the link partner.
rx_errors already means different things: mxl-gpy reports its RXERR
counter, qcom-phy-lib and dp83tg720 report CRC errors.

Strict definitions would need a counter for each combination, "include
everything" would make the counters useless for diagnosis, and moving a
counter between fields breaks existing users. Also, few people have the
hardware to confirm what a counter really counts.

I suggest metadata for the existing counters instead, similar to how
ETHTOOL_MSG_MSE_GET reports the scale of its values next to them. Old
user space can ignore it, new user space can use it, and it lists only
what is confirmed for a PHY. Andrew should agree to this direction
first.

For this series: keep rx_bytes as it is, report rx_packets and rx_errors
as you do, and keep the byte total driver-private for now.

@Andrew?

Oleksij