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

From: Andrew Lunn

Date: Mon Nov 16 2026 - 08:15:00 EST


> > 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