Wed Jan 29 06:39:07 2020 UTC ()
Adopt <net/if_stats.h>.


(thorpej)
diff -r1.34 -r1.35 src/sys/dev/usb/if_ure.c
diff -r1.72 -r1.73 src/sys/dev/usb/if_url.c
diff -r1.35 -r1.36 src/sys/dev/usb/if_urndis.c
diff -r1.20 -r1.21 src/sys/dev/usb/if_urtw.c
diff -r1.80 -r1.81 src/sys/dev/usb/if_urtwn.c
diff -r1.55 -r1.56 src/sys/dev/usb/if_zyd.c
diff -r1.31 -r1.32 src/sys/dev/usb/uhso.c
diff -r1.33 -r1.34 src/sys/dev/usb/usbnet.c

cvs diff -r1.34 -r1.35 src/sys/dev/usb/if_ure.c (expand / switch to context diff)
--- src/sys/dev/usb/if_ure.c 2020/01/07 06:42:26 1.34
+++ src/sys/dev/usb/if_ure.c 2020/01/29 06:39:07 1.35
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ure.c,v 1.34 2020/01/07 06:42:26 maxv Exp $	*/
+/*	$NetBSD: if_ure.c,v 1.35 2020/01/29 06:39:07 thorpej Exp $	*/
 /*	$OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $	*/
 
 /*-
@@ -30,7 +30,7 @@
 /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.34 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.35 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1007,7 +1007,7 @@
 	do {
 		if (total_len < sizeof(rxhdr)) {
 			DPRINTF(("too few bytes left for a packet header\n"));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			return;
 		}
 
@@ -1020,7 +1020,7 @@
 		DPRINTFN(4, ("next packet is %d bytes\n", pkt_len));
 		if (pkt_len > total_len) {
 			DPRINTF(("not enough bytes left for next packet\n"));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			return;
 		}
 

cvs diff -r1.72 -r1.73 src/sys/dev/usb/if_url.c (expand / switch to context diff)
--- src/sys/dev/usb/if_url.c 2020/01/07 06:42:26 1.72
+++ src/sys/dev/usb/if_url.c 2020/01/29 06:39:07 1.73
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_url.c,v 1.72 2020/01/07 06:42:26 maxv Exp $	*/
+/*	$NetBSD: if_url.c,v 1.73 2020/01/29 06:39:07 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.72 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.73 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -576,7 +576,7 @@
 	DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev),__func__));
 
 	if (total_len <= ETHER_CRC_LEN || total_len <= sizeof(rxhdr)) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -591,7 +591,7 @@
 		 UGETW(rxhdr) & URL_RXHDR_MCASTPKT_MASK ? ", Multicast" : ""));
 
 	if ((UGETW(rxhdr) & URL_RXHDR_VALID_MASK) == 0) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 

cvs diff -r1.35 -r1.36 src/sys/dev/usb/if_urndis.c (expand / switch to context diff)
--- src/sys/dev/usb/if_urndis.c 2020/01/07 06:42:26 1.35
+++ src/sys/dev/usb/if_urndis.c 2020/01/29 06:39:07 1.36
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urndis.c,v 1.35 2020/01/07 06:42:26 maxv Exp $ */
+/*	$NetBSD: if_urndis.c,v 1.36 2020/01/29 06:39:07 thorpej Exp $ */
 /*	$OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
 
 /*
@@ -21,7 +21,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.35 2020/01/07 06:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.36 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -820,7 +820,7 @@
 		}
 
 		if (le32toh(msg->rm_datalen) < sizeof(struct ether_header)) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			printf("%s: urndis_decap invalid ethernet size "
 			    "%d < %zu\n",
 			    DEVNAME(un),

cvs diff -r1.20 -r1.21 src/sys/dev/usb/if_urtw.c (expand / switch to context diff)
--- src/sys/dev/usb/if_urtw.c 2019/11/28 17:09:10 1.20
+++ src/sys/dev/usb/if_urtw.c 2020/01/29 06:39:07 1.21
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtw.c,v 1.20 2019/11/28 17:09:10 maxv Exp $	*/
+/*	$NetBSD: if_urtw.c,v 1.21 2020/01/29 06:39:07 thorpej Exp $	*/
 /*	$OpenBSD: if_urtw.c,v 1.39 2011/07/03 15:47:17 matthew Exp $	*/
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtw.c,v 1.20 2019/11/28 17:09:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtw.c,v 1.21 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2489,7 +2489,7 @@
 			if (urtw_tx_start(sc, ni, m0, URTW_PRIORITY_NORMAL)
 			    != 0) {
 				ieee80211_free_node(ni);
-				ifp->if_oerrors++;
+				if_statinc(ifp, if_oerrors);
 				break;
 			}
 		}
