Path: blob/master/arch/blackfin/include/asm/checksum.h
15126 views
/*1* Copyright 2004-2009 Analog Devices Inc.2* [email protected]3*4* Licensed under the GPL-2 or later.5*/67#ifndef _BFIN_CHECKSUM_H8#define _BFIN_CHECKSUM_H910/*11* computes the checksum of the TCP/UDP pseudo-header12* returns a 16-bit checksum, already complemented13*/1415static inline __wsum16__csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,17unsigned short proto, __wsum sum)18{19unsigned int carry;2021__asm__ ("%0 = %0 + %2;\n\t"22"CC = AC0;\n\t"23"%1 = CC;\n\t"24"%0 = %0 + %1;\n\t"25"%0 = %0 + %3;\n\t"26"CC = AC0;\n\t"27"%1 = CC;\n\t"28"%0 = %0 + %1;\n\t"29"%0 = %0 + %4;\n\t"30"CC = AC0;\n\t"31"%1 = CC;\n\t"32"%0 = %0 + %1;\n\t"33: "=d" (sum), "=&d" (carry)34: "d" (daddr), "d" (saddr), "d" ((len + proto) << 8), "0"(sum)35: "CC");3637return (sum);38}39#define csum_tcpudp_nofold __csum_tcpudp_nofold4041#include <asm-generic/checksum.h>4243#endif444546