summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_var.h
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_var.h
parentdb7e392b45e8f2dbbe7184dbe24a4b3c4600c1b0 (diff)
percpu counters for TCP stats
ok mpi@ bluhm@
Diffstat (limited to 'sys/netinet/tcp_var.h')
-rw-r--r--sys/netinet/tcp_var.h128
1 files changed, 126 insertions, 2 deletions
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index e04a16f7b31..2b2184a046d 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.121 2017/02/01 20:59:47 dhill Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.122 2017/02/09 15:19:32 jca Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -566,8 +566,132 @@ struct tcp_ident_mapping {
};
#ifdef _KERNEL
+
+#include <sys/percpu.h>
+
+enum tcpstat_counters {
+ tcps_connattempt,
+ tcps_accepts,
+ tcps_connects,
+ tcps_drops,
+ tcps_conndrops,
+ tcps_closed,
+ tcps_segstimed,
+ tcps_rttupdated,
+ tcps_delack,
+ tcps_timeoutdrop,
+ tcps_rexmttimeo,
+ tcps_persisttimeo,
+ tcps_persistdrop,
+ tcps_keeptimeo,
+ tcps_keepprobe,
+ tcps_keepdrops,
+ tcps_sndtotal,
+ tcps_sndpack,
+ tcps_sndbyte,
+ tcps_sndrexmitpack,
+ tcps_sndrexmitbyte,
+ tcps_sndrexmitfast,
+ tcps_sndacks,
+ tcps_sndprobe,
+ tcps_sndurg,
+ tcps_sndwinup,
+ tcps_sndctrl,
+ tcps_rcvtotal,
+ tcps_rcvpack,
+ tcps_rcvbyte,
+ tcps_rcvbadsum,
+ tcps_rcvbadoff,
+ tcps_rcvmemdrop,
+ tcps_rcvnosec,
+ tcps_rcvshort,
+ tcps_rcvduppack,
+ tcps_rcvdupbyte,
+ tcps_rcvpartduppack,
+ tcps_rcvpartdupbyte,
+ tcps_rcvoopack,
+ tcps_rcvoobyte,
+ tcps_rcvpackafterwin,
+ tcps_rcvbyteafterwin,
+ tcps_rcvafterclose,
+ tcps_rcvwinprobe,
+ tcps_rcvdupack,
+ tcps_rcvacktoomuch,
+ tcps_rcvacktooold,
+ tcps_rcvackpack,
+ tcps_rcvackbyte,
+ tcps_rcvwinupd,
+ tcps_pawsdrop,
+ tcps_predack,
+ tcps_preddat,
+ tcps_pcbhashmiss,
+ tcps_noport,
+ tcps_badsyn,
+ tcps_dropsyn,
+ tcps_rcvbadsig,
+ tcps_rcvgoodsig,
+ tcps_inswcsum,
+ tcps_outswcsum,
+ tcps_ecn_accepts,
+ tcps_ecn_rcvece,
+ tcps_ecn_rcvcwr,
+ tcps_ecn_rcvce,
+ tcps_ecn_sndect,
+ tcps_ecn_sndece,
+ tcps_ecn_sndcwr,
+ tcps_cwr_ecn,
+ tcps_cwr_frecovery,
+ tcps_cwr_timeout,
+ tcps_sc_added,
+ tcps_sc_completed,
+ tcps_sc_timed_out,
+ tcps_sc_overflowed,
+ tcps_sc_reset,
+ tcps_sc_unreach,
+ tcps_sc_bucketoverflow,
+ tcps_sc_aborted,
+ tcps_sc_dupesyn,
+ tcps_sc_dropped,
+ tcps_sc_collisions,
+ tcps_sc_retransmitted,
+ tcps_sc_seedrandom,
+ tcps_sc_hash_size,
+ tcps_sc_entry_count,
+ tcps_sc_entry_limit,
+ tcps_sc_bucket_maxlen,
+ tcps_sc_bucket_limit,
+ tcps_sc_uses_left,
+ tcps_conndrained,
+ tcps_sack_recovery_episode,
+ tcps_sack_rexmits,
+ tcps_sack_rexmit_bytes,
+ tcps_sack_rcv_opts,
+ tcps_sack_snd_opts,
+ tcps_ncounters,
+};
+
+extern struct cpumem *tcpcounters;
+
+static inline void
+tcpstat_inc(enum tcpstat_counters c)
+{
+ counters_inc(tcpcounters, c);
+}
+
+static inline void
+tcpstat_add(enum tcpstat_counters c, uint64_t v)
+{
+ counters_add(tcpcounters, c, v);
+}
+
+static inline void
+tcpstat_pkt(enum tcpstat_counters pcounter, enum tcpstat_counters bcounter,
+ uint64_t v)
+{
+ counters_pkt(tcpcounters, pcounter, bcounter, v);
+}
+
extern struct inpcbtable tcbtable; /* head of queue of active tcpcb's */
-extern struct tcpstat tcpstat; /* tcp statistics */
extern u_int32_t tcp_now; /* for RFC 1323 timestamps */
extern int tcp_do_rfc1323; /* enabled/disabled? */
extern int tcptv_keep_init; /* time to keep alive the initial SYN packet */