]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[tcp] Increase maximum window size to 256kB
authorMichael Brown <mcb30@ipxe.org>
Sun, 8 Jul 2012 16:54:07 +0000 (17:54 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 9 Jul 2012 09:15:24 +0000 (10:15 +0100)
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>
src/include/ipxe/tcp.h

index cb3309f2f9ad2df06489e4d2bf8629a74ea964aa..6b6691175fcb05e65ad926bd8d243f183ec03acd 100644 (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.
- *
- * 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 = ( tcp_window / round_trip_time )
- *
- * 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.
- *
- * 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.
+ * The maximum bandwidth on any link is limited by
+ *
+ *    max_bandwidth * round_trip_time = tcp_window
+ *
+ * Some rough expectations for achievable bandwidths over various
+ * links are:
+ *
+ *    a) Gigabit LAN: expected bandwidth 125MB/s, typical RTT 0.5ms,
+ *       minimum required window 64kB
+ *
+ *    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