Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/macppc/dev Convert a few more drivers to the if_sta...



details:   https://anonhg.NetBSD.org/src/rev/68e626963d24
branches:  trunk
changeset: 744511:68e626963d24
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Feb 04 13:47:34 2020 +0000

description:
Convert a few more drivers to the if_stats interface

diffstat:

 sys/arch/macppc/dev/am79c950.c |  34 ++++++++++++++++++----------------
 sys/arch/macppc/dev/if_bm.c    |   6 +++---
 2 files changed, 21 insertions(+), 19 deletions(-)

diffs (136 lines):

diff -r 2a5ff83cbee3 -r 68e626963d24 sys/arch/macppc/dev/am79c950.c
--- a/sys/arch/macppc/dev/am79c950.c    Tue Feb 04 10:59:21 2020 +0000
+++ b/sys/arch/macppc/dev/am79c950.c    Tue Feb 04 13:47:34 2020 +0000
@@ -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 <khym%bga.com@localhost>
@@ -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 @@
 #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 @@
                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 @@
 
        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 @@
                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;
        }
 
diff -r 2a5ff83cbee3 -r 68e626963d24 sys/arch/macppc/dev/if_bm.c
--- a/sys/arch/macppc/dev/if_bm.c       Tue Feb 04 10:59:21 2020 +0000
+++ b/sys/arch/macppc/dev/if_bm.c       Tue Feb 04 13:47:34 2020 +0000
@@ -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 @@
        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);
        }
 



Home | Main Index | Thread Index | Old Index