diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2016-11-14 03:51:54 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2016-11-14 03:51:54 +0000 |
commit | fc674f9894d986b47cfa77e09298d752aaf88a86 (patch) | |
tree | 5f6625cc3c701dbec6e85a033c355f4ff47ab185 /sys/netinet/ip_var.h | |
parent | e0ce1e1136e22dfdf32c6e56000621f1fc333891 (diff) |
turn ipstat into a set of percpu counters.
each counter is identified by an enum value which correspond to the
original members of the ipstat struct.
ipstat_inc(ips_foo) replaces ipstat.ips_foo++ for the actual updates.
ipstat_inc is a thin wrapper around counters_inc.
counters are still returned to userland via the ipstat struct for now.
ok mpi@ mikeb@
Diffstat (limited to 'sys/netinet/ip_var.h')
-rw-r--r-- | sys/netinet/ip_var.h | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h index d86bec2257c..e4e364649c8 100644 --- a/sys/netinet/ip_var.h +++ b/sys/netinet/ip_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_var.h,v 1.62 2016/04/15 11:18:40 mpi Exp $ */ +/* $OpenBSD: ip_var.h,v 1.63 2016/11/14 03:51:53 dlg Exp $ */ /* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */ /* @@ -96,6 +96,53 @@ struct ipoption { #ifdef _KERNEL +#include <sys/percpu.h> + +enum ipstat_counters { + ips_total, /* total packets received */ + ips_badsum, /* checksum bad */ + ips_tooshort, /* packet too short */ + ips_toosmall, /* not enough data */ + ips_badhlen, /* ip header length < data size */ + ips_badlen, /* ip length < ip header length */ + ips_fragments, /* fragments received */ + ips_fragdropped, /* frags dropped (dups, out of space) */ + ips_fragtimeout, /* fragments timed out */ + ips_forward, /* packets forwarded */ + ips_cantforward, /* packets rcvd for unreachable dest */ + ips_redirectsent, /* packets forwarded on same net */ + ips_noproto, /* unknown or unsupported protocol */ + ips_delivered, /* datagrams delivered to upper level*/ + ips_localout, /* total ip packets generated here */ + ips_odropped, /* lost packets due to nobufs, etc. */ + ips_reassembled, /* total packets reassembled ok */ + ips_fragmented, /* datagrams successfully fragmented */ + ips_ofragments, /* output fragments created */ + ips_cantfrag, /* don't fragment flag was set, etc. */ + ips_badoptions, /* error in option processing */ + ips_noroute, /* packets discarded due to no route */ + ips_badvers, /* ip version != 4 */ + ips_rawout, /* total raw ip packets generated */ + ips_badfrags, /* malformed fragments (bad length) */ + ips_rcvmemdrop, /* frags dropped for lack of memory */ + ips_toolong, /* ip length > max ip packet size */ + ips_nogif, /* no match gif found */ + ips_badaddr, /* invalid address on header */ + ips_inswcsum, /* software checksummed on input */ + ips_outswcsum, /* software checksummed on output */ + ips_notmember, /* multicasts for unregistered groups */ + + ips_ncounters +}; + +extern struct cpumem *ipcounters; + +static inline void +ipstat_inc(enum ipstat_counters c) +{ + counters_inc(ipcounters, c); +} + /* * Structure attached to inpcb.ip_moptions and * passed to ip_output when IP multicast options are in use. |