Browse Source

[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>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
07bc73e087
1 changed files with 24 additions and 22 deletions
  1. 24
    22
      src/include/ipxe/tcp.h

+ 24
- 22
src/include/ipxe/tcp.h View File

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

Loading…
Cancel
Save