summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2004-07-15 12:18:57 +0000
committermillert <millert@openbsd.org>2004-07-15 12:18:57 +0000
commit335ac477a0ca69e7eab440159c02aef1149c57cc (patch)
tree5b32935d1aa6723f5298521d580bae2678e2e648
parentDelete some dead code and a less-than-helpful comment. (diff)
downloadwireguard-openbsd-335ac477a0ca69e7eab440159c02aef1149c57cc.tar.xz
wireguard-openbsd-335ac477a0ca69e7eab440159c02aef1149c57cc.zip
In the transmit interrupt handler, do not unnecessarily synchronize
all the descriptors for a buffer chain. Just synchronize the last one, which has the interesting stuff. We still synchronize all the descriptors for the buffer chain if super-verbose debugging is enabled, since the driver will print all the descriptors for the chain. Delay for tens of milliseconds lot after writing the Network Access Register. This is what the reference driver does, we can probably lower the delays later. From NetBSD (dyoung)
-rw-r--r--sys/dev/ic/atw.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c
index b793878b1ae..9a867a1db95 100644
--- a/sys/dev/ic/atw.c
+++ b/sys/dev/ic/atw.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: atw.c,v 1.9 2004/07/15 12:15:09 millert Exp $ */
-/* $NetBSD: atw.c,v 1.47 2004/07/15 06:34:24 dyoung Exp $ */
+/* $OpenBSD: atw.c,v 1.10 2004/07/15 12:18:57 millert Exp $ */
+/* $NetBSD: atw.c,v 1.49 2004/07/15 06:38:46 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.47 2004/07/15 06:34:24 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.49 2004/07/15 06:38:46 dyoung Exp $");
#endif
#include "bpfilter.h"
@@ -2493,6 +2493,7 @@ atw_stop(struct ifnet *ifp, int disable)
/* Stop the transmit and receive processes. */
sc->sc_opmode = 0;
ATW_WRITE(sc, ATW_NAR, 0);
+ DELAY(20 * 1000);
ATW_WRITE(sc, ATW_TDBD, 0);
ATW_WRITE(sc, ATW_TDBP, 0);
ATW_WRITE(sc, ATW_RDB, 0);
@@ -2722,6 +2723,8 @@ atw_intr(void *arg)
* the transmit process.
*/
ATW_WRITE(sc, ATW_NAR, sc->sc_opmode);
+ DELAY(20 * 1000);
+ ATW_WRITE(sc, ATW_RDR, 0x1);
/* XXX Log every Nth underrun from
* XXX now on?
*/
@@ -2797,12 +2800,13 @@ atw_idle(struct atw_softc *sc, u_int32_t bits)
}
ATW_WRITE(sc, ATW_NAR, opmode);
+ DELAY(20 * 1000);
- for (i = 0; i < 1000; i++) {
+ for (i = 0; i < 10; i++) {
stsr = ATW_READ(sc, ATW_STSR);
if ((stsr & ackmask) == ackmask)
break;
- DELAY(10);
+ DELAY(1000);
}
ATW_WRITE(sc, ATW_STSR, stsr & ackmask);
@@ -3049,14 +3053,16 @@ atw_txintr(struct atw_softc *sc)
* frames that have been transmitted.
*/
while ((txs = SIMPLEQ_FIRST(&sc->sc_txdirtyq)) != NULL) {
- ATW_CDTXSYNC(sc, txs->txs_lastdesc,
- txs->txs_ndescs,
+ ATW_CDTXSYNC(sc, txs->txs_lastdesc, 1,
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
#ifdef ATW_DEBUG
if ((ifp->if_flags & IFF_DEBUG) != 0 && atw_debug > 2) {
int i;
printf(" txsoft %p transmit chain:\n", txs);
+ ATW_CDTXSYNC(sc, txs->txs_firstdesc,
+ txs->txs_ndescs - 1,
+ BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
for (i = txs->txs_firstdesc;; i = ATW_NEXTTX(i)) {
printf(" descriptor %d:\n", i);
printf(" at_status: 0x%08x\n",