Lines Matching +full:segment +full:- +full:0

1 // SPDX-License-Identifier: GPL-2.0
13 * pcl_free - Release all memory associated with a parsed chunk list
19 while (!list_empty(&pcl->cl_chunks)) { in pcl_free()
23 list_del(&chunk->ch_list); in pcl_free()
36 chunk->ch_position = position; in pcl_alloc_chunk()
37 chunk->ch_length = 0; in pcl_alloc_chunk()
38 chunk->ch_payload_length = 0; in pcl_alloc_chunk()
39 chunk->ch_segcount = 0; in pcl_alloc_chunk()
49 if (pos->ch_position == position) in pcl_lookup_position()
61 if (pos->ch_position > chunk->ch_position) in pcl_insert_position()
64 __list_add(&chunk->ch_list, pos->ch_list.prev, &pos->ch_list); in pcl_insert_position()
65 pcl->cl_count++; in pcl_insert_position()
72 struct svc_rdma_segment *segment; in pcl_set_read_segment() local
74 segment = &chunk->ch_segments[chunk->ch_segcount]; in pcl_set_read_segment()
75 segment->rs_handle = handle; in pcl_set_read_segment()
76 segment->rs_length = length; in pcl_set_read_segment()
77 segment->rs_offset = offset; in pcl_set_read_segment()
79 trace_svcrdma_decode_rseg(&rctxt->rc_cid, chunk, segment); in pcl_set_read_segment()
81 chunk->ch_length += length; in pcl_set_read_segment()
82 chunk->ch_segcount++; in pcl_set_read_segment()
86 * pcl_alloc_call - Construct a parsed chunk list for the Call body
88 * @p: Start of an un-decoded Read list
91 * - The incoming Read list has already been sanity checked.
92 * - cl_count is already set to the number of segments in
93 * the un-decoded list.
94 * - The list might not be in order by position.
104 struct svc_rdma_pcl *pcl = &rctxt->rc_call_pcl; in pcl_alloc_call()
105 unsigned int i, segcount = pcl->cl_count; in pcl_alloc_call()
107 pcl->cl_count = 0; in pcl_alloc_call()
108 for (i = 0; i < segcount; i++) { in pcl_alloc_call()
116 if (position != 0) in pcl_alloc_call()
125 chunk = list_first_entry(&pcl->cl_chunks, in pcl_alloc_call()
137 * pcl_alloc_read - Construct a parsed chunk list for normal Read chunks
139 * @p: Start of an un-decoded Read list
142 * - The incoming Read list has already been sanity checked.
143 * - cl_count is already set to the number of segments in
144 * the un-decoded list.
145 * - The list might not be in order by position.
154 * - Check for chunk range overlaps
158 struct svc_rdma_pcl *pcl = &rctxt->rc_read_pcl; in pcl_alloc_read()
159 unsigned int i, segcount = pcl->cl_count; in pcl_alloc_read()
161 pcl->cl_count = 0; in pcl_alloc_read()
162 for (i = 0; i < segcount; i++) { in pcl_alloc_read()
170 if (position == 0) in pcl_alloc_read()
188 * pcl_alloc_write - Construct a parsed chunk list from a Write list
191 * @p: Start of an un-decoded Write list
194 * - The incoming Write list has already been sanity checked, and
195 * - cl_count is set to the number of chunks in the un-decoded list.
204 struct svc_rdma_segment *segment; in pcl_alloc_write() local
209 for (i = 0; i < pcl->cl_count; i++) { in pcl_alloc_write()
213 chunk = pcl_alloc_chunk(segcount, 0); in pcl_alloc_write()
216 list_add_tail(&chunk->ch_list, &pcl->cl_chunks); in pcl_alloc_write()
218 for (j = 0; j < segcount; j++) { in pcl_alloc_write()
219 segment = &chunk->ch_segments[j]; in pcl_alloc_write()
220 p = xdr_decode_rdma_segment(p, &segment->rs_handle, in pcl_alloc_write()
221 &segment->rs_length, in pcl_alloc_write()
222 &segment->rs_offset); in pcl_alloc_write()
223 trace_svcrdma_decode_wseg(&rctxt->rc_cid, chunk, j); in pcl_alloc_write()
225 chunk->ch_length += segment->rs_length; in pcl_alloc_write()
226 chunk->ch_segcount++; in pcl_alloc_write()
240 return 0; in pcl_process_region()
242 return -EMSGSIZE; in pcl_process_region()
247 * pcl_process_nonpayloads - Process non-payload regions inside @xdr
250 * @actor: Function to invoke on each non-payload region
258 * The xdr->len and ch_position fields are aligned to 4-byte multiples.
262 * %-EMSGSIZE on XDR buffer overflow, or
277 if (!chunk || !chunk->ch_payload_length) in pcl_process_nonpayloads()
281 ret = pcl_process_region(xdr, 0, chunk->ch_position, actor, data); in pcl_process_nonpayloads()
282 if (ret < 0) in pcl_process_nonpayloads()
287 if (!next->ch_payload_length) in pcl_process_nonpayloads()
291 ret = pcl_process_region(xdr, start, next->ch_position - start, in pcl_process_nonpayloads()
293 if (ret < 0) in pcl_process_nonpayloads()
301 ret = pcl_process_region(xdr, start, xdr->len - start, actor, data); in pcl_process_nonpayloads()
302 if (ret < 0) in pcl_process_nonpayloads()
305 return 0; in pcl_process_nonpayloads()