aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/hw/mlx4/main.c16
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c6
2 files changed, 21 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 6ad7f7a0e464..d57563b9d1fb 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -120,6 +120,17 @@ static int check_flow_steering_support(struct mlx4_dev *dev)
120 return dmfs; 120 return dmfs;
121} 121}
122 122
123static int num_ib_ports(struct mlx4_dev *dev)
124{
125 int ib_ports = 0;
126 int i;
127
128 mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
129 ib_ports++;
130
131 return ib_ports;
132}
133
123static int mlx4_ib_query_device(struct ib_device *ibdev, 134static int mlx4_ib_query_device(struct ib_device *ibdev,
124 struct ib_device_attr *props) 135 struct ib_device_attr *props)
125{ 136{
@@ -127,6 +138,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
127 struct ib_smp *in_mad = NULL; 138 struct ib_smp *in_mad = NULL;
128 struct ib_smp *out_mad = NULL; 139 struct ib_smp *out_mad = NULL;
129 int err = -ENOMEM; 140 int err = -ENOMEM;
141 int have_ib_ports;
130 142
131 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); 143 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
132 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 144 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
@@ -143,6 +155,8 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
143 155
144 memset(props, 0, sizeof *props); 156 memset(props, 0, sizeof *props);
145 157
158 have_ib_ports = num_ib_ports(dev->dev);
159
146 props->fw_ver = dev->dev->caps.fw_ver; 160 props->fw_ver = dev->dev->caps.fw_ver;
147 props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT | 161 props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT |
148 IB_DEVICE_PORT_ACTIVE_EVENT | 162 IB_DEVICE_PORT_ACTIVE_EVENT |
@@ -153,7 +167,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
153 props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR; 167 props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR;
154 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR) 168 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR)
155 props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR; 169 props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR;
156 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_APM) 170 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_APM && have_ib_ports)
157 props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG; 171 props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG;
158 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UD_AV_PORT) 172 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UD_AV_PORT)
159 props->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE; 173 props->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE;
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 25e0208588e6..393423c69c00 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1424,6 +1424,12 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
1424 int steer_qp = 0; 1424 int steer_qp = 0;
1425 int err = -EINVAL; 1425 int err = -EINVAL;
1426 1426
1427 /* APM is not supported under RoCE */
1428 if (attr_mask & IB_QP_ALT_PATH &&
1429 rdma_port_get_link_layer(&dev->ib_dev, qp->port) ==
1430 IB_LINK_LAYER_ETHERNET)
1431 return -ENOTSUPP;
1432
1427 context = kzalloc(sizeof *context, GFP_KERNEL); 1433 context = kzalloc(sizeof *context, GFP_KERNEL);
1428 if (!context) 1434 if (!context)
1429 return -ENOMEM; 1435 return -ENOMEM;