Commit ca5b91d6 authored by Or Gerlitz's avatar Or Gerlitz Committed by Doug Ledford

IB/mlx5: Support RAW Ethernet when RoCE is disabled

On some environments, such as certain SRIOV VF configurations, RoCE is
not supported for mlx5 Ethernet ports. Currently, the driver will not
open IB device on that port.

This is problematic, since we do want user-space RAW Ethernet (RAW_PACKET
QPs) functionality to remain in place. For that end, enhance the relevant
driver flows such that we do create a device instance in that case.
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: default avatarMatan Barak <matanb@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 45f95acd
...@@ -2779,6 +2779,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, ...@@ -2779,6 +2779,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num,
struct ib_port_immutable *immutable) struct ib_port_immutable *immutable)
{ {
struct ib_port_attr attr; struct ib_port_attr attr;
struct mlx5_ib_dev *dev = to_mdev(ibdev);
enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num);
int err; int err;
err = mlx5_ib_query_port(ibdev, port_num, &attr); err = mlx5_ib_query_port(ibdev, port_num, &attr);
...@@ -2788,7 +2790,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, ...@@ -2788,7 +2790,8 @@ static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num,
immutable->pkey_tbl_len = attr.pkey_tbl_len; immutable->pkey_tbl_len = attr.pkey_tbl_len;
immutable->gid_tbl_len = attr.gid_tbl_len; immutable->gid_tbl_len = attr.gid_tbl_len;
immutable->core_cap_flags = get_core_cap_flags(ibdev); immutable->core_cap_flags = get_core_cap_flags(ibdev);
immutable->max_mad_size = IB_MGMT_MAD_SIZE; if ((ll == IB_LINK_LAYER_INFINIBAND) || MLX5_CAP_GEN(dev->mdev, roce))
immutable->max_mad_size = IB_MGMT_MAD_SIZE;
return 0; return 0;
} }
...@@ -2873,9 +2876,11 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev) ...@@ -2873,9 +2876,11 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev)
if (err) if (err)
return err; return err;
err = mlx5_nic_vport_enable_roce(dev->mdev); if (MLX5_CAP_GEN(dev->mdev, roce)) {
if (err) err = mlx5_nic_vport_enable_roce(dev->mdev);
goto err_unregister_netdevice_notifier; if (err)
goto err_unregister_netdevice_notifier;
}
err = mlx5_eth_lag_init(dev); err = mlx5_eth_lag_init(dev);
if (err) if (err)
...@@ -2884,7 +2889,8 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev) ...@@ -2884,7 +2889,8 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev)
return 0; return 0;
err_disable_roce: err_disable_roce:
mlx5_nic_vport_disable_roce(dev->mdev); if (MLX5_CAP_GEN(dev->mdev, roce))
mlx5_nic_vport_disable_roce(dev->mdev);
err_unregister_netdevice_notifier: err_unregister_netdevice_notifier:
mlx5_remove_netdev_notifier(dev); mlx5_remove_netdev_notifier(dev);
...@@ -2894,7 +2900,8 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev) ...@@ -2894,7 +2900,8 @@ static int mlx5_enable_eth(struct mlx5_ib_dev *dev)
static void mlx5_disable_eth(struct mlx5_ib_dev *dev) static void mlx5_disable_eth(struct mlx5_ib_dev *dev)
{ {
mlx5_eth_lag_cleanup(dev); mlx5_eth_lag_cleanup(dev);
mlx5_nic_vport_disable_roce(dev->mdev); if (MLX5_CAP_GEN(dev->mdev, roce))
mlx5_nic_vport_disable_roce(dev->mdev);
} }
static void mlx5_ib_dealloc_q_counters(struct mlx5_ib_dev *dev) static void mlx5_ib_dealloc_q_counters(struct mlx5_ib_dev *dev)
...@@ -3016,9 +3023,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) ...@@ -3016,9 +3023,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
port_type_cap = MLX5_CAP_GEN(mdev, port_type); port_type_cap = MLX5_CAP_GEN(mdev, port_type);
ll = mlx5_port_type_cap_to_rdma_ll(port_type_cap); ll = mlx5_port_type_cap_to_rdma_ll(port_type_cap);
if ((ll == IB_LINK_LAYER_ETHERNET) && !MLX5_CAP_GEN(mdev, roce))
return NULL;
printk_once(KERN_INFO "%s", mlx5_version); printk_once(KERN_INFO "%s", mlx5_version);
dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev)); dev = (struct mlx5_ib_dev *)ib_alloc_device(sizeof(*dev));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment