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/f0e7cdf182fd
branches:  trunk
changeset: 370143:f0e7cdf182fd
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 18 15:47:09 2022 +0000

description:
Eliminate use of IFF_OACTIVE.

diffstat:

 sys/arch/arm/ti/if_cpsw.c           |  20 ++++++++++++--------
 sys/arch/arm/xscale/ixp425_if_npe.c |  12 ++++--------
 sys/arch/emips/ebus/if_le_ebus.c    |  15 ++++++++-------
 3 files changed, 24 insertions(+), 23 deletions(-)

diffs (209 lines):

diff -r fbcc63b712fe -r f0e7cdf182fd sys/arch/arm/ti/if_cpsw.c
--- a/sys/arch/arm/ti/if_cpsw.c Sun Sep 18 15:44:29 2022 +0000
+++ b/sys/arch/arm/ti/if_cpsw.c Sun Sep 18 15:47:09 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cpsw.c,v 1.15 2021/11/07 17:12:55 jmcneill Exp $    */
+/*     $NetBSD: if_cpsw.c,v 1.16 2022/09/18 15:47:09 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.15 2021/11/07 17:12:55 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.16 2022/09/18 15:47:09 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -130,6 +130,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;
@@ -622,8 +623,10 @@
        KERNHIST_FUNC(__func__);
        CPSWHIST_CALLARGS(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;
        }
 
@@ -655,7 +658,7 @@
                }
 
                if (dm->dm_nsegs + 1 >= txfree) {
-                       ifp->if_flags |= IFF_OACTIVE;
+                       sc->sc_txbusy = true;
                        bus_dmamap_unload(sc->sc_bdt, dm);
                        break;
                }
@@ -1033,7 +1036,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;
 }
@@ -1101,8 +1104,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;
@@ -1295,7 +1299,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 fbcc63b712fe -r f0e7cdf182fd sys/arch/arm/xscale/ixp425_if_npe.c
--- a/sys/arch/arm/xscale/ixp425_if_npe.c       Sun Sep 18 15:44:29 2022 +0000
+++ b/sys/arch/arm/xscale/ixp425_if_npe.c       Sun Sep 18 15:47:09 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp425_if_npe.c,v 1.51 2022/05/22 11:27:34 andvar Exp $ */
+/*     $NetBSD: ixp425_if_npe.c,v 1.52 2022/09/18 15:49:42 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Sam Leffler.  All rights reserved.
@@ -28,7 +28,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.51 2022/05/22 11:27:34 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.52 2022/09/18 15:49:42 thorpej Exp $");
 
 /*
  * Intel XScale NPE Ethernet driver.
@@ -788,7 +788,6 @@
         * start routine to xmit more packets.
         */
        if_statadd(ifp, if_opackets, td->count);
-       ifp->if_flags &= ~IFF_OACTIVE;
        ifp->if_timer = 0;
        if_schedule_deferred_start(ifp);
 }
@@ -1174,7 +1173,6 @@
        npe_startrecv(sc);
 
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
        ifp->if_timer = 0;              /* just in case */
 
        /* Enable transmitter and receiver in the MAC */
@@ -1244,7 +1242,7 @@
        int nseg, len, error, i;
        uint32_t next;
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
 
        while (sc->tx_free != NULL) {
@@ -1308,8 +1306,6 @@
 
                ifp->if_timer = 5;
        }
-       if (sc->tx_free == NULL)
-               ifp->if_flags |= IFF_OACTIVE;
 }
 
 static void
@@ -1380,7 +1376,7 @@
        WR4(sc, NPE_MAC_CORE_CNTRL, NPE_CORE_MDC_EN);
 
        ifp->if_timer = 0;
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
 }
 
 void
diff -r fbcc63b712fe -r f0e7cdf182fd sys/arch/emips/ebus/if_le_ebus.c
--- a/sys/arch/emips/ebus/if_le_ebus.c  Sun Sep 18 15:44:29 2022 +0000
+++ b/sys/arch/emips/ebus/if_le_ebus.c  Sun Sep 18 15:47:09 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_le_ebus.c,v 1.23 2020/02/04 13:53:07 martin Exp $   */
+/*     $NetBSD: if_le_ebus.c,v 1.24 2022/09/18 15:53:24 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.23 2020/02/04 13:53:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.24 2022/09/18 15:53:24 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -95,6 +95,7 @@
        /* BUGBUG really should be malloc-ed */
 #define SC_MAX_N_XMIT 16
        struct bufmap sc_xmit[SC_MAX_N_XMIT];
+       bool sc_txbusy;
 
 #if DEBUG
        int xhit;
@@ -530,7 +531,7 @@
 
        /* Start the eNIC */
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
        ifp->if_timer = 0;
        ctl = sc->sc_regs->Control | EC_INTEN;
        ctl &= ~EC_RXDIS;
@@ -776,7 +777,7 @@
        if (--sc->sc_no_td == 0)
                ifp->if_timer = 0;
 
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
        if_schedule_deferred_start(ifp);
 #if DEBUG
        sc->it = 1;
@@ -805,7 +806,7 @@
        printf("enic_start(%x)\n", ifp->if_flags);
 #endif
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
 
        s = splnet();   /* I know, I dont trust people.. */
@@ -826,7 +827,7 @@
                        if (sc->sc_xmit[ix].mbuf == NULL)
                                goto found;
                /* oh well */
-               ifp->if_flags |= IFF_OACTIVE;
+               sc->sc_txbusy = true;
 #if DEBUG
                sc->tfull++;
 #endif
@@ -869,7 +870,7 @@
                tpostone(phys, len);
 
                if (sc->sc_regs->Control & EC_IF_FULL) {
-                       ifp->if_flags |= IFF_OACTIVE;
+                       sc->sc_txbusy = true;
 #if DEBUG
                        sc->tfull2++;
 #endif



Home | Main Index | Thread Index | Old Index