tcp: improve rcv process ack processing
[vpp.git] / src / vnet / tcp / tcp.h
index 65182c4..46d72b7 100644 (file)
@@ -117,7 +117,6 @@ extern timer_expiration_handler tcp_timer_retransmit_syn_handler;
 #define foreach_tcp_connection_flag             \
   _(SNDACK, "Send ACK")                         \
   _(FINSNT, "FIN sent")                                \
-  _(SENT_RCV_WND0, "Sent 0 rcv_wnd")           \
   _(RECOVERY, "Recovery")                      \
   _(FAST_RECOVERY, "Fast Recovery")            \
   _(DCNT_PENDING, "Disconnect pending")                \
@@ -127,6 +126,7 @@ extern timer_expiration_handler tcp_timer_retransmit_syn_handler;
   _(FRXT_FIRST, "Fast-retransmit first again") \
   _(DEQ_PENDING, "Pending dequeue acked")      \
   _(PSH_PENDING, "PSH pending")                        \
+  _(FINRCVD, "FIN received")                   \
 
 typedef enum _tcp_connection_flag_bits
 {
@@ -144,26 +144,6 @@ typedef enum _tcp_connection_flag
   TCP_CONN_N_FLAGS
 } tcp_connection_flags_e;
 
-/** TCP buffer flags */
-#define foreach_tcp_buf_flag                            \
-  _ (ACK)       /**< Sending ACK. */                    \
-  _ (DUPACK)    /**< Sending DUPACK. */                 \
-
-enum
-{
-#define _(f) TCP_BUF_BIT_##f,
-  foreach_tcp_buf_flag
-#undef _
-    TCP_N_BUF_BITS,
-};
-
-enum
-{
-#define _(f) TCP_BUF_FLAG_##f = 1 << TCP_BUF_BIT_##f,
-  foreach_tcp_buf_flag
-#undef _
-};
-
 #define TCP_SCOREBOARD_TRACE (0)
 #define TCP_MAX_SACK_BLOCKS 256        /**< Max number of SACK blocks stored */
 #define TCP_INVALID_SACK_HOLE_INDEX ((u32)~0)
@@ -475,6 +455,9 @@ typedef struct _tcp_main
   /* Seed used to generate random iss */
   tcp_iss_seed_t iss_seed;
 
+  /** Hash table of cc algorithms by name */
+  uword *cc_algo_by_name;
+
   /*
    * Configuration
    */
@@ -486,6 +469,9 @@ typedef struct _tcp_main
    *  rfc 7323 window scaling factor */
   u32 max_rx_fifo;
 
+  /** Default MTU to be used when establishing connections */
+  u16 default_mtu;
+
   /** Number of preallocated connections */
   u32 preallocated_connections;
   u32 preallocated_half_open_connections;
@@ -515,6 +501,14 @@ extern vlib_node_registration_t tcp4_input_node;
 extern vlib_node_registration_t tcp6_input_node;
 extern vlib_node_registration_t tcp4_output_node;
 extern vlib_node_registration_t tcp6_output_node;
+extern vlib_node_registration_t tcp4_established_node;
+extern vlib_node_registration_t tcp6_established_node;
+extern vlib_node_registration_t tcp4_syn_sent_node;
+extern vlib_node_registration_t tcp6_syn_sent_node;
+extern vlib_node_registration_t tcp4_rcv_process_node;
+extern vlib_node_registration_t tcp6_rcv_process_node;
+extern vlib_node_registration_t tcp4_listen_node;
+extern vlib_node_registration_t tcp6_listen_node;
 
 always_inline tcp_main_t *
 vnet_get_tcp_main ()
@@ -672,7 +666,7 @@ tcp_flight_size (const tcp_connection_t * tc)
 {
   int flight_size;
 
-  flight_size = (int) (tc->snd_una_max - tc->snd_una) - tcp_bytes_out (tc)
+  flight_size = (int) (tc->snd_nxt - tc->snd_una) - tcp_bytes_out (tc)
     + tc->snd_rxt_bytes;
 
   if (flight_size < 0)
@@ -812,7 +806,8 @@ tcp_set_time_now (tcp_worker_ctx_t * wrk)
   return wrk->time_now;
 }
 
-u32 tcp_push_header (tcp_connection_t * tconn, vlib_buffer_t * b);
+u32 tcp_session_push_header (transport_connection_t * tconn,
+                            vlib_buffer_t * b);
 
 void tcp_connection_timers_init (tcp_connection_t * tc);
 void tcp_connection_timers_reset (tcp_connection_t * tc);
@@ -915,7 +910,7 @@ tcp_persist_timer_reset (tcp_connection_t * tc)
 always_inline void
 tcp_retransmit_timer_update (tcp_connection_t * tc)
 {
-  if (tc->snd_una == tc->snd_una_max)
+  if (tc->snd_una == tc->snd_nxt)
     {
       tcp_retransmit_timer_reset (tc);
       if (tc->snd_wnd < tc->snd_mss)
@@ -934,7 +929,7 @@ tcp_timer_is_active (tcp_connection_t * tc, tcp_timers_e timer)
 
 #define tcp_validate_txf_size(_tc, _a)                                         \
   ASSERT(_tc->state != TCP_STATE_ESTABLISHED                           \
-        || session_tx_fifo_max_dequeue (&_tc->connection) >= _a)
+        || transport_max_tx_dequeue (&_tc->connection) >= _a)
 
 void tcp_rcv_sacks (tcp_connection_t * tc, u32 ack);
 u8 *tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose);