Module Name: src Committed By: thorpej Date: Wed Jan 29 06:35:28 UTC 2020
Modified Files: src/sys/dev/usb: if_otus.c if_rum.c if_run.c if_smsc.c if_udav.c if_umb.c if_upgt.c if_upl.c if_ural.c Log Message: Adopt <net/if_stats.h>. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/dev/usb/if_otus.c cvs rdiff -u -r1.65 -r1.66 src/sys/dev/usb/if_rum.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/if_run.c cvs rdiff -u -r1.62 -r1.63 src/sys/dev/usb/if_smsc.c cvs rdiff -u -r1.73 -r1.74 src/sys/dev/usb/if_udav.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/usb/if_umb.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/if_upgt.c cvs rdiff -u -r1.69 -r1.70 src/sys/dev/usb/if_upl.c cvs rdiff -u -r1.61 -r1.62 src/sys/dev/usb/if_ural.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/usb/if_otus.c diff -u src/sys/dev/usb/if_otus.c:1.40 src/sys/dev/usb/if_otus.c:1.41 --- src/sys/dev/usb/if_otus.c:1.40 Wed Jan 15 08:20:13 2020 +++ src/sys/dev/usb/if_otus.c Wed Jan 29 06:35:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_otus.c,v 1.40 2020/01/15 08:20:13 skrll Exp $ */ +/* $NetBSD: if_otus.c,v 1.41 2020/01/29 06:35:28 thorpej Exp $ */ /* $OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.40 2020/01/15 08:20:13 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.41 2020/01/29 06:35:28 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1734,7 +1734,7 @@ otus_sub_rxeof(struct otus_softc *sc, ui /* Received MPDU. */ if (__predict_false(len < AR_PLCP_HDR_LEN + sizeof(*tail))) { DPRINTFN(DBG_RX, sc, "MPDU too short %d\n", len); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } tail = (void *)(plcp + len - sizeof(*tail)); @@ -1749,7 +1749,7 @@ otus_sub_rxeof(struct otus_softc *sc, ui /* Report Michael MIC failures to net80211. */ ieee80211_notify_michael_failure(ic, wh, 0 /* XXX: keyix */); } - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } /* Compute MPDU's length. */ @@ -1761,7 +1761,7 @@ otus_sub_rxeof(struct otus_softc *sc, ui * want this in IEEE80211_M_MONITOR mode? */ if (__predict_false(mlen < sizeof(*wh))) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -1770,13 +1770,13 @@ otus_sub_rxeof(struct otus_softc *sc, ui MGETHDR(m, M_DONTWAIT, MT_DATA); if (__predict_false(m == NULL)) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } if (align + mlen > MHLEN) { MCLGET(m, M_DONTWAIT); if (__predict_false(!(m->m_flags & M_EXT))) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); m_freem(m); return; } @@ -1917,10 +1917,10 @@ otus_txeof(struct usbd_xfer *xfer, void DPRINTFN(DBG_TX, sc, "TX status=%d\n", status); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_data_tx_pipe); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return; } - ifp->if_opackets++; + if_statinc(ifp, if_opackets); s = splnet(); sc->sc_tx_timer = 0; @@ -2114,7 +2114,7 @@ otus_start(struct ifnet *ifp) if (m->m_len < (int)sizeof(*eh) && (m = m_pullup(m, sizeof(*eh))) == NULL) { - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } @@ -2122,7 +2122,7 @@ otus_start(struct ifnet *ifp) ni = ieee80211_find_txnode(ic, eh->ether_dhost); if (ni == NULL) { m_freem(m); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } @@ -2131,7 +2131,7 @@ otus_start(struct ifnet *ifp) if ((m = ieee80211_encap(ic, m, ni)) == NULL) { /* original m was freed by ieee80211_encap() */ ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } sendit: @@ -2140,7 +2140,7 @@ otus_start(struct ifnet *ifp) if (otus_tx(sc, m, ni, data) != 0) { m_freem(m); ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } @@ -2175,7 +2175,7 @@ otus_watchdog(struct ifnet *ifp) if (--sc->sc_tx_timer == 0) { aprint_error_dev(sc->sc_dev, "device timeout\n"); /* otus_init(ifp); XXX needs a process context! */ - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return; } ifp->if_timer = 1; Index: src/sys/dev/usb/if_rum.c diff -u src/sys/dev/usb/if_rum.c:1.65 src/sys/dev/usb/if_rum.c:1.66 --- src/sys/dev/usb/if_rum.c:1.65 Sun May 5 03:17:54 2019 +++ src/sys/dev/usb/if_rum.c Wed Jan 29 06:35:28 2020 @@ -1,5 +1,5 @@ /* $OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $ */ -/* $NetBSD: if_rum.c,v 1.65 2019/05/05 03:17:54 mrg Exp $ */ +/* $NetBSD: if_rum.c,v 1.66 2020/01/29 06:35:28 thorpej Exp $ */ /*- * Copyright (c) 2005-2007 Damien Bergamini <damien.bergam...@free.fr> @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.65 2019/05/05 03:17:54 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.66 2020/01/29 06:35:28 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -776,7 +776,7 @@ rum_txeof(struct usbd_xfer *xfer, void * if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_tx_pipeh); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return; } @@ -786,7 +786,7 @@ rum_txeof(struct usbd_xfer *xfer, void * data->ni = NULL; sc->tx_queued--; - ifp->if_opackets++; + if_statinc(ifp, if_opackets); DPRINTFN(10, ("tx done\n")); @@ -825,7 +825,7 @@ rum_rxeof(struct usbd_xfer *xfer, void * sizeof(struct ieee80211_frame_min))) { DPRINTF(("%s: xfer too short %d\n", device_xname(sc->sc_dev), len)); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto skip; } @@ -837,7 +837,7 @@ rum_rxeof(struct usbd_xfer *xfer, void * * those frames when we filled RT2573_TXRX_CSR0. */ DPRINTFN(5, ("CRC error\n")); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto skip; } @@ -845,7 +845,7 @@ rum_rxeof(struct usbd_xfer *xfer, void * if (mnew == NULL) { printf("%s: could not allocate rx mbuf\n", device_xname(sc->sc_dev)); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto skip; } @@ -854,7 +854,7 @@ rum_rxeof(struct usbd_xfer *xfer, void * printf("%s: could not allocate rx mbuf cluster\n", device_xname(sc->sc_dev)); m_freem(mnew); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto skip; } @@ -1301,7 +1301,7 @@ rum_start(struct ifnet *ifp) bpf_mtap3(ic->ic_rawbpf, m0, BPF_D_OUT); if (rum_tx_data(sc, m0, ni) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); break; } } @@ -1323,7 +1323,7 @@ rum_watchdog(struct ifnet *ifp) if (--sc->sc_tx_timer == 0) { printf("%s: device timeout\n", device_xname(sc->sc_dev)); /*rum_init(ifp); XXX needs a process context! */ - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return; } ifp->if_timer = 1; @@ -2258,7 +2258,7 @@ rum_amrr_update(struct usbd_xfer *xfer, } /* count TX retry-fail as Tx errors */ - ifp->if_oerrors += le32toh(sc->sta[5]) >> 16; + if_statadd(ifp, if_oerrors, le32toh(sc->sta[5]) >> 16); sc->amn.amn_retrycnt = (le32toh(sc->sta[4]) >> 16) + /* TX one-retry ok count */ Index: src/sys/dev/usb/if_run.c diff -u src/sys/dev/usb/if_run.c:1.35 src/sys/dev/usb/if_run.c:1.36 --- src/sys/dev/usb/if_run.c:1.35 Sat Jan 4 22:30:06 2020 +++ src/sys/dev/usb/if_run.c Wed Jan 29 06:35:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_run.c,v 1.35 2020/01/04 22:30:06 mlelstv Exp $ */ +/* $NetBSD: if_run.c,v 1.36 2020/01/29 06:35:28 thorpej Exp $ */ /* $OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.35 2020/01/04 22:30:06 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.36 2020/01/29 06:35:28 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -2157,7 +2157,7 @@ run_calibrate_cb(struct run_softc *sc, v s = splnet(); /* count failed TX as errors */ - ifp->if_oerrors += le32toh(sta[0]) & 0xffff; + if_statadd(ifp, if_oerrors, le32toh(sta[0]) & 0xffff); sc->amn.amn_retrycnt = (le32toh(sta[0]) & 0xffff) + /* failed TX count */ @@ -2266,7 +2266,7 @@ run_rx_frame(struct run_softc *sc, uint8 flags = le32toh(rxd->flags); if (__predict_false(flags & (RT2860_RX_CRCERR | RT2860_RX_ICVERR))) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -2275,7 +2275,7 @@ run_rx_frame(struct run_softc *sc, uint8 if (__predict_false((flags & RT2860_RX_MICERR))) { /* report MIC failures to net80211 for TKIP */ ieee80211_notify_michael_failure(ic, wh, 0/* XXX */); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -2295,13 +2295,13 @@ run_rx_frame(struct run_softc *sc, uint8 /* could use m_devget but net80211 wants contig mgmt frames */ MGETHDR(m, M_DONTWAIT, MT_DATA); if (__predict_false(m == NULL)) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } if (len > MHLEN) { MCLGET(m, M_DONTWAIT); if (__predict_false(!(m->m_flags & M_EXT))) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); m_freem(m); return; } @@ -2464,13 +2464,13 @@ run_txeof(struct usbd_xfer *xfer, void * device_xname(sc->sc_dev), usbd_errstr(status))); if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(txq->pipeh); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); splx(s); return; } sc->sc_tx_timer = 0; - ifp->if_opackets++; + if_statinc(ifp, if_opackets); ifp->if_flags &= ~IFF_OACTIVE; run_start(ifp); splx(s); @@ -2671,7 +2671,7 @@ run_start(struct ifnet *ifp) break; if (m->m_len < (int)sizeof(*eh) && (m = m_pullup(m, sizeof(*eh))) == NULL) { - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } @@ -2679,7 +2679,7 @@ run_start(struct ifnet *ifp) ni = ieee80211_find_txnode(ic, eh->ether_dhost); if (ni == NULL) { m_freem(m); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } @@ -2687,7 +2687,7 @@ run_start(struct ifnet *ifp) if ((m = ieee80211_encap(ic, m, ni)) == NULL) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } sendit: @@ -2695,7 +2695,7 @@ sendit: if (run_tx(sc, m, ni) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); continue; } @@ -2716,7 +2716,7 @@ run_watchdog(struct ifnet *ifp) if (--sc->sc_tx_timer == 0) { device_printf(sc->sc_dev, "device timeout\n"); /* run_init(ifp); XXX needs a process context! */ - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return; } ifp->if_timer = 1; Index: src/sys/dev/usb/if_smsc.c diff -u src/sys/dev/usb/if_smsc.c:1.62 src/sys/dev/usb/if_smsc.c:1.63 --- src/sys/dev/usb/if_smsc.c:1.62 Tue Jan 7 06:42:26 2020 +++ src/sys/dev/usb/if_smsc.c Wed Jan 29 06:35:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_smsc.c,v 1.62 2020/01/07 06:42:26 maxv Exp $ */ +/* $NetBSD: if_smsc.c,v 1.63 2020/01/29 06:35:28 thorpej Exp $ */ /* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */ /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */ @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.62 2020/01/07 06:42:26 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.63 2020/01/29 06:35:28 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -951,7 +951,7 @@ smsc_rx_loop(struct usbnet * un, struct if (total_len < sizeof(rxhdr)) { DPRINTF("total_len %jd < sizeof(rxhdr) %jd", total_len, sizeof(rxhdr), 0, 0); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -961,13 +961,13 @@ smsc_rx_loop(struct usbnet * un, struct total_len -= sizeof(rxhdr); if (rxhdr & SMSC_RX_STAT_COLLISION) - ifp->if_collisions++; + if_statinc(ifp, if_collisions); if (rxhdr & (SMSC_RX_STAT_ERROR | SMSC_RX_STAT_LENGTH_ERROR | SMSC_RX_STAT_MII_ERROR)) { DPRINTF("rx error (hdr 0x%08jx)", rxhdr, 0, 0, 0); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -978,7 +978,7 @@ smsc_rx_loop(struct usbnet * un, struct if (pktlen < ETHER_HDR_LEN) { DPRINTF("pktlen %jd < ETHER_HDR_LEN %jd", pktlen, ETHER_HDR_LEN, 0, 0); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } @@ -987,14 +987,14 @@ smsc_rx_loop(struct usbnet * un, struct if (pktlen > MCLBYTES) { DPRINTF("pktlen %jd > MCLBYTES %jd", pktlen, MCLBYTES, 0, 0); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } if (pktlen > total_len) { DPRINTF("pktlen %jd > total_len %jd", pktlen, total_len, 0, 0); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } Index: src/sys/dev/usb/if_udav.c diff -u src/sys/dev/usb/if_udav.c:1.73 src/sys/dev/usb/if_udav.c:1.74 --- src/sys/dev/usb/if_udav.c:1.73 Tue Jan 7 06:42:26 2020 +++ src/sys/dev/usb/if_udav.c Wed Jan 29 06:35:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_udav.c,v 1.73 2020/01/07 06:42:26 maxv Exp $ */ +/* $NetBSD: if_udav.c,v 1.74 2020/01/29 06:35:28 thorpej Exp $ */ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.73 2020/01/07 06:42:26 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.74 2020/01/29 06:35:28 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -713,14 +713,14 @@ udav_rx_loop(struct usbnet *un, struct u DPRINTF(("%s: RX Length: 0x%02x\n", device_xname(un->un_dev), pkt_len)); if (pktstat & UDAV_RSR_LCS) { - ifp->if_collisions++; + if_statinc(ifp, if_collisions); return; } if (pkt_len < sizeof(struct ether_header) || pkt_len > total_len || (pktstat & UDAV_RSR_ERR)) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } Index: src/sys/dev/usb/if_umb.c diff -u src/sys/dev/usb/if_umb.c:1.10 src/sys/dev/usb/if_umb.c:1.11 --- src/sys/dev/usb/if_umb.c:1.10 Tue Dec 17 04:54:36 2019 +++ src/sys/dev/usb/if_umb.c Wed Jan 29 06:35:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_umb.c,v 1.10 2019/12/17 04:54:36 christos Exp $ */ +/* $NetBSD: if_umb.c,v 1.11 2020/01/29 06:35:28 thorpej Exp $ */ /* $OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */ /* @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.10 2019/12/17 04:54:36 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.11 2020/01/29 06:35:28 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -889,7 +889,7 @@ umb_input(struct ifnet *ifp, struct mbuf return; } if (pktlen < sizeof(struct ip)) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); DPRINTFN(4, "%s: dropping short packet (len %zd)\n", __func__, pktlen); m_freem(m); @@ -897,11 +897,10 @@ umb_input(struct ifnet *ifp, struct mbuf } s = splnet(); if (__predict_false(!pktq_enqueue(ip_pktq, m, 0))) { - ifp->if_iqdrops++; + if_statinc(ifp, if_iqdrops); m_freem(m); } else { - ifp->if_ipackets++; - ifp->if_ibytes += pktlen; + if_statadd2(ifp, if_ipackets, 1, if_ibytes, pktlen); } splx(s); } @@ -939,7 +938,7 @@ umb_watchdog(struct ifnet *ifp) if (sc->sc_dying) return; - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); printf("%s: watchdog timeout\n", DEVNAM(sc)); usbd_abort_pipe(sc->sc_tx_pipe); return; @@ -1894,7 +1893,7 @@ umb_txeof(struct usbd_xfer *xfer, void * if (status != USBD_NORMAL_COMPLETION) { if (status != USBD_NOT_STARTED && status != USBD_CANCELLED) { - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); DPRINTF("%s: tx error: %s\n", DEVNAM(sc), usbd_errstr(status)); if (status == USBD_STALLED) @@ -2016,7 +2015,7 @@ umb_decap(struct umb_softc *sc, struct u doff = UGETDW(dgram32->dwDatagramIndex); break; default: - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto done; } @@ -2034,7 +2033,7 @@ umb_decap(struct umb_softc *sc, struct u DPRINTFN(3, "%s: decap %d bytes\n", DEVNAM(sc), dlen); m = m_devget(dp, dlen, 0, ifp); if (m == NULL) { - ifp->if_iqdrops++; + if_statinc(ifp, if_iqdrops); continue; } @@ -2046,7 +2045,7 @@ done: toosmall: DPRINTF("%s: packet too small (%d)\n", DEVNAM(sc), len); fail: - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); splx(s); } Index: src/sys/dev/usb/if_upgt.c diff -u src/sys/dev/usb/if_upgt.c:1.27 src/sys/dev/usb/if_upgt.c:1.28 --- src/sys/dev/usb/if_upgt.c:1.27 Wed Jan 15 08:20:13 2020 +++ src/sys/dev/usb/if_upgt.c Wed Jan 29 06:35:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_upgt.c,v 1.27 2020/01/15 08:20:13 skrll Exp $ */ +/* $NetBSD: if_upgt.c,v 1.28 2020/01/29 06:35:28 thorpej Exp $ */ /* $OpenBSD: if_upgt.c,v 1.49 2010/04/20 22:05:43 tedu Exp $ */ /* @@ -18,7 +18,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_upgt.c,v 1.27 2020/01/15 08:20:13 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_upgt.c,v 1.28 2020/01/29 06:35:28 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1491,7 +1491,7 @@ upgt_start(struct ifnet *ifp) aprint_error_dev(sc->sc_dev, "no free prism memory\n"); m_freem(m); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); break; } data_tx->ni = ni; @@ -1533,7 +1533,7 @@ upgt_start(struct ifnet *ifp) "no free prism memory\n"); m_freem(m); ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); break; } data_tx->ni = ni; @@ -1611,7 +1611,7 @@ upgt_tx_task(void *arg) data_tx->m = NULL; ieee80211_free_node(data_tx->ni); data_tx->ni = NULL; - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); break; } @@ -1696,7 +1696,7 @@ upgt_tx_task(void *arg) error != USBD_IN_PROGRESS) { aprint_error_dev(sc->sc_dev, "could not transmit TX data URB\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); break; } @@ -1735,7 +1735,7 @@ upgt_tx_done(struct upgt_softc *sc, uint data_tx->addr = 0; sc->tx_queued--; - ifp->if_opackets++; + if_statinc(ifp, if_opackets); DPRINTF(2, "%s: TX done: ", device_xname(sc->sc_dev)); DPRINTF(2, "memaddr=0x%08x, status=0x%04x, rssi=%d, ", @@ -1857,7 +1857,7 @@ upgt_rx(struct upgt_softc *sc, uint8_t * if (m == NULL) { DPRINTF(1, "%s: could not create RX mbuf\n", device_xname(sc->sc_dev)); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); return; } Index: src/sys/dev/usb/if_upl.c diff -u src/sys/dev/usb/if_upl.c:1.69 src/sys/dev/usb/if_upl.c:1.70 --- src/sys/dev/usb/if_upl.c:1.69 Tue Jan 7 06:42:26 2020 +++ src/sys/dev/usb/if_upl.c Wed Jan 29 06:35:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_upl.c,v 1.69 2020/01/07 06:42:26 maxv Exp $ */ +/* $NetBSD: if_upl.c,v 1.70 2020/01/29 06:35:28 thorpej Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.69 2020/01/07 06:42:26 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.70 2020/01/29 06:35:28 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -307,11 +307,10 @@ upl_input(struct ifnet *ifp, struct mbuf s = splnet(); if (__predict_false(!pktq_enqueue(ip_pktq, m, 0))) { - ifp->if_iqdrops++; + if_statinc(ifp, if_iqdrops); m_freem(m); } else { - ifp->if_ipackets++; - ifp->if_ibytes += pktlen; + if_statadd2(ifp, if_ipackets, 1, if_ibytes, pktlen); } splx(s); #endif Index: src/sys/dev/usb/if_ural.c diff -u src/sys/dev/usb/if_ural.c:1.61 src/sys/dev/usb/if_ural.c:1.62 --- src/sys/dev/usb/if_ural.c:1.61 Sun Dec 1 08:27:54 2019 +++ src/sys/dev/usb/if_ural.c Wed Jan 29 06:35:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ural.c,v 1.61 2019/12/01 08:27:54 maxv Exp $ */ +/* $NetBSD: if_ural.c,v 1.62 2020/01/29 06:35:28 thorpej Exp $ */ /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.61 2019/12/01 08:27:54 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.62 2020/01/29 06:35:28 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -866,7 +866,7 @@ ural_txeof(struct usbd_xfer *xfer, void if (status == USBD_STALLED) usbd_clear_endpoint_stall_async(sc->sc_tx_pipeh); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return; } @@ -878,7 +878,7 @@ ural_txeof(struct usbd_xfer *xfer, void data->ni = NULL; sc->tx_queued--; - ifp->if_opackets++; + if_statinc(ifp, if_opackets); DPRINTFN(10, ("tx done\n")); @@ -916,7 +916,7 @@ ural_rxeof(struct usbd_xfer *xfer, void if (len < RAL_RX_DESC_SIZE + IEEE80211_MIN_LEN) { DPRINTF(("%s: xfer too short %d\n", device_xname(sc->sc_dev), len)); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto skip; } @@ -930,19 +930,19 @@ ural_rxeof(struct usbd_xfer *xfer, void * those frames when we filled RAL_TXRX_CSR2. */ DPRINTFN(5, ("PHY or CRC error\n")); - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto skip; } MGETHDR(mnew, M_DONTWAIT, MT_DATA); if (mnew == NULL) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto skip; } MCLGET(mnew, M_DONTWAIT); if (!(mnew->m_flags & M_EXT)) { - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); m_freem(mnew); goto skip; } @@ -1400,7 +1400,7 @@ ural_start(struct ifnet *ifp) bpf_mtap3(ic->ic_rawbpf, m0, BPF_D_OUT); if (ural_tx_data(sc, m0, ni) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); break; } } @@ -1422,7 +1422,7 @@ ural_watchdog(struct ifnet *ifp) if (--sc->sc_tx_timer == 0) { printf("%s: device timeout\n", device_xname(sc->sc_dev)); /*ural_init(sc); XXX needs a process context! */ - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); return; } ifp->if_timer = 1; @@ -2341,7 +2341,7 @@ ural_amrr_update(struct usbd_xfer *xfer, } /* count TX retry-fail as Tx errors */ - ifp->if_oerrors += sc->sta[9]; + if_statadd(ifp, if_oerrors, sc->sta[9]); sc->amn.amn_retrycnt = sc->sta[7] + /* TX one-retry ok count */