Browse Source

[tcp] Use MAX_LL_NET_HEADER_LEN instead of defining our own MAX_HDR_LEN

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
d012f87018
2 changed files with 5 additions and 5 deletions
  1. 0
    1
      src/include/ipxe/tcp.h
  2. 5
    4
      src/net/tcp.c

+ 0
- 1
src/include/ipxe/tcp.h View File

258
 #define TCP_MIN_PORT 1
258
 #define TCP_MIN_PORT 1
259
 
259
 
260
 /* Some IOB constants */
260
 /* Some IOB constants */
261
-#define MAX_HDR_LEN	100
262
 #define MAX_IOB_LEN	1500
261
 #define MAX_IOB_LEN	1500
263
 #define MIN_IOB_LEN	MAX_HDR_LEN + 100 /* To account for padding by LL */
262
 #define MIN_IOB_LEN	MAX_HDR_LEN + 100 /* To account for padding by LL */
264
 
263
 

+ 5
- 4
src/net/tcp.c View File

12
 #include <ipxe/xfer.h>
12
 #include <ipxe/xfer.h>
13
 #include <ipxe/open.h>
13
 #include <ipxe/open.h>
14
 #include <ipxe/uri.h>
14
 #include <ipxe/uri.h>
15
+#include <ipxe/netdevice.h>
15
 #include <ipxe/tcpip.h>
16
 #include <ipxe/tcpip.h>
16
 #include <ipxe/tcp.h>
17
 #include <ipxe/tcp.h>
17
 
18
 
483
 		start_timer ( &tcp->timer );
484
 		start_timer ( &tcp->timer );
484
 
485
 
485
 	/* Allocate I/O buffer */
486
 	/* Allocate I/O buffer */
486
-	iobuf = alloc_iob ( len + MAX_HDR_LEN );
487
+	iobuf = alloc_iob ( len + MAX_LL_NET_HEADER_LEN );
487
 	if ( ! iobuf ) {
488
 	if ( ! iobuf ) {
488
 		DBGC ( tcp, "TCP %p could not allocate iobuf for %08x..%08x "
489
 		DBGC ( tcp, "TCP %p could not allocate iobuf for %08x..%08x "
489
 		       "%08x\n", tcp, tcp->snd_seq, ( tcp->snd_seq + seq_len ),
490
 		       "%08x\n", tcp, tcp->snd_seq, ( tcp->snd_seq + seq_len ),
490
 		       tcp->rcv_ack );
491
 		       tcp->rcv_ack );
491
 		return -ENOMEM;
492
 		return -ENOMEM;
492
 	}
493
 	}
493
-	iob_reserve ( iobuf, MAX_HDR_LEN );
494
+	iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN );
494
 
495
 
495
 	/* Fill data payload from transmit queue */
496
 	/* Fill data payload from transmit queue */
496
 	tcp_process_tx_queue ( tcp, len, iobuf, 0 );
497
 	tcp_process_tx_queue ( tcp, len, iobuf, 0 );
627
 	int rc;
628
 	int rc;
628
 
629
 
629
 	/* Allocate space for dataless TX buffer */
630
 	/* Allocate space for dataless TX buffer */
630
-	iobuf = alloc_iob ( MAX_HDR_LEN );
631
+	iobuf = alloc_iob ( MAX_LL_NET_HEADER_LEN );
631
 	if ( ! iobuf ) {
632
 	if ( ! iobuf ) {
632
 		DBGC ( tcp, "TCP %p could not allocate iobuf for RST "
633
 		DBGC ( tcp, "TCP %p could not allocate iobuf for RST "
633
 		       "%08x..%08x %08x\n", tcp, ntohl ( in_tcphdr->ack ),
634
 		       "%08x..%08x %08x\n", tcp, ntohl ( in_tcphdr->ack ),
634
 		       ntohl ( in_tcphdr->ack ), ntohl ( in_tcphdr->seq ) );
635
 		       ntohl ( in_tcphdr->ack ), ntohl ( in_tcphdr->seq ) );
635
 		return -ENOMEM;
636
 		return -ENOMEM;
636
 	}
637
 	}
637
-	iob_reserve ( iobuf, MAX_HDR_LEN );
638
+	iob_reserve ( iobuf, MAX_LL_NET_HEADER_LEN );
638
 
639
 
639
 	/* Construct RST response */
640
 	/* Construct RST response */
640
 	tcphdr = iob_push ( iobuf, sizeof ( *tcphdr ) );
641
 	tcphdr = iob_push ( iobuf, sizeof ( *tcphdr ) );

Loading…
Cancel
Save