Module Name:    src
Committed By:   martin
Date:           Tue Feb  4 13:47:34 UTC 2020

Modified Files:
        src/sys/arch/macppc/dev: am79c950.c if_bm.c

Log Message:
Convert a few more drivers to the if_stats interface


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/macppc/dev/am79c950.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/macppc/dev/if_bm.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/macppc/dev/am79c950.c
diff -u src/sys/arch/macppc/dev/am79c950.c:1.48 src/sys/arch/macppc/dev/am79c950.c:1.49
--- src/sys/arch/macppc/dev/am79c950.c:1.48	Tue Feb  4 07:36:36 2020
+++ src/sys/arch/macppc/dev/am79c950.c	Tue Feb  4 13:47:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am79c950.c,v 1.48 2020/02/04 07:36:36 skrll Exp $	*/
+/*	$NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang <k...@bga.com>
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.48 2020/02/04 07:36:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -439,19 +439,19 @@ mcintr(void *arg)
 #ifdef MCDEBUG
 		printf("%s: jabber error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_oerrors++;
+		if_statinc(&sc->sc_if, if_oerrors);
 	}
 
 	if (ir & BABL) {
 #ifdef MCDEBUG
 		printf("%s: babble\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_oerrors++;
+		if_statinc(&sc->sc_if, if_oerrors);
 	}
 
 	if (ir & CERR) {
 		printf("%s: collision error\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_collisions++;
+		if_statinc(&sc->sc_if, if_collisions);
 	}
 
 	/*
@@ -486,27 +486,29 @@ mc_tint(struct mc_softc *sc)
 		return;
 	}
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(&sc->sc_if);
 	if (xmtfs & LCOL) {
 		printf("%s: late collision\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_oerrors++;
-		sc->sc_if.if_collisions++;
+		if_statinc_ref(nsr, if_oerrors);
+		if_statinc_ref(nsr, if_collisions);
 	}
 
 	if (xmtfs & MORE)
 		/* Real number is unknown. */
-		sc->sc_if.if_collisions += 2;
+		if_statadd_ref(nsr, if_collisions, 2);
 	else if (xmtfs & ONE)
-		sc->sc_if.if_collisions++;
+		if_statinc_ref(nsr, if_collisions);
 	else if (xmtfs & RTRY) {
-		sc->sc_if.if_collisions += 16;
-		sc->sc_if.if_oerrors++;
+		if_statadd_ref(nsr, if_collisions, 16);
+		if_statinc_ref(nsr, if_oerrors);
 	}
 
 	if (xmtfs & LCAR) {
 		sc->sc_havecarrier = 0;
 		printf("%s: lost carrier\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_oerrors++;
+		if_statinc_ref(nsr, if_oerrors);
 	}
+	IF_STAT_PUTREF(&sc->sc_if);
 
 	sc->sc_if.if_flags &= ~IFF_OACTIVE;
 	sc->sc_if.if_timer = 0;
@@ -530,18 +532,18 @@ mc_rint(struct mc_softc *sc)
 
 	if (rxf.rx_rcvsts & OFLO) {
 		printf("%s: receive FIFO overflow\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_ierrors++;
+		if_statinc(&sc->sc_if, if_ierrors);
 		return;
 	}
 
 	if (rxf.rx_rcvsts & CLSN)
-		sc->sc_if.if_collisions++;
+		if_statinc(&sc->sc_if, if_collisions);
 
 	if (rxf.rx_rcvsts & FRAM) {
 #ifdef MCDEBUG
 		printf("%s: framing error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(&sc->sc_if, if_ierrors);
 		return;
 	}
 
@@ -550,7 +552,7 @@ mc_rint(struct mc_softc *sc)
 		printf("%s: frame control checksum error\n",
 		    device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(&sc->sc_if, if_ierrors);
 		return;
 	}
 

Index: src/sys/arch/macppc/dev/if_bm.c
diff -u src/sys/arch/macppc/dev/if_bm.c:1.62 src/sys/arch/macppc/dev/if_bm.c:1.63
--- src/sys/arch/macppc/dev/if_bm.c:1.62	Tue Feb  4 07:36:36 2020
+++ src/sys/arch/macppc/dev/if_bm.c	Tue Feb  4 13:47:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bm.c,v 1.62 2020/02/04 07:36:36 skrll Exp $	*/
+/*	$NetBSD: if_bm.c,v 1.63 2020/02/04 13:47:34 martin Exp $	*/
 
 /*-
  * Copyright (C) 1998, 1999, 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.62 2020/02/04 07:36:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.63 2020/02/04 13:47:34 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -436,7 +436,7 @@ bmac_intr(void *v)
 	if (stat & IntFrameSent) {
 		sc->sc_if.if_flags &= ~IFF_OACTIVE;
 		sc->sc_if.if_timer = 0;
-		sc->sc_if.if_opackets++;
+		if_statinc(&sc->sc_if, if_opackets);
 		if_schedule_deferred_start(&sc->sc_if);
 	}
 

Reply via email to