Assert that I'm DMA-syncing a non-negative number of transmit

descriptors.

As I free dirty transmit buffers, move them to the free list, not
back to the dirty list!

Add a 5-second transmit timeout.
This commit is contained in:
dyoung 2004-12-20 00:16:21 +00:00
parent 6ae65cb555
commit 3c88b36364
1 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtw.c,v 1.5 2004/12/19 08:19:25 dyoung Exp $ */
/* $NetBSD: rtw.c,v 1.6 2004/12/20 00:16:21 dyoung Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.5 2004/12/19 08:19:25 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.6 2004/12/20 00:16:21 dyoung Exp $");
#include "bpfilter.h"
@ -1386,7 +1386,7 @@ rtw_txbufs_release(bus_dma_tag_t dmat, struct ieee80211com *ic,
while ((stx = SIMPLEQ_FIRST(&stc->stc_dirtyq)) != NULL) {
rtw_txbuf_release(dmat, ic, stx);
SIMPLEQ_REMOVE_HEAD(&stc->stc_dirtyq, stx_q);
SIMPLEQ_INSERT_HEAD(&stc->stc_dirtyq, stx, stx_q);
SIMPLEQ_INSERT_TAIL(&stc->stc_freeq, stx, stx_q);
}
}
@ -1437,6 +1437,8 @@ rtw_collect_txring(struct rtw_softc *sc, struct rtw_txctl_blk *stc,
if (stx->stx_last < stx->stx_first)
ndesc += htc->htc_ndesc;
KASSERT(ndesc > 0);
rtw_txdescs_sync(sc->sc_dmat, sc->sc_desc_dmamap, htc,
stx->stx_first, ndesc,
BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
@ -1447,7 +1449,7 @@ rtw_collect_txring(struct rtw_softc *sc, struct rtw_txctl_blk *stc,
rtw_collect_txpkt(sc, htc, stx, ndesc);
SIMPLEQ_REMOVE_HEAD(&stc->stc_dirtyq, stx_q);
SIMPLEQ_INSERT_HEAD(&stc->stc_freeq, stx, stx_q);
SIMPLEQ_INSERT_TAIL(&stc->stc_freeq, stx, stx_q);
sc->sc_if.if_flags &= ~IFF_OACTIVE;
}
if (stx == NULL)
@ -2478,6 +2480,9 @@ rtw_start(struct ifnet *ifp)
SIMPLEQ_REMOVE_HEAD(&stc->stc_freeq, stx_q);
SIMPLEQ_INSERT_TAIL(&stc->stc_dirtyq, stx, stx_q);
stc->stc_tx_timer = 5;
ifp->if_timer = 1;
/* TBD poke just one txmtr? */
RTW_WRITE8(&sc->sc_regs, RTW_TPPOLL,
RTW_TPPOLL_NPQ | RTW_TPPOLL_LPQ | RTW_TPPOLL_HPQ |