Skip to content

Instantly share code, notes, and snippets.

@postwait
Created March 27, 2013 00:17
Show Gist options
  • Select an option

  • Save postwait/5250526 to your computer and use it in GitHub Desktop.

Select an option

Save postwait/5250526 to your computer and use it in GitHub Desktop.
commit 89140caf2308cd1f9dd76a0aadd0a9d48a640013
Author: Theo Schlossnagle <[email protected]>
Date: Tue Mar 26 18:48:37 2013 +0000
OMNIOS#52 Allow operator setting of TCP initial congestion window
Change the initial congestion window calculation to respect the
tcp_slow_start_initial and tcp_slow_start_after_idle tunables up
to a value of 16.
The new default value of 0, uses the RFC to determine the window
size as either 2, 3 or 4 segments.
diff --git a/usr/src/uts/common/inet/tcp/tcp_opt_data.c b/usr/src/uts/common/inet/tcp/tcp_opt_data.c
index 460ef6d..1a5363b 100644
--- a/usr/src/uts/common/inet/tcp/tcp_opt_data.c
+++ b/usr/src/uts/common/inet/tcp/tcp_opt_data.c
@@ -269,9 +269,6 @@ optdb_obj_t tcp_opt_obj = {
tcp_valid_levels_arr /* TCP valid level array */
};
-/* Maximum TCP initial cwin (start/restart). */
-#define TCP_MAX_INIT_CWND 16
-
static int tcp_max_init_cwnd = TCP_MAX_INIT_CWND;
/*
diff --git a/usr/src/uts/common/inet/tcp/tcp_tunables.c b/usr/src/uts/common/inet/tcp/tcp_tunables.c
index a1792f7..36bab57 100644
--- a/usr/src/uts/common/inet/tcp/tcp_tunables.c
+++ b/usr/src/uts/common/inet/tcp/tcp_tunables.c
@@ -379,11 +379,11 @@ mod_prop_info_t tcp_propinfo_tbl[] = {
{ "_slow_start_after_idle", MOD_PROTO_TCP,
mod_set_uint32, mod_get_uint32,
- {1, 16384, 4}, {4} },
+ {0, 16384, 0}, {0} },
{ "_slow_start_initial", MOD_PROTO_TCP,
mod_set_uint32, mod_get_uint32,
- {1, 4, 4}, {4} },
+ {0, 16, 0}, {0} },
{ "sack", MOD_PROTO_TCP,
mod_set_uint32, mod_get_uint32,
diff --git a/usr/src/uts/common/inet/tcp_impl.h b/usr/src/uts/common/inet/tcp_impl.h
index 77f9bb1..a08cd97 100644
--- a/usr/src/uts/common/inet/tcp_impl.h
+++ b/usr/src/uts/common/inet/tcp_impl.h
@@ -199,12 +199,33 @@ typedef struct tcp_squeue_priv_s {
* should be 0 and we use the formula in RFC 3390 to set tcp_cwnd.
* If the upper layer has changed set the tcp_init_cwnd, just use
* it to calculate the tcp_cwnd.
+ *
+ * ACM SIGCOMM Computer Communications Review, vol. 40 (2010), pp. 27-33
+ * "Based on the results from our experiments, we believe the
+ * initial congestion window should be at least ten segments
+ * and the same be investigated for standardization by the IETF."
+ *
+ * As such, the def_max_init_cwnd argument with which this macro is
+ * invoked is either the tcps_slow_start_initial or
+ * tcps_slow_start_after_idle which both default to 4 which respects
+ * RFC 3390 exactly. However, the initial congestion window should
+ * be increased as the operator demands (via both slow_start tunables)
+ * within reason. We shall arbitrarily define reason as a maximum of 16.
*/
+
+/* Maximum TCP initial cwin (start/restart). */
+#define TCP_MAX_INIT_CWND 16
+
#define TCP_SET_INIT_CWND(tcp, mss, def_max_init_cwnd) \
{ \
if ((tcp)->tcp_init_cwnd == 0) { \
- (tcp)->tcp_cwnd = MIN(def_max_init_cwnd * (mss), \
- MIN(4 * (mss), MAX(2 * (mss), 4380 / (mss) * (mss)))); \
+ if(def_max_init_cwnd == 0) { \
+ (tcp)->tcp_cwnd = MIN(4 * (mss), \
+ MAX(2 * (mss), 4380 / (mss) * (mss))); \
+ } else { \
+ (tcp)->tcp_cwnd = MIN(TCP_MAX_INIT_CWND * (mss),\
+ def_max_init_cwnd * (mss)); \
+ } \
} else { \
(tcp)->tcp_cwnd = (tcp)->tcp_init_cwnd * (mss); \
} \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment