@@ -145,19 +145,32 @@ static __be32 *decode_reply_array(__be32 *va, __be32 *vaend)
145
145
return (__be32 * )& ary -> wc_array [nchunks ];
146
146
}
147
147
148
- int svc_rdma_xdr_decode_req (struct rpcrdma_msg * rmsgp , struct svc_rqst * rqstp )
148
+ /**
149
+ * svc_rdma_xdr_decode_req - Parse incoming RPC-over-RDMA header
150
+ * @rq_arg: Receive buffer
151
+ *
152
+ * On entry, xdr->head[0].iov_base points to first byte in the
153
+ * RPC-over-RDMA header.
154
+ *
155
+ * On successful exit, head[0] points to first byte past the
156
+ * RPC-over-RDMA header. For RDMA_MSG, this is the RPC message.
157
+ * The length of the RPC-over-RDMA header is returned.
158
+ */
159
+ int svc_rdma_xdr_decode_req (struct xdr_buf * rq_arg )
149
160
{
161
+ struct rpcrdma_msg * rmsgp ;
150
162
__be32 * va , * vaend ;
151
163
unsigned int len ;
152
164
u32 hdr_len ;
153
165
154
166
/* Verify that there's enough bytes for header + something */
155
- if (rqstp -> rq_arg . len <= RPCRDMA_HDRLEN_ERR ) {
167
+ if (rq_arg -> len <= RPCRDMA_HDRLEN_ERR ) {
156
168
dprintk ("svcrdma: header too short = %d\n" ,
157
- rqstp -> rq_arg . len );
169
+ rq_arg -> len );
158
170
return - EINVAL ;
159
171
}
160
172
173
+ rmsgp = (struct rpcrdma_msg * )rq_arg -> head [0 ].iov_base ;
161
174
if (rmsgp -> rm_vers != rpcrdma_version ) {
162
175
dprintk ("%s: bad version %u\n" , __func__ ,
163
176
be32_to_cpu (rmsgp -> rm_vers ));
@@ -189,10 +202,10 @@ int svc_rdma_xdr_decode_req(struct rpcrdma_msg *rmsgp, struct svc_rqst *rqstp)
189
202
be32_to_cpu (rmsgp -> rm_body .rm_padded .rm_thresh );
190
203
191
204
va = & rmsgp -> rm_body .rm_padded .rm_pempty [4 ];
192
- rqstp -> rq_arg . head [0 ].iov_base = va ;
205
+ rq_arg -> head [0 ].iov_base = va ;
193
206
len = (u32 )((unsigned long )va - (unsigned long )rmsgp );
194
- rqstp -> rq_arg . head [0 ].iov_len -= len ;
195
- if (len > rqstp -> rq_arg . len )
207
+ rq_arg -> head [0 ].iov_len -= len ;
208
+ if (len > rq_arg -> len )
196
209
return - EINVAL ;
197
210
return len ;
198
211
default :
@@ -205,7 +218,7 @@ int svc_rdma_xdr_decode_req(struct rpcrdma_msg *rmsgp, struct svc_rqst *rqstp)
205
218
* chunk list and a reply chunk list.
206
219
*/
207
220
va = & rmsgp -> rm_body .rm_chunks [0 ];
208
- vaend = (__be32 * )((unsigned long )rmsgp + rqstp -> rq_arg . len );
221
+ vaend = (__be32 * )((unsigned long )rmsgp + rq_arg -> len );
209
222
va = decode_read_list (va , vaend );
210
223
if (!va ) {
211
224
dprintk ("svcrdma: failed to decode read list\n" );
@@ -222,10 +235,9 @@ int svc_rdma_xdr_decode_req(struct rpcrdma_msg *rmsgp, struct svc_rqst *rqstp)
222
235
return - EINVAL ;
223
236
}
224
237
225
- rqstp -> rq_arg . head [0 ].iov_base = va ;
238
+ rq_arg -> head [0 ].iov_base = va ;
226
239
hdr_len = (unsigned long )va - (unsigned long )rmsgp ;
227
- rqstp -> rq_arg .head [0 ].iov_len -= hdr_len ;
228
-
240
+ rq_arg -> head [0 ].iov_len -= hdr_len ;
229
241
return hdr_len ;
230
242
}
231
243
0 commit comments