This reverts commit c0071be0e16c461680d87b763ba1ee5e46548fde. The cited commit removed the validity checks which initialized the window_sz and never removed the use of the now uninitialized variable, so now we are left with wrong value in the window size and the following clang warning: [-Wuninitialized] drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c:232:45: warning: variable 'window_sz' is uninitialized when used here MLX5_SET(macsec_aso, aso_ctx, window_size, window_sz); Revet at this time to address the clang issue due to lack of time to test the proper solution.
Unified · Split
| @@ -229,6 +229,22 @@ static int macsec_set_replay_protection(struct mlx5_macsec_obj_attrs *attrs, voi · 228 unmodified lines | ||
| 229 | 229 | if (!attrs->replay_protect) |
| 230 | 230 | return 0; |
| 231 | 231 | |
| 232 | + switch (attrs->replay_window) { | |
| 233 | + case 256: | |
| 234 | + window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_256BIT; | |
| 235 | + break; | |
| 236 | + case 128: | |
| 237 | + window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_128BIT; | |
| 238 | + break; | |
| 239 | + case 64: | |
| 240 | + window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_64BIT; | |
| 241 | + break; | |
| 242 | + case 32: | |
| 243 | + window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_32BIT; | |
| 244 | + break; | |
| 245 | + default: | |
| 246 | + return -EINVAL; | |
| 247 | + } | |
| 232 | 248 | MLX5_SET(macsec_aso, aso_ctx, window_size, window_sz); |
| 233 | 249 | MLX5_SET(macsec_aso, aso_ctx, mode, MLX5_MACSEC_ASO_REPLAY_PROTECTION); |
| 234 | 250 | |
| @@ -11611,6 +11611,13 @@ enum { · 11610 unmodified lines | ||
| 11611 | 11611 | MLX5_MACSEC_ASO_REPLAY_PROTECTION = 0x1, |
| 11612 | 11612 | }; |
| 11613 | 11613 | |
| 11614 | +enum { | |
| 11615 | + MLX5_MACSEC_ASO_REPLAY_WIN_32BIT = 0x0, | |
| 11616 | + MLX5_MACSEC_ASO_REPLAY_WIN_64BIT = 0x1, | |
| 11617 | + MLX5_MACSEC_ASO_REPLAY_WIN_128BIT = 0x2, | |
| 11618 | + MLX5_MACSEC_ASO_REPLAY_WIN_256BIT = 0x3, | |
| 11619 | +}; | |
| 11620 | + | |
| 11614 | 11621 | #define MLX5_MACSEC_ASO_INC_SN 0x2 |
| 11615 | 11622 | #define MLX5_MACSEC_ASO_REG_C_4_5 0x2 |
| 11616 | 11623 | |