History

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma

Pull rdma fixes from Doug Ledford: - Various driver bug fixes in mlx5, mlx4, bnxt_re and qedr, ranging from bugs under load to bad error case handling - There in one largish patch fixing the locking in bnxt_re to avoid a machine hard lock situation - A few core bugs on error paths - A patch to reduce stack usage in the new CQ API - One mlx5 regression introduced in this merge window - There were new syzkaller scripts written for the RDMA subsystem and we are fixing issues found by the bot - One of the commits (aa0de36a40f4 “RDMA/mlx5: Fix integer overflow while resizing CQ”) is missing part of the commit log message and one of the SOB lines. The original patch was from Leon Romanovsky, and a cut-n-paste separator in the commit message confused patchworks which then put the end of message separator in the wrong place in the downloaded patch, and I didn’t notice in time. The patch made it into the official branch, and the only way to fix it in-place was to rebase. Given the pain that a rebase causes, and the fact that the patch has relevant tags for stable and syzkaller, a revert of the munged patch and a reapplication of the original patch with the log message intact was done. * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (25 commits) RDMA/mlx5: Fix integer overflow while resizing CQ Revert "RDMA/mlx5: Fix integer overflow while resizing CQ" RDMA/ucma: Check that user doesn't overflow QP state RDMA/mlx5: Fix integer overflow while resizing CQ RDMA/ucma: Limit possible option size IB/core: Fix possible crash to access NULL netdev RDMA/bnxt_re: Avoid Hard lockup during error CQE processing RDMA/core: Reduce poll batch for direct cq polling IB/mlx5: Fix an error code in __mlx5_ib_modify_qp() IB/mlx5: When not in dual port RoCE mode, use provided port as native IB/mlx4: Include GID type when deleting GIDs from HW table under RoCE IB/mlx4: Fix corruption of RoCEv2 IPv4 GIDs RDMA/qedr: Fix iWARP write and send with immediate RDMA/qedr: Fix kernel panic when running fio over NFSoRDMA RDMA/qedr: Fix iWARP connect with port mapper RDMA/qedr: Fix ipv6 destination address resolution IB/core : Add null pointer check in addr_resolve RDMA/bnxt_re: Fix the ib_reg failure cleanup RDMA/bnxt_re: Fix incorrect DB offset calculation RDMA/bnxt_re: Unconditionly fence non wire memory operations ...

Linus Torvalds committed 8 years ago

Commit 2f64e702 parents b3337a6 28e909123 files · +192 −156Browse files

Unified · Split

23 files
  1. drivers/infiniband/core/addr.c +5 −10
  2. drivers/infiniband/core/cq.c +11 −10
  3. drivers/infiniband/core/device.c +4 −2
  4. drivers/infiniband/core/sa_query.c +3 −4
  5. drivers/infiniband/core/ucma.c +6 −0
  6. drivers/infiniband/hw/bnxt_re/ib_verbs.c +19 −7
  7. drivers/infiniband/hw/bnxt_re/ib_verbs.h +3 −0
  8. drivers/infiniband/hw/bnxt_re/main.c +11 −1
  9. drivers/infiniband/hw/bnxt_re/qplib_fp.c +24 −85
  10. drivers/infiniband/hw/bnxt_re/qplib_fp.h +12 −0
  11. drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +6 −3
  12. drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +1 −0
  13. drivers/infiniband/hw/bnxt_re/qplib_sp.c +2 −1
  14. drivers/infiniband/hw/bnxt_re/roce_hsi.h +24 −1
  15. drivers/infiniband/hw/mlx4/cq.c +3 −1
  16. drivers/infiniband/hw/mlx4/main.c +7 −4
  17. drivers/infiniband/hw/mlx5/cq.c +8 −2
  18. drivers/infiniband/hw/mlx5/main.c +9 −12
  19. drivers/infiniband/hw/mlx5/mr.c +1 −1
  20. drivers/infiniband/hw/mlx5/qp.c +9 −2
  21. drivers/infiniband/hw/qedr/qedr_iw_cm.c +11 −8
  22. drivers/infiniband/hw/qedr/verbs.c +12 −1
  23. drivers/net/ethernet/mellanox/mlx5/core/health.c +1 −1
drivers/infiniband/core/addr.c+5−10
@@ -550,18 +550,13 @@ static int addr_resolve(struct sockaddr *src_in, · 549 unmodified lines
550550 dst_release(dst);
551551 }
552552
553− if (ndev->flags & IFF_LOOPBACK) {
554− ret = rdma_translate_ip(dst_in, addr);
555− /*
556− * Put the loopback device and get the translated
557− * device instead.
558− */
553+ if (ndev) {
554+ if (ndev->flags & IFF_LOOPBACK)
555+ ret = rdma_translate_ip(dst_in, addr);
556+ else
557+ addr->bound_dev_if = ndev->ifindex;
559558 dev_put(ndev);
560− ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
561− } else {
562− addr->bound_dev_if = ndev->ifindex;
563559 }
564− dev_put(ndev);
565560
566561 return ret;
567562 }
drivers/infiniband/core/cq.c+11−10
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717
1818 /* # of WCs to poll for with a single call to ib_poll_cq */
1919 #define IB_POLL_BATCH 16
20+#define IB_POLL_BATCH_DIRECT 8
2021
2122 /* # of WCs to iterate over before yielding */
2223 #define IB_POLL_BUDGET_IRQ 256
@@ -25,18 +26,18 @@ · 2 unmodified lines
2526 #define IB_POLL_FLAGS \
2627 (IB_CQ_NEXT_COMP | IB_CQ_REPORT_MISSED_EVENTS)
2728
28−static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc)
29+static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *wcs,
30+ int batch)
2931 {
3032 int i, n, completed = 0;
31− struct ib_wc *wcs = poll_wc ? : cq->wc;
3233
3334 /*
3435 * budget might be (-1) if the caller does not
3536 * want to bound this call, thus we need unsigned
3637 * minimum here.
3738 */
38− while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH,
39− budget - completed), wcs)) > 0) {
39+ while ((n = ib_poll_cq(cq, min_t(u32, batch,
40+ budget - completed), wcs)) > 0) {
4041 for (i = 0; i < n; i++) {
4142 struct ib_wc *wc = &wcs[i];
4243
@@ -48,8 +49,7 @@ static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc) · 5 unmodified lines
4849
4950 completed += n;
5051
51− if (n != IB_POLL_BATCH ||
52− (budget != -1 && completed >= budget))
52+ if (n != batch || (budget != -1 && completed >= budget))
5353 break;
5454 }
5555
@@ -72,9 +72,9 @@ static int __ib_process_cq(struct ib_cq *cq, int budget, struct ib_wc *poll_wc) · 16 unmodified lines
7272 */
7373 int ib_process_cq_direct(struct ib_cq *cq, int budget)
7474 {
75− struct ib_wc wcs[IB_POLL_BATCH];
75+ struct ib_wc wcs[IB_POLL_BATCH_DIRECT];
7676
77− return __ib_process_cq(cq, budget, wcs);
77+ return __ib_process_cq(cq, budget, wcs, IB_POLL_BATCH_DIRECT);
7878 }
7979 EXPORT_SYMBOL(ib_process_cq_direct);
8080
@@ -88,7 +88,7 @@ static int ib_poll_handler(struct irq_poll *iop, int budget) · 7 unmodified lines
8888 struct ib_cq *cq = container_of(iop, struct ib_cq, iop);
8989 int completed;
9090
91− completed = __ib_process_cq(cq, budget, NULL);
91+ completed = __ib_process_cq(cq, budget, cq->wc, IB_POLL_BATCH);
9292 if (completed < budget) {
9393 irq_poll_complete(&cq->iop);
9494 if (ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
@@ -108,7 +108,8 @@ static void ib_cq_poll_work(struct work_struct *work) · 13 unmodified lines
108108 struct ib_cq *cq = container_of(work, struct ib_cq, work);
109109 int completed;
110110
111− completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, NULL);
111+ completed = __ib_process_cq(cq, IB_POLL_BUDGET_WORKQUEUE, cq->wc,
112+ IB_POLL_BATCH);
112113 if (completed >= IB_POLL_BUDGET_WORKQUEUE ||
113114 ib_req_notify_cq(cq, IB_POLL_FLAGS) > 0)
114115 queue_work(ib_comp_wq, &cq->work);
drivers/infiniband/core/device.c+4−2
@@ -536,14 +536,14 @@ int ib_register_device(struct ib_device *device, · 535 unmodified lines
536536 ret = device->query_device(device, &device->attrs, &uhw);
537537 if (ret) {
538538 pr_warn("Couldn't query the device attributes\n");
539− goto cache_cleanup;
539+ goto cg_cleanup;
540540 }
541541
542542 ret = ib_device_register_sysfs(device, port_callback);
543543 if (ret) {
544544 pr_warn("Couldn't register device %s with driver model\n",
545545 device->name);
546− goto cache_cleanup;
546+ goto cg_cleanup;
547547 }
548548
549549 device->reg_state = IB_DEV_REGISTERED;
@@ -559,6 +559,8 @@ int ib_register_device(struct ib_device *device, · 9 unmodified lines
559559 mutex_unlock(&device_mutex);
560560 return 0;
561561
562+cg_cleanup:
563+ ib_device_unregister_rdmacg(device);
562564 cache_cleanup:
563565 ib_cache_cleanup_one(device);
564566 ib_cache_release_one(device);
drivers/infiniband/core/sa_query.c+3−4
@@ -1291,10 +1291,9 @@ int ib_init_ah_attr_from_path(struct ib_device *device, u8 port_num, · 1290 unmodified lines
12911291
12921292 resolved_dev = dev_get_by_index(dev_addr.net,
12931293 dev_addr.bound_dev_if);
1294− if (resolved_dev->flags & IFF_LOOPBACK) {
1295− dev_put(resolved_dev);
1296− resolved_dev = idev;
1297− dev_hold(resolved_dev);
1294+ if (!resolved_dev) {
1295+ dev_put(idev);
1296+ return -ENODEV;
12981297 }
12991298 ndev = ib_get_ndev_from_path(rec);
13001299 rcu_read_lock();
drivers/infiniband/core/ucma.c+6−0
@@ -1149,6 +1149,9 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file, · 1148 unmodified lines
11491149 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
11501150 return -EFAULT;
11511151
1152+ if (cmd.qp_state > IB_QPS_ERR)
1153+ return -EINVAL;
1154+
11521155 ctx = ucma_get_ctx(file, cmd.id);
11531156 if (IS_ERR(ctx))
11541157 return PTR_ERR(ctx);
@@ -1294,6 +1297,9 @@ static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf, · 139 unmodified lines
12941297 if (IS_ERR(ctx))
12951298 return PTR_ERR(ctx);
12961299
1300+ if (unlikely(cmd.optval > KMALLOC_MAX_SIZE))
1301+ return -EINVAL;
1302+
12971303 optval = memdup_user((void __user *) (unsigned long) cmd.optval,
12981304 cmd.optlen);
12991305 if (IS_ERR(optval)) {
drivers/infiniband/hw/bnxt_re/ib_verbs.c+19−7
@@ -785,7 +785,7 @@ int bnxt_re_query_ah(struct ib_ah *ib_ah, struct rdma_ah_attr *ah_attr) · 784 unmodified lines
785785 return 0;
786786 }
787787
788−static unsigned long bnxt_re_lock_cqs(struct bnxt_re_qp *qp)
788+unsigned long bnxt_re_lock_cqs(struct bnxt_re_qp *qp)
789789 __acquires(&qp->scq->cq_lock) __acquires(&qp->rcq->cq_lock)
790790 {
791791 unsigned long flags;
@@ -799,8 +799,8 @@ static unsigned long bnxt_re_lock_cqs(struct bnxt_re_qp *qp) · 7 unmodified lines
799799 return flags;
800800 }
801801
802−static void bnxt_re_unlock_cqs(struct bnxt_re_qp *qp,
803− unsigned long flags)
802+void bnxt_re_unlock_cqs(struct bnxt_re_qp *qp,
803+ unsigned long flags)
804804 __releases(&qp->scq->cq_lock) __releases(&qp->rcq->cq_lock)
805805 {
806806 if (qp->rcq != qp->scq)
@@ -1606,6 +1606,7 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, · 799 unmodified lines
16061606 int status;
16071607 union ib_gid sgid;
16081608 struct ib_gid_attr sgid_attr;
1609+ unsigned int flags;
16091610 u8 nw_type;
16101611
16111612 qp->qplib_qp.modify_flags = 0;
@@ -1634,14 +1635,18 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, · 22 unmodified lines
16341635 dev_dbg(rdev_to_dev(rdev),
16351636 "Move QP = %p to flush list\n",
16361637 qp);
1638+ flags = bnxt_re_lock_cqs(qp);
16371639 bnxt_qplib_add_flush_qp(&qp->qplib_qp);
1640+ bnxt_re_unlock_cqs(qp, flags);
16381641 }
16391642 if (!qp->sumem &&
16401643 qp->qplib_qp.state == CMDQ_MODIFY_QP_NEW_STATE_RESET) {
16411644 dev_dbg(rdev_to_dev(rdev),
16421645 "Move QP = %p out of flush list\n",
16431646 qp);
1647+ flags = bnxt_re_lock_cqs(qp);
16441648 bnxt_qplib_clean_qp(&qp->qplib_qp);
1649+ bnxt_re_unlock_cqs(qp, flags);
16451650 }
16461651 }
16471652 if (qp_attr_mask & IB_QP_EN_SQD_ASYNC_NOTIFY) {
@@ -2227,10 +2232,13 @@ static int bnxt_re_build_inv_wqe(struct ib_send_wr *wr, · 579 unmodified lines
22272232 wqe->type = BNXT_QPLIB_SWQE_TYPE_LOCAL_INV;
22282233 wqe->local_inv.inv_l_key = wr->ex.invalidate_rkey;
22292234
2235+ /* Need unconditional fence for local invalidate
2236+ * opcode to work as expected.
2237+ */
2238+ wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_UC_FENCE;
2239+
22302240 if (wr->send_flags & IB_SEND_SIGNALED)
22312241 wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP;
2232− if (wr->send_flags & IB_SEND_FENCE)
2233− wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_UC_FENCE;
22342242 if (wr->send_flags & IB_SEND_SOLICITED)
22352243 wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_SOLICIT_EVENT;
22362244
@@ -2251,8 +2259,12 @@ static int bnxt_re_build_reg_wqe(struct ib_reg_wr *wr, · 14 unmodified lines
22512259 wqe->frmr.levels = qplib_frpl->hwq.level + 1;
22522260 wqe->type = BNXT_QPLIB_SWQE_TYPE_REG_MR;
22532261
2254− if (wr->wr.send_flags & IB_SEND_FENCE)
2255− wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_UC_FENCE;
2262+ /* Need unconditional fence for reg_mr
2263+ * opcode to function as expected.
2264+ */
2265+
2266+ wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_UC_FENCE;
2267+
22562268 if (wr->wr.send_flags & IB_SEND_SIGNALED)
22572269 wqe->flags |= BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP;
22582270
drivers/infiniband/hw/bnxt_re/ib_verbs.h+3−0
@@ -222,4 +222,7 @@ struct ib_ucontext *bnxt_re_alloc_ucontext(struct ib_device *ibdev, · 221 unmodified lines
222222 struct ib_udata *udata);
223223 int bnxt_re_dealloc_ucontext(struct ib_ucontext *context);
224224 int bnxt_re_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
225+
226+unsigned long bnxt_re_lock_cqs(struct bnxt_re_qp *qp);
227+void bnxt_re_unlock_cqs(struct bnxt_re_qp *qp, unsigned long flags);
225228 #endif /* __BNXT_RE_IB_VERBS_H__ */
drivers/infiniband/hw/bnxt_re/main.c+11−1
@@ -730,6 +730,13 @@ static int bnxt_re_handle_qp_async_event(struct creq_qp_event *qp_event, · 729 unmodified lines
730730 struct bnxt_re_qp *qp)
731731 {
732732 struct ib_event event;
733+ unsigned int flags;
734+
735+ if (qp->qplib_qp.state == CMDQ_MODIFY_QP_NEW_STATE_ERR) {
736+ flags = bnxt_re_lock_cqs(qp);
737+ bnxt_qplib_add_flush_qp(&qp->qplib_qp);
738+ bnxt_re_unlock_cqs(qp, flags);
739+ }
733740
734741 memset(&event, 0, sizeof(event));
735742 if (qp->qplib_qp.srq) {
@@ -1416,9 +1423,12 @@ static void bnxt_re_task(struct work_struct *work) · 680 unmodified lines
14161423 switch (re_work->event) {
14171424 case NETDEV_REGISTER:
14181425 rc = bnxt_re_ib_reg(rdev);
1419− if (rc)
1426+ if (rc) {
14201427 dev_err(rdev_to_dev(rdev),
14211428 "Failed to register with IB: %#x", rc);
1429+ bnxt_re_remove_one(rdev);
1430+ bnxt_re_dev_unreg(rdev);
1431+ }
14221432 break;
14231433 case NETDEV_UP:
14241434 bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1,
drivers/infiniband/hw/bnxt_re/qplib_fp.c+24−85
@@ -88,75 +88,35 @@ static void __bnxt_qplib_add_flush_qp(struct bnxt_qplib_qp *qp) · 87 unmodified lines
8888 }
8989 }
9090
91−void bnxt_qplib_acquire_cq_locks(struct bnxt_qplib_qp *qp,
92− unsigned long *flags)
93− __acquires(&qp->scq->hwq.lock) __acquires(&qp->rcq->hwq.lock)
91+static void bnxt_qplib_acquire_cq_flush_locks(struct bnxt_qplib_qp *qp,
92+ unsigned long *flags)
93+ __acquires(&qp->scq->flush_lock) __acquires(&qp->rcq->flush_lock)
9494 {
95− spin_lock_irqsave(&qp->scq->hwq.lock, *flags);
95+ spin_lock_irqsave(&qp->scq->flush_lock, *flags);
9696 if (qp->scq == qp->rcq)
97− __acquire(&qp->rcq->hwq.lock);
97+ __acquire(&qp->rcq->flush_lock);
9898 else
99− spin_lock(&qp->rcq->hwq.lock);
99+ spin_lock(&qp->rcq->flush_lock);
100100 }
101101
102−void bnxt_qplib_release_cq_locks(struct bnxt_qplib_qp *qp,
103− unsigned long *flags)
104− __releases(&qp->scq->hwq.lock) __releases(&qp->rcq->hwq.lock)
102+static void bnxt_qplib_release_cq_flush_locks(struct bnxt_qplib_qp *qp,
103+ unsigned long *flags)
104+ __releases(&qp->scq->flush_lock) __releases(&qp->rcq->flush_lock)
105105 {
106106 if (qp->scq == qp->rcq)
107− __release(&qp->rcq->hwq.lock);
107+ __release(&qp->rcq->flush_lock);
108108 else
109− spin_unlock(&qp->rcq->hwq.lock);
110− spin_unlock_irqrestore(&qp->scq->hwq.lock, *flags);
111−}
112−
113−static struct bnxt_qplib_cq *bnxt_qplib_find_buddy_cq(struct bnxt_qplib_qp *qp,
114− struct bnxt_qplib_cq *cq)
115−{
116− struct bnxt_qplib_cq *buddy_cq = NULL;
117−
118− if (qp->scq == qp->rcq)
119− buddy_cq = NULL;
120− else if (qp->scq == cq)
121− buddy_cq = qp->rcq;
122− else
123− buddy_cq = qp->scq;
124− return buddy_cq;
125−}
126−
127−static void bnxt_qplib_lock_buddy_cq(struct bnxt_qplib_qp *qp,
128− struct bnxt_qplib_cq *cq)
129− __acquires(&buddy_cq->hwq.lock)
130−{
131− struct bnxt_qplib_cq *buddy_cq = NULL;
132−
133− buddy_cq = bnxt_qplib_find_buddy_cq(qp, cq);
134− if (!buddy_cq)
135− __acquire(&cq->hwq.lock);
136− else
137− spin_lock(&buddy_cq->hwq.lock);
138−}
139−
140−static void bnxt_qplib_unlock_buddy_cq(struct bnxt_qplib_qp *qp,
141− struct bnxt_qplib_cq *cq)
142− __releases(&buddy_cq->hwq.lock)
143−{
144− struct bnxt_qplib_cq *buddy_cq = NULL;
145−
146− buddy_cq = bnxt_qplib_find_buddy_cq(qp, cq);
147− if (!buddy_cq)
148− __release(&cq->hwq.lock);
149− else
150− spin_unlock(&buddy_cq->hwq.lock);
109+ spin_unlock(&qp->rcq->flush_lock);
110+ spin_unlock_irqrestore(&qp->scq->flush_lock, *flags);
151111 }
152112
153113 void bnxt_qplib_add_flush_qp(struct bnxt_qplib_qp *qp)
154114 {
155115 unsigned long flags;
156116
157− bnxt_qplib_acquire_cq_locks(qp, &flags);
117+ bnxt_qplib_acquire_cq_flush_locks(qp, &flags);
158118 __bnxt_qplib_add_flush_qp(qp);
159− bnxt_qplib_release_cq_locks(qp, &flags);
119+ bnxt_qplib_release_cq_flush_locks(qp, &flags);
160120 }
161121
162122 static void __bnxt_qplib_del_flush_qp(struct bnxt_qplib_qp *qp)
@@ -177,7 +137,7 @@ void bnxt_qplib_clean_qp(struct bnxt_qplib_qp *qp) · 14 unmodified lines
177137 {
178138 unsigned long flags;
179139
180− bnxt_qplib_acquire_cq_locks(qp, &flags);
140+ bnxt_qplib_acquire_cq_flush_locks(qp, &flags);
181141 __clean_cq(qp->scq, (u64)(unsigned long)qp);
182142 qp->sq.hwq.prod = 0;
183143 qp->sq.hwq.cons = 0;
@@ -186,7 +146,7 @@ void bnxt_qplib_clean_qp(struct bnxt_qplib_qp *qp) · 2 unmodified lines
186146 qp->rq.hwq.cons = 0;
187147
188148 __bnxt_qplib_del_flush_qp(qp);
189− bnxt_qplib_release_cq_locks(qp, &flags);
149+ bnxt_qplib_release_cq_flush_locks(qp, &flags);
190150 }
191151
192152 static void bnxt_qpn_cqn_sched_task(struct work_struct *work)
@@ -2107,9 +2067,6 @@ void bnxt_qplib_mark_qp_error(void *qp_handle) · 1914 unmodified lines
21072067 /* Must block new posting of SQ and RQ */
21082068 qp->state = CMDQ_MODIFY_QP_NEW_STATE_ERR;
21092069 bnxt_qplib_cancel_phantom_processing(qp);
2110−
2111− /* Add qp to flush list of the CQ */
2112− __bnxt_qplib_add_flush_qp(qp);
21132070 }
21142071
21152072 /* Note: SQE is valid from sw_sq_cons up to cqe_sq_cons (exclusive)
@@ -2285,9 +2242,9 @@ static int bnxt_qplib_cq_process_req(struct bnxt_qplib_cq *cq, · 169 unmodified lines
22852242 sw_sq_cons, cqe->wr_id, cqe->status);
22862243 cqe++;
22872244 (*budget)--;
2288− bnxt_qplib_lock_buddy_cq(qp, cq);
22892245 bnxt_qplib_mark_qp_error(qp);
2290− bnxt_qplib_unlock_buddy_cq(qp, cq);
2246+ /* Add qp to flush list of the CQ */
2247+ bnxt_qplib_add_flush_qp(qp);
22912248 } else {
22922249 if (swq->flags & SQ_SEND_FLAGS_SIGNAL_COMP) {
22932250 /* Before we complete, do WA 9060 */
@@ -2403,9 +2360,7 @@ static int bnxt_qplib_cq_process_res_rc(struct bnxt_qplib_cq *cq, · 109 unmodified lines
24032360 if (hwcqe->status != CQ_RES_RC_STATUS_OK) {
24042361 qp->state = CMDQ_MODIFY_QP_NEW_STATE_ERR;
24052362 /* Add qp to flush list of the CQ */
2406− bnxt_qplib_lock_buddy_cq(qp, cq);
2407− __bnxt_qplib_add_flush_qp(qp);
2408− bnxt_qplib_unlock_buddy_cq(qp, cq);
2363+ bnxt_qplib_add_flush_qp(qp);
24092364 }
24102365 }
24112366
@@ -2489,9 +2444,7 @@ static int bnxt_qplib_cq_process_res_ud(struct bnxt_qplib_cq *cq, · 77 unmodified lines
24892444 if (hwcqe->status != CQ_RES_RC_STATUS_OK) {
24902445 qp->state = CMDQ_MODIFY_QP_NEW_STATE_ERR;
24912446 /* Add qp to flush list of the CQ */
2492− bnxt_qplib_lock_buddy_cq(qp, cq);
2493− __bnxt_qplib_add_flush_qp(qp);
2494− bnxt_qplib_unlock_buddy_cq(qp, cq);
2447+ bnxt_qplib_add_flush_qp(qp);
24952448 }
24962449 }
24972450 done:
@@ -2501,11 +2454,9 @@ done: · 3 unmodified lines
25012454 bool bnxt_qplib_is_cq_empty(struct bnxt_qplib_cq *cq)
25022455 {
25032456 struct cq_base *hw_cqe, **hw_cqe_ptr;
2504− unsigned long flags;
25052457 u32 sw_cons, raw_cons;
25062458 bool rc = true;
25072459
2508− spin_lock_irqsave(&cq->hwq.lock, flags);
25092460 raw_cons = cq->hwq.cons;
25102461 sw_cons = HWQ_CMP(raw_cons, &cq->hwq);
25112462 hw_cqe_ptr = (struct cq_base **)cq->hwq.pbl_ptr;
@@ -2513,7 +2464,6 @@ bool bnxt_qplib_is_cq_empty(struct bnxt_qplib_cq *cq) · 1 unmodified line
25132464
25142465 /* Check for Valid bit. If the CQE is valid, return false */
25152466 rc = !CQE_CMP_VALID(hw_cqe, raw_cons, cq->hwq.max_elements);
2516− spin_unlock_irqrestore(&cq->hwq.lock, flags);
25172467 return rc;
25182468 }
25192469
@@ -2602,9 +2552,7 @@ static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq, · 82 unmodified lines
26022552 if (hwcqe->status != CQ_RES_RC_STATUS_OK) {
26032553 qp->state = CMDQ_MODIFY_QP_NEW_STATE_ERR;
26042554 /* Add qp to flush list of the CQ */
2605− bnxt_qplib_lock_buddy_cq(qp, cq);
2606− __bnxt_qplib_add_flush_qp(qp);
2607− bnxt_qplib_unlock_buddy_cq(qp, cq);
2555+ bnxt_qplib_add_flush_qp(qp);
26082556 }
26092557 }
26102558
@@ -2719,9 +2667,7 @@ do_rq: · 108 unmodified lines
27192667 */
27202668
27212669 /* Add qp to flush list of the CQ */
2722− bnxt_qplib_lock_buddy_cq(qp, cq);
2723− __bnxt_qplib_add_flush_qp(qp);
2724− bnxt_qplib_unlock_buddy_cq(qp, cq);
2670+ bnxt_qplib_add_flush_qp(qp);
27252671 done:
27262672 return rc;
27272673 }
@@ -2750,7 +2696,7 @@ int bnxt_qplib_process_flush_list(struct bnxt_qplib_cq *cq, · 22 unmodified lines
27502696 u32 budget = num_cqes;
27512697 unsigned long flags;
27522698
2753− spin_lock_irqsave(&cq->hwq.lock, flags);
2699+ spin_lock_irqsave(&cq->flush_lock, flags);
27542700 list_for_each_entry(qp, &cq->sqf_head, sq_flush) {
27552701 dev_dbg(&cq->hwq.pdev->dev,
27562702 "QPLIB: FP: Flushing SQ QP= %p",
@@ -2764,7 +2710,7 @@ int bnxt_qplib_process_flush_list(struct bnxt_qplib_cq *cq, · 7 unmodified lines
27642710 qp);
27652711 __flush_rq(&qp->rq, qp, &cqe, &budget);
27662712 }
2767− spin_unlock_irqrestore(&cq->hwq.lock, flags);
2713+ spin_unlock_irqrestore(&cq->flush_lock, flags);
27682714
27692715 return num_cqes - budget;
27702716 }
@@ -2773,11 +2719,9 @@ int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, · 2 unmodified lines
27732719 int num_cqes, struct bnxt_qplib_qp **lib_qp)
27742720 {
27752721 struct cq_base *hw_cqe, **hw_cqe_ptr;
2776− unsigned long flags;
27772722 u32 sw_cons, raw_cons;
27782723 int budget, rc = 0;
27792724
2780− spin_lock_irqsave(&cq->hwq.lock, flags);
27812725 raw_cons = cq->hwq.cons;
27822726 budget = num_cqes;
27832727
@@ -2853,20 +2797,15 @@ int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, · 69 unmodified lines
28532797 bnxt_qplib_arm_cq(cq, DBR_DBR_TYPE_CQ);
28542798 }
28552799 exit:
2856− spin_unlock_irqrestore(&cq->hwq.lock, flags);
28572800 return num_cqes - budget;
28582801 }
28592802
28602803 void bnxt_qplib_req_notify_cq(struct bnxt_qplib_cq *cq, u32 arm_type)
28612804 {
2862− unsigned long flags;
2863−
2864− spin_lock_irqsave(&cq->hwq.lock, flags);
28652805 if (arm_type)
28662806 bnxt_qplib_arm_cq(cq, arm_type);
28672807 /* Using cq->arm_state variable to track whether to issue cq handler */
28682808 atomic_set(&cq->arm_state, 1);
2869− spin_unlock_irqrestore(&cq->hwq.lock, flags);
28702809 }
28712810
28722811 void bnxt_qplib_flush_cqn_wq(struct bnxt_qplib_qp *qp)
drivers/infiniband/hw/bnxt_re/qplib_fp.h+12−0
@@ -389,6 +389,18 @@ struct bnxt_qplib_cq { · 388 unmodified lines
389389 struct list_head sqf_head, rqf_head;
390390 atomic_t arm_state;
391391 spinlock_t compl_lock; /* synch CQ handlers */
392+/* Locking Notes:
393+ * QP can move to error state from modify_qp, async error event or error
394+ * CQE as part of poll_cq. When QP is moved to error state, it gets added
395+ * to two flush lists, one each for SQ and RQ.
396+ * Each flush list is protected by qplib_cq->flush_lock. Both scq and rcq
397+ * flush_locks should be acquired when QP is moved to error. The control path
398+ * operations(modify_qp and async error events) are synchronized with poll_cq
399+ * using upper level CQ locks (bnxt_re_cq->cq_lock) of both SCQ and RCQ.
400+ * The qplib_cq->flush_lock is required to synchronize two instances of poll_cq
401+ * of the same QP while manipulating the flush list.
402+ */
403+ spinlock_t flush_lock; /* QP flush management */
392404 };
393405
394406 #define BNXT_QPLIB_MAX_IRRQE_ENTRY_SIZE sizeof(struct xrrq_irrq)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c+6−3
@@ -305,9 +305,8 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, · 304 unmodified lines
305305 err_event->res_err_state_reason);
306306 if (!qp)
307307 break;
308− bnxt_qplib_acquire_cq_locks(qp, &flags);
309308 bnxt_qplib_mark_qp_error(qp);
310− bnxt_qplib_release_cq_locks(qp, &flags);
309+ rcfw->aeq_handler(rcfw, qp_event, qp);
311310 break;
312311 default:
313312 /* Command Response */
@@ -460,7 +459,11 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, · 146 unmodified lines
460459 int rc;
461460
462461 RCFW_CMD_PREP(req, INITIALIZE_FW, cmd_flags);
463−
462+ /* Supply (log-base-2-of-host-page-size - base-page-shift)
463+ * to bono to adjust the doorbell page sizes.
464+ */
465+ req.log2_dbr_pg_size = cpu_to_le16(PAGE_SHIFT -
466+ RCFW_DBR_BASE_PAGE_SHIFT);
464467 /*
465468 * VFs need not setup the HW context area, PF
466469 * shall setup this area for VF. Skipping the
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h+1−0
@@ -49,6 +49,7 @@ · 48 unmodified lines
4949 #define RCFW_COMM_SIZE 0x104
5050
5151 #define RCFW_DBR_PCI_BAR_REGION 2
52+#define RCFW_DBR_BASE_PAGE_SHIFT 12
5253
5354 #define RCFW_CMD_PREP(req, CMD, cmd_flags) \
5455 do { \
drivers/infiniband/hw/bnxt_re/qplib_sp.c+2−1
@@ -139,7 +139,8 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, · 138 unmodified lines
139139 attr->max_pkey = le32_to_cpu(sb->max_pkeys);
140140
141141 attr->max_inline_data = le32_to_cpu(sb->max_inline_data);
142− attr->l2_db_size = (sb->l2_db_space_size + 1) * PAGE_SIZE;
142+ attr->l2_db_size = (sb->l2_db_space_size + 1) *
143+ (0x01 << RCFW_DBR_BASE_PAGE_SHIFT);
143144 attr->max_sgid = le32_to_cpu(sb->max_gid);
144145
145146 bnxt_qplib_query_version(rcfw, attr->fw_ver);
drivers/infiniband/hw/bnxt_re/roce_hsi.h+24−1
@@ -1761,7 +1761,30 @@ struct cmdq_initialize_fw { · 1760 unmodified lines
17611761 #define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_2M (0x3UL << 4)
17621762 #define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_8M (0x4UL << 4)
17631763 #define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_1G (0x5UL << 4)
1764− __le16 reserved16;
1764+ /* This value is (log-base-2-of-DBR-page-size - 12).
1765+ * 0 for 4KB. HW supported values are enumerated below.
1766+ */
1767+ __le16 log2_dbr_pg_size;
1768+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_MASK 0xfUL
1769+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_SFT 0
1770+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_4K 0x0UL
1771+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_8K 0x1UL
1772+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_16K 0x2UL
1773+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_32K 0x3UL
1774+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_64K 0x4UL
1775+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_128K 0x5UL
1776+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_256K 0x6UL
1777+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_512K 0x7UL
1778+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_1M 0x8UL
1779+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_2M 0x9UL
1780+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_4M 0xaUL
1781+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_8M 0xbUL
1782+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_16M 0xcUL
1783+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_32M 0xdUL
1784+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_64M 0xeUL
1785+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_128M 0xfUL
1786+ #define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_LAST \
1787+ CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_128M
17651788 __le64 qpc_page_dir;
17661789 __le64 mrw_page_dir;
17671790 __le64 srq_page_dir;
drivers/infiniband/hw/mlx4/cq.c+3−1
@@ -601,6 +601,7 @@ static void use_tunnel_data(struct mlx4_ib_qp *qp, struct mlx4_ib_cq *cq, struct · 600 unmodified lines
601601 wc->dlid_path_bits = 0;
602602
603603 if (is_eth) {
604+ wc->slid = 0;
604605 wc->vlan_id = be16_to_cpu(hdr->tun.sl_vid);
605606 memcpy(&(wc->smac[0]), (char *)&hdr->tun.mac_31_0, 4);
606607 memcpy(&(wc->smac[4]), (char *)&hdr->tun.slid_mac_47_32, 2);
@@ -851,7 +852,6 @@ repoll: · 244 unmodified lines
851852 }
852853 }
853854
854− wc->slid = be16_to_cpu(cqe->rlid);
855855 g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn);
856856 wc->src_qp = g_mlpath_rqpn & 0xffffff;
857857 wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f;
@@ -860,6 +860,7 @@ repoll: · 2 unmodified lines
860860 wc->wc_flags |= mlx4_ib_ipoib_csum_ok(cqe->status,
861861 cqe->checksum) ? IB_WC_IP_CSUM_OK : 0;
862862 if (is_eth) {
863+ wc->slid = 0;
863864 wc->sl = be16_to_cpu(cqe->sl_vid) >> 13;
864865 if (be32_to_cpu(cqe->vlan_my_qpn) &
865866 MLX4_CQE_CVLAN_PRESENT_MASK) {
@@ -871,6 +872,7 @@ repoll: · 5 unmodified lines
871872 memcpy(wc->smac, cqe->smac, ETH_ALEN);
872873 wc->wc_flags |= (IB_WC_WITH_VLAN | IB_WC_WITH_SMAC);
873874 } else {
875+ wc->slid = be16_to_cpu(cqe->rlid);
874876 wc->sl = be16_to_cpu(cqe->sl_vid) >> 12;
875877 wc->vlan_id = 0xffff;
876878 }
drivers/infiniband/hw/mlx4/main.c+7−4
@@ -219,8 +219,6 @@ static int mlx4_ib_update_gids_v1_v2(struct gid_entry *gids, · 218 unmodified lines
219219 gid_tbl[i].version = 2;
220220 if (!ipv6_addr_v4mapped((struct in6_addr *)&gids[i].gid))
221221 gid_tbl[i].type = 1;
222− else
223− memset(&gid_tbl[i].gid, 0, 12);
224222 }
225223 }
226224
@@ -366,8 +364,13 @@ static int mlx4_ib_del_gid(struct ib_device *device, · 139 unmodified lines
366364 if (!gids) {
367365 ret = -ENOMEM;
368366 } else {
369− for (i = 0; i < MLX4_MAX_PORT_GIDS; i++)
370− memcpy(&gids[i].gid, &port_gid_table->gids[i].gid, sizeof(union ib_gid));
367+ for (i = 0; i < MLX4_MAX_PORT_GIDS; i++) {
368+ memcpy(&gids[i].gid,
369+ &port_gid_table->gids[i].gid,
370+ sizeof(union ib_gid));
371+ gids[i].gid_type =
372+ port_gid_table->gids[i].gid_type;
373+ }
371374 }
372375 }
373376 spin_unlock_bh(&iboe->lock);
drivers/infiniband/hw/mlx5/cq.c+8−2
@@ -226,7 +226,6 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, · 225 unmodified lines
226226 wc->ex.invalidate_rkey = be32_to_cpu(cqe->imm_inval_pkey);
227227 break;
228228 }
229− wc->slid = be16_to_cpu(cqe->slid);
230229 wc->src_qp = be32_to_cpu(cqe->flags_rqpn) & 0xffffff;
231230 wc->dlid_path_bits = cqe->ml_path;
232231 g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3;
@@ -241,10 +240,12 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe, · 8 unmodified lines
241240 }
242241
243242 if (ll != IB_LINK_LAYER_ETHERNET) {
243+ wc->slid = be16_to_cpu(cqe->slid);
244244 wc->sl = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf;
245245 return;
246246 }
247247
248+ wc->slid = 0;
248249 vlan_present = cqe->l4_l3_hdr_type & 0x1;
249250 roce_packet_type = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0x3;
250251 if (vlan_present) {
@@ -1177,7 +1178,12 @@ static int resize_user(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, · 926 unmodified lines
11771178 if (ucmd.reserved0 || ucmd.reserved1)
11781179 return -EINVAL;
11791180
1180− umem = ib_umem_get(context, ucmd.buf_addr, entries * ucmd.cqe_size,
1181+ /* check multiplication overflow */
1182+ if (ucmd.cqe_size && SIZE_MAX / ucmd.cqe_size <= entries - 1)
1183+ return -EINVAL;
1184+
1185+ umem = ib_umem_get(context, ucmd.buf_addr,
1186+ (size_t)ucmd.cqe_size * entries,
11811187 IB_ACCESS_LOCAL_WRITE, 1);
11821188 if (IS_ERR(umem)) {
11831189 err = PTR_ERR(umem);
drivers/infiniband/hw/mlx5/main.c+9−12
@@ -245,12 +245,16 @@ struct mlx5_core_dev *mlx5_ib_get_native_port_mdev(struct mlx5_ib_dev *ibdev, · 244 unmodified lines
245245 struct mlx5_ib_multiport_info *mpi;
246246 struct mlx5_ib_port *port;
247247
248+ if (!mlx5_core_mp_enabled(ibdev->mdev) ||
249+ ll != IB_LINK_LAYER_ETHERNET) {
250+ if (native_port_num)
251+ *native_port_num = ib_port_num;
252+ return ibdev->mdev;
253+ }
254+
248255 if (native_port_num)
249256 *native_port_num = 1;
250257
251− if (!mlx5_core_mp_enabled(ibdev->mdev) || ll != IB_LINK_LAYER_ETHERNET)
252− return ibdev->mdev;
253−
254258 port = &ibdev->port[ib_port_num - 1];
255259 if (!port)
256260 return NULL;
@@ -3263,7 +3267,7 @@ static void mlx5_ib_handle_event(struct work_struct *_work) · 3006 unmodified lines
32633267 struct mlx5_ib_dev *ibdev;
32643268 struct ib_event ibev;
32653269 bool fatal = false;
3266− u8 port = 0;
3270+ u8 port = (u8)work->param;
32673271
32683272 if (mlx5_core_is_mp_slave(work->dev)) {
32693273 ibdev = mlx5_ib_get_ibdev_from_mpi(work->context);
@@ -3283,8 +3287,6 @@ static void mlx5_ib_handle_event(struct work_struct *_work) · 13 unmodified lines
32833287 case MLX5_DEV_EVENT_PORT_UP:
32843288 case MLX5_DEV_EVENT_PORT_DOWN:
32853289 case MLX5_DEV_EVENT_PORT_INITIALIZED:
3286− port = (u8)work->param;
3287−
32883290 /* In RoCE, port up/down events are handled in
32893291 * mlx5_netdev_event().
32903292 */
@@ -3298,24 +3300,19 @@ static void mlx5_ib_handle_event(struct work_struct *_work) · 7 unmodified lines
32983300
32993301 case MLX5_DEV_EVENT_LID_CHANGE:
33003302 ibev.event = IB_EVENT_LID_CHANGE;
3301− port = (u8)work->param;
33023303 break;
33033304
33043305 case MLX5_DEV_EVENT_PKEY_CHANGE:
33053306 ibev.event = IB_EVENT_PKEY_CHANGE;
3306− port = (u8)work->param;
3307−
33083307 schedule_work(&ibdev->devr.ports[port - 1].pkey_change_work);
33093308 break;
33103309
33113310 case MLX5_DEV_EVENT_GUID_CHANGE:
33123311 ibev.event = IB_EVENT_GID_CHANGE;
3313− port = (u8)work->param;
33143312 break;
33153313
33163314 case MLX5_DEV_EVENT_CLIENT_REREG:
33173315 ibev.event = IB_EVENT_CLIENT_REREGISTER;
3318− port = (u8)work->param;
33193316 break;
33203317 case MLX5_DEV_EVENT_DELAY_DROP_TIMEOUT:
33213318 schedule_work(&ibdev->delay_drop.delay_drop_work);
@@ -3327,7 +3324,7 @@ static void mlx5_ib_handle_event(struct work_struct *_work) · 5 unmodified lines
33273324 ibev.device = &ibdev->ib_dev;
33283325 ibev.element.port_num = port;
33293326
3330− if (port < 1 || port > ibdev->num_ports) {
3327+ if (!rdma_is_port_valid(&ibdev->ib_dev, port)) {
33313328 mlx5_ib_warn(ibdev, "warning: event on port %d\n", port);
33323329 goto out;
33333330 }
drivers/infiniband/hw/mlx5/mr.c+1−1
@@ -1816,7 +1816,6 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr, · 1815 unmodified lines
18161816
18171817 mr->ibmr.iova = sg_dma_address(sg) + sg_offset;
18181818 mr->ibmr.length = 0;
1819− mr->ndescs = sg_nents;
18201819
18211820 for_each_sg(sgl, sg, sg_nents, i) {
18221821 if (unlikely(i >= mr->max_descs))
@@ -1828,6 +1827,7 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr, · 5 unmodified lines
18281827
18291828 sg_offset = 0;
18301829 }
1830+ mr->ndescs = i;
18311831
18321832 if (sg_offset_p)
18331833 *sg_offset_p = sg_offset;
drivers/infiniband/hw/mlx5/qp.c+9−2
@@ -1584,6 +1584,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, · 1583 unmodified lines
15841584 u32 uidx = MLX5_IB_DEFAULT_UIDX;
15851585 struct mlx5_ib_create_qp ucmd;
15861586 struct mlx5_ib_qp_base *base;
1587+ int mlx5_st;
15871588 void *qpc;
15881589 u32 *in;
15891590 int err;
@@ -1592,6 +1593,10 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, · 2 unmodified lines
15921593 spin_lock_init(&qp->sq.lock);
15931594 spin_lock_init(&qp->rq.lock);
15941595
1596+ mlx5_st = to_mlx5_st(init_attr->qp_type);
1597+ if (mlx5_st < 0)
1598+ return -EINVAL;
1599+
15951600 if (init_attr->rwq_ind_tbl) {
15961601 if (!udata)
15971602 return -ENOSYS;
@@ -1753,7 +1758,7 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, · 155 unmodified lines
17531758
17541759 qpc = MLX5_ADDR_OF(create_qp_in, in, qpc);
17551760
1756− MLX5_SET(qpc, qpc, st, to_mlx5_st(init_attr->qp_type));
1761+ MLX5_SET(qpc, qpc, st, mlx5_st);
17571762 MLX5_SET(qpc, qpc, pm_state, MLX5_QP_PM_MIGRATED);
17581763
17591764 if (init_attr->qp_type != MLX5_IB_QPT_REG_UMR)
@@ -3095,8 +3100,10 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, · 1335 unmodified lines
30953100 goto out;
30963101
30973102 if (mlx5_cur >= MLX5_QP_NUM_STATE || mlx5_new >= MLX5_QP_NUM_STATE ||
3098− !optab[mlx5_cur][mlx5_new])
3103+ !optab[mlx5_cur][mlx5_new]) {
3104+ err = -EINVAL;
30993105 goto out;
3106+ }
31003107
31013108 op = optab[mlx5_cur][mlx5_new];
31023109 optpar = ib_mask_to_mlx5_opt(attr_mask);
drivers/infiniband/hw/qedr/qedr_iw_cm.c+11−8
@@ -458,8 +458,7 @@ qedr_addr6_resolve(struct qedr_dev *dev, · 457 unmodified lines
458458 }
459459 return -EINVAL;
460460 }
461− neigh = dst_neigh_lookup(dst, &dst_in);
462−
461+ neigh = dst_neigh_lookup(dst, &fl6.daddr);
463462 if (neigh) {
464463 rcu_read_lock();
465464 if (neigh->nud_state & NUD_VALID) {
@@ -494,10 +493,14 @@ int qedr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) · 28 unmodified lines
494493
495494 qp = idr_find(&dev->qpidr, conn_param->qpn);
496495
497− laddr = (struct sockaddr_in *)&cm_id->local_addr;
498− raddr = (struct sockaddr_in *)&cm_id->remote_addr;
499− laddr6 = (struct sockaddr_in6 *)&cm_id->local_addr;
500− raddr6 = (struct sockaddr_in6 *)&cm_id->remote_addr;
496+ laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
497+ raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
498+ laddr6 = (struct sockaddr_in6 *)&cm_id->m_local_addr;
499+ raddr6 = (struct sockaddr_in6 *)&cm_id->m_remote_addr;
500+
501+ DP_DEBUG(dev, QEDR_MSG_IWARP, "MAPPED %d %d\n",
502+ ntohs(((struct sockaddr_in *)&cm_id->remote_addr)->sin_port),
503+ ntohs(raddr->sin_port));
501504
502505 DP_DEBUG(dev, QEDR_MSG_IWARP,
503506 "Connect source address: %pISpc, remote address: %pISpc\n",
@@ -599,8 +602,8 @@ int qedr_iw_create_listen(struct iw_cm_id *cm_id, int backlog) · 95 unmodified lines
599602 int rc;
600603 int i;
601604
602− laddr = (struct sockaddr_in *)&cm_id->local_addr;
603− laddr6 = (struct sockaddr_in6 *)&cm_id->local_addr;
605+ laddr = (struct sockaddr_in *)&cm_id->m_local_addr;
606+ laddr6 = (struct sockaddr_in6 *)&cm_id->m_local_addr;
604607
605608 DP_DEBUG(dev, QEDR_MSG_IWARP,
606609 "Create Listener address: %pISpc\n", &cm_id->local_addr);
drivers/infiniband/hw/qedr/verbs.c+12−1
@@ -3034,6 +3034,11 @@ static int __qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 3033 unmodified lines
30343034
30353035 switch (wr->opcode) {
30363036 case IB_WR_SEND_WITH_IMM:
3037+ if (unlikely(rdma_protocol_iwarp(&dev->ibdev, 1))) {
3038+ rc = -EINVAL;
3039+ *bad_wr = wr;
3040+ break;
3041+ }
30373042 wqe->req_type = RDMA_SQ_REQ_TYPE_SEND_WITH_IMM;
30383043 swqe = (struct rdma_sq_send_wqe_1st *)wqe;
30393044 swqe->wqe_size = 2;
@@ -3075,6 +3080,11 @@ static int __qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 35 unmodified lines
30753080 break;
30763081
30773082 case IB_WR_RDMA_WRITE_WITH_IMM:
3083+ if (unlikely(rdma_protocol_iwarp(&dev->ibdev, 1))) {
3084+ rc = -EINVAL;
3085+ *bad_wr = wr;
3086+ break;
3087+ }
30783088 wqe->req_type = RDMA_SQ_REQ_TYPE_RDMA_WR_WITH_IMM;
30793089 rwqe = (struct rdma_sq_rdma_wqe_1st *)wqe;
30803090
@@ -3724,7 +3734,7 @@ int qedr_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 643 unmodified lines
37243734 {
37253735 struct qedr_dev *dev = get_qedr_dev(ibcq->device);
37263736 struct qedr_cq *cq = get_qedr_cq(ibcq);
3727− union rdma_cqe *cqe = cq->latest_cqe;
3737+ union rdma_cqe *cqe;
37283738 u32 old_cons, new_cons;
37293739 unsigned long flags;
37303740 int update = 0;
@@ -3741,6 +3751,7 @@ int qedr_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) · 10 unmodified lines
37413751 return qedr_gsi_poll_cq(ibcq, num_entries, wc);
37423752
37433753 spin_lock_irqsave(&cq->cq_lock, flags);
3754+ cqe = cq->latest_cqe;
37443755 old_cons = qed_chain_get_cons_idx_u32(&cq->pbl);
37453756 while (num_entries && is_valid_cqe(cq, cqe)) {
37463757 struct qedr_qp *qp;
drivers/net/ethernet/mellanox/mlx5/core/health.c+1−1
@@ -124,7 +124,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force) · 123 unmodified lines
124124 trigger_cmd_completions(dev);
125125 }
126126
127− mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 0);
127+ mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 1);
128128 mlx5_core_err(dev, "end\n");
129129
130130 unlock:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t