public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Jay Vosburgh <jv@jvosburgh.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Jiri Pirko <jiri@resnulli.us>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	 Ido Schimmel <idosch@nvidia.com>,
	Simon Horman <horms@kernel.org>,
	 Sabrina Dubroca <sd@queasysnail.net>,
	 Sridhar Samudrala <sridhar.samudrala@intel.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 bridge@lists.linux.dev, Hangbin Liu <liuhangbin@gmail.com>
Subject: [PATCH net-next v3 1/5] net: add ndo_update_offloads for offload computation
Date: Mon, 16 Mar 2026 12:26:09 +0800	[thread overview]
Message-ID: <20260316-offload_compute-v3-1-a5d4a07d86d3@gmail.com> (raw)
In-Reply-To: <20260316-offload_compute-v3-0-a5d4a07d86d3@gmail.com>

Add a new ndo_update_offloads callback to net_device_ops that allows
devices to compute and update their offload features during feature
updates.

This callback enables master devices to recompute their features
based on current slave device configuration. This is particularly
useful for bonding, bridging, team, and failover devices that need
to aggregate features from their lower devices.

The callback is optional and only implemented by devices that need
dynamic offload feature computation.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 include/linux/netdevice.h | 7 +++++++
 net/core/dev.c            | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ae269a2e7f4d..acaec0340266 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1281,6 +1281,12 @@ struct netdev_net_notifier {
  *	constraints, and returns the resulting flags. Must not modify
  *	the device state.
  *
+ * void (*ndo_update_offloads)(struct net_device *dev);
+ *	Called during feature update to allow device to compute and update
+ *	offload features (like vlan_features, hw_enc_features) based on
+ *	current lower device configuration. Typically used by master
+ *	devices to aggregate features from slave devices.
+ *
  * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
  *	Called to update device configuration to new features. Passed
  *	feature set might be less than what was returned by ndo_fix_features()).
@@ -1558,6 +1564,7 @@ struct net_device_ops {
 							struct sock *sk);
 	netdev_features_t	(*ndo_fix_features)(struct net_device *dev,
 						    netdev_features_t features);
+	void			(*ndo_update_offloads)(struct net_device *dev);
 	int			(*ndo_set_features)(struct net_device *dev,
 						    netdev_features_t features);
 	int			(*ndo_neigh_construct)(struct net_device *dev,
diff --git a/net/core/dev.c b/net/core/dev.c
index 200d44883fc1..bbd532aa6a1b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -11011,6 +11011,9 @@ int __netdev_update_features(struct net_device *dev)
 	ASSERT_RTNL();
 	netdev_ops_assert_locked(dev);
 
+	if (dev->netdev_ops->ndo_update_offloads)
+		dev->netdev_ops->ndo_update_offloads(dev);
+
 	features = netdev_get_wanted_features(dev);
 
 	if (dev->netdev_ops->ndo_fix_features)

-- 
Git-155)


  reply	other threads:[~2026-03-16  4:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16  4:26 [PATCH net-next v3 0/5] net: centralize master device offload feature computation Hangbin Liu
2026-03-16  4:26 ` Hangbin Liu [this message]
2026-03-17 15:14   ` [PATCH net-next v3 1/5] net: add ndo_update_offloads for offload computation Sabrina Dubroca
2026-03-18  1:15     ` Hangbin Liu
2026-03-18 23:29       ` Sabrina Dubroca
2026-03-19  2:02         ` Hangbin Liu
2026-03-16  4:26 ` [PATCH net-next v3 2/5] net: use ndo_update_offloads to set offload features for bonding/bridge/team Hangbin Liu
2026-03-19  9:16   ` [net-next,v3,2/5] " Paolo Abeni
2026-03-16  4:26 ` [PATCH net-next v3 3/5] macsec: move netdev_upper_dev_link() after macsec_changelink_common() Hangbin Liu
2026-03-17 11:58   ` Sabrina Dubroca
2026-03-16  4:26 ` [PATCH net-next v3 4/5] failover: use ndo_update_offloads for failover offload compute Hangbin Liu
2026-03-16  4:26 ` [PATCH net-next v3 5/5] net: no need to disable LRO specifically Hangbin Liu
2026-03-19  9:52 ` [PATCH net-next v3 0/5] net: centralize master device offload feature computation Paolo Abeni
2026-03-19 13:37   ` Hangbin Liu
2026-03-19 16:01   ` Jakub Kicinski

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=20260316-offload_compute-v3-1-a5d4a07d86d3@gmail.com \
    --to=liuhangbin@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bridge@lists.linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=jiri@resnulli.us \
    --cc=jv@jvosburgh.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox