mirror of https://github.com/ipxe/ipxe.git
[tcpip] Do not fall back to using unoptimised TCP/IP checksumming
Require architecture-specific code to make a deliberate choice to use the unoptimised generic_tcpip_continue_chksum() function, if there is no optimised version available. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/53/head
parent
9f91df422b
commit
1e066431a4
|
@ -42,8 +42,8 @@ extern char x86_tcpip_loop_end[];
|
||||||
* @v len Length of data buffer
|
* @v len Length of data buffer
|
||||||
* @ret cksum Updated checksum, in network byte order
|
* @ret cksum Updated checksum, in network byte order
|
||||||
*/
|
*/
|
||||||
uint16_t x86_tcpip_continue_chksum ( uint16_t partial,
|
uint16_t tcpip_continue_chksum ( uint16_t partial, const void *data,
|
||||||
const void *data, size_t len ) {
|
size_t len ) {
|
||||||
unsigned long sum = ( ( ~partial ) & 0xffff );
|
unsigned long sum = ( ( ~partial ) & 0xffff );
|
||||||
unsigned long initial_word_count;
|
unsigned long initial_word_count;
|
||||||
unsigned long loop_count;
|
unsigned long loop_count;
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
|
|
||||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
|
|
||||||
extern uint16_t x86_tcpip_continue_chksum ( uint16_t partial,
|
extern uint16_t tcpip_continue_chksum ( uint16_t partial, const void *data,
|
||||||
const void *data, size_t len );
|
size_t len );
|
||||||
|
|
||||||
#define tcpip_continue_chksum x86_tcpip_continue_chksum
|
|
||||||
|
|
||||||
#endif /* _BITS_TCPIP_H */
|
#endif /* _BITS_TCPIP_H */
|
||||||
|
|
|
@ -13,6 +13,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||||
#include <ipxe/socket.h>
|
#include <ipxe/socket.h>
|
||||||
#include <ipxe/in.h>
|
#include <ipxe/in.h>
|
||||||
#include <ipxe/tables.h>
|
#include <ipxe/tables.h>
|
||||||
|
|
||||||
|
extern uint16_t generic_tcpip_continue_chksum ( uint16_t partial,
|
||||||
|
const void *data, size_t len );
|
||||||
|
|
||||||
#include <bits/tcpip.h>
|
#include <bits/tcpip.h>
|
||||||
|
|
||||||
struct io_buffer;
|
struct io_buffer;
|
||||||
|
@ -195,17 +199,8 @@ extern int tcpip_tx ( struct io_buffer *iobuf, struct tcpip_protocol *tcpip,
|
||||||
extern struct tcpip_net_protocol * tcpip_net_protocol ( sa_family_t sa_family );
|
extern struct tcpip_net_protocol * tcpip_net_protocol ( sa_family_t sa_family );
|
||||||
extern struct net_device * tcpip_netdev ( struct sockaddr_tcpip *st_dest );
|
extern struct net_device * tcpip_netdev ( struct sockaddr_tcpip *st_dest );
|
||||||
extern size_t tcpip_mtu ( struct sockaddr_tcpip *st_dest );
|
extern size_t tcpip_mtu ( struct sockaddr_tcpip *st_dest );
|
||||||
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 );
|
extern uint16_t tcpip_chksum ( const void *data, size_t len );
|
||||||
extern int tcpip_bind ( struct sockaddr_tcpip *st_local,
|
extern int tcpip_bind ( struct sockaddr_tcpip *st_local,
|
||||||
int ( * available ) ( int port ) );
|
int ( * available ) ( int port ) );
|
||||||
|
|
||||||
/* 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 */
|
#endif /* _IPXE_TCPIP_H */
|
||||||
|
|
Loading…
Reference in New Issue