Mechanically convert to if_inc_counter().

This commit is contained in:
Gleb Smirnoff 2014-09-19 09:20:16 +00:00
parent d8cc52c9a1
commit 6625a48525
7 changed files with 47 additions and 49 deletions

View File

@ -260,7 +260,7 @@ emac_txeof(struct emac_softc *sc)
EMAC_ASSERT_LOCKED(sc);
ifp = sc->emac_ifp;
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
/* Unarm watchdog timer if no TX */
@ -340,12 +340,12 @@ emac_rxeof(struct emac_softc *sc, int count)
if_printf(ifp,
"bad packet: len = %i status = %i\n",
len, status);
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
}
#if 0
if (status & (EMAC_CRCERR | EMAC_LENERR)) {
good_packet = 0;
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
if (status & EMAC_CRCERR)
if_printf(ifp, "crc error\n");
if (status & EMAC_LENERR)
@ -393,18 +393,18 @@ emac_rxeof(struct emac_softc *sc, int count)
m0->m_next = m;
m = m0;
} else {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
m = NULL;
continue;
}
} else if (m->m_len > EMAC_MAC_MAXF) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
m_freem(m);
m = NULL;
continue;
}
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
EMAC_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
EMAC_LOCK(sc);
@ -431,7 +431,7 @@ emac_watchdog(struct emac_softc *sc)
} else
if_printf(sc->emac_ifp, "watchdog timeout -- resetting\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
emac_init_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))

View File

@ -776,19 +776,19 @@ ate_tick(void *xsc)
sc->mibdata.dot3StatsAlignmentErrors += RD4(sc, ETH_ALE);
sc->mibdata.dot3StatsFCSErrors += RD4(sc, ETH_SEQE);
c = RD4(sc, ETH_SCOL);
ifp->if_collisions += c;
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, c);
sc->mibdata.dot3StatsSingleCollisionFrames += c;
c = RD4(sc, ETH_MCOL);
sc->mibdata.dot3StatsMultipleCollisionFrames += c;
ifp->if_collisions += c;
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, c);
sc->mibdata.dot3StatsSQETestErrors += RD4(sc, ETH_SQEE);
sc->mibdata.dot3StatsDeferredTransmissions += RD4(sc, ETH_DTE);
c = RD4(sc, ETH_LCOL);
sc->mibdata.dot3StatsLateCollisions += c;
ifp->if_collisions += c;
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, c);
c = RD4(sc, ETH_ECOL);
sc->mibdata.dot3StatsExcessiveCollisions += c;
ifp->if_collisions += c;
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, c);
sc->mibdata.dot3StatsCarrierSenseErrors += RD4(sc, ETH_CSE);
sc->mibdata.dot3StatsFrameTooLongs += RD4(sc, ETH_ELR);
sc->mibdata.dot3StatsInternalMacReceiveErrors += RD4(sc, ETH_DRFC);
@ -797,9 +797,9 @@ ate_tick(void *xsc)
* Not sure where to lump these, so count them against the errors
* for the interface.
*/
sc->ifp->if_oerrors += RD4(sc, ETH_TUE);
sc->ifp->if_ierrors += RD4(sc, ETH_CDE) + RD4(sc, ETH_RJB) +
RD4(sc, ETH_USF);
if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, RD4(sc, ETH_TUE));
if_inc_counter(sc->ifp, IFCOUNTER_IERRORS,
RD4(sc, ETH_CDE) + RD4(sc, ETH_RJB) + RD4(sc, ETH_USF));
/* Schedule another timeout one second from now. */
callout_reset(&sc->tick_ch, hz, ate_tick, sc);
@ -914,7 +914,7 @@ ate_intr(void *xsc)
mb = m_get2(remain + ETHER_ALIGN, M_NOWAIT, MT_DATA,
M_PKTHDR);
if (mb == NULL) {
sc->ifp->if_iqdrops++;
if_inc_counter(sc->ifp, IFCOUNTER_IQDROPS, 1);
rxdhead->status = 0;
continue;
}
@ -957,7 +957,7 @@ ate_intr(void *xsc)
} while (!done);
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
(*ifp->if_input)(ifp, mb);
}
}
@ -990,7 +990,7 @@ ate_intr(void *xsc)
m_freem(sc->sent_mbuf[sc->txtail]);
sc->tx_descs[sc->txtail].addr = 0;
sc->sent_mbuf[sc->txtail] = NULL;
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
sc->txtail = NEXT_TX_IDX(sc, sc->txtail);
}
@ -1162,7 +1162,7 @@ atestart_locked(struct ifnet *ifp)
BUS_DMASYNC_POSTWRITE);
bus_dmamap_unload(sc->mtag, sc->tx_map[sc->txtail]);
m_free(sc->sent_mbuf[sc->txhead]);
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
}
sc->sent_mbuf[sc->txhead] = m;

View File

