Path: blob/master/arch/microblaze/include/asm/checksum.h
15126 views
/*1* Copyright (C) 2008 Michal Simek <[email protected]>2* Copyright (C) 2006 Atmark Techno, Inc.3*4* This file is subject to the terms and conditions of the GNU General Public5* License. See the file "COPYING" in the main directory of this archive6* for more details.7*/89#ifndef _ASM_MICROBLAZE_CHECKSUM_H10#define _ASM_MICROBLAZE_CHECKSUM_H1112/*13* computes the checksum of the TCP/UDP pseudo-header14* returns a 16-bit checksum, already complemented15*/16#define csum_tcpudp_nofold csum_tcpudp_nofold17static inline __wsum18csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,19unsigned short proto, __wsum sum)20{21__asm__("add %0, %0, %1\n\t"22"addc %0, %0, %2\n\t"23"addc %0, %0, %3\n\t"24"addc %0, %0, r0\n\t"25: "+&d" (sum)26: "d" (saddr), "d" (daddr),27#ifdef __MICROBLAZEEL__28"d" ((len + proto) << 8)29#else30"d" (len + proto)31#endif32);33return sum;34}3536#include <asm-generic/checksum.h>3738#endif /* _ASM_MICROBLAZE_CHECKSUM_H */394041