Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/4713bc43f00d
branches:  trunk
changeset: 370134:4713bc43f00d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 18 13:53:06 2022 +0000

description:
Eliminate use of IFF_OACTIVE.

diffstat:

 sys/arch/arm/imx/if_enet.c    |  19 ++++++++++---------
 sys/arch/arm/imx/if_enetvar.h |   3 ++-
 2 files changed, 12 insertions(+), 10 deletions(-)

diffs (95 lines):

diff -r 98c2c82e598e -r 4713bc43f00d sys/arch/arm/imx/if_enet.c
--- a/sys/arch/arm/imx/if_enet.c        Sun Sep 18 13:31:08 2022 +0000
+++ b/sys/arch/arm/imx/if_enet.c        Sun Sep 18 13:53:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enet.c,v 1.35 2022/01/24 09:14:37 andvar Exp $      */
+/*     $NetBSD: if_enet.c,v 1.36 2022/09/18 13:53:06 thorpej Exp $     */
 
 /*
  * Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.35 2022/01/24 09:14:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.36 2022/09/18 13:53:06 thorpej Exp $");
 
 #include "vlan.h"
 
@@ -498,7 +498,7 @@
        sc->sc_tx_considx = idx;
 
        if (sc->sc_tx_free > 0)
-               ifp->if_flags &= ~IFF_OACTIVE;
+               sc->sc_txbusy = false;
 
        /*
         * No more pending TX descriptor,
@@ -823,7 +823,7 @@
 
        /* update if_flags */
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
+       sc->sc_txbusy = false;
 
        /* update local copy of if_flags */
        sc->sc_if_flags = ifp->if_flags;
@@ -850,18 +850,18 @@
        struct mbuf *m;
        int npkt;
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
 
        sc = ifp->if_softc;
-       for (npkt = 0; ; npkt++) {
+       for (npkt = 0; !sc->sc_txbusy; npkt++) {
                IFQ_POLL(&ifp->if_snd, m);
                if (m == NULL)
                        break;
 
                if (sc->sc_tx_free <= 0) {
                        /* no tx descriptor now... */
-                       ifp->if_flags |= IFF_OACTIVE;
+                       sc->sc_txbusy = true;
                        DEVICE_DPRINTF("TX descriptor is full\n");
                        break;
                }
@@ -870,7 +870,7 @@
 
                if (enet_encap_txring(sc, &m) != 0) {
                        /* too many mbuf chains? */
-                       ifp->if_flags |= IFF_OACTIVE;
+                       sc->sc_txbusy = true;
                        DEVICE_DPRINTF(
                            "TX descriptor is full. dropping packet\n");
                        m_freem(m);
@@ -909,8 +909,9 @@
        ENET_REG_WRITE(sc, ENET_ECR, v & ~ENET_ECR_ETHEREN);
 
        /* 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;
+       sc->sc_txbusy = false;
 
        if (disable) {
                enet_drain_txbuf(sc);
diff -r 98c2c82e598e -r 4713bc43f00d sys/arch/arm/imx/if_enetvar.h
--- a/sys/arch/arm/imx/if_enetvar.h     Sun Sep 18 13:31:08 2022 +0000
+++ b/sys/arch/arm/imx/if_enetvar.h     Sun Sep 18 13:53:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enetvar.h,v 1.7 2020/01/15 01:09:56 jmcneill Exp $  */
+/*     $NetBSD: if_enetvar.h,v 1.8 2022/09/18 13:53:06 thorpej Exp $   */
 
 /*
  * Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -81,6 +81,7 @@
        int sc_tx_considx;
        int sc_tx_prodidx;
        int sc_tx_free;
+       bool sc_txbusy;
 
        /* RX */
        struct enet_rxsoft sc_rxsoft[ENET_RX_RING_CNT];



Home | Main Index | Thread Index | Old Index