Module Name:    src
Committed By:   thorpej
Date:           Wed Jan 29 05:57:21 UTC 2020

Modified Files:
        src/sys/dev/qbus: if_de.c if_qt.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/qbus/if_de.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/qbus/if_qt.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/qbus/if_de.c
diff -u src/sys/dev/qbus/if_de.c:1.34 src/sys/dev/qbus/if_de.c:1.35
--- src/sys/dev/qbus/if_de.c:1.34	Tue Jun 26 06:48:02 2018
+++ src/sys/dev/qbus/if_de.c	Wed Jan 29 05:57:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_de.c,v 1.34 2018/06/26 06:48:02 msaitoh Exp $	*/
+/*	$NetBSD: if_de.c,v 1.35 2020/01/29 05:57:21 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.34 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.35 2020/01/29 05:57:21 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -480,19 +480,19 @@ deintr(void *arg)
 		if (rp->r_flags & XFLG_OWN)
 			break;
 
-		sc->sc_if.if_opackets++;
+		if_statinc(&sc->sc_if, if_opackets);
 		ifxp = &sc->sc_ifw[sc->sc_xindex];
 		/* check for unusual conditions */
 		if (rp->r_flags & (XFLG_ERRS|XFLG_MTCH|XFLG_ONE|XFLG_MORE)) {
 			if (rp->r_flags & XFLG_ERRS) {
 				/* output error */
-				sc->sc_if.if_oerrors++;
+				if_statinc(&sc->sc_if, if_oerrors);
 			} else if (rp->r_flags & XFLG_ONE) {
 				/* one collision */
-				sc->sc_if.if_collisions++;
+				if_statinc(&sc->sc_if, if_collisions);
 			} else if (rp->r_flags & XFLG_MORE) {
-				/* more than one collision */
-				sc->sc_if.if_collisions += 2;	/* guess */
+				/* more than one collision (guess...) */
+				if_statadd(&sc->sc_if, if_collisions, 2);
 			}
 		}
 		if_ubaend(&sc->sc_ifuba, ifxp);
@@ -534,13 +534,13 @@ derecv(struct de_softc *sc)
 		/* check for errors */
 		if ((rp->r_flags & (RFLG_ERRS|RFLG_FRAM|RFLG_OFLO|RFLG_CRC)) ||
 		    (rp->r_lenerr & (RERR_BUFL|RERR_UBTO))) {
-			sc->sc_if.if_ierrors++;
+			if_statinc(&sc->sc_if, if_ierrors);
 			goto next;
 		}
 		m = if_ubaget(&sc->sc_ifuba, &sc->sc_ifr[sc->sc_rindex],
 		    ifp, len);
 		if (m == 0) {
-			sc->sc_if.if_ierrors++;
+			if_statinc(&sc->sc_if, if_ierrors);
 			goto next;
 		}
 

Index: src/sys/dev/qbus/if_qt.c
diff -u src/sys/dev/qbus/if_qt.c:1.24 src/sys/dev/qbus/if_qt.c:1.25
--- src/sys/dev/qbus/if_qt.c:1.24	Mon Oct 21 08:22:06 2019
+++ src/sys/dev/qbus/if_qt.c	Wed Jan 29 05:57:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_qt.c,v 1.24 2019/10/21 08:22:06 msaitoh Exp $	*/
+/*	$NetBSD: if_qt.c,v 1.25 2020/01/29 05:57:21 thorpej Exp $	*/
 /*
  * Copyright (c) 1992 Steven M. Schultz
  * All rights reserved.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_qt.c,v 1.24 2019/10/21 08:22:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_qt.c,v 1.25 2020/01/29 05:57:21 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -507,37 +507,35 @@ qtintr(void *arg)
 
 void
 qttint(struct qt_softc *sc)
-	{
+{
 	struct qt_tring *rp;
 
-	while (sc->nxmit > 0)
-		{
+	while (sc->nxmit > 0) {
 		rp = &sc->sc_ib->qc_t[sc->xlast];
 		if ((rp->tmd3 & TMD3_OWN) == 0)
 			break;
-		sc->is_if.if_opackets++;
+		if_statinc(&sc->is_if, if_opackets);
 /*
  * Collisions don't count as output errors, but babbling and missing packets
  * do count as output errors.
 */
-		if	(rp->tmd2 & TMD2_CER)
-			sc->is_if.if_collisions++;
-		if	((rp->tmd0 & TMD0_ERR1) ||
-			 ((rp->tmd2 & TMD2_ERR2) && (rp->tmd2 & BBLMIS)))
-			{
+		if (rp->tmd2 & TMD2_CER)
+			if_statinc(&sc->is_if, if_collisions);
+		if ((rp->tmd0 & TMD0_ERR1) ||
+		    ((rp->tmd2 & TMD2_ERR2) && (rp->tmd2 & BBLMIS))) {
 #ifdef QTDEBUG
 			char buf[100];
 			snprintb(buf, sizeof(buf), TMD2_BITS, rp->tmd2);
 			printf("%s: tmd2 %s\n", device_xname(sc->sc_dev), buf);
 #endif
-			sc->is_if.if_oerrors++;
-			}
+			if_statinc(&sc->is_if, if_oerrors);
+		}
 		if_ubaend(&sc->sc_ifuba, &sc->sc_ifw[sc->xlast]);
-		if	(++sc->xlast >= NXMT)
+		if (++sc->xlast >= NXMT)
 			sc->xlast = 0;
 		sc->nxmit--;
-		}
 	}
+}
 
 /*
  * Receive interrupt service.  Pull packet off the interface and put into
@@ -555,16 +553,14 @@ qtrint(struct qt_softc *sc)
 	while	(sc->sc_ib->qc_r[(int)sc->rindex].rmd3 & RMD3_OWN)
 		{
 		rp = &sc->sc_ib->qc_r[(int)sc->rindex];
-		if     ((rp->rmd0 & (RMD0_STP|RMD0_ENP)) != (RMD0_STP|RMD0_ENP))
-			{
+		if ((rp->rmd0 & (RMD0_STP|RMD0_ENP)) != (RMD0_STP|RMD0_ENP)) {
 			printf("%s: chained packet\n", device_xname(sc->sc_dev));
-			sc->is_if.if_ierrors++;
+			if_statinc(&sc->is_if, if_ierrors);
 			goto rnext;
-			}
+		}
 		len = (rp->rmd1 & RMD1_MCNT) - 4;	/* -4 for CRC */
 
-		if	((rp->rmd0 & RMD0_ERR3) || (rp->rmd2 & RMD2_ERR4))
-			{
+		if ((rp->rmd0 & RMD0_ERR3) || (rp->rmd2 & RMD2_ERR4)) {
 #ifdef QTDEBUG
 			char buf[100];
 			snprintb(buf, sizeof(buf), RMD0_BITS, rp->rmd0);
@@ -572,13 +568,13 @@ qtrint(struct qt_softc *sc)
 			snprintb(buf, sizeof(buf), RMD2_BITS, rp->rmd2);
 			printf("%s: rmd2 %s\n", device_xname(sc->sc_dev), buf);
 #endif
-			sc->is_if.if_ierrors++;
+			if_statinc(&sc->is_if, if_ierrors);
 			goto rnext;
-			}
+		}
 		m = if_ubaget(&sc->sc_ifuba, &sc->sc_ifr[(int)sc->rindex],
 		    ifp, len);
 		if (m == 0) {
-			sc->is_if.if_ierrors++;
+			if_statinc(&sc->is_if, if_ierrors);
 			goto rnext;
 		}
 		if_percpuq_enqueue(ifp->if_percpuq, m);

Reply via email to