History

Revert "net/mlx5e: MACsec, remove replay window size limitation in offload path"

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.

Saeed Mahameed committed 3 years ago

Commit dda3bbb1 parent e493bec2 files · +23 −0Browse files

Unified · Split

2 files
  1. drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +16 −0
  2. include/linux/mlx5/mlx5_ifc.h +7 −0
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c+16−0
@@ -229,6 +229,22 @@ static int macsec_set_replay_protection(struct mlx5_macsec_obj_attrs *attrs, voi · 228 unmodified lines
229229 if (!attrs->replay_protect)
230230 return 0;
231231
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+ }
232248 MLX5_SET(macsec_aso, aso_ctx, window_size, window_sz);
233249 MLX5_SET(macsec_aso, aso_ctx, mode, MLX5_MACSEC_ASO_REPLAY_PROTECTION);
234250
include/linux/mlx5/mlx5_ifc.h+7−0
@@ -11611,6 +11611,13 @@ enum { · 11610 unmodified lines
1161111611 MLX5_MACSEC_ASO_REPLAY_PROTECTION = 0x1,
1161211612 };
1161311613
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+
1161411621 #define MLX5_MACSEC_ASO_INC_SN 0x2
1161511622 #define MLX5_MACSEC_ASO_REG_C_4_5 0x2
1161611623