From: Hangbin Liu <liuhangbin@gmail.com>
To: netdev@vger.kernel.org
Cc: 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>,
Sridhar Samudrala <sridhar.samudrala@intel.com>,
Jiri Pirko <jiri@resnulli.us>, Simon Horman <horms@kernel.org>,
Nikolay Aleksandrov <razor@blackwall.org>,
Ido Schimmel <idosch@nvidia.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Kuniyuki Iwashima <kuniyu@google.com>,
Samiullah Khawaja <skhawaja@google.com>,
Ahmed Zaki <ahmed.zaki@intel.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
linux-kernel@vger.kernel.org, bridge@lists.linux.dev,
Hangbin Liu <liuhangbin@gmail.com>
Subject: [RFC PATCH net-next 1/3] net: add ndo_update_offloads
Date: Thu, 26 Feb 2026 11:42:06 +0000 [thread overview]
Message-ID: <20260226114208.27774-2-liuhangbin@gmail.com> (raw)
In-Reply-To: <20260226114208.27774-1-liuhangbin@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 enabling 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 d4e6e00bb90a..1169091ccb9a 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 096b3ff13f6b..d05837c0713a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -10982,6 +10982,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)
--
2.50.1
next prev parent reply other threads:[~2026-02-26 11:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 11:42 [RFC PATCH net-next 0/3] net: add ndo_update_offloads for offload computation Hangbin Liu
2026-02-26 11:42 ` Hangbin Liu [this message]
2026-02-26 11:42 ` [RFC PATCH net-next 2/3] net: use ndo_update_offloads for bonding/bridge/team Hangbin Liu
2026-02-27 7:53 ` Hangbin Liu
2026-02-26 11:42 ` [RFC PATCH net-next 3/3] failover: use .ndo_update_offloads for failover Hangbin Liu
2026-02-26 12:48 ` 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=20260226114208.27774-2-liuhangbin@gmail.com \
--to=liuhangbin@gmail.com \
--cc=ahmed.zaki@intel.com \
--cc=aleksander.lobakin@intel.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=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=sdf@fomichev.me \
--cc=skhawaja@google.com \
--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