diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c index a390e1bbc876..ae573da02541 100644 --- a/sys/netgraph/ng_eiface.c +++ b/sys/netgraph/ng_eiface.c @@ -247,7 +247,7 @@ ng_eiface_start2(node_p node, hook_p hook, void *arg1, int arg2) BPF_MTAP(ifp, m); if (ifp->if_flags & IFF_MONITOR) { - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); m_freem(m); continue; } @@ -262,9 +262,9 @@ ng_eiface_start2(node_p node, hook_p hook, void *arg1, int arg2) /* Update stats */ if (error == 0) - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); else - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -597,7 +597,7 @@ ng_eiface_rcvdata(hook_p hook, item_p item) m->m_pkthdr.rcvif = ifp; /* Update interface stats */ - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); (*ifp->if_input)(ifp, m); diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index b44dcdd4f86e..ea83b9773e37 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -396,7 +396,7 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m, IFQ_LOCK(&ifp->if_snd); IFQ_INC_DROPS(&ifp->if_snd); IFQ_UNLOCK(&ifp->if_snd); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (ENOBUFS); } *(sa_family_t *)m->m_data = af; @@ -472,8 +472,8 @@ ng_iface_send(struct ifnet *ifp, struct mbuf *m, sa_family_t sa) /* Update stats. */ if (error == 0) { - ifp->if_obytes += len; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OBYTES, len); + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } return (error); @@ -736,8 +736,8 @@ ng_iface_rcvdata(hook_p hook, item_p item) } /* Update interface stats */ - 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); /* Note receiving interface */ m->m_pkthdr.rcvif = ifp; diff --git a/sys/netgraph/ng_sppp.c b/sys/netgraph/ng_sppp.c index 44db053ca447..95e9a60f56f9 100644 --- a/sys/netgraph/ng_sppp.c +++ b/sys/netgraph/ng_sppp.c @@ -364,7 +364,7 @@ ng_sppp_rcvdata (hook_p hook, item_p item) } /* Update interface stats */ - SP2IFP(pp)->if_ipackets++; + if_inc_counter(SP2IFP(pp), IFCOUNTER_IPACKETS, 1); /* Note receiving interface */ m->m_pkthdr.rcvif = SP2IFP(pp);