rtwn: ensure TX work isn't scheduled during reset / abort

Don't schedule work during reset / abort.  For USB NICs, work
must not be scheduled during a call to rtwn_usb_abort_xfers(),
as then it'll cause the call to usbd_transfer_drain() to hang.

This fixes a hang I've been seeing where the NIC hits a TX timeout
and then the reset/re-init path is called.  If data is scheduled
to be transmitted in that window, the call to usbd_transfer_drain()
would hang and require a hard reboot to recover.

Differential Revision: https://reviews.freebsd.org/D47479
This commit is contained in:
Adrian Chadd 2024-11-08 08:26:05 -08:00
parent 21d7ac8c79
commit 8838f3c32a

View File

@ -263,6 +263,11 @@ rtwn_start(struct rtwn_softc *sc)
struct mbuf *m;
RTWN_ASSERT_LOCKED(sc);
/* Ensure no work is scheduled during reset/teardown */
if ((sc->sc_flags & RTWN_RUNNING) == 0)
return;
while ((m = mbufq_dequeue(&sc->sc_snd)) != NULL) {
if (sc->qfullmsk != 0) {
mbufq_prepend(&sc->sc_snd, m);