diff mbox series

[SRU,F,1/1,v2] net/mlx5e: Add missing capability check for uplink follow

Message ID 20210326165908.1061838-2-frank.heimes@canonical.com
State New
Headers show
Series [SRU,F,1/1,v2] net/mlx5e: Add missing capability check for uplink follow | expand

Commit Message

Frank Heimes March 26, 2021, 4:59 p.m. UTC
From: Aya Levin <ayal@nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/1921104

Expose firmware indication that it supports setting eswitch uplink state
to follow (follow the physical link). Condition setting the eswitch
uplink admin-state with this capability bit. Older FW may not support
the uplink state setting.

Fixes: 7d0314b11cdd ("net/mlx5e: Modify uplink state on interface up/down")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Reported-and-Tested-by: Alexander Schmidt <alexschm@de.ibm.com>
(backported from commit 9c9be85f6b59d80efe4705109c0396df18d4e11d)
Signed-off-by: Alexander Schmidt <alexschm@de.ibm.com>
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>

---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 ++-
 include/linux/mlx5/mlx5_ifc.h                     | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 24fc71116f48..96c8aa4c94a5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3093,7 +3093,8 @@  static void mlx5e_modify_admin_state(struct mlx5_core_dev *mdev,
 
 	mlx5_set_port_admin_status(mdev, state);
 
-	if (!MLX5_ESWITCH_MANAGER(mdev) ||  mlx5_eswitch_mode(esw) == MLX5_ESWITCH_OFFLOADS)
+	if (!MLX5_ESWITCH_MANAGER(mdev) || mlx5_eswitch_mode(esw) == MLX5_ESWITCH_OFFLOADS ||
+	    !MLX5_CAP_GEN(mdev, uplink_follow))
 		return;
 
 	if (state == MLX5_PORT_UP)
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 75e5a7fe341f..33976b0d5d5e 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1160,7 +1160,9 @@  struct mlx5_ifc_cmd_hca_cap_bits {
 
 	u8         reserved_at_a0[0xb];
 	u8         log_max_srq[0x5];
-	u8         reserved_at_b0[0x10];
+	u8         reserved_at_b0[0x1];
+	u8         uplink_follow[0x1];
+	u8         reserved_at_b2[0xe];
 
 	u8         reserved_at_c0[0x8];
 	u8         log_max_cq_sz[0x8];