Skip to content

Commit 4861333

Browse files
Jianbo Liukuba-moo
authored andcommitted
bonding: add ESP offload features when slaves support
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 <[email protected]> Reviewed-by: Boris Pismenny <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4592de8 commit 4861333

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
@@ -1545,6 +1545,7 @@ static void bond_compute_features(struct bonding *bond)
15451545
{
15461546
unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE |
15471547
IFF_XMIT_DST_RELEASE_PERM;
1548+
netdev_features_t gso_partial_features = NETIF_F_GSO_ESP;
15481549
netdev_features_t vlan_features = BOND_VLAN_FEATURES;
15491550
netdev_features_t enc_features = BOND_ENC_FEATURES;
15501551
#ifdef CONFIG_XFRM_OFFLOAD
@@ -1577,6 +1578,9 @@ static void bond_compute_features(struct bonding *bond)
15771578
BOND_XFRM_FEATURES);
15781579
#endif /* CONFIG_XFRM_OFFLOAD */
15791580

1581+
if (slave->dev->hw_enc_features & NETIF_F_GSO_PARTIAL)
1582+
gso_partial_features &= slave->dev->gso_partial_features;
1583+
15801584
mpls_features = netdev_increment_features(mpls_features,
15811585
slave->dev->mpls_features,
15821586
BOND_MPLS_FEATURES);
@@ -1590,6 +1594,11 @@ static void bond_compute_features(struct bonding *bond)
15901594
}
15911595
bond_dev->hard_header_len = max_hard_header_len;
15921596

1597+
if (gso_partial_features & NETIF_F_GSO_ESP)
1598+
bond_dev->gso_partial_features |= NETIF_F_GSO_ESP;
1599+
else
1600+
bond_dev->gso_partial_features &= ~NETIF_F_GSO_ESP;
1601+
15931602
done:
15941603
bond_dev->vlan_features = vlan_features;
15951604
bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |

0 commit comments

Comments
 (0)