aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/rpc_rdma.h32
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c24
2 files changed, 28 insertions, 28 deletions
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
index 0013a0d8dc6b..87b895d5c786 100644
--- a/include/linux/sunrpc/rpc_rdma.h
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -41,17 +41,17 @@
41#define _LINUX_SUNRPC_RPC_RDMA_H 41#define _LINUX_SUNRPC_RPC_RDMA_H
42 42
43struct rpcrdma_segment { 43struct rpcrdma_segment {
44 uint32_t rs_handle; /* Registered memory handle */ 44 __be32 rs_handle; /* Registered memory handle */
45 uint32_t rs_length; /* Length of the chunk in bytes */ 45 __be32 rs_length; /* Length of the chunk in bytes */
46 uint64_t rs_offset; /* Chunk virtual address or offset */ 46 __be64 rs_offset; /* Chunk virtual address or offset */
47}; 47};
48 48
49/* 49/*
50 * read chunk(s), encoded as a linked list. 50 * read chunk(s), encoded as a linked list.
51 */ 51 */
52struct rpcrdma_read_chunk { 52struct rpcrdma_read_chunk {
53 uint32_t rc_discrim; /* 1 indicates presence */ 53 __be32 rc_discrim; /* 1 indicates presence */
54 uint32_t rc_position; /* Position in XDR stream */ 54 __be32 rc_position; /* Position in XDR stream */
55 struct rpcrdma_segment rc_target; 55 struct rpcrdma_segment rc_target;
56}; 56};
57 57
@@ -66,29 +66,29 @@ struct rpcrdma_write_chunk {
66 * write chunk(s), encoded as a counted array. 66 * write chunk(s), encoded as a counted array.
67 */ 67 */
68struct rpcrdma_write_array { 68struct rpcrdma_write_array {
69 uint32_t wc_discrim; /* 1 indicates presence */ 69 __be32 wc_discrim; /* 1 indicates presence */
70 uint32_t wc_nchunks; /* Array count */ 70 __be32 wc_nchunks; /* Array count */
71 struct rpcrdma_write_chunk wc_array[0]; 71 struct rpcrdma_write_chunk wc_array[0];
72}; 72};
73 73
74struct rpcrdma_msg { 74struct rpcrdma_msg {
75 uint32_t rm_xid; /* Mirrors the RPC header xid */ 75 __be32 rm_xid; /* Mirrors the RPC header xid */
76 uint32_t rm_vers; /* Version of this protocol */ 76 __be32 rm_vers; /* Version of this protocol */
77 uint32_t rm_credit; /* Buffers requested/granted */ 77 __be32 rm_credit; /* Buffers requested/granted */
78 uint32_t rm_type; /* Type of message (enum rpcrdma_proc) */ 78 __be32 rm_type; /* Type of message (enum rpcrdma_proc) */
79 union { 79 union {
80 80
81 struct { /* no chunks */ 81 struct { /* no chunks */
82 uint32_t rm_empty[3]; /* 3 empty chunk lists */ 82 __be32 rm_empty[3]; /* 3 empty chunk lists */
83 } rm_nochunks; 83 } rm_nochunks;
84 84
85 struct { /* no chunks and padded */ 85 struct { /* no chunks and padded */
86 uint32_t rm_align; /* Padding alignment */ 86 __be32 rm_align; /* Padding alignment */
87 uint32_t rm_thresh; /* Padding threshold */ 87 __be32 rm_thresh; /* Padding threshold */
88 uint32_t rm_pempty[3]; /* 3 empty chunk lists */ 88 __be32 rm_pempty[3]; /* 3 empty chunk lists */
89 } rm_padded; 89 } rm_padded;
90 90
91 uint32_t rm_chunks[0]; /* read, write and reply chunks */ 91 __be32 rm_chunks[0]; /* read, write and reply chunks */
92 92
93 } rm_body; 93 } rm_body;
94}; 94};
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 12db63580427..f877b88091ce 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -181,7 +181,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
181 struct rpcrdma_read_chunk *cur_rchunk = NULL; 181 struct rpcrdma_read_chunk *cur_rchunk = NULL;
182 struct rpcrdma_write_array *warray = NULL; 182 struct rpcrdma_write_array *warray = NULL;
183 struct rpcrdma_write_chunk *cur_wchunk = NULL; 183 struct rpcrdma_write_chunk *cur_wchunk = NULL;
184 u32 *iptr = headerp->rm_body.rm_chunks; 184 __be32 *iptr = headerp->rm_body.rm_chunks;
185 185
186 if (type == rpcrdma_readch || type == rpcrdma_areadch) { 186 if (type == rpcrdma_readch || type == rpcrdma_areadch) {
187 /* a read chunk - server will RDMA Read our memory */ 187 /* a read chunk - server will RDMA Read our memory */
@@ -217,7 +217,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
217 cur_rchunk->rc_target.rs_handle = htonl(seg->mr_rkey); 217 cur_rchunk->rc_target.rs_handle = htonl(seg->mr_rkey);
218 cur_rchunk->rc_target.rs_length = htonl(seg->mr_len); 218 cur_rchunk->rc_target.rs_length = htonl(seg->mr_len);
219 xdr_encode_hyper( 219 xdr_encode_hyper(
220 (u32 *)&cur_rchunk->rc_target.rs_offset, 220 (__be32 *)&cur_rchunk->rc_target.rs_offset,
221 seg->mr_base); 221 seg->mr_base);
222 dprintk("RPC: %s: read chunk " 222 dprintk("RPC: %s: read chunk "
223 "elem %d@0x%llx:0x%x pos %d (%s)\n", __func__, 223 "elem %d@0x%llx:0x%x pos %d (%s)\n", __func__,
@@ -229,7 +229,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
229 cur_wchunk->wc_target.rs_handle = htonl(seg->mr_rkey); 229 cur_wchunk->wc_target.rs_handle = htonl(seg->mr_rkey);
230 cur_wchunk->wc_target.rs_length = htonl(seg->mr_len); 230 cur_wchunk->wc_target.rs_length = htonl(seg->mr_len);
231 xdr_encode_hyper( 231 xdr_encode_hyper(
232 (u32 *)&cur_wchunk->wc_target.rs_offset, 232 (__be32 *)&cur_wchunk->wc_target.rs_offset,
233 seg->mr_base); 233 seg->mr_base);
234 dprintk("RPC: %s: %s chunk " 234 dprintk("RPC: %s: %s chunk "
235 "elem %d@0x%llx:0x%x (%s)\n", __func__, 235 "elem %d@0x%llx:0x%x (%s)\n", __func__,
@@ -257,14 +257,14 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
257 * finish off header. If write, marshal discrim and nchunks. 257 * finish off header. If write, marshal discrim and nchunks.
258 */ 258 */
259 if (cur_rchunk) { 259 if (cur_rchunk) {
260 iptr = (u32 *) cur_rchunk; 260 iptr = (__be32 *) cur_rchunk;
261 *iptr++ = xdr_zero; /* finish the read chunk list */ 261 *iptr++ = xdr_zero; /* finish the read chunk list */
262 *iptr++ = xdr_zero; /* encode a NULL write chunk list */ 262 *iptr++ = xdr_zero; /* encode a NULL write chunk list */
263 *iptr++ = xdr_zero; /* encode a NULL reply chunk */ 263 *iptr++ = xdr_zero; /* encode a NULL reply chunk */
264 } else { 264 } else {
265 warray->wc_discrim = xdr_one; 265 warray->wc_discrim = xdr_one;
266 warray->wc_nchunks = htonl(nchunks); 266 warray->wc_nchunks = htonl(nchunks);
267 iptr = (u32 *) cur_wchunk; 267 iptr = (__be32 *) cur_wchunk;
268 if (type == rpcrdma_writech) { 268 if (type == rpcrdma_writech) {
269 *iptr++ = xdr_zero; /* finish the write chunk list */ 269 *iptr++ = xdr_zero; /* finish the write chunk list */
270 *iptr++ = xdr_zero; /* encode a NULL reply chunk */ 270 *iptr++ = xdr_zero; /* encode a NULL reply chunk */
@@ -559,7 +559,7 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst)
559 * RDMA'd by server. See map at rpcrdma_create_chunks()! :-) 559 * RDMA'd by server. See map at rpcrdma_create_chunks()! :-)
560 */ 560 */
561static int 561static int
562rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp) 562rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, __be32 **iptrp)
563{ 563{
564 unsigned int i, total_len; 564 unsigned int i, total_len;
565 struct rpcrdma_write_chunk *cur_wchunk; 565 struct rpcrdma_write_chunk *cur_wchunk;
@@ -573,7 +573,7 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp)
573 struct rpcrdma_segment *seg = &cur_wchunk->wc_target; 573 struct rpcrdma_segment *seg = &cur_wchunk->wc_target;
574 ifdebug(FACILITY) { 574 ifdebug(FACILITY) {
575 u64 off; 575 u64 off;
576 xdr_decode_hyper((u32 *)&seg->rs_offset, &off); 576 xdr_decode_hyper((__be32 *)&seg->rs_offset, &off);
577 dprintk("RPC: %s: chunk %d@0x%llx:0x%x\n", 577 dprintk("RPC: %s: chunk %d@0x%llx:0x%x\n",
578 __func__, 578 __func__,
579 ntohl(seg->rs_length), 579 ntohl(seg->rs_length),
@@ -585,7 +585,7 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp)
585 } 585 }
586 /* check and adjust for properly terminated write chunk */ 586 /* check and adjust for properly terminated write chunk */
587 if (wrchunk) { 587 if (wrchunk) {
588 u32 *w = (u32 *) cur_wchunk; 588 __be32 *w = (__be32 *) cur_wchunk;
589 if (*w++ != xdr_zero) 589 if (*w++ != xdr_zero)
590 return -1; 590 return -1;
591 cur_wchunk = (struct rpcrdma_write_chunk *) w; 591 cur_wchunk = (struct rpcrdma_write_chunk *) w;
@@ -593,7 +593,7 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp)
593 if ((char *) cur_wchunk > rep->rr_base + rep->rr_len) 593 if ((char *) cur_wchunk > rep->rr_base + rep->rr_len)
594 return -1; 594 return -1;
595 595
596 *iptrp = (u32 *) cur_wchunk; 596 *iptrp = (__be32 *) cur_wchunk;
597 return total_len; 597 return total_len;
598} 598}
599 599
@@ -721,7 +721,7 @@ rpcrdma_reply_handler(struct rpcrdma_rep *rep)
721 struct rpc_rqst *rqst; 721 struct rpc_rqst *rqst;
722 struct rpc_xprt *xprt = rep->rr_xprt; 722 struct rpc_xprt *xprt = rep->rr_xprt;
723 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); 723 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
724 u32 *iptr; 724 __be32 *iptr;
725 int i, rdmalen, status; 725 int i, rdmalen, status;
726 726
727 /* Check status. If bad, signal disconnect and return rep to pool */ 727 /* Check status. If bad, signal disconnect and return rep to pool */
@@ -801,7 +801,7 @@ repost:
801 r_xprt->rx_stats.total_rdma_reply += rdmalen; 801 r_xprt->rx_stats.total_rdma_reply += rdmalen;
802 } else { 802 } else {
803 /* else ordinary inline */ 803 /* else ordinary inline */
804 iptr = (u32 *)((unsigned char *)headerp + 28); 804 iptr = (__be32 *)((unsigned char *)headerp + 28);
805 rep->rr_len -= 28; /*sizeof *headerp;*/ 805 rep->rr_len -= 28; /*sizeof *headerp;*/
806 status = rep->rr_len; 806 status = rep->rr_len;
807 } 807 }
@@ -816,7 +816,7 @@ repost:
816 headerp->rm_body.rm_chunks[2] != xdr_one || 816 headerp->rm_body.rm_chunks[2] != xdr_one ||
817 req->rl_nchunks == 0) 817 req->rl_nchunks == 0)
818 goto badheader; 818 goto badheader;
819 iptr = (u32 *)((unsigned char *)headerp + 28); 819 iptr = (__be32 *)((unsigned char *)headerp + 28);
820 rdmalen = rpcrdma_count_chunks(rep, req->rl_nchunks, 0, &iptr); 820 rdmalen = rpcrdma_count_chunks(rep, req->rl_nchunks, 0, &iptr);
821 if (rdmalen < 0) 821 if (rdmalen < 0)
822 goto badheader; 822 goto badheader;