Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/1a26071bd10b
branches:  trunk
changeset: 370140:1a26071bd10b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 18 15:14:06 2022 +0000

description:
Eliminate use of IFF_OACTIVE.

diffstat:

 sys/arch/arm/omap/if_cpsw.c      |  20 ++++++++++++--------
 sys/arch/arm/omap/omapl1x_emac.c |  15 +++------------
 sys/arch/arm/sociox/if_scx.c     |  19 +++++--------------
 3 files changed, 20 insertions(+), 34 deletions(-)

diffs (216 lines):

diff -r 4713bc43f00d -r 1a26071bd10b sys/arch/arm/omap/if_cpsw.c
--- a/sys/arch/arm/omap/if_cpsw.c       Sun Sep 18 13:53:06 2022 +0000
+++ b/sys/arch/arm/omap/if_cpsw.c       Sun Sep 18 15:14:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cpsw.c,v 1.28 2020/02/04 07:35:34 skrll Exp $       */
+/*     $NetBSD: if_cpsw.c,v 1.29 2022/09/18 15:14:06 thorpej Exp $     */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.28 2020/02/04 07:35:34 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.29 2022/09/18 15:14:06 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -129,6 +129,7 @@
        volatile u_int sc_txnext;
        volatile u_int sc_txhead;
        volatile u_int sc_rxhead;
+       bool sc_txbusy;
        void *sc_rxthih;
        void *sc_rxih;
        void *sc_txih;
@@ -596,8 +597,10 @@
        KERNHIST_FUNC(__func__);
        KERNHIST_CALLED_5(cpswhist, (uintptr_t)sc, 0, 0, 0);
 
-       if (__predict_false((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) !=
-           IFF_RUNNING)) {
+       if (__predict_false((ifp->if_flags & IFF_RUNNING) == 0)) {
+               return;
+       }
+       if (__predict_false(sc->sc_txbusy)) {
                return;
        }
 
@@ -629,7 +632,7 @@
                }
 
                if (dm->dm_nsegs + 1 >= txfree) {
-                       ifp->if_flags |= IFF_OACTIVE;
+                       sc->sc_txbusy = true;
                        bus_dmamap_unload(sc->sc_bdt, dm);
                        break;
                }
@@ -1007,7 +1010,7 @@
        sc->sc_txeoq = true;
        callout_schedule(&sc->sc_tick_ch, hz);
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
 
        return 0;
 }
@@ -1075,8 +1078,9 @@
                rdp->tx_mb[i] = NULL;
        }
 
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
        ifp->if_timer = 0;
+       sc->sc_txbusy = false;
 
        if (!disable)
                return;
@@ -1270,7 +1274,7 @@
 
                handled = true;
 
-               ifp->if_flags &= ~IFF_OACTIVE;
+               sc->sc_txbusy = false;
 
 next:
                if (ISSET(dw[3], CPDMA_BD_EOP) && ISSET(dw[3], CPDMA_BD_EOQ)) {
diff -r 4713bc43f00d -r 1a26071bd10b sys/arch/arm/omap/omapl1x_emac.c
--- a/sys/arch/arm/omap/omapl1x_emac.c  Sun Sep 18 13:53:06 2022 +0000
+++ b/sys/arch/arm/omap/omapl1x_emac.c  Sun Sep 18 15:14:06 2022 +0000
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: omapl1x_emac.c,v 1.11 2019/05/30 02:32:17 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omapl1x_emac.c,v 1.12 2022/09/18 15:19:36 thorpej Exp $");
 
 #include "opt_omapl1x.h"
 
@@ -713,13 +713,9 @@
 {
        int ret;
        struct emac_chain *entry;
-       struct ifnet * const ifp = &sc->sc_if;
 
        if (chan->ch == TXCH) {
                ret = emac_tx_desc_dequeue(sc, chan);
-               if (ret == 0) {
-                       ifp->if_flags &= ~IFF_OACTIVE;
-               }
        } else {
                /* Process the received packet */
                ret = emac_rx_desc_process(sc, chan);
@@ -862,8 +858,7 @@
        bus_dmamap_t map;
        int error;
 
-       if (__predict_false((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) !=
-                           IFF_RUNNING)) {
+       if (__predict_false((ifp->if_flags & IFF_RUNNING) == 0)) {
                return;
        }
 
@@ -943,9 +938,6 @@
                        goto unlock;
        }
 
-       device_printf(sc->sc_dev, "TX desc's full, setting IFF_OACTIVE\n");
-       ifp->if_flags |= IFF_OACTIVE;
-
 unlock:
        mutex_exit(chan->lock);
 }
@@ -1020,7 +1012,7 @@
 
        mutex_exit(rx_chan->lock);
 
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
 }
 
 static int
@@ -1093,7 +1085,6 @@
        rx_chan->run = true;
        callout_schedule(&sc->sc_mii_callout, hz);
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
        mutex_enter(sc->sc_hwlock);
        emac_int_enable(sc);
diff -r 4713bc43f00d -r 1a26071bd10b sys/arch/arm/sociox/if_scx.c
--- a/sys/arch/arm/sociox/if_scx.c      Sun Sep 18 13:53:06 2022 +0000
+++ b/sys/arch/arm/sociox/if_scx.c      Sun Sep 18 15:14:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_scx.c,v 1.37 2022/06/12 16:22:37 andvar Exp $       */
+/*     $NetBSD: if_scx.c,v 1.38 2022/09/18 15:22:43 thorpej Exp $      */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -51,7 +51,7 @@
 #define NOT_MP_SAFE    0
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.37 2022/06/12 16:22:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.38 2022/09/18 15:22:43 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1133,7 +1133,6 @@
        mac_write(sc, GMACOMR, csr | OMR_SR | OMR_ST);
 
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
        /* start one second timer */
        callout_schedule(&sc->sc_callout, hz);
@@ -1153,7 +1152,7 @@
        mii_down(&sc->sc_mii);
 
        /* Mark the interface down and cancel the watchdog timer. */
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
        ifp->if_timer = 0;
 
        CSR_WRITE(sc, xINTAE_CLR, ~0);
@@ -1318,7 +1317,7 @@
        int error, nexttx, lasttx, ofree, seg;
        uint32_t tdes0;
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
 
        /* Remember the previous number of free descriptors. */
@@ -1362,10 +1361,8 @@
                         * Not enough free descriptors to transmit this
                         * packet.  We haven't committed anything yet,
                         * so just unload the DMA map, put the packet
-                        * back on the queue, and punt.  Notify the upper
-                        * layer that there are not more slots left.
+                        * back on the queue, and punt.
                         */
-                       ifp->if_flags |= IFF_OACTIVE;
                        bus_dmamap_unload(sc->sc_dmat, dmamap);
                        break;
                }
@@ -1427,10 +1424,6 @@
                bpf_mtap(ifp, m0, BPF_D_OUT);
        }
 
-       if (sc->sc_txsfree == 0 || sc->sc_txfree == 0) {
-               /* No more slots left; notify upper layer. */
-               ifp->if_flags |= IFF_OACTIVE;
-       }
        if (sc->sc_txfree != ofree) {
                /* Set a watchdog timer in case the chip flakes out. */
                ifp->if_timer = 5;
@@ -1505,8 +1498,6 @@
        uint32_t txstat;
        int i;
 
-       ifp->if_flags &= ~IFF_OACTIVE;
-
        for (i = sc->sc_txsdirty; sc->sc_txsfree != MD_TXQUEUELEN;
             i = MD_NEXTTXS(i), sc->sc_txsfree++) {
                txs = &sc->sc_txsoft[i];



Home | Main Index | Thread Index | Old Index