@@ -2508,7 +2508,7 @@
 	if (sc->sc_txtimer > 0) {
 		if (--sc->sc_txtimer == 0) {
 			printf("%s: device timeout\n", device_xname(sc->sc_dev));
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			return;
 		}
 		ifp->if_timer = 1;
@@ -2537,7 +2537,7 @@
 		if (status == USBD_STALLED)
 			usbd_clear_endpoint_stall_async(sc->sc_txpipe_low);
 
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		return;
 	}
 
@@ -2547,7 +2547,7 @@
 	data->ni = NULL;
 
 	sc->sc_txtimer = 0;
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 
 	sc->sc_tx_queued[URTW_PRIORITY_LOW]--;
 	ifp->if_flags &= ~IFF_OACTIVE;
@@ -2576,7 +2576,7 @@
 		if (status == USBD_STALLED)
 			usbd_clear_endpoint_stall_async(sc->sc_txpipe_normal);
 
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		return;
 	}
 
@@ -2586,7 +2586,7 @@
 	data->ni = NULL;
 
 	sc->sc_txtimer = 0;
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 
 	sc->sc_tx_queued[URTW_PRIORITY_NORMAL]--;
 	ifp->if_flags &= ~IFF_OACTIVE;
@@ -3073,13 +3073,13 @@
 
 		if (status == USBD_STALLED)
 			usbd_clear_endpoint_stall_async(sc->sc_rxpipe);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		goto skip;
 	}
 
 	usbd_get_xfer_status(xfer, NULL, NULL, &actlen, NULL);
 	if (actlen < URTW_MIN_RXBUFSZ) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		goto skip;
 	}
 
@@ -3093,7 +3093,7 @@
 	desc = data->buf + len;
 	flen = ((desc[1] & 0x0f) << 8) + (desc[0] & 0xff);
 	if (flen > actlen) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		goto skip;
 	}
 
@@ -3119,7 +3119,7 @@
 	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;
 	}
 	MCLGET(mnew, M_DONTWAIT);
@@ -3127,7 +3127,7 @@
 		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;
 	}
 

cvs diff -r1.80 -r1.81 src/sys/dev/usb/if_urtwn.c (expand / switch to context diff)
--- src/sys/dev/usb/if_urtwn.c 2020/01/15 08:20:13 1.80
+++ src/sys/dev/usb/if_urtwn.c 2020/01/29 06:39:07 1.81
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.80 2020/01/15 08:20:13 skrll Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.81 2020/01/29 06:39:07 thorpej Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.80 2020/01/15 08:20:13 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.81 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2380,7 +2380,7 @@
 		 * to not receive these frames.
 		 */
 		DPRINTFN(DBG_RX, "CRC error", 0, 0, 0, 0);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 	/*
@@ -2391,12 +2391,12 @@
 	if (__predict_false(pktlen < (int)sizeof(struct ieee80211_frame_ack))) {
 		DPRINTFN(DBG_RX, "packet too short %jd", pktlen, 0, 0, 0);
 		ic->ic_stats.is_rx_tooshort++;
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 	if (__predict_false(pktlen > MCLBYTES)) {
 		DPRINTFN(DBG_RX, "packet too big %jd", pktlen, 0, 0, 0);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -2420,7 +2420,7 @@
 	if (__predict_false(m == NULL)) {
 		aprint_error_dev(sc->sc_dev, "couldn't allocate rx mbuf\n");
 		ic->ic_stats.is_rx_nobuf++;
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 	if (pktlen > (int)MHLEN) {
@@ -2430,7 +2430,7 @@
 			    "couldn't allocate rx mbuf cluster\n");
 			m_freem(m);
 			ic->ic_stats.is_rx_nobuf++;
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			return;
 		}
 	}
@@ -2598,13 +2598,13 @@
 				usbd_clear_endpoint_stall_async(pipe);
 			}
 			printf("ERROR1\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		}
 		splx(s);
 		return;
 	}
 
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 	urtwn_start(ifp);
 	splx(s);
 
@@ -2891,7 +2891,7 @@
 		if (m->m_len < (int)sizeof(*eh) &&
 		    (m = m_pullup(m, sizeof(*eh))) == NULL) {
 			printf("ERROR6\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 		eh = mtod(m, struct ether_header *);
@@ -2899,7 +2899,7 @@
 		if (ni == NULL) {
 			m_freem(m);
 			printf("ERROR5\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 
@@ -2908,7 +2908,7 @@
 		if ((m = ieee80211_encap(ic, m, ni)) == NULL) {
 			ieee80211_free_node(ni);
 			printf("ERROR4\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
  sendit:
@@ -2918,7 +2918,7 @@
 			m_freem(m);
 			ieee80211_free_node(ni);
 			printf("ERROR3\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			continue;
 		}
 		m_freem(m);
@@ -2942,7 +2942,7 @@
 			aprint_error_dev(sc->sc_dev, "device timeout\n");
 			/* urtwn_init(ifp); XXX needs a process context! */
 			printf("ERROR2\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			return;
 		}
 		ifp->if_timer = 1;

