xprtrdma: Clean up rpcrdma_bc_marshal_reply()

Same changes as in rpcrdma_marshal_req(). This removes
C-structure style encoding from the backchannel.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>

authored by

Chuck Lever and committed by
Anna Schumaker
7ec910e7 39f4cd9e

+17 -12
+17 -12
net/sunrpc/xprtrdma/backchannel.c
··· 49 49 if (IS_ERR(rb)) 50 50 goto out_fail; 51 51 req->rl_rdmabuf = rb; 52 + xdr_buf_init(&req->rl_hdrbuf, rb->rg_base, rdmab_length(rb)); 52 53 53 54 size = r_xprt->rx_data.inline_rsize; 54 55 rb = rpcrdma_alloc_regbuf(size, DMA_TO_DEVICE, GFP_KERNEL); ··· 203 202 */ 204 203 int rpcrdma_bc_marshal_reply(struct rpc_rqst *rqst) 205 204 { 206 - struct rpc_xprt *xprt = rqst->rq_xprt; 207 - struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); 205 + struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_xprt); 208 206 struct rpcrdma_req *req = rpcr_to_rdmar(rqst); 209 - struct rpcrdma_msg *headerp; 207 + __be32 *p; 210 208 211 - headerp = rdmab_to_msg(req->rl_rdmabuf); 212 - headerp->rm_xid = rqst->rq_xid; 213 - headerp->rm_vers = rpcrdma_version; 214 - headerp->rm_credit = 215 - cpu_to_be32(r_xprt->rx_buf.rb_bc_srv_max_requests); 216 - headerp->rm_type = rdma_msg; 217 - headerp->rm_body.rm_chunks[0] = xdr_zero; 218 - headerp->rm_body.rm_chunks[1] = xdr_zero; 219 - headerp->rm_body.rm_chunks[2] = xdr_zero; 209 + rpcrdma_set_xdrlen(&req->rl_hdrbuf, 0); 210 + xdr_init_encode(&req->rl_stream, &req->rl_hdrbuf, 211 + req->rl_rdmabuf->rg_base); 212 + 213 + p = xdr_reserve_space(&req->rl_stream, 28); 214 + if (unlikely(!p)) 215 + return -EIO; 216 + *p++ = rqst->rq_xid; 217 + *p++ = rpcrdma_version; 218 + *p++ = cpu_to_be32(r_xprt->rx_buf.rb_bc_srv_max_requests); 219 + *p++ = rdma_msg; 220 + *p++ = xdr_zero; 221 + *p++ = xdr_zero; 222 + *p = xdr_zero; 220 223 221 224 if (!rpcrdma_prepare_send_sges(&r_xprt->rx_ia, req, RPCRDMA_HDRLEN_MIN, 222 225 &rqst->rq_snd_buf, rpcrdma_noch))