Commit d1f6e236 authored by Chuck Lever's avatar Chuck Lever

svcrdma: Add @rctxt parameter to svc_rdma_send_error() functions

Another step towards making svc_rdma_send_error_msg() and
svc_rdma_send_error() similar enough to eliminate one of them.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 6e9fab70
...@@ -715,10 +715,11 @@ static void rdma_read_complete(struct svc_rqst *rqstp, ...@@ -715,10 +715,11 @@ static void rdma_read_complete(struct svc_rqst *rqstp,
} }
static void svc_rdma_send_error(struct svcxprt_rdma *xprt, static void svc_rdma_send_error(struct svcxprt_rdma *xprt,
__be32 *rdma_argp, int status) struct svc_rdma_recv_ctxt *rctxt,
int status)
{ {
__be32 *p, *rdma_argp = rctxt->rc_recv_buf;
struct svc_rdma_send_ctxt *ctxt; struct svc_rdma_send_ctxt *ctxt;
__be32 *p;
int ret; int ret;
ctxt = svc_rdma_send_ctxt_get(xprt); ctxt = svc_rdma_send_ctxt_get(xprt);
...@@ -900,13 +901,13 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp) ...@@ -900,13 +901,13 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
return 0; return 0;
out_err: out_err:
svc_rdma_send_error(rdma_xprt, p, ret); svc_rdma_send_error(rdma_xprt, ctxt, ret);
svc_rdma_recv_ctxt_put(rdma_xprt, ctxt); svc_rdma_recv_ctxt_put(rdma_xprt, ctxt);
return 0; return 0;
out_postfail: out_postfail:
if (ret == -EINVAL) if (ret == -EINVAL)
svc_rdma_send_error(rdma_xprt, p, ret); svc_rdma_send_error(rdma_xprt, ctxt, ret);
svc_rdma_recv_ctxt_put(rdma_xprt, ctxt); svc_rdma_recv_ctxt_put(rdma_xprt, ctxt);
return ret; return ret;
......
...@@ -811,18 +811,17 @@ static int svc_rdma_send_reply_msg(struct svcxprt_rdma *rdma, ...@@ -811,18 +811,17 @@ static int svc_rdma_send_reply_msg(struct svcxprt_rdma *rdma,
* Remote Invalidation is skipped for simplicity. * Remote Invalidation is skipped for simplicity.
*/ */
static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma, static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
struct svc_rdma_send_ctxt *ctxt, struct svc_rdma_send_ctxt *sctxt,
struct svc_rqst *rqstp) struct svc_rdma_recv_ctxt *rctxt)
{ {
struct svc_rdma_recv_ctxt *rctxt = rqstp->rq_xprt_ctxt;
__be32 *rdma_argp = rctxt->rc_recv_buf; __be32 *rdma_argp = rctxt->rc_recv_buf;
__be32 *p; __be32 *p;
rpcrdma_set_xdrlen(&ctxt->sc_hdrbuf, 0); rpcrdma_set_xdrlen(&sctxt->sc_hdrbuf, 0);
xdr_init_encode(&ctxt->sc_stream, &ctxt->sc_hdrbuf, ctxt->sc_xprt_buf, xdr_init_encode(&sctxt->sc_stream, &sctxt->sc_hdrbuf,
NULL); sctxt->sc_xprt_buf, NULL);
p = xdr_reserve_space(&ctxt->sc_stream, RPCRDMA_HDRLEN_ERR); p = xdr_reserve_space(&sctxt->sc_stream, RPCRDMA_HDRLEN_ERR);
if (!p) if (!p)
return -ENOMSG; return -ENOMSG;
...@@ -833,10 +832,10 @@ static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma, ...@@ -833,10 +832,10 @@ static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
*p = err_chunk; *p = err_chunk;
trace_svcrdma_err_chunk(*rdma_argp); trace_svcrdma_err_chunk(*rdma_argp);
ctxt->sc_send_wr.num_sge = 1; sctxt->sc_send_wr.num_sge = 1;
ctxt->sc_send_wr.opcode = IB_WR_SEND; sctxt->sc_send_wr.opcode = IB_WR_SEND;
ctxt->sc_sges[0].length = ctxt->sc_hdrbuf.len; sctxt->sc_sges[0].length = sctxt->sc_hdrbuf.len;
return svc_rdma_send(rdma, &ctxt->sc_send_wr); return svc_rdma_send(rdma, &sctxt->sc_send_wr);
} }
/** /**
...@@ -931,7 +930,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp) ...@@ -931,7 +930,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
* of previously posted RDMA Writes. * of previously posted RDMA Writes.
*/ */
svc_rdma_save_io_pages(rqstp, sctxt); svc_rdma_save_io_pages(rqstp, sctxt);
ret = svc_rdma_send_error_msg(rdma, sctxt, rqstp); ret = svc_rdma_send_error_msg(rdma, sctxt, rctxt);
if (ret < 0) if (ret < 0)
goto err1; goto err1;
return 0; return 0;
......
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