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 rdma fixes from Doug Ledford:
"Most are minor to important fixes.

There is one performance enhancement that I took on the grounds that
failing to check if other processes can run before running what's
intended to be a background, idle-time task is a bug, even though the
primary effect of the fix is to improve performance (and it was a very
simple patch)"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma:
IB/mlx5: Postpone remove_keys under knowledge of coming preemption
IB/mlx4: Use vmalloc for WR buffers when needed
IB/mlx4: Use correct order of variables in log message
iser-target: Remove explicit mlx4 work-around
mlx4: Expose correct max_sge_rd limit
IB/mad: Require CM send method for everything except ClassPortInfo
IB/cma: Add a missing rcu_read_unlock()
IB core: Fix ib_sg_to_pages()
IB/srp: Fix srp_map_sg_fr()
IB/srp: Fix indirect data buffer rkey endianness
IB/srp: Initialize dma_length in srp_map_idb
IB/srp: Fix possible send queue overflow
IB/srp: Fix a memory leak
IB/sa: Put netlink request into the request list before sending
IB/iser: use sector_div instead of do_div
IB/core: use RCU for uverbs id lookup
IB/qib: Minor fixes to qib per SFF 8636
IB/core: Fix user mode post wr corruption
IB/qib: Fix qib_mr structure

