From 23c3d349e52e57600aaaf3ef32e4264fffb2d0db Mon Sep 17 00:00:00 2001 From: Simon Zhang Date: Tue, 15 Sep 2020 23:40:28 +0800 Subject: tcp: make max gso packet size configurable Type: improvement Signed-off-by: Simon Zhang Change-Id: I14de90f07d825c5c99023996a88173ee855e9a6f --- src/vnet/tcp/tcp.c | 3 ++- src/vnet/tcp/tcp.h | 3 +++ src/vnet/tcp/tcp_cli.c | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index 1563be4eb86..a4599c2fd98 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -877,7 +877,7 @@ tcp_session_cal_goal_size (tcp_connection_t * tc) { u16 goal_size = tc->snd_mss; - goal_size = TCP_MAX_GSO_SZ - tc->snd_mss % TCP_MAX_GSO_SZ; + goal_size = tcp_cfg.max_gso_size - tc->snd_mss % tcp_cfg.max_gso_size; goal_size = clib_min (goal_size, tc->snd_wnd / 2); return goal_size > tc->snd_mss ? goal_size : tc->snd_mss; @@ -1430,6 +1430,7 @@ tcp_configuration_init (void) tcp_cfg.csum_offload = 1; tcp_cfg.cc_algo = TCP_CC_CUBIC; tcp_cfg.rwnd_min_update_ack = 1; + tcp_cfg.max_gso_size = TCP_MAX_GSO_SZ; /* Time constants defined as timer tick (100ms) multiples */ tcp_cfg.delack_time = 1; /* 0.1s */ diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h index bc6e353b60e..29d30dc0691 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -193,6 +193,9 @@ typedef struct tcp_configuration_ /** Number of preallocated half-open connections */ u32 preallocated_half_open_connections; + /** Maxium allowed GSO packet size */ + u32 max_gso_size; + /** Vectors of src addresses. Optional unless one needs > 63K active-opens */ ip4_address_t *ip4_src_addrs; ip6_address_t *ip6_src_addrs; diff --git a/src/vnet/tcp/tcp_cli.c b/src/vnet/tcp/tcp_cli.c index edd4d2d1bc1..94ee21f91bc 100644 --- a/src/vnet/tcp/tcp_cli.c +++ b/src/vnet/tcp/tcp_cli.c @@ -1050,7 +1050,7 @@ unformat_tcp_cc_algo_cfg (unformat_input_t * input, va_list * va) static clib_error_t * tcp_config_fn (vlib_main_t * vm, unformat_input_t * input) { - u32 cwnd_multiplier, tmp_time, mtu; + u32 cwnd_multiplier, tmp_time, mtu, max_gso_size; uword memory_size; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) @@ -1100,6 +1100,8 @@ tcp_config_fn (vlib_main_t * vm, unformat_input_t * input) tcp_cfg.allow_tso = 1; else if (unformat (input, "no-csum-offload")) tcp_cfg.csum_offload = 0; + else if (unformat (input, "max-gso-size %u", &max_gso_size)) + tcp_cfg.max_gso_size = clib_min (max_gso_size, TCP_MAX_GSO_SZ); else if (unformat (input, "cc-algo %U", unformat_tcp_cc_algo, &tcp_cfg.cc_algo)) ; -- cgit 1.2.3-korg