mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
lib/checksum.c: make do_csum optional
Mike Frysinger suggested that do_csum should be optional so that an architecture can use the generic checksum code but still provide an optimized fast-path for the most critical function. This can mean an implementation using inline assembly, or in case of Alpha one using 64-bit arithmetic in C. Cc: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
parent
c44ba9f668
commit
20c1f641bb
1 changed files with 2 additions and 0 deletions
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
|
|
||||||
|
#ifndef do_csum
|
||||||
static inline unsigned short from32to16(unsigned int x)
|
static inline unsigned short from32to16(unsigned int x)
|
||||||
{
|
{
|
||||||
/* add up 16-bit and 16-bit for 16+c bit */
|
/* add up 16-bit and 16-bit for 16+c bit */
|
||||||
|
@ -102,6 +103,7 @@ static unsigned int do_csum(const unsigned char *buff, int len)
|
||||||
out:
|
out:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a version of ip_compute_csum() optimized for IP headers,
|
* This is a version of ip_compute_csum() optimized for IP headers,
|
||||||
|
|
Loading…
Reference in a new issue