tcp: do not overcount ooo bytes 34/37034/2
authorFlorin Coras <fcoras@cisco.com>
Mon, 29 Aug 2022 18:35:53 +0000 (11:35 -0700)
committerDamjan Marion <dmarion@0xa5.net>
Tue, 30 Aug 2022 18:14:26 +0000 (18:14 +0000)
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ic81702bffb5b3189db48efe1ab3b237fa2bf75f2

src/vnet/tcp/tcp_input.c

index 4950553..a6d1358 100644 (file)
@@ -1149,7 +1149,6 @@ tcp_session_enqueue_data (tcp_connection_t * tc, vlib_buffer_t * b,
   ASSERT (data_len);
   written = session_enqueue_stream_connection (&tc->connection, b, 0,
                                               1 /* queue event */ , 1);
-  tc->bytes_in += written;
 
   TCP_EVT (TCP_EVT_INPUT, tc, 0, data_len, written);
 
@@ -1157,17 +1156,20 @@ tcp_session_enqueue_data (tcp_connection_t * tc, vlib_buffer_t * b,
   if (PREDICT_TRUE (written == data_len))
     {
       tc->rcv_nxt += written;
+      tc->bytes_in += written;
     }
   /* If more data written than expected, account for out-of-order bytes. */
   else if (written > data_len)
     {
       tc->rcv_nxt += written;
+      tc->bytes_in += data_len;
       TCP_EVT (TCP_EVT_CC_INPUT, tc, data_len, written);
     }
   else if (written > 0)
     {
       /* We've written something but FIFO is probably full now */
       tc->rcv_nxt += written;
+      tc->bytes_in += written;
       error = TCP_ERROR_PARTIALLY_ENQUEUED;
     }
   else