Skip to content

Commit a5e400a

Browse files
rleonSaeed Mahameed
authored andcommitted
net/mlx5e: Honor user choice of IPsec replay window size
Users can configure IPsec replay window size, but mlx5 driver didn't honor their choice and set always 32bits. Fix assignment logic to configure right size from the beginning. Fixes: 7db21ef ("net/mlx5e: Set IPsec replay sequence numbers") Reviewed-by: Patrisious Haddad <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 37e4b8d commit a5e400a

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,27 @@ void mlx5e_ipsec_build_accel_xfrm_attrs(struct mlx5e_ipsec_sa_entry *sa_entry,
335335
attrs->replay_esn.esn = sa_entry->esn_state.esn;
336336
attrs->replay_esn.esn_msb = sa_entry->esn_state.esn_msb;
337337
attrs->replay_esn.overlap = sa_entry->esn_state.overlap;
338+
switch (x->replay_esn->replay_window) {
339+
case 32:
340+
attrs->replay_esn.replay_window =
341+
MLX5_IPSEC_ASO_REPLAY_WIN_32BIT;
342+
break;
343+
case 64:
344+
attrs->replay_esn.replay_window =
345+
MLX5_IPSEC_ASO_REPLAY_WIN_64BIT;
346+
break;
347+
case 128:
348+
attrs->replay_esn.replay_window =
349+
MLX5_IPSEC_ASO_REPLAY_WIN_128BIT;
350+
break;
351+
case 256:
352+
attrs->replay_esn.replay_window =
353+
MLX5_IPSEC_ASO_REPLAY_WIN_256BIT;
354+
break;
355+
default:
356+
WARN_ON(true);
357+
return;
358+
}
338359
}
339360

340361
attrs->dir = x->xso.dir;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static void mlx5e_ipsec_packet_setup(void *obj, u32 pdn,
9595

9696
if (attrs->dir == XFRM_DEV_OFFLOAD_IN) {
9797
MLX5_SET(ipsec_aso, aso_ctx, window_sz,
98-
attrs->replay_esn.replay_window / 64);
98+
attrs->replay_esn.replay_window);
9999
MLX5_SET(ipsec_aso, aso_ctx, mode,
100100
MLX5_IPSEC_ASO_REPLAY_PROTECTION);
101101
}

include/linux/mlx5/mlx5_ifc.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12001,6 +12001,13 @@ enum {
1200112001
MLX5_IPSEC_ASO_INC_SN = 0x2,
1200212002
};
1200312003

12004+
enum {
12005+
MLX5_IPSEC_ASO_REPLAY_WIN_32BIT = 0x0,
12006+
MLX5_IPSEC_ASO_REPLAY_WIN_64BIT = 0x1,
12007+
MLX5_IPSEC_ASO_REPLAY_WIN_128BIT = 0x2,
12008+
MLX5_IPSEC_ASO_REPLAY_WIN_256BIT = 0x3,
12009+
};
12010+
1200412011
struct mlx5_ifc_ipsec_aso_bits {
1200512012
u8 valid[0x1];
1200612013
u8 reserved_at_201[0x1];

0 commit comments

Comments
 (0)