Date: Fri, 19 Sep 2014 09:20:17 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271859 - in head/sys/arm: allwinner at91 cavium/cns11xx lpc ti/cpsw xscale/ixp425 Message-ID: <201409190920.s8J9KHxC006114@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Fri Sep 19 09:20:16 2014 New Revision: 271859 URL: http://svnweb.freebsd.org/changeset/base/271859 Log: Mechanically convert to if_inc_counter(). Modified: head/sys/arm/allwinner/if_emac.c head/sys/arm/at91/if_ate.c head/sys/arm/at91/if_macb.c head/sys/arm/cavium/cns11xx/if_ece.c head/sys/arm/lpc/if_lpe.c head/sys/arm/ti/cpsw/if_cpsw.c head/sys/arm/xscale/ixp425/if_npe.c Modified: head/sys/arm/allwinner/if_emac.c ============================================================================== --- head/sys/arm/allwinner/if_emac.c Fri Sep 19 09:19:49 2014 (r271858) +++ head/sys/arm/allwinner/if_emac.c Fri Sep 19 09:20:16 2014 (r271859) @@ -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 co 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 co 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)) Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Fri Sep 19 09:19:49 2014 (r271858) +++ head/sys/arm/at91/if_ate.c Fri Sep 19 09:20:16 2014 (r271859) @@ -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; Modified: head/sys/arm/at91/if_macb.c ============================================================================== --- head/sys/arm/at91/if_macb.c Fri Sep 19 09:19:49 2014 (r271858) +++ head/sys/arm/at91/if_macb.c Fri Sep 19 09:20:16 2014 (r271859) @@ -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); Modified: head/sys/arm/cavium/cns11xx/if_ece.c ============================================================================== --- head/sys/arm/cavium/cns11xx/if_ece.c Fri Sep 19 09:19:49 2014 (r271858) +++ head/sys/arm/cavium/cns11xx/if_ece.c Fri Sep 19 09:20:16 2014 (r271859) @@ -1379,7 +1379,7 @@ ece_intr_rx_locked(struct ece_softc *sc, 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, } 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); } } Modified: head/sys/arm/lpc/if_lpe.c ============================================================================== --- head/sys/arm/lpc/if_lpe.c Fri Sep 19 09:19:49 2014 (r271858) +++ head/sys/arm/lpc/if_lpe.c Fri Sep 19 09:20:16 2014 (r271859) @@ -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, Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Fri Sep 19 09:19:49 2014 (r271858) +++ head/sys/arm/ti/cpsw/if_cpsw.c Fri Sep 19 09:20:16 2014 (r271859) @@ -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); } Modified: head/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- head/sys/arm/xscale/ixp425/if_npe.c Fri Sep 19 09:19:49 2014 (r271858) +++ head/sys/arm/xscale/ixp425/if_npe.c Fri Sep 19 09:20:16 2014 (r271859) @@ -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, * 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409190920.s8J9KHxC006114>