diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-04-11 23:35:20 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-04-11 23:35:20 +0000 |
commit | 692f8aa2fac966ef1adc29843ad741d355db1ecd (patch) | |
tree | 10c5a6d474eb50a7cbc30483b13c043872a03382 /sys/net/if_bridge.c | |
parent | 000707192e4b75299e3d0c78425c7da549319f08 (diff) | |
download | FreeBSD-src-692f8aa2fac966ef1adc29843ad741d355db1ecd.zip FreeBSD-src-692f8aa2fac966ef1adc29843ad741d355db1ecd.tar.gz |
Update stats in struct ipstat using four new macros, IPSTAT_ADD(),
IPSTAT_INC(), IPSTAT_SUB(), and IPSTAT_DEC(), rather than directly
manipulating the fields across the kernel. This will make it easier
to change the implementation of these statistics, such as using
per-CPU versions of the data structures.
MFC after: 3 days
Diffstat (limited to 'sys/net/if_bridge.c')
-rw-r--r-- | sys/net/if_bridge.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 1e9d956..ef8cf5b 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -3243,12 +3243,12 @@ bridge_ip_checkbasic(struct mbuf **mp) if ((m = m_copyup(m, sizeof(struct ip), (max_linkhdr + 3) & ~3)) == NULL) { /* XXXJRT new stat, please */ - V_ipstat.ips_toosmall++; + IPSTAT_INC(ips_toosmall); goto bad; } } else if (__predict_false(m->m_len < sizeof (struct ip))) { if ((m = m_pullup(m, sizeof (struct ip))) == NULL) { - V_ipstat.ips_toosmall++; + IPSTAT_INC(ips_toosmall); goto bad; } } @@ -3256,17 +3256,17 @@ bridge_ip_checkbasic(struct mbuf **mp) if (ip == NULL) goto bad; if (ip->ip_v != IPVERSION) { - V_ipstat.ips_badvers++; + IPSTAT_INC(ips_badvers); goto bad; } hlen = ip->ip_hl << 2; if (hlen < sizeof(struct ip)) { /* minimum header length */ - V_ipstat.ips_badhlen++; + IPSTAT_INC(ips_badhlen); goto bad; } if (hlen > m->m_len) { if ((m = m_pullup(m, hlen)) == 0) { - V_ipstat.ips_badhlen++; + IPSTAT_INC(ips_badhlen); goto bad; } ip = mtod(m, struct ip *); @@ -3283,7 +3283,7 @@ bridge_ip_checkbasic(struct mbuf **mp) } } if (sum) { - V_ipstat.ips_badsum++; + IPSTAT_INC(ips_badsum); goto bad; } @@ -3294,7 +3294,7 @@ bridge_ip_checkbasic(struct mbuf **mp) * Check for additional length bogosity */ if (len < hlen) { - V_ipstat.ips_badlen++; + IPSTAT_INC(ips_badlen); goto bad; } @@ -3304,7 +3304,7 @@ bridge_ip_checkbasic(struct mbuf **mp) * Drop packet if shorter than we expect. */ if (m->m_pkthdr.len < len) { - V_ipstat.ips_tooshort++; + IPSTAT_INC(ips_tooshort); goto bad; } @@ -3419,7 +3419,7 @@ bridge_fragment(struct ifnet *ifp, struct mbuf *m, struct ether_header *eh, } if (error == 0) - V_ipstat.ips_fragmented++; + IPSTAT_INC(ips_fragmented); return (error); |