Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull more rdma fixes from Doug Ledford:
"As per my previous pull request, there were two drivers that each had
a rather large number of legitimate fixes still to be sent.

As it turned out, I also missed a reasonably large set of fixes from
one person across the stack that are all important fixes. All in all,
the bnxt_re, i40iw, and Dan Carpenter are 3/4 to 2/3rds of this pull
request.

There were some other random fixes that I didn't send in the last pull
request that I added to this one. This catches the rdma stack up to
the fixes from up to about the beginning of this week. Any more fixes
I'll wait and batch up later in the -rc cycle. This will give us a
good base to start with for basing a for-next branch on -rc2.

Summary:

- i40iw fixes

- bnxt_re fixes

- Dan Carpenter bugfixes across stack

- ten more random fixes, no more than two from any one person"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (37 commits)
RDMA/core: Initialize port_num in qp_attr
RDMA/uverbs: Fix the check for port number
IB/cma: Fix reference count leak when no ipv4 addresses are set
RDMA/iser: don't send an rkey if all data is written as immadiate-data
rxe: fix broken receive queue draining
RDMA/qedr: Prevent memory overrun in verbs' user responses
iw_cxgb4: don't use WR keys/addrs for 0 byte reads
IB/mlx4: Fix CM REQ retries in paravirt mode
IB/rdmavt: Setting of QP timeout can overflow jiffies computation
IB/core: Fix sparse warnings
RDMA/bnxt_re: Fix the value reported for local ack delay
RDMA/bnxt_re: Report MISSED_EVENTS in req_notify_cq
RDMA/bnxt_re: Fix return value of poll routine
RDMA/bnxt_re: Enable atomics only if host bios supports
RDMA/bnxt_re: Specify RDMA component when allocating stats context
RDMA/bnxt_re: Fixed the max_rd_atomic support for initiator and destination QP
RDMA/bnxt_re: Report supported value to IB stack in query_device
RDMA/bnxt_re: Do not free the ctx_tbl entry if delete GID fails
RDMA/bnxt_re: Fix WQE Size posted to HW to prevent it from throwing error
RDMA/bnxt_re: Free doorbell page index (DPI) during dealloc ucontext
...