+145 -101
+1 -4
drivers/infiniband/core/cma.c
··· 1126 1126 1127 1127 rcu_read_lock(); 1128 1128 err = fib_lookup(dev_net(net_dev), &fl4, &res, 0); 1129 - if (err) 1130 - return false; 1131 - 1132 - ret = FIB_RES_DEV(res) == net_dev; 1129 + ret = err == 0 && FIB_RES_DEV(res) == net_dev; 1133 1130 rcu_read_unlock(); 1134 1131 1135 1132 return ret;
+5
drivers/infiniband/core/mad.c
··· 1811 1811 if (qp_num == 0) 1812 1812 valid = 1; 1813 1813 } else { 1814 + /* CM attributes other than ClassPortInfo only use Send method */ 1815 + if ((mad_hdr->mgmt_class == IB_MGMT_CLASS_CM) && 1816 + (mad_hdr->attr_id != IB_MGMT_CLASSPORTINFO_ATTR_ID) && 1817 + (mad_hdr->method != IB_MGMT_METHOD_SEND)) 1818 + goto out; 1814 1819 /* Filter GSI packets sent to QP0 */ 1815 1820 if (qp_num != 0) 1816 1821 valid = 1;
+17 -15
drivers/infiniband/core/sa_query.c
··· 512 512 return len; 513 513 } 514 514 515 - static int ib_nl_send_msg(struct ib_sa_query *query) 515 + static int ib_nl_send_msg(struct ib_sa_query *query, gfp_t gfp_mask) 516 516 { 517 517 struct sk_buff *skb = NULL; 518 518 struct nlmsghdr *nlh; ··· 526 526 if (len <= 0) 527 527 return -EMSGSIZE; 528 528 529 - skb = nlmsg_new(len, GFP_KERNEL); 529 + skb = nlmsg_new(len, gfp_mask); 530 530 if (!skb) 531 531 return -ENOMEM; 532 532 ··· 544 544 /* Repair the nlmsg header length */ 545 545 nlmsg_end(skb, nlh); 546 546 547 - ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_LS, GFP_KERNEL); 547 + ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_LS, gfp_mask); 548 548 if (!ret) 549 549 ret = len; 550 550 else ··· 553 553 return ret; 554 554 } 555 555 556 - static int ib_nl_make_request(struct ib_sa_query *query) 556 + static int ib_nl_make_request(struct ib_sa_query *query, gfp_t gfp_mask) 557 557 { 558 558 unsigned long flags; 559 559 unsigned long delay; ··· 562 562 INIT_LIST_HEAD(&query->list); 563 563 query->seq = (u32)atomic_inc_return(&ib_nl_sa_request_seq); 564 564 565 + /* Put the request on the list first.*/ 565 566 spin_lock_irqsave(&ib_nl_request_lock, flags); 566 - ret = ib_nl_send_msg(query); 567 - if (ret <= 0) { 568 - ret = -EIO; 569 - goto request_out; 570 - } else { 571 - ret = 0; 572 - } 573 - 574 567 delay = msecs_to_jiffies(sa_local_svc_timeout_ms); 575 568 query->timeout = delay + jiffies; 576 569 list_add_tail(&query->list, &ib_nl_request_list); 577 570 /* Start the timeout if this is the only request */ 578 571 if (ib_nl_request_list.next == &query->list) 579 572 queue_delayed_work(ib_nl_wq, &ib_nl_timed_work, delay); 580 - 581 - request_out: 582 573 spin_unlock_irqrestore(&ib_nl_request_lock, flags); 574 + 575 + ret = ib_nl_send_msg(query, gfp_mask); 576 + if (ret <= 0) { 577 + ret = -EIO; 578 + /* Remove the request */ 579 + spin_lock_irqsave(&ib_nl_request_lock, flags); 580 + list_del(&query->list); 581 + spin_unlock_irqrestore(&ib_nl_request_lock, flags); 582 + } else { 583 + ret = 0; 584 + } 583 585 584 586 return ret; 585 587 } ··· 1110 1108 1111 1109 if (query->flags & IB_SA_ENABLE_LOCAL_SERVICE) { 1112 1110 if (!ibnl_chk_listeners(RDMA_NL_GROUP_LS)) { 1113 - if (!ib_nl_make_request(query)) 1111 + if (!ib_nl_make_request(query, gfp_mask)) 1114 1112 return id; 1115 1113 } 1116 1114 ib_sa_disable_local_svc(query);
+17 -10
drivers/infiniband/core/uverbs_cmd.c
··· 62 62 * The ib_uobject locking scheme is as follows: 63 63 * 64 64 * - ib_uverbs_idr_lock protects the uverbs idrs themselves, so it 65 - * needs to be held during all idr operations. When an object is 65 + * needs to be held during all idr write operations. When an object is 66 66 * looked up, a reference must be taken on the object's kref before 67 - * dropping this lock. 67 + * dropping this lock. For read operations, the rcu_read_lock() 68 + * and rcu_write_lock() but similarly the kref reference is grabbed 69 + * before the rcu_read_unlock(). 68 70 * 69 71 * - Each object also has an rwsem. This rwsem must be held for 70 72 * reading while an operation that uses the object is performed. ··· 98 96 99 97 static void release_uobj(struct kref *kref) 100 98 { 101 - kfree(container_of(kref, struct ib_uobject, ref)); 99 + kfree_rcu(container_of(kref, struct ib_uobject, ref), rcu); 102 100 } 103 101 104 102 static void put_uobj(struct ib_uobject *uobj) ··· 147 145 { 148 146 struct ib_uobject *uobj; 149 147 150 - spin_lock(&ib_uverbs_idr_lock); 148 + rcu_read_lock(); 151 149 uobj = idr_find(idr, id); 152 150 if (uobj) { 153 151 if (uobj->context == context) ··· 155 153 else 156 154 uobj = NULL; 157 155 } 158 - spin_unlock(&ib_uverbs_idr_lock); 156 + rcu_read_unlock(); 159 157 160 158 return uobj; 161 159 } ··· 2448 2446 int i, sg_ind; 2449 2447 int is_ud; 2450 2448 ssize_t ret = -EINVAL; 2449 + size_t next_size; 2451 2450 2452 2451 if (copy_from_user(&cmd, buf, sizeof cmd)) 2453 2452 return -EFAULT; ··· 2493 2490 goto out_put; 2494 2491 } 2495 2492 2496 - ud = alloc_wr(sizeof(*ud), user_wr->num_sge); 2493 + next_size = sizeof(*ud); 2494 + ud = alloc_wr(next_size, user_wr->num_sge); 2497 2495 if (!ud) { 2498 2496 ret = -ENOMEM; 2499 2497 goto out_put; ··· 2515 2511 user_wr->opcode == IB_WR_RDMA_READ) { 2516 2512 struct ib_rdma_wr *rdma; 2517 2513 2518 - rdma = alloc_wr(sizeof(*rdma), user_wr->num_sge); 2514 + next_size = sizeof(*rdma); 2515 + rdma = alloc_wr(next_size, user_wr->num_sge); 2519 2516 if (!rdma) { 2520 2517 ret = -ENOMEM; 2521 2518 goto out_put; ··· 2530 2525 user_wr->opcode == IB_WR_ATOMIC_FETCH_AND_ADD) { 2531 2526 struct ib_atomic_wr *atomic; 2532 2527 2533 - atomic = alloc_wr(sizeof(*atomic), user_wr->num_sge); 2528 + next_size = sizeof(*atomic); 2529 + atomic = alloc_wr(next_size, user_wr->num_sge); 2534 2530 if (!atomic) { 2535 2531 ret = -ENOMEM; 2536 2532 goto out_put; ··· 2546 2540 } else if (user_wr->opcode == IB_WR_SEND || 2547 2541 user_wr->opcode == IB_WR_SEND_WITH_IMM || 2548 2542 user_wr->opcode == IB_WR_SEND_WITH_INV) { 2549 - next = alloc_wr(sizeof(*next), user_wr->num_sge); 2543 + next_size = sizeof(*next); 2544 + next = alloc_wr(next_size, user_wr->num_sge); 2550 2545 if (!next) { 2551 2546 ret = -ENOMEM; 2552 2547 goto out_put; ··· 2579 2572 2580 2573 if (next->num_sge) { 2581 2574 next->sg_list = (void *) next + 2582 - ALIGN(sizeof *next, sizeof (struct ib_sge)); 2575 + ALIGN(next_size, sizeof(struct ib_sge)); 2583 2576 if (copy_from_user(next->sg_list, 2584 2577 buf + sizeof cmd + 2585 2578 cmd.wr_count * cmd.wqe_size +
+21 -20
drivers/infiniband/core/verbs.c
··· 1516 1516 * @sg_nents: number of entries in sg 1517 1517 * @set_page: driver page assignment function pointer 1518 1518 * 1519 - * Core service helper for drivers to covert the largest 1519 + * Core service helper for drivers to convert the largest 1520 1520 * prefix of given sg list to a page vector. The sg list 1521 1521 * prefix converted is the prefix that meet the requirements 1522 1522 * of ib_map_mr_sg. ··· 1533 1533 u64 last_end_dma_addr = 0, last_page_addr = 0; 1534 1534 unsigned int last_page_off = 0; 1535 1535 u64 page_mask = ~((u64)mr->page_size - 1); 1536 - int i; 1536 + int i, ret; 1537 1537 1538 1538 mr->iova = sg_dma_address(&sgl[0]); 1539 1539 mr->length = 0; ··· 1544 1544 u64 end_dma_addr = dma_addr + dma_len; 1545 1545 u64 page_addr = dma_addr & page_mask; 1546 1546 1547 - if (i && page_addr != dma_addr) { 1548 - if (last_end_dma_addr != dma_addr) { 1549 - /* gap */ 1550 - goto done; 1547 + /* 1548 + * For the second and later elements, check whether either the 1549 + * end of element i-1 or the start of element i is not aligned 1550 + * on a page boundary. 1551 + */ 1552 + if (i && (last_page_off != 0 || page_addr != dma_addr)) { 1553 + /* Stop mapping if there is a gap. */ 1554 + if (last_end_dma_addr != dma_addr) 1555 + break; 1551 1556 1552 - } else if (last_page_off + dma_len <= mr->page_size) { 1553 - /* chunk this fragment with the last */ 1554 - mr->length += dma_len; 1555 - last_end_dma_addr += dma_len; 1556 - last_page_off += dma_len; 1557 - continue; 1558 - } else { 1559 - /* map starting from the next page */ 1560 - page_addr = last_page_addr + mr->page_size; 1561 - dma_len -= mr->page_size - last_page_off; 1562 - } 1557 + /* 1558 + * Coalesce this element with the last. If it is small 1559 + * enough just update mr->length. Otherwise start 1560 + * mapping from the next page. 1561 + */ 1562 + goto next_page; 1563 1563 } 1564 1564 1565 1565 do { 1566 - if (unlikely(set_page(mr, page_addr))) 1567 - goto done; 1566 + ret = set_page(mr, page_addr); 1567 + if (unlikely(ret < 0)) 1568 + return i ? : ret; 1569 + next_page: 1568 1570 page_addr += mr->page_size; 1569 1571 } while (page_addr < end_dma_addr); 1570 1572 ··· 1576 1574 last_page_off = end_dma_addr & ~page_mask; 1577 1575 } 1578 1576 1579 - done: 1580 1577 return i; 1581 1578 } 1582 1579 EXPORT_SYMBOL(ib_sg_to_pages);
+1 -1
drivers/infiniband/hw/mlx4/main.c
··· 456 456 props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; 457 457 props->max_sge = min(dev->dev->caps.max_sq_sg, 458 458 dev->dev->caps.max_rq_sg); 459 - props->max_sge_rd = props->max_sge; 459 + props->max_sge_rd = MLX4_MAX_SGE_RD; 460 460 props->max_cq = dev->dev->quotas.cq; 461 461 props->max_cqe = dev->dev->caps.max_cqes; 462 462 props->max_mr = dev->dev->quotas.mpt;
+13 -6
drivers/infiniband/hw/mlx4/qp.c
··· 34 34 #include <linux/log2.h> 35 35 #include <linux/slab.h> 36 36 #include <linux/netdevice.h> 37 + #include <linux/vmalloc.h> 37 38 38 39 #include <rdma/ib_cache.h> 39 40 #include <rdma/ib_pack.h> ··· 796 795 if (err) 797 796 goto err_mtt; 798 797 799 - qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof (u64), gfp); 800 - qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof (u64), gfp); 798 + qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64), gfp); 799 + if (!qp->sq.wrid) 800 + qp->sq.wrid = __vmalloc(qp->sq.wqe_cnt * sizeof(u64), 801 + gfp, PAGE_KERNEL); 802 + qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64), gfp); 803 + if (!qp->rq.wrid) 804 + qp->rq.wrid = __vmalloc(qp->rq.wqe_cnt * sizeof(u64), 805 + gfp, PAGE_KERNEL); 801 806 if (!qp->sq.wrid || !qp->rq.wrid) { 802 807 err = -ENOMEM; 803 808 goto err_wrid; ··· 893 886 if (qp_has_rq(init_attr)) 894 887 mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), &qp->db); 895 888 } else { 896 - kfree(qp->sq.wrid); 897 - kfree(qp->rq.wrid); 889 + kvfree(qp->sq.wrid); 890 + kvfree(qp->rq.wrid); 898 891 } 899 892 900 893 err_mtt: ··· 1069 1062 &qp->db); 1070 1063 ib_umem_release(qp->umem); 1071 1064 } else { 1072 - kfree(qp->sq.wrid); 1073 - kfree(qp->rq.wrid); 1065 + kvfree(qp->sq.wrid); 1066 + kvfree(qp->rq.wrid); 1074 1067 if (qp->mlx4_ib_qp_type & (MLX4_IB_QPT_PROXY_SMI_OWNER | 1075 1068 MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_GSI)) 1076 1069 free_proxy_bufs(&dev->ib_dev, qp);
+8 -3
drivers/infiniband/hw/mlx4/srq.c
··· 34 34 #include <linux/mlx4/qp.h> 35 35 #include <linux/mlx4/srq.h> 36 36 #include <linux/slab.h> 37 + #include <linux/vmalloc.h> 37 38 38 39 #include "mlx4_ib.h" 39 40 #include "user.h" ··· 173 172 174 173 srq->wrid = kmalloc(srq->msrq.max * sizeof (u64), GFP_KERNEL); 175 174 if (!srq->wrid) { 176 - err = -ENOMEM; 177 - goto err_mtt; 175 + srq->wrid = __vmalloc(srq->msrq.max * sizeof(u64), 176 + GFP_KERNEL, PAGE_KERNEL); 177 + if (!srq->wrid) { 178 + err = -ENOMEM; 179 + goto err_mtt; 180 + } 178 181 } 179 182 } 180 183 ··· 209 204 if (pd->uobject) 210 205 mlx4_ib_db_unmap_user(to_mucontext(pd->uobject->context), &srq->db); 211 206 else 212 - kfree(srq->wrid); 207 + kvfree(srq->wrid); 213 208 214 209 err_mtt: 215 210 mlx4_mtt_cleanup(dev->dev, &srq->mtt);
+13 -1
drivers/infiniband/hw/mlx5/mr.c
··· 381 381 } 382 382 } 383 383 } else if (ent->cur > 2 * ent->limit) { 384 - if (!someone_adding(cache) && 384 + /* 385 + * The remove_keys() logic is performed as garbage collection 386 + * task. Such task is intended to be run when no other active 387 + * processes are running. 388 + * 389 + * The need_resched() will return TRUE if there are user tasks 390 + * to be activated in near future. 391 + * 392 + * In such case, we don't execute remove_keys() and postpone 393 + * the garbage collection work to try to run in next cycle, 394 + * in order to free CPU resources to other tasks. 395 + */ 396 + if (!need_resched() && !someone_adding(cache) && 385 397 time_after(jiffies, cache->last_add + 300 * HZ)) { 386 398 remove_keys(dev, i, 1); 387 399 if (ent->cur > ent->limit)
+2 -2
drivers/infiniband/hw/qib/qib_qsfp.c
··· 292 292 qib_dev_porterr(ppd->dd, ppd->port, 293 293 "QSFP byte0 is 0x%02X, S/B 0x0C/D\n", peek[0]); 294 294 295 - if ((peek[2] & 2) == 0) { 295 + if ((peek[2] & 4) == 0) { 296 296 /* 297 297 * If cable is paged, rather than "flat memory", we need to 298 298 * set the page to zero, Even if it already appears to be zero. ··· 538 538 sofar += scnprintf(buf + sofar, len - sofar, "Date:%.*s\n", 539 539 QSFP_DATE_LEN, cd.date); 540 540 sofar += scnprintf(buf + sofar, len - sofar, "Lot:%.*s\n", 541 - QSFP_LOT_LEN, cd.date); 541 + QSFP_LOT_LEN, cd.lot); 542 542 543 543 while (bidx < QSFP_DEFAULT_HDR_CNT) { 544 544 int iidx;
+1 -1
drivers/infiniband/hw/qib/qib_verbs.h
··· 329 329 struct qib_mr { 330 330 struct ib_mr ibmr; 331 331 struct ib_umem *umem; 332 - struct qib_mregion mr; /* must be last */ 333 332 u64 *pages; 334 333 u32 npages; 334 + struct qib_mregion mr; /* must be last */ 335 335 }; 336 336 337 337 /*
+1 -1
drivers/infiniband/ulp/iser/iser_verbs.c
··· 1293 1293 if (mr_status.fail_status & IB_MR_CHECK_SIG_STATUS) { 1294 1294 sector_t sector_off = mr_status.sig_err.sig_err_offset; 1295 1295 1296 - do_div(sector_off, sector_size + 8); 1296 + sector_div(sector_off, sector_size + 8); 1297 1297 *sector = scsi_get_lba(iser_task->sc) + sector_off; 1298 1298 1299 1299 pr_err("PI error found type %d at sector %llx "
+3 -10
drivers/infiniband/ulp/isert/ib_isert.c
··· 157 157 attr.recv_cq = comp->cq; 158 158 attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS; 159 159 attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1; 160 - /* 161 - * FIXME: Use devattr.max_sge - 2 for max_send_sge as 162 - * work-around for RDMA_READs with ConnectX-2. 163 - * 164 - * Also, still make sure to have at least two SGEs for 165 - * outgoing control PDU responses. 166 - */ 167 - attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2); 168 - isert_conn->max_sge = attr.cap.max_send_sge; 169 - 160 + attr.cap.max_send_sge = device->dev_attr.max_sge; 161 + isert_conn->max_sge = min(device->dev_attr.max_sge, 162 + device->dev_attr.max_sge_rd); 170 163 attr.cap.max_recv_sge = 1; 171 164 attr.sq_sig_type = IB_SIGNAL_REQ_WR; 172 165 attr.qp_type = IB_QPT_RC;
+26 -22
drivers/infiniband/ulp/srp/ib_srp.c
··· 488 488 struct ib_qp *qp; 489 489 struct ib_fmr_pool *fmr_pool = NULL; 490 490 struct srp_fr_pool *fr_pool = NULL; 491 - const int m = 1 + dev->use_fast_reg; 491 + const int m = dev->use_fast_reg ? 3 : 1; 492 492 struct ib_cq_init_attr cq_attr = {}; 493 493 int ret; 494 494 ··· 994 994 995 995 ret = srp_lookup_path(ch); 996 996 if (ret) 997 - return ret; 997 + goto out; 998 998 999 999 while (1) { 1000 1000 init_completion(&ch->done); 1001 1001 ret = srp_send_req(ch, multich); 1002 1002 if (ret) 1003 - return ret; 1003 + goto out; 1004 1004 ret = wait_for_completion_interruptible(&ch->done); 1005 1005 if (ret < 0) 1006 - return ret; 1006 + goto out; 1007 1007 1008 1008 /* 1009 1009 * The CM event handling code will set status to ··· 1011 1011 * back, or SRP_DLID_REDIRECT if we get a lid/qp 1012 1012 * redirect REJ back. 1013 1013 */ 1014 - switch (ch->status) { 1014 + ret = ch->status; 1015 + switch (ret) { 1015 1016 case 0: 1016 1017 ch->connected = true; 1017 - return 0; 1018 + goto out; 1018 1019 1019 1020 case SRP_PORT_REDIRECT: 1020 1021 ret = srp_lookup_path(ch); 1021 1022 if (ret) 1022 - return ret; 1023 + goto out; 1023 1024 break; 1024 1025 1025 1026 case SRP_DLID_REDIRECT: ··· 1029 1028 case SRP_STALE_CONN: 1030 1029 shost_printk(KERN_ERR, target->scsi_host, PFX 1031 1030 "giving up on stale connection\n"); 1032 - ch->status = -ECONNRESET; 1033 - return ch->status; 1031 + ret = -ECONNRESET; 1032 + goto out; 1034 1033 1035 1034 default: 1036 - return ch->status; 1035 + goto out; 1037 1036 } 1038 1037 } 1038 + 1039 + out: 1040 + return ret <= 0 ? ret : -ENODEV; 1039 1041 } 1040 1042 1041 1043 static int srp_inv_rkey(struct srp_rdma_ch *ch, u32 rkey) ··· 1313 1309 } 1314 1310 1315 1311 static int srp_map_finish_fr(struct srp_map_state *state, 1316 - struct srp_rdma_ch *ch) 1312 + struct srp_rdma_ch *ch, int sg_nents) 1317 1313 { 1318 1314 struct srp_target_port *target = ch->target; 1319 1315 struct srp_device *dev = target->srp_host->srp_dev; ··· 1328 1324 1329 1325 WARN_ON_ONCE(!dev->use_fast_reg); 1330 1326 1331 - if (state->sg_nents == 0) 1327 + if (sg_nents == 0) 1332 1328 return 0; 1333 1329 1334 - if (state->sg_nents == 1 && target->global_mr) { 1330 + if (sg_nents == 1 && target->global_mr) { 1335 1331 srp_map_desc(state, sg_dma_address(state->sg), 1336 1332 sg_dma_len(state->sg), 1337 1333 target->global_mr->rkey); ··· 1345 1341 rkey = ib_inc_rkey(desc->mr->rkey); 1346 1342 ib_update_fast_reg_key(desc->mr, rkey); 1347 1343 1348 - n = ib_map_mr_sg(desc->mr, state->sg, state->sg_nents, 1349 - dev->mr_page_size); 1344 + n = ib_map_mr_sg(desc->mr, state->sg, sg_nents, dev->mr_page_size); 1350 1345 if (unlikely(n < 0)) 1351 1346 return n; 1352 1347 ··· 1451 1448 state->fr.next = req->fr_list; 1452 1449 state->fr.end = req->fr_list + ch->target->cmd_sg_cnt; 1453 1450 state->sg = scat; 1454 - state->sg_nents = scsi_sg_count(req->scmnd); 1455 1451 1456 - while (state->sg_nents) { 1452 + while (count) { 1457 1453 int i, n; 1458 1454 1459 - n = srp_map_finish_fr(state, ch); 1455 + n = srp_map_finish_fr(state, ch, count); 1460 1456 if (unlikely(n < 0)) 1461 1457 return n; 1462 1458 1463 - state->sg_nents -= n; 1459 + count -= n; 1464 1460 for (i = 0; i < n; i++) 1465 1461 state->sg = sg_next(state->sg); 1466 1462 } ··· 1519 1517 1520 1518 if (dev->use_fast_reg) { 1521 1519 state.sg = idb_sg; 1522 - state.sg_nents = 1; 1523 1520 sg_set_buf(idb_sg, req->indirect_desc, idb_len); 1524 1521 idb_sg->dma_address = req->indirect_dma_addr; /* hack! */ 1525 - ret = srp_map_finish_fr(&state, ch); 1522 + #ifdef CONFIG_NEED_SG_DMA_LENGTH 1523 + idb_sg->dma_length = idb_sg->length; /* hack^2 */ 1524 + #endif 1525 + ret = srp_map_finish_fr(&state, ch, 1); 1526 1526 if (ret < 0) 1527 1527 return ret; 1528 1528 } else if (dev->use_fmr) { ··· 1659 1655 return ret; 1660 1656 req->nmdesc++; 1661 1657 } else { 1662 - idb_rkey = target->global_mr->rkey; 1658 + idb_rkey = cpu_to_be32(target->global_mr->rkey); 1663 1659 } 1664 1660 1665 1661 indirect_hdr->table_desc.va = cpu_to_be64(req->indirect_dma_addr);
+1 -4
drivers/infiniband/ulp/srp/ib_srp.h
··· 300 300 dma_addr_t base_dma_addr; 301 301 u32 dma_len; 302 302 u32 total_len; 303 - union { 304 - unsigned int npages; 305 - int sg_nents; 306 - }; 303 + unsigned int npages; 307 304 unsigned int nmdesc; 308 305 unsigned int ndesc; 309 306 };
+1 -1
drivers/net/ethernet/mellanox/mlx4/cmd.c
··· 1010 1010 if (!(smp->mgmt_class == IB_MGMT_CLASS_SUBN_LID_ROUTED && 1011 1011 smp->method == IB_MGMT_METHOD_GET) || network_view) { 1012 1012 mlx4_err(dev, "Unprivileged slave %d is trying to execute a Subnet MGMT MAD, class 0x%x, method 0x%x, view=%s for attr 0x%x. Rejecting\n", 1013 - slave, smp->method, smp->mgmt_class, 1013 + slave, smp->mgmt_class, smp->method, 1014 1014 network_view ? "Network" : "Host", 1015 1015 be16_to_cpu(smp->attr_id)); 1016 1016 return -EPERM;
+11
include/linux/mlx4/device.h
··· 427 427 }; 428 428 429 429 enum { 430 + /* 431 + * Max wqe size for rdma read is 512 bytes, so this 432 + * limits our max_sge_rd as the wqe needs to fit: 433 + * - ctrl segment (16 bytes) 434 + * - rdma segment (16 bytes) 435 + * - scatter elements (16 bytes each) 436 + */ 437 + MLX4_MAX_SGE_RD = (512 - 16 - 16) / 16 438 + }; 439 + 440 + enum { 430 441 MLX4_DEV_PMC_SUBTYPE_GUID_INFO = 0x14, 431 442 MLX4_DEV_PMC_SUBTYPE_PORT_INFO = 0x15, 432 443 MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE = 0x16,
+2
include/rdma/ib_mad.h
··· 237 237 u8 data[IB_MGMT_VENDOR_DATA]; 238 238 }; 239 239 240 + #define IB_MGMT_CLASSPORTINFO_ATTR_ID cpu_to_be16(0x0001) 241 + 240 242 struct ib_class_port_info { 241 243 u8 base_version; 242 244 u8 class_version;
+1
include/rdma/ib_verbs.h
··· 1271 1271 int id; /* index into kernel idr */ 1272 1272 struct kref ref; 1273 1273 struct rw_semaphore mutex; /* protects .live */ 1274 + struct rcu_head rcu; /* kfree_rcu() overhead */ 1274 1275 int live; 1275 1276 }; 1276 1277