aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_lagg.h
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2013-04-15 13:00:42 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2013-04-15 13:00:42 +0000
commitb64478a137fed733688dcbdfe12d5a3df21d9e3f (patch)
tree9b44da6be5b85a3d8ccb22144f6e38b5d3f10a56 /sys/net/if_lagg.h
parentaa76317cfc604948a1671b2246914b047003f28d (diff)
downloadsrc-b64478a137fed733688dcbdfe12d5a3df21d9e3f.tar.gz
src-b64478a137fed733688dcbdfe12d5a3df21d9e3f.zip
Switch lagg(4) statistics to counter(9).
The lagg(4) is often used to bond high speed links, so basic per-packet += on statistics cause cache misses and statistics loss. Perfect solution would be to convert ifnet(9) to counters(9), but this requires much more work, and unfortunately ABI change, so temporarily patch lagg(4) manually. We store counters in the softc, and once per second push their values to legacy ifnet counters. Sponsored by: Nginx, Inc.
Notes
Notes: svn path=/head/; revision=249506
Diffstat (limited to 'sys/net/if_lagg.h')
-rw-r--r--sys/net/if_lagg.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/net/if_lagg.h b/sys/net/if_lagg.h
index 573a1d60e749..7170128f9918 100644
--- a/sys/net/if_lagg.h
+++ b/sys/net/if_lagg.h
@@ -21,8 +21,6 @@
#ifndef _NET_LAGG_H
#define _NET_LAGG_H
-#include <sys/sysctl.h>
-
/*
* Global definitions
*/
@@ -137,6 +135,9 @@ struct lagg_reqflags {
#define SIOCSLAGGHASH _IOW('i', 146, struct lagg_reqflags)
#ifdef _KERNEL
+
+#include <sys/counter.h>
+
/*
* Internal kernel part
*/
@@ -195,6 +196,11 @@ struct lagg_softc {
uint32_t sc_seq; /* sequence counter */
uint32_t sc_flags;
+ counter_u64_t sc_ipackets;
+ counter_u64_t sc_opackets;
+ counter_u64_t sc_ibytes;
+ counter_u64_t sc_obytes;
+
SLIST_HEAD(__tplhd, lagg_port) sc_ports; /* list of interfaces */
SLIST_ENTRY(lagg_softc) sc_entries;
@@ -217,6 +223,7 @@ struct lagg_softc {
void (*sc_portreq)(struct lagg_port *, caddr_t);
eventhandler_tag vlan_attach;
eventhandler_tag vlan_detach;
+ struct callout sc_callout;
struct sysctl_ctx_list ctx; /* sysctl variables */
int use_flowid; /* use M_FLOWID */
};