Lines Matching +full:len +full:- +full:or +full:- +full:define
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #define _ASM_POWERPC_CHECKSUM_H
12 * Computes the checksum of a memory block at src, length len,
13 * and adds in "sum" (32-bit), while copying the block to dst.
14 * If an access exception occurs on src or dst, it stores -EFAULT
15 * to *src_err or *dst_err respectively (if that pointer is not
21 extern __wsum csum_partial_copy_generic(const void *src, void *dst, int len);
23 #define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
25 int len);
26 #define HAVE_CSUM_COPY_USER
28 int len);
30 #define _HAVE_ARCH_CSUM_AND_COPY
31 #define csum_partial_copy_nocheck(src, dst, len) \ argument
32 csum_partial_copy_generic((src), (dst), (len))
36 * turns a 32-bit partial checksum (e.g. from csum_partial) into a
37 * 1's complement 16-bit checksum.
44 * swap the two 16-bit halves of sum in csum_fold()
45 * if there is a carry from adding the two 16-bit halves, in csum_fold()
57 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, in csum_tcpudp_nofold() argument
66 s += proto + len; in csum_tcpudp_nofold()
68 s += (proto + len) << 8; in csum_tcpudp_nofold()
79 : "r" (daddr), "r"(saddr), "r"(proto + len), "0"(sum)); in csum_tcpudp_nofold()
85 * computes the checksum of the TCP/UDP pseudo-header
86 * returns a 16-bit checksum, already complemented
88 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, in csum_tcpudp_magic() argument
91 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); in csum_tcpudp_magic()
94 #define HAVE_ARCH_CSUM_ADD
115 #define HAVE_ARCH_CSUM_SHIFT
125 * of 32-bit words and is always >= 5.
134 for (i = 0; i < ihl - 1; i++, ptr++) in ip_fast_csum_nofold()
147 : "r" (ihl - 2), "r" (*(const u32 *)iph), "r" (*ptr) in ip_fast_csum_nofold()
160 * computes the checksum of a memory block at buff, length len,
161 * and adds in "sum" (32-bit)
163 * returns a 32-bit number suitable for feeding into itself
164 * or csum_tcpudp_magic
169 * it's best to have buff aligned on a 32-bit boundary
171 __wsum __csum_partial(const void *buff, int len, __wsum sum);
173 static __always_inline __wsum csum_partial(const void *buff, int len, __wsum sum) in csum_partial() argument
175 if (__builtin_constant_p(len) && len <= 16 && (len & 1) == 0) { in csum_partial()
176 if (len == 2) in csum_partial()
178 if (len >= 4) in csum_partial()
180 if (len == 6) in csum_partial()
183 if (len >= 8) in csum_partial()
186 if (len == 10) in csum_partial()
189 if (len >= 12) in csum_partial()
192 if (len == 14) in csum_partial()
195 if (len >= 16) in csum_partial()
198 } else if (__builtin_constant_p(len) && (len & 3) == 0) { in csum_partial()
199 sum = csum_add(sum, ip_fast_csum_nofold(buff, len >> 2)); in csum_partial()
201 sum = __csum_partial(buff, len, sum); in csum_partial()
207 * this routine is used for miscellaneous IP-like checksums, mainly
210 static inline __sum16 ip_compute_csum(const void *buff, int len) in ip_compute_csum() argument
212 return csum_fold(csum_partial(buff, len, 0)); in ip_compute_csum()
215 #define _HAVE_ARCH_IPV6_CSUM
218 __u32 len, __u8 proto, __wsum sum);