Mechanically convert to if_inc_counter().

This commit is contained in:
Gleb Smirnoff 2014-09-18 20:21:46 +00:00
parent 2c705cad05
commit 8da56a6fec

View File

@ -568,18 +568,18 @@ gem_tick(void *arg)
/*
* Unload collision and error counters.
*/
ifp->if_collisions +=
if_inc_counter(ifp, IFCOUNTER_COLLISIONS,
GEM_BANK1_READ_4(sc, GEM_MAC_NORM_COLL_CNT) +
GEM_BANK1_READ_4(sc, GEM_MAC_FIRST_COLL_CNT);
GEM_BANK1_READ_4(sc, GEM_MAC_FIRST_COLL_CNT));
v = GEM_BANK1_READ_4(sc, GEM_MAC_EXCESS_COLL_CNT) +
GEM_BANK1_READ_4(sc, GEM_MAC_LATE_COLL_CNT);
ifp->if_collisions += v;
ifp->if_oerrors += v;
ifp->if_ierrors +=
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, v);
if_inc_counter(ifp, IFCOUNTER_OERRORS, v);
if_inc_counter(ifp, IFCOUNTER_IERRORS,
GEM_BANK1_READ_4(sc, GEM_MAC_RX_LEN_ERR_CNT) +
GEM_BANK1_READ_4(sc, GEM_MAC_RX_ALIGN_ERR) +
GEM_BANK1_READ_4(sc, GEM_MAC_RX_CRC_ERR_CNT) +
GEM_BANK1_READ_4(sc, GEM_MAC_RX_CODE_VIOL);
GEM_BANK1_READ_4(sc, GEM_MAC_RX_CODE_VIOL));
/*
* Then clear the hardware counters.
@ -1485,7 +1485,7 @@ gem_tint(struct gem_softc *sc)
STAILQ_INSERT_TAIL(&sc->sc_txfreeq, txs, txs_q);
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
progress = 1;
}
@ -1580,7 +1580,7 @@ gem_rint(struct gem_softc *sc)
}
if (rxstat & GEM_RD_BAD_CRC) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
device_printf(sc->sc_dev, "receive error: CRC error\n");
GEM_INIT_RXDESC(sc, sc->sc_rxptr);
m = NULL;
@ -1606,7 +1606,7 @@ gem_rint(struct gem_softc *sc)
* the buffer that's already attached to this descriptor.
*/
if (gem_add_rxbuf(sc, sc->sc_rxptr) != 0) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
GEM_INIT_RXDESC(sc, sc->sc_rxptr);
m = NULL;
}
@ -1634,7 +1634,7 @@ gem_rint(struct gem_softc *sc)
continue;
}
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
m->m_data += ETHER_ALIGN; /* first byte offset */
m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.len = m->m_len = GEM_RD_BUFLEN(rxstat);
@ -1706,7 +1706,7 @@ static void
gem_eint(struct gem_softc *sc, u_int status)
{
sc->sc_ifp->if_ierrors++;
if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1);
if ((status & GEM_INTR_RX_TAG_ERR) != 0) {
gem_reset_rxdma(sc);
return;
@ -1784,7 +1784,7 @@ gem_intr(void *v)
"MAC TX fault, status %x\n", status2);
if ((status2 &
(GEM_MAC_TX_UNDERRUN | GEM_MAC_TX_PKT_TOO_LONG)) != 0) {
sc->sc_ifp->if_oerrors++;
if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
gem_init_locked(sc);
}
@ -1798,7 +1798,7 @@ gem_intr(void *v)
* likely that the receiver has hung so we reset it.
*/
if ((status2 & GEM_MAC_RX_OVERFLOW) != 0) {
sc->sc_ifp->if_ierrors++;
if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1);
gem_reset_rxdma(sc);
} else if ((status2 &
~(GEM_MAC_RX_DONE | GEM_MAC_RX_FRAME_CNT)) != 0)
@ -1835,7 +1835,7 @@ gem_watchdog(struct gem_softc *sc)
device_printf(sc->sc_dev, "device timeout\n");
else if (bootverbose)
device_printf(sc->sc_dev, "device timeout (no link)\n");
++ifp->if_oerrors;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
/* Try to get more packets going. */
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;