arch/tile: break out the "csum a long" function to <asm/checksum.h>

This makes it available to the tilegx network driver.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Esse commit está contido em:
Chris Metcalf
2012-04-28 15:41:39 -04:00
commit 10104a1ad6
2 arquivos alterados com 19 adições e 14 exclusões

Ver arquivo

@@ -16,19 +16,6 @@
#include <net/checksum.h>
#include <linux/module.h>
static inline unsigned int longto16(unsigned long x)
{
unsigned long ret;
#ifdef __tilegx__
ret = __insn_v2sadu(x, 0);
ret = __insn_v2sadu(ret, 0);
#else
ret = __insn_sadh_u(x, 0);
ret = __insn_sadh_u(ret, 0);
#endif
return ret;
}
__wsum do_csum(const unsigned char *buff, int len)
{
int odd, count;
@@ -94,7 +81,7 @@ __wsum do_csum(const unsigned char *buff, int len)
}
if (len & 1)
result += *buff;
result = longto16(result);
result = csum_long(result);
if (odd)
result = swab16(result);
out: