Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/efa5f7948c50
branches:  trunk
changeset: 370144:efa5f7948c50
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 18 15:57:13 2022 +0000

description:
Eliminate use of IFF_OACTIVE.

diffstat:

 sys/arch/evbppc/virtex/dev/if_temac.c |  24 ++++++------------------
 sys/dev/bi/if_ni.c                    |   9 ++-------
 sys/dev/cadence/if_cemac.c            |  15 ++++++++-------
 3 files changed, 16 insertions(+), 32 deletions(-)

diffs (210 lines):

diff -r f0e7cdf182fd -r efa5f7948c50 sys/arch/evbppc/virtex/dev/if_temac.c
--- a/sys/arch/evbppc/virtex/dev/if_temac.c     Sun Sep 18 15:47:09 2022 +0000
+++ b/sys/arch/evbppc/virtex/dev/if_temac.c     Sun Sep 18 15:57:13 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_temac.c,v 1.19 2022/02/27 11:49:28 riastradh Exp $ */
+/*     $NetBSD: if_temac.c,v 1.20 2022/09/18 15:57:13 thorpej Exp $ */
 
 /*
  * Copyright (c) 2006 Jachym Holecek
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.19 2022/02/27 11:49:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.20 2022/09/18 15:57:13 thorpej Exp $");
 
 
 #include <sys/param.h>
@@ -635,7 +635,6 @@
        }
 
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
        return (0);
 }
@@ -684,16 +683,11 @@
         *
         * We schedule one interrupt per Tx batch.
         */
-       while (1) {
+       while (sc->sc_txsfree) {
                IFQ_POLL(&ifp->if_snd, m);
                if (m == NULL)
                        break;
 
-               if (sc->sc_txsfree == 0) {
-                       ifp->if_flags |= IFF_OACTIVE;
-                       break;
-               }
-
                txs = &sc->sc_txsoft[sc->sc_txscur];
                dmap = txs->txs_dmap;
 
@@ -718,12 +712,11 @@
                }
 
                /*
-                * If we're short on DMA descriptors, notify upper layers
-                * and leave this packet for later.
+                * If we're short on DMA descriptors; leave this packet
+                * for later.
                 */
                if (dmap->dm_nsegs > sc->sc_txfree) {
                        bus_dmamap_unload(sc->sc_dmat, dmap);
-                       ifp->if_flags |= IFF_OACTIVE;
                        break;
                }
 
@@ -820,7 +813,7 @@
        sc->sc_txbusy = 0;
 
        /* Acknowledge we're down. */
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
 }
 
 static int
@@ -1008,7 +1001,6 @@
 {
        struct temac_txsoft     *txs;
        bus_dmamap_t            dmap;
-       int                     sent = 0;
 
        /*
         * Transmit interrupts happen on the last descriptor of Tx jobs.
@@ -1030,7 +1022,6 @@
                txs->txs_mbuf = NULL;
 
                if_statinc(&sc->sc_if, if_opackets);
-               sent = 1;
 
                sc->sc_txsreap = TEMAC_TXSNEXT(sc->sc_txsreap);
                sc->sc_txsfree++;
@@ -1043,9 +1034,6 @@
                        break;
                }
        }
-
-       if (sent && (sc->sc_if.if_flags & IFF_OACTIVE))
-               sc->sc_if.if_flags &= ~IFF_OACTIVE;
 }
 
 static int
diff -r f0e7cdf182fd -r efa5f7948c50 sys/dev/bi/if_ni.c
--- a/sys/dev/bi/if_ni.c        Sun Sep 18 15:47:09 2022 +0000
+++ b/sys/dev/bi/if_ni.c        Sun Sep 18 15:57:13 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ni.c,v 1.49 2019/05/28 07:41:48 msaitoh Exp $ */
+/*     $NetBSD: if_ni.c,v 1.50 2022/09/18 16:51:28 thorpej Exp $ */
 /*
  * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
  *
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ni.c,v 1.49 2019/05/28 07:41:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ni.c,v 1.50 2022/09/18 16:51:28 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -482,7 +482,6 @@
         * Set flags (so ni_setup() do the right thing).
         */
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
        /*
         * Send setup messages so that the rx/tx locic starts.
@@ -503,8 +502,6 @@
        struct mbuf *m, *m0;
        int i, cnt, res, mlen;
 
-       if (ifp->if_flags & IFF_OACTIVE)
-               return;
 #ifdef DEBUG
        if (ifp->if_flags & IFF_DEBUG)
                printf("%s: nistart\n", device_xname(sc->sc_dev));
@@ -517,7 +514,6 @@
 
                data = REMQHI(&fqb->nf_dforw);
                if ((int)data == Q_EMPTY) {
-                       ifp->if_flags |= IFF_OACTIVE;
                        break;
                }
 
@@ -623,7 +619,6 @@
 
                case BVP_DGRAM:
                        m = (struct mbuf *)data->nd_cmdref;
-                       ifp->if_flags &= ~IFF_OACTIVE;
                        m_freem(m);
                        res = INSQTI(data, &fqb->nf_dforw);
                        if (res == Q_EMPTY) {
diff -r f0e7cdf182fd -r efa5f7948c50 sys/dev/cadence/if_cemac.c
--- a/sys/dev/cadence/if_cemac.c        Sun Sep 18 15:47:09 2022 +0000
+++ b/sys/dev/cadence/if_cemac.c        Sun Sep 18 15:57:13 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cemac.c,v 1.24 2021/12/31 14:25:22 riastradh Exp $  */
+/*     $NetBSD: if_cemac.c,v 1.25 2022/09/18 16:54:30 thorpej Exp $    */
 
 /*
  * Copyright (c) 2015  Genetec Corporation.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.24 2021/12/31 14:25:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.25 2022/09/18 16:54:30 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -126,6 +126,7 @@
        int                     txqi, txqc;
        struct cemac_qmeta      txq[TX_QLEN];
        callout_t               cemac_tick_ch;
+       bool                    tx_busy;
 
        int                     cemac_flags;
 };
@@ -225,7 +226,6 @@
 static int
 cemac_gctx(struct cemac_softc *sc)
 {
-       struct ifnet * ifp = &sc->sc_ethercom.ec_if;
        uint32_t tsr;
 
        tsr = CEMAC_READ(ETH_TSR);
@@ -261,8 +261,8 @@
        }
 
        // mark we're free
-       if (ifp->if_flags & IFF_OACTIVE) {
-               ifp->if_flags &= ~IFF_OACTIVE;
+       if (sc->tx_busy) {
+               sc->tx_busy = false;
                /* Disable transmit-buffer-free interrupt */
                /*CEMAC_WRITE(ETH_IDR, ETH_ISR_TBRE);*/
        }
@@ -783,7 +783,7 @@
        if (cemac_gctx(sc) == 0) {
                /* Enable transmit-buffer-free interrupt */
                CEMAC_WRITE(ETH_IER, ETH_ISR_TBRE);
-               ifp->if_flags |= IFF_OACTIVE;
+               sc->tx_busy = true;
                ifp->if_timer = 10;
                splx(s);
                return;
@@ -961,8 +961,9 @@
        /* Down the MII. */
        mii_down(&sc->sc_mii);
 
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
        ifp->if_timer = 0;
+       sc->tx_busy = false;
        sc->sc_mii.mii_media_status &= ~IFM_ACTIVE;
 }
 



Home | Main Index | Thread Index | Old Index