]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[tcp] Use MAX_LL_NET_HEADER_LEN instead of defining our own MAX_HDR_LEN
authorMichael Brown <mcb30@ipxe.org>
Fri, 19 Nov 2010 15:50:02 +0000 (15:50 +0000)
committerMichael Brown <mcb30@ipxe.org>
Fri, 19 Nov 2010 16:08:05 +0000 (16:08 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/tcp.h
src/net/tcp.c

index e64614646eaa240d99286a3135cb687aa8bcd44e..68bb899ae2b79b7512b79983ab999fb85dfd2cfe 100644 (file)
@@ -258,7 +258,6 @@ struct tcp_options {
 #define TCP_MIN_PORT 1
 
 /* Some IOB constants */
-#define MAX_HDR_LEN    100
 #define MAX_IOB_LEN    1500
 #define MIN_IOB_LEN    MAX_HDR_LEN + 100 /* To account for padding by LL */
 
index c3104771222871158bf2725ce1e70f0eb56b7c27..3e1aeedc7e1b0059ec444503e4dd205e398b4599 100644 (file)
@@ -12,6 +12,7 @@
 #include <ipxe/xfer.h>
 #include <ipxe/open.h>
 #include <ipxe/uri.h>
+#include <ipxe/netdevice.h>
 #include <ipxe/tcpip.h>
 #include <ipxe/tcp.h>
 
@@ -483,14 +484,14 @@ static int tcp_xmit ( struct tcp_connection *tcp ) {
                start_timer ( &tcp->timer );
 
        /* Allocate I/O buffer */
-       iobuf = alloc_iob ( len + MAX_HDR_LEN );
+       iobuf = alloc_iob ( len + MAX_LL_NET_HEADER_LEN );
        if ( ! iobuf ) {
                DBGC ( tcp, "TCP %p could not allocate iobuf for %08x..%08x "
                       "%08x\n", tcp, tcp->snd_seq, ( tcp->snd_seq + seq_len ),
                       tcp->rcv_ack );
                return -ENOMEM;
        }
-       iob_reserve ( iobuf, MAX_HDR_LEN );
+       iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN );
 
        /* Fill data payload from transmit queue */
        tcp_process_tx_queue ( tcp, len, iobuf, 0 );
@@ -627,14 +628,14 @@ static int tcp_xmit_reset ( struct tcp_connection *tcp,
        int rc;
 
        /* Allocate space for dataless TX buffer */
-       iobuf = alloc_iob ( MAX_HDR_LEN );
+       iobuf = alloc_iob ( MAX_LL_NET_HEADER_LEN );
        if ( ! iobuf ) {
                DBGC ( tcp, "TCP %p could not allocate iobuf for RST "
                       "%08x..%08x %08x\n", tcp, ntohl ( in_tcphdr->ack ),
                       ntohl ( in_tcphdr->ack ), ntohl ( in_tcphdr->seq ) );
                return -ENOMEM;
        }
-       iob_reserve ( iobuf, MAX_HDR_LEN );
+       iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN );
 
        /* Construct RST response */
        tcphdr = iob_push ( iobuf, sizeof ( *tcphdr ) );