blob: 785d3ff930047dd2a6563295980b537b86694bc7 [file] [log] [blame]
From 3300d7dc7d506804664567b0039acebd4b351931 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Sat, 18 Nov 2023 07:36:45 +0800
Subject: [PATCH 09/76] wifi: mt76: ACS channel time too long on duty channel
Issue:
There's a chance that the channel time for duty channel is zero in ACS
scan.
Root cause:
The chan_stat may be reset when restore to duty channel.
Mac80211 will notify to hostapd when scan done and then restore to duty
channel.
And mt76 will clear scan flag after restore done.
If hostapd get the chan_stat before channel_restore, will get the
correct channel time;
If hostapd get the chan_stat after channel_restore, will get zero
channel time;
Solution:
When channel switch, will check the mac80211 scan state but not the mt76 scan flag.
Mac80211 scan state will be set in scanning, and will be reset after
scan done and before restore to duty channel.
---
mac80211.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mac80211.c b/mac80211.c
index cc9e9ff..6c5b4f5 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -928,6 +928,7 @@ void mt76_set_channel(struct mt76_phy *phy)
struct cfg80211_chan_def *chandef = &hw->conf.chandef;
bool offchannel = hw->conf.flags & IEEE80211_CONF_OFFCHANNEL;
int timeout = HZ / 5;
+ unsigned long was_scanning = ieee80211_get_scanning(hw);
wait_event_timeout(dev->tx_wait, !mt76_has_tx_pending(phy), timeout);
mt76_update_survey(phy);
@@ -942,7 +943,7 @@ void mt76_set_channel(struct mt76_phy *phy)
if (!offchannel)
phy->main_chan = chandef->chan;
- if (chandef->chan != phy->main_chan)
+ if (chandef->chan != phy->main_chan || was_scanning)
memset(phy->chan_state, 0, sizeof(*phy->chan_state));
}
EXPORT_SYMBOL_GPL(mt76_set_channel);
--
2.18.0