struct svc_rdma_read_info {
struct svc_rqst *ri_rqst;
struct svc_rdma_recv_ctxt *ri_readctxt;
- unsigned int ri_pageno;
unsigned int ri_pageoff;
};
if (!info->ri_pageoff)
head->rc_page_count++;
- sg_set_page(sg, rqstp->rq_pages[info->ri_pageno],
+ sg_set_page(sg, rqstp->rq_pages[head->rc_curpage],
seg_len, info->ri_pageoff);
sg = sg_next(sg);
info->ri_pageoff += seg_len;
if (info->ri_pageoff == PAGE_SIZE) {
- info->ri_pageno++;
+ head->rc_curpage++;
info->ri_pageoff = 0;
}
len -= seg_len;
- /* Safety check */
- if (len &&
- &rqstp->rq_pages[info->ri_pageno + 1] > rqstp->rq_page_end)
+ if (len && ((head->rc_curpage + 1) > ARRAY_SIZE(rqstp->rq_pages)))
goto out_overrun;
}
return 0;
out_overrun:
- trace_svcrdma_page_overrun_err(&cc->cc_cid, info->ri_pageno);
+ trace_svcrdma_page_overrun_err(&cc->cc_cid, head->rc_curpage);
return -EINVAL;
}
*
* Take a page at a time from rqstp->rq_pages and copy the inline
* content from the Receive buffer into that page. Update
- * info->ri_pageno and info->ri_pageoff so that the next RDMA Read
+ * head->rc_curpage and info->ri_pageoff so that the next RDMA Read
* result will land contiguously with the copied content.
*
* Return values:
if (!info->ri_pageoff)
head->rc_page_count++;
- dst = page_address(rqstp->rq_pages[info->ri_pageno]);
- memcpy(dst + info->ri_pageno, src + offset, page_len);
+ dst = page_address(rqstp->rq_pages[head->rc_curpage]);
+ memcpy(dst + head->rc_curpage, src + offset, page_len);
head->rc_readbytes += page_len;
info->ri_pageoff += page_len;
if (info->ri_pageoff == PAGE_SIZE) {
- info->ri_pageno++;
+ head->rc_curpage++;
info->ri_pageoff = 0;
}
remaining -= page_len;
return -ENOMEM;
info->ri_rqst = rqstp;
info->ri_readctxt = head;
- info->ri_pageno = 0;
info->ri_pageoff = 0;
svc_rdma_cc_init(rdma, cc);
cc->cc_cqe.done = svc_rdma_wc_read_done;
+ head->rc_curpage = 0;
head->rc_readbytes = 0;
if (pcl_is_empty(&head->rc_call_pcl)) {