Linux Documentation
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: james.hilliard1@gmail.com
Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, corbet@lwn.net,
	skhan@linuxfoundation.org, rdunlap@infradead.org,
	o.rempel@pengutronix.de, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH net-next v6 2/3] ethtool: include errored frames in PHY receive byte counts
Date: Thu, 19 Nov 2026 12:00:18 +0000	[thread overview]
Message-ID: <179508961824.3136.4655138931772662232@kernel.org> (raw)
In-Reply-To: <20261116-submit-acx00-phy-stats-v1-v6-2-8feef8e76cd5@gmail.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message says the patch defines rx_bytes in two ways:
  it includes bytes in frames with errors, and it counts reception at…
- [Low] After this patch, the counters in the ETHTOOL_STATS_PHY
  ("phydev") group no longer count the same set of frames, and nothing…

--

ethtool: include errored frames in PHY receive byte counts

This commit changes the kerneldoc for rx_bytes in struct ethtool_phy_stats
from "Total successfully received bytes" to "Total received bytes". The
commit message says the goal is to let PHY drivers report a hardware byte
count that includes frames with errors.

> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index c3a41fbd5426d..9c3f079d9573e 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -481,7 +481,7 @@ struct ethtool_eth_phy_stats {
>  /**
>   * struct ethtool_phy_stats - PHY-level statistics counters
>   * @rx_packets: Total successfully received frames
> - * @rx_bytes: Total successfully received bytes
> + * @rx_bytes: Total received bytes

[Severity: Low]
The commit message says:

    Define this existing counter to include bytes in frames with errors so
    drivers can report their hardware byte count through it. The counter
    describes reception at the PHY, independently of MAC or host filtering.

Does the new kerneldoc line say either of these things? "Total received
bytes" does not say that errored frames are included. It also says nothing
about counting before MAC or host filtering.

Nothing else in the tree documents the new meaning either. The uAPI comment
covering ETHTOOL_A_STATS_PHY_RX_BYTES in include/uapi/linux/ethtool_netlink.h
only says:

	/* Basic packet counters if PHY has separate counters from the MAC */

The group table in ethtool-netlink.rst only says "Additional PHY
statistics, not defined by IEEE".

Neither of these changes by the end of the series (after "net: phy: acx00:
report receive statistics"). The definition therefore exists only in this
commit message.

Could the line state it directly, for example "Total bytes in all frames
received by the PHY, including frames with errors"?

>   * @rx_errors: Total received frames with errors (e.g., CRC errors)
>   * @tx_packets: Total successfully transmitted frames
>   * @tx_bytes: Total successfully transmitted bytes

[Severity: Low]
After this change, @rx_packets and @tx_bytes still say "successfully", but
@rx_bytes is meant to include errored frames. Should the doc say that the
two RX counters now cover different sets of frames?

stats_put_phydev_stats() in net/ethtool/stats.c sends them to userspace
together as the RxFrames/RxOctets pair:

	if (stat_put(skb, ETHTOOL_A_STATS_PHY_RX_PKTS,
		     data->phydev_stats.rx_packets) ||
	    stat_put(skb, ETHTOOL_A_STATS_PHY_RX_BYTES,
		     data->phydev_stats.rx_bytes) ||

The first user is acx00_ephy_get_phy_stats(), added later in this series
by "net: phy: acx00: report receive statistics". It relies on this split.
It reports rx_packets without CRC-errored frames, and rx_bytes as the raw
hardware total that includes them:

	stats->rx_packets = priv->stats[ACX00_STAT_RX_PACKETS];
	stats->rx_errors = priv->stats[ACX00_STAT_RX_CRC_ERRORS];
	stats->rx_bytes = priv->stats[ACX00_STAT_RX_BYTES];

Userspace that computes RxOctets / RxFrames (average frame size) would get
inflated numbers. So would userspace that compares the RX pair with the TX
pair. Nothing in the uAPI header, ethtool-netlink.rst or the kerneldoc
explains the difference.

The commit message explains why rx_bytes has to include errored frames. It
does not say why the difference between the two RX counters is left
undocumented.

Could the doc say something like "including frames with errors (unlike
@rx_packets)"? Alternatively, the pair could stay consistent, with a
separate attribute added for bytes in all frames.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-submit-acx00-phy-stats-v1-v6-0-8feef8e76cd5%40gmail.com

  parent reply	other threads:[~2026-11-19 12:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  8:59 [PATCH net-next v6 0/3] net: phy: report ACx00 receive statistics James Hilliard
2026-11-16  8:59 ` [PATCH net-next v6 1/3] docs: networking: correct the PHY statistics group name James Hilliard
2026-11-16  8:59 ` [PATCH net-next v6 2/3] ethtool: include errored frames in PHY receive byte counts James Hilliard
2026-11-16 13:12   ` Oleksij Rempel
2026-11-16 13:23     ` Andrew Lunn
2026-11-17  2:35     ` James Hilliard
2026-11-19 12:00   ` netdev-bot+sashiko [this message]
2026-11-16  8:59 ` [PATCH net-next v6 3/3] net: phy: acx00: report receive statistics James Hilliard
2026-11-19 12:00   ` netdev-bot+sashiko

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=179508961824.3136.4655138931772662232@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /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