Module Name:    src
Committed By:   thorpej
Date:           Wed Jan 29 06:21:40 UTC 2020

Modified Files:
        src/sys/dev/isa: cs89x0isa.c if_eg.c if_el.c if_iy.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/isa/cs89x0isa.c
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/isa/if_eg.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/isa/if_el.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/isa/if_iy.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/isa/cs89x0isa.c
diff -u src/sys/dev/isa/cs89x0isa.c:1.18 src/sys/dev/isa/cs89x0isa.c:1.19
--- src/sys/dev/isa/cs89x0isa.c:1.18	Fri Jun 10 13:27:14 2016
+++ src/sys/dev/isa/cs89x0isa.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cs89x0isa.c,v 1.18 2016/06/10 13:27:14 ozaki-r Exp $ */
+/* $NetBSD: cs89x0isa.c,v 1.19 2020/01/29 06:21:40 thorpej Exp $ */
 
 /*
  * Copyright 1997
@@ -36,7 +36,7 @@
 /* isa DMA routines for cs89x0 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.18 2016/06/10 13:27:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.19 2020/01/29 06:21:40 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -226,7 +226,7 @@ void cs_process_rx_dma(struct cs_softc *
 				printf("%s: cs_process_rx_dma: "
 				    "DMA buffer out of sync about to reset\n",
 				    device_xname(sc->sc_dev));
-				ifp->if_ierrors++;
+				if_statinc(ifp, if_ierrors);
 
 				/* skip the rest of the DMA buffer */
 				isa_dmaabort(isc->sc_ic, isc->sc_drq);
@@ -243,7 +243,7 @@ void cs_process_rx_dma(struct cs_softc *
 					printf("%s: cs_process_rx_dma: "
 					    "unable to allocate mbuf\n",
 					    device_xname(sc->sc_dev));
-					ifp->if_ierrors++;
+					if_statinc(ifp, if_ierrors);
 					/*
 					 * couldn't allocate an mbuf so
 					 * things are not good, may as well
@@ -352,7 +352,7 @@ void cs_process_rx_dma(struct cs_softc *
 			else {
 				/* the frame was not received OK */
 				/* Increment the input error count */
-				ifp->if_ierrors++;
+				if_statinc(ifp, if_ierrors);
 
 				/*
 				 * If debugging is enabled then log error

Index: src/sys/dev/isa/if_eg.c
diff -u src/sys/dev/isa/if_eg.c:1.96 src/sys/dev/isa/if_eg.c:1.97
--- src/sys/dev/isa/if_eg.c:1.96	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/isa/if_eg.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_eg.c,v 1.96 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: if_eg.c,v 1.97 2020/01/29 06:21:40 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1993 Dean Huxley <[email protected]>
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.96 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.97 2020/01/29 06:21:40 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -589,7 +589,7 @@ loop:
 	if (egwritePCB(iot, ioh, sc->eg_pcb) != 0) {
 		aprint_error_dev(sc->sc_dev,
 		    "can't send Send Packet command\n");
-		ifp->if_oerrors++;
+		if_statinc(ifp, if_oerrors);
 		ifp->if_flags &= ~IFF_OACTIVE;
 		m_freem(m0);
 		goto loop;
@@ -620,6 +620,7 @@ int
 egintr(void *arg)
 {
 	struct eg_softc *sc = arg;
+	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 	bus_space_tag_t iot = sc->sc_iot;
 	bus_space_handle_t ioh = sc->sc_ioh;
 	int i, len, serviced;
@@ -657,11 +658,12 @@ egintr(void *arg)
 			if (sc->eg_pcb[6] || sc->eg_pcb[7]) {
 				DPRINTF(("%s: packet dropped\n",
 				    device_xname(sc->sc_dev)));
-				sc->sc_ethercom.ec_if.if_oerrors++;
+				if_statinc(ifp, if_oerrors);
 			} else
-				sc->sc_ethercom.ec_if.if_opackets++;
-			sc->sc_ethercom.ec_if.if_collisions +=
-			    sc->eg_pcb[8] & 0xf;
+				if_statinc(ifp, if_opackets);
+			if (sc->eg_pcb[8] & 0xf)
+				if_statadd(ifp, if_collisions,
+				    sc->eg_pcb[8] & 0xf);
 			sc->sc_ethercom.ec_if.if_flags &= ~IFF_OACTIVE;
 			egstart(&sc->sc_ethercom.ec_if);
 			serviced = 1;
@@ -712,14 +714,14 @@ egread(struct eg_softc *sc, void *buf, i
 	    len > ETHER_MAX_LEN) {
 		aprint_error_dev(sc->sc_dev,
 		    "invalid packet size %d; dropping\n", len);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
 	/* Pull packet off interface. */
 	m = egget(sc, buf, len);
 	if (m == 0) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -861,7 +863,7 @@ egwatchdog(struct ifnet *ifp)
 	struct eg_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);
 
 	egreset(sc);
 }

