svn commit: r271867 - head/sys/net
Gleb Smirnoff
glebius at FreeBSD.org
Fri Sep 19 10:40:02 UTC 2014
Author: glebius
Date: Fri Sep 19 10:39:58 2014
New Revision: 271867
URL: http://svnweb.freebsd.org/changeset/base/271867
Log:
Mechanically convert to if_inc_counter().
Modified:
head/sys/net/if_arcsubr.c
head/sys/net/if_atmsubr.c
head/sys/net/if_bridge.c
head/sys/net/if_disc.c
head/sys/net/if_edsc.c
head/sys/net/if_epair.c
head/sys/net/if_ethersubr.c
head/sys/net/if_faith.c
head/sys/net/if_fddisubr.c
head/sys/net/if_fwsubr.c
head/sys/net/if_gif.c
head/sys/net/if_gre.c
head/sys/net/if_iso88025subr.c
head/sys/net/if_loop.c
head/sys/net/if_spppfr.c
head/sys/net/if_spppsubr.c
head/sys/net/if_stf.c
head/sys/net/if_tap.c
head/sys/net/if_tun.c
head/sys/net/if_vlan.c
Modified: head/sys/net/if_arcsubr.c
==============================================================================
--- head/sys/net/if_arcsubr.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_arcsubr.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -357,7 +357,7 @@ arc_defrag(struct ifnet *ifp, struct mbu
if (m->m_len < ARC_HDRNEWLEN) {
m = m_pullup(m, ARC_HDRNEWLEN);
if (m == NULL) {
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return NULL;
}
}
@@ -377,7 +377,7 @@ arc_defrag(struct ifnet *ifp, struct mbu
if (m->m_len < ARC_HDRNEWLEN) {
m = m_pullup(m, ARC_HDRNEWLEN);
if (m == NULL) {
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return NULL;
}
}
@@ -530,11 +530,11 @@ arc_input(struct ifnet *ifp, struct mbuf
return;
}
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
if (ah->arc_dhost == arcbroadcastaddr) {
m->m_flags |= M_BCAST|M_MCAST;
- ifp->if_imcasts++;
+ if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
}
atype = ah->arc_type;
Modified: head/sys/net/if_atmsubr.c
==============================================================================
--- head/sys/net/if_atmsubr.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_atmsubr.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -252,7 +252,7 @@ atm_input(struct ifnet *ifp, struct atm_
#ifdef MAC
mac_ifnet_create_mbuf(ifp, m);
#endif
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
if (ng_atm_input_p != NULL) {
(*ng_atm_input_p)(ifp, &m, ah, rxhand);
Modified: head/sys/net/if_bridge.c
==============================================================================
--- head/sys/net/if_bridge.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_bridge.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -1848,7 +1848,7 @@ bridge_enqueue(struct bridge_softc *sc,
if (m == NULL) {
if_printf(dst_ifp,
"unable to prepend VLAN header\n");
- dst_ifp->if_oerrors++;
+ if_inc_counter(dst_ifp, IFCOUNTER_OERRORS, 1);
continue;
}
m->m_flags &= ~M_VLANTAG;
@@ -1856,14 +1856,14 @@ bridge_enqueue(struct bridge_softc *sc,
if ((err = dst_ifp->if_transmit(dst_ifp, m))) {
m_freem(m0);
- sc->sc_ifp->if_oerrors++;
+ if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
break;
}
- sc->sc_ifp->if_opackets++;
- sc->sc_ifp->if_obytes += len;
+ if_inc_counter(sc->sc_ifp, IFCOUNTER_OPACKETS, 1);
+ if_inc_counter(sc->sc_ifp, IFCOUNTER_OBYTES, len);
if (mflags & M_MCAST)
- sc->sc_ifp->if_omcasts++;
+ if_inc_counter(sc->sc_ifp, IFCOUNTER_OMCASTS, 1);
}
return (err);
@@ -1994,7 +1994,7 @@ bridge_output(struct ifnet *ifp, struct
} else {
mc = m_copypacket(m, M_NOWAIT);
if (mc == NULL) {
- sc->sc_ifp->if_oerrors++;
+ if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
continue;
}
}
@@ -2084,8 +2084,8 @@ bridge_forward(struct bridge_softc *sc,
src_if = m->m_pkthdr.rcvif;
ifp = sc->sc_ifp;
- ifp->if_ipackets++;
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
vlan = VLANTAGOF(m);
if ((sbif->bif_flags & IFBIF_STP) &&
@@ -2137,7 +2137,7 @@ bridge_forward(struct bridge_softc *sc,
goto drop;
/* ...forward it to all interfaces. */
- ifp->if_imcasts++;
+ if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
dst_if = NULL;
}
@@ -2245,8 +2245,8 @@ bridge_input(struct ifnet *ifp, struct m
if ((bifp->if_flags & IFF_MONITOR) != 0) {
m->m_pkthdr.rcvif = bifp;
ETHER_BPF_MTAP(bifp, m);
- bifp->if_ipackets++;
- bifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(bifp, IFCOUNTER_IPACKETS, 1);
+ if_inc_counter(bifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
m_freem(m);
return (NULL);
}
@@ -2347,8 +2347,8 @@ bridge_input(struct ifnet *ifp, struct m
) { \
if ((iface)->if_type == IFT_BRIDGE) { \
ETHER_BPF_MTAP(iface, m); \
- iface->if_ipackets++; \
- iface->if_ibytes += m->m_pkthdr.len; \
+ if_inc_counter(iface, IFCOUNTER_IPACKETS, 1); \
+ if_inc_counter(iface, IFCOUNTER_IBYTES, m->m_pkthdr.len); \
/* Filter on the physical interface. */ \
if (pfil_local_phys && \
(PFIL_HOOKED(&V_inet_pfil_hook) \
@@ -2478,7 +2478,7 @@ bridge_broadcast(struct bridge_softc *sc
} else {
mc = m_dup(m, M_NOWAIT);
if (mc == NULL) {
- sc->sc_ifp->if_oerrors++;
+ if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
continue;
}
}
@@ -2498,7 +2498,7 @@ bridge_broadcast(struct bridge_softc *sc
i = min(mc->m_pkthdr.len, max_protohdr);
mc = m_copyup(mc, i, ETHER_ALIGN);
if (mc == NULL) {
- sc->sc_ifp->if_oerrors++;
+ if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
continue;
}
}
@@ -2541,7 +2541,7 @@ bridge_span(struct bridge_softc *sc, str
mc = m_copypacket(m, M_NOWAIT);
if (mc == NULL) {
- sc->sc_ifp->if_oerrors++;
+ if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
continue;
}
Modified: head/sys/net/if_disc.c
==============================================================================
--- head/sys/net/if_disc.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_disc.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -174,8 +174,8 @@ discoutput(struct ifnet *ifp, struct mbu
m->m_pkthdr.rcvif = ifp;
- ifp->if_opackets++;
- ifp->if_obytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
+ if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
m_freem(m);
return (0);
Modified: head/sys/net/if_edsc.c
==============================================================================
--- head/sys/net/if_edsc.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_edsc.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -291,8 +291,8 @@ edsc_start(struct ifnet *ifp)
/*
* Update the interface counters.
*/
- ifp->if_obytes += m->m_pkthdr.len;
- ifp->if_opackets++;
+ if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
+ if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
/*
* Finally, just drop the packet.
Modified: head/sys/net/if_epair.c
==============================================================================
--- head/sys/net/if_epair.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_epair.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -418,7 +418,7 @@ epair_start_locked(struct ifnet *ifp)
*/
if ((oifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ||
(oifp->if_flags & IFF_UP) ==0) {
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
continue;
}
@@ -434,15 +434,15 @@ epair_start_locked(struct ifnet *ifp)
error = netisr_queue(NETISR_EPAIR, m);
CURVNET_RESTORE();
if (!error) {
- ifp->if_opackets++;
+ if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
/* Someone else received the packet. */
- oifp->if_ipackets++;
+ if_inc_counter(oifp, IFCOUNTER_IPACKETS, 1);
} else {
/* The packet was freed already. */
epair_dpcpu->epair_drv_flags |= IFF_DRV_OACTIVE;
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
(void) epair_add_ifp_for_draining(ifp);
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
EPAIR_REFCOUNT_RELEASE(&sc->refcount);
EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1,
("%s: ifp=%p sc->refcount not >= 1: %d",
@@ -503,7 +503,7 @@ epair_transmit_locked(struct ifnet *ifp,
oifp = sc->oifp;
if ((oifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ||
(oifp->if_flags & IFF_UP) ==0) {
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
return (0);
}
@@ -517,12 +517,12 @@ epair_transmit_locked(struct ifnet *ifp,
if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
ALTQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
if (error)
- ifp->if_oqdrops++;
+ if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1);
IF_UNLOCK(&ifp->if_snd);
if (!error) {
- ifp->if_obytes += len;
+ if_inc_counter(ifp, IFCOUNTER_OBYTES, len);
if (mflags & (M_BCAST|M_MCAST))
- ifp->if_omcasts++;
+ if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0)
epair_start_locked(ifp);
@@ -556,22 +556,22 @@ epair_transmit_locked(struct ifnet *ifp,
error = netisr_queue(NETISR_EPAIR, m);
CURVNET_RESTORE();
if (!error) {
- ifp->if_opackets++;
+ if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
/*
* IFQ_HANDOFF_ADJ/ip_handoff() update statistics,
* but as we bypass all this we have to duplicate
* the logic another time.
*/
- ifp->if_obytes += len;
+ if_inc_counter(ifp, IFCOUNTER_OBYTES, len);
if (mflags & (M_BCAST|M_MCAST))
- ifp->if_omcasts++;
+ if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1);
/* Someone else received the packet. */
- oifp->if_ipackets++;
+ if_inc_counter(oifp, IFCOUNTER_IPACKETS, 1);
} else {
/* The packet was freed already. */
epair_dpcpu->epair_drv_flags |= IFF_DRV_OACTIVE;
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
EPAIR_REFCOUNT_RELEASE(&sc->refcount);
EPAIR_REFCOUNT_ASSERT((int)sc->refcount >= 1,
("%s: ifp=%p sc->refcount not >= 1: %d",
Modified: head/sys/net/if_ethersubr.c
==============================================================================
--- head/sys/net/if_ethersubr.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_ethersubr.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -306,7 +306,7 @@ ether_output(struct ifnet *ifp, struct m
update_mbuf_csumflags(m, n);
(void)if_simloop(ifp, n, dst->sa_family, hlen);
} else
- ifp->if_iqdrops++;
+ if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
} else if (bcmp(eh->ether_dhost, eh->ether_shost,
ETHER_ADDR_LEN) == 0) {
update_mbuf_csumflags(m, m);
@@ -404,7 +404,7 @@ ether_input_internal(struct ifnet *ifp,
*/
if ((m->m_flags & M_PKTHDR) == 0) {
if_printf(ifp, "discard frame w/o packet header\n");
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
return;
}
@@ -413,7 +413,7 @@ ether_input_internal(struct ifnet *ifp,
if_printf(ifp, "discard frame w/o leading ethernet "
"header (len %u pkt len %u)\n",
m->m_len, m->m_pkthdr.len);
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
return;
}
@@ -421,7 +421,7 @@ ether_input_internal(struct ifnet *ifp,
etype = ntohs(eh->ether_type);
if (m->m_pkthdr.rcvif == NULL) {
if_printf(ifp, "discard frame w/o interface pointer\n");
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
return;
}
@@ -439,7 +439,7 @@ ether_input_internal(struct ifnet *ifp,
m->m_flags |= M_BCAST;
else
m->m_flags |= M_MCAST;
- ifp->if_imcasts++;
+ if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
}
#ifdef MAC
@@ -466,7 +466,7 @@ ether_input_internal(struct ifnet *ifp,
}
if (!(ifp->if_capenable & IFCAP_HWSTATS))
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
/* Allow monitor mode to claim this frame, after stats are updated. */
if (ifp->if_flags & IFF_MONITOR) {
@@ -502,7 +502,7 @@ ether_input_internal(struct ifnet *ifp,
#ifdef DIAGNOSTIC
if_printf(ifp, "cannot pullup VLAN header\n");
#endif
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
CURVNET_RESTORE();
return;
@@ -715,7 +715,7 @@ ether_demux(struct ifnet *ifp, struct mb
if ((m->m_flags & M_VLANTAG) &&
EVL_VLANOFTAG(m->m_pkthdr.ether_vtag) != 0) {
if (ifp->if_vlantrunk == NULL) {
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
m_freem(m);
return;
}
Modified: head/sys/net/if_faith.c
==============================================================================
--- head/sys/net/if_faith.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_faith.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -211,8 +211,8 @@ faithoutput(struct ifnet *ifp, struct mb
return (rt->rt_flags & RTF_BLACKHOLE ? 0 :
rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
}
- ifp->if_opackets++;
- ifp->if_obytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
+ if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
switch (af) {
#ifdef INET
case AF_INET:
@@ -232,8 +232,8 @@ faithoutput(struct ifnet *ifp, struct mb
/* XXX do we need more sanity checks? */
m->m_pkthdr.rcvif = ifp;
- ifp->if_ipackets++;
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
netisr_dispatch(isr, m);
return (0);
}
Modified: head/sys/net/if_fddisubr.c
==============================================================================
--- head/sys/net/if_fddisubr.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_fddisubr.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -288,12 +288,12 @@ fddi_output(struct ifnet *ifp, struct mb
error = (ifp->if_transmit)(ifp, m);
if (error)
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return (error);
bad:
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
if (m)
m_freem(m);
return (error);
@@ -317,20 +317,20 @@ fddi_input(ifp, m)
*/
if ((m->m_flags & M_PKTHDR) == 0) {
if_printf(ifp, "discard frame w/o packet header\n");
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
return;
}
if (m->m_pkthdr.rcvif == NULL) {
if_printf(ifp, "discard frame w/o interface pointer\n");
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
return;
}
m = m_pullup(m, FDDI_HDR_LEN);
if (m == NULL) {
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
goto dropanyway;
}
fh = mtod(m, struct fddi_header *);
@@ -362,7 +362,7 @@ fddi_input(ifp, m)
/*
* Update interface statistics.
*/
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
getmicrotime(&ifp->if_lastchange);
/*
@@ -383,7 +383,7 @@ fddi_input(ifp, m)
m->m_flags |= M_BCAST;
else
m->m_flags |= M_MCAST;
- ifp->if_imcasts++;
+ if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
}
#ifdef M_LINK0
@@ -401,7 +401,7 @@ fddi_input(ifp, m)
m = m_pullup(m, LLC_SNAPFRAMELEN);
if (m == 0) {
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
goto dropanyway;
}
l = mtod(m, struct llc *);
@@ -412,13 +412,13 @@ fddi_input(ifp, m)
u_int16_t type;
if ((l->llc_control != LLC_UI) ||
(l->llc_ssap != LLC_SNAP_LSAP)) {
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
}
if (l->llc_snap.org_code[0] != 0 ||
l->llc_snap.org_code[1] != 0 ||
l->llc_snap.org_code[2] != 0) {
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
}
@@ -451,7 +451,7 @@ fddi_input(ifp, m)
#endif
default:
/* printf("fddi_input: unknown protocol 0x%x\n", type); */
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
}
break;
@@ -459,7 +459,7 @@ fddi_input(ifp, m)
default:
/* printf("fddi_input: unknown dsap 0x%x\n", l->llc_dsap); */
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
}
M_SETFIB(m, ifp->if_fib);
@@ -467,7 +467,7 @@ fddi_input(ifp, m)
return;
dropanyway:
- ifp->if_iqdrops++;
+ if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
if (m)
m_freem(m);
return;
Modified: head/sys/net/if_fwsubr.c
==============================================================================
--- head/sys/net/if_fwsubr.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_fwsubr.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -537,7 +537,7 @@ firewire_input(struct ifnet *ifp, struct
if (m->m_pkthdr.rcvif == NULL) {
if_printf(ifp, "discard frame w/o interface pointer\n");
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
return;
}
@@ -582,7 +582,7 @@ firewire_input(struct ifnet *ifp, struct
return;
}
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
/* Discard packet if interface is not up */
if ((ifp->if_flags & IFF_UP) == 0) {
@@ -591,7 +591,7 @@ firewire_input(struct ifnet *ifp, struct
}
if (m->m_flags & (M_BCAST|M_MCAST))
- ifp->if_imcasts++;
+ if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
switch (type) {
#ifdef INET
Modified: head/sys/net/if_gif.c
==============================================================================
--- head/sys/net/if_gif.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_gif.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -377,10 +377,10 @@ gif_start(struct ifnet *ifp)
af = AF_LINK;
BPF_MTAP2(ifp, &af, sizeof(af), m);
- ifp->if_opackets++;
+ if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
/* Done by IFQ_HANDOFF */
-/* ifp->if_obytes += m->m_pkthdr.len;*/
+/* if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);*/
/* override to IPPROTO_ETHERIP for bridged traffic */
M_SETFIB(m, sc->gif_fibnum);
@@ -403,7 +403,7 @@ gif_start(struct ifnet *ifp)
error = ENETDOWN;
}
if (error)
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
}
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
@@ -513,7 +513,7 @@ gif_output(struct ifnet *ifp, struct mbu
IFQ_HANDOFF(ifp, m, error);
end:
if (error)
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return (error);
}
@@ -544,8 +544,8 @@ gif_input(struct mbuf *m, int af, struct
}
if ((ifp->if_flags & IFF_MONITOR) != 0) {
- ifp->if_ipackets++;
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
m_freem(m);
return;
}
@@ -583,7 +583,7 @@ gif_input(struct mbuf *m, int af, struct
if (n > m->m_len) {
m = m_pullup(m, n);
if (m == NULL) {
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
return;
}
}
@@ -622,7 +622,7 @@ gif_input(struct mbuf *m, int af, struct
m->m_flags |= M_BCAST;
else
m->m_flags |= M_MCAST;
- ifp->if_imcasts++;
+ if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
}
BRIDGE_INPUT(ifp, m);
@@ -647,8 +647,8 @@ gif_input(struct mbuf *m, int af, struct
return;
}
- ifp->if_ipackets++;
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
}
Modified: head/sys/net/if_gre.c
==============================================================================
--- head/sys/net/if_gre.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_gre.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -361,7 +361,7 @@ gre_output(struct ifnet *ifp, struct mbu
* be encapsulated.
*/
if (ip->ip_off & htons(IP_MF | IP_OFFMASK)) {
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
error = EINVAL; /* is there better errno? */
goto end;
@@ -390,7 +390,7 @@ gre_output(struct ifnet *ifp, struct mbu
if ((m->m_data - msiz) < m->m_pktdat) {
m0 = m_gethdr(M_NOWAIT, MT_DATA);
if (m0 == NULL) {
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
error = ENOBUFS;
goto end;
@@ -415,7 +415,7 @@ gre_output(struct ifnet *ifp, struct mbu
memcpy((caddr_t)(ip + 1), &mob_h, (unsigned)msiz);
ip->ip_len = htons(ntohs(ip->ip_len) + msiz);
} else { /* AF_INET */
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
error = EINVAL;
goto end;
@@ -440,7 +440,7 @@ gre_output(struct ifnet *ifp, struct mbu
break;
#endif
default:
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
error = EAFNOSUPPORT;
goto end;
@@ -452,14 +452,14 @@ gre_output(struct ifnet *ifp, struct mbu
hdrlen += sizeof(uint32_t);
M_PREPEND(m, hdrlen, M_NOWAIT);
} else {
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
m_freem(m);
error = EINVAL;
goto end;
}
if (m == NULL) { /* mbuf allocation failed */
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
error = ENOBUFS;
goto end;
}
@@ -494,8 +494,8 @@ gre_output(struct ifnet *ifp, struct mbu
gh->gi_len = htons(m->m_pkthdr.len);
}
- ifp->if_opackets++;
- ifp->if_obytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
+ if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
/*
* Send it off and with IP_FORWARD flag to prevent it from
* overwriting the ip_id again. ip_id is already set to the
@@ -505,7 +505,7 @@ gre_output(struct ifnet *ifp, struct mbu
(struct ip_moptions *)NULL, (struct inpcb *)NULL);
end:
if (error)
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return (error);
}
Modified: head/sys/net/if_iso88025subr.c
==============================================================================
--- head/sys/net/if_iso88025subr.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_iso88025subr.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -381,12 +381,12 @@ iso88025_output(struct ifnet *ifp, struc
IFQ_HANDOFF_ADJ(ifp, m, ISO88025_HDR_LEN + LLC_SNAPFRAMELEN, error);
if (error) {
printf("iso88025_output: packet dropped QFULL.\n");
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
}
return (error);
bad:
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
if (m)
m_freem(m);
return (error);
@@ -411,20 +411,20 @@ iso88025_input(ifp, m)
*/
if ((m->m_flags & M_PKTHDR) == 0) {
if_printf(ifp, "discard frame w/o packet header\n");
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
return;
}
if (m->m_pkthdr.rcvif == NULL) {
if_printf(ifp, "discard frame w/o interface pointer\n");
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
return;
}
m = m_pullup(m, ISO88025_HDR_LEN);
if (m == NULL) {
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
goto dropanyway;
}
th = mtod(m, struct iso88025_header *);
@@ -456,7 +456,7 @@ iso88025_input(ifp, m)
/*
* Update interface statistics.
*/
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
getmicrotime(&ifp->if_lastchange);
/*
@@ -478,7 +478,7 @@ iso88025_input(ifp, m)
m->m_flags |= M_BCAST;
else
m->m_flags |= M_MCAST;
- ifp->if_imcasts++;
+ if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
}
mac_hdr_len = ISO88025_HDR_LEN;
@@ -491,7 +491,7 @@ iso88025_input(ifp, m)
m = m_pullup(m, LLC_SNAPFRAMELEN);
if (m == 0) {
- ifp->if_ierrors++;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
goto dropanyway;
}
l = mtod(m, struct llc *);
@@ -501,14 +501,14 @@ iso88025_input(ifp, m)
u_int16_t type;
if ((l->llc_control != LLC_UI) ||
(l->llc_ssap != LLC_SNAP_LSAP)) {
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
}
if (l->llc_snap.org_code[0] != 0 ||
l->llc_snap.org_code[1] != 0 ||
l->llc_snap.org_code[2] != 0) {
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
}
@@ -537,7 +537,7 @@ iso88025_input(ifp, m)
#endif /* INET6 */
default:
printf("iso88025_input: unexpected llc_snap ether_type 0x%02x\n", type);
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
}
break;
@@ -546,7 +546,7 @@ iso88025_input(ifp, m)
case LLC_ISO_LSAP:
switch (l->llc_control) {
case LLC_UI:
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
break;
case LLC_XID:
@@ -595,7 +595,7 @@ iso88025_input(ifp, m)
}
default:
printf("iso88025_input: unexpected llc control 0x%02x\n", l->llc_control);
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
break;
}
@@ -603,7 +603,7 @@ iso88025_input(ifp, m)
#endif /* ISO */
default:
printf("iso88025_input: unknown dsap 0x%x\n", l->llc_dsap);
- ifp->if_noproto++;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto dropanyway;
break;
}
@@ -613,7 +613,7 @@ iso88025_input(ifp, m)
return;
dropanyway:
- ifp->if_iqdrops++;
+ if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
if (m)
m_freem(m);
return;
Modified: head/sys/net/if_loop.c
==============================================================================
--- head/sys/net/if_loop.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_loop.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -226,8 +226,8 @@ looutput(struct ifnet *ifp, struct mbuf
rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
}
- ifp->if_opackets++;
- ifp->if_obytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
+ if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
/* BPF writes need to be handled specially. */
if (dst->sa_family == AF_UNSPEC)
@@ -358,8 +358,8 @@ if_simloop(struct ifnet *ifp, struct mbu
m_freem(m);
return (EAFNOSUPPORT);
}
- ifp->if_ipackets++;
- ifp->if_ibytes += m->m_pkthdr.len;
+ if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
netisr_queue(isr, m); /* mbuf is free'd on failure. */
return (0);
}
Modified: head/sys/net/if_spppfr.c
==============================================================================
--- head/sys/net/if_spppfr.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_spppfr.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -250,9 +250,9 @@ bad: m_freem (m);
switch (proto) {
default:
- ++ifp->if_noproto;
-drop: ++ifp->if_ierrors;
- ++ifp->if_iqdrops;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
+drop: if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
+ if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
m_freem (m);
return;
#ifdef INET
@@ -394,7 +394,7 @@ void sppp_fr_keepalive (struct sppp *sp)
(u_char) sp->pp_rseq[IDX_LCP]);
if (! IF_HANDOFF_ADJ(&sp->pp_cpq, m, ifp, 3))
- ++ifp->if_oerrors;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
}
/*
@@ -508,7 +508,7 @@ static void sppp_fr_arp (struct sppp *sp
reply->ptarget2 = htonl (his_ip_address) >> 16;
if (! IF_HANDOFF_ADJ(&sp->pp_cpq, m, ifp, 3))
- ++ifp->if_oerrors;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
}
/*
Modified: head/sys/net/if_spppsubr.c
==============================================================================
--- head/sys/net/if_spppsubr.c Fri Sep 19 10:35:56 2014 (r271866)
+++ head/sys/net/if_spppsubr.c Fri Sep 19 10:39:58 2014 (r271867)
@@ -518,7 +518,7 @@ sppp_input(struct ifnet *ifp, struct mbu
if (ifp->if_flags & IFF_UP)
/* Count received bytes, add FCS and one flag */
- ifp->if_ibytes += m->m_pkthdr.len + 3;
+ if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len + 3);
if (m->m_pkthdr.len <= PPP_HEADER_LEN) {
/* Too small packet, drop it. */
@@ -530,8 +530,8 @@ sppp_input(struct ifnet *ifp, struct mbu
m_freem (m);
SPPP_UNLOCK(sp);
drop2:
- ++ifp->if_ierrors;
- ++ifp->if_iqdrops;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
+ if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
return;
}
@@ -570,7 +570,7 @@ sppp_input(struct ifnet *ifp, struct mbu
sppp_cp_send (sp, PPP_LCP, PROTO_REJ,
++sp->pp_seq[IDX_LCP], m->m_pkthdr.len + 2,
&h->protocol);
- ++ifp->if_noproto;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto drop;
case PPP_LCP:
sppp_cp_input(&lcp, sp, m);
@@ -682,7 +682,7 @@ sppp_input(struct ifnet *ifp, struct mbu
}
switch (ntohs (h->protocol)) {
default:
- ++ifp->if_noproto;
+ if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
goto invalid;
case CISCO_KEEPALIVE:
sppp_cisco_input (sp, m);
@@ -906,7 +906,7 @@ sppp_output(struct ifnet *ifp, struct mb
nobufs: if (debug)
log(LOG_DEBUG, SPP_FMT "no memory for transmit header\n",
SPP_ARGS(ifp));
- ++ifp->if_oerrors;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
SPPP_UNLOCK(sp);
return (ENOBUFS);
}
@@ -966,7 +966,7 @@ nobufs: if (debug)
#endif
default:
m_freem (m);
- ++ifp->if_oerrors;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
SPPP_UNLOCK(sp);
return (EAFNOSUPPORT);
}
@@ -981,7 +981,7 @@ out:
else
IFQ_HANDOFF_ADJ(ifp, m, 3, error);
if (error) {
- ++ifp->if_oerrors;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
SPPP_UNLOCK(sp);
return (rv? rv: ENOBUFS);
}
@@ -1393,7 +1393,7 @@ sppp_cisco_send(struct sppp *sp, int typ
(u_long)ch->par2, (u_int)ch->rel, (u_int)ch->time0, (u_int)ch->time1);
if (! IF_HANDOFF_ADJ(&sp->pp_cpq, m, ifp, 3))
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
}
/*
@@ -1442,7 +1442,7 @@ sppp_cp_send(struct sppp *sp, u_short pr
log(-1, ">\n");
}
if (! IF_HANDOFF_ADJ(&sp->pp_cpq, m, ifp, 3))
- ifp->if_oerrors++;
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
}
/*
@@ -1484,7 +1484,7 @@ sppp_cp_input(const struct cp *cp, struc
log(-1, SPP_FMT "%s invalid conf-req length %d\n",
SPP_ARGS(ifp), cp->name,
len);
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
break;
}
/* handle states where RCR doesn't get a SCA/SCN */
@@ -1540,7 +1540,7 @@ sppp_cp_input(const struct cp *cp, struc
SPP_ARGS(ifp), cp->name,
sppp_cp_type_name(h->type),
sppp_state_name(sp->state[cp->protoidx]));
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
break;
case CONF_ACK:
@@ -1549,7 +1549,7 @@ sppp_cp_input(const struct cp *cp, struc
log(-1, SPP_FMT "%s id mismatch 0x%x != 0x%x\n",
SPP_ARGS(ifp), cp->name,
h->ident, sp->confid[cp->protoidx]);
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
break;
}
switch (sp->state[cp->protoidx]) {
@@ -1584,7 +1584,7 @@ sppp_cp_input(const struct cp *cp, struc
SPP_ARGS(ifp), cp->name,
sppp_cp_type_name(h->type),
sppp_state_name(sp->state[cp->protoidx]));
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
break;
case CONF_NAK:
@@ -1594,7 +1594,7 @@ sppp_cp_input(const struct cp *cp, struc
log(-1, SPP_FMT "%s id mismatch 0x%x != 0x%x\n",
SPP_ARGS(ifp), cp->name,
h->ident, sp->confid[cp->protoidx]);
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
break;
}
if (h->type == CONF_NAK)
@@ -1634,7 +1634,7 @@ sppp_cp_input(const struct cp *cp, struc
SPP_ARGS(ifp), cp->name,
sppp_cp_type_name(h->type),
sppp_state_name(sp->state[cp->protoidx]));
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
break;
@@ -1667,7 +1667,7 @@ sppp_cp_input(const struct cp *cp, struc
SPP_ARGS(ifp), cp->name,
sppp_cp_type_name(h->type),
sppp_state_name(sp->state[cp->protoidx]));
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
break;
case TERM_ACK:
@@ -1698,7 +1698,7 @@ sppp_cp_input(const struct cp *cp, struc
SPP_ARGS(ifp), cp->name,
sppp_cp_type_name(h->type),
sppp_state_name(sp->state[cp->protoidx]));
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
break;
case CODE_REJ:
@@ -1725,7 +1725,7 @@ sppp_cp_input(const struct cp *cp, struc
SPP_ARGS(ifp), cp->name,
sppp_cp_type_name(h->type),
sppp_state_name(sp->state[cp->protoidx]));
- ++ifp->if_ierrors;
+ if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
break;
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list