Lines Matching +full:data +full:- +full:shift
1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright (C) 2019-2020 Arm Ltd.
5 #include <linux/kasan-checks.h>
10 /* Looks dumb, but generates nice-ish code */
11 static u64 accumulate(u64 sum, u64 data) in accumulate() argument
13 __uint128_t tmp = (__uint128_t)sum + data; in accumulate()
18 * We over-read the buffer and this makes KASAN unhappy. Instead, disable
23 unsigned int offset, shift, sum; in do_csum() local
25 u64 data, sum64 = 0; in do_csum() local
34 * should absolutely not be pointing to anything read-sensitive. We do, in do_csum()
37 * compensate with an explicit check up-front. in do_csum()
40 ptr = (u64 *)(buff - offset); in do_csum()
41 len = len + offset - 8; in do_csum()
48 shift = offset * 8; in do_csum()
49 data = *ptr++; in do_csum()
51 data = (data >> shift) << shift; in do_csum()
53 data = (data << shift) >> shift; in do_csum()
70 len -= 64; in do_csum()
91 sum64 = accumulate(sum64, data); in do_csum()
94 len -= 16; in do_csum()
98 data = tmp >> 64; in do_csum()
101 data = tmp; in do_csum()
106 sum64 = accumulate(sum64, data); in do_csum()
107 data = *ptr; in do_csum()
108 len -= 8; in do_csum()
111 * Tail: zero any over-read bytes similarly to the head, again in do_csum()
114 shift = len * -8; in do_csum()
116 data = (data << shift) >> shift; in do_csum()
118 data = (data >> shift) << shift; in do_csum()
120 sum64 = accumulate(sum64, data); in do_csum()
139 src = *(const __uint128_t *)saddr->s6_addr; in csum_ipv6_magic()
140 dst = *(const __uint128_t *)daddr->s6_addr; in csum_ipv6_magic()