From 41acb7e12cf14480a273430223fc68e7a209da01 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Thu, 18 Sep 2014 20:30:47 +0000 Subject: [PATCH] Mechanically convert to if_inc_counter(). --- sys/dev/vge/if_vge.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/dev/vge/if_vge.c b/sys/dev/vge/if_vge.c index 13276d95bfa6..315f273eef9d 100644 --- a/sys/dev/vge/if_vge.c +++ b/sys/dev/vge/if_vge.c @@ -1400,7 +1400,7 @@ vge_freebufs(struct vge_softc *sc) txd->tx_dmamap); m_freem(txd->tx_m); txd->tx_m = NULL; - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } } } @@ -1467,7 +1467,7 @@ vge_rxeof(struct vge_softc *sc, int count) */ if ((rxstat & VGE_RXPKT_SOF) != 0) { if (vge_newbuf(sc, prod) != 0) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); VGE_CHAIN_RESET(sc); vge_discard_rxbuf(sc, prod); continue; @@ -1498,7 +1498,7 @@ vge_rxeof(struct vge_softc *sc, int count) if ((rxstat & VGE_RDSTS_RXOK) == 0 && (rxstat & (VGE_RDSTS_VIDM | VGE_RDSTS_RLERR | VGE_RDSTS_CSUMERR)) == 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); /* * If this is part of a multi-fragment packet, * discard all the pieces. @@ -1509,7 +1509,7 @@ vge_rxeof(struct vge_softc *sc, int count) } if (vge_newbuf(sc, prod) != 0) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); VGE_CHAIN_RESET(sc); vge_discard_rxbuf(sc, prod); continue; @@ -2380,7 +2380,7 @@ vge_watchdog(void *arg) ifp = sc->vge_ifp; if_printf(ifp, "watchdog timeout\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); vge_txeof(sc); vge_rxeof(sc, VGE_RX_DESC_CNT); @@ -2706,24 +2706,25 @@ vge_stats_update(struct vge_softc *sc) stats->tx_latecolls += mib[VGE_MIB_TX_LATECOLLS]; /* Update counters in ifnet. */ - ifp->if_opackets += mib[VGE_MIB_TX_GOOD_FRAMES]; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, mib[VGE_MIB_TX_GOOD_FRAMES]); - ifp->if_collisions += mib[VGE_MIB_TX_COLLS] + - mib[VGE_MIB_TX_LATECOLLS]; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, + mib[VGE_MIB_TX_COLLS] + mib[VGE_MIB_TX_LATECOLLS]); - ifp->if_oerrors += mib[VGE_MIB_TX_COLLS] + - mib[VGE_MIB_TX_LATECOLLS]; + if_inc_counter(ifp, IFCOUNTER_OERRORS, + mib[VGE_MIB_TX_COLLS] + mib[VGE_MIB_TX_LATECOLLS]); - ifp->if_ipackets += mib[VGE_MIB_RX_GOOD_FRAMES]; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, mib[VGE_MIB_RX_GOOD_FRAMES]); - ifp->if_ierrors += mib[VGE_MIB_RX_FIFO_OVERRUNS] + + if_inc_counter(ifp, IFCOUNTER_IERRORS, + mib[VGE_MIB_RX_FIFO_OVERRUNS] + mib[VGE_MIB_RX_RUNTS] + mib[VGE_MIB_RX_RUNTS_ERRS] + mib[VGE_MIB_RX_CRCERRS] + mib[VGE_MIB_RX_ALIGNERRS] + mib[VGE_MIB_RX_NOBUFS] + mib[VGE_MIB_RX_SYMERRS] + - mib[VGE_MIB_RX_LENERRS]; + mib[VGE_MIB_RX_LENERRS]); } static void