Module Name: src Committed By: thorpej Date: Thu Jan 30 06:10:26 UTC 2020
Modified Files: src/sys/dev/pci: if_txp.c if_wpi.c if_xge.c Log Message: Adopt <net/if_stats.h>. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pci/if_txp.c cvs rdiff -u -r1.87 -r1.88 src/sys/dev/pci/if_wpi.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/if_xge.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/pci/if_txp.c diff -u src/sys/dev/pci/if_txp.c:1.62 src/sys/dev/pci/if_txp.c:1.63 --- src/sys/dev/pci/if_txp.c:1.62 Fri Dec 6 07:12:39 2019 +++ src/sys/dev/pci/if_txp.c Thu Jan 30 06:10:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_txp.c,v 1.62 2019/12/06 07:12:39 maxv Exp $ */ +/* $NetBSD: if_txp.c,v 1.63 2020/01/30 06:10:26 thorpej Exp $ */ /* * Copyright (c) 2001 @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.62 2019/12/06 07:12:39 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.63 2020/01/30 06:10:26 thorpej Exp $"); #include "opt_inet.h" @@ -684,7 +684,7 @@ txp_rx_reclaim(struct txp_softc *sc, str if (rxd->rx_flags & RX_FLAGS_ERROR) { printf("%s: error 0x%x\n", device_xname(sc->sc_dev), le32toh(rxd->rx_stat)); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto next; } @@ -883,7 +883,7 @@ txp_tx_reclaim(struct txp_softc *sc, str m_freem(m); txd->tx_addrlo = 0; txd->tx_addrhi = 0; - ifp->if_opackets++; + if_statinc(ifp, if_opackets); } } ifp->if_flags &= ~IFF_OACTIVE; @@ -1362,13 +1362,16 @@ txp_tick(void *vsc) goto out; ext = (struct txp_ext_desc *)(rsp + 1); - ifp->if_ierrors += ext[3].ext_2 + ext[3].ext_3 + ext[3].ext_4 + - ext[4].ext_1 + ext[4].ext_4; - ifp->if_oerrors += ext[0].ext_1 + ext[1].ext_1 + ext[1].ext_4 + - ext[2].ext_1; - ifp->if_collisions += ext[0].ext_2 + ext[0].ext_3 + ext[1].ext_2 + - ext[1].ext_3; - ifp->if_opackets += rsp->rsp_par2; + net_stat_ref_t nsr = IF_STAT_GETREF(ifp); + if_statadd_ref(nsr, if_ierrors, + ext[3].ext_2 + ext[3].ext_3 + ext[3].ext_4 + + ext[4].ext_1 + ext[4].ext_4); + if_statadd_ref(nsr, if_oerrors, + ext[0].ext_1 + ext[1].ext_1 + ext[1].ext_4 + ext[2].ext_1); + if_statadd_ref(nsr, if_collisions, + ext[0].ext_2 + ext[0].ext_3 + ext[1].ext_2 + ext[1].ext_3); + if_statadd_ref(nsr, if_opackets, rsp->rsp_par2); + IF_STAT_PUTREF(ifp); out: if (rsp != NULL) Index: src/sys/dev/pci/if_wpi.c diff -u src/sys/dev/pci/if_wpi.c:1.87 src/sys/dev/pci/if_wpi.c:1.88 --- src/sys/dev/pci/if_wpi.c:1.87 Sun Nov 10 21:16:36 2019 +++ src/sys/dev/pci/if_wpi.c Thu Jan 30 06:10:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wpi.c,v 1.87 2019/11/10 21:16:36 chs Exp $ */ +/* $NetBSD: if_wpi.c,v 1.88 2020/01/30 06:10:26 thorpej Exp $ */ /*- * Copyright (c) 2006, 2007 @@ -18,7 +18,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.87 2019/11/10 21:16:36 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.88 2020/01/30 06:10:26 thorpej Exp $"); /* * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters. @@ -1495,7 +1495,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct if (stat->len > WPI_STAT_MAXLEN) { aprint_error_dev(sc->sc_dev, "invalid rx statistic header\n"); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -1514,7 +1514,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct if ((le32toh(tail->flags) & WPI_RX_NOERROR) != WPI_RX_NOERROR) { DPRINTF(("rx tail flags error %x\n", le32toh(tail->flags))); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -1523,14 +1523,14 @@ wpi_rx_intr(struct wpi_softc *sc, struct MGETHDR(mnew, M_DONTWAIT, MT_DATA); if (mnew == NULL) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } rbuf = wpi_alloc_rbuf(sc); if (rbuf == NULL) { m_freem(mnew); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -1548,7 +1548,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct device_printf(sc->sc_dev, "couldn't load rx mbuf: %d\n", error); m_freem(mnew); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); error = bus_dmamap_load(sc->sc_dmat, data->map, mtod(data->m, void *), WPI_RBUF_SIZE, NULL, @@ -1655,9 +1655,9 @@ wpi_tx_intr(struct wpi_softc *sc, struct } if ((le32toh(stat->status) & 0xff) != 1) - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); else - ifp->if_opackets++; + if_statinc(ifp, if_opackets); bus_dmamap_unload(sc->sc_dmat, data->map); m_freem(data->m); @@ -2122,12 +2122,12 @@ wpi_start(struct ifnet *ifp) /* management frames go into ring 0 */ if (sc->txq[0].queued > sc->txq[0].count - 8) { - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } bpf_mtap3(ic->ic_rawbpf, m0, BPF_D_OUT); if (wpi_tx_data(sc, m0, ni, 0) != 0) { - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); break; } } else { @@ -2139,14 +2139,14 @@ wpi_start(struct ifnet *ifp) if (m0->m_len < sizeof (*eh) && (m0 = m_pullup(m0, sizeof (*eh))) == NULL) { - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } eh = mtod(m0, struct ether_header *); ni = ieee80211_find_txnode(ic, eh->ether_dhost); if (ni == NULL) { m_freem(m0); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } @@ -2154,7 +2154,7 @@ wpi_start(struct ifnet *ifp) if (ieee80211_classify(ic, m0, ni) != 0) { m_freem(m0); ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } @@ -2172,13 +2172,13 @@ wpi_start(struct ifnet *ifp) m0 = ieee80211_encap(ic, m0, ni); if (m0 == NULL) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } bpf_mtap3(ic->ic_rawbpf, m0, BPF_D_OUT); if (wpi_tx_data(sc, m0, ni, ac) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); break; } } @@ -2200,7 +2200,7 @@ wpi_watchdog(struct ifnet *ifp) aprint_error_dev(sc->sc_dev, "device timeout\n"); ifp->if_flags &= ~IFF_UP; wpi_stop(ifp, 1); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return; } ifp->if_timer = 1; Index: src/sys/dev/pci/if_xge.c diff -u src/sys/dev/pci/if_xge.c:1.32 src/sys/dev/pci/if_xge.c:1.33 --- src/sys/dev/pci/if_xge.c:1.32 Wed May 29 10:07:29 2019 +++ src/sys/dev/pci/if_xge.c Thu Jan 30 06:10:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_xge.c,v 1.32 2019/05/29 10:07:29 msaitoh Exp $ */ +/* $NetBSD: if_xge.c,v 1.33 2020/01/30 06:10:26 thorpej Exp $ */ /* * Copyright (c) 2004, SUNET, Swedish University Computer Network. @@ -43,7 +43,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.32 2019/05/29 10:07:29 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.33 2020/01/30 06:10:26 thorpej Exp $"); #include <sys/param.h> @@ -741,7 +741,7 @@ xge_intr(void *pv) } bus_dmamap_unload(sc->sc_dmat, dmp); m_freem(sc->sc_txb[i]); - ifp->if_opackets++; + if_statinc(ifp, if_opackets); sc->sc_lasttx = i; } if (i == sc->sc_nexttx) { @@ -803,7 +803,7 @@ xge_intr(void *pv) #endif XGE_RXSYNC(sc->sc_nextrx, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); break; }