On Sun, Jul 15, 2012 at 07:57:26PM +0200, Stefan Sperling wrote: > The part of this change which resets sc->sc_tx_timer in a different way > can cause spurious device timeouts, leading to unneccesary disassociations. > I'm seeing a device timeout almost every minute on a net5501 soekris with > the RT2561S (dev/ic/rt2661.c) ral variant. > > It seems we should not always expect to see an empty queue in the TX > interrupt handler. Resetting the tx timer if one or more frames were > dequeued, rather than if all frames were dequeued, fixes the spurious > device timeouts for me and should still detect a card that got stuck.
Disregard this diff. It makes things even worse because it re-introduces the problem where the interface gets stuck with OACTIVE set and isn't reset automatically. > > Index: rt2560.c > =================================================================== > RCS file: /cvs/src/sys/dev/ic/rt2560.c,v > retrieving revision 1.60 > diff -u -p -r1.60 rt2560.c > --- rt2560.c 13 Jul 2012 10:08:15 -0000 1.60 > +++ rt2560.c 15 Jul 2012 17:07:17 -0000 > @@ -993,10 +993,9 @@ rt2560_tx_intr(struct rt2560_softc *sc) > > sc->txq.queued--; > sc->txq.next = (sc->txq.next + 1) % RT2560_TX_RING_COUNT; > + sc->sc_tx_timer = 0; > } > > - if (sc->txq.queued == 0 && sc->prioq.queued == 0) > - sc->sc_tx_timer = 0; > if (sc->txq.queued < RT2560_TX_RING_COUNT - 1) { > sc->sc_flags &= ~RT2560_DATA_OACTIVE; > if (!(sc->sc_flags & (RT2560_DATA_OACTIVE|RT2560_PRIO_OACTIVE))) > Index: rt2661.c > =================================================================== > RCS file: /cvs/src/sys/dev/ic/rt2661.c,v > retrieving revision 1.66 > diff -u -p -r1.66 rt2661.c > --- rt2661.c 13 Jul 2012 10:08:15 -0000 1.66 > +++ rt2661.c 15 Jul 2012 17:07:44 -0000 > @@ -984,10 +984,9 @@ rt2661_tx_intr(struct rt2661_softc *sc) > txq->queued--; > if (++txq->stat >= txq->count) /* faster than % count */ > txq->stat = 0; > + sc->sc_tx_timer = 0; > } > > - if (sc->mgtq.queued == 0 && sc->txq[0].queued == 0) > - sc->sc_tx_timer = 0; > if (sc->mgtq.queued < RT2661_MGT_RING_COUNT && > sc->txq[0].queued < RT2661_TX_RING_COUNT - 1) { > if (sc->mgtq.queued < RT2661_MGT_RING_COUNT)