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/4a1bfab11eed
branches:  trunk
changeset: 370127:4a1bfab11eed
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 18 10:54:52 2022 +0000

description:
Eliminate use of IFF_OACTIVE.

diffstat:

 sys/arch/macppc/dev/am79c950.c         |  17 +++++++----------
 sys/arch/macppc/dev/if_bm.c            |  18 ++++++++----------
 sys/arch/macppc/dev/if_gm.c            |  18 ++++++++----------
 sys/arch/macppc/dev/if_mcvar.h         |   3 ++-
 sys/arch/mips/adm5120/dev/if_admsw.c   |  26 ++++++++++----------------
 sys/arch/mips/alchemy/dev/if_aumac.c   |  13 +++++--------
 sys/arch/mips/atheros/dev/if_ae.c      |  19 +++++--------------
 sys/arch/mips/cavium/dev/if_cnmac.c    |  21 ++++++++++++---------
 sys/arch/mips/cavium/dev/if_cnmacvar.h |   3 ++-
 9 files changed, 59 insertions(+), 79 deletions(-)

diffs (truncated from 533 to 300 lines):

diff -r a2408723752d -r 4a1bfab11eed sys/arch/macppc/dev/am79c950.c
--- a/sys/arch/macppc/dev/am79c950.c    Sun Sep 18 06:03:19 2022 +0000
+++ b/sys/arch/macppc/dev/am79c950.c    Sun Sep 18 10:54:52 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: am79c950.c,v 1.50 2020/10/20 18:17:58 roy Exp $        */
+/*     $NetBSD: am79c950.c,v 1.51 2022/09/18 10:54:52 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1997 David Huang <khym%bga.com@localhost>
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.50 2020/10/20 18:17:58 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.51 2022/09/18 10:54:52 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -250,13 +250,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 @@
                bpf_mtap(ifp, m, BPF_D_OUT);
 
                /* 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;
@@ -515,7 +512,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 a2408723752d -r 4a1bfab11eed sys/arch/macppc/dev/if_bm.c
--- a/sys/arch/macppc/dev/if_bm.c       Sun Sep 18 06:03:19 2022 +0000
+++ b/sys/arch/macppc/dev/if_bm.c       Sun Sep 18 10:54:52 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bm.c,v 1.64 2021/03/05 07:15:53 rin Exp $   */
+/*     $NetBSD: if_bm.c,v 1.65 2022/09/18 10:59:22 thorpej Exp $       */
 
 /*-
  * Copyright (C) 1998, 1999, 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.64 2021/03/05 07:15:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.65 2022/09/18 10:59:22 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -90,6 +90,7 @@
        void *sc_rxbuf;
        int sc_rxlast;
        int sc_flags;
+       bool sc_txbusy;
        struct mii_data sc_mii;
        u_char sc_enaddr[6];
 };
@@ -382,7 +383,7 @@
        bmac_write_reg(sc, INTDISABLE, NormalIntEvents);
 
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
        ifp->if_timer = 0;
 
        data = sc->sc_txbuf;
@@ -440,7 +441,7 @@
 #endif
 
        if (stat & IntFrameSent) {
-               sc->sc_if.if_flags &= ~IFF_OACTIVE;
+               sc->sc_txbusy = false;
                sc->sc_if.if_timer = 0;
                if_statinc(&sc->sc_if, if_opackets);
                if_schedule_deferred_start(&sc->sc_if);
@@ -561,13 +562,10 @@
        struct mbuf *m;
        int tlen;
 
-       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) {
                IFQ_DEQUEUE(&ifp->if_snd, m);
                if (m == 0)
                        break;
@@ -577,7 +575,7 @@
                 */
                bpf_mtap(ifp, m, BPF_D_OUT);
 
-               ifp->if_flags |= IFF_OACTIVE;
+               sc->sc_txbusy = true;
                tlen = bmac_put(sc, sc->sc_txbuf, m);
 
                /* 5 seconds to watch for failing to transmit */
diff -r a2408723752d -r 4a1bfab11eed sys/arch/macppc/dev/if_gm.c
--- a/sys/arch/macppc/dev/if_gm.c       Sun Sep 18 06:03:19 2022 +0000
+++ b/sys/arch/macppc/dev/if_gm.c       Sun Sep 18 10:54:52 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gm.c,v 1.58 2021/03/05 07:15:53 rin Exp $   */
+/*     $NetBSD: if_gm.c,v 1.59 2022/09/18 11:08:29 thorpej Exp $       */
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.58 2021/03/05 07:15:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.59 2022/09/18 11:08:29 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -75,6 +75,7 @@
        struct gmac_dma *sc_txlist;
        struct gmac_dma *sc_rxlist;
        int sc_txnext;
+       bool sc_txbusy;
        int sc_rxlast;
        void *sc_txbuf[NTXBUF];
        void *sc_rxbuf[NRXBUF];
@@ -337,7 +338,7 @@
 {
        struct ifnet *ifp = &sc->sc_if;
 
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
        ifp->if_timer = 0;
        if_schedule_deferred_start(ifp);
 }
