summaryrefslogtreecommitdiffstats
path: root/include/net/checksum.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-01-10 05:27:25 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-01-10 05:27:25 +0000
commitc9c06167e7933d93a6e396174c68abf242294abb (patch)
treed9a8bb30663e9a3405a1ef37ffb62bc14b9f019f /include/net/checksum.h
parentf79e8cc3c34e4192a3e5ef4cc9c6542fdef703c0 (diff)
Merge with Linux 2.4.0-test12.
Diffstat (limited to 'include/net/checksum.h')
-rw-r--r--include/net/checksum.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 76cf27e77..6a16809c9 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -124,10 +124,31 @@ static __inline__ unsigned int csum_and_copy_to_user
}
#endif
-static inline unsigned int csum_chain(unsigned int csum, unsigned int addend)
+static inline unsigned int csum_add(unsigned int csum, unsigned int addend)
{
csum += addend;
return csum + (csum < addend);
}
+static inline unsigned int csum_sub(unsigned int csum, unsigned int addend)
+{
+ return csum_add(csum, ~addend);
+}
+
+static inline unsigned int
+csum_block_add(unsigned int csum, unsigned int csum2, int offset)
+{
+ if (offset&1)
+ csum2 = ((csum2&0xFF00FF)<<8)+((csum2>>8)&0xFF00FF);
+ return csum_add(csum, csum2);
+}
+
+static inline unsigned int
+csum_block_sub(unsigned int csum, unsigned int csum2, int offset)
+{
+ if (offset&1)
+ csum2 = ((csum2&0xFF00FF)<<8)+((csum2>>8)&0xFF00FF);
+ return csum_sub(csum, csum2);
+}
+
#endif