aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Rizzo <luigi@FreeBSD.org>2002-06-30 21:59:08 +0000
committerLuigi Rizzo <luigi@FreeBSD.org>2002-06-30 21:59:08 +0000
commit4dfae5a5e8b316e524ea391625891864eb6d6cdb (patch)
treec49e01c1e0017c8dc98db742120350df62e00c37
parent4f0fa8805b91b55b33b80400e61971c8318a8292 (diff)
Notes
-rw-r--r--sys/pci/if_sis.c28
-rw-r--r--sys/pci/if_sisreg.h2
2 files changed, 11 insertions, 19 deletions
diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c
index 22a2163f7c944..380195747b86d 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -1393,31 +1393,24 @@ void sis_rxeoc(sc)
static void sis_txeof(sc)
struct sis_softc *sc;
{
- struct sis_desc *cur_tx = NULL;
struct ifnet *ifp;
u_int32_t idx;
ifp = &sc->arpcom.ac_if;
- /* Clear the timeout timer. */
- ifp->if_timer = 0;
-
/*
* Go through our tx list and free mbufs for those
* frames that have been transmitted.
*/
- idx = sc->sis_cdata.sis_tx_cons;
- while (idx != sc->sis_cdata.sis_tx_prod) {
- cur_tx = &sc->sis_ldata.sis_tx_list[idx];
+ for (idx = sc->sis_cdata.sis_tx_cons; sc->sis_cdata.sis_tx_cnt > 0;
+ sc->sis_cdata.sis_tx_cnt--, SIS_INC(idx, SIS_TX_LIST_CNT) ) {
+ struct sis_desc *cur_tx = &sc->sis_ldata.sis_tx_list[idx];
if (SIS_OWNDESC(cur_tx))
break;
- if (cur_tx->sis_ctl & SIS_CMDSTS_MORE) {
- sc->sis_cdata.sis_tx_cnt--;
- SIS_INC(idx, SIS_TX_LIST_CNT);
+ if (cur_tx->sis_ctl & SIS_CMDSTS_MORE)
continue;
- }
if (!(cur_tx->sis_ctl & SIS_CMDSTS_PKT_OK)) {
ifp->if_oerrors++;
@@ -1437,16 +1430,15 @@ static void sis_txeof(sc)
bus_dmamap_unload(sc->sis_tag, cur_tx->sis_map);
bus_dmamap_destroy(sc->sis_tag, cur_tx->sis_map);
}
-
- sc->sis_cdata.sis_tx_cnt--;
- SIS_INC(idx, SIS_TX_LIST_CNT);
- ifp->if_timer = 0;
}
- sc->sis_cdata.sis_tx_cons = idx;
-
- if (cur_tx != NULL)
+ if (idx != sc->sis_cdata.sis_tx_cons) {
+ /* we freed up some buffers */
+ sc->sis_cdata.sis_tx_cons = idx;
ifp->if_flags &= ~IFF_OACTIVE;
+ }
+
+ ifp->if_timer = (sc->sis_cdata.sis_tx_cnt == 0) ? 0 : 5;
return;
}
diff --git a/sys/pci/if_sisreg.h b/sys/pci/if_sisreg.h
index 8244f2a2f156b..2e2ee19a5bba5 100644
--- a/sys/pci/if_sisreg.h
+++ b/sys/pci/if_sisreg.h
@@ -309,7 +309,7 @@ struct sis_desc {
#define SIS_LASTDESC(x) (!((x)->sis_ctl & SIS_CMDSTS_MORE)))
#define SIS_OWNDESC(x) ((x)->sis_ctl & SIS_CMDSTS_OWN)
-#define SIS_INC(x, y) { if (++(x) == y) x = 0; }
+#define SIS_INC(x, y) (x) = ((x) == ((y)-1)) ? 0 : (x)+1
#define SIS_RXBYTES(x) (((x)->sis_ctl & SIS_CMDSTS_BUFLEN) - ETHER_CRC_LEN)
#define SIS_RXSTAT_COLL 0x00010000