diff options
author | Arnd Bergmann <arnd@arndb.de> | 2009-06-23 15:37:26 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2009-11-03 10:06:52 -0500 |
commit | 20c1f641bb80fb272dec959a5caabed92e5a422e (patch) | |
tree | f86824522190b527c211ae43054e1e0a1f25568d /lib | |
parent | c44ba9f6684946b156335da6a6d55f0b8cf7cb72 (diff) |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/checksum.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/checksum.c b/lib/checksum.c index 886b48db4f28..b08c2d059024 100644 --- a/lib/checksum.c +++ b/lib/checksum.c | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include <asm/byteorder.h> | 38 | #include <asm/byteorder.h> |
39 | 39 | ||
40 | #ifndef do_csum | ||
40 | static inline unsigned short from32to16(unsigned int x) | 41 | static inline unsigned short from32to16(unsigned int x) |
41 | { | 42 | { |
42 | /* add up 16-bit and 16-bit for 16+c bit */ | 43 | /* 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) | |||
102 | out: | 103 | out: |
103 | return result; | 104 | return result; |
104 | } | 105 | } |
106 | #endif | ||
105 | 107 | ||
106 | /* | 108 | /* |
107 | * This is a version of ip_compute_csum() optimized for IP headers, | 109 | * This is a version of ip_compute_csum() optimized for IP headers, |