Skip to contentSkip to conversation

bonding: set xfrm feature flags more sanely

PATCH Applied Jarod Wilson 2 participants 2 messages Dec 5, 2020 – Dec 8, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bonding: set xfrm feature flags more sanely

We can remove one of the ifdef blocks here, and instead of setting both the xfrm hw_features and features flags, then unsetting the the features flags if not in AB, wait to set the features flags if we're actually in AB mode.

Cc Jay Vosburgh <[email protected]>
Cc Veaceslav Falico <[email protected]>
Cc Andy Gospodarek <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Thomas Davis <[email protected]>
---
 drivers/net/bonding/bond_main.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/bonding/bond_main.c +4 -6
index e0880a3840d7..5fe5232cc3f3 100644
@@ -4746,15 +4746,13 @@ void bond_setup(struct net_device *bond_dev)
 				NETIF_F_HW_VLAN_CTAG_FILTER;
 
 	bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
-#ifdef CONFIG_XFRM_OFFLOAD
-	bond_dev->hw_features |= BOND_XFRM_FEATURES;
-#endif /* CONFIG_XFRM_OFFLOAD */
 	bond_dev->features |= bond_dev->hw_features;
 	bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
 #ifdef CONFIG_XFRM_OFFLOAD
-	/* Disable XFRM features if this isn't an active-backup config */
-	if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)
-		bond_dev->features &= ~BOND_XFRM_FEATURES;
+	bond_dev->hw_features |= BOND_XFRM_FEATURES;
+	/* Only enable XFRM features if this is an active-backup config */
+	if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
+		bond_dev->features |= BOND_XFRM_FEATURES;
 #endif /* CONFIG_XFRM_OFFLOAD */
 }
 
Signature · 1 line
2.28.0
maintainer Applied
#1 lore raw
Quoted 5 lines · On Sat, 5 Dec 2020 12:40:03 -0500 Jarod Wilson wrote:

We can remove one of the ifdef blocks here, and instead of setting both the xfrm hw_features and features flags, then unsetting the the features flags if not in AB, wait to set the features flags if we're actually in AB mode.

Quoted 8 lines
Cc Jay Vosburgh <[email protected]>
Cc Veaceslav Falico <[email protected]>
Cc Andy Gospodarek <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Thomas Davis <[email protected]>

Applied, thanks!