Linux 3.8-rc7
[cris-mirror.git] / arch / unicore32 / include / asm / checksum.h
blobf55c3f937c3ed78132d43befd00efa86c915e1d7
1 /*
2 * linux/arch/unicore32/include/asm/checksum.h
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * IP checksum routines
14 #ifndef __UNICORE_CHECKSUM_H__
15 #define __UNICORE_CHECKSUM_H__
18 * computes the checksum of the TCP/UDP pseudo-header
19 * returns a 16-bit checksum, already complemented
22 static inline __wsum
23 csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
24 unsigned short proto, __wsum sum)
26 __asm__(
27 "add.a %0, %1, %2\n"
28 "addc.a %0, %0, %3\n"
29 "addc.a %0, %0, %4 << #8\n"
30 "addc.a %0, %0, %5\n"
31 "addc %0, %0, #0\n"
32 : "=&r"(sum)
33 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto))
34 : "cc");
35 return sum;
37 #define csum_tcpudp_nofold csum_tcpudp_nofold
39 #include <asm-generic/checksum.h>
41 #endif