Lines Matching +full:len +full:- +full:or +full:- +full:limit

1 // SPDX-License-Identifier: GPL-2.0-or-later
9 * 2004 Jean-Luc Cooke <jlcooke@certainkey.com>
20 struct scatterlist *sg = walk->sg; in scatterwalk_skip()
22 nbytes += walk->offset - sg->offset; in scatterwalk_skip()
24 while (nbytes > sg->length) { in scatterwalk_skip()
25 nbytes -= sg->length; in scatterwalk_skip()
28 walk->sg = sg; in scatterwalk_skip()
29 walk->offset = sg->offset + nbytes; in scatterwalk_skip()
40 memcpy(buf, walk->addr, to_copy); in memcpy_from_scatterwalk()
43 nbytes -= to_copy; in memcpy_from_scatterwalk()
55 memcpy(walk->addr, buf, to_copy); in memcpy_to_scatterwalk()
58 nbytes -= to_copy; in memcpy_to_scatterwalk()
90 * memcpy_sglist() - Copy data from one scatterlist to another
96 * function is a no-op. No other overlaps are supported.
105 if (unlikely(nbytes == 0)) /* in case src and/or dst is NULL */ in memcpy_sglist()
108 src_offset = src->offset; in memcpy_sglist()
109 dst_offset = dst->offset; in memcpy_sglist()
112 unsigned int len = min3(src->offset + src->length - src_offset, in memcpy_sglist() local
113 dst->offset + dst->length - dst_offset, in memcpy_sglist()
124 const unsigned int limit = PAGE_SIZE; in memcpy_sglist() local
126 /* Further limit len to not cross a page boundary. */ in memcpy_sglist()
127 len = min3(len, limit - src_oip, limit - dst_oip); in memcpy_sglist()
136 src_page, src_oip, len); in memcpy_sglist()
142 len); in memcpy_sglist()
155 memcpy(dst_virt, src_virt, len); in memcpy_sglist()
158 dst_page, dst_offset, len); in memcpy_sglist()
161 nbytes -= len; in memcpy_sglist()
169 src_offset += len; in memcpy_sglist()
170 if (src_offset >= src->offset + src->length) { in memcpy_sglist()
172 src_offset = src->offset; in memcpy_sglist()
174 dst_offset += len; in memcpy_sglist()
175 if (dst_offset >= dst->offset + dst->length) { in memcpy_sglist()
177 dst_offset = dst->offset; in memcpy_sglist()
185 unsigned int len) in scatterwalk_ffwd() argument
188 if (!len) in scatterwalk_ffwd()
191 if (src->length > len) in scatterwalk_ffwd()
194 len -= src->length; in scatterwalk_ffwd()
199 sg_set_page(dst, sg_page(src), src->length - len, src->offset + len); in scatterwalk_ffwd()