From 8e4bff4cab0ddac6060645b0715210484d02ff40 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Wed, 30 Aug 2017 08:25:59 +0000 Subject: Initial file dump from open source release --- arch/blackfin/include/asm/checksum.h | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 arch/blackfin/include/asm/checksum.h (limited to 'arch/blackfin/include/asm/checksum.h') diff --git a/arch/blackfin/include/asm/checksum.h b/arch/blackfin/include/asm/checksum.h new file mode 100644 index 00000000..623cc7fb --- /dev/null +++ b/arch/blackfin/include/asm/checksum.h @@ -0,0 +1,44 @@ +/* + * Copyright 2004-2009 Analog Devices Inc. + * akbar.hussain@lineo.com + * + * Licensed under the GPL-2 or later. + */ + +#ifndef _BFIN_CHECKSUM_H +#define _BFIN_CHECKSUM_H + +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 16-bit checksum, already complemented + */ + +static inline __wsum +__csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, + unsigned short proto, __wsum sum) +{ + unsigned int carry; + + __asm__ ("%0 = %0 + %2;\n\t" + "CC = AC0;\n\t" + "%1 = CC;\n\t" + "%0 = %0 + %1;\n\t" + "%0 = %0 + %3;\n\t" + "CC = AC0;\n\t" + "%1 = CC;\n\t" + "%0 = %0 + %1;\n\t" + "%0 = %0 + %4;\n\t" + "CC = AC0;\n\t" + "%1 = CC;\n\t" + "%0 = %0 + %1;\n\t" + : "=d" (sum), "=&d" (carry) + : "d" (daddr), "d" (saddr), "d" ((len + proto) << 8), "0"(sum) + : "CC"); + + return (sum); +} +#define csum_tcpudp_nofold __csum_tcpudp_nofold + +#include + +#endif -- cgit v1.3.1