diff options
| author | Michael Brown | 2007-01-03 21:48:52 +0100 |
|---|---|---|
| committer | Michael Brown | 2007-01-03 21:48:52 +0100 |
| commit | a0525a4ed36a28260d6dee4723bd6a1eb29020be (patch) | |
| tree | 720037999566f4a80c7873f173938fddf2942d5e /src/include | |
| parent | Tidy up debug messages (diff) | |
| download | ipxe-a0525a4ed36a28260d6dee4723bd6a1eb29020be.tar.gz ipxe-a0525a4ed36a28260d6dee4723bd6a1eb29020be.tar.xz ipxe-a0525a4ed36a28260d6dee4723bd6a1eb29020be.zip | |
Verify checksums on the RX datapath.
Simplify checksum generation on the TX datapath.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/gpxe/ip.h | 2 | ||||
| -rw-r--r-- | src/include/gpxe/tcpip.h | 40 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/include/gpxe/ip.h b/src/include/gpxe/ip.h index bec7c9020..352cf6435 100644 --- a/src/include/gpxe/ip.h +++ b/src/include/gpxe/ip.h @@ -12,7 +12,7 @@ /* IP constants */ -#define IP_VER 4 +#define IP_VER 0x40 #define IP_MASK_VER 0xf0 #define IP_MASK_HLEN 0x0f #define IP_MASK_OFFSET 0x1fff diff --git a/src/include/gpxe/tcpip.h b/src/include/gpxe/tcpip.h index 6ab2f195d..23c6ce7f2 100644 --- a/src/include/gpxe/tcpip.h +++ b/src/include/gpxe/tcpip.h @@ -14,6 +14,13 @@ struct pk_buff; +/** Empty checksum value + * + * This is the TCP/IP checksum over a zero-length block of data. + */ +#define TCPIP_EMPTY_CSUM 0xffff + +/** Length of a @c struct @c sockaddr_tcpip */ #define SA_TCPIP_LEN 32 /** @@ -45,30 +52,22 @@ struct tcpip_protocol { /** * Process received packet * - * @v pkb Packet buffer - * @v st_src Partially-filled source address - * @v st_dest Partially-filled destination address - * @ret rc Return status code + * @v pkb Packet buffer + * @v st_src Partially-filled source address + * @v st_dest Partially-filled destination address + * @v pshdr_csum Pseudo-header checksum + * @ret rc Return status code * * This method takes ownership of the packet buffer. */ int ( * rx ) ( struct pk_buff *pkb, struct sockaddr_tcpip *st_src, - struct sockaddr_tcpip *st_dest ); + struct sockaddr_tcpip *st_dest, uint16_t pshdr_csum ); /** * Transport-layer protocol number * * This is a constant of the type IP_XXX */ uint8_t tcpip_proto; - /** - * Checksum offset - * - * A negative number indicates that the protocol does not - * require checksumming to be performed by the network layer. - * A positive number is the offset of the checksum field in - * the transport-layer header. - */ - int csum_offset; }; /** @@ -85,13 +84,14 @@ struct tcpip_net_protocol { * @v pkb Packet buffer * @v tcpip_protocol Transport-layer protocol * @v st_dest Destination address + * @v trans_csum Transport-layer checksum to complete, or NULL * @ret rc Return status code * * This function takes ownership of the packet buffer. */ int ( * tx ) ( struct pk_buff *pkb, struct tcpip_protocol *tcpip_protocol, - struct sockaddr_tcpip *st_dest ); + struct sockaddr_tcpip *st_dest, uint16_t *trans_csum ); }; /** Declare a TCP/IP transport-layer protocol */ @@ -102,11 +102,11 @@ struct tcpip_net_protocol { extern int tcpip_rx ( struct pk_buff *pkb, uint8_t tcpip_proto, struct sockaddr_tcpip *st_src, - struct sockaddr_tcpip *st_dest ); + struct sockaddr_tcpip *st_dest, uint16_t pshdr_csum ); extern int tcpip_tx ( struct pk_buff *pkb, struct tcpip_protocol *tcpip, - struct sockaddr_tcpip *st_dest ); -extern unsigned int tcpip_continue_chksum ( unsigned int partial, - const void *data, size_t len ); -extern unsigned int tcpip_chksum ( const void *data, size_t len ); + struct sockaddr_tcpip *st_dest, uint16_t *trans_csum ); +extern uint16_t tcpip_continue_chksum ( uint16_t partial, + const void *data, size_t len ); +extern uint16_t tcpip_chksum ( const void *data, size_t len ); #endif /* _GPXE_TCPIP_H */ |
