summaryrefslogtreecommitdiff
path: root/roms/ipxe/src/include/ipxe/tcpip.h
diff options
context:
space:
mode:
Diffstat (limited to 'roms/ipxe/src/include/ipxe/tcpip.h')
-rw-r--r--roms/ipxe/src/include/ipxe/tcpip.h54
1 files changed, 11 insertions, 43 deletions
diff --git a/roms/ipxe/src/include/ipxe/tcpip.h b/roms/ipxe/src/include/ipxe/tcpip.h
index 414daad53..3cfc8e3ac 100644
--- a/roms/ipxe/src/include/ipxe/tcpip.h
+++ b/roms/ipxe/src/include/ipxe/tcpip.h
@@ -13,48 +13,17 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/socket.h>
#include <ipxe/in.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>
struct io_buffer;
struct net_device;
struct ip_statistics;
-/** Positive zero checksum value */
-#define TCPIP_POSITIVE_ZERO_CSUM 0x0000
-
-/** Negative zero checksum value */
-#define TCPIP_NEGATIVE_ZERO_CSUM 0xffff
-
/** Empty checksum value
*
- * All of our TCP/IP checksum algorithms will return only the positive
- * representation of zero (0x0000) for a zero checksum over non-zero
- * input data. This property arises since the end-around carry used
- * to mimic one's complement addition using unsigned arithmetic
- * prevents the running total from ever returning to 0x0000. The
- * running total will therefore use only the negative representation
- * of zero (0xffff). Since the return value is the one's complement
- * negation of the running total (calculated by simply bit-inverting
- * the running total), the return value will therefore use only the
- * positive representation of zero (0x0000).
- *
- * It is a very common misconception (found in many places such as
- * RFC1624) that this is a property guaranteed by the underlying
- * mathematics. It is not; the choice of which zero representation is
- * used is merely an artifact of the software implementation of the
- * checksum algorithm.
- *
- * For consistency, we choose to use the positive representation of
- * zero (0x0000) for the checksum of a zero-length block of data.
- * This ensures that all of our TCP/IP checksum algorithms will return
- * only the positive representation of zero (0x0000) for a zero
- * checksum (regardless of the input data).
+ * This is the TCP/IP checksum over a zero-length block of data.
*/
-#define TCPIP_EMPTY_CSUM TCPIP_POSITIVE_ZERO_CSUM
+#define TCPIP_EMPTY_CSUM 0xffff
/** TCP/IP address flags */
enum tcpip_st_flags {
@@ -119,13 +88,6 @@ struct tcpip_protocol {
int ( * rx ) ( struct io_buffer *iobuf, struct net_device *netdev,
struct sockaddr_tcpip *st_src,
struct sockaddr_tcpip *st_dest, uint16_t pshdr_csum );
- /** Preferred zero checksum value
- *
- * The checksum is a one's complement value: zero may be
- * represented by either positive zero (0x0000) or negative
- * zero (0xffff).
- */
- uint16_t zero_csum;
/**
* Transport-layer protocol number
*
@@ -144,8 +106,6 @@ struct tcpip_net_protocol {
sa_family_t sa_family;
/** Fixed header length */
size_t header_len;
- /** Network-layer protocol */
- struct net_protocol *net_protocol;
/**
* Transmit packet
*
@@ -196,11 +156,19 @@ 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 struct tcpip_net_protocol * tcpip_net_protocol ( sa_family_t sa_family );
extern struct net_device * tcpip_netdev ( 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 int tcpip_bind ( struct sockaddr_tcpip *st_local,
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 */