Module Name:    src
Committed By:   thorpej
Date:           Wed Jan 29 05:39:48 UTC 2020

Modified Files:
        src/sys/arch/sun2/dev: if_ec.c
        src/sys/arch/sun3/dev: if_ie.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sun2/dev/if_ec.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sun3/dev/if_ie.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/arch/sun2/dev/if_ec.c
diff -u src/sys/arch/sun2/dev/if_ec.c:1.34 src/sys/arch/sun2/dev/if_ec.c:1.35
--- src/sys/arch/sun2/dev/if_ec.c:1.34	Wed May 29 10:07:29 2019
+++ src/sys/arch/sun2/dev/if_ec.c	Wed Jan 29 05:39:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ec.c,v 1.34 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: if_ec.c,v 1.35 2020/01/29 05:39:48 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.34 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.35 2020/01/29 05:39:48 thorpej Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -419,7 +419,7 @@ ec_intr(void *arg)
 		if (ECREG_CSR_RD & EC_CSR_JAM) {
 			ECREG_CSR_WR(ECREG_CSR_RD &
 			    (EC_CSR_BINT | EC_CSR_AINT | EC_CSR_PAMASK));
-			sc->sc_ethercom.ec_if.if_collisions++;
+			if_statinc(ifp, if_collisions);
 			retval++;
 			ec_coll(sc);
 
@@ -429,7 +429,7 @@ ec_intr(void *arg)
 			ECREG_CSR_WR(ECREG_CSR_RD &
 			    (EC_CSR_BINT | EC_CSR_AINT | EC_CSR_PAMASK));
 			retval++;
-			sc->sc_ethercom.ec_if.if_opackets++;
+			if_statinc(ifp, if_opackets);
 			sc->sc_jammed = 0;
 			ifp->if_flags &= ~IFF_OACTIVE;
 			if_schedule_deferred_start(ifp);
@@ -526,7 +526,7 @@ ec_recv(struct ec_softc *sc, int intbit)
 		/* Something went wrong. */
 		if (m0 != NULL)
 			m_freem(m0);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 	}
 
 	/* Give the receive buffer back to the card. */
@@ -629,7 +629,7 @@ ec_coll(struct ec_softc *sc)
 	u_short jams;
 
 	if ((++sc->sc_colliding) >= EC_COLLISIONS_JAMMED) {
-		sc->sc_ethercom.ec_if.if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		if (!sc->sc_jammed)
 			printf("%s: ethernet jammed\n",
 			    device_xname(sc->sc_dev));
@@ -658,7 +658,7 @@ ec_watchdog(struct ifnet *ifp)
 	struct ec_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	sc->sc_ethercom.ec_if.if_oerrors++;
+	if_statinc(ifp, if_oerrors);
 
 	ec_reset(ifp);
 }

Index: src/sys/arch/sun3/dev/if_ie.c
diff -u src/sys/arch/sun3/dev/if_ie.c:1.70 src/sys/arch/sun3/dev/if_ie.c:1.71
--- src/sys/arch/sun3/dev/if_ie.c:1.70	Tue May 28 07:41:48 2019
+++ src/sys/arch/sun3/dev/if_ie.c	Wed Jan 29 05:39:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ie.c,v 1.70 2019/05/28 07:41:48 msaitoh Exp $ */
+/*	$NetBSD: if_ie.c,v 1.71 2020/01/29 05:39:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@@ -98,7 +98,7 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.70 2019/05/28 07:41:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.71 2020/01/29 05:39:48 thorpej Exp $");
 
 #include "opt_inet.h"
 #include "opt_ns.h"
@@ -432,7 +432,7 @@ iewatchdog(struct ifnet *ifp)
 	struct ie_softc *sc = ifp->if_softc;
 
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 	iereset(sc);
 }
 
@@ -504,7 +504,7 @@ ie_intr(void *arg)
 #ifdef IEDEBUG
 		printf("%s: receiver not ready\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(&sc->sc_if, if_ierrors);
 		iereset(sc);
 	}
 
@@ -542,11 +542,11 @@ ierint(struct ie_softc *sc)
 
 		if ((status & IE_FD_COMPLETE) && (status & IE_FD_OK)) {
 			if (!--timesthru) {
-				sc->sc_if.if_ierrors +=
+				if_statadd(&sc->sc_if, if_ierrors,
 				    SWAP(scb->ie_err_crc) +
 				    SWAP(scb->ie_err_align) +
 				    SWAP(scb->ie_err_resource) +
-				    SWAP(scb->ie_err_overrun);
+				    SWAP(scb->ie_err_overrun));
 				scb->ie_err_crc = 0;
 				scb->ie_err_align = 0;
 				scb->ie_err_resource = 0;
@@ -591,10 +591,10 @@ ietint(struct ie_softc *sc)
 		printf("%s: command still busy!\n", __func__);
 
 	if (status & IE_STAT_OK) {
-		ifp->if_opackets++;
-		ifp->if_collisions += SWAP(status & IE_XS_MAXCOLL);
+		if_statadd2(ifp, if_opackets, 1,
+			    if_collisions, SWAP(status & IE_XS_MAXCOLL));
 	} else {
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		/*
 		 * XXX
 		 * Check SQE and DEFERRED?
@@ -613,7 +613,7 @@ ietint(struct ie_softc *sc)
 			printf("%s: DMA underrun\n", device_xname(sc->sc_dev));
 		if (status & IE_XS_EXCMAX) {
 			/* Do not print this one (too noisy). */
-			ifp->if_collisions += 16;
+			if_statadd(ifp, if_collisions, 16);
 		}
 	}
 
@@ -896,7 +896,7 @@ ie_readframe(struct ie_softc *sc, int nu
 		ie_drop_packet_buffer(sc);
 	}
 	if (m == 0) {
-		sc->sc_if.if_ierrors++;
+		if_statinc(&sc->sc_if, if_ierrors);
 		return;
 	}
 

Reply via email to