All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: liuhangbin@gmail.com
Cc: Simon Horman <horms@kernel.org>,
	jv@jvosburgh.net, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, davem@davemloft.net, sd@queasysnail.net,
	andrew+netdev@lunn.ch, pabeni@redhat.com,
	sridhar.samudrala@intel.com, jiri@resnulli.us,
	bridge@lists.linux.dev, edumazet@google.com, kuba@kernel.org,
	razor@blackwall.org, idosch@nvidia.com
Subject: Re: [net-next,v2,1/4] net: use ndo_set_features to set offload features for bonding/bridge/team
Date: Sun, 15 Mar 2026 16:19:43 +0000	[thread overview]
Message-ID: <20260315161943.1419237-1-horms@kernel.org> (raw)
In-Reply-To: <20260313-offload_compute-v2-1-ffbc8ce5d50c@gmail.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: use ndo_set_features to set offload features for bonding/bridge/team

This commit converts bonding, bridge, and team drivers to use the
ndo_set_features callback instead of manually calling
netdev_compute_master_upper_features() during port add/remove operations.

> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 90b71bd53040..2c84d3ce3b04 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c

[ ... ]

> @@ -5953,6 +5957,7 @@ static const struct net_device_ops bond_netdev_ops = {
>  	.ndo_add_slave		= bond_enslave,
>  	.ndo_del_slave		= bond_release,
>  	.ndo_fix_features	= bond_fix_features,
> +	.ndo_set_features	= bond_set_features,
>  	.ndo_features_check	= passthru_features_check,
>  	.ndo_get_xmit_slave	= bond_xmit_get_slave,
>  	.ndo_sk_get_lower_dev	= bond_sk_get_lower_dev,

[ ... ]

> diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
> index b7282f5c9632..4906ea3717b1 100644
> --- a/drivers/net/team/team_core.c
> +++ b/drivers/net/team/team_core.c

[ ... ]

> @@ -2007,6 +2010,7 @@ static const struct net_device_ops team_netdev_ops = {
>  	.ndo_add_slave		= team_add_slave,
>  	.ndo_del_slave		= team_del_slave,
>  	.ndo_fix_features	= team_fix_features,
> +	.ndo_set_features	= team_set_features,
>  	.ndo_change_carrier     = team_change_carrier,
>  	.ndo_features_check	= passthru_features_check,
>  };

[ ... ]

> diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
> index f7502e62dd35..f82082050e36 100644
> --- a/net/bridge/br_device.c
> +++ b/net/bridge/br_device.c

[ ... ]

> @@ -456,6 +462,7 @@ static const struct net_device_ops br_netdev_ops = {
>  	.ndo_add_slave		 = br_add_slave,
>  	.ndo_del_slave		 = br_del_slave,
>  	.ndo_fix_features        = br_fix_features,
> +	.ndo_set_features        = br_set_features,
>  	.ndo_fdb_add		 = br_fdb_add,
>  	.ndo_fdb_del		 = br_fdb_delete,
>  	.ndo_fdb_del_bulk	 = br_fdb_delete_bulk,

[ ... ]

> diff --git a/net/core/dev.c b/net/core/dev.c
> index f48dc299e4b2..16b3fc620807 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -8920,6 +8920,9 @@ static int __netdev_upper_dev_link(struct net_device *dev,
>  	__netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level,
>  				    priv);
>
> +	/* re-compute all features after adding link */
> +	netdev_change_features(upper_dev);
> +
>  	return 0;
>
>  rollback:

Can the feature computation skip updating ancillary fields when features
don't change?

The new architecture routes computation through netdev_change_features() ->
__netdev_update_features() -> ndo_set_features(). However,
__netdev_update_features() has this check:

net/core/dev.c:__netdev_update_features() {
    ...
    if (dev->features == features)
        goto sync_lower;

This skips the ndo_set_features callback entirely when computed features
match current features. This means netdev_compute_master_upper_features() is
never called when dev->features doesn't change, even though it updates
several ancillary fields independent of dev->features:

- vlan_features
- hw_enc_features
- mpls_features
- gso_partial_features
- tso_max_size
- tso_max_segs
- hard_header_len
- needed_headroom
- needed_tailroom

For example, adding a second bond slave with identical dev->features but
different tso_max_size or vlan_features will not trigger ndo_set_features,
leaving the bond's ancillary fields stale.

In the old code, netdev_compute_master_upper_features() was called
unconditionally and always updated these fields regardless of whether
dev->features changed.

> @@ -9012,6 +9015,9 @@ static void __netdev_upper_dev_unlink(struct net_device *dev,
>  	__netdev_update_lower_level(upper_dev, priv);
>  	__netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level,
>  				    priv);
> +
> +	/* re-compute all features after removing link */
> +	netdev_change_features(upper_dev);
>  }

The same issue applies here. When a port is removed but dev->features
doesn't change, the ancillary fields won't be recomputed.

> @@ -12874,8 +12880,6 @@ void netdev_compute_master_upper_features(struct net_device *dev, bool update_he
>
>  	netif_set_tso_max_segs(dev, tso_max_segs);
>  	netif_set_tso_max_size(dev, tso_max_size);
> -
> -	netdev_change_features(dev);
>  }
>  EXPORT_SYMBOL(netdev_compute_master_upper_features);

  reply	other threads:[~2026-03-15 16:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13  3:03 [PATCH net-next v2 0/4] net: move netdev_compute_master_upper_features to ndo_set_features Hangbin Liu
2026-03-13  3:03 ` [PATCH net-next v2 1/4] net: use ndo_set_features to set offload features for bonding/bridge/team Hangbin Liu
2026-03-15 16:19   ` Simon Horman [this message]
2026-03-16  1:02     ` [net-next,v2,1/4] " Hangbin Liu
2026-03-13  3:03 ` [PATCH net-next v2 2/4] macsec: move netdev_upper_dev_link() after macsec_changelink_common() Hangbin Liu
2026-03-13  3:03 ` [PATCH net-next v2 3/4] failover: use ndo_set_features for failover offload compute Hangbin Liu
2026-03-13  3:03 ` [PATCH net-next v2 4/4] net: no need to disable LRO specifically Hangbin Liu

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=20260315161943.1419237-1-horms@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bridge@lists.linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=jiri@resnulli.us \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=sd@queasysnail.net \
    --cc=sridhar.samudrala@intel.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.