aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_timer.c
diff options
context:
space:
mode:
authorRandall Stewart <rrs@FreeBSD.org>2016-04-28 13:27:12 +0000
committerRandall Stewart <rrs@FreeBSD.org>2016-04-28 13:27:12 +0000
commite5ad64562a541c3b882789adec036387efd2986c (patch)
treec82ebe02d26bb553d2eb18b0db5e5a73bb688e89 /sys/netinet/tcp_timer.c
parent329ee7e3dc2632c941ac63ad70833a95b91527e7 (diff)
downloadsrc-e5ad64562a541c3b882789adec036387efd2986c.tar.gz
src-e5ad64562a541c3b882789adec036387efd2986c.zip
This cleans up the timers code in TCP to start using the new
async_drain functionality. This as been tested in NF as well as by Verisign. Still to do in here is to remove all the old flags. They are currently left being maintained but probably are no longer needed. Sponsored by: Netflix Inc. Differential Revision: http://reviews.freebsd.org/D5924
Notes
Notes: svn path=/head/; revision=298743
Diffstat (limited to 'sys/netinet/tcp_timer.c')
-rw-r--r--sys/netinet/tcp_timer.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 172c39419739..5d6865c6bf4d 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -927,7 +927,6 @@ void
tcp_timer_stop(struct tcpcb *tp, uint32_t timer_type)
{
struct callout *t_callout;
- timeout_t *f_callout;
uint32_t f_reset;
tp->t_timers->tt_flags |= TT_STOPPED;
@@ -935,27 +934,22 @@ tcp_timer_stop(struct tcpcb *tp, uint32_t timer_type)
switch (timer_type) {
case TT_DELACK:
t_callout = &tp->t_timers->tt_delack;
- f_callout = tcp_timer_delack_discard;
f_reset = TT_DELACK_RST;
break;
case TT_REXMT:
t_callout = &tp->t_timers->tt_rexmt;
- f_callout = tcp_timer_rexmt_discard;
f_reset = TT_REXMT_RST;
break;
case TT_PERSIST:
t_callout = &tp->t_timers->tt_persist;
- f_callout = tcp_timer_persist_discard;
f_reset = TT_PERSIST_RST;
break;
case TT_KEEP:
t_callout = &tp->t_timers->tt_keep;
- f_callout = tcp_timer_keep_discard;
f_reset = TT_KEEP_RST;
break;
case TT_2MSL:
t_callout = &tp->t_timers->tt_2msl;
- f_callout = tcp_timer_2msl_discard;
f_reset = TT_2MSL_RST;
break;
default:
@@ -971,21 +965,13 @@ tcp_timer_stop(struct tcpcb *tp, uint32_t timer_type)
}
if (tp->t_timers->tt_flags & timer_type) {
- if ((callout_stop(t_callout) > 0) &&
- (tp->t_timers->tt_flags & f_reset)) {
- tp->t_timers->tt_flags &= ~(timer_type | f_reset);
- } else {
+ if (callout_async_drain(t_callout, tcp_timer_discard) == 0) {
/*
* Can't stop the callout, defer tcpcb actual deletion
- * to the last tcp timer discard callout.
- * The TT_STOPPED flag will ensure that no tcp timer
- * callouts can be restarted on our behalf, and
- * past this point currently running callouts waiting
- * on inp lock will return right away after the
- * classical check for callout reset/stop events:
- * callout_pending() || !callout_active()
+ * to the last one. We do this using the async drain
+ * function and incrementing the count in
*/
- callout_reset(t_callout, 1, f_callout, tp);
+ tp->t_timers->tt_draincnt++;
}
}
}