Index: src/sys/dev/isa/if_el.c
diff -u src/sys/dev/isa/if_el.c:1.98 src/sys/dev/isa/if_el.c:1.99
--- src/sys/dev/isa/if_el.c:1.98	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/isa/if_el.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_el.c,v 1.98 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: if_el.c,v 1.99 2020/01/29 06:21:40 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.98 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.99 2020/01/29 06:21:40 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -415,7 +415,7 @@ elstart(struct ifnet *ifp)
 			bus_space_write_1(iot, ioh, EL_GPBL, off & 0xff);
 			bus_space_write_1(iot, ioh, EL_GPBH, (off >> 8) & 0xff);
 			if (el_xmit(sc)) {
-				ifp->if_oerrors++;
+				if_statinc(ifp, if_oerrors);
 				break;
 			}
 			/* Check out status. */
@@ -424,7 +424,7 @@ elstart(struct ifnet *ifp)
 			if ((i & EL_TXS_READY) == 0) {
 				DPRINTF(("el: err txs=%x\n", i));
 				if (i & (EL_TXS_COLL | EL_TXS_COLL16)) {
-					ifp->if_collisions++;
+					if_statinc(ifp, if_collisions);
 					if ((i & EL_TXC_DCOLL16) == 0 &&
 					    retries < 15) {
 						retries++;
@@ -432,11 +432,11 @@ elstart(struct ifnet *ifp)
 						    EL_AC, EL_AC_HOST);
 					}
 				} else {
-					ifp->if_oerrors++;
+					if_statinc(ifp, if_oerrors);
 					break;
 				}
 			} else {
-				ifp->if_opackets++;
+				if_statinc(ifp, if_opackets);
 				break;
 			}
 		}
@@ -569,14 +569,14 @@ elread(struct el_softc *sc, int len)
 	    len > ETHER_MAX_LEN) {
 		printf("%s: invalid packet size %d; dropping\n",
 		    device_xname(sc->sc_dev), len);
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
 	/* Pull packet off interface. */
 	m = elget(sc, len);
 	if (m == 0) {
-		ifp->if_ierrors++;
+		if_statinc(ifp, if_ierrors);
 		return;
 	}
 
@@ -716,7 +716,7 @@ elwatchdog(struct ifnet *ifp)
 	struct el_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);
 
 	elreset(sc);
 }

Index: src/sys/dev/isa/if_iy.c
diff -u src/sys/dev/isa/if_iy.c:1.112 src/sys/dev/isa/if_iy.c:1.113
--- src/sys/dev/isa/if_iy.c:1.112	Mon Jan  6 07:15:03 2020
+++ src/sys/dev/isa/if_iy.c	Wed Jan 29 06:21:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iy.c,v 1.112 2020/01/06 07:15:03 msaitoh Exp $	*/
+/*	$NetBSD: if_iy.c,v 1.113 2020/01/29 06:21:40 thorpej Exp $	*/
 /* #define IYDEBUG */
 /* #define IYMEMDEBUG */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.112 2020/01/06 07:15:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.113 2020/01/29 06:21:40 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -672,7 +672,7 @@ iystart(struct ifnet *ifp)
 
 		if (len + pad > ETHER_MAX_LEN) {
 			/* packet is obviously too large: toss it */
-			++ifp->if_oerrors;
+			if_statinc(ifp, if_oerrors);
 			IFQ_DEQUEUE(&ifp->if_snd, m0);
 			m_freem(m0);
 			continue;
@@ -819,7 +819,7 @@ iystart(struct ifnet *ifp)
 
 		/* XXX todo: enable ints here if disabled */
 
-		++ifp->if_opackets;
+		if_statinc(ifp, if_opackets);
 
 		if (sc->tx_start == sc->tx_end) {
 			bus_space_write_2(iot, ioh, XMT_ADDR_REG, last);
@@ -921,7 +921,7 @@ iywatchdog(struct ifnet *ifp)
 	struct iy_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);
 	iyreset(sc);
 }
 
@@ -1048,7 +1048,7 @@ iyget(struct iy_softc *sc, bus_space_tag
 	return;
 
 dropped:
-	++ifp->if_ierrors;
+	if_statinc(ifp, if_ierrors);
 	return;
 }
 
@@ -1150,12 +1150,12 @@ iy_intr_tx(struct iy_softc *sc)
 		ifp->if_flags &= ~IFF_OACTIVE;
 
 		if (txstat2 & 0x0020)
-			ifp->if_collisions += 16;
+			if_statadd(ifp, if_collisions, 16);
 		else
-			ifp->if_collisions += txstat2 & 0x000f;
+			if_statadd(ifp, if_collisions, txstat2 & 0x000f);
 
 		if ((txstat2 & 0x2000) == 0)
-			++ifp->if_oerrors;
+			if_statinc(ifp, if_oerrors);
 	}
 }
 

Reply via email to