session tcp: support pacer idle timeouts
[vpp.git] / src / vnet / tcp / tcp.h
index 825099a..e9247eb 100644 (file)
@@ -140,7 +140,6 @@ typedef enum tcp_cfg_flag_
   _(DEQ_PENDING, "Dequeue pending ")           \
   _(PSH_PENDING, "PSH pending")                        \
   _(FINRCVD, "FIN received")                   \
-  _(TRACK_BURST, "Track burst")                        \
   _(ZERO_RWND_SENT, "Zero RWND sent")          \
 
 typedef enum tcp_connection_flag_bits_
@@ -256,6 +255,8 @@ typedef enum tcp_bts_flags_
 {
   TCP_BTS_IS_RXT = 1,
   TCP_BTS_IS_APP_LIMITED = 1 << 1,
+  TCP_BTS_IS_SACKED = 1 << 2,
+  TCP_BTS_IS_RXT_LOST = 1 << 3,
 } __clib_packed tcp_bts_flags_t;
 
 typedef struct tcp_bt_sample_
@@ -393,7 +394,6 @@ typedef struct _tcp_connection
   u32 prr_start;       /**< snd_una when prr starts */
   u32 rxt_delivered;   /**< Rxt bytes delivered during current cc event */
   u32 rxt_head;                /**< snd_una last time we re rxted the head */
-  u32 prev_dsegs_out;  /**< Number of dsegs after last ack */
   u32 tsecr_last_ack;  /**< Timestamp echoed to us in last healthy ACK */
   u32 snd_congestion;  /**< snd_una_max when congestion is detected */
   u32 tx_fifo_size;    /**< Tx fifo size. Used to constrain cwnd */
@@ -434,6 +434,7 @@ typedef struct _tcp_connection
   u32 last_fib_check;  /**< Last time we checked fib route for peer */
   u16 mss;             /**< Our max seg size that includes options */
   u32 timestamp_delta; /**< Offset for timestamp */
+  u32 ipv6_flow_label; /**< flow label for ipv6 header */
 } tcp_connection_t;
 
 /* *INDENT-OFF* */
@@ -510,9 +511,6 @@ typedef struct tcp_worker_ctx_
   /** tx buffer free list */
   u32 *tx_buffers;
 
-  /** tx frames for tcp 4/6 output nodes */
-  vlib_frame_t *tx_frames[2];
-
   /** tx frames for ip 4/6 lookup nodes */
   vlib_frame_t *ip_lookup_tx_frames[2];
 
@@ -789,7 +787,6 @@ void tcp_send_fin (tcp_connection_t * tc);
 void tcp_send_ack (tcp_connection_t * tc);
 void tcp_update_burst_snd_vars (tcp_connection_t * tc);
 void tcp_update_rto (tcp_connection_t * tc);
-void tcp_flush_frame_to_output (tcp_worker_ctx_t * wrk, u8 is_ip4);
 void tcp_flush_frames_to_output (tcp_worker_ctx_t * wrk);
 void tcp_send_window_update_ack (tcp_connection_t * tc);
 
@@ -825,7 +822,7 @@ void tcp_bt_flush_samples (tcp_connection_t * tc);
  *
  * @param tc   tcp connection
  */
-void tcp_bt_track_tx (tcp_connection_t * tc);
+void tcp_bt_track_tx (tcp_connection_t * tc, u32 len);
 /**
  * Track a tcp retransmission
  *
@@ -856,6 +853,7 @@ void tcp_bt_check_app_limited (tcp_connection_t * tc);
  * @param bt   byte tracker
  */
 int tcp_bt_is_sane (tcp_byte_tracker_t * bt);
+u8 *format_tcp_bt (u8 * s, va_list * args);
 
 always_inline u32
 tcp_end_seq (tcp_header_t * th, u32 len)
@@ -883,7 +881,8 @@ tcp_bytes_out (const tcp_connection_t * tc)
   if (tcp_opts_sack_permitted (&tc->rcv_opts))
     return tc->sack_sb.sacked_bytes + tc->sack_sb.lost_bytes;
   else
-    return tc->rcv_dupacks * tc->snd_mss;
+    return clib_min (tc->rcv_dupacks * tc->snd_mss,
+                    tc->snd_nxt - tc->snd_una);
 }
 
 /**
@@ -1172,8 +1171,14 @@ tcp_persist_timer_set (tcp_connection_t * tc)
 always_inline void
 tcp_persist_timer_update (tcp_connection_t * tc)
 {
-  tcp_timer_update (tc, TCP_TIMER_PERSIST,
-                   clib_max (tc->rto * TCP_TO_TIMER_TICK, 1));
+  u32 interval;
+
+  if (seq_leq (tc->snd_una, tc->snd_congestion + tc->burst_acked))
+    interval = 1;
+  else
+    interval = clib_max (tc->rto * TCP_TO_TIMER_TICK, 1);
+
+  tcp_timer_update (tc, TCP_TIMER_PERSIST, interval);
 }
 
 always_inline void