net/mlx5e: Add missing capability check for uplink follow
authorAya Levin <ayal@nvidia.com>
Tue, 24 Nov 2020 20:16:23 +0000 (22:16 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 7 Jan 2021 20:22:48 +0000 (12:22 -0800)
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>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
include/linux/mlx5/mlx5_ifc.h

index 7a79d330c0751f6e6be3c88c483326274f84f993..6a852b4901aa0a742989d9882b37f21f07108750 100644 (file)
@@ -3161,7 +3161,8 @@ static void mlx5e_modify_admin_state(struct mlx5_core_dev *mdev,
 
        mlx5_set_port_admin_status(mdev, state);
 
-       if (mlx5_eswitch_mode(mdev) != MLX5_ESWITCH_LEGACY)
+       if (mlx5_eswitch_mode(mdev) == MLX5_ESWITCH_OFFLOADS ||
+           !MLX5_CAP_GEN(mdev, uplink_follow))
                return;
 
        if (state == MLX5_PORT_UP)
index 8fbddec26eb8c994713ddc3cd2a0ebd69cd479d6..442c0160caab52ac07e94ddeab6581d46b5ad248 100644 (file)
@@ -1280,7 +1280,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
        u8         ece_support[0x1];
        u8         reserved_at_a4[0x7];
        u8         log_max_srq[0x5];
-       u8         reserved_at_b0[0x2];
+       u8         reserved_at_b0[0x1];
+       u8         uplink_follow[0x1];
        u8         ts_cqe_to_dest_cqn[0x1];
        u8         reserved_at_b3[0xd];