Module Name: src Committed By: thorpej Date: Wed Jan 29 14:18:54 UTC 2020
Modified Files: src/sys/dev/ic: tulip.c Log Message: Adopt <net/if_stats.h>. To generate a diff of this commit: cvs rdiff -u -r1.200 -r1.201 src/sys/dev/ic/tulip.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/tulip.c diff -u src/sys/dev/ic/tulip.c:1.200 src/sys/dev/ic/tulip.c:1.201 --- src/sys/dev/ic/tulip.c:1.200 Sun Nov 10 21:16:35 2019 +++ src/sys/dev/ic/tulip.c Wed Jan 29 14:18:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tulip.c,v 1.200 2019/11/10 21:16:35 chs Exp $ */ +/* $NetBSD: tulip.c,v 1.201 2020/01/29 14:18:54 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.200 2019/11/10 21:16:35 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.201 2020/01/29 14:18:54 thorpej Exp $"); #include <sys/param.h> @@ -940,10 +940,10 @@ tlp_watchdog(struct ifnet *ifp) if (doing_setup && doing_transmit) { printf("%s: filter setup and transmit timeout\n", device_xname(sc->sc_dev)); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); } else if (doing_transmit) { printf("%s: transmit timeout\n", device_xname(sc->sc_dev)); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); } else if (doing_setup) printf("%s: filter setup timeout\n", device_xname(sc->sc_dev)); else @@ -1251,7 +1251,7 @@ tlp_rxintr(struct tulip_softc *sc) * If any collisions were seen on the wire, count one. */ if (rxstat & TDSTAT_Rx_CS) - ifp->if_collisions++; + if_statinc(ifp, if_collisions); /* * If an error occurred, update stats, clear the status @@ -1279,7 +1279,7 @@ tlp_rxintr(struct tulip_softc *sc) if (rxstat & (bit)) \ aprint_error_dev(sc->sc_dev, \ "receive error: %s\n", str) - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); PRINTERR(TDSTAT_Rx_DE, "descriptor error"); PRINTERR(TDSTAT_Rx_RF, "runt frame"); PRINTERR(TDSTAT_Rx_TL, "frame too long"); @@ -1308,7 +1308,7 @@ tlp_rxintr(struct tulip_softc *sc) */ m = rxs->rxs_mbuf; if (tlp_add_rxbuf(sc, i) != 0) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); TULIP_INIT_RXDESC(sc, i); bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0, rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); @@ -1324,7 +1324,7 @@ tlp_rxintr(struct tulip_softc *sc) MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { dropit: - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); TULIP_INIT_RXDESC(sc, i); bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0, rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD); @@ -1491,18 +1491,20 @@ tlp_txintr(struct tulip_softc *sc) if (txstat & TDSTAT_Tx_LC) sc->sc_stats.ts_tx_lc++; #endif - + net_stat_ref_t nsr = IF_STAT_GETREF(ifp); if (txstat & (TDSTAT_Tx_UF | TDSTAT_Tx_TO)) - ifp->if_oerrors++; + if_statinc_ref(nsr, if_oerrors); if (txstat & TDSTAT_Tx_EC) - ifp->if_collisions += 16; + if_statadd_ref(nsr, if_collisions, 16); else - ifp->if_collisions += TDSTAT_Tx_COLLISIONS(txstat); + if_statadd_ref(nsr, if_collisions, + TDSTAT_Tx_COLLISIONS(txstat)); if (txstat & TDSTAT_Tx_LC) - ifp->if_collisions++; + if_statinc_ref(nsr, if_collisions); - ifp->if_opackets++; + if_statinc_ref(nsr, if_opackets); + IF_STAT_PUTREF(ifp); } /*