From: Jianbo Liu The ESN paths rebuild a full set of attrs from the xfrm state, and mlx5_accel_esp_modify_xfrm() copies all of them over sa_entry->attrs although the hardware modify changes only the ESN fields. The rebuilt attrs do not carry what changed at run time, so an ESN update undoes: - attrs.drop, set when the lifetime worker expires the SA; - lft.soft_packet_limit, reset by mlx5e_ipsec_handle_limits(); - the MACs and the drop state programmed by the neighbour event worker, which runs on the same unbound workqueue and can also race the copy. The software state then differs from the installed rules. Copy back only replay_esn. Discovered by code inspection in review of the next patch. Not reproduced. The ESN update was tested on ConnectX-7 (fw 28.48.1000) with SAs starting just below sequence number 2^31 and 2^32: no loss across either boundary. Fixes: b2f7b01d36a9 ("net/mlx5e: Simulate missing IPsec TX limits hardware functionality") Fixes: d05971a413d3 ("net/mlx5e: Add SW implementation to support IPsec 64 bit soft and hard limits") Fixes: 4c24272b4e2b ("net/mlx5e: Listen to ARP events to update IPsec L2 headers in tunnel mode") Signed-off-by: Jianbo Liu Reviewed-by: Cosmin Ratiu Signed-off-by: Tariq Toukan --- .../net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c index 1f03465762e0..5182a79b0e99 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_offload.c @@ -299,7 +299,7 @@ void mlx5_accel_esp_modify_xfrm(struct mlx5e_ipsec_sa_entry *sa_entry, if (err) return; - memcpy(&sa_entry->attrs, attrs, sizeof(sa_entry->attrs)); + sa_entry->attrs.replay_esn = attrs->replay_esn; } static void mlx5e_ipsec_aso_update(struct mlx5e_ipsec_sa_entry *sa_entry, -- 2.44.0