Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia - Adopt <net/if_stats.h>.



details:   https://anonhg.NetBSD.org/src/rev/a3722dc946f5
branches:  trunk
changeset: 968956:a3722dc946f5
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Feb 02 05:56:42 2020 +0000

description:
- Adopt <net/if_stats.h>.
- Use ifmedia_fini().

diffstat:

 sys/dev/pcmcia/if_xi.c |  28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diffs (105 lines):

diff -r fcae758ccdf0 -r a3722dc946f5 sys/dev/pcmcia/if_xi.c
--- a/sys/dev/pcmcia/if_xi.c    Sun Feb 02 05:27:21 2020 +0000
+++ b/sys/dev/pcmcia/if_xi.c    Sun Feb 02 05:56:42 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_xi.c,v 1.93 2020/01/06 07:15:03 msaitoh Exp $ */
+/*     $NetBSD: if_xi.c,v 1.94 2020/02/02 05:56:42 thorpej Exp $ */
 /*     OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp   */
 
 /*
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.93 2020/01/06 07:15:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.94 2020/02/02 05:56:42 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -259,9 +259,9 @@
        rnd_detach_source(&sc->sc_rnd_source);
 
        mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
-       ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
        ether_ifdetach(ifp);
        if_detach(ifp);
+       ifmedia_fini(&sc->sc_mii.mii_media);
 
        return 0;
 }
@@ -323,7 +323,7 @@
                if (recvcount > MAX_BYTES_INTR) {
                        DPRINTF(XID_INTR,
                            ("xi: too many bytes this interrupt\n"));
-                       ifp->if_iqdrops++;
+                       if_statinc(ifp, if_iqdrops);
                        /* Drop packet. */
                        bus_space_write_2(sc->sc_bst, sc->sc_bsh, DO0,
                            DO_SKIP_RX_PKT);
@@ -336,25 +336,25 @@
 
        /* Packet too long? */
        if (rsr & RSR_TOO_LONG) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                DPRINTF(XID_INTR, ("xi: packet too long\n"));
        }
 
        /* CRC error? */
        if (rsr & RSR_CRCERR) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                DPRINTF(XID_INTR, ("xi: CRC error detected\n"));
        }
 
        /* Alignment error? */
        if (rsr & RSR_ALIGNERR) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                DPRINTF(XID_INTR, ("xi: alignment error detected\n"));
        }
 
        /* Check for rx overrun. */
        if (rx_status & RX_OVERRUN) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                bus_space_write_1(sc->sc_bst, sc->sc_bsh, CR, CLR_RX_OVERRUN);
                DPRINTF(XID_INTR, ("xi: overrun cleared\n"));
        }
@@ -363,14 +363,14 @@
        if_schedule_deferred_start(ifp);
 
        /* Detected excessive collisions? */
-       if ((tx_status & EXCESSIVE_COLL) && ifp->if_opackets > 0) {
+       if ((tx_status & EXCESSIVE_COLL) /* XXX && ifp->if_opackets > 0 */) {
                DPRINTF(XID_INTR, ("xi: excessive collisions\n"));
                bus_space_write_1(sc->sc_bst, sc->sc_bsh, CR, RESTART_TX);
-               ifp->if_oerrors++;
+               if_statinc(ifp, if_oerrors);
        }
 
-       if ((tx_status & TX_ABORT) && ifp->if_opackets > 0)
-               ifp->if_oerrors++;
+       if ((tx_status & TX_ABORT) /* && XXX ifp->if_opackets > 0 */)
+               if_statinc(ifp, if_oerrors);
 
        /* have handled the interrupt */
        rnd_add_uint32(&sc->sc_rnd_source, tx_status);
@@ -645,7 +645,7 @@
        struct xi_softc *sc = ifp->if_softc;
 
        printf("%s: device timeout\n", device_xname(sc->sc_dev));
-       ++ifp->if_oerrors;
+       if_statinc(ifp, if_oerrors);
 
        xi_reset(sc);
 }
@@ -824,7 +824,7 @@
        splx(s);
 
        ifp->if_timer = 5;
-       ++ifp->if_opackets;
+       if_statinc(ifp, if_opackets);
 }
 
 STATIC int



Home | Main Index | Thread Index | Old Index