]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
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 | ||
3532010b | 12 | static inline __wsum |
01cfbad7 AD |
13 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, |
14 | __u8 proto, __wsum sum) | |
1da177e4 | 15 | { |
3532010b | 16 | __wsum res; |
1da177e4 LT |
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) | |
3532010b | 25 | : "0" (sum), "r" (daddr), "r" (saddr), "r" ((len + proto) << 8)); |
1da177e4 LT |
26 | |
27 | return res; | |
28 | } | |
29 | ||
30 | #endif |