summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/tcp.h
diff options
context:
space:
mode:
authorMichael Brown2012-06-29 15:30:18 +0200
committerMichael Brown2012-06-29 16:05:33 +0200
commitea61075c60e6417203bbb5fd54e1f313c99c164c (patch)
tree2bae13fae87f6a0fadf2d1a1ca39734db8149d87 /src/include/ipxe/tcp.h
parent[undi] Align the received frame payload for faster processing (diff)
downloadipxe-ea61075c60e6417203bbb5fd54e1f313c99c164c.tar.gz
ipxe-ea61075c60e6417203bbb5fd54e1f313c99c164c.tar.xz
ipxe-ea61075c60e6417203bbb5fd54e1f313c99c164c.zip
[tcp] Add support for TCP window scaling
The maximum unscaled TCP window (64kB) implies a maximum bandwidth of around 300kB/s on a WAN link with an RTT of 200ms. Add support for the TCP window scaling option to remove this upper limit. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/tcp.h')
-rw-r--r--src/include/ipxe/tcp.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/include/ipxe/tcp.h b/src/include/ipxe/tcp.h
index 7084af60..cb3309f2 100644
--- a/src/include/ipxe/tcp.h
+++ b/src/include/ipxe/tcp.h
@@ -54,6 +54,31 @@ struct tcp_mss_option {
/** Code for the TCP MSS option */
#define TCP_OPTION_MSS 2
+/** TCP window scale option */
+struct tcp_window_scale_option {
+ uint8_t kind;
+ uint8_t length;
+ uint8_t scale;
+} __attribute__ (( packed ));
+
+/** Padded TCP window scale option (used for sending) */
+struct tcp_window_scale_padded_option {
+ uint8_t nop;
+ struct tcp_window_scale_option wsopt;
+} __attribute (( packed ));
+
+/** Code for the TCP window scale option */
+#define TCP_OPTION_WS 3
+
+/** Advertised TCP window scale
+ *
+ * Using a scale factor of 2**9 provides for a maximum window of 32MB,
+ * which is sufficient to allow Gigabit-speed transfers with a 200ms
+ * RTT. The minimum advertised window is 512 bytes, which is still
+ * less than a single packet.
+ */
+#define TCP_RX_WINDOW_SCALE 9
+
/** TCP timestamp option */
struct tcp_timestamp_option {
uint8_t kind;
@@ -75,7 +100,9 @@ struct tcp_timestamp_padded_option {
struct tcp_options {
/** MSS option, if present */
const struct tcp_mss_option *mssopt;
- /** Timestampe option, if present */
+ /** Window scale option, if present */
+ const struct tcp_window_scale_option *wsopt;
+ /** Timestamp option, if present */
const struct tcp_timestamp_option *tsopt;
};
@@ -316,6 +343,7 @@ struct tcp_options {
( MAX_LL_NET_HEADER_LEN + \
sizeof ( struct tcp_header ) + \
sizeof ( struct tcp_mss_option ) + \
+ sizeof ( struct tcp_window_scale_padded_option ) + \
sizeof ( struct tcp_timestamp_padded_option ) )
/**