Skip to content

Commit d1f6e23

Browse files
committed
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: Chuck Lever <[email protected]>
1 parent 6e9fab7 commit d1f6e23

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

net/sunrpc/xprtrdma/svc_rdma_recvfrom.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -715,10 +715,11 @@ static void rdma_read_complete(struct svc_rqst *rqstp,
715715
}
716716

717717
static void svc_rdma_send_error(struct svcxprt_rdma *xprt,
718-
__be32 *rdma_argp, int status)
718+
struct svc_rdma_recv_ctxt *rctxt,
719+
int status)
719720
{
721+
__be32 *p, *rdma_argp = rctxt->rc_recv_buf;
720722
struct svc_rdma_send_ctxt *ctxt;
721-
__be32 *p;
722723
int ret;
723724

724725
ctxt = svc_rdma_send_ctxt_get(xprt);
@@ -900,13 +901,13 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
900901
return 0;
901902

902903
out_err:
903-
svc_rdma_send_error(rdma_xprt, p, ret);
904+
svc_rdma_send_error(rdma_xprt, ctxt, ret);
904905
svc_rdma_recv_ctxt_put(rdma_xprt, ctxt);
905906
return 0;
906907

907908
out_postfail:
908909
if (ret == -EINVAL)
909-
svc_rdma_send_error(rdma_xprt, p, ret);
910+
svc_rdma_send_error(rdma_xprt, ctxt, ret);
910911
svc_rdma_recv_ctxt_put(rdma_xprt, ctxt);
911912
return ret;
912913

net/sunrpc/xprtrdma/svc_rdma_sendto.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -811,18 +811,17 @@ static int svc_rdma_send_reply_msg(struct svcxprt_rdma *rdma,
811811
* Remote Invalidation is skipped for simplicity.
812812
*/
813813
static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
814-
struct svc_rdma_send_ctxt *ctxt,
815-
struct svc_rqst *rqstp)
814+
struct svc_rdma_send_ctxt *sctxt,
815+
struct svc_rdma_recv_ctxt *rctxt)
816816
{
817-
struct svc_rdma_recv_ctxt *rctxt = rqstp->rq_xprt_ctxt;
818817
__be32 *rdma_argp = rctxt->rc_recv_buf;
819818
__be32 *p;
820819

821-
rpcrdma_set_xdrlen(&ctxt->sc_hdrbuf, 0);
822-
xdr_init_encode(&ctxt->sc_stream, &ctxt->sc_hdrbuf, ctxt->sc_xprt_buf,
823-
NULL);
820+
rpcrdma_set_xdrlen(&sctxt->sc_hdrbuf, 0);
821+
xdr_init_encode(&sctxt->sc_stream, &sctxt->sc_hdrbuf,
822+
sctxt->sc_xprt_buf, NULL);
824823

825-
p = xdr_reserve_space(&ctxt->sc_stream, RPCRDMA_HDRLEN_ERR);
824+
p = xdr_reserve_space(&sctxt->sc_stream, RPCRDMA_HDRLEN_ERR);
826825
if (!p)
827826
return -ENOMSG;
828827

@@ -833,10 +832,10 @@ static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
833832
*p = err_chunk;
834833
trace_svcrdma_err_chunk(*rdma_argp);
835834

836-
ctxt->sc_send_wr.num_sge = 1;
837-
ctxt->sc_send_wr.opcode = IB_WR_SEND;
838-
ctxt->sc_sges[0].length = ctxt->sc_hdrbuf.len;
839-
return svc_rdma_send(rdma, &ctxt->sc_send_wr);
835+
sctxt->sc_send_wr.num_sge = 1;
836+
sctxt->sc_send_wr.opcode = IB_WR_SEND;
837+
sctxt->sc_sges[0].length = sctxt->sc_hdrbuf.len;
838+
return svc_rdma_send(rdma, &sctxt->sc_send_wr);
840839
}
841840

842841
/**
@@ -931,7 +930,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
931930
* of previously posted RDMA Writes.
932931
*/
933932
svc_rdma_save_io_pages(rqstp, sctxt);
934-
ret = svc_rdma_send_error_msg(rdma, sctxt, rqstp);
933+
ret = svc_rdma_send_error_msg(rdma, sctxt, rctxt);
935934
if (ret < 0)
936935
goto err1;
937936
return 0;

0 commit comments

Comments
 (0)