aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/core/umem.c16
-rw-r--r--drivers/infiniband/hw/mlx4/main.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c42
3 files changed, 30 insertions, 30 deletions
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index b4aec5103c99..d40652a80151 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -225,13 +225,15 @@ void ib_umem_release(struct ib_umem *umem)
225 * up here and not be able to take the mmap_sem. In that case 225 * up here and not be able to take the mmap_sem. In that case
226 * we defer the vm_locked accounting to the system workqueue. 226 * we defer the vm_locked accounting to the system workqueue.
227 */ 227 */
228 if (context->closing && !down_write_trylock(&mm->mmap_sem)) { 228 if (context->closing) {
229 INIT_WORK(&umem->work, ib_umem_account); 229 if (!down_write_trylock(&mm->mmap_sem)) {
230 umem->mm = mm; 230 INIT_WORK(&umem->work, ib_umem_account);
231 umem->diff = diff; 231 umem->mm = mm;
232 232 umem->diff = diff;
233 schedule_work(&umem->work); 233
234 return; 234 schedule_work(&umem->work);
235 return;
236 }
235 } else 237 } else
236 down_write(&mm->mmap_sem); 238 down_write(&mm->mmap_sem);
237 239
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 1095c82b38c2..c591616dccde 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -120,7 +120,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
120 props->max_qp_init_rd_atom = dev->dev->caps.max_qp_init_rdma; 120 props->max_qp_init_rd_atom = dev->dev->caps.max_qp_init_rdma;
121 props->max_res_rd_atom = props->max_qp_rd_atom * props->max_qp; 121 props->max_res_rd_atom = props->max_qp_rd_atom * props->max_qp;
122 props->max_srq = dev->dev->caps.num_srqs - dev->dev->caps.reserved_srqs; 122 props->max_srq = dev->dev->caps.num_srqs - dev->dev->caps.reserved_srqs;
123 props->max_srq_wr = dev->dev->caps.max_srq_wqes; 123 props->max_srq_wr = dev->dev->caps.max_srq_wqes - 1;
124 props->max_srq_sge = dev->dev->caps.max_srq_sge; 124 props->max_srq_sge = dev->dev->caps.max_srq_sge;
125 props->local_ca_ack_delay = dev->dev->caps.local_ca_ack_delay; 125 props->local_ca_ack_delay = dev->dev->caps.local_ca_ack_delay;
126 props->atomic_cap = dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_ATOMIC ? 126 props->atomic_cap = dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_ATOMIC ?
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 076a0bbb63d7..5ffc464c99aa 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -56,13 +56,6 @@ MODULE_PARM_DESC(cm_data_debug_level,
56#define IPOIB_CM_RX_DELAY (3 * 256 * HZ) 56#define IPOIB_CM_RX_DELAY (3 * 256 * HZ)
57#define IPOIB_CM_RX_UPDATE_MASK (0x3) 57#define IPOIB_CM_RX_UPDATE_MASK (0x3)
58 58
59struct ipoib_cm_id {
60 struct ib_cm_id *id;
61 int flags;
62 u32 remote_qpn;
63 u32 remote_mtu;
64};
65
66static struct ib_qp_attr ipoib_cm_err_attr = { 59static struct ib_qp_attr ipoib_cm_err_attr = {
67 .qp_state = IB_QPS_ERR 60 .qp_state = IB_QPS_ERR
68}; 61};
@@ -309,6 +302,11 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
309 return -ENOMEM; 302 return -ENOMEM;
310 p->dev = dev; 303 p->dev = dev;
311 p->id = cm_id; 304 p->id = cm_id;
305 cm_id->context = p;
306 p->state = IPOIB_CM_RX_LIVE;
307 p->jiffies = jiffies;
308 INIT_LIST_HEAD(&p->list);
309
312 p->qp = ipoib_cm_create_rx_qp(dev, p); 310 p->qp = ipoib_cm_create_rx_qp(dev, p);
313 if (IS_ERR(p->qp)) { 311 if (IS_ERR(p->qp)) {
314 ret = PTR_ERR(p->qp); 312 ret = PTR_ERR(p->qp);
@@ -320,24 +318,24 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
320 if (ret) 318 if (ret)
321 goto err_modify; 319 goto err_modify;
322 320
321 spin_lock_irq(&priv->lock);
322 queue_delayed_work(ipoib_workqueue,
323 &priv->cm.stale_task, IPOIB_CM_RX_DELAY);
324 /* Add this entry to passive ids list head, but do not re-add it
325 * if IB_EVENT_QP_LAST_WQE_REACHED has moved it to flush list. */
326 p->jiffies = jiffies;
327 if (p->state == IPOIB_CM_RX_LIVE)
328 list_move(&p->list, &priv->cm.passive_ids);
329 spin_unlock_irq(&priv->lock);
330
323 ret = ipoib_cm_send_rep(dev, cm_id, p->qp, &event->param.req_rcvd, psn); 331 ret = ipoib_cm_send_rep(dev, cm_id, p->qp, &event->param.req_rcvd, psn);
324 if (ret) { 332 if (ret) {
325 ipoib_warn(priv, "failed to send REP: %d\n", ret); 333 ipoib_warn(priv, "failed to send REP: %d\n", ret);
326 goto err_rep; 334 if (ib_modify_qp(p->qp, &ipoib_cm_err_attr, IB_QP_STATE))
335 ipoib_warn(priv, "unable to move qp to error state\n");
327 } 336 }
328
329 cm_id->context = p;
330 p->jiffies = jiffies;
331 p->state = IPOIB_CM_RX_LIVE;
332 spin_lock_irq(&priv->lock);
333 if (list_empty(&priv->cm.passive_ids))
334 queue_delayed_work(ipoib_workqueue,
335 &priv->cm.stale_task, IPOIB_CM_RX_DELAY);
336 list_add(&p->list, &priv->cm.passive_ids);
337 spin_unlock_irq(&priv->lock);
338 return 0; 337 return 0;
339 338
340err_rep:
341err_modify: 339err_modify:
342 ib_destroy_qp(p->qp); 340 ib_destroy_qp(p->qp);
343err_qp: 341err_qp:
@@ -754,9 +752,9 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
754 752
755 p->mtu = be32_to_cpu(data->mtu); 753 p->mtu = be32_to_cpu(data->mtu);
756 754
757 if (p->mtu < priv->dev->mtu + IPOIB_ENCAP_LEN) { 755 if (p->mtu <= IPOIB_ENCAP_LEN) {
758 ipoib_warn(priv, "Rejecting connection: mtu %d < device mtu %d + 4\n", 756 ipoib_warn(priv, "Rejecting connection: mtu %d <= %d\n",
759 p->mtu, priv->dev->mtu); 757 p->mtu, IPOIB_ENCAP_LEN);
760 return -EINVAL; 758 return -EINVAL;
761 } 759 }
762 760