Skip to content

Commit 5934ecb

Browse files
sneginhaPlaidCat
authored andcommitted
bonding: add ESP offload features when slaves support
commit-author Jianbo Liu <jianbol@nvidia.com> commit 4861333 Add NETIF_F_GSO_ESP bit to bond's gso_partial_features if all slaves support it, such that ESP segmentation is handled by hardware if possible. Signed-off-by: Jianbo Liu <jianbol@nvidia.com> Reviewed-by: Boris Pismenny <borisp@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20241105192721.584822-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> (cherry picked from commit 4861333) Signed-off-by: Srinivas Neginhal <sneginhal@google.com>
1 parent 00adedc commit 5934ecb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,7 @@ static void bond_compute_features(struct bonding *bond)
14081408
{
14091409
unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
14101410
IFF_XMIT_DST_RELEASE_PERM;
1411+
netdev_features_t gso_partial_features = NETIF_F_GSO_ESP;
14111412
netdev_features_t vlan_features = BOND_VLAN_FEATURES;
14121413
netdev_features_t enc_features = BOND_ENC_FEATURES;
14131414
#ifdef CONFIG_XFRM_OFFLOAD
@@ -1440,6 +1441,9 @@ static void bond_compute_features(struct bonding *bond)
14401441
BOND_XFRM_FEATURES);
14411442
#endif /* CONFIG_XFRM_OFFLOAD */
14421443

1444+
if (slave->dev->hw_enc_features & NETIF_F_GSO_PARTIAL)
1445+
gso_partial_features &= slave->dev->gso_partial_features;
1446+
14431447
mpls_features = netdev_increment_features(mpls_features,
14441448
slave->dev->mpls_features,
14451449
BOND_MPLS_FEATURES);
@@ -1453,6 +1457,11 @@ static void bond_compute_features(struct bonding *bond)
14531457
}
14541458
bond_dev->hard_header_len = max_hard_header_len;
14551459

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+
14561465
done:
14571466
bond_dev->vlan_features = vlan_features;
14581467
bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |

0 commit comments

Comments
 (0)