Skip to content

Commit

Permalink
lib/checksum.c: make do_csum optional
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
  • Loading branch information
arndb committed Nov 3, 2009
1 parent c44ba9f commit 20c1f64
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#include <asm/byteorder.h>

#ifndef do_csum
static inline unsigned short from32to16(unsigned int x)
{
/* add up 16-bit and 16-bit for 16+c bit */
Expand Down Expand Up @@ -102,6 +103,7 @@ static unsigned int do_csum(const unsigned char *buff, int len)
out:
return result;
}
#endif

/*
* This is a version of ip_compute_csum() optimized for IP headers,
Expand Down

0 comments on commit 20c1f64

Please sign in to comment.