Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/6099c6a6d4c1
branches:  trunk
changeset: 370132:6099c6a6d4c1
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 18 13:19:40 2022 +0000

description:
Eliminate use of IFF_OACTIVE.

diffstat:

 sys/arch/powerpc/ibm4xx/dev/if_emac.c |  18 +++++-------------
 sys/arch/sgimips/hpc/if_sq.c          |  21 +++++----------------
 sys/arch/sgimips/mace/if_mec.c        |  14 +++++---------
 3 files changed, 15 insertions(+), 38 deletions(-)

diffs (222 lines):

diff -r 017b0d489505 -r 6099c6a6d4c1 sys/arch/powerpc/ibm4xx/dev/if_emac.c
--- a/sys/arch/powerpc/ibm4xx/dev/if_emac.c     Sun Sep 18 13:03:51 2022 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/if_emac.c     Sun Sep 18 13:19:40 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $ */
+/*     $NetBSD: if_emac.c,v 1.57 2022/09/18 13:19:40 thorpej Exp $     */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.57 2022/09/18 13:19:40 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_emac.h"
@@ -671,7 +671,7 @@
 
        lasttx = 0;     /* XXX gcc */
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
 
        /*
@@ -740,7 +740,6 @@
                         * layer that there are not more slots left.
                         *
                         */
-                       ifp->if_flags |= IFF_OACTIVE;
                        bus_dmamap_unload(sc->sc_dmat, dmamap);
                        EMAC_EVCNT_INCR(&sc->sc_ev_txdstall);
                        break;
@@ -831,10 +830,6 @@
                bpf_mtap(ifp, m0, BPF_D_OUT);
        }
 
-       if (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;
@@ -1050,11 +1045,10 @@
         * ... all done!
         */
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
  out:
        if (error) {
-               ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+               ifp->if_flags &= ~IFF_RUNNING;
                ifp->if_timer = 0;
                aprint_error_ifnet(ifp, "interface not running\n");
        }
@@ -1100,7 +1094,7 @@
        /*
         * 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;
 }
 
@@ -1268,8 +1262,6 @@
        EMAC_EVCNT_INCR(&sc->sc_ev_txreap);
        handled = 0;
 
-       ifp->if_flags &= ~IFF_OACTIVE;
-
        count = 0;
        /*
         * Go through our Tx list and free mbufs for those
diff -r 017b0d489505 -r 6099c6a6d4c1 sys/arch/sgimips/hpc/if_sq.c
--- a/sys/arch/sgimips/hpc/if_sq.c      Sun Sep 18 13:03:51 2022 +0000
+++ b/sys/arch/sgimips/hpc/if_sq.c      Sun Sep 18 13:19:40 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sq.c,v 1.54 2020/01/30 06:25:46 martin Exp $        */
+/*     $NetBSD: if_sq.c,v 1.55 2022/09/18 13:23:53 thorpej Exp $       */
 
 /*
  * Copyright (c) 2001 Rafal K. Boni
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.54 2020/01/30 06:25:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.55 2022/09/18 13:23:53 thorpej Exp $");
 
 
 #include <sys/param.h>
@@ -456,7 +456,6 @@
                sq_hpc_write(sc, HPC1_ENET_INTDELAY, HPC1_ENET_INTDELAY_OFF);
 
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
        return 0;
 }
@@ -535,7 +534,7 @@
        bus_dmamap_t dmamap;
        int err, totlen, nexttx, firsttx, lasttx = -1, ofree, seg;
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
 
        /*
@@ -619,13 +618,11 @@
                         * Not enough free descriptors to transmit this
                         * packet.  We haven't committed to anything yet,
                         * so just unload the DMA map, put the packet
-                        * back on the queue, and punt.  Notify the upper
-                        * layer that there are no more slots left.
+                        * back on the queue, and punt.
                         *
                         * XXX We could allocate an mbuf and copy, but
                         * XXX it is worth it?
                         */
-                       ifp->if_flags |= IFF_OACTIVE;
                        bus_dmamap_unload(sc->sc_dmat, dmamap);
                        if (m != NULL)
                                m_freem(m);
@@ -719,10 +716,6 @@
                sc->sc_nexttx = nexttx;
        }
 
-       /* All transmit descriptors used up, let upper layers know */
-       if (sc->sc_nfreetx == 0)
-               ifp->if_flags |= IFF_OACTIVE;
-
        if (sc->sc_nfreetx != ofree) {
                SQ_DPRINTF(("%s: %d packets enqueued, first %d, INTR on %d\n",
                    device_xname(sc->sc_dev), lasttx - firsttx + 1,
@@ -839,7 +832,7 @@
 
        sq_reset(sc);
 
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
        ifp->if_timer = 0;
 }
 
@@ -1101,10 +1094,6 @@
        else
                sq_txring_hpc1(sc);
 
-       /* If we have buffers free, let upper layers know */
-       if (sc->sc_nfreetx > 0)
-               ifp->if_flags &= ~IFF_OACTIVE;
-
        /* If all packets have left the coop, cancel watchdog */
        if (sc->sc_nfreetx == SQ_NTXDESC)
                ifp->if_timer = 0;
diff -r 017b0d489505 -r 6099c6a6d4c1 sys/arch/sgimips/mace/if_mec.c
--- a/sys/arch/sgimips/mace/if_mec.c    Sun Sep 18 13:03:51 2022 +0000
+++ b/sys/arch/sgimips/mace/if_mec.c    Sun Sep 18 13:19:40 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.63 2020/01/29 05:37:08 thorpej Exp $ */
+/* $NetBSD: if_mec.c,v 1.64 2022/09/18 13:26:40 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2004, 2008 Izumi Tsutsui.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.63 2020/01/29 05:37:08 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.64 2022/09/18 13:26:40 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -905,7 +905,6 @@
                return rc;
 
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
        mec_start(ifp);
 
        return 0;
@@ -953,7 +952,7 @@
        int len, bufoff, buflen, nsegs, align, resid, pseg, nptr, slen, i;
        uint32_t txdcmd;
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+       if ((ifp->if_flags & IFF_RUNNING) == 0)
                return;
 
        /*
@@ -1391,9 +1390,8 @@
        }
 
        if (sc->sc_txpending == MEC_NTXDESC - 1) {
-               /* No more slots; notify upper layer. */
+               /* No more slots. */
                MEC_EVCNT_INCR(&sc->sc_ev_txdstall);
-               ifp->if_flags |= IFF_OACTIVE;
        }
 
        if (sc->sc_txpending != opending) {
@@ -1422,7 +1420,7 @@
        DPRINTF(MEC_DEBUG_STOP, ("%s\n", __func__));
 
        ifp->if_timer = 0;
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
 
        callout_stop(&sc->sc_tick_ch);
        mii_down(&sc->sc_mii);
@@ -1900,8 +1898,6 @@
        /* cancel the watchdog timer if there are no pending TX packets */
        if (sc->sc_txpending == 0)
                ifp->if_timer = 0;
-       if (sc->sc_txpending < MEC_NTXDESC - MEC_NTXDESC_RSVD)
-               ifp->if_flags &= ~IFF_OACTIVE;
 }
 
 static bool



Home | Main Index | Thread Index | Old Index