Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci vte_ifstart(): Make the condition if the transmi...



details:   https://anonhg.NetBSD.org/src/rev/4d82e18095b0
branches:  trunk
changeset: 370101:4d82e18095b0
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Sep 17 15:31:29 2022 +0000

description:
vte_ifstart(): Make the condition if the transmit loop the number of
free descriptors, not "are there packets in the queue"; the latter is
redundant with the IFQ_POLL() that happens within the loop after the
number of available descriptors is checked.  Eliminate use of IFF_OACTIVE.

diffstat:

 sys/dev/pci/if_vte.c |  27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)

diffs (75 lines):

diff -r 0c6f49fd4e5e -r 4d82e18095b0 sys/dev/pci/if_vte.c
--- a/sys/dev/pci/if_vte.c      Sat Sep 17 13:55:35 2022 +0000
+++ b/sys/dev/pci/if_vte.c      Sat Sep 17 15:31:29 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vte.c,v 1.33 2022/09/03 02:48:00 thorpej Exp $      */
+/*     $NetBSD: if_vte.c,v 1.34 2022/09/17 15:31:29 thorpej Exp $      */
 
 /*
  * Copyright (c) 2011 Manuel Bouyer.  All rights reserved.
@@ -55,7 +55,7 @@
 /* Driver for DM&P Electronics, Inc, Vortex86 RDC R6040 FastEthernet. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.33 2022/09/03 02:48:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.34 2022/09/17 15:31:29 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -772,23 +772,20 @@
 
        DPRINTF(("vte_ifstart 0x%x 0x%x\n", ifp->if_flags, sc->vte_flags));
 
-       if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) !=
-           IFF_RUNNING || (sc->vte_flags & VTE_FLAG_LINK) == 0)
+       if ((ifp->if_flags & IFF_RUNNING) == 0) {
                return;
+       }
+       if ((sc->vte_flags & VTE_FLAG_LINK) == 0) {
+               return;
+       }
 
-       for (enq = 0; !IFQ_IS_EMPTY(&ifp->if_snd); ) {
-               /* Reserve one free TX descriptor. */
-               if (sc->vte_cdata.vte_tx_cnt >= VTE_TX_RING_CNT - 1) {
-                       ifp->if_flags |= IFF_OACTIVE;
-                       break;
-               }
+       /* Reserve one free TX descriptor. */
+       for (enq = 0; sc->vte_cdata.vte_tx_cnt < VTE_TX_RING_CNT - 1; ) {
                IFQ_POLL(&ifp->if_snd, m_head);
                if (m_head == NULL)
                        break;
                /*
-                * Pack the data into the transmit ring. If we
-                * don't have room, set the OACTIVE flag and wait
-                * for the NIC to drain the ring.
+                * Pack the data into the transmit ring.
                 */
                DPRINTF(("vte_encap:"));
                if ((txd = vte_encap(sc, &m_head)) == NULL) {
@@ -1044,7 +1041,6 @@
        }
 
        if (prog > 0) {
-               ifp->if_flags &= ~IFF_OACTIVE;
                sc->vte_cdata.vte_tx_cons = cons;
                /*
                 * Unarm watchdog timer only when there is no pending
@@ -1365,7 +1361,6 @@
 
        sc->vte_flags &= ~VTE_FLAG_LINK;
        ifp->if_flags |= IFF_RUNNING;
-       ifp->if_flags &= ~IFF_OACTIVE;
 
        /* calling mii_mediachg will call back vte_start_mac() */
        if ((error = mii_mediachg(&sc->vte_mii)) == ENXIO)
@@ -1398,7 +1393,7 @@
        /*
         * Mark the interface down and cancel the watchdog timer.
         */
-       ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+       ifp->if_flags &= ~IFF_RUNNING;
        sc->vte_flags &= ~VTE_FLAG_LINK;
        callout_stop(&sc->vte_tick_ch);
        sc->vte_watchdog_timer = 0;



Home | Main Index | Thread Index | Old Index