aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/core/cma.c12
-rw-r--r--drivers/infiniband/core/rdma_core.c2
-rw-r--r--drivers/infiniband/core/ucma.c6
-rw-r--r--drivers/infiniband/core/uverbs_main.c5
-rw-r--r--drivers/infiniband/hw/bnxt_re/ib_verbs.c2
-rw-r--r--drivers/infiniband/hw/bnxt_re/qplib_fp.c2
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c6
-rw-r--r--drivers/infiniband/hw/mlx4/main.c8
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c2
9 files changed, 33 insertions, 12 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index f72677291b69..a36c94930c31 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -724,6 +724,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
724 dgid = (union ib_gid *) &addr->sib_addr; 724 dgid = (union ib_gid *) &addr->sib_addr;
725 pkey = ntohs(addr->sib_pkey); 725 pkey = ntohs(addr->sib_pkey);
726 726
727 mutex_lock(&lock);
727 list_for_each_entry(cur_dev, &dev_list, list) { 728 list_for_each_entry(cur_dev, &dev_list, list) {
728 for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) { 729 for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
729 if (!rdma_cap_af_ib(cur_dev->device, p)) 730 if (!rdma_cap_af_ib(cur_dev->device, p))
@@ -750,18 +751,19 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
750 cma_dev = cur_dev; 751 cma_dev = cur_dev;
751 sgid = gid; 752 sgid = gid;
752 id_priv->id.port_num = p; 753 id_priv->id.port_num = p;
754 goto found;
753 } 755 }
754 } 756 }
755 } 757 }
756 } 758 }
757 759 mutex_unlock(&lock);
758 if (!cma_dev) 760 return -ENODEV;
759 return -ENODEV;
760 761
761found: 762found:
762 cma_attach_to_dev(id_priv, cma_dev); 763 cma_attach_to_dev(id_priv, cma_dev);
763 addr = (struct sockaddr_ib *) cma_src_addr(id_priv); 764 mutex_unlock(&lock);
764 memcpy(&addr->sib_addr, &sgid, sizeof sgid); 765 addr = (struct sockaddr_ib *)cma_src_addr(id_priv);
766 memcpy(&addr->sib_addr, &sgid, sizeof(sgid));
765 cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr); 767 cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr);
766 return 0; 768 return 0;
767} 769}
diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c
index 6eb64c6f0802..c4118bcd5103 100644
--- a/drivers/infiniband/core/rdma_core.c
+++ b/drivers/infiniband/core/rdma_core.c
@@ -882,6 +882,8 @@ static int __uverbs_cleanup_ufile(struct ib_uverbs_file *ufile,
882 WARN_ON(uverbs_try_lock_object(obj, UVERBS_LOOKUP_WRITE)); 882 WARN_ON(uverbs_try_lock_object(obj, UVERBS_LOOKUP_WRITE));
883 if (!uverbs_destroy_uobject(obj, reason)) 883 if (!uverbs_destroy_uobject(obj, reason))
884 ret = 0; 884 ret = 0;
885 else
886 atomic_set(&obj->usecnt, 0);
885 } 887 }
886 return ret; 888 return ret;
887} 889}
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index ec8fb289621f..5f437d1570fb 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -124,6 +124,8 @@ static DEFINE_MUTEX(mut);
124static DEFINE_IDR(ctx_idr); 124static DEFINE_IDR(ctx_idr);
125static DEFINE_IDR(multicast_idr); 125static DEFINE_IDR(multicast_idr);
126 126
127static const struct file_operations ucma_fops;
128
127static inline struct ucma_context *_ucma_find_context(int id, 129static inline struct ucma_context *_ucma_find_context(int id,
128 struct ucma_file *file) 130 struct ucma_file *file)
129{ 131{
@@ -1581,6 +1583,10 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file,
1581 f = fdget(cmd.fd); 1583 f = fdget(cmd.fd);
1582 if (!f.file) 1584 if (!f.file)
1583 return -ENOENT; 1585 return -ENOENT;
1586 if (f.file->f_op != &ucma_fops) {
1587 ret = -EINVAL;
1588 goto file_put;
1589 }
1584 1590
1585 /* Validate current fd and prevent destruction of id. */ 1591 /* Validate current fd and prevent destruction of id. */
1586 ctx = ucma_get_ctx(f.file->private_data, cmd.id); 1592 ctx = ucma_get_ctx(f.file->private_data, cmd.id);
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 823beca448e1..6d974e2363df 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -1050,7 +1050,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
1050 uverbs_dev->num_comp_vectors = device->num_comp_vectors; 1050 uverbs_dev->num_comp_vectors = device->num_comp_vectors;
1051 1051
1052 if (ib_uverbs_create_uapi(device, uverbs_dev)) 1052 if (ib_uverbs_create_uapi(device, uverbs_dev))
1053 goto err; 1053 goto err_uapi;
1054 1054
1055 cdev_init(&uverbs_dev->cdev, NULL); 1055 cdev_init(&uverbs_dev->cdev, NULL);
1056 uverbs_dev->cdev.owner = THIS_MODULE; 1056 uverbs_dev->cdev.owner = THIS_MODULE;
@@ -1077,11 +1077,10 @@ static void ib_uverbs_add_one(struct ib_device *device)
1077 1077
1078err_class: 1078err_class:
1079 device_destroy(uverbs_class, uverbs_dev->cdev.dev); 1079 device_destroy(uverbs_class, uverbs_dev->cdev.dev);
1080
1081err_cdev: 1080err_cdev:
1082 cdev_del(&uverbs_dev->cdev); 1081 cdev_del(&uverbs_dev->cdev);
1082err_uapi:
1083 clear_bit(devnum, dev_map); 1083 clear_bit(devnum, dev_map);
1084
1085err: 1084err:
1086 if (atomic_dec_and_test(&uverbs_dev->refcount)) 1085 if (atomic_dec_and_test(&uverbs_dev->refcount))
1087 ib_uverbs_comp_dev(uverbs_dev); 1086 ib_uverbs_comp_dev(uverbs_dev);
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index bbfb86eb2d24..bc2b9e038439 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -833,6 +833,8 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp)
833 "Failed to destroy Shadow QP"); 833 "Failed to destroy Shadow QP");
834 return rc; 834 return rc;
835 } 835 }
836 bnxt_qplib_free_qp_res(&rdev->qplib_res,
837 &rdev->qp1_sqp->qplib_qp);
836 mutex_lock(&rdev->qp_lock); 838 mutex_lock(&rdev->qp_lock);
837 list_del(&rdev->qp1_sqp->list); 839 list_del(&rdev->qp1_sqp->list);
838 atomic_dec(&rdev->qp_count); 840 atomic_dec(&rdev->qp_count);
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
index e426b990c1dd..6ad0d46ab879 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
@@ -196,7 +196,7 @@ static int bnxt_qplib_alloc_qp_hdr_buf(struct bnxt_qplib_res *res,
196 struct bnxt_qplib_qp *qp) 196 struct bnxt_qplib_qp *qp)
197{ 197{
198 struct bnxt_qplib_q *rq = &qp->rq; 198 struct bnxt_qplib_q *rq = &qp->rq;
199 struct bnxt_qplib_q *sq = &qp->rq; 199 struct bnxt_qplib_q *sq = &qp->sq;
200 int rc = 0; 200 int rc = 0;
201 201
202 if (qp->sq_hdr_buf_size && sq->hwq.max_elements) { 202 if (qp->sq_hdr_buf_size && sq->hwq.max_elements) {
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index b3203afa3b1d..347fe18b1a41 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1685,6 +1685,12 @@ static void flush_qp(struct c4iw_qp *qhp)
1685 schp = to_c4iw_cq(qhp->ibqp.send_cq); 1685 schp = to_c4iw_cq(qhp->ibqp.send_cq);
1686 1686
1687 if (qhp->ibqp.uobject) { 1687 if (qhp->ibqp.uobject) {
1688
1689 /* for user qps, qhp->wq.flushed is protected by qhp->mutex */
1690 if (qhp->wq.flushed)
1691 return;
1692
1693 qhp->wq.flushed = 1;
1688 t4_set_wq_in_error(&qhp->wq, 0); 1694 t4_set_wq_in_error(&qhp->wq, 0);
1689 t4_set_cq_in_error(&rchp->cq); 1695 t4_set_cq_in_error(&rchp->cq);
1690 spin_lock_irqsave(&rchp->comp_handler_lock, flag); 1696 spin_lock_irqsave(&rchp->comp_handler_lock, flag);
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index ca0f1ee26091..0bbeaaae47e0 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -517,9 +517,11 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
517 props->page_size_cap = dev->dev->caps.page_size_cap; 517 props->page_size_cap = dev->dev->caps.page_size_cap;
518 props->max_qp = dev->dev->quotas.qp; 518 props->max_qp = dev->dev->quotas.qp;
519 props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; 519 props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE;
520 props->max_send_sge = dev->dev->caps.max_sq_sg; 520 props->max_send_sge =
521 props->max_recv_sge = dev->dev->caps.max_rq_sg; 521 min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
522 props->max_sge_rd = MLX4_MAX_SGE_RD; 522 props->max_recv_sge =
523 min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
524 props->max_sge_rd = MLX4_MAX_SGE_RD;
523 props->max_cq = dev->dev->quotas.cq; 525 props->max_cq = dev->dev->quotas.cq;
524 props->max_cqe = dev->dev->caps.max_cqes; 526 props->max_cqe = dev->dev->caps.max_cqes;
525 props->max_mr = dev->dev->quotas.mpt; 527 props->max_mr = dev->dev->quotas.mpt;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index ea01b8dd2be6..3d5424f335cb 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1027,12 +1027,14 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id,
1027 1027
1028 skb_queue_head_init(&skqueue); 1028 skb_queue_head_init(&skqueue);
1029 1029
1030 netif_tx_lock_bh(p->dev);
1030 spin_lock_irq(&priv->lock); 1031 spin_lock_irq(&priv->lock);
1031 set_bit(IPOIB_FLAG_OPER_UP, &p->flags); 1032 set_bit(IPOIB_FLAG_OPER_UP, &p->flags);
1032 if (p->neigh) 1033 if (p->neigh)
1033 while ((skb = __skb_dequeue(&p->neigh->queue))) 1034 while ((skb = __skb_dequeue(&p->neigh->queue)))
1034 __skb_queue_tail(&skqueue, skb); 1035 __skb_queue_tail(&skqueue, skb);
1035 spin_unlock_irq(&priv->lock); 1036 spin_unlock_irq(&priv->lock);
1037 netif_tx_unlock_bh(p->dev);
1036 1038
1037 while ((skb = __skb_dequeue(&skqueue))) { 1039 while ((skb = __skb_dequeue(&skqueue))) {
1038 skb->dev = p->dev; 1040 skb->dev = p->dev;