Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/ec6c24511843
branches:  trunk
changeset: 370112:ec6c24511843
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Sep 17 17:15:02 2022 +0000

description:
Eliminate use of IFF_OACTIVE.

diffstat:

 sys/dev/isa/if_el.c |  15 ++++++++-------
 sys/dev/isa/if_iy.c |  33 +++++++++++++++++++--------------
 2 files changed, 27 insertions(+), 21 deletions(-)

diffs (179 lines):

diff -r 72f320e11221 -r ec6c24511843 sys/dev/isa/if_el.c
--- a/sys/dev/isa/if_el.c       Sat Sep 17 17:08:43 2022 +0000
+++ b/sys/dev/isa/if_el.c       Sat Sep 17 17:15:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_el.c,v 1.101 2022/09/17 17:08:43 thorpej Exp $      */
+/*     $NetBSD: if_el.c,v 1.102 2022/09/17 17:15:02 thorpej Exp $      */
 
 /*
  * Copyright (c) 1994, Matthew E. Kimmel.  Permission is hereby granted
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.101 2022/09/17 17:08:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.102 2022/09/17 17:15:02 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -72,6 +72,7 @@
        struct ethercom sc_ethercom;    /* ethernet common */
        bus_space_tag_t sc_iot;         /* bus space identifier */
        bus_space_handle_t sc_ioh;      /* i/o handle */
+       bool sc_txbusy;                 /* transmitter is busy */
 
        krndsource_t rnd_source;
 };
@@ -337,7 +338,7 @@
 
        /* Set flags appropriately. */
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
 
        /* And start output. */
        elstart(ifp);
@@ -361,12 +362,12 @@
        s = splnet();
 
        /* Don't do anything if output is active. */
-       if ((ifp->if_flags & IFF_OACTIVE) != 0) {
+       if (sc->sc_txbusy) {
                splx(s);
                return;
        }
 
-       ifp->if_flags |= IFF_OACTIVE;
+       sc->sc_txbusy = true;
 
        /*
         * The main loop.  They warned me against endless loops, but would I
@@ -448,13 +449,13 @@
                (void)bus_space_read_1(iot, ioh, EL_AS);
                bus_space_write_1(iot, ioh, EL_AC, EL_AC_IRQE | EL_AC_RX);
                splx(s);
-               /* Interrupt here. */
+               /* (Maybe) interrupt here. */
                s = splnet();
        }
 
        (void)bus_space_read_1(iot, ioh, EL_AS);
        bus_space_write_1(iot, ioh, EL_AC, EL_AC_IRQE | EL_AC_RX);
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
        splx(s);
 }
 
diff -r 72f320e11221 -r ec6c24511843 sys/dev/isa/if_iy.c
--- a/sys/dev/isa/if_iy.c       Sat Sep 17 17:08:43 2022 +0000
+++ b/sys/dev/isa/if_iy.c       Sat Sep 17 17:15:02 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_iy.c,v 1.113 2020/01/29 06:21:40 thorpej Exp $      */
+/*     $NetBSD: if_iy.c,v 1.114 2022/09/17 17:21:52 thorpej Exp $      */
 /* #define IYDEBUG */
 /* #define IYMEMDEBUG */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.113 2020/01/29 06:21:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.114 2022/09/17 17:21:52 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -112,6 +112,8 @@
        int sram, tx_size, rx_size;
 
        int tx_start, tx_end, tx_last;
+       bool tx_busy;
+
        int rx_start;
 
        int doing_mc_setup;
@@ -416,7 +418,8 @@
 #endif
        sc->tx_start = sc->tx_end = sc->rx_size;
        sc->tx_last = 0;
-       sc->sc_ethercom.ec_if.if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       sc->sc_ethercom.ec_if.if_flags &= ~IFF_RUNNING;
+       sc->tx_busy = false;
 }
 
 void
@@ -615,7 +618,7 @@
        bus_space_write_1(iot, ioh, 0, RCV_ENABLE_CMD);
 
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->tx_busy = false;
 }
 
 void
@@ -639,7 +642,10 @@
 #endif
        sc = ifp->if_softc;
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
+               return;
+
+       if (sc->tx_busy)
                return;
 
        iy_intr_tx(sc);
@@ -696,11 +702,11 @@
 
                if ((len+pad+2*I595_XMT_HDRLEN) > avail) {
 #ifdef IYDEBUG
-                       printf("%s: len = %d, avail = %d, setting OACTIVE\n",
+                       printf("%s: len = %d, avail = %d, setting tx_busy\n",
                            device_xname(sc->sc_dev), len, avail);
 #endif
                        /* mark interface as full ... */
-                       ifp->if_flags |= IFF_OACTIVE;
+                       sc->tx_busy = true;
 
                        /* and wait for any transmission result */
                        bus_space_write_1(iot, ioh, 0, BANK_SEL(2));
@@ -970,7 +976,7 @@
        }
        if (status & TX_INT) {
                /* Tell feeders we may be able to accept more data... */
-               ifp->if_flags &= ~IFF_OACTIVE;
+               sc->tx_busy = false;
                /* and get more data. */
                iystart(ifp);
                bus_space_write_1(iot, ioh, STATUS_REG, TX_INT);
@@ -1147,7 +1153,7 @@
                        sc->tx_start = txnext;
                else
                        sc->tx_start = sc->tx_end;
-               ifp->if_flags &= ~IFF_OACTIVE;
+               sc->tx_busy = false;
 
                if (txstat2 & 0x0020)
                        if_statadd(ifp, if_collisions, 16);
@@ -1371,8 +1377,7 @@
                break;
        }
        sc->tx_start = sc->tx_end;
-       ifp->if_flags &= ~IFF_OACTIVE;
-
+       sc->tx_busy = false;
 }
 
 static void
@@ -1412,9 +1417,9 @@
                ETHER_UNLOCK(ecp);
                /* OK, we really need to do it now: */
 #if 0
-               if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE))
-                   != IFF_RUNNING) {
-                       ifp->if_flags |= IFF_OACTIVE;
+               if ((ifp->if_flags & IFF_RUNNING) == 0 || sc->tx_busy) {
+                       /* XXX This logic is b0rk3n. */
+                       sc->tx_busy = true;
                        sc->want_mc_setup = 1;
                        return;
                }



Home | Main Index | Thread Index | Old Index