Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Eliminate use of IFF_OACTIVE.



details:   https://anonhg.NetBSD.org/src/rev/5890ef1b1b2c
branches:  trunk
changeset: 370124:5890ef1b1b2c
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 18 02:32:14 2022 +0000

description:
Eliminate use of IFF_OACTIVE.

diffstat:

 sys/arch/arm/sunxi/sun4i_emac.c |  13 +++----------
 sys/arch/mac68k/dev/if_mc.c     |  17 +++++++----------
 sys/arch/mac68k/dev/if_mcvar.h  |   3 ++-
 3 files changed, 12 insertions(+), 21 deletions(-)

diffs (134 lines):

diff -r 33ec73c5560f -r 5890ef1b1b2c sys/arch/arm/sunxi/sun4i_emac.c
--- a/sys/arch/arm/sunxi/sun4i_emac.c   Sat Sep 17 19:49:09 2022 +0000
+++ b/sys/arch/arm/sunxi/sun4i_emac.c   Sun Sep 18 02:32:14 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun4i_emac.c,v 1.14 2021/01/27 03:10:20 thorpej Exp $ */
+/* $NetBSD: sun4i_emac.c,v 1.15 2022/09/18 02:32:14 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2013-2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.14 2021/01/27 03:10:20 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.15 2022/09/18 02:32:14 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -630,10 +630,7 @@
 static void
 sun4i_emac_tx_intr(struct sun4i_emac_softc *sc, u_int slot)
 {
-       struct ifnet * const ifp = &sc->sc_ec.ec_if;
-
        sc->sc_tx_active &= ~__BIT(slot);
-       ifp->if_flags &= ~IFF_OACTIVE;
 }
 
 int
@@ -697,9 +694,6 @@
                sc->sc_tx_active |= 2;
        }
 
-       if (sc->sc_tx_active == 3)
-               ifp->if_flags |= IFF_OACTIVE;
-
        ifp->if_timer = 5;
 
        mutex_exit(&sc->sc_intr_lock);
@@ -753,7 +747,7 @@
        sun4i_emac_clear_set(sc, EMAC_CTL_REG,
            EMAC_CTL_RST | EMAC_CTL_TX_EN | EMAC_CTL_RX_EN, 0);
 
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
        ifp->if_timer = 0;
 }
 
@@ -812,7 +806,6 @@
        sun4i_emac_int_enable(sc);
 
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
        /* Enable RX/TX */
        sun4i_emac_clear_set(sc, EMAC_CTL_REG,
diff -r 33ec73c5560f -r 5890ef1b1b2c sys/arch/mac68k/dev/if_mc.c
--- a/sys/arch/mac68k/dev/if_mc.c       Sat Sep 17 19:49:09 2022 +0000
+++ b/sys/arch/mac68k/dev/if_mc.c       Sun Sep 18 02:32:14 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mc.c,v 1.57 2021/01/24 05:20:23 rin Exp $   */
+/*     $NetBSD: if_mc.c,v 1.58 2022/09/18 02:41:24 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1997 David Huang <khym%azeotrope.org@localhost>
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.57 2021/01/24 05:20:23 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.58 2022/09/18 02:41:24 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -248,13 +248,10 @@
        struct mc_softc *sc = ifp->if_softc;
        struct mbuf *m;
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
 
-       while (1) {
-               if (ifp->if_flags & IFF_OACTIVE)
-                       return;
-
+       while (!sc->sc_txbusy) {
                IF_DEQUEUE(&ifp->if_snd, m);
                if (m == 0)
                        return;
@@ -268,7 +265,7 @@
                /*
                 * Copy the mbuf chain into the transmit buffer.
                 */
-               ifp->if_flags |= IFF_OACTIVE;
+               sc->sc_txbusy = true;
                maceput(sc, m);
 
                if_statinc(ifp, if_opackets);   /* # of pkts */
@@ -348,7 +345,7 @@
 
        /* flag interface as "running" */
        sc->sc_if.if_flags |= IFF_RUNNING;
-       sc->sc_if.if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
 
        splx(s);
        return 0;
@@ -518,7 +515,7 @@
 
        IF_STAT_PUTREF(&sc->sc_if);
 
-       sc->sc_if.if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
        sc->sc_if.if_timer = 0;
        if_schedule_deferred_start(&sc->sc_if);
 
diff -r 33ec73c5560f -r 5890ef1b1b2c sys/arch/mac68k/dev/if_mcvar.h
--- a/sys/arch/mac68k/dev/if_mcvar.h    Sat Sep 17 19:49:09 2022 +0000
+++ b/sys/arch/mac68k/dev/if_mcvar.h    Sun Sep 18 02:32:14 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mcvar.h,v 1.17 2021/01/24 05:20:23 rin Exp $        */
+/*     $NetBSD: if_mcvar.h,v 1.18 2022/09/18 02:41:24 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1997 David Huang <khym%azeotrope.org@localhost>
@@ -87,6 +87,7 @@
        int             sc_tail;
        int             sc_rxset;
        int             sc_txset, sc_txseti;
+       bool            sc_txbusy;
 
        krndsource_t rnd_source;
 };



Home | Main Index | Thread Index | Old Index