Skip to content

Commit 9e6c4e6

Browse files
Cosmin RatiuPaolo Abeni
authored andcommitted
bonding: Correctly support GSO ESP offload
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 <[email protected]> Signed-off-by: Cosmin Ratiu <[email protected]> Acked-by: Jay Vosburgh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 740a3e7 commit 9e6c4e6

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
@@ -1538,17 +1538,20 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
15381538
NETIF_F_HIGHDMA | NETIF_F_LRO)
15391539

15401540
#define BOND_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
1541-
NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE)
1541+
NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE | \
1542+
NETIF_F_GSO_PARTIAL)
15421543

15431544
#define BOND_MPLS_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
15441545
NETIF_F_GSO_SOFTWARE)
15451546

1547+
#define BOND_GSO_PARTIAL_FEATURES (NETIF_F_GSO_ESP)
1548+
15461549

15471550
static void bond_compute_features(struct bonding *bond)
15481551
{
1552+
netdev_features_t gso_partial_features = BOND_GSO_PARTIAL_FEATURES;
15491553
unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
15501554
IFF_XMIT_DST_RELEASE_PERM;
1551-
netdev_features_t gso_partial_features = NETIF_F_GSO_ESP;
15521555
netdev_features_t vlan_features = BOND_VLAN_FEATURES;
15531556
netdev_features_t enc_features = BOND_ENC_FEATURES;
15541557
#ifdef CONFIG_XFRM_OFFLOAD
@@ -1582,8 +1585,9 @@ static void bond_compute_features(struct bonding *bond)
15821585
BOND_XFRM_FEATURES);
15831586
#endif /* CONFIG_XFRM_OFFLOAD */
15841587

1585-
if (slave->dev->hw_enc_features & NETIF_F_GSO_PARTIAL)
1586-
gso_partial_features &= slave->dev->gso_partial_features;
1588+
gso_partial_features = netdev_increment_features(gso_partial_features,
1589+
slave->dev->gso_partial_features,
1590+
BOND_GSO_PARTIAL_FEATURES);
15871591

15881592
mpls_features = netdev_increment_features(mpls_features,
15891593
slave->dev->mpls_features,
@@ -1598,12 +1602,8 @@ static void bond_compute_features(struct bonding *bond)
15981602
}
15991603
bond_dev->hard_header_len = max_hard_header_len;
16001604

1601-
if (gso_partial_features & NETIF_F_GSO_ESP)
1602-
bond_dev->gso_partial_features |= NETIF_F_GSO_ESP;
1603-
else
1604-
bond_dev->gso_partial_features &= ~NETIF_F_GSO_ESP;
1605-
16061605
done:
1606+
bond_dev->gso_partial_features = gso_partial_features;
16071607
bond_dev->vlan_features = vlan_features;
16081608
bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
16091609
NETIF_F_HW_VLAN_CTAG_TX |
@@ -6046,6 +6046,7 @@ void bond_setup(struct net_device *bond_dev)
60466046
bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
60476047
bond_dev->features |= bond_dev->hw_features;
60486048
bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
6049+
bond_dev->features |= NETIF_F_GSO_PARTIAL;
60496050
#ifdef CONFIG_XFRM_OFFLOAD
60506051
bond_dev->hw_features |= BOND_XFRM_FEATURES;
60516052
/* Only enable XFRM features if this is an active-backup config */

0 commit comments

Comments
 (0)