summaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp_timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/tcp/tcp_timer.h')
-rw-r--r--src/vnet/tcp/tcp_timer.h32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/vnet/tcp/tcp_timer.h b/src/vnet/tcp/tcp_timer.h
index 5f14a71ee7d..7f7dbf193eb 100644
--- a/src/vnet/tcp/tcp_timer.h
+++ b/src/vnet/tcp/tcp_timer.h
@@ -51,6 +51,13 @@ tcp_timer_update (tcp_timer_wheel_t * tw, tcp_connection_t * tc, u8 timer_id,
timer_id, interval);
}
+always_inline u8
+tcp_timer_is_active (tcp_connection_t *tc, tcp_timers_e timer)
+{
+ return tc->timers[timer] != TCP_TIMER_HANDLE_INVALID ||
+ (tc->pending_timers & (1 << timer));
+}
+
always_inline void
tcp_retransmit_timer_set (tcp_timer_wheel_t * tw, tcp_connection_t * tc)
{
@@ -74,19 +81,6 @@ tcp_persist_timer_set (tcp_timer_wheel_t * tw, tcp_connection_t * tc)
}
always_inline void
-tcp_persist_timer_update (tcp_timer_wheel_t * tw, tcp_connection_t * tc)
-{
- u32 interval;
-
- if (seq_leq (tc->snd_una, tc->snd_congestion + tc->burst_acked))
- interval = 1;
- else
- interval = clib_max ((u32) tc->rto * TCP_TO_TIMER_TICK, 1);
-
- tcp_timer_update (tw, tc, TCP_TIMER_PERSIST, interval);
-}
-
-always_inline void
tcp_persist_timer_reset (tcp_timer_wheel_t * tw, tcp_connection_t * tc)
{
tcp_timer_reset (tw, tc, TCP_TIMER_PERSIST);
@@ -98,21 +92,15 @@ tcp_retransmit_timer_update (tcp_timer_wheel_t * tw, tcp_connection_t * tc)
if (tc->snd_una == tc->snd_nxt)
{
tcp_retransmit_timer_reset (tw, tc);
- if (tc->snd_wnd < tc->snd_mss)
- tcp_persist_timer_update (tw, tc);
+ if (tc->snd_wnd < tc->snd_mss &&
+ !tcp_timer_is_active (tc, TCP_TIMER_PERSIST))
+ tcp_persist_timer_set (tw, tc);
}
else
tcp_timer_update (tw, tc, TCP_TIMER_RETRANSMIT,
clib_max ((u32) tc->rto * TCP_TO_TIMER_TICK, 1));
}
-always_inline u8
-tcp_timer_is_active (tcp_connection_t * tc, tcp_timers_e timer)
-{
- return tc->timers[timer] != TCP_TIMER_HANDLE_INVALID
- || (tc->pending_timers & (1 << timer));
-}
-
always_inline void
tcp_timer_expire_timers (tcp_timer_wheel_t * tw, f64 now)
{