Commit 67982414 authored by Max Gurtovoy's avatar Max Gurtovoy Committed by Jason Gunthorpe

RDMA/rw: map P2P memory correctly for signature operations

Since RDMA rw API support operations with P2P memory sg list, make sure to
map/unmap the scatter list for signature operation correctly.

Link: https://lore.kernel.org/r/20200220100819.41860-2-maxg@mellanox.comSigned-off-by: default avatarMax Gurtovoy <maxg@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 6f00a54c
...@@ -391,13 +391,13 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, ...@@ -391,13 +391,13 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
return -EINVAL; return -EINVAL;
} }
ret = ib_dma_map_sg(dev, sg, sg_cnt, dir); ret = rdma_rw_map_sg(dev, sg, sg_cnt, dir);
if (!ret) if (!ret)
return -ENOMEM; return -ENOMEM;
sg_cnt = ret; sg_cnt = ret;
if (prot_sg_cnt) { if (prot_sg_cnt) {
ret = ib_dma_map_sg(dev, prot_sg, prot_sg_cnt, dir); ret = rdma_rw_map_sg(dev, prot_sg, prot_sg_cnt, dir);
if (!ret) { if (!ret) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_unmap_sg; goto out_unmap_sg;
...@@ -466,9 +466,9 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, ...@@ -466,9 +466,9 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
kfree(ctx->reg); kfree(ctx->reg);
out_unmap_prot_sg: out_unmap_prot_sg:
if (prot_sg_cnt) if (prot_sg_cnt)
ib_dma_unmap_sg(dev, prot_sg, prot_sg_cnt, dir); rdma_rw_unmap_sg(dev, prot_sg, prot_sg_cnt, dir);
out_unmap_sg: out_unmap_sg:
ib_dma_unmap_sg(dev, sg, sg_cnt, dir); rdma_rw_unmap_sg(dev, sg, sg_cnt, dir);
return ret; return ret;
} }
EXPORT_SYMBOL(rdma_rw_ctx_signature_init); EXPORT_SYMBOL(rdma_rw_ctx_signature_init);
...@@ -628,9 +628,9 @@ void rdma_rw_ctx_destroy_signature(struct rdma_rw_ctx *ctx, struct ib_qp *qp, ...@@ -628,9 +628,9 @@ void rdma_rw_ctx_destroy_signature(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
ib_mr_pool_put(qp, &qp->sig_mrs, ctx->reg->mr); ib_mr_pool_put(qp, &qp->sig_mrs, ctx->reg->mr);
kfree(ctx->reg); kfree(ctx->reg);
ib_dma_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
if (prot_sg_cnt) if (prot_sg_cnt)
ib_dma_unmap_sg(qp->pd->device, prot_sg, prot_sg_cnt, dir); rdma_rw_unmap_sg(qp->pd->device, prot_sg, prot_sg_cnt, dir);
rdma_rw_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
} }
EXPORT_SYMBOL(rdma_rw_ctx_destroy_signature); EXPORT_SYMBOL(rdma_rw_ctx_destroy_signature);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment