/** * pcl_alloc_call - Construct a parsed chunk list for the Call body * @rctxt: Ingress receive context * @p: Start of an un-decoded Read list * * Assumptions: * - The incoming Read list has already been sanity checked. * - cl_count is already set to the number of segments in * the un-decoded list. * - The list might not be in order by position. * * Return values: * %true: Parsed chunk list was successfully constructed, and * cl_count is updated to be the number of chunks (ie. * unique positions) in the Read list. * %false: Memory allocation failed.
*/ bool pcl_alloc_call(struct svc_rdma_recv_ctxt *rctxt, __be32 *p)
{ struct svc_rdma_pcl *pcl = &rctxt->rc_call_pcl; unsignedint i, segcount = pcl->cl_count;
pcl->cl_count = 0; for (i = 0; i < segcount; i++) { struct svc_rdma_chunk *chunk;
u32 position, handle, length;
u64 offset;
p++; /* skip the list discriminator */
p = xdr_decode_read_segment(p, &position, &handle,
&length, &offset); if (position != 0) continue;
/** * pcl_alloc_read - Construct a parsed chunk list for normal Read chunks * @rctxt: Ingress receive context * @p: Start of an un-decoded Read list * * Assumptions: * - The incoming Read list has already been sanity checked. * - cl_count is already set to the number of segments in * the un-decoded list. * - The list might not be in order by position. * * Return values: * %true: Parsed chunk list was successfully constructed, and * cl_count is updated to be the number of chunks (ie. * unique position values) in the Read list. * %false: Memory allocation failed. * * TODO: * - Check for chunk range overlaps
*/ bool pcl_alloc_read(struct svc_rdma_recv_ctxt *rctxt, __be32 *p)
{ struct svc_rdma_pcl *pcl = &rctxt->rc_read_pcl; unsignedint i, segcount = pcl->cl_count;
pcl->cl_count = 0; for (i = 0; i < segcount; i++) { struct svc_rdma_chunk *chunk;
u32 position, handle, length;
u64 offset;
p++; /* skip the list discriminator */
p = xdr_decode_read_segment(p, &position, &handle,
&length, &offset); if (position == 0) continue;
chunk = pcl_lookup_position(pcl, position); if (!chunk) {
chunk = pcl_alloc_chunk(segcount, position); if (!chunk) returnfalse;
pcl_insert_position(pcl, chunk);
}
/** * pcl_alloc_write - Construct a parsed chunk list from a Write list * @rctxt: Ingress receive context * @pcl: Parsed chunk list to populate * @p: Start of an un-decoded Write list * * Assumptions: * - The incoming Write list has already been sanity checked, and * - cl_count is set to the number of chunks in the un-decoded list. * * Return values: * %true: Parsed chunk list was successfully constructed. * %false: Memory allocation failed.
*/ bool pcl_alloc_write(struct svc_rdma_recv_ctxt *rctxt, struct svc_rdma_pcl *pcl, __be32 *p)
{ struct svc_rdma_segment *segment; struct svc_rdma_chunk *chunk; unsignedint i, j;
u32 segcount;
for (i = 0; i < pcl->cl_count; i++) {
p++; /* skip the list discriminator */
segcount = be32_to_cpup(p++);
chunk = pcl_alloc_chunk(segcount, 0); if (!chunk) returnfalse;
list_add_tail(&chunk->ch_list, &pcl->cl_chunks);
if (!length) return 0; if (xdr_buf_subsegment(xdr, &subbuf, offset, length)) return -EMSGSIZE; return actor(&subbuf, data);
}
/** * pcl_process_nonpayloads - Process non-payload regions inside @xdr * @pcl: Chunk list to process * @xdr: xdr_buf to process * @actor: Function to invoke on each non-payload region * @data: Arguments for @actor * * This mechanism must ignore not only result payloads that were already * sent via RDMA Write, but also XDR padding for those payloads that * the upper layer has added. * * Assumptions: * The xdr->len and ch_position fields are aligned to 4-byte multiples. * * Returns: * On success, zero, * %-EMSGSIZE on XDR buffer overflow, or * The return value of @actor
*/ int pcl_process_nonpayloads(conststruct svc_rdma_pcl *pcl, conststruct xdr_buf *xdr, int (*actor)(conststruct xdr_buf *, void *), void *data)
{ struct svc_rdma_chunk *chunk, *next; unsignedint start; int ret;
chunk = pcl_first_chunk(pcl);
/* No result payloads were generated */ if (!chunk || !chunk->ch_payload_length) return actor(xdr, data);
/* Process the region before the first result payload */
ret = pcl_process_region(xdr, 0, chunk->ch_position, actor, data); if (ret < 0) return ret;
/* Process the regions between each middle result payload */ while ((next = pcl_next_chunk(pcl, chunk))) { if (!next->ch_payload_length) break;
start = pcl_chunk_end_offset(chunk);
ret = pcl_process_region(xdr, start, next->ch_position - start,
actor, data); if (ret < 0) return ret;
chunk = next;
}
/* Process the region after the last result payload */
start = pcl_chunk_end_offset(chunk);
ret = pcl_process_region(xdr, start, xdr->len - start, actor, data); if (ret < 0) return ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.