Linux NFS development
 help / color / mirror / Atom feed
From: Tom Tucker <tom@opengridcomputing.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH,RFC 05/09] svcrdma: Modify post recv path to use local dma key
Date: Wed, 13 Aug 2008 11:12:55 -0500	[thread overview]
Message-ID: <48A30807.1010503@opengridcomputing.com> (raw)


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>

---
  net/sunrpc/xprtrdma/svc_rdma_transport.c |   10 +++++++---
  1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c 
b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index b8c642d..a61caa7 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -476,7 +476,7 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
  	struct ib_recv_wr recv_wr, *bad_recv_wr;
  	struct svc_rdma_op_ctxt *ctxt;
  	struct page *page;
-	unsigned long pa;
+	dma_addr_t pa;
  	int sge_no;
  	int buflen;
  	int ret;
@@ -488,13 +488,17 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
  		BUG_ON(sge_no >= xprt->sc_max_sge);
  		page = svc_rdma_get_page();
  		ctxt->pages[sge_no] = page;
-		atomic_inc(&xprt->sc_dma_used);
  		pa = ib_dma_map_page(xprt->sc_cm_id->device,
  				     page, 0, PAGE_SIZE,
  				     DMA_FROM_DEVICE);
+		if (ib_dma_mapping_error(xprt->sc_cm_id->device, pa)) {
+			svc_rdma_put_context(ctxt, 1);
+			return -ENOMEM;
+		}
+		atomic_inc(&xprt->sc_dma_used);
  		ctxt->sge[sge_no].addr = pa;
  		ctxt->sge[sge_no].length = PAGE_SIZE;
-		ctxt->sge[sge_no].lkey = xprt->sc_phys_mr->lkey;
+		ctxt->sge[sge_no].lkey = xprt->sc_dma_lkey;
  		buflen += PAGE_SIZE;
  	}
  	ctxt->count = sge_no;

                 reply	other threads:[~2008-08-13 16:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48A30807.1010503@opengridcomputing.com \
    --to=tom@opengridcomputing.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox