Skip to content

Commit 9137846

Browse files
sneginhaPlaidCat
authored andcommitted
bonding: Correctly support GSO ESP offload
commit-author Cosmin Ratiu <cratiu@nvidia.com> commit 9e6c4e6 The referenced fix is incomplete. It correctly computes bond_dev->gso_partial_features across slaves, but unfortunately netdev_fix_features discards gso_partial_features from the feature set if NETIF_F_GSO_PARTIAL isn't set in bond_dev->features. This is visible with ethtool -k bond0 | grep esp: tx-esp-segmentation: off [requested on] esp-hw-offload: on esp-tx-csum-hw-offload: on This patch reworks the bonding GSO offload support by: - making aggregating gso_partial_features across slaves similar to the other feature sets (this part is a no-op). - advertising the default partial gso features on empty bond devs, same as with other feature sets (also a no-op). - adding NETIF_F_GSO_PARTIAL to hw_enc_features filtered across slaves. - adding NETIF_F_GSO_PARTIAL to features in bond_setup() With all of these, 'ethtool -k bond0 | grep esp' now reports: tx-esp-segmentation: on esp-hw-offload: on esp-tx-csum-hw-offload: on Fixes: 4861333 ("bonding: add ESP offload features when slaves support") Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com> Acked-by: Jay Vosburgh <jv@jvosburgh.net> Link: https://patch.msgid.link/20250127104147.759658-1-cratiu@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit 9e6c4e6) Signed-off-by: Srinivas Neginhal <sneginhal@google.com>
1 parent 5934ecb commit 9137846

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,17 +1398,20 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
13981398
NETIF_F_HIGHDMA | NETIF_F_LRO)
13991399

14001400
#define BOND_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
1401-
NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE)
1401+
NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE | \
1402+
NETIF_F_GSO_PARTIAL)
14021403

14031404
#define BOND_MPLS_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
14041405
NETIF_F_GSO_SOFTWARE)
14051406

1407+
#define BOND_GSO_PARTIAL_FEATURES (NETIF_F_GSO_ESP)
1408+
14061409

14071410
static void bond_compute_features(struct bonding *bond)
14081411
{
1412+
netdev_features_t gso_partial_features = BOND_GSO_PARTIAL_FEATURES;
14091413
unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
14101414
IFF_XMIT_DST_RELEASE_PERM;
1411-
netdev_features_t gso_partial_features = NETIF_F_GSO_ESP;
14121415
netdev_features_t vlan_features = BOND_VLAN_FEATURES;
14131416
netdev_features_t enc_features = BOND_ENC_FEATURES;
14141417
#ifdef CONFIG_XFRM_OFFLOAD
@@ -1441,8 +1444,9 @@ static void bond_compute_features(struct bonding *bond)
14411444
BOND_XFRM_FEATURES);
14421445
#endif /* CONFIG_XFRM_OFFLOAD */
14431446

1444-
if (slave->dev->hw_enc_features & NETIF_F_GSO_PARTIAL)
1445-
gso_partial_features &= slave->dev->gso_partial_features;
1447+
gso_partial_features = netdev_increment_features(gso_partial_features,
1448+
slave->dev->gso_partial_features,
1449+
BOND_GSO_PARTIAL_FEATURES);
14461450

14471451
mpls_features = netdev_increment_features(mpls_features,
14481452
slave->dev->mpls_features,
@@ -1457,12 +1461,8 @@ static void bond_compute_features(struct bonding *bond)
14571461
}
14581462
bond_dev->hard_header_len = max_hard_header_len;
14591463

1460-
if (gso_partial_features & NETIF_F_GSO_ESP)
1461-
bond_dev->gso_partial_features |= NETIF_F_GSO_ESP;
1462-
else
1463-
bond_dev->gso_partial_features &= ~NETIF_F_GSO_ESP;
1464-
14651464
done:
1465+
bond_dev->gso_partial_features = gso_partial_features;
14661466
bond_dev->vlan_features = vlan_features;
14671467
bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
14681468
NETIF_F_HW_VLAN_CTAG_TX |
@@ -5798,6 +5798,7 @@ void bond_setup(struct net_device *bond_dev)
57985798
bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
57995799
bond_dev->features |= bond_dev->hw_features;
58005800
bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
5801+
bond_dev->features |= NETIF_F_GSO_PARTIAL;
58015802
#ifdef CONFIG_XFRM_OFFLOAD
58025803
bond_dev->hw_features |= BOND_XFRM_FEATURES;
58035804
/* Only enable XFRM features if this is an active-backup config */

0 commit comments

Comments
 (0)