Skip to contentSkip to conversation

net, team, bonding: Add netdev_base_features helper

PATCH Applied Daniel Borkmann 5 participants 18 messages Dec 10, 2024 – Dec 12, 2024

Subsystems (5)
lore
Share & tools
lore

Daniel Borkmann

author maintainer
#0 lore raw

PATCH 1/5 net, team, bonding: Add netdev_base_features helper

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.

Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/bonding/bond_main.c | 4 +---
 drivers/net/team/team_core.c    | 3 +--
 include/linux/netdev_features.h | 7 +++++++
 3 files changed, 9 insertions(+), 5 deletions(-)
drivers/net/bonding/bond_main.c +1 -3
index 49dd4fe195e5..42c835c60cd8 100644
@@ -1520,9 +1520,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
 	struct slave *slave;
 
 	mask = features;
-
-	features &= ~NETIF_F_ONE_FOR_ALL;
-	features |= NETIF_F_ALL_FOR_ALL;
+	features = netdev_base_features(features);
 
 	bond_for_each_slave(bond, slave, iter) {
 		features = netdev_increment_features(features,
drivers/net/team/team_core.c +1 -2
index a1b27b69f010..1df062c67640 100644
@@ -2011,8 +2011,7 @@ static netdev_features_t team_fix_features(struct net_device *dev,
 	netdev_features_t mask;
 
 	mask = features;
-	features &= ~NETIF_F_ONE_FOR_ALL;
-	features |= NETIF_F_ALL_FOR_ALL;
+	features = netdev_base_features(features);
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(port, &team->port_list, list) {
include/linux/netdev_features.h +7 -0
index 66e7d26b70a4..11be70a7929f 100644
@@ -253,4 +253,11 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
 				 NETIF_F_GSO_UDP_TUNNEL |		\
 				 NETIF_F_GSO_UDP_TUNNEL_CSUM)
 
+static inline netdev_features_t netdev_base_features(netdev_features_t features)
+{
+	features &= ~NETIF_F_ONE_FOR_ALL;
+	features |= NETIF_F_ALL_FOR_ALL;
+	return features;
+}
+
 #endif	/* _LINUX_NETDEV_FEATURES_H */
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 2/5 bonding: Fix initial {vlan,mpls}_feature set in bond_compute_features

If a bonding device has slave devices, then the current logic to derive the feature set for the master bond device is limited in that flags which are fully supported by the underlying slave devices cannot be propagated up to vlan devices which sit on top of bond devices. Instead, these get blindly masked out via current NETIF_F_ALL_FOR_ALL logic.

vlan_features and mpls_features should reuse netdev_base_features() in order derive the set in the same way as ndo_fix_features before iterating through the slave devices to refine the feature set.

Fixes a9b3ace44c7d ("bonding: fix vlan_features computing")
Fixes 2e770b507ccd ("net: bonding: Inherit MPLS features from slave devices")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/bonding/bond_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +3 -2
index 42c835c60cd8..320dd71392ef 100644
@@ -1563,8 +1563,9 @@ static void bond_compute_features(struct bonding *bond)
 
 	if (!bond_has_slaves(bond))
 		goto done;
-	vlan_features &= NETIF_F_ALL_FOR_ALL;
-	mpls_features &= NETIF_F_ALL_FOR_ALL;
+
+	vlan_features = netdev_base_features(vlan_features);
+	mpls_features = netdev_base_features(mpls_features);
 
 	bond_for_each_slave(bond, slave, iter) {
 		vlan_features = netdev_increment_features(vlan_features,
Signature · 1 line
2.43.0
Reviewed-by on v1 2/5
#2 lore raw

Re: [PATCH net 2/5] bonding: Fix initial {vlan,mpls}_feature set in bond_compute_features

Quoted 26 lines · Daniel Borkmann

If a bonding device has slave devices, then the current logic to derive the feature set for the master bond device is limited in that flags which are fully supported by the underlying slave devices cannot be propagated up to vlan devices which sit on top of bond devices. Instead, these get blindly masked out via current NETIF_F_ALL_FOR_ALL logic.

vlan_features and mpls_features should reuse netdev_base_features() in order derive the set in the same way as ndo_fix_features before iterating through the slave devices to refine the feature set.

Fixes a9b3ace44c7d ("bonding: fix vlan_features computing")
Fixes 2e770b507ccd ("net: bonding: Inherit MPLS features from slave devices")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/bonding/bond_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +0 -0
index 42c835c60cd8..320dd71392ef 100644
@@ -1563,8 +1563,9 @@ static void bond_compute_features(struct bonding *bond)
 

drivers/net/bonding/bond_main.c static void bond_compute_features(struct bonding *bond) · line 1571

Quoted 10 lines
drivers/net/bonding/bond_main.c +3 -2
 	if (!bond_has_slaves(bond))
 		goto done;
-	vlan_features &= NETIF_F_ALL_FOR_ALL;
-	mpls_features &= NETIF_F_ALL_FOR_ALL;
+
+	vlan_features = netdev_base_features(vlan_features);
+	mpls_features = netdev_base_features(mpls_features);
 
 	bond_for_each_slave(bond, slave, iter) {
 		vlan_features = netdev_increment_features(vlan_features,
Reviewed-by on v1 2/5
#3 lore raw

Re: [PATCH net 2/5] bonding: Fix initial {vlan,mpls}_feature set in bond_compute_features

In reply to Daniel Borkmann
Quoted 39 lines · Daniel Borkmann

If a bonding device has slave devices, then the current logic to derive the feature set for the master bond device is limited in that flags which are fully supported by the underlying slave devices cannot be propagated up to vlan devices which sit on top of bond devices. Instead, these get blindly masked out via current NETIF_F_ALL_FOR_ALL logic.

vlan_features and mpls_features should reuse netdev_base_features() in order derive the set in the same way as ndo_fix_features before iterating through the slave devices to refine the feature set.

Fixes a9b3ace44c7d ("bonding: fix vlan_features computing")
Fixes 2e770b507ccd ("net: bonding: Inherit MPLS features from slave devices")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/bonding/bond_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +3 -2
index 42c835c60cd8..320dd71392ef 100644
@@ -1563,8 +1563,9 @@ static void bond_compute_features(struct bonding *bond)
 
 	if (!bond_has_slaves(bond))
 		goto done;
-	vlan_features &= NETIF_F_ALL_FOR_ALL;
-	mpls_features &= NETIF_F_ALL_FOR_ALL;
+
+	vlan_features = netdev_base_features(vlan_features);
+	mpls_features = netdev_base_features(mpls_features);
 
 	bond_for_each_slave(bond, slave, iter) {
 		vlan_features = netdev_increment_features(vlan_features,
Signature · 1 line
2.43.0
author maintainer
#4 lore raw

PATCH 3/5 bonding: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL

In reply to Daniel Borkmann

Drivers like mlx5 expose NIC's vlan_features such as NETIF_F_GSO_UDP_TUNNEL & NETIF_F_GSO_UDP_TUNNEL_CSUM which are later not propagated when the underlying devices are bonded and a vlan device created on top of the bond.

Right now, the more cumbersome workaround for this is to create the vlan on top of the mlx5 and then enslave the vlan devices to a bond.

To fix this, add NETIF_F_GSO_ENCAP_ALL to BOND_VLAN_FEATURES such that bond_compute_features() can probe and propagate the vlan_features from the slave devices up to the vlan device.

Given the following bond:

  # ethtool -i enp2s0f{0,1}np{0,1}
  driver: mlx5_core
  [...]
  # ethtool -k enp2s0f0np0 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: on
  rx-udp-gro-forwarding: off
  # ethtool -k enp2s0f1np1 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: on
  rx-udp-gro-forwarding: off
  # ethtool -k bond0 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: off [fixed]
  rx-udp-gro-forwarding: off

Before:

  # ethtool -k bond0.100 | grep udp
  tx-udp_tnl-segmentation: off [requested on]
  tx-udp_tnl-csum-segmentation: off [requested on]
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: off [fixed]
  rx-udp-gro-forwarding: off

After:

  # ethtool -k bond0.100 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: off [fixed]
  rx-udp-gro-forwarding: off

Various users have run into this reporting performance issues when configuring Cilium in vxlan tunneling mode and having the combination of bond & vlan for the core devices connecting the Kubernetes cluster to the outside world.

Fixes a9b3ace44c7d ("bonding: fix vlan_features computing")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/bonding/bond_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/bonding/bond_main.c +1 -0
index 320dd71392ef..7b78c2bada81 100644
@@ -1534,6 +1534,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
 
 #define BOND_VLAN_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
 				 NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | \
+				 NETIF_F_GSO_ENCAP_ALL | \
 				 NETIF_F_HIGHDMA | NETIF_F_LRO)
 
 #define BOND_ENC_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
Signature · 1 line
2.43.0
Reviewed-by on v1 3/5
#5 lore raw

Re: [PATCH net 3/5] bonding: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL

Quoted 63 lines · Daniel Borkmann

Drivers like mlx5 expose NIC's vlan_features such as NETIF_F_GSO_UDP_TUNNEL & NETIF_F_GSO_UDP_TUNNEL_CSUM which are later not propagated when the underlying devices are bonded and a vlan device created on top of the bond.

Right now, the more cumbersome workaround for this is to create the vlan on top of the mlx5 and then enslave the vlan devices to a bond.

To fix this, add NETIF_F_GSO_ENCAP_ALL to BOND_VLAN_FEATURES such that bond_compute_features() can probe and propagate the vlan_features from the slave devices up to the vlan device.

Given the following bond:

  # ethtool -i enp2s0f{0,1}np{0,1}
  driver: mlx5_core
  [...]
  # ethtool -k enp2s0f0np0 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: on
  rx-udp-gro-forwarding: off
  # ethtool -k enp2s0f1np1 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: on
  rx-udp-gro-forwarding: off
  # ethtool -k bond0 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: off [fixed]
  rx-udp-gro-forwarding: off

Before:

  # ethtool -k bond0.100 | grep udp
  tx-udp_tnl-segmentation: off [requested on]
  tx-udp_tnl-csum-segmentation: off [requested on]
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: off [fixed]
  rx-udp-gro-forwarding: off

After:

  # ethtool -k bond0.100 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: off [fixed]
  rx-udp-gro-forwarding: off

Various users have run into this reporting performance issues when configuring Cilium in vxlan tunneling mode and having the combination of bond & vlan for the core devices connecting the Kubernetes cluster to the outside world.

Quoted 9 lines
Fixes a9b3ace44c7d ("bonding: fix vlan_features computing")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/bonding/bond_main.c | 1 +
 1 file changed, 1 insertion(+)

Indeed, I've tested a similar change a year ago to get the expected performance.

Reviewed-by on v1 3/5
#6 lore raw

Re: [PATCH net 3/5] bonding: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL

In reply to Daniel Borkmann
Quoted 87 lines · Daniel Borkmann

Drivers like mlx5 expose NIC's vlan_features such as NETIF_F_GSO_UDP_TUNNEL & NETIF_F_GSO_UDP_TUNNEL_CSUM which are later not propagated when the underlying devices are bonded and a vlan device created on top of the bond.

Right now, the more cumbersome workaround for this is to create the vlan on top of the mlx5 and then enslave the vlan devices to a bond.

To fix this, add NETIF_F_GSO_ENCAP_ALL to BOND_VLAN_FEATURES such that bond_compute_features() can probe and propagate the vlan_features from the slave devices up to the vlan device.

Given the following bond:

  # ethtool -i enp2s0f{0,1}np{0,1}
  driver: mlx5_core
  [...]
  # ethtool -k enp2s0f0np0 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: on
  rx-udp-gro-forwarding: off
  # ethtool -k enp2s0f1np1 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: on
  rx-udp-gro-forwarding: off
  # ethtool -k bond0 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: off [fixed]
  rx-udp-gro-forwarding: off

Before:

  # ethtool -k bond0.100 | grep udp
  tx-udp_tnl-segmentation: off [requested on]
  tx-udp_tnl-csum-segmentation: off [requested on]
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: off [fixed]
  rx-udp-gro-forwarding: off

After:

  # ethtool -k bond0.100 | grep udp
  tx-udp_tnl-segmentation: on
  tx-udp_tnl-csum-segmentation: on
  tx-udp-segmentation: on
  rx-udp_tunnel-port-offload: off [fixed]
  rx-udp-gro-forwarding: off

Various users have run into this reporting performance issues when configuring Cilium in vxlan tunneling mode and having the combination of bond & vlan for the core devices connecting the Kubernetes cluster to the outside world.

Fixes a9b3ace44c7d ("bonding: fix vlan_features computing")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/bonding/bond_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/bonding/bond_main.c +1 -0
index 320dd71392ef..7b78c2bada81 100644
@@ -1534,6 +1534,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
 
 #define BOND_VLAN_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
 				 NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | \
+				 NETIF_F_GSO_ENCAP_ALL | \
 				 NETIF_F_HIGHDMA | NETIF_F_LRO)
 
 #define BOND_ENC_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
Signature · 1 line
2.43.0
author maintainer
#7 lore raw

PATCH 4/5 team: Fix initial vlan_feature set in __team_compute_features

In reply to Daniel Borkmann

Similarly as with bonding, fix the calculation of vlan_features to reuse netdev_base_features() in order derive the set in the same way as ndo_fix_features before iterating through the slave devices to refine the feature set.

Fixes 3625920b62c3 ("teaming: fix vlan_features computing")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/team/team_core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/team/team_core.c +3 -2
index 1df062c67640..306416fc1db0 100644
@@ -991,13 +991,14 @@ static void team_port_disable(struct team *team,
 static void __team_compute_features(struct team *team)
 {
 	struct team_port *port;
-	netdev_features_t vlan_features = TEAM_VLAN_FEATURES &
-					  NETIF_F_ALL_FOR_ALL;
+	netdev_features_t vlan_features = TEAM_VLAN_FEATURES;
 	netdev_features_t enc_features  = TEAM_ENC_FEATURES;
 	unsigned short max_hard_header_len = ETH_HLEN;
 	unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
 					IFF_XMIT_DST_RELEASE_PERM;
 
+	vlan_features = netdev_base_features(vlan_features);
+
 	rcu_read_lock();
 	list_for_each_entry_rcu(port, &team->port_list, list) {
 		vlan_features = netdev_increment_features(vlan_features,
Signature · 1 line
2.43.0
Reviewed-by on v1 4/5
#8 lore raw

Re: [PATCH net 4/5] team: Fix initial vlan_feature set in __team_compute_features

Quoted 25 lines · Daniel Borkmann

Similarly as with bonding, fix the calculation of vlan_features to reuse netdev_base_features() in order derive the set in the same way as ndo_fix_features before iterating through the slave devices to refine the feature set.

Fixes 3625920b62c3 ("teaming: fix vlan_features computing")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/team/team_core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/team/team_core.c +1 -2
index 1df062c67640..306416fc1db0 100644
@@ -991,13 +991,14 @@ static void team_port_disable(struct team *team,
 static void __team_compute_features(struct team *team)
 {
 	struct team_port *port;
-	netdev_features_t vlan_features = TEAM_VLAN_FEATURES &
-					  NETIF_F_ALL_FOR_ALL;
+	netdev_features_t vlan_features = TEAM_VLAN_FEATURES;

drivers/net/team/team_core.c static void team_port_disable(struct team *team, · line 1004

Quoted 10 lines
drivers/net/team/team_core.c +2 -0
 	netdev_features_t enc_features  = TEAM_ENC_FEATURES;
 	unsigned short max_hard_header_len = ETH_HLEN;
 	unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
 					IFF_XMIT_DST_RELEASE_PERM;
 
+	vlan_features = netdev_base_features(vlan_features);
+
 	rcu_read_lock();
 	list_for_each_entry_rcu(port, &team->port_list, list) {
 		vlan_features = netdev_increment_features(vlan_features,
Reviewed-by on v1 4/5
#9 lore raw

Re: [PATCH net 4/5] team: Fix initial vlan_feature set in __team_compute_features

In reply to Daniel Borkmann
Quoted 38 lines · Daniel Borkmann

Similarly as with bonding, fix the calculation of vlan_features to reuse netdev_base_features() in order derive the set in the same way as ndo_fix_features before iterating through the slave devices to refine the feature set.

Fixes 3625920b62c3 ("teaming: fix vlan_features computing")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/team/team_core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/team/team_core.c +3 -2
index 1df062c67640..306416fc1db0 100644
@@ -991,13 +991,14 @@ static void team_port_disable(struct team *team,
 static void __team_compute_features(struct team *team)
 {
 	struct team_port *port;
-	netdev_features_t vlan_features = TEAM_VLAN_FEATURES &
-					  NETIF_F_ALL_FOR_ALL;
+	netdev_features_t vlan_features = TEAM_VLAN_FEATURES;
 	netdev_features_t enc_features  = TEAM_ENC_FEATURES;
 	unsigned short max_hard_header_len = ETH_HLEN;
 	unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
 					IFF_XMIT_DST_RELEASE_PERM;
 
+	vlan_features = netdev_base_features(vlan_features);
+
 	rcu_read_lock();
 	list_for_each_entry_rcu(port, &team->port_list, list) {
 		vlan_features = netdev_increment_features(vlan_features,
Signature · 1 line
2.43.0
author maintainer
#10 lore raw

PATCH 5/5 team: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL

In reply to Daniel Borkmann

Similar to bonding driver, add NETIF_F_GSO_ENCAP_ALL to TEAM_VLAN_FEATURES in order to support slave devices which propagate NETIF_F_GSO_UDP_TUNNEL & NETIF_F_GSO_UDP_TUNNEL_CSUM as vlan_features.

Fixes 3625920b62c3 ("teaming: fix vlan_features computing")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/team/team_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/team/team_core.c +2 -1
index 306416fc1db0..69ea2c3c76bf 100644
@@ -983,7 +983,8 @@ static void team_port_disable(struct team *team,
 
 #define TEAM_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
 			    NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | \
-			    NETIF_F_HIGHDMA | NETIF_F_LRO)
+			    NETIF_F_HIGHDMA | NETIF_F_LRO | \
+			    NETIF_F_GSO_ENCAP_ALL)
 
 #define TEAM_ENC_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
 				 NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE)
Signature · 1 line
2.43.0
Reviewed-by on v1 5/5
#11 lore raw

Re: [PATCH net 5/5] team: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL

Quoted 18 lines · Daniel Borkmann

Similar to bonding driver, add NETIF_F_GSO_ENCAP_ALL to TEAM_VLAN_FEATURES in order to support slave devices which propagate NETIF_F_GSO_UDP_TUNNEL & NETIF_F_GSO_UDP_TUNNEL_CSUM as vlan_features.

Fixes 3625920b62c3 ("teaming: fix vlan_features computing")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/team/team_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/team/team_core.c +0 -0
index 306416fc1db0..69ea2c3c76bf 100644

drivers/net/team/team_core.c static void team_port_disable(struct team *team, · line 990

Quoted 9 lines
drivers/net/team/team_core.c +2 -1
@@ -983,7 +983,8 @@ static void team_port_disable(struct team *team,
 
 #define TEAM_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
 			    NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | \
-			    NETIF_F_HIGHDMA | NETIF_F_LRO)
+			    NETIF_F_HIGHDMA | NETIF_F_LRO | \
+			    NETIF_F_GSO_ENCAP_ALL)
 
 #define TEAM_ENC_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
 				 NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE)
Reviewed-by on v1 5/5
#12 lore raw

Re: [PATCH net 5/5] team: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL

In reply to Daniel Borkmann
Quoted 30 lines · Daniel Borkmann

Similar to bonding driver, add NETIF_F_GSO_ENCAP_ALL to TEAM_VLAN_FEATURES in order to support slave devices which propagate NETIF_F_GSO_UDP_TUNNEL & NETIF_F_GSO_UDP_TUNNEL_CSUM as vlan_features.

Fixes 3625920b62c3 ("teaming: fix vlan_features computing")
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/team/team_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/team/team_core.c +2 -1
index 306416fc1db0..69ea2c3c76bf 100644
@@ -983,7 +983,8 @@ static void team_port_disable(struct team *team,
 
 #define TEAM_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
 			    NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE | \
-			    NETIF_F_HIGHDMA | NETIF_F_LRO)
+			    NETIF_F_HIGHDMA | NETIF_F_LRO | \
+			    NETIF_F_GSO_ENCAP_ALL)
 
 #define TEAM_ENC_FEATURES	(NETIF_F_HW_CSUM | NETIF_F_SG | \
 				 NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE)
Signature · 1 line
2.43.0
Reviewed-by on v1 1/5
#13 lore raw
In reply to Daniel Borkmann
Quoted 65 lines · Daniel Borkmann

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.

Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 drivers/net/bonding/bond_main.c | 4 +---
 drivers/net/team/team_core.c    | 3 +--
 include/linux/netdev_features.h | 7 +++++++
 3 files changed, 9 insertions(+), 5 deletions(-)
drivers/net/bonding/bond_main.c +1 -3
index 49dd4fe195e5..42c835c60cd8 100644
@@ -1520,9 +1520,7 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
 	struct slave *slave;
 
 	mask = features;
-
-	features &= ~NETIF_F_ONE_FOR_ALL;
-	features |= NETIF_F_ALL_FOR_ALL;
+	features = netdev_base_features(features);
 
 	bond_for_each_slave(bond, slave, iter) {
 		features = netdev_increment_features(features,
drivers/net/team/team_core.c +1 -2
index a1b27b69f010..1df062c67640 100644
@@ -2011,8 +2011,7 @@ static netdev_features_t team_fix_features(struct net_device *dev,
 	netdev_features_t mask;
 
 	mask = features;
-	features &= ~NETIF_F_ONE_FOR_ALL;
-	features |= NETIF_F_ALL_FOR_ALL;
+	features = netdev_base_features(features);
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(port, &team->port_list, list) {
include/linux/netdev_features.h +7 -0
index 66e7d26b70a4..11be70a7929f 100644
@@ -253,4 +253,11 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
 				 NETIF_F_GSO_UDP_TUNNEL |		\
 				 NETIF_F_GSO_UDP_TUNNEL_CSUM)
 
+static inline netdev_features_t netdev_base_features(netdev_features_t features)
+{
+	features &= ~NETIF_F_ONE_FOR_ALL;
+	features |= NETIF_F_ALL_FOR_ALL;
+	return features;
+}
+
 #endif	/* _LINUX_NETDEV_FEATURES_H */
Signature · 1 line
2.43.0
Reviewed-by on v1 1/5
#14 lore raw
In reply to Daniel Borkmann
Quoted 11 lines · Daniel Borkmann

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.

Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>
Quoted 6 lines
---
 drivers/net/bonding/bond_main.c | 4 +---
 drivers/net/team/team_core.c    | 3 +--
 include/linux/netdev_features.h | 7 +++++++
 3 files changed, 9 insertions(+), 5 deletions(-)
maintainer
#15 lore raw
In reply to Daniel Borkmann
Quoted 11 lines · Daniel Borkmann

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.

Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>

The series looks good, I'm applying it right now, but please include a (even small) cover letter in the next multi-patch submission, thanks!

Paolo

author maintainer
#16 lore raw
Quoted 8 lines · Paolo Abeni
Quoted 7 lines · Daniel Borkmann

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.

Quoted 7 lines
Quoted 4 lines
Cc Nikolay Aleksandrov <[email protected]>
Cc Ido Schimmel <[email protected]>
Cc Jiri Pirko <[email protected]>

The series looks good, I'm applying it right now, but please include a (even small) cover letter in the next multi-patch submission, thanks!

Ok, thanks, will do next time!

Cheers,
Daniel

#17 lore raw
In reply to Daniel Borkmann
This series was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Tue, 10 Dec 2024 15:12:41 +0100 you wrote:

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.

[...]

Here is the summary with links:
- [net,1/5] net, team, bonding: Add netdev_base_features helper

    https://git.kernel.org/netdev/net/c/d2516c3a5370
  - [net,2/5] bonding: Fix initial {vlan,mpls}_feature set in bond_compute_features
    https://git.kernel.org/netdev/net/c/d064ea7fe2a2
  - [net,3/5] bonding: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL
    https://git.kernel.org/netdev/net/c/77b11c8bf3a2
  - [net,4/5] team: Fix initial vlan_feature set in __team_compute_features
    https://git.kernel.org/netdev/net/c/396699ac2cb1
  - [net,5/5] team: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL
    https://git.kernel.org/netdev/net/c/98712844589e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html