From d012f8701887526498b3dc9917b467c6319c7073 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 19 Nov 2010 15:50:02 +0000 Subject: [PATCH] [tcp] Use MAX_LL_NET_HEADER_LEN instead of defining our own MAX_HDR_LEN Signed-off-by: Michael Brown --- src/include/ipxe/tcp.h | 1 - src/net/tcp.c | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/include/ipxe/tcp.h b/src/include/ipxe/tcp.h index e64614646..68bb899ae 100644 --- a/src/include/ipxe/tcp.h +++ b/src/include/ipxe/tcp.h @@ -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 */ diff --git a/src/net/tcp.c b/src/net/tcp.c index c31047712..3e1aeedc7 100644 --- a/src/net/tcp.c +++ b/src/net/tcp.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -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 ) );