1 #ifndef _CRIS_ARCH_CHECKSUM_H
2 #define _CRIS_ARCH_CHECKSUM_H
4 /* Checksum some values used in TCP/UDP headers.
6 * The gain by doing this in asm is that C will not generate carry-additions
7 * for the 32-bit components of the checksum, so otherwise we would have had
8 * to split all of those into 16-bit components, then add.
11 static inline unsigned int
12 csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
13 unsigned short proto, unsigned int sum)
16 __asm__ ("add.d %2, %0\n\t"
24 : "0" (sum), "r" (daddr), "r" (saddr), "r" ((ntohs(len) << 16) + (proto << 8)));