Skip to content

Commit 5cfb540

Browse files
Huy NguyenSaeed Mahameed
authored andcommitted
net/mlx5e: Set IPsec WAs only in IP's non checksum partial case.
The IP's checksum partial still requires L4 csum flag on Ethernet WQE. Make the IPsec WAs only for the IP's non checksum partial case (for example icmd packet) Fixes: 5be0190 ("net/mlx5e: IPsec: Add Connect-X IPsec Tx data path offload") Signed-off-by: Huy Nguyen <huyn@mellanox.com> Reviewed-by: Raed Salem <raeds@nvidia.com> Reviewed-by: Alaa Hleihel <alaa@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent ea63609 commit 5cfb540

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core

drivers/net/ethernet/mellanox/mlx5/core/en_tx.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ static inline void mlx5e_insert_vlan(void *start, struct sk_buff *skb, u16 ihs)
144144
memcpy(&vhdr->h_vlan_encapsulated_proto, skb->data + cpy1_sz, cpy2_sz);
145145
}
146146

147-
/* RM 2311217: no L4 inner checksum for IPsec tunnel type packet */
147+
/* If packet is not IP's CHECKSUM_PARTIAL (e.g. icmd packet),
148+
* need to set L3 checksum flag for IPsec
149+
*/
148150
static void
149151
ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
150152
struct mlx5_wqe_eth_seg *eseg)
@@ -154,19 +156,13 @@ ipsec_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb,
154156
eseg->cs_flags |= MLX5_ETH_WQE_L3_INNER_CSUM;
155157
sq->stats->csum_partial_inner++;
156158
} else {
157-
eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;
158159
sq->stats->csum_partial++;
159160
}
160161
}
161162

162163
static inline void
163164
mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb, struct mlx5_wqe_eth_seg *eseg)
164165
{
165-
if (unlikely(eseg->flow_table_metadata & cpu_to_be32(MLX5_ETH_WQE_FT_META_IPSEC))) {
166-
ipsec_txwqe_build_eseg_csum(sq, skb, eseg);
167-
return;
168-
}
169-
170166
if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
171167
eseg->cs_flags = MLX5_ETH_WQE_L3_CSUM;
172168
if (skb->encapsulation) {
@@ -177,6 +173,9 @@ mlx5e_txwqe_build_eseg_csum(struct mlx5e_txqsq *sq, struct sk_buff *skb, struct
177173
eseg->cs_flags |= MLX5_ETH_WQE_L4_CSUM;
178174
sq->stats->csum_partial++;
179175
}
176+
} else if (unlikely(eseg->flow_table_metadata & cpu_to_be32(MLX5_ETH_WQE_FT_META_IPSEC))) {
177+
ipsec_txwqe_build_eseg_csum(sq, skb, eseg);
178+
180179
} else
181180
sq->stats->csum_none++;
182181
}

0 commit comments

Comments
 (0)