aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTom Tucker <tom@opengridcomputing.com>2008-09-30 15:05:41 -0400
committerTom Tucker <tom@opengridcomputing.com>2008-10-06 15:45:52 -0400
commita5abf4e81545d9c7280c49cae853cc45fd769ddf (patch)
treefef48a88715bac9bfdca3e00aa1ed6afb1177004 /net/sunrpc
parente1183210625cc8e02ce13eec78fb7a246567fc59 (diff)
svcrdma: Modify post recv path to use local dma key
Update the svc_rdma_post_recv routine to use the adapter's global LKEY instead of sc_phys_mr which is only valid when using a DMA MR. Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index c3e8db0eeb3b..d9183cbcd967 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -483,7 +483,7 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
483 struct ib_recv_wr recv_wr, *bad_recv_wr; 483 struct ib_recv_wr recv_wr, *bad_recv_wr;
484 struct svc_rdma_op_ctxt *ctxt; 484 struct svc_rdma_op_ctxt *ctxt;
485 struct page *page; 485 struct page *page;
486 unsigned long pa; 486 dma_addr_t pa;
487 int sge_no; 487 int sge_no;
488 int buflen; 488 int buflen;
489 int ret; 489 int ret;
@@ -495,13 +495,15 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
495 BUG_ON(sge_no >= xprt->sc_max_sge); 495 BUG_ON(sge_no >= xprt->sc_max_sge);
496 page = svc_rdma_get_page(); 496 page = svc_rdma_get_page();
497 ctxt->pages[sge_no] = page; 497 ctxt->pages[sge_no] = page;
498 atomic_inc(&xprt->sc_dma_used);
499 pa = ib_dma_map_page(xprt->sc_cm_id->device, 498 pa = ib_dma_map_page(xprt->sc_cm_id->device,
500 page, 0, PAGE_SIZE, 499 page, 0, PAGE_SIZE,
501 DMA_FROM_DEVICE); 500 DMA_FROM_DEVICE);
501 if (ib_dma_mapping_error(xprt->sc_cm_id->device, pa))
502 goto err_put_ctxt;
503 atomic_inc(&xprt->sc_dma_used);
502 ctxt->sge[sge_no].addr = pa; 504 ctxt->sge[sge_no].addr = pa;
503 ctxt->sge[sge_no].length = PAGE_SIZE; 505 ctxt->sge[sge_no].length = PAGE_SIZE;
504 ctxt->sge[sge_no].lkey = xprt->sc_phys_mr->lkey; 506 ctxt->sge[sge_no].lkey = xprt->sc_dma_lkey;
505 buflen += PAGE_SIZE; 507 buflen += PAGE_SIZE;
506 } 508 }
507 ctxt->count = sge_no; 509 ctxt->count = sge_no;
@@ -517,6 +519,10 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
517 svc_rdma_put_context(ctxt, 1); 519 svc_rdma_put_context(ctxt, 1);
518 } 520 }
519 return ret; 521 return ret;
522
523 err_put_ctxt:
524 svc_rdma_put_context(ctxt, 1);
525 return -ENOMEM;
520} 526}
521 527
522/* 528/*