Merge tag 'asoc-fix-v4.14-rc6' into asoc-linus
[sfrench/cifs-2.6.git] / arch / cris / include / arch-v10 / arch / checksum.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _CRIS_ARCH_CHECKSUM_H
3 #define _CRIS_ARCH_CHECKSUM_H
4
5 /* Checksum some values used in TCP/UDP headers.
6  *
7  * The gain by doing this in asm is that C will not generate carry-additions
8  * for the 32-bit components of the checksum, so otherwise we would have had
9  * to split all of those into 16-bit components, then add.
10  */
11
12 static inline __wsum
13 csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
14                    __u8 proto, __wsum sum)
15 {
16         __wsum res;
17         __asm__ ("add.d %2, %0\n\t"
18                  "ax\n\t"
19                  "add.d %3, %0\n\t"
20                  "ax\n\t"
21                  "add.d %4, %0\n\t"
22                  "ax\n\t"
23                  "addq 0, %0\n"
24         : "=r" (res)
25         : "0" (sum), "r" (daddr), "r" (saddr), "r" ((len + proto) << 8));
26
27         return res;
28 }       
29
30 #endif