mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 13:30:57 +03:00
[tcp] Handle out-of-order received packets
Maintain a queue of received packets, so that lost packets need not result in retransmission of the entire TCP window. Increase the TCP window to 8kB, in order that we can potentially transmit enough duplicate ACKs to trigger Fast Retransmission at the sender. Using a 10MB HTTP download in qemu-kvm with an artificial drop rate of 1 in 64 packets, this reduces the download time from around 26s to around 4s. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -287,7 +287,7 @@ struct tcp_options {
|
||||
* that payloads remain dword-aligned.
|
||||
*/
|
||||
//#define TCP_MAX_WINDOW_SIZE ( 65536 - 4 )
|
||||
#define TCP_MAX_WINDOW_SIZE 4096
|
||||
#define TCP_MAX_WINDOW_SIZE 8192
|
||||
|
||||
/**
|
||||
* Path MTU
|
||||
@@ -313,6 +313,35 @@ struct tcp_options {
|
||||
*/
|
||||
#define TCP_MSL ( 2 * 60 * TICKS_PER_SEC )
|
||||
|
||||
/**
|
||||
* Compare TCP sequence numbers
|
||||
*
|
||||
* @v seq1 Sequence number 1
|
||||
* @v seq2 Sequence number 2
|
||||
* @ret diff Sequence difference
|
||||
*
|
||||
* Analogous to memcmp(), returns an integer less than, equal to, or
|
||||
* greater than zero if @c seq1 is found, respectively, to be before,
|
||||
* equal to, or after @c seq2.
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int32_t
|
||||
tcp_cmp ( uint32_t seq1, uint32_t seq2 ) {
|
||||
return ( ( int32_t ) ( seq1 - seq2 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if TCP sequence number lies within window
|
||||
*
|
||||
* @v seq Sequence number
|
||||
* @v start Start of window
|
||||
* @v len Length of window
|
||||
* @ret in_window Sequence number is within window
|
||||
*/
|
||||
static inline int tcp_in_window ( uint32_t seq, uint32_t start,
|
||||
uint32_t len ) {
|
||||
return ( ( seq - start ) < len );
|
||||
}
|
||||
|
||||
extern struct tcpip_protocol tcp_protocol;
|
||||
|
||||
#endif /* _IPXE_TCP_H */
|
||||
|
||||
Reference in New Issue
Block a user