aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2025-01-15 22:50:01 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2025-01-15 23:36:00 +0000
commit054c5ddf587a7a0c430cf64dbf100b718eafdcc5 (patch)
treeb712dbfd78847eb00f4a1645adc6cdc7a31ce9e9
parent52f7eb31ae84b0a02cd79c857c3201cb7b65c00f (diff)
net80211: add IEEE80211_IS_LOCKED()
When trying to sort out a teardown locking problem (downcall in the driver can sleep) I found that the fan-out tree was getting too big to fix net80211 locking per-se for this while working on entirely different problems. Add IEEE80211_IS_LOCKED() so the driver can check and un-/re-lock as necessary (as we do in other cases already) to avoid panics on debug kernels left and right. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D48475
-rw-r--r--sys/net80211/ieee80211_freebsd.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h
index b58c55cc7652..ed913f7b3661 100644
--- a/sys/net80211/ieee80211_freebsd.h
+++ b/sys/net80211/ieee80211_freebsd.h
@@ -73,6 +73,8 @@ typedef struct {
mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED)
#define IEEE80211_UNLOCK_ASSERT(_ic) \
mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED)
+#define IEEE80211_IS_LOCKED(_ic) \
+ mtx_owned(IEEE80211_LOCK_OBJ(_ic))
/*
* Transmit lock.