tcp: avoid sack processing when not needed (VPP-1460) 17/15317/3
authorFlorin Coras <fcoras@cisco.com>
Wed, 17 Oct 2018 02:52:10 +0000 (19:52 -0700)
committerMarco Varlese <marco.varlese@suse.de>
Wed, 17 Oct 2018 07:32:46 +0000 (07:32 +0000)
Change-Id: If81ee34e1f1e929de1a5b758ddb9aede4002e858
Signed-off-by: Florin Coras <fcoras@cisco.com>
src/plugins/unittest/tcp_test.c
src/vnet/tcp/tcp.c
src/vnet/tcp/tcp_input.c

index d26532d..33a7fd6 100644 (file)
@@ -1580,7 +1580,6 @@ tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input)
   tc->connection.proto = TRANSPORT_PROTO_TCP;
   tc->connection.is_ip4 = 1;
   clib_memcpy (tc1, &tc->connection, sizeof (*tc1));
-  s1 = s;
 
   /*
    * Allocate fake session and connection 2
@@ -1607,6 +1606,7 @@ tcp_test_lookup (vlib_main_t * vm, unformat_input_t * input)
    * Confirm that connection lookup works
    */
 
+  s1 = pool_elt_at_index (smm->sessions[0], 0);
   session_lookup_add_connection (tc1, session_handle (s1));
   tconn = session_lookup_connection_wt4 (0, &tc1->lcl_ip.ip4,
                                         &tc1->rmt_ip.ip4,
index 1c8ce34..884602d 100644 (file)
@@ -939,9 +939,11 @@ format_tcp_scoreboard (u8 * s, va_list * args)
   s = format (s, "sacked_bytes %u last_sacked_bytes %u lost_bytes %u\n",
              sb->sacked_bytes, sb->last_sacked_bytes, sb->lost_bytes);
   s = format (s, " last_bytes_delivered %u high_sacked %u snd_una_adv %u\n",
-             sb->last_bytes_delivered, sb->high_sacked, sb->snd_una_adv);
+             sb->last_bytes_delivered, sb->high_sacked - tc->iss,
+             sb->snd_una_adv);
   s = format (s, " cur_rxt_hole %u high_rxt %u rescue_rxt %u",
-             sb->cur_rxt_hole, sb->high_rxt, sb->rescue_rxt);
+             sb->cur_rxt_hole, sb->high_rxt - tc->iss,
+             sb->rescue_rxt - tc->iss);
 
   hole = scoreboard_first_hole (sb);
   if (hole)
index 10f50fe..85aaa16 100644 (file)
@@ -135,7 +135,8 @@ tcp_options_parse (tcp_header_t * th, tcp_options_t * to)
   data = (const u8 *) (th + 1);
 
   /* Zero out all flags but those set in SYN */
-  to->flags &= (TCP_OPTS_FLAG_SACK_PERMITTED | TCP_OPTS_FLAG_WSCALE);
+  to->flags &= (TCP_OPTS_FLAG_SACK_PERMITTED | TCP_OPTS_FLAG_WSCALE
+               | TCP_OPTS_FLAG_SACK);
 
   for (; opts_len > 0; opts_len -= opt_len, data += opt_len)
     {