Skip to content

Commit 4906ef3

Browse files
committed
Merge: [bonding]tx-esp-segmentation can't be enabled on bonding
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6350 JIRA: https://issues.redhat.com/browse/RHEL-75544 ``` 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]> (cherry picked from commit 9e6c4e6) ``` Signed-off-by: CKI Backport Bot <[email protected]> --- <small>Created 2025-02-06 02:44 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://gitlab.com/cki-project/kernel-workflow/-/issues/new?issue%5Btitle%5D=backporter%20webhook%20issue)</small> Approved-by: Xin Long <[email protected]> Approved-by: José Ignacio Tornos Martínez <[email protected]> Approved-by: Kamal Heib <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Augusto Caringi <[email protected]>
2 parents 19e4d87 + 8b6a25d commit 4906ef3

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

15411541
#define BOND_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
1542-
NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE)
1542+
NETIF_F_RXCSUM | NETIF_F_GSO_SOFTWARE | \
1543+
NETIF_F_GSO_PARTIAL)
15431544

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

1548+
#define BOND_GSO_PARTIAL_FEATURES (NETIF_F_GSO_ESP)
1549+
15471550

15481551
static void bond_compute_features(struct bonding *bond)
15491552
{
1553+
netdev_features_t gso_partial_features = BOND_GSO_PARTIAL_FEATURES;
15501554
unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
15511555
IFF_XMIT_DST_RELEASE_PERM;
1552-
netdev_features_t gso_partial_features = NETIF_F_GSO_ESP;
15531556
netdev_features_t vlan_features = BOND_VLAN_FEATURES;
15541557
netdev_features_t enc_features = BOND_ENC_FEATURES;
15551558
#ifdef CONFIG_XFRM_OFFLOAD
@@ -1583,8 +1586,9 @@ static void bond_compute_features(struct bonding *bond)
15831586
BOND_XFRM_FEATURES);
15841587
#endif /* CONFIG_XFRM_OFFLOAD */
15851588

1586-
if (slave->dev->hw_enc_features & NETIF_F_GSO_PARTIAL)
1587-
gso_partial_features &= slave->dev->gso_partial_features;
1589+
gso_partial_features = netdev_increment_features(gso_partial_features,
1590+
slave->dev->gso_partial_features,
1591+
BOND_GSO_PARTIAL_FEATURES);
15881592

15891593
mpls_features = netdev_increment_features(mpls_features,
15901594
slave->dev->mpls_features,
@@ -1599,12 +1603,8 @@ static void bond_compute_features(struct bonding *bond)
15991603
}
16001604
bond_dev->hard_header_len = max_hard_header_len;
16011605

1602-
if (gso_partial_features & NETIF_F_GSO_ESP)
1603-
bond_dev->gso_partial_features |= NETIF_F_GSO_ESP;
1604-
else
1605-
bond_dev->gso_partial_features &= ~NETIF_F_GSO_ESP;
1606-
16071606
done:
1607+
bond_dev->gso_partial_features = gso_partial_features;
16081608
bond_dev->vlan_features = vlan_features;
16091609
bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
16101610
NETIF_F_HW_VLAN_CTAG_TX |
@@ -6037,6 +6037,7 @@ void bond_setup(struct net_device *bond_dev)
60376037
bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
60386038
bond_dev->features |= bond_dev->hw_features;
60396039
bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
6040+
bond_dev->features |= NETIF_F_GSO_PARTIAL;
60406041
#ifdef CONFIG_XFRM_OFFLOAD
60416042
bond_dev->hw_features |= BOND_XFRM_FEATURES;
60426043
/* Only enable XFRM features if this is an active-backup config */

0 commit comments

Comments
 (0)