From: Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: [PATCH v2 14/15] xprtrdma: Handle non-SEND completions via a callout Date: Tue, 24 Mar 2015 16:32:38 -0400 [thread overview] Message-ID: <20150324203238.2311.58032.stgit@manet.1015granger.net> (raw) In-Reply-To: <20150324201849.2311.53599.stgit-FYjufvaPoItvLzlybtyyYzGyq/o6K9yX@public.gmane.org> Allow each memory registration mode to plug in a callout that handles the completion of a memory registration operation. Signed-off-by: Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> --- net/sunrpc/xprtrdma/frwr_ops.c | 17 +++++++++++++++++ net/sunrpc/xprtrdma/verbs.c | 16 ++++++---------- net/sunrpc/xprtrdma/xprt_rdma.h | 5 +++++ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index e17d54d..ea59c1b 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c @@ -117,6 +117,22 @@ frwr_op_maxpages(struct rpcrdma_xprt *r_xprt) rpcrdma_max_segments(r_xprt) * ia->ri_max_frmr_depth); } +/* If FAST_REG or LOCAL_INV failed, indicate the frmr needs to be reset. */ +static void +frwr_sendcompletion(struct ib_wc *wc) +{ + struct rpcrdma_mw *r; + + if (likely(wc->status == IB_WC_SUCCESS)) + return; + + /* WARNING: Only wr_id and status are reliable at this point */ + r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id; + dprintk("RPC: %s: frmr %p (stale), status %d\n", + __func__, r, wc->status); + r->r.frmr.fr_state = FRMR_IS_STALE; +} + static int frwr_op_init(struct rpcrdma_xprt *r_xprt) { @@ -148,6 +164,7 @@ frwr_op_init(struct rpcrdma_xprt *r_xprt) list_add(&r->mw_list, &buf->rb_mws); list_add(&r->mw_all, &buf->rb_all); + r->mw_sendcompletion = frwr_sendcompletion; } return 0; diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index b697b3e..cac06f2 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -186,7 +186,7 @@ static const char * const wc_status[] = { "remote access error", "remote operation error", "transport retry counter exceeded", - "RNR retrycounter exceeded", + "RNR retry counter exceeded", "local RDD violation error", "remove invalid RD request", "operation aborted", @@ -204,21 +204,17 @@ static const char * const wc_status[] = { static void rpcrdma_sendcq_process_wc(struct ib_wc *wc) { - if (likely(wc->status == IB_WC_SUCCESS)) - return; - /* WARNING: Only wr_id and status are reliable at this point */ - if (wc->wr_id == 0ULL) { - if (wc->status != IB_WC_WR_FLUSH_ERR) + if (wc->wr_id == RPCRDMA_IGNORE_COMPLETION) { + if (wc->status != IB_WC_SUCCESS && + wc->status != IB_WC_WR_FLUSH_ERR) pr_err("RPC: %s: SEND: %s\n", __func__, COMPLETION_MSG(wc->status)); } else { struct rpcrdma_mw *r; r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id; - r->r.frmr.fr_state = FRMR_IS_STALE; - pr_err("RPC: %s: frmr %p (stale): %s\n", - __func__, r, COMPLETION_MSG(wc->status)); + r->mw_sendcompletion(wc); } } @@ -1622,7 +1618,7 @@ rpcrdma_ep_post(struct rpcrdma_ia *ia, } send_wr.next = NULL; - send_wr.wr_id = 0ULL; /* no send cookie */ + send_wr.wr_id = RPCRDMA_IGNORE_COMPLETION; send_wr.sg_list = req->rl_send_iov; send_wr.num_sge = req->rl_niovs; send_wr.opcode = IB_WR_SEND; diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 9036fb4..54bcbe4 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h @@ -106,6 +106,10 @@ struct rpcrdma_ep { #define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit) #define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount) +/* Force completion handler to ignore the signal + */ +#define RPCRDMA_IGNORE_COMPLETION (0ULL) + /* Registered buffer -- registered kmalloc'd memory for RDMA SEND/RECV * * The below structure appears at the front of a large region of kmalloc'd @@ -206,6 +210,7 @@ struct rpcrdma_mw { struct ib_fmr *fmr; struct rpcrdma_frmr frmr; } r; + void (*mw_sendcompletion)(struct ib_wc *); struct list_head mw_list; struct list_head mw_all; }; -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Chuck Lever <chuck.lever@oracle.com> To: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org Subject: [PATCH v2 14/15] xprtrdma: Handle non-SEND completions via a callout Date: Tue, 24 Mar 2015 16:32:38 -0400 [thread overview] Message-ID: <20150324203238.2311.58032.stgit@manet.1015granger.net> (raw) In-Reply-To: <20150324201849.2311.53599.stgit@manet.1015granger.net> Allow each memory registration mode to plug in a callout that handles the completion of a memory registration operation. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> --- net/sunrpc/xprtrdma/frwr_ops.c | 17 +++++++++++++++++ net/sunrpc/xprtrdma/verbs.c | 16 ++++++---------- net/sunrpc/xprtrdma/xprt_rdma.h | 5 +++++ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c index e17d54d..ea59c1b 100644 --- a/net/sunrpc/xprtrdma/frwr_ops.c +++ b/net/sunrpc/xprtrdma/frwr_ops.c @@ -117,6 +117,22 @@ frwr_op_maxpages(struct rpcrdma_xprt *r_xprt) rpcrdma_max_segments(r_xprt) * ia->ri_max_frmr_depth); } +/* If FAST_REG or LOCAL_INV failed, indicate the frmr needs to be reset. */ +static void +frwr_sendcompletion(struct ib_wc *wc) +{ + struct rpcrdma_mw *r; + + if (likely(wc->status == IB_WC_SUCCESS)) + return; + + /* WARNING: Only wr_id and status are reliable at this point */ + r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id; + dprintk("RPC: %s: frmr %p (stale), status %d\n", + __func__, r, wc->status); + r->r.frmr.fr_state = FRMR_IS_STALE; +} + static int frwr_op_init(struct rpcrdma_xprt *r_xprt) { @@ -148,6 +164,7 @@ frwr_op_init(struct rpcrdma_xprt *r_xprt) list_add(&r->mw_list, &buf->rb_mws); list_add(&r->mw_all, &buf->rb_all); + r->mw_sendcompletion = frwr_sendcompletion; } return 0; diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index b697b3e..cac06f2 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -186,7 +186,7 @@ static const char * const wc_status[] = { "remote access error", "remote operation error", "transport retry counter exceeded", - "RNR retrycounter exceeded", + "RNR retry counter exceeded", "local RDD violation error", "remove invalid RD request", "operation aborted", @@ -204,21 +204,17 @@ static const char * const wc_status[] = { static void rpcrdma_sendcq_process_wc(struct ib_wc *wc) { - if (likely(wc->status == IB_WC_SUCCESS)) - return; - /* WARNING: Only wr_id and status are reliable at this point */ - if (wc->wr_id == 0ULL) { - if (wc->status != IB_WC_WR_FLUSH_ERR) + if (wc->wr_id == RPCRDMA_IGNORE_COMPLETION) { + if (wc->status != IB_WC_SUCCESS && + wc->status != IB_WC_WR_FLUSH_ERR) pr_err("RPC: %s: SEND: %s\n", __func__, COMPLETION_MSG(wc->status)); } else { struct rpcrdma_mw *r; r = (struct rpcrdma_mw *)(unsigned long)wc->wr_id; - r->r.frmr.fr_state = FRMR_IS_STALE; - pr_err("RPC: %s: frmr %p (stale): %s\n", - __func__, r, COMPLETION_MSG(wc->status)); + r->mw_sendcompletion(wc); } } @@ -1622,7 +1618,7 @@ rpcrdma_ep_post(struct rpcrdma_ia *ia, } send_wr.next = NULL; - send_wr.wr_id = 0ULL; /* no send cookie */ + send_wr.wr_id = RPCRDMA_IGNORE_COMPLETION; send_wr.sg_list = req->rl_send_iov; send_wr.num_sge = req->rl_niovs; send_wr.opcode = IB_WR_SEND; diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 9036fb4..54bcbe4 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h @@ -106,6 +106,10 @@ struct rpcrdma_ep { #define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit) #define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount) +/* Force completion handler to ignore the signal + */ +#define RPCRDMA_IGNORE_COMPLETION (0ULL) + /* Registered buffer -- registered kmalloc'd memory for RDMA SEND/RECV * * The below structure appears at the front of a large region of kmalloc'd @@ -206,6 +210,7 @@ struct rpcrdma_mw { struct ib_fmr *fmr; struct rpcrdma_frmr frmr; } r; + void (*mw_sendcompletion)(struct ib_wc *); struct list_head mw_list; struct list_head mw_all; };
next prev parent reply other threads:[~2015-03-24 20:32 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-03-24 20:30 [PATCH v2 00/15] NFS/RDMA patches proposed for 4.1 Chuck Lever 2015-03-24 20:30 ` Chuck Lever [not found] ` <20150324201849.2311.53599.stgit-FYjufvaPoItvLzlybtyyYzGyq/o6K9yX@public.gmane.org> 2015-03-24 20:30 ` [PATCH v2 01/15] SUNRPC: Introduce missing well-known netids Chuck Lever 2015-03-24 20:30 ` Chuck Lever 2015-03-24 20:30 ` [PATCH v2 02/15] xprtrdma: Display IPv6 addresses and port numbers correctly Chuck Lever 2015-03-24 20:30 ` Chuck Lever 2015-03-24 20:30 ` [PATCH v2 03/15] xprtrdma: Perform a full marshal on retransmit Chuck Lever 2015-03-24 20:30 ` Chuck Lever 2015-03-24 20:31 ` [PATCH v2 04/15] xprtrdma: Byte-align FRWR registration Chuck Lever 2015-03-24 20:31 ` Chuck Lever 2015-03-24 20:31 ` [PATCH v2 05/15] xprtrdma: Prevent infinite loop in rpcrdma_ep_create() Chuck Lever 2015-03-24 20:31 ` Chuck Lever 2015-03-24 20:31 ` [PATCH v2 06/15] xprtrdma: Add vector of ops for each memory registration strategy Chuck Lever 2015-03-24 20:31 ` Chuck Lever 2015-03-24 20:31 ` [PATCH v2 07/15] xprtrdma: Add a "max_payload" op for each memreg mode Chuck Lever 2015-03-24 20:31 ` Chuck Lever 2015-03-24 20:31 ` [PATCH v2 08/15] xprtrdma: Add a "register_external" " Chuck Lever 2015-03-24 20:31 ` Chuck Lever 2015-03-24 20:31 ` [PATCH v2 09/15] xprtrdma: Add a "deregister_external" " Chuck Lever 2015-03-24 20:31 ` Chuck Lever 2015-03-24 20:32 ` [PATCH v2 10/15] xprtrdma: Add "init MRs" memreg op Chuck Lever 2015-03-24 20:32 ` Chuck Lever 2015-03-24 20:32 ` [PATCH v2 11/15] xprtrdma: Add "reset " Chuck Lever 2015-03-24 20:32 ` Chuck Lever 2015-03-24 20:32 ` [PATCH v2 12/15] xprtrdma: Add "destroy " Chuck Lever 2015-03-24 20:32 ` Chuck Lever 2015-03-24 20:32 ` [PATCH v2 13/15] xprtrdma: Add "open" " Chuck Lever 2015-03-24 20:32 ` Chuck Lever 2015-03-24 20:32 ` Chuck Lever [this message] 2015-03-24 20:32 ` [PATCH v2 14/15] xprtrdma: Handle non-SEND completions via a callout Chuck Lever 2015-03-24 20:32 ` [PATCH v2 15/15] xprtrdma: Make rpcrdma_{un}map_one() into inline functions Chuck Lever 2015-03-24 20:32 ` Chuck Lever 2015-03-26 18:39 ` [PATCH v2 00/15] NFS/RDMA patches proposed for 4.1 Anna Schumaker 2015-03-26 18:39 ` Anna Schumaker [not found] ` <55145274.203-ZwjVKphTwtPQT0dZR+AlfA@public.gmane.org> 2015-03-26 18:43 ` Chuck Lever 2015-03-26 18:43 ` Chuck Lever 2015-03-27 5:42 ` Devesh Sharma 2015-03-27 5:42 ` Devesh Sharma [not found] ` <EE7902D3F51F404C82415C4803930ACD5DC3B914-DWYeeINJQrxExQ8dmkPuX0M9+F4ksjoh@public.gmane.org> 2015-03-27 5:44 ` Devesh Sharma 2015-03-27 5:44 ` Devesh Sharma [not found] ` <c541888a-6b49-4b9f-98ba-a1d77df1d071-3RiH6ntJJkOPfaB/Gd0HpljyZtpTMMwT@public.gmane.org> 2015-03-27 14:17 ` Chuck Lever 2015-03-27 14:17 ` Chuck Lever [not found] ` <AFCD874E-D85C-4788-A409-17906D841C5B-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2015-03-27 15:59 ` Devesh Sharma 2015-03-27 15:59 ` Devesh Sharma 2015-03-30 14:18 ` Steve Wise 2015-03-30 14:18 ` Steve Wise [not found] ` <55195B3B.40205-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> 2015-03-30 17:53 ` Chuck Lever 2015-03-30 17:53 ` Chuck Lever [not found] ` <9D560F87-71BF-470E-B411-EF68D75070AA-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2015-03-30 18:01 ` Steve Wise 2015-03-30 18:01 ` Steve Wise
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=20150324203238.2311.58032.stgit@manet.1015granger.net \ --to=chuck.lever-qhclzuegtsvqt0dzr+alfa@public.gmane.org \ --cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.