diff options
author | Adrian Chadd <adrian@FreeBSD.org> | 2024-11-08 16:26:05 +0000 |
---|---|---|
committer | Adrian Chadd <adrian@FreeBSD.org> | 2024-11-08 16:26:05 +0000 |
commit | 8838f3c32ac0ebcb8b20863f8c455375039a505e (patch) | |
tree | e1d3cc9c4dd90f1d64ef93f7830304ff57e74fa4 | |
parent | 21d7ac8c79a34cf3b7205d0c32014ee39f1f28ab (diff) |
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
-rw-r--r-- | sys/dev/rtwn/if_rtwn_tx.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/dev/rtwn/if_rtwn_tx.c b/sys/dev/rtwn/if_rtwn_tx.c index f5e97933b314..bf45d14f7edc 100644 --- a/sys/dev/rtwn/if_rtwn_tx.c +++ b/sys/dev/rtwn/if_rtwn_tx.c @@ -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); |