Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Do the "have transmit resources available" check...



details:   https://anonhg.NetBSD.org/src/rev/68e6fff9a604
branches:  trunk
changeset: 745911:68e6fff9a604
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Mar 16 01:54:23 2020 +0000

description:
Do the "have transmit resources available" check before checking that
there is a packet in the send queue.

diffstat:

 sys/dev/pci/if_pcn.c |  15 +++------------
 sys/dev/pci/if_sip.c |  16 +++-------------
 2 files changed, 6 insertions(+), 25 deletions(-)

diffs (114 lines):

diff -r d79a1e4b55f0 -r 68e6fff9a604 sys/dev/pci/if_pcn.c
--- a/sys/dev/pci/if_pcn.c      Mon Mar 16 01:37:51 2020 +0000
+++ b/sys/dev/pci/if_pcn.c      Mon Mar 16 01:54:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_pcn.c,v 1.75 2020/03/15 22:20:31 thorpej Exp $      */
+/*     $NetBSD: if_pcn.c,v 1.76 2020/03/16 01:54:23 thorpej Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.75 2020/03/15 22:20:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.76 2020/03/16 01:54:23 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -267,7 +267,6 @@
 
 #ifdef PCN_EVENT_COUNTERS
        /* Event counters. */
-       struct evcnt sc_ev_txsstall;    /* Tx stalled due to no txs */
        struct evcnt sc_ev_txdstall;    /* Tx stalled due to no txd */
        struct evcnt sc_ev_txintr;      /* Tx interrupts */
        struct evcnt sc_ev_rxintr;      /* Rx interrupts */
@@ -821,8 +820,6 @@
 
 #ifdef PCN_EVENT_COUNTERS
        /* Attach event counters. */
-       evcnt_attach_dynamic(&sc->sc_ev_txsstall, EVCNT_TYPE_MISC,
-           NULL, device_xname(self), "txsstall");
        evcnt_attach_dynamic(&sc->sc_ev_txdstall, EVCNT_TYPE_MISC,
            NULL, device_xname(self), "txdstall");
        evcnt_attach_dynamic(&sc->sc_ev_txintr, EVCNT_TYPE_INTR,
@@ -936,19 +933,13 @@
         * until we drain the queue, or use up all available transmit
         * descriptors.
         */
-       for (;;) {
+       while (sc->sc_txsfree != 0) {
                /* Grab a packet off the queue. */
                IFQ_POLL(&ifp->if_snd, m0);
                if (m0 == NULL)
                        break;
                m = NULL;
 
-               /* Get a work queue entry. */
-               if (sc->sc_txsfree == 0) {
-                       PCN_EVCNT_INCR(&sc->sc_ev_txsstall);
-                       break;
-               }
-
                txs = &sc->sc_txsoft[sc->sc_txsnext];
                dmamap = txs->txs_dmamap;
 
diff -r d79a1e4b55f0 -r 68e6fff9a604 sys/dev/pci/if_sip.c
--- a/sys/dev/pci/if_sip.c      Mon Mar 16 01:37:51 2020 +0000
+++ b/sys/dev/pci/if_sip.c      Mon Mar 16 01:54:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sip.c,v 1.181 2020/03/15 22:20:31 thorpej Exp $     */
+/*     $NetBSD: if_sip.c,v 1.182 2020/03/16 01:54:23 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.181 2020/03/15 22:20:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.182 2020/03/16 01:54:23 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -248,7 +248,6 @@
        /*
         * Event counters.
         */
-       struct evcnt sc_ev_txsstall;    /* Tx stalled due to no txs */
        struct evcnt sc_ev_txdstall;    /* Tx stalled due to no txd */
        struct evcnt sc_ev_txforceintr; /* Tx interrupts forced */
        struct evcnt sc_ev_txdintr;     /* Tx descriptor interrupts */
@@ -973,7 +972,6 @@
                 */
                evcnt_detach(&sc->sc_ev_txforceintr);
                evcnt_detach(&sc->sc_ev_txdstall);
-               evcnt_detach(&sc->sc_ev_txsstall);
                evcnt_detach(&sc->sc_ev_hiberr);
                evcnt_detach(&sc->sc_ev_rxintr);
                evcnt_detach(&sc->sc_ev_txiintr);
@@ -1432,8 +1430,6 @@
        /*
         * Attach event counters.
         */
-       evcnt_attach_dynamic(&sc->sc_ev_txsstall, EVCNT_TYPE_MISC,
-           NULL, device_xname(sc->sc_dev), "txsstall");
        evcnt_attach_dynamic(&sc->sc_ev_txdstall, EVCNT_TYPE_MISC,
            NULL, device_xname(sc->sc_dev), "txdstall");
        evcnt_attach_dynamic(&sc->sc_ev_txforceintr, EVCNT_TYPE_INTR,
@@ -1567,13 +1563,7 @@
         * until we drain the queue, or use up all available transmit
         * descriptors.
         */
-       for (;;) {
-               /* Get a work queue entry. */
-               if ((txs = SIMPLEQ_FIRST(&sc->sc_txfreeq)) == NULL) {
-                       SIP_EVCNT_INCR(&sc->sc_ev_txsstall);
-                       break;
-               }
-
+       while ((txs = SIMPLEQ_FIRST(&sc->sc_txfreeq)) != NULL) {
                /*
                 * Grab a packet off the queue.
                 */



Home | Main Index | Thread Index | Old Index