summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-10-18 01:01:28 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-10-18 01:01:28 +0000
commitaaf387dc1acb29472904cd77e55a7b3d8af41a34 (patch)
tree0f4d21ea4c2d4d2ff36cde75aaef54b73710825f /sys
parent89aabae5d37d72f978d1c81cd182a3d4995b66a9 (diff)
Put rev 1.56 back in and make sure to include the header so
it actually compiles this time.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_sis.c30
-rw-r--r--sys/dev/pci/if_sisreg.h4
2 files changed, 12 insertions, 22 deletions
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c
index 32e61f5e9fb..b5855eced4a 100644
--- a/sys/dev/pci/if_sis.c
+++ b/sys/dev/pci/if_sis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sis.c,v 1.57 2005/10/18 00:44:23 brad Exp $ */
+/* $OpenBSD: if_sis.c,v 1.58 2005/10/18 01:01:27 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -1425,22 +1425,18 @@ void sis_rxeoc(sc)
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];
bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
((caddr_t)cur_tx - sc->sc_listkva),
@@ -1450,11 +1446,8 @@ void sis_txeof(sc)
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++;
@@ -1479,18 +1472,15 @@ void sis_txeof(sc)
m_freem(cur_tx->sis_mbuf);
cur_tx->sis_mbuf = NULL;
}
-
- 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;
+ }
- return;
+ ifp->if_timer = (sc->sis_cdata.sis_tx_cnt == 0) ? 0 : 5;
}
void sis_tick(xsc)
diff --git a/sys/dev/pci/if_sisreg.h b/sys/dev/pci/if_sisreg.h
index b1edef8661d..378fbb1b114 100644
--- a/sys/dev/pci/if_sisreg.h
+++ b/sys/dev/pci/if_sisreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sisreg.h,v 1.22 2005/10/14 22:59:38 brad Exp $ */
+/* $OpenBSD: if_sisreg.h,v 1.23 2005/10/18 01:01:27 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@@ -330,7 +330,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