Module Name: src
Committed By: thorpej
Date: Mon Mar 16 01:54:23 UTC 2020
Modified Files:
src/sys/dev/pci: if_pcn.c if_sip.c
Log Message:
Do the "have transmit resources available" check before checking that
there is a packet in the send queue.
To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/if_pcn.c
cvs rdiff -u -r1.181 -r1.182 src/sys/dev/pci/if_sip.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_pcn.c
diff -u src/sys/dev/pci/if_pcn.c:1.75 src/sys/dev/pci/if_pcn.c:1.76
--- src/sys/dev/pci/if_pcn.c:1.75 Sun Mar 15 22:20:31 2020
+++ src/sys/dev/pci/if_pcn.c Mon Mar 16 01:54:23 2020
@@ -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 @@ struct pcn_softc {
#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 @@ pcn_attach(device_t parent, device_t sel
#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 @@ pcn_start(struct ifnet *ifp)
* 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;
Index: src/sys/dev/pci/if_sip.c
diff -u src/sys/dev/pci/if_sip.c:1.181 src/sys/dev/pci/if_sip.c:1.182
--- src/sys/dev/pci/if_sip.c:1.181 Sun Mar 15 22:20:31 2020
+++ src/sys/dev/pci/if_sip.c Mon Mar 16 01:54:23 2020
@@ -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 @@ struct sip_softc {
/*
* 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 @@ sipcom_do_detach(device_t self, enum sip
*/
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 @@ sipcom_attach(device_t parent, device_t
/*
* 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 @@ sipcom_start(struct ifnet *ifp)
* 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.
*/