Skip to contentSkip to conversation

Bonding: Fix support for gso_partial_features

PATCH Superseded Hangbin Liu 1 participant 2 messages Jan 21, 2025

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bonding: Fix support for gso_partial_features

The fixed commit adds NETIF_F_GSO_ESP bit for bonding gso_partial_features. However, if we don't set the dev NETIF_F_GSO_PARTIAL bit, the later netdev_change_features() -> netdev_fix_features() will remove the NETIF_F_GSO_ESP bit from the dev features. This causes ethtool to show that the bond does not support tx-esp-segmentation. For example

 # ethtool -k bond0 | grep esp
 tx-esp-segmentation: off [requested on]
 esp-hw-offload: on
 esp-tx-csum-hw-offload: on

Add the NETIF_F_GSO_PARTIAL bit to bond dev features when set gso_partial_features to fix this issue.

Fixes 4861333b4217 ("bonding: add ESP offload features when slaves support")
---
 drivers/net/bonding/bond_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +4 -2
index 7b78c2bada81..e1c054416d5e 100644
@@ -1598,10 +1598,12 @@ static void bond_compute_features(struct bonding *bond)
 	}
 	bond_dev->hard_header_len = max_hard_header_len;
 
-	if (gso_partial_features & NETIF_F_GSO_ESP)
+	if (gso_partial_features & NETIF_F_GSO_ESP) {
 		bond_dev->gso_partial_features |= NETIF_F_GSO_ESP;
-	else
+		bond_dev->features |= NETIF_F_GSO_PARTIAL;
+	} else {
 		bond_dev->gso_partial_features &= ~NETIF_F_GSO_ESP;
+	}
 
 done:
 	bond_dev->vlan_features = vlan_features;
Signature · 1 line
2.39.5 (Apple Git-154)
#1 lore raw
Quoted 27 lines · Hangbin Liu

The fixed commit adds NETIF_F_GSO_ESP bit for bonding gso_partial_features. However, if we don't set the dev NETIF_F_GSO_PARTIAL bit, the later netdev_change_features() -> netdev_fix_features() will remove the NETIF_F_GSO_ESP bit from the dev features. This causes ethtool to show that the bond does not support tx-esp-segmentation. For example

 # ethtool -k bond0 | grep esp
 tx-esp-segmentation: off [requested on]
 esp-hw-offload: on
 esp-tx-csum-hw-offload: on

Add the NETIF_F_GSO_PARTIAL bit to bond dev features when set gso_partial_features to fix this issue.

Fixes 4861333b4217 ("bonding: add ESP offload features when slaves support")
---
 drivers/net/bonding/bond_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/bonding/bond_main.c +0 -0
index 7b78c2bada81..e1c054416d5e 100644
@@ -1598,10 +1598,12 @@ static void bond_compute_features(struct bonding *bond)
 	}

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

Quoted 10 lines
drivers/net/bonding/bond_main.c +4 -2
 	bond_dev->hard_header_len = max_hard_header_len;
 
-	if (gso_partial_features & NETIF_F_GSO_ESP)
+	if (gso_partial_features & NETIF_F_GSO_ESP) {
 		bond_dev->gso_partial_features |= NETIF_F_GSO_ESP;
-	else
+		bond_dev->features |= NETIF_F_GSO_PARTIAL;
+	} else {
 		bond_dev->gso_partial_features &= ~NETIF_F_GSO_ESP;
+	}

Hmm, looks we need to remove NETIF_F_GSO_PARTIAL when remove the gso_partial_features.

BTW, I saw some drivers set NETIF_F_GSO_PARTIAL on dev->features. Some other drivers set NETIF_F_GSO_PARTIAL on dev->hw_enc_features. I haven't see a doc about where we should set. Please tell me if you have any comments.

Thanks
Hangbin