Skip to content

Commit ec5a406

Browse files
committed
net, team, bonding: Add netdev_base_features helper
jira LE-2974 Rebuild_History Non-Buildable kernel-5.14.0-503.40.1.el9_5 commit-author Daniel Borkmann <[email protected]> commit d2516c3 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 <[email protected]> Cc: Nikolay Aleksandrov <[email protected]> Cc: Ido Schimmel <[email protected]> Cc: Jiri Pirko <[email protected]> Reviewed-by: Hangbin Liu <[email protected]> Reviewed-by: Nikolay Aleksandrov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> (cherry picked from commit d2516c3) Signed-off-by: Jonathan Maple <[email protected]>
1 parent bf14c33 commit ec5a406

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
@@ -1408,9 +1408,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
14081408
#endif
14091409

14101410
mask = features;
1411-
1412-
features &= ~NETIF_F_ONE_FOR_ALL;
1413-
features |= NETIF_F_ALL_FOR_ALL;
1411+
features = netdev_base_features(features);
14141412

14151413
bond_for_each_slave(bond, slave, iter) {
14161414
features = netdev_increment_features(features,

drivers/net/team/team_core.c

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

20252025
mask = features;
2026-
features &= ~NETIF_F_ONE_FOR_ALL;
2027-
features |= NETIF_F_ALL_FOR_ALL;
2026+
features = netdev_base_features(features);
20282027

20292028
rcu_read_lock();
20302029
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)