Skip to content

Commit 5352859

Browse files
raed-salemSaeed Mahameed
authored andcommitted
net/mlx5e: IPsec: Fix crypto offload for non TCP/UDP encapsulated traffic
IPsec crypto offload always set the ethernet segment checksum flags with the inner L4 header checksum flag enabled for encapsulated IPsec offloaded packet regardless of the encapsulated L4 header type, and even if it doesn't exists in the first place, this breaks non TCP/UDP traffic as such. Set the inner L4 checksum flag only when the encapsulated L4 header protocol is TCP/UDP using software parser swp_inner_l4_offset field as indication. Fixes: 5cfb540 ("net/mlx5e: Set IPsec WAs only in IP's non checksum partial case.") Signed-off-by: Raed Salem <[email protected]> Reviewed-by: Maor Dickman <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 736dfe4 commit 5352859

File tree

1 file changed

+6
-3
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en_accel

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,17 @@ static inline bool
131131
mlx5e_ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
132132
struct mlx5_wqe_eth_seg *eseg)
133133
{
134-
struct xfrm_offload *xo = xfrm_offload(skb);
134+
u8 inner_ipproto;
135135

136136
if (!mlx5e_ipsec_eseg_meta(eseg))
137137
return false;
138138

139139
eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM;
140-
if (xo->inner_ipproto) {
141-
eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM | MLX5_ETH_WQE_L3_INNER_CSUM;
140+
inner_ipproto = xfrm_offload(skb)->inner_ipproto;
141+
if (inner_ipproto) {
142+
eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM;
143+
if (inner_ipproto == IPPROTO_TCP || inner_ipproto == IPPROTO_UDP)
144+
eseg->cs_flags |= MLX5_ETH_WQE_L4_INNER_CSUM;
142145
} else if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
143146
eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;
144147
sq->stats->csum_partial_inner++;

0 commit comments

Comments
 (0)