From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: [PATCH v2 7/8] svcrdma: Consolidate send_error helper functions
Date: Mon, 29 Jun 2020 10:50:34 -0400 [thread overview]
Message-ID: <20200629145034.15024.54133.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <20200629144802.15024.30635.stgit@klimt.1015granger.net>
Final refactor: Replace internals of svc_rdma_send_error() with a
simple call to svc_rdma_send_error_msg().
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 52 +++----------------------------
1 file changed, 5 insertions(+), 47 deletions(-)
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
index 60d855116ae7..c072ce61b393 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
@@ -714,58 +714,16 @@ static void rdma_read_complete(struct svc_rqst *rqstp,
rqstp->rq_arg.buflen = head->rc_arg.buflen;
}
-static void svc_rdma_send_error(struct svcxprt_rdma *xprt,
+static void svc_rdma_send_error(struct svcxprt_rdma *rdma,
struct svc_rdma_recv_ctxt *rctxt,
int status)
{
- __be32 *p, *rdma_argp = rctxt->rc_recv_buf;
- struct svc_rdma_send_ctxt *ctxt;
- int ret;
+ struct svc_rdma_send_ctxt *sctxt;
- ctxt = svc_rdma_send_ctxt_get(xprt);
- if (!ctxt)
+ sctxt = svc_rdma_send_ctxt_get(rdma);
+ if (!sctxt)
return;
-
- p = xdr_reserve_space(&ctxt->sc_stream,
- rpcrdma_fixed_maxsz * sizeof(*p));
- if (!p)
- goto put_ctxt;
-
- *p++ = *rdma_argp;
- *p++ = *(rdma_argp + 1);
- *p++ = xprt->sc_fc_credits;
- *p = rdma_error;
-
- switch (status) {
- case -EPROTONOSUPPORT:
- p = xdr_reserve_space(&ctxt->sc_stream, 3 * sizeof(*p));
- if (!p)
- goto put_ctxt;
-
- *p++ = err_vers;
- *p++ = rpcrdma_version;
- *p = rpcrdma_version;
- trace_svcrdma_err_vers(*rdma_argp);
- break;
- default:
- p = xdr_reserve_space(&ctxt->sc_stream, sizeof(*p));
- if (!p)
- goto put_ctxt;
-
- *p = err_chunk;
- trace_svcrdma_err_chunk(*rdma_argp);
- }
-
- ctxt->sc_send_wr.num_sge = 1;
- ctxt->sc_send_wr.opcode = IB_WR_SEND;
- ctxt->sc_sges[0].length = ctxt->sc_hdrbuf.len;
- ret = svc_rdma_send(xprt, &ctxt->sc_send_wr);
- if (ret)
- goto put_ctxt;
- return;
-
-put_ctxt:
- svc_rdma_send_ctxt_put(xprt, ctxt);
+ svc_rdma_send_error_msg(rdma, sctxt, rctxt, status);
}
/* By convention, backchannel calls arrive via rdma_msg type
next prev parent reply other threads:[~2020-06-29 19:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 14:49 [PATCH v2 0/8] Refactor path that sends error responses Chuck Lever
2020-06-29 14:50 ` [PATCH v2 1/8] svcrdma: Fix page leak in svc_rdma_recv_read_chunk() Chuck Lever
2020-06-29 14:50 ` [PATCH v2 2/8] svcrdma: Remove save_io_pages() call from send_error_msg() Chuck Lever
2020-06-29 14:50 ` [PATCH v2 3/8] svcrdma: Add @rctxt parameter to svc_rdma_send_error() functions Chuck Lever
2020-06-29 14:50 ` [PATCH v2 4/8] svcrdma: Add a @status parameter to svc_rdma_send_error_msg() Chuck Lever
2020-06-29 14:50 ` [PATCH v2 5/8] svcrdma: Eliminate return value for svc_rdma_send_error_msg() Chuck Lever
2020-06-29 14:50 ` [PATCH v2 6/8] svcrdma: Make svc_rdma_send_error_msg() a global function Chuck Lever
2020-06-29 14:50 ` Chuck Lever [this message]
2020-06-29 14:50 ` [PATCH v2 8/8] svcrdma: Clean up trace_svcrdma_send_failed() tracepoint Chuck Lever
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=20200629145034.15024.54133.stgit@klimt.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-rdma@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;
as well as URLs for NNTP newsgroup(s).