summaryrefslogtreecommitdiffstats
path: root/arch/tile/lib/checksum.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-04-28 15:41:39 -0400
committerChris Metcalf <cmetcalf@tilera.com>2012-07-11 16:04:57 -0400
commit10104a1ad670889adc1ae3779df968db621b5dbd (patch)
tree1a5aa6b3ae5c669b818bf076f748a8a54d27f88f /arch/tile/lib/checksum.c
parent4875f69fecab08654972d6fb0d71ee2109d2538c (diff)
downloadop-kernel-dev-10104a1ad670889adc1ae3779df968db621b5dbd.zip
op-kernel-dev-10104a1ad670889adc1ae3779df968db621b5dbd.tar.gz
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>
Diffstat (limited to 'arch/tile/lib/checksum.c')
-rw-r--r--arch/tile/lib/checksum.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/arch/tile/lib/checksum.c b/arch/tile/lib/checksum.c
index e4bab5b..c3ca3e6 100644
--- a/arch/tile/lib/checksum.c
+++ b/arch/tile/lib/checksum.c
@@ -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:
OpenPOWER on IntegriCloud