> Date: Sun, 15 Jul 2012 19:57:26 +0200
> From: Stefan Sperling <[email protected]>
>
> On Fri, Jul 13, 2012 at 07:14:19PM +0200, Mark Kettenis wrote:
> > > Date: Fri, 13 Jul 2012 11:37:41 +0200
> > > From: Stefan Sperling <[email protected]>
> > >
> > > On Tue, Jul 10, 2012 at 05:56:29PM +0200, Stefan Sperling wrote:
> > > > Updated version that includes similar fixes for the rt2661 variants.
> > > >
> > > > This seems to help soekris-based ral APs that get stuck with the OACTIVE
> > > > flag set (see the flags line in "ifconfig ral0" output when the AP stops
> > > > responding) and then require "ifconfig ral0 down up" to recover.
> > > >
> > > > It would be great to get some more testing. Thanks!
> > >
> > > Anyone want to OK this?
> >
> > ok kettenis@
>
> 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.
Sorry, but that's not at all obvious to me.
> 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)