Session layer improvements
[vpp.git] / src / vnet / tcp / tcp_output.c
index d2fa1d7..4e1a7aa 100644 (file)
@@ -993,6 +993,7 @@ tcp_prepare_retransmit_segment (tcp_connection_t * tc, vlib_buffer_t * b,
   ASSERT (n_bytes != 0);
   b->current_length = n_bytes;
   tcp_push_hdr_i (tc, b, tc->state);
+  tc->rtx_bytes += n_bytes;
 
 done:
   TCP_EVT_DBG (TCP_EVT_CC_RTX, tc, offset, n_bytes);
@@ -1089,8 +1090,6 @@ tcp_timer_retransmit_handler_i (u32 index, u8 is_syn)
 
          if (n_bytes == 0)
            return;
-
-         tc->rtx_bytes += n_bytes;
        }
     }
   else
@@ -1217,10 +1216,12 @@ tcp_retransmit_first_unacked (tcp_connection_t * tc)
 
   n_bytes = tcp_prepare_retransmit_segment (tc, b, 0, tc->snd_mss);
   if (n_bytes == 0)
-    return;
+    goto done;
 
   tcp_enqueue_to_output (vm, b, bi, tc->c_is_ip4);
-  tc->rtx_bytes += n_bytes;
+
+done:
+  tc->snd_nxt = tc->snd_una_max;
 }
 
 sack_scoreboard_hole_t *
@@ -1294,7 +1295,6 @@ tcp_fast_retransmit (tcp_connection_t * tc)
        }
 
       tcp_enqueue_to_output (vm, b, bi, tc->c_is_ip4);
-      tc->rtx_bytes += n_written;
       snd_space -= n_written;
     }
 
@@ -1558,7 +1558,6 @@ tcp46_send_reset_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          vlib_buffer_t *b0;
          tcp_tx_trace_t *t0;
          tcp_header_t *th0;
-         tcp_connection_t *tc0;
          u32 error0 = TCP_ERROR_RST_SENT, next0 = TCP_RESET_NEXT_IP_LOOKUP;
 
          bi0 = from[0];
@@ -1592,13 +1591,8 @@ tcp46_send_reset_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
                th0 = ip4_next_header ((ip4_header_t *) th0);
              else
                th0 = ip6_next_header ((ip6_header_t *) th0);
-             tc0 =
-               tcp_connection_get (vnet_buffer (b0)->tcp.connection_index,
-                                   my_thread_index);
              t0 = vlib_add_trace (vm, node, b0, sizeof (*t0));
              clib_memcpy (&t0->tcp_header, th0, sizeof (t0->tcp_header));
-             clib_memcpy (&t0->tcp_connection, tc0,
-                          sizeof (t0->tcp_connection));
            }
 
          vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,