svcrdma: Cleanup sparse warnings in the svcrdma module
The svcrdma transport was un-marshalling requests in-place. This resulted in sparse warnings due to __beXX data containing both NBO and HBO data. The code has been restructured to do byte-swapping as the header is parsed instead of when the header is validated immediately after receipt. Also moved extern declarations for the workqueue and memory pools to the private header file. Signed-off-by: Tom Tucker <tom@ogc.us> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:

committed by
J. Bruce Fields

parent
2c8bd7e0d1
commit
cec56c8ff5
@@ -147,7 +147,7 @@ static int map_read_chunks(struct svcxprt_rdma *xprt,
|
||||
page_off = 0;
|
||||
ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0];
|
||||
ch_no = 0;
|
||||
ch_bytes = ch->rc_target.rs_length;
|
||||
ch_bytes = ntohl(ch->rc_target.rs_length);
|
||||
head->arg.head[0] = rqstp->rq_arg.head[0];
|
||||
head->arg.tail[0] = rqstp->rq_arg.tail[0];
|
||||
head->arg.pages = &head->pages[head->count];
|
||||
@@ -183,7 +183,7 @@ static int map_read_chunks(struct svcxprt_rdma *xprt,
|
||||
ch_no++;
|
||||
ch++;
|
||||
chl_map->ch[ch_no].start = sge_no;
|
||||
ch_bytes = ch->rc_target.rs_length;
|
||||
ch_bytes = ntohl(ch->rc_target.rs_length);
|
||||
/* If bytes remaining account for next chunk */
|
||||
if (byte_count) {
|
||||
head->arg.page_len += ch_bytes;
|
||||
@@ -281,11 +281,12 @@ static int fast_reg_read_chunks(struct svcxprt_rdma *xprt,
|
||||
offset = 0;
|
||||
ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0];
|
||||
for (ch_no = 0; ch_no < ch_count; ch_no++) {
|
||||
int len = ntohl(ch->rc_target.rs_length);
|
||||
rpl_map->sge[ch_no].iov_base = frmr->kva + offset;
|
||||
rpl_map->sge[ch_no].iov_len = ch->rc_target.rs_length;
|
||||
rpl_map->sge[ch_no].iov_len = len;
|
||||
chl_map->ch[ch_no].count = 1;
|
||||
chl_map->ch[ch_no].start = ch_no;
|
||||
offset += ch->rc_target.rs_length;
|
||||
offset += len;
|
||||
ch++;
|
||||
}
|
||||
|
||||
@@ -316,7 +317,7 @@ static int rdma_set_ctxt_sge(struct svcxprt_rdma *xprt,
|
||||
for (i = 0; i < count; i++) {
|
||||
ctxt->sge[i].length = 0; /* in case map fails */
|
||||
if (!frmr) {
|
||||
BUG_ON(0 == virt_to_page(vec[i].iov_base));
|
||||
BUG_ON(!virt_to_page(vec[i].iov_base));
|
||||
off = (unsigned long)vec[i].iov_base & ~PAGE_MASK;
|
||||
ctxt->sge[i].addr =
|
||||
ib_dma_map_page(xprt->sc_cm_id->device,
|
||||
@@ -426,6 +427,7 @@ static int rdma_read_xdr(struct svcxprt_rdma *xprt,
|
||||
|
||||
for (ch = (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0];
|
||||
ch->rc_discrim != 0; ch++, ch_no++) {
|
||||
u64 rs_offset;
|
||||
next_sge:
|
||||
ctxt = svc_rdma_get_context(xprt);
|
||||
ctxt->direction = DMA_FROM_DEVICE;
|
||||
@@ -440,10 +442,10 @@ next_sge:
|
||||
read_wr.opcode = IB_WR_RDMA_READ;
|
||||
ctxt->wr_op = read_wr.opcode;
|
||||
read_wr.send_flags = IB_SEND_SIGNALED;
|
||||
read_wr.wr.rdma.rkey = ch->rc_target.rs_handle;
|
||||
read_wr.wr.rdma.remote_addr =
|
||||
get_unaligned(&(ch->rc_target.rs_offset)) +
|
||||
sgl_offset;
|
||||
read_wr.wr.rdma.rkey = ntohl(ch->rc_target.rs_handle);
|
||||
xdr_decode_hyper((__be32 *)&ch->rc_target.rs_offset,
|
||||
&rs_offset);
|
||||
read_wr.wr.rdma.remote_addr = rs_offset + sgl_offset;
|
||||
read_wr.sg_list = ctxt->sge;
|
||||
read_wr.num_sge =
|
||||
rdma_read_max_sge(xprt, chl_map->ch[ch_no].count);
|
||||
|
Reference in New Issue
Block a user