Skip to contentSkip to conversation

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

PATCH Applied Saeed Mahameed 2 participants 3 messages Nov 29, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

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

From: Saeed Mahameed <[email protected]>

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.

Fixes c0071be0e16c ("net/mlx5e: MACsec, remove replay window size limitation in offload path")
---
 .../mellanox/mlx5/core/en_accel/macsec.c         | 16 ++++++++++++++++
 include/linux/mlx5/mlx5_ifc.h                    |  7 +++++++
 2 files changed, 23 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +16 -0
index 0d6dc394a12a..f900709639f6 100644
@@ -229,6 +229,22 @@ static int macsec_set_replay_protection(struct mlx5_macsec_obj_attrs *attrs, voi
 	if (!attrs->replay_protect)
 		return 0;
 
+	switch (attrs->replay_window) {
+	case 256:
+		window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_256BIT;
+		break;
+	case 128:
+		window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_128BIT;
+		break;
+	case 64:
+		window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_64BIT;
+		break;
+	case 32:
+		window_sz = MLX5_MACSEC_ASO_REPLAY_WIN_32BIT;
+		break;
+	default:
+		return -EINVAL;
+	}
 	MLX5_SET(macsec_aso, aso_ctx, window_size, window_sz);
 	MLX5_SET(macsec_aso, aso_ctx, mode, MLX5_MACSEC_ASO_REPLAY_PROTECTION);
 
include/linux/mlx5/mlx5_ifc.h +7 -0
index 981fc7dfa408..5a4e914e2a6f 100644
@@ -11611,6 +11611,13 @@ enum {
 	MLX5_MACSEC_ASO_REPLAY_PROTECTION = 0x1,
 };
 
+enum {
+	MLX5_MACSEC_ASO_REPLAY_WIN_32BIT  = 0x0,
+	MLX5_MACSEC_ASO_REPLAY_WIN_64BIT  = 0x1,
+	MLX5_MACSEC_ASO_REPLAY_WIN_128BIT = 0x2,
+	MLX5_MACSEC_ASO_REPLAY_WIN_256BIT = 0x3,
+};
+
 #define MLX5_MACSEC_ASO_INC_SN  0x2
 #define MLX5_MACSEC_ASO_REG_C_4_5 0x2
 
Signature · 1 line
2.38.1
#1 lore raw

PATCH 2/2 net/mlx5: Lag, Fix for loop when checking lag

From: Chris Mi <[email protected]>

The cited commit adds a for loop to check if each port supports lag or not. But dev is not initialized correctly. Fix it by initializing dev for each iteration.

Fixes e87c6a832f88 ("net/mlx5: E-switch, Fix duplicate lag creation")
---
 drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +4 -2
index 4070dc1d17cb..32c3e0a649a7 100644
@@ -700,11 +700,13 @@ static bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
 			return false;
 
 #ifdef CONFIG_MLX5_ESWITCH
-	dev = ldev->pf[MLX5_LAG_P1].dev;
-	for (i = 0; i  < ldev->ports; i++)
+	for (i = 0; i < ldev->ports; i++) {
+		dev = ldev->pf[i].dev;
 		if (mlx5_eswitch_num_vfs(dev->priv.eswitch) && !is_mdev_switchdev_mode(dev))
 			return false;
+	}
 
+	dev = ldev->pf[MLX5_LAG_P1].dev;
 	mode = mlx5_eswitch_mode(dev);
 	for (i = 0; i < ldev->ports; i++)
 		if (mlx5_eswitch_mode(ldev->pf[i].dev) != mode)
Signature · 1 line
2.38.1
#2 lore raw
In reply to Saeed Mahameed
This series was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Quoted 12 lines · On Tue, 29 Nov 2022 01:30:05 -0800 you wrote:

From: Saeed Mahameed <[email protected]>

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);

Quoted 1 line

[...]

Here is the summary with links:
- [net,1/2] Revert "net/mlx5e: MACsec, remove replay window size limitation in offload path"

    https://git.kernel.org/netdev/net/c/dda3bbbb26c8
  - [net,2/2] net/mlx5: Lag, Fix for loop when checking lag
    https://git.kernel.org/netdev/net/c/0e682f04b4b5

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html