@@ -446,13 +447,10 @@
        int i, tlen;
        volatile struct gmac_dma *dp;
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
 
-       for (;;) {
-               if (ifp->if_flags & IFF_OACTIVE)
-                       break;
-
+       while (!sc->sc_txbusy) {
                IFQ_DEQUEUE(&ifp->if_snd, m);
                if (m == 0)
                        break;
@@ -489,7 +487,7 @@
                if (i == NTXBUF)
                        i = 0;
                if (i == gmac_read_reg(sc, GMAC_TXDMACOMPLETE)) {
-                       ifp->if_flags |= IFF_OACTIVE;
+                       sc->sc_txbusy = true;
                        break;
                }
        }
@@ -732,7 +730,7 @@
        gmac_write_reg(sc, GMAC_INTMASK, ~(GMAC_INT_TXEMPTY | GMAC_INT_RXDONE));
 
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
        ifp->if_timer = 0;
 
        callout_reset(&sc->sc_tick_ch, 1, gmac_mii_tick, sc);
diff -r a2408723752d -r 4a1bfab11eed sys/arch/macppc/dev/if_mcvar.h
--- a/sys/arch/macppc/dev/if_mcvar.h    Sun Sep 18 06:03:19 2022 +0000
+++ b/sys/arch/macppc/dev/if_mcvar.h    Sun Sep 18 10:54:52 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mcvar.h,v 1.13 2011/07/26 08:36:02 macallan Exp $   */
+/*     $NetBSD: if_mcvar.h,v 1.14 2022/09/18 10:54:52 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1997 David Huang <khym%bga.com@localhost>
@@ -86,6 +86,7 @@
        u_char          *sc_txbuf, *sc_rxbuf;
        int             sc_txbuf_phys, sc_rxbuf_phys;
        int             sc_tail;
+       bool            sc_txbusy;
 
        int             sc_node;
        dbdma_regmap_t  *sc_txdma;
diff -r a2408723752d -r 4a1bfab11eed sys/arch/mips/adm5120/dev/if_admsw.c
--- a/sys/arch/mips/adm5120/dev/if_admsw.c      Sun Sep 18 06:03:19 2022 +0000
+++ b/sys/arch/mips/adm5120/dev/if_admsw.c      Sun Sep 18 10:54:52 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_admsw.c,v 1.28 2020/01/29 05:30:14 thorpej Exp $ */
+/* $NetBSD: if_admsw.c,v 1.29 2022/09/18 11:17:36 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.28 2020/01/29 05:30:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.29 2022/09/18 11:17:36 thorpej Exp $");
 
 
 #include <sys/param.h>
@@ -556,13 +556,12 @@
                i = vlan;
                for (;;) {
                        ifp = &sc->sc_ethercom[i].ec_if;
-                       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) ==
-                           IFF_RUNNING) {
-                               /* Grab a packet off the queue. */
-                               IFQ_POLL(&ifp->if_snd, m0);
-                               if (m0 != NULL)
-                                       break;
-                       }
+                       if ((ifp->if_flags & IFF_RUNNING) == 0)
+                               continue;
+                       /* Grab a packet off the queue. */
+                       IFQ_POLL(&ifp->if_snd, m0);
+                       if (m0 != NULL)
+                               break;
                        i++;
                        if (i == SW_DEVS)
                                i = 0;
@@ -574,8 +573,7 @@
 
                /* Get a spare descriptor. */
                if (sc->sc_txfree == 0) {
-                       /* No more slots left; notify upper layer. */
-                       ifp->if_flags |= IFF_OACTIVE;
+                       /* No more slots left. */
                        ADMSW_EVCNT_INCR(&sc->sc_ev_txstall);
                        break;
                }
@@ -881,9 +879,6 @@
 #ifdef ADMSW_EVENT_COUNTERS
                ADMSW_EVCNT_INCR(&sc->sc_ev_txintr);
 #endif
-               for (vlan = 0; vlan < SW_DEVS; vlan++)
-                       sc->sc_ethercom[vlan].ec_if.if_flags &= ~IFF_OACTIVE;
-
                ifp = &sc->sc_ethercom[0].ec_if;
 
                /* Try to queue more packets. */
@@ -1061,7 +1056,6 @@
 
        /* Mark iface as running */
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
        return 0;
 }
@@ -1098,7 +1092,7 @@
        }
 
        /* Mark the interface as down and cancel the watchdog timer. */
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
        ifp->if_timer = 0;
 
        return;
diff -r a2408723752d -r 4a1bfab11eed sys/arch/mips/alchemy/dev/if_aumac.c
--- a/sys/arch/mips/alchemy/dev/if_aumac.c      Sun Sep 18 06:03:19 2022 +0000
+++ b/sys/arch/mips/alchemy/dev/if_aumac.c      Sun Sep 18 10:54:52 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aumac.c,v 1.49 2020/09/29 02:58:52 msaitoh Exp $ */
+/* $NetBSD: if_aumac.c,v 1.50 2022/09/18 11:25:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.



Home | Main Index | Thread Index | Old Index