cvs diff -r1.55 -r1.56 src/sys/dev/usb/if_zyd.c (expand / switch to context diff)
--- src/sys/dev/usb/if_zyd.c 2020/01/15 08:21:00 1.55
+++ src/sys/dev/usb/if_zyd.c 2020/01/29 06:39:07 1.56
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $	*/
-/*	$NetBSD: if_zyd.c,v 1.55 2020/01/15 08:21:00 skrll Exp $	*/
+/*	$NetBSD: if_zyd.c,v 1.56 2020/01/29 06:39:07 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr>
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.55 2020/01/15 08:21:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.56 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1857,7 +1857,7 @@
 		((struct zyd_node *)ni)->amn.amn_retrycnt++;
 
 		if (le16toh(retry->count) & 0x100)
-			ifp->if_oerrors++;	/* too many retries */
+			if_statinc(ifp, if_oerrors);
 
 	} else if (le16toh(cmd->code) == ZYD_NOTIF_IORD) {
 		struct rq *rqp;
@@ -1913,7 +1913,7 @@
 	if (len < ZYD_MIN_FRAGSZ) {
 		printf("%s: frame too short (length=%d)\n",
 		    device_xname(sc->sc_dev), len);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1924,7 +1924,7 @@
 	if (stat->flags & ZYD_RX_ERROR) {
 		DPRINTF(("%s: RX status indicated error (%x)\n",
 		    device_xname(sc->sc_dev), stat->flags));
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -1937,7 +1937,7 @@
 	if (m == NULL) {
 		printf("%s: could not allocate rx mbuf\n",
 		    device_xname(sc->sc_dev));
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 	if (rlen > MHLEN) {
@@ -1946,7 +1946,7 @@
 			printf("%s: could not allocate rx mbuf cluster\n",
 			    device_xname(sc->sc_dev));
 			m_freem(m);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			return;
 		}
 	}
@@ -2006,7 +2006,7 @@
 	if (len < ZYD_MIN_RXBUFSZ) {
 		printf("%s: xfer too short (length=%d)\n",
 		    device_xname(sc->sc_dev), len);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		goto skip;
 	}
 
@@ -2145,7 +2145,7 @@
 	    USBD_FORCE_SHORT_XFER, ZYD_TX_TIMEOUT, zyd_txeof);
 	error = usbd_transfer(data->xfer);
 	if (error != USBD_IN_PROGRESS && error != 0) {
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		return EIO;
 	}
 	sc->tx_queued++;
@@ -2172,7 +2172,7 @@
 			usbd_clear_endpoint_stall_async(
 			    sc->zyd_ep[ZYD_ENDPT_BOUT]);
 		}
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		return;
 	}
 
@@ -2185,7 +2185,7 @@
 	data->ni = NULL;
 
 	sc->tx_queued--;
-	ifp->if_opackets++;
+	if_statinc(ifp, if_opackets);
 
 	sc->tx_timer = 0;
 	ifp->if_flags &= ~IFF_OACTIVE;
@@ -2302,7 +2302,7 @@
 	    USBD_FORCE_SHORT_XFER, ZYD_TX_TIMEOUT, zyd_txeof);
 	error = usbd_transfer(data->xfer);
 	if (error != USBD_IN_PROGRESS && error != 0) {
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		return EIO;
 	}
 	sc->tx_queued++;
@@ -2358,13 +2358,13 @@
 			bpf_mtap(ifp, m0, BPF_D_OUT);
 			if ((m0 = ieee80211_encap(ic, m0, ni)) == NULL) {
 				ieee80211_free_node(ni);
-				ifp->if_oerrors++;
+				if_statinc(ifp, if_oerrors);
 				continue;
 			}
 			bpf_mtap3(ic->ic_rawbpf, m0, BPF_D_OUT);
 			if (zyd_tx_data(sc, m0, ni) != 0) {
 				ieee80211_free_node(ni);
-				ifp->if_oerrors++;
+				if_statinc(ifp, if_oerrors);
 				break;
 			}
 		}
@@ -2386,7 +2386,7 @@
 		if (--sc->tx_timer == 0) {
 			printf("%s: device timeout\n", device_xname(sc->sc_dev));
 			/* zyd_init(ifp); XXX needs a process context ? */
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			return;
 		}
 		ifp->if_timer = 1;

