From 53e97a895b3965eb3ce51576bbbc5b9c4f91d736 Mon Sep 17 00:00:00 2001 From: rwatson Date: Tue, 23 Nov 2004 16:45:07 +0000 Subject: De-spl tcp_slowtimo; tcp_maxidle assignment is subject to possible but unlikely races that could be corrected by having tcp_keepcnt and tcp_keepintvl modifications go through handler functions via sysctl, but probably is not worth doing. Updates to multiple sysctls within evaluation of a single addition are unlikely. Annotate that tcp_canceltimers() is currently unused. De-spl tcp_timer_delack(). De-spl tcp_timer_2msl(). MFC after: 2 weeks --- sys/netinet/tcp_timer.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'sys/netinet') diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 1ecf33d..d4ae4a9 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -130,11 +130,15 @@ int tcp_maxidle; void tcp_slowtimo() { - int s; - s = splnet(); + /* + * XXXRW: Note that there is a minor race issue associated with rapid + * modification of the two components of tcp_maxidle. This could be + * corrected by introducing sysctl handlers for those two fields, + * sliding this update of tcp_maxidle under the tcbinfo lock, and + * acquiring that lock in the handlers. + */ tcp_maxidle = tcp_keepcnt * tcp_keepintvl; - splx(s); INP_INFO_WLOCK(&tcbinfo); (void) tcp_timer_2msl_tw(0); INP_INFO_WUNLOCK(&tcbinfo); @@ -142,6 +146,8 @@ tcp_slowtimo() /* * Cancel all timers for TCP tp. + * + * XXXRW: This appears to be unused. */ void tcp_canceltimers(tp) @@ -170,22 +176,18 @@ tcp_timer_delack(xtp) void *xtp; { struct tcpcb *tp = xtp; - int s; struct inpcb *inp; - s = splnet(); INP_INFO_RLOCK(&tcbinfo); inp = tp->t_inpcb; - if (!inp) { + if (inp == NULL) { INP_INFO_RUNLOCK(&tcbinfo); - splx(s); return; } INP_LOCK(inp); INP_INFO_RUNLOCK(&tcbinfo); if (callout_pending(tp->tt_delack) || !callout_active(tp->tt_delack)) { INP_UNLOCK(inp); - splx(s); return; } callout_deactivate(tp->tt_delack); @@ -194,7 +196,6 @@ tcp_timer_delack(xtp) tcpstat.tcps_delack++; (void) tcp_output(tp); INP_UNLOCK(inp); - splx(s); } void @@ -202,19 +203,16 @@ tcp_timer_2msl(xtp) void *xtp; { struct tcpcb *tp = xtp; - int s; struct inpcb *inp; #ifdef TCPDEBUG int ostate; ostate = tp->t_state; #endif - s = splnet(); INP_INFO_WLOCK(&tcbinfo); inp = tp->t_inpcb; - if (!inp) { + if (inp == NULL) { INP_INFO_WUNLOCK(&tcbinfo); - splx(s); return; } INP_LOCK(inp); @@ -222,7 +220,6 @@ tcp_timer_2msl(xtp) if (callout_pending(tp->tt_2msl) || !callout_active(tp->tt_2msl)) { INP_UNLOCK(tp->t_inpcb); INP_INFO_WUNLOCK(&tcbinfo); - splx(s); return; } callout_deactivate(tp->tt_2msl); @@ -247,7 +244,6 @@ tcp_timer_2msl(xtp) if (tp) INP_UNLOCK(inp); INP_INFO_WUNLOCK(&tcbinfo); - splx(s); } struct twlist { -- cgit v1.1