+313 -126
+2
drivers/infiniband/core/cma.c
··· 1033 1033 } else 1034 1034 ret = iw_cm_init_qp_attr(id_priv->cm_id.iw, qp_attr, 1035 1035 qp_attr_mask); 1036 + qp_attr->port_num = id_priv->id.port_num; 1037 + *qp_attr_mask |= IB_QP_PORT; 1036 1038 } else 1037 1039 ret = -ENOSYS; 1038 1040
+2 -11
drivers/infiniband/core/uverbs_cmd.c
··· 1296 1296 struct ib_uobject *uobj; 1297 1297 struct ib_cq *cq; 1298 1298 struct ib_ucq_object *obj; 1299 - struct ib_uverbs_event_queue *ev_queue; 1300 1299 int ret = -EINVAL; 1301 1300 1302 1301 if (copy_from_user(&cmd, buf, sizeof cmd)) ··· 1312 1313 */ 1313 1314 uverbs_uobject_get(uobj); 1314 1315 cq = uobj->object; 1315 - ev_queue = cq->cq_context; 1316 1316 obj = container_of(cq->uobject, struct ib_ucq_object, uobject); 1317 1317 1318 1318 memset(&resp, 0, sizeof(resp)); ··· 1933 1935 goto out; 1934 1936 } 1935 1937 1936 - if (!rdma_is_port_valid(qp->device, cmd->base.port_num)) { 1938 + if ((cmd->base.attr_mask & IB_QP_PORT) && 1939 + !rdma_is_port_valid(qp->device, cmd->base.port_num)) { 1937 1940 ret = -EINVAL; 1938 1941 goto release_qp; 1939 1942 } ··· 2087 2088 struct ib_uverbs_destroy_qp cmd; 2088 2089 struct ib_uverbs_destroy_qp_resp resp; 2089 2090 struct ib_uobject *uobj; 2090 - struct ib_qp *qp; 2091 2091 struct ib_uqp_object *obj; 2092 2092 int ret = -EINVAL; 2093 2093 ··· 2100 2102 if (IS_ERR(uobj)) 2101 2103 return PTR_ERR(uobj); 2102 2104 2103 - qp = uobj->object; 2104 2105 obj = container_of(uobj, struct ib_uqp_object, uevent.uobject); 2105 2106 /* 2106 2107 * Make sure we don't free the memory in remove_commit as we still ··· 3001 3004 { 3002 3005 struct ib_uverbs_ex_destroy_wq cmd = {}; 3003 3006 struct ib_uverbs_ex_destroy_wq_resp resp = {}; 3004 - struct ib_wq *wq; 3005 3007 struct ib_uobject *uobj; 3006 3008 struct ib_uwq_object *obj; 3007 3009 size_t required_cmd_sz; ··· 3034 3038 if (IS_ERR(uobj)) 3035 3039 return PTR_ERR(uobj); 3036 3040 3037 - wq = uobj->object; 3038 3041 obj = container_of(uobj, struct ib_uwq_object, uevent.uobject); 3039 3042 /* 3040 3043 * Make sure we don't free the memory in remove_commit as we still ··· 3723 3728 struct ib_uverbs_destroy_srq cmd; 3724 3729 struct ib_uverbs_destroy_srq_resp resp; 3725 3730 struct ib_uobject *uobj; 3726 - struct ib_srq *srq; 3727 3731 struct ib_uevent_object *obj; 3728 3732 int ret = -EINVAL; 3729 - enum ib_srq_type srq_type; 3730 3733 3731 3734 if (copy_from_user(&cmd, buf, sizeof cmd)) 3732 3735 return -EFAULT; ··· 3734 3741 if (IS_ERR(uobj)) 3735 3742 return PTR_ERR(uobj); 3736 3743 3737 - srq = uobj->object; 3738 3744 obj = container_of(uobj, struct ib_uevent_object, uobject); 3739 - srq_type = srq->srq_type; 3740 3745 /* 3741 3746 * Make sure we don't free the memory in remove_commit as we still 3742 3747 * needs the uobject memory to create the response.
+9
drivers/infiniband/hw/bnxt_re/bnxt_re.h
··· 51 51 #define BNXT_RE_PAGE_SIZE_8M BIT(23) 52 52 #define BNXT_RE_PAGE_SIZE_1G BIT(30) 53 53 54 + #define BNXT_RE_MAX_MR_SIZE BIT(30) 55 + 54 56 #define BNXT_RE_MAX_QPC_COUNT (64 * 1024) 55 57 #define BNXT_RE_MAX_MRW_COUNT (64 * 1024) 56 58 #define BNXT_RE_MAX_SRQC_COUNT (64 * 1024) ··· 61 59 #define BNXT_RE_UD_QP_HW_STALL 0x400000 62 60 63 61 #define BNXT_RE_RQ_WQE_THRESHOLD 32 62 + 63 + /* 64 + * Setting the default ack delay value to 16, which means 65 + * the default timeout is approx. 260ms(4 usec * 2 ^(timeout)) 66 + */ 67 + 68 + #define BNXT_RE_DEFAULT_ACK_DELAY 16 64 69 65 70 struct bnxt_re_work { 66 71 struct work_struct work;
+72 -47
drivers/infiniband/hw/bnxt_re/ib_verbs.c
··· 145 145 ib_attr->fw_ver = (u64)(unsigned long)(dev_attr->fw_ver); 146 146 bnxt_qplib_get_guid(rdev->netdev->dev_addr, 147 147 (u8 *)&ib_attr->sys_image_guid); 148 - ib_attr->max_mr_size = ~0ull; 149 - ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_4K | BNXT_RE_PAGE_SIZE_8K | 150 - BNXT_RE_PAGE_SIZE_64K | BNXT_RE_PAGE_SIZE_2M | 151 - BNXT_RE_PAGE_SIZE_8M | BNXT_RE_PAGE_SIZE_1G; 148 + ib_attr->max_mr_size = BNXT_RE_MAX_MR_SIZE; 149 + ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_4K; 152 150 153 151 ib_attr->vendor_id = rdev->en_dev->pdev->vendor; 154 152 ib_attr->vendor_part_id = rdev->en_dev->pdev->device; ··· 172 174 ib_attr->max_mr = dev_attr->max_mr; 173 175 ib_attr->max_pd = dev_attr->max_pd; 174 176 ib_attr->max_qp_rd_atom = dev_attr->max_qp_rd_atom; 175 - ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_rd_atom; 176 - ib_attr->atomic_cap = IB_ATOMIC_HCA; 177 - ib_attr->masked_atomic_cap = IB_ATOMIC_HCA; 177 + ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom; 178 + if (dev_attr->is_atomic) { 179 + ib_attr->atomic_cap = IB_ATOMIC_HCA; 180 + ib_attr->masked_atomic_cap = IB_ATOMIC_HCA; 181 + } 178 182 179 183 ib_attr->max_ee_rd_atom = 0; 180 184 ib_attr->max_res_rd_atom = 0; ··· 201 201 ib_attr->max_fast_reg_page_list_len = MAX_PBL_LVL_1_PGS; 202 202 203 203 ib_attr->max_pkeys = 1; 204 - ib_attr->local_ca_ack_delay = 0; 204 + ib_attr->local_ca_ack_delay = BNXT_RE_DEFAULT_ACK_DELAY; 205 205 return 0; 206 206 } 207 207 ··· 390 390 return -EINVAL; 391 391 ctx->refcnt--; 392 392 if (!ctx->refcnt) { 393 - rc = bnxt_qplib_del_sgid 394 - (sgid_tbl, 395 - &sgid_tbl->tbl[ctx->idx], true); 396 - if (rc) 393 + rc = bnxt_qplib_del_sgid(sgid_tbl, 394 + &sgid_tbl->tbl[ctx->idx], 395 + true); 396 + if (rc) { 397 397 dev_err(rdev_to_dev(rdev), 398 398 "Failed to remove GID: %#x", rc); 399 - ctx_tbl = sgid_tbl->ctx; 400 - ctx_tbl[ctx->idx] = NULL; 401 - kfree(ctx); 399 + } else { 400 + ctx_tbl = sgid_tbl->ctx; 401 + ctx_tbl[ctx->idx] = NULL; 402 + kfree(ctx); 403 + } 402 404 } 403 405 } else { 404 406 return -EINVAL; ··· 590 588 591 589 /* Create a fence MW only for kernel consumers */ 592 590 mw = bnxt_re_alloc_mw(&pd->ib_pd, IB_MW_TYPE_1, NULL); 593 - if (!mw) { 591 + if (IS_ERR(mw)) { 594 592 dev_err(rdev_to_dev(rdev), 595 593 "Failed to create fence-MW for PD: %p\n", pd); 596 - rc = -EINVAL; 594 + rc = PTR_ERR(mw); 597 595 goto fail; 598 596 } 599 597 fence->mw = mw; ··· 614 612 int rc; 615 613 616 614 bnxt_re_destroy_fence_mr(pd); 617 - if (ib_pd->uobject && pd->dpi.dbr) { 618 - struct ib_ucontext *ib_uctx = ib_pd->uobject->context; 619 - struct bnxt_re_ucontext *ucntx; 620 615 621 - /* Free DPI only if this is the first PD allocated by the 622 - * application and mark the context dpi as NULL 623 - */ 624 - ucntx = container_of(ib_uctx, struct bnxt_re_ucontext, ib_uctx); 625 - 626 - rc = bnxt_qplib_dealloc_dpi(&rdev->qplib_res, 627 - &rdev->qplib_res.dpi_tbl, 628 - &pd->dpi); 616 + if (pd->qplib_pd.id) { 617 + rc = bnxt_qplib_dealloc_pd(&rdev->qplib_res, 618 + &rdev->qplib_res.pd_tbl, 619 + &pd->qplib_pd); 629 620 if (rc) 630 - dev_err(rdev_to_dev(rdev), "Failed to deallocate HW DPI"); 631 - /* Don't fail, continue*/ 632 - ucntx->dpi = NULL; 633 - } 634 - 635 - rc = bnxt_qplib_dealloc_pd(&rdev->qplib_res, 636 - &rdev->qplib_res.pd_tbl, 637 - &pd->qplib_pd); 638 - if (rc) { 639 - dev_err(rdev_to_dev(rdev), "Failed to deallocate HW PD"); 640 - return rc; 621 + dev_err(rdev_to_dev(rdev), "Failed to deallocate HW PD"); 641 622 } 642 623 643 624 kfree(pd); ··· 652 667 if (udata) { 653 668 struct bnxt_re_pd_resp resp; 654 669 655 - if (!ucntx->dpi) { 670 + if (!ucntx->dpi.dbr) { 656 671 /* Allocate DPI in alloc_pd to avoid failing of 657 672 * ibv_devinfo and family of application when DPIs 658 673 * are depleted. 659 674 */ 660 675 if (bnxt_qplib_alloc_dpi(&rdev->qplib_res.dpi_tbl, 661 - &pd->dpi, ucntx)) { 676 + &ucntx->dpi, ucntx)) { 662 677 rc = -ENOMEM; 663 678 goto dbfail; 664 679 } 665 - ucntx->dpi = &pd->dpi; 666 680 } 667 681 668 682 resp.pdid = pd->qplib_pd.id; 669 683 /* Still allow mapping this DBR to the new user PD. */ 670 - resp.dpi = ucntx->dpi->dpi; 671 - resp.dbr = (u64)ucntx->dpi->umdbr; 684 + resp.dpi = ucntx->dpi.dpi; 685 + resp.dbr = (u64)ucntx->dpi.umdbr; 672 686 673 687 rc = ib_copy_to_udata(udata, &resp, sizeof(resp)); 674 688 if (rc) { ··· 944 960 qplib_qp->rq.nmap = umem->nmap; 945 961 } 946 962 947 - qplib_qp->dpi = cntx->dpi; 963 + qplib_qp->dpi = &cntx->dpi; 948 964 return 0; 949 965 rqfail: 950 966 ib_umem_release(qp->sumem); ··· 1514 1530 if (qp_attr_mask & IB_QP_MAX_QP_RD_ATOMIC) { 1515 1531 qp->qplib_qp.modify_flags |= 1516 1532 CMDQ_MODIFY_QP_MODIFY_MASK_MAX_RD_ATOMIC; 1517 - qp->qplib_qp.max_rd_atomic = qp_attr->max_rd_atomic; 1533 + /* Cap the max_rd_atomic to device max */ 1534 + qp->qplib_qp.max_rd_atomic = min_t(u32, qp_attr->max_rd_atomic, 1535 + dev_attr->max_qp_rd_atom); 1518 1536 } 1519 1537 if (qp_attr_mask & IB_QP_SQ_PSN) { 1520 1538 qp->qplib_qp.modify_flags |= CMDQ_MODIFY_QP_MODIFY_MASK_SQ_PSN; 1521 1539 qp->qplib_qp.sq.psn = qp_attr->sq_psn; 1522 1540 } 1523 1541 if (qp_attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) { 1542 + if (qp_attr->max_dest_rd_atomic > 1543 + dev_attr->max_qp_init_rd_atom) { 1544 + dev_err(rdev_to_dev(rdev), 1545 + "max_dest_rd_atomic requested%d is > dev_max%d", 1546 + qp_attr->max_dest_rd_atomic, 1547 + dev_attr->max_qp_init_rd_atom); 1548 + return -EINVAL; 1549 + } 1550 + 1524 1551 qp->qplib_qp.modify_flags |= 1525 1552 CMDQ_MODIFY_QP_MODIFY_MASK_MAX_DEST_RD_ATOMIC; 1526 1553 qp->qplib_qp.max_dest_rd_atomic = qp_attr->max_dest_rd_atomic; ··· 2398 2403 } 2399 2404 cq->qplib_cq.sghead = cq->umem->sg_head.sgl; 2400 2405 cq->qplib_cq.nmap = cq->umem->nmap; 2401 - cq->qplib_cq.dpi = uctx->dpi; 2406 + cq->qplib_cq.dpi = &uctx->dpi; 2402 2407 } else { 2403 2408 cq->max_cql = min_t(u32, entries, MAX_CQL_PER_POLL); 2404 2409 cq->cql = kcalloc(cq->max_cql, sizeof(struct bnxt_qplib_cqe), ··· 2900 2905 2901 2906 spin_lock_irqsave(&cq->cq_lock, flags); 2902 2907 budget = min_t(u32, num_entries, cq->max_cql); 2908 + num_entries = budget; 2903 2909 if (!cq->cql) { 2904 2910 dev_err(rdev_to_dev(cq->rdev), "POLL CQ : no CQL to use"); 2905 2911 goto exit; ··· 3026 3030 /* Trigger on the next solicited completion */ 3027 3031 else if (ib_cqn_flags & IB_CQ_SOLICITED) 3028 3032 type = DBR_DBR_TYPE_CQ_ARMSE; 3033 + 3034 + /* Poll to see if there are missed events */ 3035 + if ((ib_cqn_flags & IB_CQ_REPORT_MISSED_EVENTS) && 3036 + !(bnxt_qplib_is_cq_empty(&cq->qplib_cq))) 3037 + return 1; 3029 3038 3030 3039 bnxt_qplib_req_notify_cq(&cq->qplib_cq, type); 3031 3040 ··· 3246 3245 struct scatterlist *sg; 3247 3246 int entry; 3248 3247 3248 + if (length > BNXT_RE_MAX_MR_SIZE) { 3249 + dev_err(rdev_to_dev(rdev), "MR Size: %lld > Max supported:%ld\n", 3250 + length, BNXT_RE_MAX_MR_SIZE); 3251 + return ERR_PTR(-ENOMEM); 3252 + } 3253 + 3249 3254 mr = kzalloc(sizeof(*mr), GFP_KERNEL); 3250 3255 if (!mr) 3251 3256 return ERR_PTR(-ENOMEM); ··· 3395 3388 struct bnxt_re_ucontext *uctx = container_of(ib_uctx, 3396 3389 struct bnxt_re_ucontext, 3397 3390 ib_uctx); 3391 + 3392 + struct bnxt_re_dev *rdev = uctx->rdev; 3393 + int rc = 0; 3394 + 3398 3395 if (uctx->shpg) 3399 3396 free_page((unsigned long)uctx->shpg); 3397 + 3398 + if (uctx->dpi.dbr) { 3399 + /* Free DPI only if this is the first PD allocated by the 3400 + * application and mark the context dpi as NULL 3401 + */ 3402 + rc = bnxt_qplib_dealloc_dpi(&rdev->qplib_res, 3403 + &rdev->qplib_res.dpi_tbl, 3404 + &uctx->dpi); 3405 + if (rc) 3406 + dev_err(rdev_to_dev(rdev), "Deallocte HW DPI failed!"); 3407 + /* Don't fail, continue*/ 3408 + uctx->dpi.dbr = NULL; 3409 + } 3410 + 3400 3411 kfree(uctx); 3401 3412 return 0; 3402 3413 }
+1 -2
drivers/infiniband/hw/bnxt_re/ib_verbs.h
··· 59 59 struct bnxt_re_dev *rdev; 60 60 struct ib_pd ib_pd; 61 61 struct bnxt_qplib_pd qplib_pd; 62 - struct bnxt_qplib_dpi dpi; 63 62 struct bnxt_re_fence_data fence; 64 63 }; 65 64 ··· 126 127 struct bnxt_re_ucontext { 127 128 struct bnxt_re_dev *rdev; 128 129 struct ib_ucontext ib_uctx; 129 - struct bnxt_qplib_dpi *dpi; 130 + struct bnxt_qplib_dpi dpi; 130 131 void *shpg; 131 132 spinlock_t sh_lock; /* protect shpg */ 132 133 };
+1
drivers/infiniband/hw/bnxt_re/main.c
··· 333 333 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1); 334 334 req.update_period_ms = cpu_to_le32(1000); 335 335 req.stats_dma_addr = cpu_to_le64(dma_map); 336 + req.stat_ctx_flags = STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE; 336 337 bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp, 337 338 sizeof(resp), DFLT_HWRM_CMD_TIMEOUT); 338 339 rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, BNXT_ROCE_ULP, &fw_msg);
+29
drivers/infiniband/hw/bnxt_re/qplib_fp.c
··· 1128 1128 } 1129 1129 /* Each SGE entry = 1 WQE size16 */ 1130 1130 wqe_size16 = wqe->num_sge; 1131 + /* HW requires wqe size has room for atleast one SGE even if 1132 + * none was supplied by ULP 1133 + */ 1134 + if (!wqe->num_sge) 1135 + wqe_size16++; 1131 1136 } 1132 1137 1133 1138 /* Specifics */ ··· 1369 1364 rqe->flags = wqe->flags; 1370 1365 rqe->wqe_size = wqe->num_sge + 1371 1366 ((offsetof(typeof(*rqe), data) + 15) >> 4); 1367 + /* HW requires wqe size has room for atleast one SGE even if none 1368 + * was supplied by ULP 1369 + */ 1370 + if (!wqe->num_sge) 1371 + rqe->wqe_size++; 1372 1372 1373 1373 /* Supply the rqe->wr_id index to the wr_id_tbl for now */ 1374 1374 rqe->wr_id[0] = cpu_to_le32(sw_prod); ··· 1892 1882 if (!rc) 1893 1883 rq->flush_in_progress = false; 1894 1884 } 1885 + return rc; 1886 + } 1887 + 1888 + bool bnxt_qplib_is_cq_empty(struct bnxt_qplib_cq *cq) 1889 + { 1890 + struct cq_base *hw_cqe, **hw_cqe_ptr; 1891 + unsigned long flags; 1892 + u32 sw_cons, raw_cons; 1893 + bool rc = true; 1894 + 1895 + spin_lock_irqsave(&cq->hwq.lock, flags); 1896 + raw_cons = cq->hwq.cons; 1897 + sw_cons = HWQ_CMP(raw_cons, &cq->hwq); 1898 + hw_cqe_ptr = (struct cq_base **)cq->hwq.pbl_ptr; 1899 + hw_cqe = &hw_cqe_ptr[CQE_PG(sw_cons)][CQE_IDX(sw_cons)]; 1900 + 1901 + /* Check for Valid bit. If the CQE is valid, return false */ 1902 + rc = !CQE_CMP_VALID(hw_cqe, raw_cons, cq->hwq.max_elements); 1903 + spin_unlock_irqrestore(&cq->hwq.lock, flags); 1895 1904 return rc; 1896 1905 } 1897 1906
+1
drivers/infiniband/hw/bnxt_re/qplib_fp.h
··· 449 449 int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq); 450 450 int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, 451 451 int num, struct bnxt_qplib_qp **qp); 452 + bool bnxt_qplib_is_cq_empty(struct bnxt_qplib_cq *cq); 452 453 void bnxt_qplib_req_notify_cq(struct bnxt_qplib_cq *cq, u32 arm_type); 453 454 void bnxt_qplib_free_nq(struct bnxt_qplib_nq *nq); 454 455 int bnxt_qplib_alloc_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq);
+16
drivers/infiniband/hw/bnxt_re/qplib_sp.c
··· 51 51 0, 0, 0, 0, 0, 0, 0, 0 } }; 52 52 53 53 /* Device */ 54 + 55 + static bool bnxt_qplib_is_atomic_cap(struct bnxt_qplib_rcfw *rcfw) 56 + { 57 + int rc; 58 + u16 pcie_ctl2; 59 + 60 + rc = pcie_capability_read_word(rcfw->pdev, PCI_EXP_DEVCTL2, 61 + &pcie_ctl2); 62 + if (rc) 63 + return false; 64 + return !!(pcie_ctl2 & PCI_EXP_DEVCTL2_ATOMIC_REQ); 65 + } 66 + 54 67 int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, 55 68 struct bnxt_qplib_dev_attr *attr) 56 69 { ··· 94 81 95 82 /* Extract the context from the side buffer */ 96 83 attr->max_qp = le32_to_cpu(sb->max_qp); 84 + /* max_qp value reported by FW for PF doesn't include the QP1 for PF */ 85 + attr->max_qp += 1; 97 86 attr->max_qp_rd_atom = 98 87 sb->max_qp_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ? 99 88 BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom; ··· 144 129 attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc); 145 130 } 146 131 132 + attr->is_atomic = bnxt_qplib_is_atomic_cap(rcfw); 147 133 bail: 148 134 bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf); 149 135 return rc;
+3
drivers/infiniband/hw/bnxt_re/qplib_sp.h
··· 42 42 43 43 #define BNXT_QPLIB_RESERVED_QP_WRS 128 44 44 45 + #define PCI_EXP_DEVCTL2_ATOMIC_REQ 0x0040 46 + 45 47 struct bnxt_qplib_dev_attr { 46 48 char fw_ver[32]; 47 49 u16 max_sgid; ··· 72 70 u32 max_inline_data; 73 71 u32 l2_db_size; 74 72 u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ]; 73 + bool is_atomic; 75 74 }; 76 75 77 76 struct bnxt_qplib_pd {
+4 -5
drivers/infiniband/hw/cxgb3/iwch_provider.c
··· 718 718 struct iwch_mr *mhp; 719 719 u32 mmid; 720 720 u32 stag = 0; 721 - int ret = 0; 721 + int ret = -ENOMEM; 722 722 723 723 if (mr_type != IB_MR_TYPE_MEM_REG || 724 724 max_num_sg > T3_MAX_FASTREG_DEPTH) ··· 731 731 goto err; 732 732 733 733 mhp->pages = kcalloc(max_num_sg, sizeof(u64), GFP_KERNEL); 734 - if (!mhp->pages) { 735 - ret = -ENOMEM; 734 + if (!mhp->pages) 736 735 goto pl_err; 737 - } 738 736 739 737 mhp->rhp = rhp; 740 738 ret = iwch_alloc_pbl(mhp, max_num_sg); ··· 749 751 mhp->attr.state = 1; 750 752 mmid = (stag) >> 8; 751 753 mhp->ibmr.rkey = mhp->ibmr.lkey = stag; 752 - if (insert_handle(rhp, &rhp->mmidr, mhp, mmid)) 754 + ret = insert_handle(rhp, &rhp->mmidr, mhp, mmid); 755 + if (ret) 753 756 goto err3; 754 757 755 758 pr_debug("%s mmid 0x%x mhp %p stag 0x%x\n", __func__, mmid, mhp, stag);
+1
drivers/infiniband/hw/cxgb4/cq.c
··· 963 963 goto err3; 964 964 965 965 if (ucontext) { 966 + ret = -ENOMEM; 966 967 mm = kmalloc(sizeof *mm, GFP_KERNEL); 967 968 if (!mm) 968 969 goto err4;
+1 -1
drivers/infiniband/hw/cxgb4/qp.c
··· 569 569 { 570 570 if (wr->num_sge > 1) 571 571 return -EINVAL; 572 - if (wr->num_sge) { 572 + if (wr->num_sge && wr->sg_list[0].length) { 573 573 wqe->read.stag_src = cpu_to_be32(rdma_wr(wr)->rkey); 574 574 wqe->read.to_src_hi = cpu_to_be32((u32)(rdma_wr(wr)->remote_addr 575 575 >> 32));
+1
drivers/infiniband/hw/i40iw/i40iw.h
··· 527 527 int i40iw_modify_qp(struct ib_qp *, struct ib_qp_attr *, int, struct ib_udata *); 528 528 void i40iw_cq_wq_destroy(struct i40iw_device *iwdev, struct i40iw_sc_cq *cq); 529 529 530 + void i40iw_cleanup_pending_cqp_op(struct i40iw_device *iwdev); 530 531 void i40iw_rem_pdusecount(struct i40iw_pd *iwpd, struct i40iw_device *iwdev); 531 532 void i40iw_add_pdusecount(struct i40iw_pd *iwpd); 532 533 void i40iw_rem_devusecount(struct i40iw_device *iwdev);
+4 -1
drivers/infiniband/hw/i40iw/i40iw_cm.c
··· 3487 3487 if (((original_hw_tcp_state == I40IW_TCP_STATE_CLOSED) || 3488 3488 (original_hw_tcp_state == I40IW_TCP_STATE_TIME_WAIT) || 3489 3489 (last_ae == I40IW_AE_RDMAP_ROE_BAD_LLP_CLOSE) || 3490 - (last_ae == I40IW_AE_LLP_CONNECTION_RESET))) { 3490 + (last_ae == I40IW_AE_LLP_CONNECTION_RESET) || 3491 + iwdev->reset)) { 3491 3492 issue_close = 1; 3492 3493 iwqp->cm_id = NULL; 3493 3494 if (!iwqp->flush_issued) { ··· 4266 4265 cm_node = container_of(list_node, struct i40iw_cm_node, connected_entry); 4267 4266 attr.qp_state = IB_QPS_ERR; 4268 4267 i40iw_modify_qp(&cm_node->iwqp->ibqp, &attr, IB_QP_STATE, NULL); 4268 + if (iwdev->reset) 4269 + i40iw_cm_disconn(cm_node->iwqp); 4269 4270 i40iw_rem_ref_cm_node(cm_node); 4270 4271 } 4271 4272 }
+2
drivers/infiniband/hw/i40iw/i40iw_ctrl.c
··· 1970 1970 ret_code = i40iw_cqp_poll_registers(cqp, tail, 1000); 1971 1971 } 1972 1972 1973 + cqp->process_cqp_sds = i40iw_update_sds_noccq; 1974 + 1973 1975 return ret_code; 1974 1976 } 1975 1977
+37 -37
drivers/infiniband/hw/i40iw/i40iw_main.c
··· 243 243 if (free_hwcqp) 244 244 dev->cqp_ops->cqp_destroy(dev->cqp); 245 245 246 + i40iw_cleanup_pending_cqp_op(iwdev); 247 + 246 248 i40iw_free_dma_mem(dev->hw, &cqp->sq); 247 249 kfree(cqp->scratch_array); 248 250 iwdev->cqp.scratch_array = NULL; ··· 276 274 /** 277 275 * i40iw_destroy_aeq - destroy aeq 278 276 * @iwdev: iwarp device 279 - * @reset: true if called before reset 280 277 * 281 278 * Issue a destroy aeq request and 282 279 * free the resources associated with the aeq 283 280 * The function is called during driver unload 284 281 */ 285 - static void i40iw_destroy_aeq(struct i40iw_device *iwdev, bool reset) 282 + static void i40iw_destroy_aeq(struct i40iw_device *iwdev) 286 283 { 287 284 enum i40iw_status_code status = I40IW_ERR_NOT_READY; 288 285 struct i40iw_sc_dev *dev = &iwdev->sc_dev; ··· 289 288 290 289 if (!iwdev->msix_shared) 291 290 i40iw_disable_irq(dev, iwdev->iw_msixtbl, (void *)iwdev); 292 - if (reset) 291 + if (iwdev->reset) 293 292 goto exit; 294 293 295 294 if (!dev->aeq_ops->aeq_destroy(&aeq->sc_aeq, 0, 1)) ··· 305 304 * i40iw_destroy_ceq - destroy ceq 306 305 * @iwdev: iwarp device 307 306 * @iwceq: ceq to be destroyed 308 - * @reset: true if called before reset 309 307 * 310 308 * Issue a destroy ceq request and 311 309 * free the resources associated with the ceq 312 310 */ 313 311 static void i40iw_destroy_ceq(struct i40iw_device *iwdev, 314 - struct i40iw_ceq *iwceq, 315 - bool reset) 312 + struct i40iw_ceq *iwceq) 316 313 { 317 314 enum i40iw_status_code status; 318 315 struct i40iw_sc_dev *dev = &iwdev->sc_dev; 319 316 320 - if (reset) 317 + if (iwdev->reset) 321 318 goto exit; 322 319 323 320 status = dev->ceq_ops->ceq_destroy(&iwceq->sc_ceq, 0, 1); ··· 334 335 /** 335 336 * i40iw_dele_ceqs - destroy all ceq's 336 337 * @iwdev: iwarp device 337 - * @reset: true if called before reset 338 338 * 339 339 * Go through all of the device ceq's and for each ceq 340 340 * disable the ceq interrupt and destroy the ceq 341 341 */ 342 - static void i40iw_dele_ceqs(struct i40iw_device *iwdev, bool reset) 342 + static void i40iw_dele_ceqs(struct i40iw_device *iwdev) 343 343 { 344 344 u32 i = 0; 345 345 struct i40iw_sc_dev *dev = &iwdev->sc_dev; ··· 347 349 348 350 if (iwdev->msix_shared) { 349 351 i40iw_disable_irq(dev, msix_vec, (void *)iwdev); 350 - i40iw_destroy_ceq(iwdev, iwceq, reset); 352 + i40iw_destroy_ceq(iwdev, iwceq); 351 353 iwceq++; 352 354 i++; 353 355 } 354 356 355 357 for (msix_vec++; i < iwdev->ceqs_count; i++, msix_vec++, iwceq++) { 356 358 i40iw_disable_irq(dev, msix_vec, (void *)iwceq); 357 - i40iw_destroy_ceq(iwdev, iwceq, reset); 359 + i40iw_destroy_ceq(iwdev, iwceq); 358 360 } 359 361 } 360 362 361 363 /** 362 364 * i40iw_destroy_ccq - destroy control cq 363 365 * @iwdev: iwarp device 364 - * @reset: true if called before reset 365 366 * 366 367 * Issue destroy ccq request and 367 368 * free the resources associated with the ccq 368 369 */ 369 - static void i40iw_destroy_ccq(struct i40iw_device *iwdev, bool reset) 370 + static void i40iw_destroy_ccq(struct i40iw_device *iwdev) 370 371 { 371 372 struct i40iw_sc_dev *dev = &iwdev->sc_dev; 372 373 struct i40iw_ccq *ccq = &iwdev->ccq; 373 374 enum i40iw_status_code status = 0; 374 375 375 - if (!reset) 376 + if (!iwdev->reset) 376 377 status = dev->ccq_ops->ccq_destroy(dev->ccq, 0, true); 377 378 if (status) 378 379 i40iw_pr_err("ccq destroy failed %d\n", status); ··· 807 810 iwceq->msix_idx = msix_vec->idx; 808 811 status = i40iw_configure_ceq_vector(iwdev, iwceq, ceq_id, msix_vec); 809 812 if (status) { 810 - i40iw_destroy_ceq(iwdev, iwceq, false); 813 + i40iw_destroy_ceq(iwdev, iwceq); 811 814 break; 812 815 } 813 816 i40iw_enable_intr(&iwdev->sc_dev, msix_vec->idx); ··· 909 912 910 913 status = i40iw_configure_aeq_vector(iwdev); 911 914 if (status) { 912 - i40iw_destroy_aeq(iwdev, false); 915 + i40iw_destroy_aeq(iwdev); 913 916 return status; 914 917 } 915 918 ··· 1439 1442 /** 1440 1443 * i40iw_deinit_device - clean up the device resources 1441 1444 * @iwdev: iwarp device 1442 - * @reset: true if called before reset 1443 1445 * 1444 1446 * Destroy the ib device interface, remove the mac ip entry and ipv4/ipv6 addresses, 1445 1447 * destroy the device queues and free the pble and the hmc objects 1446 1448 */ 1447 - static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset) 1449 + static void i40iw_deinit_device(struct i40iw_device *iwdev) 1448 1450 { 1449 1451 struct i40e_info *ldev = iwdev->ldev; 1450 1452 ··· 1460 1464 i40iw_destroy_rdma_device(iwdev->iwibdev); 1461 1465 /* fallthrough */ 1462 1466 case IP_ADDR_REGISTERED: 1463 - if (!reset) 1467 + if (!iwdev->reset) 1464 1468 i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx); 1465 1469 /* fallthrough */ 1466 1470 case INET_NOTIFIER: ··· 1470 1474 unregister_inet6addr_notifier(&i40iw_inetaddr6_notifier); 1471 1475 } 1472 1476 /* fallthrough */ 1473 - case CEQ_CREATED: 1474 - i40iw_dele_ceqs(iwdev, reset); 1475 - /* fallthrough */ 1476 - case AEQ_CREATED: 1477 - i40iw_destroy_aeq(iwdev, reset); 1478 - /* fallthrough */ 1479 - case IEQ_CREATED: 1480 - i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_IEQ, reset); 1481 - /* fallthrough */ 1482 - case ILQ_CREATED: 1483 - i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_ILQ, reset); 1484 - /* fallthrough */ 1485 - case CCQ_CREATED: 1486 - i40iw_destroy_ccq(iwdev, reset); 1487 - /* fallthrough */ 1488 1477 case PBLE_CHUNK_MEM: 1489 1478 i40iw_destroy_pble_pool(dev, iwdev->pble_rsrc); 1490 1479 /* fallthrough */ 1480 + case CEQ_CREATED: 1481 + i40iw_dele_ceqs(iwdev); 1482 + /* fallthrough */ 1483 + case AEQ_CREATED: 1484 + i40iw_destroy_aeq(iwdev); 1485 + /* fallthrough */ 1486 + case IEQ_CREATED: 1487 + i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_IEQ, iwdev->reset); 1488 + /* fallthrough */ 1489 + case ILQ_CREATED: 1490 + i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_ILQ, iwdev->reset); 1491 + /* fallthrough */ 1492 + case CCQ_CREATED: 1493 + i40iw_destroy_ccq(iwdev); 1494 + /* fallthrough */ 1491 1495 case HMC_OBJS_CREATED: 1492 - i40iw_del_hmc_objects(dev, dev->hmc_info, true, reset); 1496 + i40iw_del_hmc_objects(dev, dev->hmc_info, true, iwdev->reset); 1493 1497 /* fallthrough */ 1494 1498 case CQP_CREATED: 1495 1499 i40iw_destroy_cqp(iwdev, true); ··· 1666 1670 status = i40iw_hmc_init_pble(&iwdev->sc_dev, iwdev->pble_rsrc); 1667 1671 if (status) 1668 1672 break; 1673 + iwdev->init_state = PBLE_CHUNK_MEM; 1669 1674 iwdev->virtchnl_wq = alloc_ordered_workqueue("iwvch", WQ_MEM_RECLAIM); 1670 1675 i40iw_register_notifiers(); 1671 1676 iwdev->init_state = INET_NOTIFIER; ··· 1690 1693 } while (0); 1691 1694 1692 1695 i40iw_pr_err("status = %d last completion = %d\n", status, iwdev->init_state); 1693 - i40iw_deinit_device(iwdev, false); 1696 + i40iw_deinit_device(iwdev); 1694 1697 return -ERESTART; 1695 1698 } 1696 1699 ··· 1771 1774 iwdev = &hdl->device; 1772 1775 iwdev->closing = true; 1773 1776 1777 + if (reset) 1778 + iwdev->reset = true; 1779 + 1774 1780 i40iw_cm_disconnect_all(iwdev); 1775 1781 destroy_workqueue(iwdev->virtchnl_wq); 1776 - i40iw_deinit_device(iwdev, reset); 1782 + i40iw_deinit_device(iwdev); 1777 1783 } 1778 1784 1779 1785 /**
+4 -1
drivers/infiniband/hw/i40iw/i40iw_puda.c
··· 408 408 set_64bit_val(wqe, 0, info->paddr); 409 409 set_64bit_val(wqe, 8, LS_64(info->len, I40IWQPSQ_FRAG_LEN)); 410 410 set_64bit_val(wqe, 16, header[0]); 411 + 412 + /* Ensure all data is written before writing valid bit */ 413 + wmb(); 411 414 set_64bit_val(wqe, 24, header[1]); 412 415 413 416 i40iw_debug_buf(qp->dev, I40IW_DEBUG_PUDA, "PUDA SEND WQE", wqe, 32); ··· 1414 1411 1415 1412 if (!list_empty(rxlist)) { 1416 1413 tmpbuf = (struct i40iw_puda_buf *)rxlist->next; 1417 - plist = &tmpbuf->list; 1418 1414 while ((struct list_head *)tmpbuf != rxlist) { 1419 1415 if ((int)(buf->seqnum - tmpbuf->seqnum) < 0) 1420 1416 break; 1417 + plist = &tmpbuf->list; 1421 1418 tmpbuf = (struct i40iw_puda_buf *)plist->next; 1422 1419 } 1423 1420 /* Insert buf before tmpbuf */
+58 -2
drivers/infiniband/hw/i40iw/i40iw_utils.c
··· 337 337 */ 338 338 void i40iw_free_cqp_request(struct i40iw_cqp *cqp, struct i40iw_cqp_request *cqp_request) 339 339 { 340 + struct i40iw_device *iwdev = container_of(cqp, struct i40iw_device, cqp); 340 341 unsigned long flags; 341 342 342 343 if (cqp_request->dynamic) { ··· 351 350 list_add_tail(&cqp_request->list, &cqp->cqp_avail_reqs); 352 351 spin_unlock_irqrestore(&cqp->req_lock, flags); 353 352 } 353 + wake_up(&iwdev->close_wq); 354 354 } 355 355 356 356 /** ··· 364 362 { 365 363 if (atomic_dec_and_test(&cqp_request->refcount)) 366 364 i40iw_free_cqp_request(cqp, cqp_request); 365 + } 366 + 367 + /** 368 + * i40iw_free_pending_cqp_request -free pending cqp request objs 369 + * @cqp: cqp ptr 370 + * @cqp_request: to be put back in cqp list 371 + */ 372 + static void i40iw_free_pending_cqp_request(struct i40iw_cqp *cqp, 373 + struct i40iw_cqp_request *cqp_request) 374 + { 375 + struct i40iw_device *iwdev = container_of(cqp, struct i40iw_device, cqp); 376 + 377 + if (cqp_request->waiting) { 378 + cqp_request->compl_info.error = true; 379 + cqp_request->request_done = true; 380 + wake_up(&cqp_request->waitq); 381 + } 382 + i40iw_put_cqp_request(cqp, cqp_request); 383 + wait_event_timeout(iwdev->close_wq, 384 + !atomic_read(&cqp_request->refcount), 385 + 1000); 386 + } 387 + 388 + /** 389 + * i40iw_cleanup_pending_cqp_op - clean-up cqp with no completions 390 + * @iwdev: iwarp device 391 + */ 392 + void i40iw_cleanup_pending_cqp_op(struct i40iw_device *iwdev) 393 + { 394 + struct i40iw_sc_dev *dev = &iwdev->sc_dev; 395 + struct i40iw_cqp *cqp = &iwdev->cqp; 396 + struct i40iw_cqp_request *cqp_request = NULL; 397 + struct cqp_commands_info *pcmdinfo = NULL; 398 + u32 i, pending_work, wqe_idx; 399 + 400 + pending_work = I40IW_RING_WORK_AVAILABLE(cqp->sc_cqp.sq_ring); 401 + wqe_idx = I40IW_RING_GETCURRENT_TAIL(cqp->sc_cqp.sq_ring); 402 + for (i = 0; i < pending_work; i++) { 403 + cqp_request = (struct i40iw_cqp_request *)(unsigned long)cqp->scratch_array[wqe_idx]; 404 + if (cqp_request) 405 + i40iw_free_pending_cqp_request(cqp, cqp_request); 406 + wqe_idx = (wqe_idx + 1) % I40IW_RING_GETSIZE(cqp->sc_cqp.sq_ring); 407 + } 408 + 409 + while (!list_empty(&dev->cqp_cmd_head)) { 410 + pcmdinfo = (struct cqp_commands_info *)i40iw_remove_head(&dev->cqp_cmd_head); 411 + cqp_request = container_of(pcmdinfo, struct i40iw_cqp_request, info); 412 + if (cqp_request) 413 + i40iw_free_pending_cqp_request(cqp, cqp_request); 414 + } 367 415 } 368 416 369 417 /** ··· 598 546 cqp_info->in.u.qp_destroy.scratch = (uintptr_t)cqp_request; 599 547 cqp_info->in.u.qp_destroy.remove_hash_idx = true; 600 548 status = i40iw_handle_cqp_op(iwdev, cqp_request); 601 - if (status) 602 - i40iw_pr_err("CQP-OP Destroy QP fail"); 549 + if (!status) 550 + return; 551 + 552 + i40iw_rem_pdusecount(iwqp->iwpd, iwdev); 553 + i40iw_free_qp_resources(iwdev, iwqp, qp_num); 554 + i40iw_rem_devusecount(iwdev); 603 555 } 604 556 605 557 /**
+14 -5
drivers/infiniband/hw/i40iw/i40iw_verbs.c
··· 426 426 struct i40iw_qp *iwqp, 427 427 u32 qp_num) 428 428 { 429 + struct i40iw_pbl *iwpbl = &iwqp->iwpbl; 430 + 429 431 i40iw_dealloc_push_page(iwdev, &iwqp->sc_qp); 430 432 if (qp_num) 431 433 i40iw_free_resource(iwdev, iwdev->allocated_qps, qp_num); 434 + if (iwpbl->pbl_allocated) 435 + i40iw_free_pble(iwdev->pble_rsrc, &iwpbl->pble_alloc); 432 436 i40iw_free_dma_mem(iwdev->sc_dev.hw, &iwqp->q2_ctx_mem); 433 437 i40iw_free_dma_mem(iwdev->sc_dev.hw, &iwqp->kqp.dma_mem); 434 438 kfree(iwqp->kqp.wrid_mem); ··· 487 483 struct i40iw_qp *iwqp, 488 484 struct i40iw_qp_init_info *init_info) 489 485 { 490 - struct i40iw_pbl *iwpbl = iwqp->iwpbl; 486 + struct i40iw_pbl *iwpbl = &iwqp->iwpbl; 491 487 struct i40iw_qp_mr *qpmr = &iwpbl->qp_mr; 492 488 493 489 iwqp->page = qpmr->sq_page; ··· 692 688 ucontext = to_ucontext(ibpd->uobject->context); 693 689 694 690 if (req.user_wqe_buffers) { 691 + struct i40iw_pbl *iwpbl; 692 + 695 693 spin_lock_irqsave( 696 694 &ucontext->qp_reg_mem_list_lock, flags); 697 - iwqp->iwpbl = i40iw_get_pbl( 695 + iwpbl = i40iw_get_pbl( 698 696 (unsigned long)req.user_wqe_buffers, 699 697 &ucontext->qp_reg_mem_list); 700 698 spin_unlock_irqrestore( 701 699 &ucontext->qp_reg_mem_list_lock, flags); 702 700 703 - if (!iwqp->iwpbl) { 701 + if (!iwpbl) { 704 702 err_code = -ENODATA; 705 703 i40iw_pr_err("no pbl info\n"); 706 704 goto error; 707 705 } 706 + memcpy(&iwqp->iwpbl, iwpbl, sizeof(iwqp->iwpbl)); 708 707 } 709 708 } 710 709 err_code = i40iw_setup_virt_qp(iwdev, iwqp, &init_info); ··· 1168 1161 memset(&req, 0, sizeof(req)); 1169 1162 iwcq->user_mode = true; 1170 1163 ucontext = to_ucontext(context); 1171 - if (ib_copy_from_udata(&req, udata, sizeof(struct i40iw_create_cq_req))) 1164 + if (ib_copy_from_udata(&req, udata, sizeof(struct i40iw_create_cq_req))) { 1165 + err_code = -EFAULT; 1172 1166 goto cq_free_resources; 1167 + } 1173 1168 1174 1169 spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags); 1175 1170 iwpbl = i40iw_get_pbl((unsigned long)req.user_cq_buffer, ··· 2072 2063 ucontext = to_ucontext(ibpd->uobject->context); 2073 2064 i40iw_del_memlist(iwmr, ucontext); 2074 2065 } 2075 - if (iwpbl->pbl_allocated) 2066 + if (iwpbl->pbl_allocated && iwmr->type != IW_MEMREG_TYPE_QP) 2076 2067 i40iw_free_pble(iwdev->pble_rsrc, palloc); 2077 2068 kfree(iwmr); 2078 2069 return 0;
+1 -1
drivers/infiniband/hw/i40iw/i40iw_verbs.h
··· 170 170 struct i40iw_qp_kmode kqp; 171 171 struct i40iw_dma_mem host_ctx; 172 172 struct timer_list terminate_timer; 173 - struct i40iw_pbl *iwpbl; 173 + struct i40iw_pbl iwpbl; 174 174 struct i40iw_dma_mem q2_ctx_mem; 175 175 struct i40iw_dma_mem ietf_mem; 176 176 struct completion sq_drained;
+4
drivers/infiniband/hw/mlx4/cm.c
··· 323 323 mad->mad_hdr.attr_id == CM_REP_ATTR_ID || 324 324 mad->mad_hdr.attr_id == CM_SIDR_REQ_ATTR_ID) { 325 325 sl_cm_id = get_local_comm_id(mad); 326 + id = id_map_get(ibdev, &pv_cm_id, slave_id, sl_cm_id); 327 + if (id) 328 + goto cont; 326 329 id = id_map_alloc(ibdev, slave_id, sl_cm_id); 327 330 if (IS_ERR(id)) { 328 331 mlx4_ib_warn(ibdev, "%s: id{slave: %d, sl_cm_id: 0x%x} Failed to id_map_alloc\n", ··· 346 343 return -EINVAL; 347 344 } 348 345 346 + cont: 349 347 set_local_comm_id(mad, id->pv_cm_id); 350 348 351 349 if (mad->mad_hdr.attr_id == CM_DREQ_ATTR_ID)
+1 -1
drivers/infiniband/hw/mlx5/mr.c
··· 835 835 access_flags, 0); 836 836 err = PTR_ERR_OR_ZERO(*umem); 837 837 if (err < 0) { 838 - mlx5_ib_err(dev, "umem get failed (%ld)\n", PTR_ERR(umem)); 838 + mlx5_ib_err(dev, "umem get failed (%d)\n", err); 839 839 return err; 840 840 } 841 841
+3 -1
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
··· 744 744 if (is_uctx_pd) { 745 745 ocrdma_release_ucontext_pd(uctx); 746 746 } else { 747 - status = _ocrdma_dealloc_pd(dev, pd); 747 + if (_ocrdma_dealloc_pd(dev, pd)) 748 + pr_err("%s: _ocrdma_dealloc_pd() failed\n", __func__); 748 749 } 749 750 exit: 750 751 return ERR_PTR(status); ··· 1902 1901 goto err; 1903 1902 1904 1903 if (udata == NULL) { 1904 + status = -ENOMEM; 1905 1905 srq->rqe_wr_id_tbl = kzalloc(sizeof(u64) * srq->rq.max_cnt, 1906 1906 GFP_KERNEL); 1907 1907 if (srq->rqe_wr_id_tbl == NULL)
+12 -4
drivers/infiniband/hw/qedr/verbs.c
··· 53 53 54 54 #define DB_ADDR_SHIFT(addr) ((addr) << DB_PWM_ADDR_OFFSET_SHIFT) 55 55 56 + static inline int qedr_ib_copy_to_udata(struct ib_udata *udata, void *src, 57 + size_t len) 58 + { 59 + size_t min_len = min_t(size_t, len, udata->outlen); 60 + 61 + return ib_copy_to_udata(udata, src, min_len); 62 + } 63 + 56 64 int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) 57 65 { 58 66 if (index > QEDR_ROCE_PKEY_TABLE_LEN) ··· 386 378 uresp.sges_per_srq_wr = dev->attr.max_srq_sge; 387 379 uresp.max_cqes = QEDR_MAX_CQES; 388 380 389 - rc = ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 381 + rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 390 382 if (rc) 391 383 goto err; 392 384 ··· 507 499 508 500 uresp.pd_id = pd_id; 509 501 510 - rc = ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 502 + rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 511 503 if (rc) { 512 504 DP_ERR(dev, "copy error pd_id=0x%x.\n", pd_id); 513 505 dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd_id); ··· 737 729 uresp.db_offset = DB_ADDR_SHIFT(DQ_PWM_OFFSET_UCM_RDMA_CQ_CONS_32BIT); 738 730 uresp.icid = cq->icid; 739 731 740 - rc = ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 732 + rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 741 733 if (rc) 742 734 DP_ERR(dev, "copy error cqid=0x%x.\n", cq->icid); 743 735 ··· 1246 1238 uresp.atomic_supported = dev->atomic_cap != IB_ATOMIC_NONE; 1247 1239 uresp.qp_id = qp->qp_id; 1248 1240 1249 - rc = ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 1241 + rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 1250 1242 if (rc) 1251 1243 DP_ERR(dev, 1252 1244 "create qp: failed a copy to user space with qp icid=0x%x.\n",
+1 -3
drivers/infiniband/sw/rdmavt/qp.c
··· 1258 1258 1259 1259 if (attr_mask & IB_QP_TIMEOUT) { 1260 1260 qp->timeout = attr->timeout; 1261 - qp->timeout_jiffies = 1262 - usecs_to_jiffies((4096UL * (1UL << qp->timeout)) / 1263 - 1000UL); 1261 + qp->timeout_jiffies = rvt_timeout_to_jiffies(qp->timeout); 1264 1262 } 1265 1263 1266 1264 if (attr_mask & IB_QP_QKEY)
+3
drivers/infiniband/sw/rxe/rxe_resp.c
··· 1219 1219 kfree_skb(skb); 1220 1220 } 1221 1221 1222 + if (notify) 1223 + return; 1224 + 1222 1225 while (!qp->srq && qp->rq.queue && queue_head(qp->rq.queue)) 1223 1226 advance_consumer(qp->rq.queue); 1224 1227 }
+3
drivers/infiniband/sw/rxe/rxe_verbs.c
··· 914 914 915 915 spin_unlock_irqrestore(&rq->producer_lock, flags); 916 916 917 + if (qp->resp.state == QP_STATE_ERROR) 918 + rxe_run_task(&qp->resp.task, 1); 919 + 917 920 err1: 918 921 return err; 919 922 }
+1
drivers/infiniband/ulp/ipoib/ipoib_main.c
··· 2239 2239 goto register_failed; 2240 2240 } 2241 2241 2242 + result = -ENOMEM; 2242 2243 if (ipoib_cm_add_mode_attr(priv->dev)) 2243 2244 goto sysfs_failed; 2244 2245 if (ipoib_add_pkey_attr(priv->dev))
+4 -2
drivers/infiniband/ulp/iser/iser_initiator.c
··· 137 137 138 138 if (unsol_sz < edtl) { 139 139 hdr->flags |= ISER_WSV; 140 - hdr->write_stag = cpu_to_be32(mem_reg->rkey); 141 - hdr->write_va = cpu_to_be64(mem_reg->sge.addr + unsol_sz); 140 + if (buf_out->data_len > imm_sz) { 141 + hdr->write_stag = cpu_to_be32(mem_reg->rkey); 142 + hdr->write_va = cpu_to_be64(mem_reg->sge.addr + unsol_sz); 143 + } 142 144 143 145 iser_dbg("Cmd itt:%d, WRITE tags, RKEY:%#.4X " 144 146 "VA:%#llX + unsol:%d\n",
+4 -2
include/rdma/ib_addr.h
··· 205 205 dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); 206 206 if (dev) { 207 207 ip4 = in_dev_get(dev); 208 - if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) { 208 + if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) 209 209 ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address, 210 210 (struct in6_addr *)gid); 211 + 212 + if (ip4) 211 213 in_dev_put(ip4); 212 - } 214 + 213 215 dev_put(dev); 214 216 } 215 217 }
+14
include/rdma/rdmavt_qp.h
··· 647 647 return len >> qp->log_pmtu; 648 648 } 649 649 650 + /** 651 + * rvt_timeout_to_jiffies - Convert a ULP timeout input into jiffies 652 + * @timeout - timeout input(0 - 31). 653 + * 654 + * Return a timeout value in jiffies. 655 + */ 656 + static inline unsigned long rvt_timeout_to_jiffies(u8 timeout) 657 + { 658 + if (timeout > 31) 659 + timeout = 31; 660 + 661 + return usecs_to_jiffies(1U << timeout) * 4096UL / 1000UL; 662 + } 663 + 650 664 extern const int ib_rvt_state_ops[]; 651 665 652 666 struct rvt_dev_info;