Module Name: src Committed By: thorpej Date: Wed Jan 29 14:53:41 UTC 2020
Modified Files: src/sys/dev/ic: lan9118.c lemac.c Log Message: Adopt <net/if_stats.h>. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/lan9118.c cvs rdiff -u -r1.54 -r1.55 src/sys/dev/ic/lemac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/lan9118.c diff -u src/sys/dev/ic/lan9118.c:1.35 src/sys/dev/ic/lan9118.c:1.36 --- src/sys/dev/ic/lan9118.c:1.35 Thu May 30 02:32:18 2019 +++ src/sys/dev/ic/lan9118.c Wed Jan 29 14:53:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lan9118.c,v 1.35 2019/05/30 02:32:18 msaitoh Exp $ */ +/* $NetBSD: lan9118.c,v 1.36 2020/01/29 14:53:40 thorpej Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.35 2019/05/30 02:32:18 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.36 2020/01/29 14:53:40 thorpej Exp $"); /* * The LAN9118 Family @@ -328,17 +328,17 @@ lan9118_intr(void *arg) } #endif if (int_sts & LAN9118_INT_RXE) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); aprint_error_ifnet(ifp, "Receive Error\n"); } if (int_sts & (LAN9118_INT_TSFL|LAN9118_INT_SW_INT)) /* TX Status FIFO Level */ lan9118_txintr(sc); if (int_sts & LAN9118_INT_RXDF_INT) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); aprint_error_ifnet(ifp, "RX Dropped Frame Interrupt\n"); } if (int_sts & LAN9118_INT_RSFF) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); aprint_error_ifnet(ifp, "RX Status FIFO Full\n"); } if (int_sts & LAN9118_INT_RSFL) /* RX Status FIFO Level */ @@ -691,7 +691,7 @@ lan9118_watchdog(struct ifnet *ifp) lan9118_txintr(sc); aprint_error_ifnet(ifp, "watchdog timeout\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); lan9118_init(ifp); } @@ -968,7 +968,7 @@ lan9118_rxintr(struct lan9118_softc *sc) aprint_error_dev(sc->sc_dev, "CRC Error\n"); dropit: - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); /* * Receive Data FIFO Fast Forward * When performing a fast-forward, there must be at @@ -1054,7 +1054,7 @@ lan9118_txintr(struct lan9118_softc *sc) "Late Collision\n"); if (tx_status & LAN9118_TXS_ECOL) { /* Rearch 16 collision */ - ifp->if_collisions += 16; + if_statadd(ifp, if_collisions, 16); aprint_error_dev(sc->sc_dev, "Excessive Collision\n"); } @@ -1067,9 +1067,9 @@ lan9118_txintr(struct lan9118_softc *sc) "Excessive Deferral\n"); if (tx_status & LAN9118_TXS_DEFERRED) aprint_error_dev(sc->sc_dev, "Deferred\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); } else - ifp->if_opackets++; + if_statinc(ifp, if_opackets); } tdfree = LAN9118_TX_FIFO_INF_TDFREE(tx_fifo_inf); Index: src/sys/dev/ic/lemac.c diff -u src/sys/dev/ic/lemac.c:1.54 src/sys/dev/ic/lemac.c:1.55 --- src/sys/dev/ic/lemac.c:1.54 Wed May 29 10:07:29 2019 +++ src/sys/dev/ic/lemac.c Wed Jan 29 14:53:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lemac.c,v 1.54 2019/05/29 10:07:29 msaitoh Exp $ */ +/* $NetBSD: lemac.c,v 1.55 2020/01/29 14:53:40 thorpej Exp $ */ /*- * Copyright (c) 1994, 1995, 1997 Matt Thomas <m...@3am-software.com> @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.54 2019/05/29 10:07:29 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.55 2020/01/29 14:53:40 thorpej Exp $"); #include "opt_inet.h" @@ -151,16 +151,16 @@ lemac_tne_intr(lemac_softc_t *sc) sc->sc_cntrs.cntr_tne_intrs++; while (txcount-- > 0) { unsigned txsts = LEMAC_INB(sc, LEMAC_REG_TDQ); - sc->sc_if.if_opackets++; /* another one done */ + if_statinc(&sc->sc_if, if_opackets); /* another one done */ if ((txsts & (LEMAC_TDQ_LCL | LEMAC_TDQ_NCL)) || (txsts & LEMAC_TDQ_COL) == LEMAC_TDQ_EXCCOL) { if (txsts & LEMAC_TDQ_NCL) sc->sc_flags &= ~LEMAC_LINKUP; - sc->sc_if.if_oerrors++; + if_statinc(&sc->sc_if, if_oerrors); } else { sc->sc_flags |= LEMAC_LINKUP; if ((txsts & LEMAC_TDQ_COL) != LEMAC_TDQ_NOCOL) - sc->sc_if.if_collisions++; + if_statinc(&sc->sc_if, if_collisions); } } sc->sc_if.if_flags &= ~IFF_OACTIVE; @@ -179,7 +179,7 @@ lemac_txd_intr(lemac_softc_t *sc, unsign sc->sc_cntrs.cntr_txd_intrs++; if (sc->sc_txctl & LEMAC_TX_STP) { - sc->sc_if.if_oerrors++; + if_statinc(&sc->sc_if, if_oerrors); /* return page to free queue */ LEMAC_OUTB(sc, LEMAC_REG_FMQ, LEMAC_INB(sc, LEMAC_REG_TDQ)); } @@ -252,7 +252,7 @@ lemac_input(lemac_softc_t *sc, bus_addr_ struct mbuf *m; if (length - sizeof(eh) > ETHERMTU || length - sizeof(eh) < ETHERMIN) { - sc->sc_if.if_ierrors++; + if_statinc(&sc->sc_if, if_ierrors); return; } if (LEMAC_USE_PIO_MODE(sc)) @@ -262,14 +262,14 @@ lemac_input(lemac_softc_t *sc, bus_addr_ MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { - sc->sc_if.if_ierrors++; + if_statinc(&sc->sc_if, if_ierrors); return; } if (length + 2 > MHLEN) { MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); - sc->sc_if.if_ierrors++; + if_statinc(&sc->sc_if, if_ierrors); return; } } @@ -320,7 +320,7 @@ lemac_rne_intr(lemac_softc_t *sc) rxlen = ((rxlen >> 8) & 0x7FF) - 4; lemac_input(sc, sizeof(rxlen), rxlen); } else { - sc->sc_if.if_ierrors++; + if_statinc(&sc->sc_if, if_ierrors); } /* Return this page to Free Memory Queue */ LEMAC_OUTB(sc, LEMAC_REG_FMQ, rxpg);