diff mbox series

[net,1/3] net/mlx5: Fix setting of devlink traps in switchdev mode

Message ID 20210414231610.136376-2-saeed@kernel.org
State New
Headers show
Series Fix ipsec offlaods with vxlan tunnel | expand

Commit Message

Saeed Mahameed April 14, 2021, 11:16 p.m. UTC
From: Aya Levin <ayal@nvidia.com>

Prevent setting of devlink traps on the uplink while in switchdev mode.
In this mode, it is the SW switch responsibility to handle both packets
with a mismatch in destination MAC or VLAN ID. Therefore, there are no
flow steering tables to trap undesirable packets and driver crashes upon
setting a trap.

Fixes: 241dc159391f ("net/mlx5: Notify on trap action by blocking event")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

patchwork-bot+netdevbpf@kernel.org April 15, 2021, 11:50 p.m. UTC | #1
Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Wed, 14 Apr 2021 16:16:08 -0700 you wrote:
> From: Aya Levin <ayal@nvidia.com>

> 

> Prevent setting of devlink traps on the uplink while in switchdev mode.

> In this mode, it is the SW switch responsibility to handle both packets

> with a mismatch in destination MAC or VLAN ID. Therefore, there are no

> flow steering tables to trap undesirable packets and driver crashes upon

> setting a trap.

> 

> [...]


Here is the summary with links:
  - [net,1/3] net/mlx5: Fix setting of devlink traps in switchdev mode
    https://git.kernel.org/netdev/net/c/41bafb31dcd5
  - [net,2/3] net/mlx5e: Fix setting of RS FEC mode
    https://git.kernel.org/netdev/net/c/7a320c9db3e7
  - [net,3/3] net/mlx5e: fix ingress_ifindex check in mlx5e_flower_parse_meta
    https://git.kernel.org/netdev/net/c/e3e0f9b27970

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
index d7d8a68ef23d..d0f9d3cee97d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
@@ -246,6 +246,11 @@  static int mlx5_devlink_trap_action_set(struct devlink *devlink,
 	struct mlx5_devlink_trap *dl_trap;
 	int err = 0;
 
+	if (is_mdev_switchdev_mode(dev)) {
+		NL_SET_ERR_MSG_MOD(extack, "Devlink traps can't be set in switchdev mode");
+		return -EOPNOTSUPP;
+	}
+
 	dl_trap = mlx5_find_trap_by_id(dev, trap->id);
 	if (!dl_trap) {
 		mlx5_core_err(dev, "Devlink trap: Set action on invalid trap id 0x%x", trap->id);