2009-03-27 21:25:22 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
|
|
|
|
* Copyright (C) 2006 Atmark Techno, Inc.
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_MICROBLAZE_CHECKSUM_H
|
|
|
|
#define _ASM_MICROBLAZE_CHECKSUM_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* computes the checksum of the TCP/UDP pseudo-header
|
|
|
|
* returns a 16-bit checksum, already complemented
|
|
|
|
*/
|
2009-06-19 01:55:32 +08:00
|
|
|
#define csum_tcpudp_nofold csum_tcpudp_nofold
|
2009-03-27 21:25:22 +08:00
|
|
|
static inline __wsum
|
2016-03-12 06:05:34 +08:00
|
|
|
csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
|
|
|
|
__u8 proto, __wsum sum)
|
2009-03-27 21:25:22 +08:00
|
|
|
{
|
|
|
|
__asm__("add %0, %0, %1\n\t"
|
|
|
|
"addc %0, %0, %2\n\t"
|
|
|
|
"addc %0, %0, %3\n\t"
|
|
|
|
"addc %0, %0, r0\n\t"
|
|
|
|
: "+&d" (sum)
|
2010-09-28 14:04:14 +08:00
|
|
|
: "d" (saddr), "d" (daddr),
|
|
|
|
#ifdef __MICROBLAZEEL__
|
|
|
|
"d" ((len + proto) << 8)
|
|
|
|
#else
|
|
|
|
"d" (len + proto)
|
|
|
|
#endif
|
|
|
|
);
|
2009-03-27 21:25:22 +08:00
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2009-06-19 01:55:32 +08:00
|
|
|
#include <asm-generic/checksum.h>
|
2009-03-27 21:25:22 +08:00
|
|
|
|
|
|
|
#endif /* _ASM_MICROBLAZE_CHECKSUM_H */
|