summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-02-09 15:19:33 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2017-02-09 15:19:33 +0000
commit56f2e55e49aaf23d0837bf2acec5f2572233f640 (patch)
treebca8897ff05dee4c7ac5077623aa9297961a0c2c /sys/netinet/tcp_subr.c
parentdb7e392b45e8f2dbbe7184dbe24a4b3c4600c1b0 (diff)
percpu counters for TCP stats
ok mpi@ bluhm@
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 55ec3fe41fd..fac36f32b37 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.159 2017/01/26 13:03:47 bluhm Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.160 2017/02/09 15:19:32 jca Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -131,7 +131,7 @@ struct pool tcpqe_pool;
struct pool sackhl_pool;
#endif
-struct tcpstat tcpstat; /* tcp statistics */
+struct cpumem *tcpcounters; /* tcp statistics */
tcp_seq tcp_iss;
/*
@@ -152,6 +152,7 @@ tcp_init(void)
pool_sethardlimit(&sackhl_pool, tcp_sackhole_limit, NULL, 0);
#endif /* TCP_SACK */
in_pcbinit(&tcbtable, TCB_INITIAL_HASH_SIZE);
+ tcpcounters = counters_alloc(tcps_ncounters);
#ifdef INET6
/*
@@ -494,9 +495,9 @@ tcp_drop(struct tcpcb *tp, int errno)
if (TCPS_HAVERCVDSYN(tp->t_state)) {
tp->t_state = TCPS_CLOSED;
(void) tcp_output(tp);
- tcpstat.tcps_drops++;
+ tcpstat_inc(tcps_drops);
} else
- tcpstat.tcps_conndrops++;
+ tcpstat_inc(tcps_conndrops);
if (errno == ETIMEDOUT && tp->t_softerror)
errno = tp->t_softerror;
so->so_error = errno;
@@ -551,7 +552,7 @@ tcp_reaper(void *arg)
struct tcpcb *tp = arg;
pool_put(&tcpcb_pool, tp);
- tcpstat.tcps_closed++;
+ tcpstat_inc(tcps_closed);
}
int