diff options
author | Michael Brown <mcb30@ipxe.org> | 2012-06-27 12:02:58 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2012-06-27 19:15:17 +0100 |
commit | 1d77d032168bd495c53589cca596131a992473c4 (patch) | |
tree | f6ade4bb1e404c1fcf66bfa647cd7d9273e66eb2 /src | |
parent | 6a4ff519c8c21c8acbedb5e2db4d92c14e99d9f1 (diff) | |
download | ipxe-1d77d032168bd495c53589cca596131a992473c4.zip ipxe-1d77d032168bd495c53589cca596131a992473c4.tar.gz ipxe-1d77d032168bd495c53589cca596131a992473c4.tar.bz2 |
[tcpip] Allow for architecture-specific TCP/IP checksum routines
Calculating the TCP/IP checksum on received packets accounts for a
substantial fraction of the response latency.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/x86/include/bits/tcpip.h | 12 | ||||
-rw-r--r-- | src/include/ipxe/tcpip.h | 12 | ||||
-rw-r--r-- | src/net/tcpip.c | 4 |
3 files changed, 24 insertions, 4 deletions
diff --git a/src/arch/x86/include/bits/tcpip.h b/src/arch/x86/include/bits/tcpip.h new file mode 100644 index 0000000..9ae8d92 --- /dev/null +++ b/src/arch/x86/include/bits/tcpip.h @@ -0,0 +1,12 @@ +#ifndef _BITS_TCPIP_H +#define _BITS_TCPIP_H + +/** @file + * + * Transport-network layer interface + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#endif /* _BITS_TCPIP_H */ diff --git a/src/include/ipxe/tcpip.h b/src/include/ipxe/tcpip.h index cdf554e..34d7f88 100644 --- a/src/include/ipxe/tcpip.h +++ b/src/include/ipxe/tcpip.h @@ -13,6 +13,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <ipxe/socket.h> #include <ipxe/in.h> #include <ipxe/tables.h> +#include <bits/tcpip.h> struct io_buffer; struct net_device; @@ -121,8 +122,15 @@ extern int tcpip_tx ( struct io_buffer *iobuf, struct tcpip_protocol *tcpip, struct sockaddr_tcpip *st_dest, struct net_device *netdev, uint16_t *trans_csum ); -extern uint16_t tcpip_continue_chksum ( uint16_t partial, - const void *data, size_t len ); +extern uint16_t generic_tcpip_continue_chksum ( uint16_t partial, + const void *data, size_t len ); extern uint16_t tcpip_chksum ( const void *data, size_t len ); +/* Use generic_tcpip_continue_chksum() if no architecture-specific + * version is available + */ +#ifndef tcpip_continue_chksum +#define tcpip_continue_chksum generic_tcpip_continue_chksum +#endif + #endif /* _IPXE_TCPIP_H */ diff --git a/src/net/tcpip.c b/src/net/tcpip.c index 4451bf1..8e187f7 100644 --- a/src/net/tcpip.c +++ b/src/net/tcpip.c @@ -97,8 +97,8 @@ int tcpip_tx ( struct io_buffer *iobuf, struct tcpip_protocol *tcpip_protocol, * or both. Deciding which to swap is left as an exercise for the * interested reader. */ -uint16_t tcpip_continue_chksum ( uint16_t partial, const void *data, - size_t len ) { +uint16_t generic_tcpip_continue_chksum ( uint16_t partial, + const void *data, size_t len ) { unsigned int cksum = ( ( ~partial ) & 0xffff ); unsigned int value; unsigned int i; |