diff options
author | glebius <glebius@FreeBSD.org> | 2016-01-27 00:45:46 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2016-01-27 00:45:46 +0000 |
commit | 9487eaf98f45a433931bad91a3463694f5423688 (patch) | |
tree | dd0b39d31460d52fec634711ce845f26d7406828 /sys/netinet/tcp_subr.c | |
parent | 1a12f8d9a17a94b40aad848fb3fa61b3f0eb1acf (diff) | |
download | FreeBSD-src-9487eaf98f45a433931bad91a3463694f5423688.zip FreeBSD-src-9487eaf98f45a433931bad91a3463694f5423688.tar.gz |
Augment struct tcpstat with tcps_states[], which is used for book-keeping
the amount of TCP connections by state. Provides a cheap way to get
connection count without traversing the whole pcb list.
Sponsored by: Netflix
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r-- | sys/netinet/tcp_subr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 6358e81..b16f540 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1468,6 +1468,7 @@ tcp_close(struct tcpcb *tp) #endif in_pcbdrop(inp); TCPSTAT_INC(tcps_closed); + TCPSTAT_DEC(tcps_states[tp->t_state]); KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL")); so = inp->inp_socket; soisdisconnected(so); @@ -2910,6 +2911,8 @@ tcp_state_change(struct tcpcb *tp, int newstate) int pstate = tp->t_state; #endif + TCPSTAT_DEC(tcps_states[tp->t_state]); + TCPSTAT_INC(tcps_states[newstate]); tp->t_state = newstate; TCP_PROBE6(state__change, NULL, tp, NULL, tp, NULL, pstate); } |