diff options
author | Florin Coras <fcoras@cisco.com> | 2018-09-25 14:00:34 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-11-09 11:24:22 +0000 |
commit | 2e31cc35ca5db7f16c8052578d79f1ec84c0acb5 (patch) | |
tree | 673f9bc946628d9d554c126f92d75eab4d67d0cb /src/vnet/tcp/tcp.c | |
parent | 97670eb3c643eefbecfbe2d61a8f06cde9516778 (diff) |
tcp: basic cubic implementation
Because the code is not optimized, newreno is still the default
congestion control algorithm.
Change-Id: I7061cc80c5a75fa8e8265901fae4ea2888e35173
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp.c')
-rw-r--r-- | src/vnet/tcp/tcp.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index d759cf0d0cd..695f614a91c 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -510,7 +510,7 @@ tcp_connection_fib_attach (tcp_connection_t * tc) static void tcp_cc_init (tcp_connection_t * tc) { - tc->cc_algo = tcp_cc_algo_get (TCP_CC_NEWRENO); + tc->cc_algo = tcp_cc_algo_get (tcp_main.cc_algo); tc->cc_algo->init (tc); } @@ -1425,11 +1425,27 @@ tcp_init (vlib_main_t * vm) tcp_api_reference (); tm->tx_pacing = 1; + tm->cc_algo = TCP_CC_NEWRENO; return 0; } VLIB_INIT_FUNCTION (tcp_init); +uword +unformat_tcp_cc_algo (unformat_input_t * input, va_list * va) +{ + uword *result = va_arg (*va, uword *); + + if (unformat (input, "newreno")) + *result = TCP_CC_NEWRENO; + else if (unformat (input, "cubic")) + *result = TCP_CC_CUBIC; + else + return 0; + + return 1; +} + static clib_error_t * tcp_config_fn (vlib_main_t * vm, unformat_input_t * input) { @@ -1451,6 +1467,9 @@ tcp_config_fn (vlib_main_t * vm, unformat_input_t * input) ; else if (unformat (input, "no-tx-pacing")) tm->tx_pacing = 0; + else if (unformat (input, "cc-algo %U", unformat_tcp_cc_algo, + &tm->cc_algo)) + ; else return clib_error_return (0, "unknown input `%U'", format_unformat_error, input); |