cvs diff -r1.31 -r1.32 src/sys/dev/usb/uhso.c (expand / switch to context diff)
--- src/sys/dev/usb/uhso.c 2019/12/01 08:27:54 1.31
+++ src/sys/dev/usb/uhso.c 2020/01/29 06:39:07 1.32
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhso.c,v 1.31 2019/12/01 08:27:54 maxv Exp $	*/
+/*	$NetBSD: uhso.c,v 1.32 2020/01/29 06:39:07 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2009 Iain Hibbert
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.31 2019/12/01 08:27:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.32 2020/01/29 06:39:07 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2024,7 +2024,7 @@
 		else
 			return;
 
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 	} else {
 		usbd_get_xfer_status(xfer, NULL, NULL, &cc, NULL);
 		DPRINTF(5, "wrote %d bytes (of %zd)\n", cc, hp->hp_wlen);
@@ -2032,7 +2032,7 @@
 		if (cc != hp->hp_wlen)
 			DPRINTF(0, "cc=%u, wlen=%zd\n", cc, hp->hp_wlen);
 
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 	}
 
 	s = splnet();
@@ -2065,7 +2065,7 @@
 		else
 			return;
 
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		hp->hp_rlen = 0;
 	} else {
 		usbd_get_xfer_status(xfer, NULL, (void **)&cp, &cc, NULL);
@@ -2097,14 +2097,14 @@
 			MGETHDR(m, M_DONTWAIT, MT_DATA);
 			if (m == NULL) {
 				aprint_error_ifnet(ifp, "no mbufs\n");
-				ifp->if_ierrors++;
+				if_statinc(ifp, if_ierrors);
 				break;
 			}
 
 			MCLGET(m, M_DONTWAIT);
 			if (!ISSET(m->m_flags, M_EXT)) {
 				aprint_error_ifnet(ifp, "no mbuf clusters\n");
-				ifp->if_ierrors++;
+				if_statinc(ifp, if_ierrors);
 				m_freem(m);
 				break;
 			}
@@ -2127,7 +2127,7 @@
 			    "bad IP header (v=%d, hl=%zd)\n",
 			    mtod(m, struct ip *)->ip_v, want);
 
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			m_freem(m);
 			break;
 		}
@@ -2179,8 +2179,7 @@
 		if (__predict_false(!pktq_enqueue(ip_pktq, m, 0))) {
 			m_freem(m);
 		} else {
-			ifp->if_ipackets++;
-			ifp->if_ibytes += got;
+			if_statadd2(ifp, if_ipackets, 1, if_ibytes, got);
 		}
 		splx(s);
 	}
@@ -2339,7 +2338,7 @@
 	m_freem(m);
 
 	if ((*hp->hp_write)(hp) != 0) {
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		CLR(ifp->if_flags, IFF_OACTIVE);
 	}
 }

cvs diff -r1.33 -r1.34 src/sys/dev/usb/usbnet.c (expand / switch to context diff)
--- src/sys/dev/usb/usbnet.c 2019/12/14 15:40:43 1.33
+++ src/sys/dev/usb/usbnet.c 2020/01/29 06:39:07 1.34
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.33 2019/12/14 15:40:43 maya Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.34 2020/01/29 06:39:07 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.33 2019/12/14 15:40:43 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.34 2020/01/29 06:39:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -271,7 +271,7 @@
 	m = usbnet_newbuf(buflen);
 	if (m == NULL) {
 		DPRINTF("%d: no memory", unp->unp_number, 0, 0, 0);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -300,7 +300,7 @@
 
 	m = usbnet_newbuf(buflen);
 	if (m == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -402,12 +402,12 @@
 		break;
 
 	case USBD_NORMAL_COMPLETION:
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		break;
 
 	default:
 
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		if (usbd_ratecheck(&unp->unp_tx_notice))
 			aprint_error_dev(un->un_dev, "usb error on tx: %s\n",
 			    usbd_errstr(status));
@@ -500,13 +500,13 @@
 		length = uno_tx_prepare(un, m, c);
 		if (length == 0) {
 			DPRINTF("uno_tx_prepare gave zero length", 0, 0, 0, 0);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			break;
 		}
 
 		if (__predict_false(c->unc_xfer == NULL)) {
 			DPRINTF("unc_xfer is NULL", 0, 0, 0, 0);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			break;
 		}
 
@@ -518,7 +518,7 @@
 		if (err != USBD_IN_PROGRESS) {
 			DPRINTF("usbd_transfer on %jx for %ju bytes: %d",
 			    (uintptr_t)c->unc_buf, length, err, 0);
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			break;
 		}
 		done_transmit = true;
@@ -1149,7 +1149,7 @@
 	struct usbnet_cdata * const cd = un_cdata(un);
 	usbd_status err;
 
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 	aprint_error_dev(un->un_dev, "watchdog timeout\n");
 
 	if (cd->uncd_tx_cnt > 0) {