Browse Source

[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>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
1e066431a4
3 changed files with 8 additions and 15 deletions
  1. 2
    2
      src/arch/x86/core/x86_tcpip.c
  2. 2
    4
      src/arch/x86/include/bits/tcpip.h
  3. 4
    9
      src/include/ipxe/tcpip.h

+ 2
- 2
src/arch/x86/core/x86_tcpip.c View File

@@ -42,8 +42,8 @@ extern char x86_tcpip_loop_end[];
42 42
  * @v len		Length of data buffer
43 43
  * @ret cksum		Updated checksum, in network byte order
44 44
  */
45
-uint16_t x86_tcpip_continue_chksum ( uint16_t partial,
46
-				     const void *data, size_t len ) {
45
+uint16_t tcpip_continue_chksum ( uint16_t partial, const void *data,
46
+				 size_t len ) {
47 47
 	unsigned long sum = ( ( ~partial ) & 0xffff );
48 48
 	unsigned long initial_word_count;
49 49
 	unsigned long loop_count;

+ 2
- 4
src/arch/x86/include/bits/tcpip.h View File

@@ -9,9 +9,7 @@
9 9
 
10 10
 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 11
 
12
-extern uint16_t x86_tcpip_continue_chksum ( uint16_t partial,
13
-					    const void *data, size_t len );
14
-
15
-#define tcpip_continue_chksum x86_tcpip_continue_chksum
12
+extern uint16_t tcpip_continue_chksum ( uint16_t partial, const void *data,
13
+					size_t len );
16 14
 
17 15
 #endif /* _BITS_TCPIP_H */

+ 4
- 9
src/include/ipxe/tcpip.h View File

@@ -13,6 +13,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13 13
 #include <ipxe/socket.h>
14 14
 #include <ipxe/in.h>
15 15
 #include <ipxe/tables.h>
16
+
17
+extern uint16_t generic_tcpip_continue_chksum ( uint16_t partial,
18
+						const void *data, size_t len );
19
+
16 20
 #include <bits/tcpip.h>
17 21
 
18 22
 struct io_buffer;
@@ -195,17 +199,8 @@ extern int tcpip_tx ( struct io_buffer *iobuf, struct tcpip_protocol *tcpip,
195 199
 extern struct tcpip_net_protocol * tcpip_net_protocol ( sa_family_t sa_family );
196 200
 extern struct net_device * tcpip_netdev ( struct sockaddr_tcpip *st_dest );
197 201
 extern size_t tcpip_mtu ( struct sockaddr_tcpip *st_dest );
198
-extern uint16_t generic_tcpip_continue_chksum ( uint16_t partial,
199
-						const void *data, size_t len );
200 202
 extern uint16_t tcpip_chksum ( const void *data, size_t len );
201 203
 extern int tcpip_bind ( struct sockaddr_tcpip *st_local,
202 204
 			int ( * available ) ( int port ) );
203 205
 
204
-/* Use generic_tcpip_continue_chksum() if no architecture-specific
205
- * version is available
206
- */
207
-#ifndef tcpip_continue_chksum
208
-#define tcpip_continue_chksum generic_tcpip_continue_chksum
209
-#endif
210
-
211 206
 #endif /* _IPXE_TCPIP_H */

Loading…
Cancel
Save