tcp: make max gso packet size configurable 32/28832/4
authorSimon Zhang <yuwei1.zhang@intel.com>
Tue, 15 Sep 2020 15:40:28 +0000 (23:40 +0800)
committerSimon Zhang <yuwei1.zhang@intel.com>
Wed, 16 Sep 2020 02:18:01 +0000 (02:18 +0000)
Type: improvement

Signed-off-by: Simon Zhang <yuwei1.zhang@intel.com>
Change-Id: I14de90f07d825c5c99023996a88173ee855e9a6f

src/vnet/tcp/tcp.c
src/vnet/tcp/tcp.h
src/vnet/tcp/tcp_cli.c

index 1563be4..a4599c2 100644 (file)
@@ -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 */
index bc6e353..29d30dc 100644 (file)
@@ -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;
index edd4d2d..94ee21f 100644 (file)
@@ -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))
        ;