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
  * @v len		Length of data buffer
42
  * @v len		Length of data buffer
43
  * @ret cksum		Updated checksum, in network byte order
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
 	unsigned long sum = ( ( ~partial ) & 0xffff );
47
 	unsigned long sum = ( ( ~partial ) & 0xffff );
48
 	unsigned long initial_word_count;
48
 	unsigned long initial_word_count;
49
 	unsigned long loop_count;
49
 	unsigned long loop_count;

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

9
 
9
 
10
 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
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
 #endif /* _BITS_TCPIP_H */
15
 #endif /* _BITS_TCPIP_H */

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

13
 #include <ipxe/socket.h>
13
 #include <ipxe/socket.h>
14
 #include <ipxe/in.h>
14
 #include <ipxe/in.h>
15
 #include <ipxe/tables.h>
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
 #include <bits/tcpip.h>
20
 #include <bits/tcpip.h>
17
 
21
 
18
 struct io_buffer;
22
 struct io_buffer;
195
 extern struct tcpip_net_protocol * tcpip_net_protocol ( sa_family_t sa_family );
199
 extern struct tcpip_net_protocol * tcpip_net_protocol ( sa_family_t sa_family );
196
 extern struct net_device * tcpip_netdev ( struct sockaddr_tcpip *st_dest );
200
 extern struct net_device * tcpip_netdev ( struct sockaddr_tcpip *st_dest );
197
 extern size_t tcpip_mtu ( struct sockaddr_tcpip *st_dest );
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
 extern uint16_t tcpip_chksum ( const void *data, size_t len );
202
 extern uint16_t tcpip_chksum ( const void *data, size_t len );
201
 extern int tcpip_bind ( struct sockaddr_tcpip *st_local,
203
 extern int tcpip_bind ( struct sockaddr_tcpip *st_local,
202
 			int ( * available ) ( int port ) );
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
 #endif /* _IPXE_TCPIP_H */
206
 #endif /* _IPXE_TCPIP_H */

Loading…
Cancel
Save