Explorar el Código

[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 hace 14 años
padre
commit
d012f87018
Se han modificado 2 ficheros con 5 adiciones y 5 borrados
  1. 0
    1
      src/include/ipxe/tcp.h
  2. 5
    4
      src/net/tcp.c

+ 0
- 1
src/include/ipxe/tcp.h Ver fichero

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

+ 5
- 4
src/net/tcp.c Ver fichero

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

Loading…
Cancelar
Guardar