summaryrefslogtreecommitdiffstats
path: root/sys/net/if_var.h
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2013-10-15 11:37:57 +0000
committerglebius <glebius@FreeBSD.org>2013-10-15 11:37:57 +0000
commit790225cfbce40af294b0962bcba0febee9125487 (patch)
treec8e33cc195b6a05b074a56d713bbf025af1bbdc4 /sys/net/if_var.h
parentbc71d67cbbd8f45860c1763eb82f7de40d07538c (diff)
downloadFreeBSD-src-790225cfbce40af294b0962bcba0febee9125487.zip
FreeBSD-src-790225cfbce40af294b0962bcba0febee9125487.tar.gz
- Utilize counter(9) to accumulate statistics on interface addresses. Add
four counters to struct ifaddr. This kills '+=' on a variables shared between processors for every packet. - Nuke struct if_data from struct ifaddr. - In ip_input() do not put a reference on ifaddr, instead update statistics right now in place and do IN_IFADDR_RUNLOCK(). These removes atomic(9) for every packet. [1] - To properly support NET_RT_IFLISTL sysctl used by getifaddrs(3), in rtsock.c fill if_data fields using counter_u64_fetch(). - Accidentially fix bug in COMPAT_32 version of NET_RT_IFLISTL, which took if_data not from the ifaddr, but from ifaddr's ifnet. [2] Submitted by: melifaro [1], pluknet[2] Sponsored by: Netflix Sponsored by: Nginx, Inc.
Diffstat (limited to 'sys/net/if_var.h')
-rw-r--r--sys/net/if_var.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 59213e7..73554a9 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -83,6 +83,7 @@ struct vnet;
#include <sys/buf_ring.h>
#include <net/vnet.h>
#endif /* _KERNEL */
+#include <sys/counter.h>
#include <sys/lock.h> /* XXX */
#include <sys/mutex.h> /* XXX */
#include <sys/rwlock.h> /* XXX */
@@ -794,7 +795,6 @@ struct ifaddr {
struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
struct sockaddr *ifa_netmask; /* used to determine subnet */
- struct if_data if_data; /* not all members are meaningful */
struct ifnet *ifa_ifp; /* back-pointer to interface */
struct carp_softc *ifa_carp; /* pointer to CARP data */
TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */
@@ -805,6 +805,11 @@ struct ifaddr {
int ifa_metric; /* cost of going out this interface */
int (*ifa_claim_addr) /* check if an addr goes to this if */
(struct ifaddr *, struct sockaddr *);
+
+ counter_u64_t ifa_ipackets;
+ counter_u64_t ifa_opackets;
+ counter_u64_t ifa_ibytes;
+ counter_u64_t ifa_obytes;
};
#endif
OpenPOWER on IntegriCloud