Date: Wed, 11 Jun 2025 09:14:25 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b2420591ff02 - stable/14 - LinuxKPI: 802.11: improve queue locking Message-ID: <202506110914.55B9EPXe062274@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b2420591ff02b9ada66ff64b2d030a5198d6ea3c commit b2420591ff02b9ada66ff64b2d030a5198d6ea3c Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2025-06-05 22:02:01 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2025-06-10 23:40:32 +0000 LinuxKPI: 802.11: improve queue locking Introduce an internal lkpi_ieee80211_wake_queues_locked() function that can be used from context holding the wiphy lock. Make linuxkpi_ieee80211_wake_queues() a wrapper with locking around this. Equally apply the wiphy lock to linuxkpi_ieee80211_wake_queue(). In lkpi_ieee80211_wake_queues() only wakeup the driver if the queue is not empty; otherwise weird sideeffects can happen with some drivers. Sponsored by: The FreeBSD Foundation (cherry picked from commit bc24342d96aa816b448bec4d32b1f5e4a5793886) --- sys/compat/linuxkpi/common/src/linux_80211.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index ba6c73b99c32..be671a2ed7a3 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -7395,6 +7395,7 @@ linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct lkpi_vif *lvif; struct sk_buff *skb; + IMPROVE("wiphy_lock? or assert?"); skb = NULL; ltxq = TXQ_TO_LTXQ(txq); ltxq->seen_dequeue = true; @@ -7897,8 +7898,8 @@ lkpi_ieee80211_wake_queues(struct ieee80211_hw *hw, int hwq) ltxq->stopped = false; - /* XXX-BZ see when this explodes with all the locking. taskq? */ - lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tid]); + if (!skb_queue_empty(<xq->skbq)) + lkpi_80211_mo_wake_tx_queue(hw, sta->txq[tid]); } } rcu_read_unlock(); @@ -7908,8 +7909,8 @@ lkpi_ieee80211_wake_queues(struct ieee80211_hw *hw, int hwq) LKPI_80211_LHW_LVIF_UNLOCK(lhw); } -void -linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *hw) +static void +lkpi_ieee80211_wake_queues_locked(struct ieee80211_hw *hw) { int i; @@ -7918,6 +7919,14 @@ linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *hw) lkpi_ieee80211_wake_queues(hw, i); } +void +linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *hw) +{ + wiphy_lock(hw->wiphy); + lkpi_ieee80211_wake_queues_locked(hw); + wiphy_unlock(hw->wiphy); +} + void linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum) { @@ -7925,7 +7934,9 @@ linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum) KASSERT(qnum < hw->queues, ("%s: qnum %d >= hw->queues %d, hw %p\n", __func__, qnum, hw->queues, hw)); + wiphy_lock(hw->wiphy); lkpi_ieee80211_wake_queues(hw, qnum); + wiphy_unlock(hw->wiphy); } /* This is just hardware queues. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202506110914.55B9EPXe062274>
