Просмотр исходного кода

[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>
tags/v1.20.1
Michael Brown 12 лет назад
Родитель
Сommit
1d77d03216
3 измененных файлов: 24 добавлений и 4 удалений
  1. 12
    0
      src/arch/x86/include/bits/tcpip.h
  2. 10
    2
      src/include/ipxe/tcpip.h
  3. 2
    2
      src/net/tcpip.c

+ 12
- 0
src/arch/x86/include/bits/tcpip.h Просмотреть файл

@@ -0,0 +1,12 @@
1
+#ifndef _BITS_TCPIP_H
2
+#define _BITS_TCPIP_H
3
+
4
+/** @file
5
+ *
6
+ * Transport-network layer interface
7
+ *
8
+ */
9
+
10
+FILE_LICENCE ( GPL2_OR_LATER );
11
+
12
+#endif /* _BITS_TCPIP_H */

+ 10
- 2
src/include/ipxe/tcpip.h Просмотреть файл

@@ -13,6 +13,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
13 13
 #include <ipxe/socket.h>
14 14
 #include <ipxe/in.h>
15 15
 #include <ipxe/tables.h>
16
+#include <bits/tcpip.h>
16 17
 
17 18
 struct io_buffer;
18 19
 struct net_device;
@@ -121,8 +122,15 @@ extern int tcpip_tx ( struct io_buffer *iobuf, struct tcpip_protocol *tcpip,
121 122
 		      struct sockaddr_tcpip *st_dest,
122 123
 		      struct net_device *netdev,
123 124
 		      uint16_t *trans_csum );
124
-extern uint16_t tcpip_continue_chksum ( uint16_t partial,
125
-					const void *data, size_t len );
125
+extern uint16_t generic_tcpip_continue_chksum ( uint16_t partial,
126
+						const void *data, size_t len );
126 127
 extern uint16_t tcpip_chksum ( const void *data, size_t len );
127 128
 
129
+/* Use generic_tcpip_continue_chksum() if no architecture-specific
130
+ * version is available
131
+ */
132
+#ifndef tcpip_continue_chksum
133
+#define tcpip_continue_chksum generic_tcpip_continue_chksum
134
+#endif
135
+
128 136
 #endif /* _IPXE_TCPIP_H */

+ 2
- 2
src/net/tcpip.c Просмотреть файл

@@ -97,8 +97,8 @@ int tcpip_tx ( struct io_buffer *iobuf, struct tcpip_protocol *tcpip_protocol,
97 97
  * or both.  Deciding which to swap is left as an exercise for the
98 98
  * interested reader.
99 99
  */
100
-uint16_t tcpip_continue_chksum ( uint16_t partial, const void *data,
101
-				 size_t len ) {
100
+uint16_t generic_tcpip_continue_chksum ( uint16_t partial,
101
+					 const void *data, size_t len ) {
102 102
 	unsigned int cksum = ( ( ~partial ) & 0xffff );
103 103
 	unsigned int value;
104 104
 	unsigned int i;

Загрузка…
Отмена
Сохранить