IB/mlx4: Do not allow APM under RoCE
Automatic Path Migration is not supported under RoCE. Therefore, return a "not-supported" error if the caller attempts to set an alternate path in a QP context. In addition, if there are no IB ports configured, do not report APM capability in the device flags returned by mlx4_ib_query_device. Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
parent
d24d9f4338
commit
3dec487888
@ -120,6 +120,17 @@ static int check_flow_steering_support(struct mlx4_dev *dev)
|
|||||||
return dmfs;
|
return dmfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int num_ib_ports(struct mlx4_dev *dev)
|
||||||
|
{
|
||||||
|
int ib_ports = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
|
||||||
|
ib_ports++;
|
||||||
|
|
||||||
|
return ib_ports;
|
||||||
|
}
|
||||||
|
|
||||||
static int mlx4_ib_query_device(struct ib_device *ibdev,
|
static int mlx4_ib_query_device(struct ib_device *ibdev,
|
||||||
struct ib_device_attr *props)
|
struct ib_device_attr *props)
|
||||||
{
|
{
|
||||||
@ -127,6 +138,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
|
|||||||
struct ib_smp *in_mad = NULL;
|
struct ib_smp *in_mad = NULL;
|
||||||
struct ib_smp *out_mad = NULL;
|
struct ib_smp *out_mad = NULL;
|
||||||
int err = -ENOMEM;
|
int err = -ENOMEM;
|
||||||
|
int have_ib_ports;
|
||||||
|
|
||||||
in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
|
in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
|
||||||
out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
|
out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
|
||||||
@ -143,6 +155,8 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
|
|||||||
|
|
||||||
memset(props, 0, sizeof *props);
|
memset(props, 0, sizeof *props);
|
||||||
|
|
||||||
|
have_ib_ports = num_ib_ports(dev->dev);
|
||||||
|
|
||||||
props->fw_ver = dev->dev->caps.fw_ver;
|
props->fw_ver = dev->dev->caps.fw_ver;
|
||||||
props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT |
|
props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT |
|
||||||
IB_DEVICE_PORT_ACTIVE_EVENT |
|
IB_DEVICE_PORT_ACTIVE_EVENT |
|
||||||
@ -153,7 +167,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
|
|||||||
props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR;
|
props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR;
|
||||||
if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR)
|
if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR)
|
||||||
props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR;
|
props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR;
|
||||||
if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_APM)
|
if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_APM && have_ib_ports)
|
||||||
props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG;
|
props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG;
|
||||||
if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UD_AV_PORT)
|
if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UD_AV_PORT)
|
||||||
props->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE;
|
props->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE;
|
||||||
|
@ -1424,6 +1424,12 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
|
|||||||
int steer_qp = 0;
|
int steer_qp = 0;
|
||||||
int err = -EINVAL;
|
int err = -EINVAL;
|
||||||
|
|
||||||
|
/* APM is not supported under RoCE */
|
||||||
|
if (attr_mask & IB_QP_ALT_PATH &&
|
||||||
|
rdma_port_get_link_layer(&dev->ib_dev, qp->port) ==
|
||||||
|
IB_LINK_LAYER_ETHERNET)
|
||||||
|
return -ENOTSUPP;
|
||||||
|
|
||||||
context = kzalloc(sizeof *context, GFP_KERNEL);
|
context = kzalloc(sizeof *context, GFP_KERNEL);
|
||||||
if (!context)
|
if (!context)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user