Skip to content

Commit 30c20fd

Browse files
borkmannmehmetb0
authored andcommitted
net, team, bonding: Add netdev_base_features helper
BugLink: https://bugs.launchpad.net/bugs/2102181 [ Upstream commit d2516c3a53705f783bb6868df0f4a2b977898a71 ] Both bonding and team driver have logic to derive the base feature flags before iterating over their slave devices to refine the set via netdev_increment_features(). Add a small helper netdev_base_features() so this can be reused instead of having it open-coded multiple times. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Nikolay Aleksandrov <razor@blackwall.org> Cc: Ido Schimmel <idosch@idosch.org> Cc: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Hangbin Liu <liuhangbin@gmail.com> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org> Link: https://patch.msgid.link/20241210141245.327886-1-daniel@iogearbox.net Signed-off-by: Paolo Abeni <pabeni@redhat.com> Stable-dep-of: d064ea7fe2a2 ("bonding: Fix initial {vlan,mpls}_feature set in bond_compute_features") Signed-off-by: Sasha Levin <sashal@kernel.org> [koichiroden: for changes on team driver, applied to an older path due to missing commit: a0393e3e3ddb ("net: team: rename team to team_core for linking")] Signed-off-by: Koichiro Den <koichiro.den@canonical.com> Signed-off-by: Mehmet Basaran <mehmet.basaran@canonical.com>
1 parent d4f7bf8 commit 30c20fd

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,9 +1446,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
14461446
struct slave *slave;
14471447

14481448
mask = features;
1449-
1450-
features &= ~NETIF_F_ONE_FOR_ALL;
1451-
features |= NETIF_F_ALL_FOR_ALL;
1449+
features = netdev_base_features(features);
14521450

14531451
bond_for_each_slave(bond, slave, iter) {
14541452
features = netdev_increment_features(features,

drivers/net/team/team.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,8 +2012,7 @@ static netdev_features_t team_fix_features(struct net_device *dev,
20122012
netdev_features_t mask;
20132013

20142014
mask = features;
2015-
features &= ~NETIF_F_ONE_FOR_ALL;
2016-
features |= NETIF_F_ALL_FOR_ALL;
2015+
features = netdev_base_features(features);
20172016

20182017
rcu_read_lock();
20192018
list_for_each_entry_rcu(port, &team->port_list, list) {

include/linux/netdev_features.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,11 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
261261
NETIF_F_GSO_UDP_TUNNEL | \
262262
NETIF_F_GSO_UDP_TUNNEL_CSUM)
263263

264+
static inline netdev_features_t netdev_base_features(netdev_features_t features)
265+
{
266+
features &= ~NETIF_F_ONE_FOR_ALL;
267+
features |= NETIF_F_ALL_FOR_ALL;
268+
return features;
269+
}
270+
264271
#endif /* _LINUX_NETDEV_FEATURES_H */

0 commit comments

Comments
 (0)