From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 11/20] wifi: mt76: mt7915: hold the device mutex in the station and regd updates
Date: Tue, 24 Nov 2026 09:43:00 +0100 [thread overview]
Message-ID: <20261124084309.1981968-11-nbd@nbd.name> (raw)
In-Reply-To: <20261124084309.1981968-1-nbd@nbd.name>
The sta_set_4addr and sta_set_decap_offload ops and
mt7915_regd_notifier() send their MCU commands without dev->mt76.mutex.
The L1 SER work holds the mutex while MT76_MCU_RESET keeps commands from
the firmware. An update in that window is thus lost: the header
translation or the radar detector state.
Hold the mutex across the updates, as mt7996 does in its station ops.
mt7915_set_radar_background() already holds it for the background
chain. The callers then wait for the end of the L1 SER.
Fixes: e57b7901469f ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Fixes: e151d71e503d ("mt76: mt7915: add encap offload for 4-address mode stations")
Fixes: 90e3abf07c80 ("mt76: mt7915: add support for rx decapsulation offload")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
drivers/net/wireless/mediatek/mt76/mt7915/init.c | 4 ++++
drivers/net/wireless/mediatek/mt76/mt7915/main.c | 16 ++++++++++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 1bb2a938c354..fb92a0b2e4ab 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -383,6 +383,8 @@ mt7915_regd_notifier(struct wiphy *wiphy,
struct mt76_phy *mphy = hw->priv;
struct mt7915_phy *phy = mphy->priv;
+ mutex_lock(&dev->mt76.mutex);
+
memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2));
dev->mt76.region = request->dfs_region;
@@ -393,6 +395,8 @@ mt7915_regd_notifier(struct wiphy *wiphy,
mphy->dfs_state = MT_DFS_STATE_UNKNOWN;
mt7915_dfs_init_radar_detector(phy);
+
+ mutex_unlock(&dev->mt76.mutex);
}
static void
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index edbb921e63bc..47796e0fa506 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -1294,15 +1294,17 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
+ mutex_lock(&dev->mt76.mutex);
+
if (enabled)
set_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
else
clear_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
- if (!msta->wcid.sta)
- return;
+ if (msta->wcid.sta)
+ mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
- mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
+ mutex_unlock(&dev->mt76.mutex);
}
static void mt7915_sta_set_decap_offload(struct ieee80211_hw *hw,
@@ -1313,15 +1315,17 @@ static void mt7915_sta_set_decap_offload(struct ieee80211_hw *hw,
struct mt7915_dev *dev = mt7915_hw_dev(hw);
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
+ mutex_lock(&dev->mt76.mutex);
+
if (enabled)
set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);
else
clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);
- if (!msta->wcid.sta)
- return;
+ if (msta->wcid.sta)
+ mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
- mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
+ mutex_unlock(&dev->mt76.mutex);
}
static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
--
2.47.3
next prev parent reply other threads:[~2026-11-24 8:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 8:42 [PATCH mt76-next 01/20] wifi: mt76: mt7915: dump the firmware memory of mt7916 Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 02/20] wifi: mt76: mt7915: set the LED GPIO mux " Felix Fietkau
2026-11-24 8:53 ` Lorenzo Bianconi
2026-11-24 8:42 ` [PATCH mt76-next 03/20] wifi: mt76: fail an MCU command started during an MCU reset Felix Fietkau
2026-11-24 8:54 ` Lorenzo Bianconi
2026-11-24 8:42 ` [PATCH mt76-next 04/20] wifi: mt76: mark an MCU command that only reads Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 05/20] wifi: mt76: retry only an MCU command that reads Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 06/20] wifi: mt76: report an MCU command whose outcome is unknown Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 07/20] wifi: mt76: mt7996: mark the MCU commands that only read Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 08/20] wifi: mt76: mt7996: reset after an MCU reset lost a state command Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 09/20] wifi: mt76: mt7915: mark the MCU commands that only read Felix Fietkau
2026-11-24 8:42 ` [PATCH mt76-next 10/20] wifi: mt76: mt7915: hold the device mutex in the rate control work Felix Fietkau
2026-11-24 8:56 ` Lorenzo Bianconi
2026-11-24 8:43 ` Felix Fietkau [this message]
2026-11-24 8:58 ` [PATCH mt76-next 11/20] wifi: mt76: mt7915: hold the device mutex in the station and regd updates Lorenzo Bianconi
2026-11-24 8:43 ` [PATCH mt76-next 12/20] wifi: mt76: mt7915: reset after an MCU reset lost a state command Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 13/20] wifi: mt76: mt7996: clear the PS state of stations at a reset Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 14/20] wifi: mt76: mt7996: apply the PS sync bitmap to MLD stations alone Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 15/20] wifi: mt76: mt7996: keep the TWT state out of the PS flag Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 16/20] wifi: mt76: mt7996: read the TSF twice against the firmware's latch Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 17/20] wifi: mt76: mt7996: check a TSF write " Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 18/20] wifi: mt76: mt7915: keep the TWT state out of the PS flag Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 19/20] wifi: mt76: mt7915: clear the PS flag of a station at a reset Felix Fietkau
2026-11-24 8:43 ` [PATCH mt76-next 20/20] wifi: mt76: mt7996: set the default link again when a link is reused Felix Fietkau
2026-11-24 8:53 ` [PATCH mt76-next 01/20] wifi: mt76: mt7915: dump the firmware memory of mt7916 Lorenzo Bianconi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124084309.1981968-11-nbd@nbd.name \
--to=nbd@nbd.name \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox