From 23db2fa1dfd5dd6ff03940578d4218b65633da21 Mon Sep 17 00:00:00 2001 From: Max Laier Date: Sat, 9 Oct 2004 15:20:18 +0000 Subject: MFC: Fix sis, bfe and ndis in the same way dc was fixed: Do not tell the hardware to send when there were no packets enqueued. Found and reviewed by: green Approved by: re (scottl) --- sys/dev/bfe/if_bfe.c | 23 ++++++++++++++--------- sys/dev/if_ndis/if_ndis.c | 3 +++ 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/bfe/if_bfe.c b/sys/dev/bfe/if_bfe.c index ba69c541a652..805cd2669e19 100644 --- a/sys/dev/bfe/if_bfe.c +++ b/sys/dev/bfe/if_bfe.c @@ -1357,7 +1357,7 @@ bfe_start(struct ifnet *ifp) { struct bfe_softc *sc; struct mbuf *m_head = NULL; - int idx; + int idx, queued = 0; sc = ifp->if_softc; idx = sc->bfe_tx_prod; @@ -1393,6 +1393,8 @@ bfe_start(struct ifnet *ifp) break; } + queued++; + /* * If there's a BPF listener, bounce a copy of this frame * to him. @@ -1400,15 +1402,18 @@ bfe_start(struct ifnet *ifp) BPF_MTAP(ifp, m_head); } - sc->bfe_tx_prod = idx; - /* Transmit - twice due to apparent hardware bug */ - CSR_WRITE_4(sc, BFE_DMATX_PTR, idx * sizeof(struct bfe_desc)); - CSR_WRITE_4(sc, BFE_DMATX_PTR, idx * sizeof(struct bfe_desc)); + if (queued) { + sc->bfe_tx_prod = idx; + /* Transmit - twice due to apparent hardware bug */ + CSR_WRITE_4(sc, BFE_DMATX_PTR, idx * sizeof(struct bfe_desc)); + CSR_WRITE_4(sc, BFE_DMATX_PTR, idx * sizeof(struct bfe_desc)); + + /* + * Set a timeout in case the chip goes out to lunch. + */ + ifp->if_timer = 5; + } - /* - * Set a timeout in case the chip goes out to lunch. - */ - ifp->if_timer = 5; BFE_UNLOCK(sc); } diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index 48da1f8efd18..2412cf082070 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -1291,6 +1291,9 @@ ndis_start(ifp) break; } + if (pcnt == 0) + return; + if (sc->ndis_txpending == 0) ifp->if_flags |= IFF_OACTIVE; -- cgit v1.3