Skip to content

Commit de47db0

Browse files
raed-salemSaeed Mahameed
authored andcommitted
net/mlx5e: IPsec: Fix tunnel mode crypto offload for non TCP/UDP traffic
IPsec Tunnel mode crypto offload software parser (SWP) setting in data path currently always set the inner L4 offset regardless of the encapsulated L4 header type and whether it exists in the first place, this breaks non TCP/UDP traffic as such. Set the SWP inner L4 offset only when the IPsec tunnel encapsulated L4 header protocol is TCP/UDP. While at it fix inner ip protocol read for setting MLX5_ETH_WQE_SWP_INNER_L4_UDP flag to address the case where the ip header protocol is IPv6. Fixes: f126779 ("net/mlx5: Fix checksum issue of VXLAN and IPsec crypto offload") Signed-off-by: Raed Salem <[email protected]> Reviewed-by: Maor Dickman <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 5352859 commit de47db0

File tree

1 file changed

+11
-2
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en_accel

1 file changed

+11
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,20 @@ static void mlx5e_ipsec_set_swp(struct sk_buff *skb,
157157
/* Tunnel mode */
158158
if (mode == XFRM_MODE_TUNNEL) {
159159
eseg->swp_inner_l3_offset = skb_inner_network_offset(skb) / 2;
160-
eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2;
161160
if (xo->proto == IPPROTO_IPV6)
162161
eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L3_IPV6;
163-
if (inner_ip_hdr(skb)->protocol == IPPROTO_UDP)
162+
163+
switch (xo->inner_ipproto) {
164+
case IPPROTO_UDP:
164165
eseg->swp_flags |= MLX5_ETH_WQE_SWP_INNER_L4_UDP;
166+
fallthrough;
167+
case IPPROTO_TCP:
168+
/* IP | ESP | IP | [TCP | UDP] */
169+
eseg->swp_inner_l4_offset = skb_inner_transport_offset(skb) / 2;
170+
break;
171+
default:
172+
break;
173+
}
165174
return;
166175
}
167176

0 commit comments

Comments
 (0)