git: 8838f3c32ac0 - main - rtwn: ensure TX work isn't scheduled during reset / abort
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Nov 2024 16:26:15 UTC
The branch main has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=8838f3c32ac0ebcb8b20863f8c455375039a505e
commit 8838f3c32ac0ebcb8b20863f8c455375039a505e
Author: Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2024-11-08 16:26:05 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2024-11-08 16:26:05 +0000
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
---
sys/dev/rtwn/if_rtwn_tx.c | 5 +++++
1 file changed, 5 insertions(+)
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);