2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-22 09:31:51 +00:00

[tcp] Increase maximum window size to 256kB

A window size of 256kB should be sufficient to allow for
full-bandwidth transfers over a Gigabit LAN, and for acceptable
transfer speeds over other typical links.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2012-07-08 17:54:07 +01:00
parent 6825b2e7bf
commit 07bc73e087

View File

@ -287,29 +287,31 @@ struct tcp_options {
/**
* Maxmimum advertised TCP window size
*
* We estimate the TCP window size as the amount of free memory we
* have. This is not strictly accurate (since it ignores any space
* already allocated as RX buffers), but it will do for now.
* The maximum bandwidth on any link is limited by
*
* Since we don't store out-of-order received packets, the
* retransmission penalty is that the whole window contents must be
* resent. This suggests keeping the window size small, but bear in
* mind that the maximum bandwidth on any link is limited to
* max_bandwidth * round_trip_time = tcp_window
*
* max_bandwidth = ( tcp_window / round_trip_time )
* Some rough expectations for achievable bandwidths over various
* links are:
*
* With a 48kB window, which probably accurately reflects our amount
* of free memory, and a WAN RTT of say 200ms, this gives a maximum
* bandwidth of 240kB/s. This is sufficiently close to realistic that
* we will need to be careful that our advertised window doesn't end
* up limiting WAN download speeds.
* a) Gigabit LAN: expected bandwidth 125MB/s, typical RTT 0.5ms,
* minimum required window 64kB
*
* Finally, since the window goes into a 16-bit field and we cannot
* actually use 65536, we use a window size of (65536-4) to ensure
* that payloads remain dword-aligned.
* b) Home Internet connection: expected bandwidth 10MB/s, typical
* RTT 25ms, minimum required window 256kB
*
* c) WAN: expected bandwidth 2MB/s, typical RTT 100ms, minimum
* required window 200kB.
*
* The maximum possible value for the TCP window size is 1GB (using
* the maximum window scale of 2**14). However, it is advisable to
* keep the window size as small as possible (without limiting
* bandwidth), since in the event of a lost packet the window size
* represents the maximum amount that will need to be retransmitted.
*
* We therefore choose a maximum window size of 256kB.
*/
//#define TCP_MAX_WINDOW_SIZE ( 65536 - 4 )
#define TCP_MAX_WINDOW_SIZE 8192
#define TCP_MAX_WINDOW_SIZE ( 256 * 1024 )
/**
* Path MTU