session tcp: support pacer idle timeouts
[vpp.git] / src / vnet / tcp / tcp.h
index 4b0a0dd..e9247eb 100644 (file)
@@ -394,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 */
@@ -882,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);
 }
 
 /**
@@ -1171,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