Re: [RFC PATCH net-next 2/3] net: use ndo_update_offloads for bonding/bridge/team

Hangbin Liu <[email protected]>
Newsgroups gmane.linux.network.bridge,gmane.linux.network,gmane.linux.kernel
Message-ID <aaFNilMyFaD9cA2u@fedora>
On Thu, Feb 26, 2026 at 11:42:07AM +0000, Hangbin Liu wrote:
> Convert bonding, bridge, and team drivers to use the new
> ndo_update_offloads callback instead of manually calling
> netdev_compute_master_upper_features() during port add/remove operations.
> 
> This change centralizes the feature computation flow:
> 
> Before:
> - netdev_compute_master_upper_features()
>   - compute offload features
>   - netdev_change_features()
>     - __netdev_update_features()
>       - update other features
> 
> After:
> - netdev_master_upper_dev_link()
>   - __netdev_upper_dev_link()
>     - netdev_change_features()
>       - __netdev_update_features()
>         - ndo_update_offloads()
>           - netdev_compute_master_upper_features()
>         - update other features
> 
> This ensures offload features are computed automatically when
> upper/lower device links change, removing the need for manual
> feature computation calls in the driver code.
> 
> The netdev_change_features() call in team_uninit() is also removed
> since it calls team_port_del() for each port, which now triggers
> feature updates automatically.
> 
> Signed-off-by: Hangbin Liu <[email protected]>
> ---
>  drivers/net/bonding/bond_main.c | 10 +++++++---
>  drivers/net/team/team_core.c    | 11 +++++++----
>  net/bridge/br_device.c          |  6 ++++++
>  net/bridge/br_if.c              |  4 ----
>  net/core/dev.c                  |  8 ++++++--
>  5 files changed, 26 insertions(+), 13 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index d05837c0713a..7043ee022980 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -8893,6 +8893,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;

Another benefit for this change is, after calling netdev_change_features() here,
the later netdev_sync_lower_features() will disable LRO automatically.
So we don't need to call dev_disable_lro() manually in
bonding/bridge/team/VLAN. I will add this patch in next version.

Hangbin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.