Commit 4a68edd9 authored by Chuck Lever's avatar Chuck Lever

svcrdma: Explicitly pass the transport into Read chunk I/O paths

Enable the eventual removal of the svc_rdma_chunk_ctxt::cc_rdma
field.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent c3899b71
...@@ -712,6 +712,7 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma, ...@@ -712,6 +712,7 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
/** /**
* svc_rdma_build_read_segment - Build RDMA Read WQEs to pull one RDMA segment * svc_rdma_build_read_segment - Build RDMA Read WQEs to pull one RDMA segment
* @rdma: controlling transport
* @info: context for ongoing I/O * @info: context for ongoing I/O
* @segment: co-ordinates of remote memory to be read * @segment: co-ordinates of remote memory to be read
* *
...@@ -721,7 +722,8 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma, ...@@ -721,7 +722,8 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma,
* %-ENOMEM: allocating a local resources failed * %-ENOMEM: allocating a local resources failed
* %-EIO: a DMA mapping error occurred * %-EIO: a DMA mapping error occurred
*/ */
static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, static int svc_rdma_build_read_segment(struct svcxprt_rdma *rdma,
struct svc_rdma_read_info *info,
const struct svc_rdma_segment *segment) const struct svc_rdma_segment *segment)
{ {
struct svc_rdma_recv_ctxt *head = info->ri_readctxt; struct svc_rdma_recv_ctxt *head = info->ri_readctxt;
...@@ -734,7 +736,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, ...@@ -734,7 +736,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info,
len = segment->rs_length; len = segment->rs_length;
sge_no = PAGE_ALIGN(info->ri_pageoff + len) >> PAGE_SHIFT; sge_no = PAGE_ALIGN(info->ri_pageoff + len) >> PAGE_SHIFT;
ctxt = svc_rdma_get_rw_ctxt(cc->cc_rdma, sge_no); ctxt = svc_rdma_get_rw_ctxt(rdma, sge_no);
if (!ctxt) if (!ctxt)
return -ENOMEM; return -ENOMEM;
ctxt->rw_nents = sge_no; ctxt->rw_nents = sge_no;
...@@ -764,7 +766,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, ...@@ -764,7 +766,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info,
goto out_overrun; goto out_overrun;
} }
ret = svc_rdma_rw_ctx_init(cc->cc_rdma, ctxt, segment->rs_offset, ret = svc_rdma_rw_ctx_init(rdma, ctxt, segment->rs_offset,
segment->rs_handle, DMA_FROM_DEVICE); segment->rs_handle, DMA_FROM_DEVICE);
if (ret < 0) if (ret < 0)
return -EIO; return -EIO;
...@@ -781,6 +783,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, ...@@ -781,6 +783,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info,
/** /**
* svc_rdma_build_read_chunk - Build RDMA Read WQEs to pull one RDMA chunk * svc_rdma_build_read_chunk - Build RDMA Read WQEs to pull one RDMA chunk
* @rdma: controlling transport
* @info: context for ongoing I/O * @info: context for ongoing I/O
* @chunk: Read chunk to pull * @chunk: Read chunk to pull
* *
...@@ -790,7 +793,8 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, ...@@ -790,7 +793,8 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info,
* %-ENOMEM: allocating a local resources failed * %-ENOMEM: allocating a local resources failed
* %-EIO: a DMA mapping error occurred * %-EIO: a DMA mapping error occurred
*/ */
static int svc_rdma_build_read_chunk(struct svc_rdma_read_info *info, static int svc_rdma_build_read_chunk(struct svcxprt_rdma *rdma,
struct svc_rdma_read_info *info,
const struct svc_rdma_chunk *chunk) const struct svc_rdma_chunk *chunk)
{ {
const struct svc_rdma_segment *segment; const struct svc_rdma_segment *segment;
...@@ -798,7 +802,7 @@ static int svc_rdma_build_read_chunk(struct svc_rdma_read_info *info, ...@@ -798,7 +802,7 @@ static int svc_rdma_build_read_chunk(struct svc_rdma_read_info *info,
ret = -EINVAL; ret = -EINVAL;
pcl_for_each_segment(segment, chunk) { pcl_for_each_segment(segment, chunk) {
ret = svc_rdma_build_read_segment(info, segment); ret = svc_rdma_build_read_segment(rdma, info, segment);
if (ret < 0) if (ret < 0)
break; break;
info->ri_totalbytes += segment->rs_length; info->ri_totalbytes += segment->rs_length;
...@@ -858,6 +862,7 @@ static int svc_rdma_copy_inline_range(struct svc_rdma_read_info *info, ...@@ -858,6 +862,7 @@ static int svc_rdma_copy_inline_range(struct svc_rdma_read_info *info,
/** /**
* svc_rdma_read_multiple_chunks - Construct RDMA Reads to pull data item Read chunks * svc_rdma_read_multiple_chunks - Construct RDMA Reads to pull data item Read chunks
* @rdma: controlling transport
* @info: context for RDMA Reads * @info: context for RDMA Reads
* *
* The chunk data lands in rqstp->rq_arg as a series of contiguous pages, * The chunk data lands in rqstp->rq_arg as a series of contiguous pages,
...@@ -870,7 +875,8 @@ static int svc_rdma_copy_inline_range(struct svc_rdma_read_info *info, ...@@ -870,7 +875,8 @@ static int svc_rdma_copy_inline_range(struct svc_rdma_read_info *info,
* %-ENOTCONN: posting failed (connection is lost), * %-ENOTCONN: posting failed (connection is lost),
* %-EIO: rdma_rw initialization failed (DMA mapping, etc). * %-EIO: rdma_rw initialization failed (DMA mapping, etc).
*/ */
static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *info) static noinline int svc_rdma_read_multiple_chunks(struct svcxprt_rdma *rdma,
struct svc_rdma_read_info *info)
{ {
struct svc_rdma_recv_ctxt *head = info->ri_readctxt; struct svc_rdma_recv_ctxt *head = info->ri_readctxt;
const struct svc_rdma_pcl *pcl = &head->rc_read_pcl; const struct svc_rdma_pcl *pcl = &head->rc_read_pcl;
...@@ -887,7 +893,7 @@ static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *inf ...@@ -887,7 +893,7 @@ static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *inf
return ret; return ret;
pcl_for_each_chunk(chunk, pcl) { pcl_for_each_chunk(chunk, pcl) {
ret = svc_rdma_build_read_chunk(info, chunk); ret = svc_rdma_build_read_chunk(rdma, info, chunk);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -920,6 +926,7 @@ static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *inf ...@@ -920,6 +926,7 @@ static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *inf
/** /**
* svc_rdma_read_data_item - Construct RDMA Reads to pull data item Read chunks * svc_rdma_read_data_item - Construct RDMA Reads to pull data item Read chunks
* @rdma: controlling transport
* @info: context for RDMA Reads * @info: context for RDMA Reads
* *
* The chunk data lands in the page list of rqstp->rq_arg.pages. * The chunk data lands in the page list of rqstp->rq_arg.pages.
...@@ -935,7 +942,8 @@ static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *inf ...@@ -935,7 +942,8 @@ static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *inf
* %-ENOTCONN: posting failed (connection is lost), * %-ENOTCONN: posting failed (connection is lost),
* %-EIO: rdma_rw initialization failed (DMA mapping, etc). * %-EIO: rdma_rw initialization failed (DMA mapping, etc).
*/ */
static int svc_rdma_read_data_item(struct svc_rdma_read_info *info) static int svc_rdma_read_data_item(struct svcxprt_rdma *rdma,
struct svc_rdma_read_info *info)
{ {
struct svc_rdma_recv_ctxt *head = info->ri_readctxt; struct svc_rdma_recv_ctxt *head = info->ri_readctxt;
struct xdr_buf *buf = &info->ri_rqst->rq_arg; struct xdr_buf *buf = &info->ri_rqst->rq_arg;
...@@ -944,7 +952,7 @@ static int svc_rdma_read_data_item(struct svc_rdma_read_info *info) ...@@ -944,7 +952,7 @@ static int svc_rdma_read_data_item(struct svc_rdma_read_info *info)
int ret; int ret;
chunk = pcl_first_chunk(&head->rc_read_pcl); chunk = pcl_first_chunk(&head->rc_read_pcl);
ret = svc_rdma_build_read_chunk(info, chunk); ret = svc_rdma_build_read_chunk(rdma, info, chunk);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -978,6 +986,7 @@ static int svc_rdma_read_data_item(struct svc_rdma_read_info *info) ...@@ -978,6 +986,7 @@ static int svc_rdma_read_data_item(struct svc_rdma_read_info *info)
/** /**
* svc_rdma_read_chunk_range - Build RDMA Read WQEs for portion of a chunk * svc_rdma_read_chunk_range - Build RDMA Read WQEs for portion of a chunk
* @rdma: controlling transport
* @info: context for RDMA Reads * @info: context for RDMA Reads
* @chunk: parsed Call chunk to pull * @chunk: parsed Call chunk to pull
* @offset: offset of region to pull * @offset: offset of region to pull
...@@ -990,7 +999,8 @@ static int svc_rdma_read_data_item(struct svc_rdma_read_info *info) ...@@ -990,7 +999,8 @@ static int svc_rdma_read_data_item(struct svc_rdma_read_info *info)
* %-ENOTCONN: posting failed (connection is lost), * %-ENOTCONN: posting failed (connection is lost),
* %-EIO: rdma_rw initialization failed (DMA mapping, etc). * %-EIO: rdma_rw initialization failed (DMA mapping, etc).
*/ */
static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info, static int svc_rdma_read_chunk_range(struct svcxprt_rdma *rdma,
struct svc_rdma_read_info *info,
const struct svc_rdma_chunk *chunk, const struct svc_rdma_chunk *chunk,
unsigned int offset, unsigned int length) unsigned int offset, unsigned int length)
{ {
...@@ -1010,7 +1020,7 @@ static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info, ...@@ -1010,7 +1020,7 @@ static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info,
dummy.rs_length = min_t(u32, length, segment->rs_length) - offset; dummy.rs_length = min_t(u32, length, segment->rs_length) - offset;
dummy.rs_offset = segment->rs_offset + offset; dummy.rs_offset = segment->rs_offset + offset;
ret = svc_rdma_build_read_segment(info, &dummy); ret = svc_rdma_build_read_segment(rdma, info, &dummy);
if (ret < 0) if (ret < 0)
break; break;
...@@ -1023,6 +1033,7 @@ static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info, ...@@ -1023,6 +1033,7 @@ static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info,
/** /**
* svc_rdma_read_call_chunk - Build RDMA Read WQEs to pull a Long Message * svc_rdma_read_call_chunk - Build RDMA Read WQEs to pull a Long Message
* @rdma: controlling transport
* @info: context for RDMA Reads * @info: context for RDMA Reads
* *
* Return values: * Return values:
...@@ -1032,7 +1043,8 @@ static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info, ...@@ -1032,7 +1043,8 @@ static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info,
* %-ENOTCONN: posting failed (connection is lost), * %-ENOTCONN: posting failed (connection is lost),
* %-EIO: rdma_rw initialization failed (DMA mapping, etc). * %-EIO: rdma_rw initialization failed (DMA mapping, etc).
*/ */
static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) static int svc_rdma_read_call_chunk(struct svcxprt_rdma *rdma,
struct svc_rdma_read_info *info)
{ {
struct svc_rdma_recv_ctxt *head = info->ri_readctxt; struct svc_rdma_recv_ctxt *head = info->ri_readctxt;
const struct svc_rdma_chunk *call_chunk = const struct svc_rdma_chunk *call_chunk =
...@@ -1043,17 +1055,17 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) ...@@ -1043,17 +1055,17 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info)
int ret; int ret;
if (pcl_is_empty(pcl)) if (pcl_is_empty(pcl))
return svc_rdma_build_read_chunk(info, call_chunk); return svc_rdma_build_read_chunk(rdma, info, call_chunk);
start = 0; start = 0;
chunk = pcl_first_chunk(pcl); chunk = pcl_first_chunk(pcl);
length = chunk->ch_position; length = chunk->ch_position;
ret = svc_rdma_read_chunk_range(info, call_chunk, start, length); ret = svc_rdma_read_chunk_range(rdma, info, call_chunk, start, length);
if (ret < 0) if (ret < 0)
return ret; return ret;
pcl_for_each_chunk(chunk, pcl) { pcl_for_each_chunk(chunk, pcl) {
ret = svc_rdma_build_read_chunk(info, chunk); ret = svc_rdma_build_read_chunk(rdma, info, chunk);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1063,7 +1075,7 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) ...@@ -1063,7 +1075,7 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info)
start += length; start += length;
length = next->ch_position - info->ri_totalbytes; length = next->ch_position - info->ri_totalbytes;
ret = svc_rdma_read_chunk_range(info, call_chunk, ret = svc_rdma_read_chunk_range(rdma, info, call_chunk,
start, length); start, length);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1071,11 +1083,12 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) ...@@ -1071,11 +1083,12 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info)
start += length; start += length;
length = call_chunk->ch_length - start; length = call_chunk->ch_length - start;
return svc_rdma_read_chunk_range(info, call_chunk, start, length); return svc_rdma_read_chunk_range(rdma, info, call_chunk, start, length);
} }
/** /**
* svc_rdma_read_special - Build RDMA Read WQEs to pull a Long Message * svc_rdma_read_special - Build RDMA Read WQEs to pull a Long Message
* @rdma: controlling transport
* @info: context for RDMA Reads * @info: context for RDMA Reads
* *
* The start of the data lands in the first page just after the * The start of the data lands in the first page just after the
...@@ -1092,12 +1105,13 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) ...@@ -1092,12 +1105,13 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info)
* %-ENOTCONN: posting failed (connection is lost), * %-ENOTCONN: posting failed (connection is lost),
* %-EIO: rdma_rw initialization failed (DMA mapping, etc). * %-EIO: rdma_rw initialization failed (DMA mapping, etc).
*/ */
static noinline int svc_rdma_read_special(struct svc_rdma_read_info *info) static noinline int svc_rdma_read_special(struct svcxprt_rdma *rdma,
struct svc_rdma_read_info *info)
{ {
struct xdr_buf *buf = &info->ri_rqst->rq_arg; struct xdr_buf *buf = &info->ri_rqst->rq_arg;
int ret; int ret;
ret = svc_rdma_read_call_chunk(info); ret = svc_rdma_read_call_chunk(rdma, info);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -1156,11 +1170,11 @@ int svc_rdma_process_read_list(struct svcxprt_rdma *rdma, ...@@ -1156,11 +1170,11 @@ int svc_rdma_process_read_list(struct svcxprt_rdma *rdma,
if (pcl_is_empty(&head->rc_call_pcl)) { if (pcl_is_empty(&head->rc_call_pcl)) {
if (head->rc_read_pcl.cl_count == 1) if (head->rc_read_pcl.cl_count == 1)
ret = svc_rdma_read_data_item(info); ret = svc_rdma_read_data_item(rdma, info);
else else
ret = svc_rdma_read_multiple_chunks(info); ret = svc_rdma_read_multiple_chunks(rdma, info);
} else } else
ret = svc_rdma_read_special(info); ret = svc_rdma_read_special(rdma, info);
if (ret < 0) if (ret < 0)
goto out_err; goto out_err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment