Module Name:    src
Committed By:   thorpej
Date:           Wed Jan 29 05:23:16 UTC 2020

Modified Files:
        src/sys/arch/amiga/dev: if_es.c if_qn.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amiga/dev/if_es.c
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/amiga/dev/if_qn.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/amiga/dev/if_es.c
diff -u src/sys/arch/amiga/dev/if_es.c:1.64 src/sys/arch/amiga/dev/if_es.c:1.65
--- src/sys/arch/amiga/dev/if_es.c:1.64	Wed May 29 10:07:28 2019
+++ src/sys/arch/amiga/dev/if_es.c	Wed Jan 29 05:23:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_es.c,v 1.64 2019/05/29 10:07:28 msaitoh Exp $ */
+/*	$NetBSD: if_es.c,v 1.65 2020/01/29 05:23:16 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Michael L. Hitch
@@ -33,7 +33,7 @@
 #include "opt_ns.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_es.c,v 1.64 2019/05/29 10:07:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_es.c,v 1.65 2020/01/29 05:23:16 thorpej Exp $");
 
 
 #include <sys/param.h>
@@ -389,7 +389,7 @@ esintr(void *arg)
 		    intsts);
 		smc->b2.ist = ACK_RX_OVRN;
 		printf ("->%02x\n", smc->b2.ist);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 	}
 	if (intact & IST_TX_EMPTY) {
 		u_short ecr;
@@ -417,8 +417,8 @@ esintr(void *arg)
 			smc->b0.bsr = BSR_BANK0;
 			ecr = smc->b0.ecr;	/* Get error counters */
 			if (ecr & 0xff00)
-				ifp->if_collisions += ((ecr >> 8) & 15) +
-				    ((ecr >> 11) & 0x1e);
+				if_statadd(ifp, if_collisions,
+				    ((ecr >> 8) & 15) + ((ecr >> 11) & 0x1e));
 			smc->b2.bsr = BSR_BANK2;
 #if 0
 			smc->b2.mmucr = MMUCR_RESET_TX; /* XXX reset TX FIFO */
@@ -468,7 +468,7 @@ zzzz:
 			smc->b0.bsr = BSR_BANK0;
 			smc->b0.tcr |= TCR_TXENA;
 			smc->b2.bsr = BSR_BANK2;
-			ifp->if_oerrors++;
+			if_statinc(ifp, if_oerrors);
 			sc->sc_intctl |= MSK_TX_EMPTY | MSK_TX;
 		} else {
 			/*
@@ -509,7 +509,7 @@ zzzz:
 		}
 	}
 	if (intact & IST_EPHINT) {
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		esreset(sc);
 	}
 	/* output packets */
@@ -601,7 +601,7 @@ esrint(struct es_softc *sc)
 		smc->b2.mmucr = MMUCR_REMRLS_RX;
 		while (smc->b2.mmucr & MMUCR_BUSY)
 			;
-		++ifp->if_ierrors;
+		if_statinc(ifp, if_ierrors);
 #ifdef ESDEBUG
 		if (--sc->sc_smcbusy) {
 			printf("%s: esrintr busy on bad packet exit\n",
@@ -922,7 +922,8 @@ esstart(struct ifnet *ifp)
 			    device_xname(sc->sc_dev), active_pnr, smc->b2.pnr);
 		bpf_mtap(&sc->sc_ethercom.ec_if, m0, BPF_D_OUT);
 		m_freem(m0);
-		sc->sc_ethercom.ec_if.if_opackets++;	/* move to interrupt? */
+				/* move to interrupt? */
+		if_statinc(&sc->sc_ethercom.ec_if, if_opackets);
 		sc->sc_intctl |= MSK_TX_EMPTY | MSK_TX;
 		sc->sc_ethercom.ec_if.if_timer = 5;
 	}
@@ -1048,7 +1049,7 @@ eswatchdog(struct ifnet *ifp)
 	struct es_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);
 
 	esreset(sc);
 }

Index: src/sys/arch/amiga/dev/if_qn.c
diff -u src/sys/arch/amiga/dev/if_qn.c:1.48 src/sys/arch/amiga/dev/if_qn.c:1.49
--- src/sys/arch/amiga/dev/if_qn.c:1.48	Tue Nov 12 13:17:43 2019
+++ src/sys/arch/amiga/dev/if_qn.c	Wed Jan 29 05:23:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_qn.c,v 1.48 2019/11/12 13:17:43 msaitoh Exp $ */
+/*	$NetBSD: if_qn.c,v 1.49 2020/01/29 05:23:16 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995 Mika Kortelainen
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_qn.c,v 1.48 2019/11/12 13:17:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qn.c,v 1.49 2020/01/29 05:23:16 thorpej Exp $");
 
 #include "qn.h"
 #if NQN > 0
@@ -305,7 +305,7 @@ qnwatchdog(struct ifnet *ifp)
 	struct qn_softc *sc = ifp->if_softc;
 
 	log(LOG_INFO, "qn: device timeout (watchdog)\n");
-	++sc->sc_ethercom.ec_if.if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	qnreset(sc);
 }
@@ -613,19 +613,19 @@ qn_rint(struct qn_softc *sc, u_short rst
 #ifdef QN_DEBUG
 		log(LOG_INFO, "Overflow\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(&sc->sc_ethercom.ec_if, if_ierrors);
 	}
 	if (rstat & R_INT_CRC_ERR) {
 #ifdef QN_DEBUG
 		log(LOG_INFO, "CRC Error\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(&sc->sc_ethercom.ec_if, if_ierrors);
 	}
 	if (rstat & R_INT_ALG_ERR) {
 #ifdef QN_DEBUG
 		log(LOG_INFO, "Alignment error\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(&sc->sc_ethercom.ec_if, if_ierrors);
 	}
 	if (rstat & R_INT_SRT_PKT) {
 		/* Short packet (these may occur and are
@@ -635,13 +635,13 @@ qn_rint(struct qn_softc *sc, u_short rst
 #ifdef QN_DEBUG
 		log(LOG_INFO, "Short packet\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(&sc->sc_ethercom.ec_if, if_ierrors);
 	}
 	if (rstat & 0x4040) {
 #ifdef QN_DEBUG
 		log(LOG_INFO, "Bus read error\n");
 #endif
-		++sc->sc_ethercom.ec_if.if_ierrors;
+		if_statinc(&sc->sc_ethercom.ec_if, if_ierrors);
 		qnreset(sc);
 	}
 
@@ -677,7 +677,7 @@ qn_rint(struct qn_softc *sc, u_short rst
 			    "%s: received a %s packet? (%u bytes)\n",
 			    device_xname(sc->sc_dev),
 			    len < ETHER_HDR_LEN ? "partial" : "big", len);
-			++sc->sc_ethercom.ec_if.if_ierrors;
+			if_statinc(&sc->sc_ethercom.ec_if, if_ierrors);
 			continue;
 		}
 #endif
@@ -742,7 +742,7 @@ qnintr(void *arg)
 			 * Update total number of successfully
 			 * transmitted packets.
 			 */
-			sc->sc_ethercom.ec_if.if_opackets++;
+			if_statinc(&sc->sc_ethercom.ec_if, if_opackets);
 		}
 
 		if (tint & T_SIXTEEN_COL) {
@@ -753,8 +753,8 @@ qnintr(void *arg)
 #ifdef QN_DEBUG1
 			qn_dump(sc);
 #endif
-			sc->sc_ethercom.ec_if.if_oerrors++;
-			sc->sc_ethercom.ec_if.if_collisions += 16;
+			if_statadd2(&sc->sc_ethercom.ec_if,
+			    if_oerrors, 1, if_collisions, 16);
 			sc->transmit_pending = 0;
 		}
 

Reply via email to