1f11e044b449c0534cd2de3465f68925f68190866Michal Simek/* 2f11e044b449c0534cd2de3465f68925f68190866Michal Simek * Copyright (C) 2008 Michal Simek <monstr@monstr.eu> 3f11e044b449c0534cd2de3465f68925f68190866Michal Simek * Copyright (C) 2006 Atmark Techno, Inc. 4f11e044b449c0534cd2de3465f68925f68190866Michal Simek * 5f11e044b449c0534cd2de3465f68925f68190866Michal Simek * This file is subject to the terms and conditions of the GNU General Public 6f11e044b449c0534cd2de3465f68925f68190866Michal Simek * License. See the file "COPYING" in the main directory of this archive 7f11e044b449c0534cd2de3465f68925f68190866Michal Simek * for more details. 8f11e044b449c0534cd2de3465f68925f68190866Michal Simek */ 9f11e044b449c0534cd2de3465f68925f68190866Michal Simek 10f11e044b449c0534cd2de3465f68925f68190866Michal Simek#ifndef _ASM_MICROBLAZE_CHECKSUM_H 11f11e044b449c0534cd2de3465f68925f68190866Michal Simek#define _ASM_MICROBLAZE_CHECKSUM_H 12f11e044b449c0534cd2de3465f68925f68190866Michal Simek 13f11e044b449c0534cd2de3465f68925f68190866Michal Simek/* 14f11e044b449c0534cd2de3465f68925f68190866Michal Simek * computes the checksum of the TCP/UDP pseudo-header 15f11e044b449c0534cd2de3465f68925f68190866Michal Simek * returns a 16-bit checksum, already complemented 16f11e044b449c0534cd2de3465f68925f68190866Michal Simek */ 1714f8738976991d2f8fb6ab6e10e9003562c3d6bbRemis Lima Baima#define csum_tcpudp_nofold csum_tcpudp_nofold 18f11e044b449c0534cd2de3465f68925f68190866Michal Simekstatic inline __wsum 19f11e044b449c0534cd2de3465f68925f68190866Michal Simekcsum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 20f11e044b449c0534cd2de3465f68925f68190866Michal Simek unsigned short proto, __wsum sum) 21f11e044b449c0534cd2de3465f68925f68190866Michal Simek{ 22f11e044b449c0534cd2de3465f68925f68190866Michal Simek __asm__("add %0, %0, %1\n\t" 23f11e044b449c0534cd2de3465f68925f68190866Michal Simek "addc %0, %0, %2\n\t" 24f11e044b449c0534cd2de3465f68925f68190866Michal Simek "addc %0, %0, %3\n\t" 25f11e044b449c0534cd2de3465f68925f68190866Michal Simek "addc %0, %0, r0\n\t" 26f11e044b449c0534cd2de3465f68925f68190866Michal Simek : "+&d" (sum) 2702b08045a0306c38131c6d7155c4034a775d40b1Michal Simek : "d" (saddr), "d" (daddr), 2802b08045a0306c38131c6d7155c4034a775d40b1Michal Simek#ifdef __MICROBLAZEEL__ 2902b08045a0306c38131c6d7155c4034a775d40b1Michal Simek "d" ((len + proto) << 8) 3002b08045a0306c38131c6d7155c4034a775d40b1Michal Simek#else 3102b08045a0306c38131c6d7155c4034a775d40b1Michal Simek "d" (len + proto) 3202b08045a0306c38131c6d7155c4034a775d40b1Michal Simek#endif 3302b08045a0306c38131c6d7155c4034a775d40b1Michal Simek); 34f11e044b449c0534cd2de3465f68925f68190866Michal Simek return sum; 35f11e044b449c0534cd2de3465f68925f68190866Michal Simek} 36f11e044b449c0534cd2de3465f68925f68190866Michal Simek 3714f8738976991d2f8fb6ab6e10e9003562c3d6bbRemis Lima Baima#include <asm-generic/checksum.h> 38f11e044b449c0534cd2de3465f68925f68190866Michal Simek 39f11e044b449c0534cd2de3465f68925f68190866Michal Simek#endif /* _ASM_MICROBLAZE_CHECKSUM_H */ 40