aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_sendto.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 2798f3ea0020..2eb3df698e11 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -189,32 +189,25 @@ static void svc_rdma_get_write_arrays(struct rpcrdma_msg *rmsgp,
189 * Invalidate, and responder chooses one rkey to invalidate. 189 * Invalidate, and responder chooses one rkey to invalidate.
190 * 190 *
191 * Find a candidate rkey to invalidate when sending a reply. Picks the 191 * Find a candidate rkey to invalidate when sending a reply. Picks the
192 * first rkey it finds in the chunks lists. 192 * first R_key it finds in the chunk lists.
193 * 193 *
194 * Returns zero if RPC's chunk lists are empty. 194 * Returns zero if RPC's chunk lists are empty.
195 */ 195 */
196static u32 svc_rdma_get_inv_rkey(struct rpcrdma_msg *rdma_argp, 196static u32 svc_rdma_get_inv_rkey(__be32 *rdma_argp,
197 struct rpcrdma_write_array *wr_ary, 197 __be32 *wr_lst, __be32 *rp_ch)
198 struct rpcrdma_write_array *rp_ary)
199{ 198{
200 struct rpcrdma_read_chunk *rd_ary; 199 __be32 *p;
201 struct rpcrdma_segment *arg_ch;
202
203 rd_ary = (struct rpcrdma_read_chunk *)&rdma_argp->rm_body.rm_chunks[0];
204 if (rd_ary->rc_discrim != xdr_zero)
205 return be32_to_cpu(rd_ary->rc_target.rs_handle);
206
207 if (wr_ary && be32_to_cpu(wr_ary->wc_nchunks)) {
208 arg_ch = &wr_ary->wc_array[0].wc_target;
209 return be32_to_cpu(arg_ch->rs_handle);
210 }
211
212 if (rp_ary && be32_to_cpu(rp_ary->wc_nchunks)) {
213 arg_ch = &rp_ary->wc_array[0].wc_target;
214 return be32_to_cpu(arg_ch->rs_handle);
215 }
216 200
217 return 0; 201 p = rdma_argp + rpcrdma_fixed_maxsz;
202 if (*p != xdr_zero)
203 p += 2;
204 else if (wr_lst && be32_to_cpup(wr_lst + 1))
205 p = wr_lst + 2;
206 else if (rp_ch && be32_to_cpup(rp_ch + 1))
207 p = rp_ch + 2;
208 else
209 return 0;
210 return be32_to_cpup(p);
218} 211}
219 212
220static int svc_rdma_dma_map_page(struct svcxprt_rdma *rdma, 213static int svc_rdma_dma_map_page(struct svcxprt_rdma *rdma,
@@ -650,7 +643,9 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
650 643
651 inv_rkey = 0; 644 inv_rkey = 0;
652 if (rdma->sc_snd_w_inv) 645 if (rdma->sc_snd_w_inv)
653 inv_rkey = svc_rdma_get_inv_rkey(rdma_argp, wr_ary, rp_ary); 646 inv_rkey = svc_rdma_get_inv_rkey(&rdma_argp->rm_xid,
647 (__be32 *)wr_ary,
648 (__be32 *)rp_ary);
654 649
655 /* Build an req vec for the XDR */ 650 /* Build an req vec for the XDR */
656 vec = svc_rdma_get_req_map(rdma); 651 vec = svc_rdma_get_req_map(rdma);