Module Name:    src
Committed By:   thorpej
Date:           Wed Jan 29 14:14:56 UTC 2020

Modified Files:
        src/sys/dev/ic: bwfm.c bwi.c cs89x0.c dm9000.c dp8390.c dp83932.c
            dwc_gmac.c

Log Message:
Adopt <net/if_stats.h>.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/bwi.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/ic/cs89x0.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/dm9000.c
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/ic/dp8390.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/dp83932.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/dwc_gmac.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/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.19 src/sys/dev/ic/bwfm.c:1.20
--- src/sys/dev/ic/bwfm.c:1.19	Fri Dec 27 09:22:20 2019
+++ src/sys/dev/ic/bwfm.c	Wed Jan 29 14:14:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.19 2019/12/27 09:22:20 msaitoh Exp $ */
+/* $NetBSD: bwfm.c,v 1.20 2020/01/29 14:14:55 thorpej Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -329,7 +329,7 @@ bwfm_start(struct ifnet *ifp)
 			break;
 		}
 		if (error != 0) {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			m_freem(m);
 			continue;
 		}
@@ -511,7 +511,7 @@ bwfm_watchdog(struct ifnet *ifp)
 	if (sc->sc_tx_timer > 0) {
 		if (--sc->sc_tx_timer == 0) {
 			printf("%s: device timeout\n", DEVNAME(sc));
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			return;
 		}
 		ifp->if_timer = 1;

Index: src/sys/dev/ic/bwi.c
diff -u src/sys/dev/ic/bwi.c:1.36 src/sys/dev/ic/bwi.c:1.37
--- src/sys/dev/ic/bwi.c:1.36	Sat Dec 22 14:07:53 2018
+++ src/sys/dev/ic/bwi.c	Wed Jan 29 14:14:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwi.c,v 1.36 2018/12/22 14:07:53 maxv Exp $	*/
+/*	$NetBSD: bwi.c,v 1.37 2020/01/29 14:14:55 thorpej Exp $	*/
 /*	$OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $	*/
 
 /*
@@ -48,7 +48,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.36 2018/12/22 14:07:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.37 2020/01/29 14:14:55 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/callout.h>
@@ -7420,7 +7420,7 @@ bwi_start(struct ifnet *ifp)
 			if (m->m_len < sizeof(*eh)) {
 				m = m_pullup(m, sizeof(*eh));
 				if (m == NULL) {
-					ifp->if_oerrors++;
+					if_statinc(ifp, if_oerrors);
 					continue;
 				}
 			}
@@ -7428,7 +7428,7 @@ bwi_start(struct ifnet *ifp)
 
 			ni = ieee80211_find_txnode(ic, eh->ether_dhost);
 			if (ni == NULL) {
-				ifp->if_oerrors++;
+				if_statinc(ifp, if_oerrors);
 				m_freem(m);
 				continue;
 			}
@@ -7450,7 +7450,7 @@ bwi_start(struct ifnet *ifp)
 				DPRINTF(sc, BWI_DBG_MISC,
 				    "%s: discard, classification failure\n",
 				    __func__);
-				ifp->if_oerrors++;
+				if_statinc(ifp, if_oerrors);
 				m_freem(m);
 				ieee80211_free_node(ni);
 				continue;
@@ -7458,7 +7458,7 @@ bwi_start(struct ifnet *ifp)
 
 			/* [TRC: XXX wi(4) and awi(4) do this; iwi(4)
 			   doesn't.] */
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 
 			/* [TRC: XXX When should the packet be
 			   filtered?  Different drivers appear to do it
@@ -7467,7 +7467,7 @@ bwi_start(struct ifnet *ifp)
 			bpf_mtap(ifp, m, BPF_D_OUT);
 			m = ieee80211_encap(ic, m, ni);
 			if (m == NULL) {
-				ifp->if_oerrors++;
+				if_statinc(ifp, if_oerrors);
 				ieee80211_free_node(ni);
 				continue;
 			}
@@ -7478,7 +7478,7 @@ bwi_start(struct ifnet *ifp)
 		/* [TRC: XXX What about ic->ic_flags & IEEE80211_F_PRIVACY?] */
 		if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
 			if (ieee80211_crypto_encap(ic, ni, m) == NULL) {
-				ifp->if_oerrors++;
+				if_statinc(ifp, if_oerrors);
 				m_freem(m);
 				ieee80211_free_node(ni);
 				continue;
@@ -7488,7 +7488,7 @@ bwi_start(struct ifnet *ifp)
 
 		if (bwi_encap(sc, idx, m, &ni, mgt_pkt) != 0) {
 			/* 'm' is freed in bwi_encap() if we reach here */
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			if (ni != NULL)
 				ieee80211_free_node(ni);
 			continue;
@@ -7524,7 +7524,7 @@ bwi_watchdog(struct ifnet *ifp)
 	if (sc->sc_tx_timer) {
 		if (--sc->sc_tx_timer == 0) {
 			aprint_error_dev(sc->sc_dev, "device timeout\n");
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			/* TODO */
 			/* [TRC: XXX TODO what?  Stop the device?
 			   Bring it down?  iwi(4) does this.] */
@@ -8475,7 +8475,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_
 		    rb->rb_dmap->dm_mapsize, BUS_DMASYNC_POSTREAD);
 
 		if (bwi_newbuf(sc, idx, 0)) {
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto next;
 		}
 
@@ -8491,7 +8491,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_
 		if (buflen < BWI_FRAME_MIN_LEN(wh_ofs)) {
 			aprint_error_dev(sc->sc_dev, "short frame %d,"
 			    " hdr_extra %d\n", buflen, hdr_extra);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			m_freem(m);
 			goto next;
 		}
@@ -9395,7 +9395,7 @@ bwi_txeof(struct bwi_softc *sc)
 
 		_bwi_txeof(sc, tx_id);
 
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 	}
 
 	if ((ifp->if_flags & IFF_OACTIVE) == 0)

Index: src/sys/dev/ic/cs89x0.c
diff -u src/sys/dev/ic/cs89x0.c:1.47 src/sys/dev/ic/cs89x0.c:1.48
--- src/sys/dev/ic/cs89x0.c:1.47	Wed May 29 10:07:29 2019
+++ src/sys/dev/ic/cs89x0.c	Wed Jan 29 14:14:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs89x0.c,v 1.47 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: cs89x0.c,v 1.48 2020/01/29 14:14:55 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2004 Christopher Gilbert
@@ -212,7 +212,7 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.47 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.48 2020/01/29 14:14:55 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -1462,7 +1462,7 @@ cs_counter_event(struct cs_softc *sc, ui
 		 * Increment the input error count, the first 6bits are the
 		 * register id.
 		 */
-		ifp->if_ierrors += ((errorCount & 0xffC0) >> 6);
+		if_statadd(ifp, if_ierrors, (errorCount & 0xffC0) >> 6);
 		break;
 	default:
 		/* Do nothing */
@@ -1528,7 +1528,7 @@ cs_transmit_event(struct cs_softc *sc, u
 	if (txEvent & (TX_EVENT_LOSS_CRS | TX_EVENT_SQE_ERR |
 	    TX_EVENT_OUT_WIN | TX_EVENT_JABBER | TX_EVENT_16_COLL)) {
 		/* Increment the output error count */
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 
 		/* Note carrier loss. */
 		if (txEvent & TX_EVENT_LOSS_CRS)
@@ -1562,12 +1562,15 @@ cs_transmit_event(struct cs_softc *sc, u
 	}
 
 	/* Add the number of collisions for this frame */
+	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 	if (txEvent & TX_EVENT_16_COLL)
-		ifp->if_collisions += 16;
+		if_statadd_ref(nsr, if_collisions, 16);
 	else
-		ifp->if_collisions += ((txEvent & TX_EVENT_COLL_MASK) >> 11);
+		if_statadd_ref(nsr, if_collisions,
+		    ((txEvent & TX_EVENT_COLL_MASK) >> 11));
 
-	ifp->if_opackets++;
+	if_statinc_ref(nsr, if_opackets);
+	IF_STAT_PUTREF(ifp);
 
 	/* Transmission is no longer in progress */
 	sc->sc_txbusy = FALSE;
@@ -1605,7 +1608,7 @@ cs_receive_event(struct cs_softc *sc, ui
 	/* If the frame was not received OK */
 	if (!(rxEvent & RX_EVENT_RX_OK)) {
 		/* Increment the input error count */
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 
 		/* If debugging is enabled then log error messages. */
 		if (ifp->if_flags & IFF_DEBUG) {
@@ -1691,7 +1694,7 @@ cs_process_receive(struct cs_softc *sc)
 	if (m == 0) {
 		aprint_error_dev(sc->sc_dev,
 		    "cs_process_receive: unable to allocate mbuf\n");
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		/*
 		 * Couldn't allocate an mbuf so things are not good, may as
 		 * well drop the packet I think.
@@ -1773,7 +1776,7 @@ cs_process_rx_early(struct cs_softc *sc)
 	if (m == 0) {
 		aprint_error_dev(sc->sc_dev,
 		    "cs_process_rx_early: unable to allocate mbuf\n");
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		/*
 		 * Couldn't allocate an mbuf so things are not good, may as
 		 * well drop the packet I think.
@@ -1848,7 +1851,7 @@ cs_process_rx_early(struct cs_softc *sc)
 		cs_ether_input(sc, m);
 	} else {
 		m_freem(m);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 	}
 }
 
@@ -1942,7 +1945,7 @@ cs_start_output(struct ifnet *ifp)
 
 				/* Discard the bad mbuf chain */
 				m_freem(pMbufChain);
-				sc->sc_ethercom.ec_if.if_oerrors++;
+				if_statinc(&sc->sc_ethercom.ec_if, if_oerrors);
 
 				/* Loop up to transmit the next chain */
 				txLoop = 0;
@@ -1983,7 +1986,7 @@ cs_start_output(struct ifnet *ifp)
 						 * Increment the output error
 						 * count
 						 */
-						ifp->if_oerrors++;
+						if_statinc(ifp, if_oerrors);
 						/*
 						 * exit the routine and drop
 						 * the packet.

Index: src/sys/dev/ic/dm9000.c
diff -u src/sys/dev/ic/dm9000.c:1.21 src/sys/dev/ic/dm9000.c:1.22
--- src/sys/dev/ic/dm9000.c:1.21	Wed May 29 10:07:29 2019
+++ src/sys/dev/ic/dm9000.c	Wed Jan 29 14:14:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dm9000.c,v 1.21 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: dm9000.c,v 1.22 2020/01/29 14:14:55 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2009 Paul Fleischer
@@ -560,9 +560,9 @@ int dme_intr(void *arg)
 
 		if (tx_status == 0x0) {
 			/* Frame successfully sent */
-			ifp->if_opackets++;
+			if_statinc(ifp, if_opackets);
 		} else {
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 		}
 
 		/* If we have nothing ready to transmit, prepare something */
@@ -797,18 +797,18 @@ dme_receive(struct dme_softc *sc, struct
 			rx_status = sc->sc_pkt_read(sc, ifp, &m);
 			if (m == NULL) {
 				/* failed to allocate a receive buffer */
-				ifp->if_ierrors++;
+				if_statinc(ifp, if_ierrors);
 				RX_DPRINTF(("dme_receive: "
 					"Error allocating buffer\n"));
 			} else if (rx_status & (DM9000_RSR_CE | DM9000_RSR_PLE)) {
 				/* Error while receiving the packet,
 				 * discard it and keep track of counters
 				 */
-				ifp->if_ierrors++;
+				if_statinc(ifp, if_ierrors);
 				RX_DPRINTF(("dme_receive: "
 					"Error reciving packet\n"));
 			} else if (rx_status & DM9000_RSR_LCS) {
-				ifp->if_collisions++;
+				if_statinc(ifp, if_collisions);
 			} else {
 				if_percpuq_enqueue(ifp->if_percpuq, m);
 			}

Index: src/sys/dev/ic/dp8390.c
diff -u src/sys/dev/ic/dp8390.c:1.95 src/sys/dev/ic/dp8390.c:1.96
--- src/sys/dev/ic/dp8390.c:1.95	Wed May 29 10:07:29 2019
+++ src/sys/dev/ic/dp8390.c	Wed Jan 29 14:14:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dp8390.c,v 1.95 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: dp8390.c,v 1.96 2020/01/29 14:14:55 thorpej Exp $	*/
 
 /*
  * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.95 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.96 2020/01/29 14:14:55 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -237,7 +237,7 @@ dp8390_watchdog(struct ifnet *ifp)
 	struct dp8390_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++sc->sc_ec.ec_if.if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	dp8390_reset(sc);
 }
@@ -581,7 +581,7 @@ dp8390_rint(struct dp8390_softc *sc)
 			log(LOG_ERR, "%s: NIC memory corrupt - "
 			    "invalid packet length %d\n",
 			    device_xname(sc->sc_dev), len);
-			++sc->sc_ec.ec_if.if_ierrors;
+			if_statinc(&sc->sc_ec.ec_if, if_ierrors);
 			dp8390_reset(sc);
 			return;
 		}
@@ -653,6 +653,7 @@ dp8390_intr(void *arg)
 		 */
 		if ((isr & (ED_ISR_PTX | ED_ISR_TXE)) != 0 &&
 		    sc->txb_inuse != 0) {
+			net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 			uint8_t collisions =
 			    NIC_GET(regt, regh, ED_P0_NCR) & 0x0f;
 
@@ -678,7 +679,7 @@ dp8390_intr(void *arg)
 				}
 
 				/* Update output errors counter. */
-				++ifp->if_oerrors;
+				if_statinc_ref(nsr, if_oerrors);
 			} else {
 				/*
 				 * Throw away the non-error status bits.
@@ -693,7 +694,7 @@ dp8390_intr(void *arg)
 				 * Update total number of successfully
 				 * transmitted packets.
 				 */
-				++ifp->if_opackets;
+				if_statinc_ref(nsr, if_opackets);
 			}
 
 			/* Clear watchdog timer. */
@@ -704,7 +705,10 @@ dp8390_intr(void *arg)
 			 * Add in total number of collisions on last
 			 * transmission.
 			 */
-			ifp->if_collisions += collisions;
+			if (collisions)
+				if_statadd_ref(nsr, if_collisions, collisions);
+
+			IF_STAT_PUTREF(ifp);
 
 			/*
 			 * Decrement buffer in-use count if not zero (can only
@@ -729,7 +733,7 @@ dp8390_intr(void *arg)
 			 * fixed in later revs.  -DG
 			 */
 			if ((isr & ED_ISR_OVW) != 0) {
-				++ifp->if_ierrors;
+				if_statinc(ifp, if_ierrors);
 #ifdef DIAGNOSTIC
 				log(LOG_WARNING, "%s: warning - receiver "
 				    "ring buffer overrun\n",
@@ -744,7 +748,7 @@ dp8390_intr(void *arg)
 				 * missed packet.
 				 */
 				if ((isr & ED_ISR_RXE) != 0) {
-					++ifp->if_ierrors;
+					if_statinc(ifp, if_ierrors);
 #ifdef DEBUG
 					if (dp8390_debug) {
 						printf("%s: receive error %x\n",
@@ -914,7 +918,7 @@ dp8390_read(struct dp8390_softc *sc, int
 	/* Pull packet off interface. */
 	m = dp8390_get(sc, buf, len);
 	if (m == NULL) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 

Index: src/sys/dev/ic/dp83932.c
diff -u src/sys/dev/ic/dp83932.c:1.44 src/sys/dev/ic/dp83932.c:1.45
--- src/sys/dev/ic/dp83932.c:1.44	Tue May 28 07:41:48 2019
+++ src/sys/dev/ic/dp83932.c	Wed Jan 29 14:14:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dp83932.c,v 1.44 2019/05/28 07:41:48 msaitoh Exp $	*/
+/*	$NetBSD: dp83932.c,v 1.45 2020/01/29 14:14:55 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.44 2019/05/28 07:41:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.45 2020/01/29 14:14:55 thorpej Exp $");
 
 
 #include <sys/param.h>
@@ -534,7 +534,7 @@ sonic_watchdog(struct ifnet *ifp)
 	struct sonic_softc *sc = ifp->if_softc;
 
 	printf("%s: device timeout\n", device_xname(sc->sc_dev));
-	ifp->if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	(void)sonic_init(ifp);
 }
@@ -668,11 +668,15 @@ sonic_txintr(struct sonic_softc *sc)
 		/*
 		 * Check for errors and collisions.
 		 */
+		net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 		if (status & TCR_PTX)
-			ifp->if_opackets++;
+			if_statinc_ref(nsr, if_opackets);
 		else
-			ifp->if_oerrors++;
-		ifp->if_collisions += TDA_STATUS_NCOL(status);
+			if_statinc_ref(nsr, if_oerrors);
+		if (TDA_STATUS_NCOL(status))
+			if_statadd_ref(nsr, if_collisions,
+			    TDA_STATUS_NCOL(status));
+		IF_STAT_PUTREF(ifp);
 	}
 
 	/* Update the dirty transmit buffer pointer. */
@@ -755,7 +759,7 @@ sonic_rxintr(struct sonic_softc *sc)
 			else if (status & RCR_CRCR)
 				printf("%s: Rx CRC error\n",
 				    device_xname(sc->sc_dev));
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			SONIC_INIT_RXDESC(sc, i);
 			continue;
 		}
@@ -827,7 +831,7 @@ sonic_rxintr(struct sonic_softc *sc)
 			m = ds->ds_mbuf;
 			if (sonic_add_rxbuf(sc, i) != 0) {
  dropit:
-				ifp->if_ierrors++;
+				if_statinc(ifp, if_ierrors);
 				SONIC_INIT_RXDESC(sc, i);
 				bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0,
 				    ds->ds_dmamap->dm_mapsize,

Index: src/sys/dev/ic/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.68 src/sys/dev/ic/dwc_gmac.c:1.69
--- src/sys/dev/ic/dwc_gmac.c:1.68	Sat Oct 19 06:40:20 2019
+++ src/sys/dev/ic/dwc_gmac.c	Wed Jan 29 14:14:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.68 2019/10/19 06:40:20 tnn Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.69 2020/01/29 14:14:55 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.68 2019/10/19 06:40:20 tnn Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.69 2020/01/29 14:14:55 thorpej Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -1192,7 +1192,7 @@ dwc_gmac_tx_intr(struct dwc_gmac_softc *
 		if (data->td_m == NULL)
 			continue;
 
-		ifp->if_opackets++;
+		if_statinc(ifp, if_opackets);
 		nsegs = data->td_active->dm_nsegs;
 		bus_dmamap_sync(sc->sc_dmat, data->td_active, 0,
 		    data->td_active->dm_mapsize, BUS_DMASYNC_POSTWRITE);
@@ -1245,7 +1245,7 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc *
 			    "RX error: descriptor status %08x, skipping\n",
 			    le32toh(desc->ddesc_status0));
 #endif
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 
@@ -1264,13 +1264,13 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc *
 		 */
 		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) == 0) {
 			m_freem(mnew);
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 		mnew->m_len = mnew->m_pkthdr.len = mnew->m_ext.ext_size;
@@ -1295,7 +1295,7 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc *
 				panic("%s: could not load old rx mbuf",
 				    device_xname(sc->sc_dev));
 			}
-			ifp->if_ierrors++;
+			if_statinc(ifp, if_ierrors);
 			goto skip;
 		}
 		physaddr = data->rd_map->dm_segs[0].ds_addr;
@@ -1459,7 +1459,7 @@ dwc_gmac_intr(struct dwc_gmac_softc *sc)
 	 * Check error conditions
 	 */
 	if (dma_status & GMAC_DMA_INT_ERRORS) {
-		sc->sc_ec.ec_if.if_oerrors++;
+		if_statinc(&sc->sc_ec.ec_if, if_oerrors);
 #ifdef DWC_GMAC_DEBUG
 		dwc_dump_and_abort(sc, "interrupt error condition");
 #endif

Reply via email to