summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2007-09-24 05:26:24 +0000
committersilby <silby@FreeBSD.org>2007-09-24 05:26:24 +0000
commit5fb86a6fa7067f2023943bf20c272b613c52b73e (patch)
tree8813a8872672cef81ebde1a54cef904ff70105d0
parentea91086eb3bb58ad24d41a614930a54819c9b9d0 (diff)
downloadFreeBSD-src-5fb86a6fa7067f2023943bf20c272b613c52b73e.zip
FreeBSD-src-5fb86a6fa7067f2023943bf20c272b613c52b73e.tar.gz
Two changes:
- Reintegrate the ANSI C function declaration change from tcp_timer.c rev 1.92 - Reorganize the tcpcb structure so that it has a single pointer to the "tcp_timer" structure which contains all of the tcp timer callouts. This change means that when the single tcp timer change is reintegrated, tcpcb will not change in size, and therefore the ABI between netstat and the kernel will not change. Neither of these changes should have any functional impact. Reviewed by: bmah, rrs Approved by: re (bmah)
-rw-r--r--sys/netinet/tcp_subr.c24
-rw-r--r--sys/netinet/tcp_timer.c58
-rw-r--r--sys/netinet/tcp_timer.h7
-rw-r--r--sys/netinet/tcp_usrreq.c6
-rw-r--r--sys/netinet/tcp_var.h6
5 files changed, 52 insertions, 49 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index d907380..0dde162 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -214,8 +214,7 @@ static void tcp_isn_tick(void *);
*/
struct tcpcb_mem {
struct tcpcb tcb;
- struct callout tcpcb_mem_rexmt, tcpcb_mem_persist, tcpcb_mem_keep;
- struct callout tcpcb_mem_2msl, tcpcb_mem_delack;
+ struct tcp_timer tt;
};
static uma_zone_t tcpcb_zone;
@@ -590,6 +589,7 @@ tcp_newtcpcb(struct inpcb *inp)
if (tm == NULL)
return (NULL);
tp = &tm->tcb;
+ tp->t_timers = &tm->tt;
/* LIST_INIT(&tp->t_segq); */ /* XXX covered by M_ZERO */
tp->t_maxseg = tp->t_maxopd =
#ifdef INET6
@@ -598,11 +598,11 @@ tcp_newtcpcb(struct inpcb *inp)
tcp_mssdflt;
/* Set up our timeouts. */
- callout_init(tp->tt_rexmt = &tm->tcpcb_mem_rexmt, CALLOUT_MPSAFE);
- callout_init(tp->tt_persist = &tm->tcpcb_mem_persist, CALLOUT_MPSAFE);
- callout_init(tp->tt_keep = &tm->tcpcb_mem_keep, CALLOUT_MPSAFE);
- callout_init(tp->tt_2msl = &tm->tcpcb_mem_2msl, CALLOUT_MPSAFE);
- callout_init(tp->tt_delack = &tm->tcpcb_mem_delack, CALLOUT_MPSAFE);
+ callout_init(&tp->t_timers->tt_rexmt, CALLOUT_MPSAFE);
+ callout_init(&tp->t_timers->tt_persist, CALLOUT_MPSAFE);
+ callout_init(&tp->t_timers->tt_keep, CALLOUT_MPSAFE);
+ callout_init(&tp->t_timers->tt_2msl, CALLOUT_MPSAFE);
+ callout_init(&tp->t_timers->tt_delack, CALLOUT_MPSAFE);
if (tcp_do_rfc1323)
tp->t_flags = (TF_REQ_SCALE|TF_REQ_TSTMP);
@@ -675,11 +675,11 @@ tcp_discardcb(struct tcpcb *tp)
* Make sure that all of our timers are stopped before we
* delete the PCB.
*/
- callout_stop(tp->tt_rexmt);
- callout_stop(tp->tt_persist);
- callout_stop(tp->tt_keep);
- callout_stop(tp->tt_2msl);
- callout_stop(tp->tt_delack);
+ callout_stop(&tp->t_timers->tt_rexmt);
+ callout_stop(&tp->t_timers->tt_persist);
+ callout_stop(&tp->t_timers->tt_keep);
+ callout_stop(&tp->t_timers->tt_2msl);
+ callout_stop(&tp->t_timers->tt_delack);
/*
* If we got enough samples through the srtt filter,
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 775d98e..6680e9b 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -119,7 +119,7 @@ int tcp_maxidle;
* causes finite state machine actions if timers expire.
*/
void
-tcp_slowtimo()
+tcp_slowtimo(void)
{
tcp_maxidle = tcp_keepcnt * tcp_keepintvl;
@@ -166,12 +166,12 @@ tcp_timer_delack(void *xtp)
}
INP_LOCK(inp);
INP_INFO_RUNLOCK(&tcbinfo);
- if ((inp->inp_vflag & INP_DROPPED) || callout_pending(tp->tt_delack)
- || !callout_active(tp->tt_delack)) {
+ if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_delack)
+ || !callout_active(&tp->t_timers->tt_delack)) {
INP_UNLOCK(inp);
return;
}
- callout_deactivate(tp->tt_delack);
+ callout_deactivate(&tp->t_timers->tt_delack);
tp->t_flags |= TF_ACKNOW;
tcpstat.tcps_delack++;
@@ -208,13 +208,13 @@ tcp_timer_2msl(void *xtp)
}
INP_LOCK(inp);
tcp_free_sackholes(tp);
- if ((inp->inp_vflag & INP_DROPPED) || callout_pending(tp->tt_2msl) ||
- !callout_active(tp->tt_2msl)) {
+ if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_2msl) ||
+ !callout_active(&tp->t_timers->tt_2msl)) {
INP_UNLOCK(tp->t_inpcb);
INP_INFO_WUNLOCK(&tcbinfo);
return;
}
- callout_deactivate(tp->tt_2msl);
+ callout_deactivate(&tp->t_timers->tt_2msl);
/*
* 2 MSL timeout in shutdown went off. If we're closed but
* still waiting for peer to close and connection has been idle
@@ -233,7 +233,7 @@ tcp_timer_2msl(void *xtp)
} else {
if (tp->t_state != TCPS_TIME_WAIT &&
(ticks - tp->t_rcvtime) <= tcp_maxidle)
- callout_reset(tp->tt_2msl, tcp_keepintvl,
+ callout_reset(&tp->t_timers->tt_2msl, tcp_keepintvl,
tcp_timer_2msl, tp);
else
tp = tcp_close(tp);
@@ -275,13 +275,13 @@ tcp_timer_keep(void *xtp)
return;
}
INP_LOCK(inp);
- if ((inp->inp_vflag & INP_DROPPED) || callout_pending(tp->tt_keep)
- || !callout_active(tp->tt_keep)) {
+ if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_keep)
+ || !callout_active(&tp->t_timers->tt_keep)) {
INP_UNLOCK(inp);
INP_INFO_WUNLOCK(&tcbinfo);
return;
}
- callout_deactivate(tp->tt_keep);
+ callout_deactivate(&tp->t_timers->tt_keep);
/*
* Keep-alive timer went off; send something
* or drop connection if idle for too long.
@@ -313,9 +313,9 @@ tcp_timer_keep(void *xtp)
tp->rcv_nxt, tp->snd_una - 1, 0);
(void) m_free(dtom(t_template));
}
- callout_reset(tp->tt_keep, tcp_keepintvl, tcp_timer_keep, tp);
+ callout_reset(&tp->t_timers->tt_keep, tcp_keepintvl, tcp_timer_keep, tp);
} else
- callout_reset(tp->tt_keep, tcp_keepidle, tcp_timer_keep, tp);
+ callout_reset(&tp->t_timers->tt_keep, tcp_keepidle, tcp_timer_keep, tp);
#ifdef TCPDEBUG
if (inp->inp_socket->so_options & SO_DEBUG)
@@ -365,13 +365,13 @@ tcp_timer_persist(void *xtp)
return;
}
INP_LOCK(inp);
- if ((inp->inp_vflag & INP_DROPPED) || callout_pending(tp->tt_persist)
- || !callout_active(tp->tt_persist)) {
+ if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_persist)
+ || !callout_active(&tp->t_timers->tt_persist)) {
INP_UNLOCK(inp);
INP_INFO_WUNLOCK(&tcbinfo);
return;
}
- callout_deactivate(tp->tt_persist);
+ callout_deactivate(&tp->t_timers->tt_persist);
/*
* Persistance timer into zero window.
* Force a byte to be output, if possible.
@@ -434,13 +434,13 @@ tcp_timer_rexmt(void * xtp)
return;
}
INP_LOCK(inp);
- if ((inp->inp_vflag & INP_DROPPED) || callout_pending(tp->tt_rexmt)
- || !callout_active(tp->tt_rexmt)) {
+ if ((inp->inp_vflag & INP_DROPPED) || callout_pending(&tp->t_timers->tt_rexmt)
+ || !callout_active(&tp->t_timers->tt_rexmt)) {
INP_UNLOCK(inp);
INP_INFO_WUNLOCK(&tcbinfo);
return;
}
- callout_deactivate(tp->tt_rexmt);
+ callout_deactivate(&tp->t_timers->tt_rexmt);
tcp_free_sackholes(tp);
/*
* Retransmission timer went off. Message has not
@@ -571,23 +571,23 @@ tcp_timer_activate(struct tcpcb *tp, int timer_type, u_int delta)
switch (timer_type) {
case TT_DELACK:
- t_callout = tp->tt_delack;
+ t_callout = &tp->t_timers->tt_delack;
f_callout = tcp_timer_delack;
break;
case TT_REXMT:
- t_callout = tp->tt_rexmt;
+ t_callout = &tp->t_timers->tt_rexmt;
f_callout = tcp_timer_rexmt;
break;
case TT_PERSIST:
- t_callout = tp->tt_persist;
+ t_callout = &tp->t_timers->tt_persist;
f_callout = tcp_timer_persist;
break;
case TT_KEEP:
- t_callout = tp->tt_keep;
+ t_callout = &tp->t_timers->tt_keep;
f_callout = tcp_timer_keep;
break;
case TT_2MSL:
- t_callout = tp->tt_2msl;
+ t_callout = &tp->t_timers->tt_2msl;
f_callout = tcp_timer_2msl;
break;
default:
@@ -607,19 +607,19 @@ tcp_timer_active(struct tcpcb *tp, int timer_type)
switch (timer_type) {
case TT_DELACK:
- t_callout = tp->tt_delack;
+ t_callout = &tp->t_timers->tt_delack;
break;
case TT_REXMT:
- t_callout = tp->tt_rexmt;
+ t_callout = &tp->t_timers->tt_rexmt;
break;
case TT_PERSIST:
- t_callout = tp->tt_persist;
+ t_callout = &tp->t_timers->tt_persist;
break;
case TT_KEEP:
- t_callout = tp->tt_keep;
+ t_callout = &tp->t_timers->tt_keep;
break;
case TT_2MSL:
- t_callout = tp->tt_2msl;
+ t_callout = &tp->t_timers->tt_2msl;
break;
default:
panic("bad timer_type");
diff --git a/sys/netinet/tcp_timer.h b/sys/netinet/tcp_timer.h
index 83b4958..ff455b6 100644
--- a/sys/netinet/tcp_timer.h
+++ b/sys/netinet/tcp_timer.h
@@ -141,6 +141,13 @@ static const char *tcptimers[] =
#ifdef _KERNEL
+struct tcp_timer {
+ struct callout tt_rexmt; /* retransmit timer */
+ struct callout tt_persist; /* retransmit persistence */
+ struct callout tt_keep; /* keepalive */
+ struct callout tt_2msl; /* 2*msl TIME_WAIT timer */
+ struct callout tt_delack; /* delayed ACK timer */
+};
#define TT_DELACK 0x01
#define TT_REXMT 0x02
#define TT_PERSIST 0x04
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index bfef57f..de44d61 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1744,11 +1744,11 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent)
db_print_indent(indent);
db_printf("tt_rexmt: %p tt_persist: %p tt_keep: %p\n",
- tp->tt_rexmt, tp->tt_persist, tp->tt_keep);
+ &tp->t_timers->tt_rexmt, &tp->t_timers->tt_persist, &tp->t_timers->tt_keep);
db_print_indent(indent);
- db_printf("tt_2msl: %p tt_delack: %p t_inpcb: %p\n", tp->tt_2msl,
- tp->tt_delack, tp->t_inpcb);
+ db_printf("tt_2msl: %p tt_delack: %p t_inpcb: %p\n", &tp->t_timers->tt_2msl,
+ &tp->t_timers->tt_delack, tp->t_inpcb);
db_print_indent(indent);
db_printf("t_state: %d (", tp->t_state);
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 38114a3..b2bdecc 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -96,11 +96,7 @@ struct tcpcb {
int t_segqlen; /* segment reassembly queue length */
int t_dupacks; /* consecutive dup acks recd */
- struct callout *tt_rexmt; /* retransmit timer */
- struct callout *tt_persist; /* retransmit persistence */
- struct callout *tt_keep; /* keepalive */
- struct callout *tt_2msl; /* 2*msl TIME_WAIT timer */
- struct callout *tt_delack; /* delayed ACK timer */
+ struct tcp_timer *t_timers; /* All the TCP timers in one struct */
struct inpcb *t_inpcb; /* back pointer to internet pcb */
int t_state; /* state of this connection */
OpenPOWER on IntegriCloud