From 9bce9009cde9004b6e25fdebb9ebfa99e4d9b172 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Thu, 18 Sep 2014 21:11:42 +0000 Subject: [PATCH] Mechanically convert to if_inc_counter(). --- sys/dev/alc/if_alc.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sys/dev/alc/if_alc.c b/sys/dev/alc/if_alc.c index 3f661fdefb7b..ecb3b47d11c8 100644 --- a/sys/dev/alc/if_alc.c +++ b/sys/dev/alc/if_alc.c @@ -2323,13 +2323,13 @@ alc_watchdog(struct alc_softc *sc) ifp = sc->alc_ifp; if ((sc->alc_flags & ALC_FLAG_LINK) == 0) { if_printf(sc->alc_ifp, "watchdog timeout (lost link)\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; alc_init_locked(sc); return; } if_printf(sc->alc_ifp, "watchdog timeout -- resetting\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; alc_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) @@ -2608,11 +2608,11 @@ alc_stats_update(struct alc_softc *sc) stat->tx_mcast_bytes += smb->tx_mcast_bytes; /* Update counters in ifnet. */ - ifp->if_opackets += smb->tx_frames; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, smb->tx_frames); - ifp->if_collisions += smb->tx_single_colls + + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_abort * HDPX_CFG_RETRY_DEFAULT); /* * XXX @@ -2621,15 +2621,16 @@ alc_stats_update(struct alc_softc *sc) * the counter name is not correct one so I've removed the * counter in output errors. */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + if_inc_counter(ifp, IFCOUNTER_OERRORS, + smb->tx_abort + smb->tx_late_colls + smb->tx_underrun); - ifp->if_ipackets += smb->rx_frames; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, smb->rx_frames); - ifp->if_ierrors += smb->rx_crcerrs + smb->rx_lenerrs + + if_inc_counter(ifp, IFCOUNTER_IERRORS, + smb->rx_crcerrs + smb->rx_lenerrs + smb->rx_runts + smb->rx_pkts_truncated + smb->rx_fifo_oflows + smb->rx_rrs_errs + - smb->rx_alignerrs; + smb->rx_alignerrs); if ((sc->alc_flags & ALC_FLAG_SMB_BUG) == 0) { /* Update done, clear. */ @@ -2921,7 +2922,7 @@ alc_fixup_rx(struct ifnet *ifp, struct mbuf *m) */ MGETHDR(n, M_NOWAIT, MT_DATA); if (n == NULL) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); m_freem(m); return (NULL); } @@ -2977,7 +2978,7 @@ alc_rxeof(struct alc_softc *sc, struct rx_rdesc *rrd) mp = rxd->rx_m; /* Add a new receive buffer to the ring. */ if (alc_newbuf(sc, rxd) != 0) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); /* Reuse Rx buffers. */ if (sc->alc_cdata.alc_rxhead != NULL) m_freem(sc->alc_cdata.alc_rxhead);