summaryrefslogtreecommitdiff
path: root/sys/net/if_bridge.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2016-11-14 03:51:54 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2016-11-14 03:51:54 +0000
commitfc674f9894d986b47cfa77e09298d752aaf88a86 (patch)
tree5f6625cc3c701dbec6e85a033c355f4ff47ab185 /sys/net/if_bridge.c
parente0ce1e1136e22dfdf32c6e56000621f1fc333891 (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/net/if_bridge.c')
-rw-r--r--sys/net/if_bridge.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 7b0c364cf60..e74be534663 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.287 2016/10/03 15:53:09 rzalamena Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.288 2016/11/14 03:51:53 dlg Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -1603,25 +1603,25 @@ bridge_ip(struct bridge_softc *sc, int dir, struct ifnet *ifp,
/* Copy minimal header, and drop invalids */
if (m->m_len < sizeof(struct ip) &&
(m = m_pullup(m, sizeof(struct ip))) == NULL) {
- ipstat.ips_toosmall++;
+ ipstat_inc(ips_toosmall);
return (NULL);
}
ip = mtod(m, struct ip *);
if (ip->ip_v != IPVERSION) {
- ipstat.ips_badvers++;
+ ipstat_inc(ips_badvers);
goto dropit;
}
hlen = ip->ip_hl << 2; /* get whole header length */
if (hlen < sizeof(struct ip)) {
- ipstat.ips_badhlen++;
+ ipstat_inc(ips_badhlen);
goto dropit;
}
if (hlen > m->m_len) {
if ((m = m_pullup(m, hlen)) == NULL) {
- ipstat.ips_badhlen++;
+ ipstat_inc(ips_badhlen);
return (NULL);
}
ip = mtod(m, struct ip *);
@@ -1629,13 +1629,13 @@ bridge_ip(struct bridge_softc *sc, int dir, struct ifnet *ifp,
if ((m->m_pkthdr.csum_flags & M_IPV4_CSUM_IN_OK) == 0) {
if (m->m_pkthdr.csum_flags & M_IPV4_CSUM_IN_BAD) {
- ipstat.ips_badsum++;
+ ipstat_inc(ips_badsum);
goto dropit;
}
- ipstat.ips_inswcsum++;
+ ipstat_inc(ips_inswcsum);
if (in_cksum(m, hlen) != 0) {
- ipstat.ips_badsum++;
+ ipstat_inc(ips_badsum);
goto dropit;
}
}
@@ -1678,7 +1678,7 @@ bridge_ip(struct bridge_softc *sc, int dir, struct ifnet *ifp,
if (0 && (ifp->if_capabilities & IFCAP_CSUM_IPv4))
m->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT;
else {
- ipstat.ips_outswcsum++;
+ ipstat_inc(ips_outswcsum);
ip->ip_sum = in_cksum(m, hlen);
}
@@ -1848,7 +1848,7 @@ bridge_fragment(struct bridge_softc *sc, struct ifnet *ifp,
}
if (error == 0)
- ipstat.ips_fragmented++;
+ ipstat_inc(ips_fragmented);
return;
dropit: