All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: xiexinet@gmail.com
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, andrew+netdev@lunn.ch, shuah@kernel.org,
	kees@kernel.org, petr.wozniak@gmail.com, qingfang.deng@linux.dev,
	fmaurer@redhat.com, luka.gejak@linux.dev, bigeasy@linutronix.de,
	xiaoliang.yang_1@nxp.com, skhawaja@google.com,
	liuhangbin@gmail.com, stable@vger.kernel.org,
	sdf.kernel@gmail.com, lukma@denx.de, fmancera@suse.de,
	danishanwar@ti.com
Subject: Re: [PATCH net v10 1/4] net: hsr: keep GRO disabled on HSR/PRP ports
Date: Fri, 20 Nov 2026 02:22:00 +0000	[thread overview]
Message-ID: <179514132000.3136.2415655157145361596@kernel.org> (raw)
In-Reply-To: <20261117141922.20-2-xiexinet@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] When dev->hsr_port is set, __netdev_update_features()
  (net/core/dev.c) clears NETIF_F_GRO, and NETIF_F_GRO_HW if it is in…

--

net: hsr: keep GRO disabled on HSR/PRP ports

This patch adds an hsr_port role bit to struct net_device and sets it on
HSR/PRP slave and interlink devices. While the bit is set,
__netdev_update_features() removes NETIF_F_GRO and configurable
NETIF_F_GRO_HW from both dev->wanted_features and the computed features.
The attach is refused if software GRO is still on after the update.

> diff --git a/net/core/dev.c b/net/core/dev.c
> index 3c58db732761a..1f51a55ff2b08 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -11289,6 +11289,21 @@ int __netdev_update_features(struct net_device *dev)
>
>  	features = netdev_get_wanted_features(dev);
>
> +	/* A direct HSR/PRP port needs per-frame metadata. Drop software
> +	 * GRO and configurable GRO_HW from the request as well as from the
> +	 * features passed to ndo_fix_features(): drivers such as veth
> +	 * derive state from wanted_features and need the requested and the
> +	 * active bit to agree. Fixed-on or driver-required GRO_HW is left
> +	 * to the driver.
> +	 */
> +	if (dev->hsr_port) {
> +		netdev_features_t gro = NETIF_F_GRO |
> +					(dev->hw_features & NETIF_F_GRO_HW);
> +
> +		dev->wanted_features &= ~gro;
> +		features &= ~gro;
> +	}

[Severity: Medium]
Does clearing dev->wanted_features here make the ethtool uAPI report a
GRO request on an HSR member incorrectly?

With the legacy ioctl, ethtool_set_features() in net/ethtool/ioctl.c
stores the request, calls __netdev_update_features(), and then works out
ETHTOOL_F_WISH from dev->wanted_features:

net/ethtool/ioctl.c:ethtool_set_features() {
    ...
	dev->wanted_features |= wanted & valid;
	__netdev_update_features(dev);

	if ((dev->wanted_features ^ dev->features) & valid)
		ret |= ETHTOOL_F_WISH;
    ...
}

On a member, "ethtool -K <port> gro on" ends with GRO cleared in both
wanted_features and features. The call therefore succeeds without
ETHTOOL_F_WISH, even though GRO stays off.

include/uapi/linux/ethtool.h documents the flag as:

 *   %ETHTOOL_F_WISH - some or all changes requested were recorded but the
 *      resulting state of bits masked by .valid is not equal to .requested.

Is that contract broken in this case?

On the netlink side, ethnl_set_features() in net/ethtool/features.c
builds its reply from the local req_wanted bitmap:

	bitmap_xor(wanted_diff_mask, req_wanted, new_active,
		   NETDEV_FEATURE_COUNT);

So the SET reply says GRO is wanted but not active. A later
ETHTOOL_MSG_FEATURES_GET then reads dev->wanted_features in
features_prepare_data() and shows GRO as not wanted. Can the SET reply
and the GET that follows it disagree about the same request, and can the
ioctl and netlink interfaces disagree with each other?

The commit message describes this behaviour:

    A GRO request on a member is dropped,
    not kept pending: while GRO stays off, the legacy ETHTOOL_SFEATURES
    ioctl returns no ETHTOOL_F_WISH for it, and the netlink reply still
    shows the request as not applied.

The other core paths seem to handle this differently.
netdev_sync_upper_features() and ndo_fix_features() only mask the
computed features, so a bridge port's LRO request still returns
ETHTOOL_F_WISH. dev_disable_lro() and dev_disable_gro_hw() clear
wanted_features only once, when they are called. This new branch erases
the request on every recompute.

Could the request stay in wanted_features, with only the computed
features masked here? veth's use of wanted_features (veth_gro_requested()
reads dev->wanted_features) could then be handled separately.

>  	if (dev->netdev_ops->ndo_fix_features)
>  		features = dev->netdev_ops->ndo_fix_features(dev, features);
>

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117141922.20-1-xiexinet%40gmail.com

  reply	other threads:[~2026-11-20  2:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 14:19 [PATCH net v10 0/4] net: hsr: fix super-packet forwarding Xin Xie
2026-11-17 14:19 ` [PATCH net v10 1/4] net: hsr: keep GRO disabled on HSR/PRP ports Xin Xie
2026-11-20  2:22   ` netdev-bot+sashiko [this message]
2026-11-20 21:28     ` Xin Xie
2026-11-17 14:19 ` [PATCH net v10 2/4] net: hsr: refuse forwarding devices as " Xin Xie
2026-11-20  2:22   ` netdev-bot+sashiko
2026-11-20 21:30     ` Xin Xie
2026-11-17 14:19 ` [PATCH net v10 3/4] net: hsr: segment GSO before per-frame forwarding Xin Xie
2026-11-20  2:22   ` netdev-bot+sashiko
2026-11-20 21:32     ` Xin Xie
2026-11-17 14:19 ` [PATCH net v10 4/4] selftests: net: hsr: verify GRO policy and ordered forwarding Xin Xie
2026-11-20  2:22   ` netdev-bot+sashiko
2026-11-20 21:33     ` Xin Xie

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=179514132000.3136.2415655157145361596@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bigeasy@linutronix.de \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=fmancera@suse.de \
    --cc=fmaurer@redhat.com \
    --cc=horms@kernel.org \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=luka.gejak@linux.dev \
    --cc=lukma@denx.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petr.wozniak@gmail.com \
    --cc=qingfang.deng@linux.dev \
    --cc=sdf.kernel@gmail.com \
    --cc=shuah@kernel.org \
    --cc=skhawaja@google.com \
    --cc=stable@vger.kernel.org \
    --cc=xiaoliang.yang_1@nxp.com \
    --cc=xiexinet@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.