@ -522,12 +522,12 @@ macb_watchdog(struct macb_softc *sc)
ifp = sc->ifp;
if ((sc->flags & MACB_FLAG_LINK) == 0) {
if_printf(ifp, "watchdog timeout (missed link)\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
return;
}
if_printf(ifp, "watchdog timeout\n");
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
macbinit_locked(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
@ -677,7 +677,7 @@ macb_tx_cleanup(struct macb_softc *sc)
td->dmamap);
m_freem(td->buff);
td->buff = NULL;
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
}
do {
@ -732,7 +732,7 @@ macb_rx(struct macb_softc *sc)
bus_dmamap_sync(sc->dmatag_ring_rx,
sc->rx_desc[sc->rx_cons].dmamap, BUS_DMASYNC_POSTREAD);
if (macb_new_rxbuf(sc, sc->rx_cons) != 0) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
first = sc->rx_cons;
do {
@ -781,7 +781,7 @@ macb_rx(struct macb_softc *sc)
m->m_flags |= M_PKTHDR;
m->m_pkthdr.len = rxbytes;
m->m_pkthdr.rcvif = ifp;
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
nsegs = 0;
MACB_UNLOCK(sc);

View File

@ -1379,7 +1379,7 @@ ece_intr_rx_locked(struct ece_softc *sc, int count)
if (desc->length < ETHER_MIN_LEN - ETHER_CRC_LEN ||
desc->length > ETHER_MAX_LEN - ETHER_CRC_LEN +
ETHER_VLAN_ENCAP_LEN) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
desc->cown = 0;
desc->length = MCLBYTES - 2;
/* Invalid packet, skip and process next
@ -1389,7 +1389,7 @@ ece_intr_rx_locked(struct ece_softc *sc, int count)
}
if (ece_new_rxbuf(sc, rxdesc) != 0) {
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
desc->cown = 0;
desc->length = MCLBYTES - 2;
break;
@ -1478,7 +1478,7 @@ ece_intr_status(void *xsc)
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
if ((stat & ERROR_MASK) != 0)
ifp->if_iqdrops++;
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
}
}

View File

@ -754,7 +754,7 @@ lpe_rxintr(struct lpe_softc *sc)
/* Check received frame for errors */
if (hws->lhs_info & LPE_HWDESC_RXERRS) {
ifp->if_ierrors++;
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
lpe_discard_rxbuf(sc, cons);
lpe_init_rxbuf(sc, cons);
goto skip;
@ -764,7 +764,7 @@ lpe_rxintr(struct lpe_softc *sc)
m->m_pkthdr.rcvif = ifp;
m->m_data += 2;
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
lpe_unlock(sc);
(*ifp->if_input)(ifp, m);
@ -800,12 +800,12 @@ lpe_txintr(struct lpe_softc *sc)
bus_dmamap_sync(sc->lpe_cdata.lpe_tx_buf_tag,
txd->lpe_txdesc_dmamap, BUS_DMASYNC_POSTWRITE);
ifp->if_collisions += LPE_HWDESC_COLLISIONS(hws->lhs_info);
if_inc_counter(ifp, IFCOUNTER_COLLISIONS, LPE_HWDESC_COLLISIONS(hws->lhs_info));
if (hws->lhs_info & LPE_HWDESC_TXERRS)
ifp->if_oerrors++;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
else
ifp->if_opackets++;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
if (txd->lpe_txdesc_first) {
bus_dmamap_unload(sc->lpe_cdata.lpe_tx_buf_tag,

View File

@ -1837,7 +1837,7 @@ cpsw_tx_watchdog(struct cpsw_softc *sc)
++sc->watchdog.timer;
if (sc->watchdog.timer > 2) {
sc->watchdog.timer = 0;
++ifp->if_oerrors;
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
++sc->watchdog.resets;
cpsw_tx_watchdog_full_reset(sc);
}

View File

@ -906,20 +906,18 @@ npe_addstats(struct npe_softc *sc)
be32toh(ns->RxOverrunDiscards)
+ be32toh(ns->RxUnderflowEntryDiscards);
ifp->if_oerrors +=
be32toh(ns->dot3StatsInternalMacTransmitErrors)
+ be32toh(ns->dot3StatsCarrierSenseErrors)
+ be32toh(ns->TxVLANIdFilterDiscards)
;
ifp->if_ierrors += be32toh(ns->dot3StatsFCSErrors)
+ be32toh(ns->dot3StatsInternalMacReceiveErrors)
+ be32toh(ns->RxOverrunDiscards)
+ be32toh(ns->RxUnderflowEntryDiscards)
;
ifp->if_collisions +=
be32toh(ns->dot3StatsSingleCollisionFrames)
+ be32toh(ns->dot3StatsMultipleCollisionFrames)
;
if_inc_counter(ifp, IFCOUNTER_OERRORS,
be32toh(ns->dot3StatsInternalMacTransmitErrors) +
be32toh(ns->dot3StatsCarrierSenseErrors) +
be32toh(ns->TxVLANIdFilterDiscards));
if_inc_counter(ifp, IFCOUNTER_IERRORS,
be32toh(ns->dot3StatsFCSErrors) +
be32toh(ns->dot3StatsInternalMacReceiveErrors) +
be32toh(ns->RxOverrunDiscards) +
be32toh(ns->RxUnderflowEntryDiscards));
if_inc_counter(ifp, IFCOUNTER_COLLISIONS,
be32toh(ns->dot3StatsSingleCollisionFrames) +
be32toh(ns->dot3StatsMultipleCollisionFrames));
#undef NPEADD
#undef MIBADD
}
@ -999,7 +997,7 @@ npe_txdone_finish(struct npe_softc *sc, const struct txdone *td)
* We're no longer busy, so clear the busy flag and call the
* start routine to xmit more packets.
*/
ifp->if_opackets += td->count;
if_inc_counter(ifp, IFCOUNTER_OPACKETS, td->count);
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
sc->npe_watchdog_timer = 0;
npestart_locked(ifp);
@ -1138,7 +1136,7 @@ npe_rxdone(int qid, void *arg)
mrx->m_pkthdr.len = mrx->m_len;
mrx->m_pkthdr.rcvif = ifp;
ifp->if_ipackets++;
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
ifp->if_input(ifp, mrx);
rx_npkts++;
} else {
@ -1467,7 +1465,7 @@ npewatchdog(struct npe_softc *sc)
return;
device_printf(sc->sc_dev, "watchdog timeout\n");
sc->sc_ifp->if_oerrors++;
if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
npeinit_locked(sc);
}