diff options
author | Israel Rukshin <israelr@mellanox.com> | 2019-06-11 17:52:52 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-06-24 16:49:27 +0200 |
commit | 6cb2d5b105c93efd453d990aa2aea3ebb9405940 (patch) | |
tree | 6604c0ad0c77d4fe317c714d7a244953f57daa42 /drivers/infiniband/core/rw.c | |
parent | RDMA/core: Validate integrity handover device cap (diff) | |
download | linux-6cb2d5b105c93efd453d990aa2aea3ebb9405940.tar.xz linux-6cb2d5b105c93efd453d990aa2aea3ebb9405940.zip |
RDMA/rw: Introduce rdma_rw_inv_key helper
This is a preparation for adding new signature API to the rw-API.
Signed-off-by: Israel Rukshin <israelr@mellanox.com>
Suggested-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/rw.c')
-rw-r--r-- | drivers/infiniband/core/rw.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c index b45b49a2ccfc..f87f0de82e24 100644 --- a/drivers/infiniband/core/rw.c +++ b/drivers/infiniband/core/rw.c @@ -65,6 +65,22 @@ static inline u32 rdma_rw_fr_page_list_len(struct ib_device *dev) return min_t(u32, dev->attrs.max_fast_reg_page_list_len, 256); } +static inline int rdma_rw_inv_key(struct rdma_rw_reg_ctx *reg) +{ + int count = 0; + + if (reg->mr->need_inval) { + reg->inv_wr.opcode = IB_WR_LOCAL_INV; + reg->inv_wr.ex.invalidate_rkey = reg->mr->lkey; + reg->inv_wr.next = ®->reg_wr.wr; + count++; + } else { + reg->inv_wr.next = NULL; + } + + return count; +} + /* Caller must have zero-initialized *reg. */ static int rdma_rw_init_one_mr(struct ib_qp *qp, u8 port_num, struct rdma_rw_reg_ctx *reg, struct scatterlist *sg, @@ -78,14 +94,7 @@ static int rdma_rw_init_one_mr(struct ib_qp *qp, u8 port_num, if (!reg->mr) return -EAGAIN; - if (reg->mr->need_inval) { - reg->inv_wr.opcode = IB_WR_LOCAL_INV; - reg->inv_wr.ex.invalidate_rkey = reg->mr->lkey; - reg->inv_wr.next = ®->reg_wr.wr; - count++; - } else { - reg->inv_wr.next = NULL; - } + count += rdma_rw_inv_key(reg); ret = ib_map_mr_sg(reg->mr, sg, nents, &offset, PAGE_SIZE); if (ret < 0 || ret < nents) { |