Skip to content

Commit c65b326

Browse files
committed
svcrdma: Make svc_rdma_send_error_msg() a global function
Prepare for svc_rdma_send_error_msg() to be invoked from another source file. Signed-off-by: Chuck Lever <[email protected]>
1 parent 605c61b commit c65b326

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

include/linux/sunrpc/svc_rdma.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ extern int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma,
195195
struct svc_rdma_send_ctxt *sctxt,
196196
const struct svc_rdma_recv_ctxt *rctxt,
197197
struct xdr_buf *xdr);
198+
extern void svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
199+
struct svc_rdma_send_ctxt *sctxt,
200+
struct svc_rdma_recv_ctxt *rctxt,
201+
int status);
198202
extern int svc_rdma_sendto(struct svc_rqst *);
199203
extern int svc_rdma_read_payload(struct svc_rqst *rqstp, unsigned int offset,
200204
unsigned int length);

net/sunrpc/xprtrdma/svc_rdma_sendto.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -804,16 +804,25 @@ static int svc_rdma_send_reply_msg(struct svcxprt_rdma *rdma,
804804
return svc_rdma_send(rdma, &sctxt->sc_send_wr);
805805
}
806806

807-
/* Given the client-provided Write and Reply chunks, the server was not
808-
* able to form a complete reply. Return an RDMA_ERROR message so the
809-
* client can retire this RPC transaction.
810-
*
811-
* Remote Invalidation is skipped for simplicity.
807+
/**
808+
* svc_rdma_send_error_msg - Send an RPC/RDMA v1 error response
809+
* @rdma: controlling transport context
810+
* @sctxt: Send context for the response
811+
* @rctxt: Receive context for incoming bad message
812+
* @status: negative errno indicating error that occurred
813+
*
814+
* Given the client-provided Read, Write, and Reply chunks, the
815+
* server was not able to parse the Call or form a complete Reply.
816+
* Return an RDMA_ERROR message so the client can retire the RPC
817+
* transaction.
818+
*
819+
* The caller does not have to release @sctxt. It is released by
820+
* Send completion, or by this function on error.
812821
*/
813-
static void svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
814-
struct svc_rdma_send_ctxt *sctxt,
815-
struct svc_rdma_recv_ctxt *rctxt,
816-
int status)
822+
void svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
823+
struct svc_rdma_send_ctxt *sctxt,
824+
struct svc_rdma_recv_ctxt *rctxt,
825+
int status)
817826
{
818827
__be32 *rdma_argp = rctxt->rc_recv_buf;
819828
__be32 *p;
@@ -852,6 +861,7 @@ static void svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
852861
trace_svcrdma_err_chunk(*rdma_argp);
853862
}
854863

864+
/* Remote Invalidation is skipped for simplicity. */
855865
sctxt->sc_send_wr.num_sge = 1;
856866
sctxt->sc_send_wr.opcode = IB_WR_SEND;
857867
sctxt->sc_sges[0].length = sctxt->sc_hdrbuf.len;

0 commit comments

Comments
 (0)