blob: 0959871ceb8884cd068c53832c3685980a6bca76 [file] [log] [blame]
developer43a264f2024-03-26 14:09:54 +08001From 35f210176257373e9b71821ca3246b10f1bb1b2a Mon Sep 17 00:00:00 2001
developerd243af02023-12-21 14:49:33 +08002From: "fancy.liu" <fancy.liu@mediatek.com>
3Date: Tue, 14 Nov 2023 10:13:24 +0800
developer43a264f2024-03-26 14:09:54 +08004Subject: [PATCH 12/17] mtk: wifi: mt76: mt7996: ACS channel time too long on
developerd243af02023-12-21 14:49:33 +08005 duty channel
6
7Step and issue:
81. Set channel to 36 in hostapd config;
92. Bootup;
103. Enable ACS through UCI command and reload;
114. Check hostapd log, channel 36 channel_time is much longer than other channels.
12
13Root cause:
14The reset chan_stat condition missed duty channel.
15
16Solution:
17When scan start, need to reset chan_stat in each channel switch.
18
19Signed-off-by: fancy.liu <fancy.liu@mediatek.com>
20
21Issue:
22There's a chance that the channel time for duty channel is zero in ACS
23scan.
24
25Root cause:
26The chan_stat may be reset when restore to duty channel.
27Mac80211 will notify to hostapd when scan done and then restore to duty
28channel.
29And mt76 will clear scan flag after restore done.
30If hostapd get the chan_stat before channel_restore, will get the
31correct channel time;
32If hostapd get the chan_stat after channel_restore, will get zero
33channel time;
34
35Solution:
36When channel switch, will check the mac80211 scan state but not the mt76 scan flag.
37Mac80211 scan state will be set in scanning, and will be reset after
38scan done and before restore to duty channel.
39
40Signed-off-by: fancy.liu <fancy.liu@mediatek.com>
41---
42 mac80211.c | 3 ++-
43 1 file changed, 2 insertions(+), 1 deletion(-)
44
45diff --git a/mac80211.c b/mac80211.c
developerebda9012024-02-22 13:42:45 +080046index b603d40c..6e8ac6f4 100644
developerd243af02023-12-21 14:49:33 +080047--- a/mac80211.c
48+++ b/mac80211.c
49@@ -928,6 +928,7 @@ void mt76_set_channel(struct mt76_phy *phy)
50 struct cfg80211_chan_def *chandef = &hw->conf.chandef;
51 bool offchannel = hw->conf.flags & IEEE80211_CONF_OFFCHANNEL;
52 int timeout = HZ / 5;
53+ unsigned long was_scanning = ieee80211_get_scanning(hw);
54
55 wait_event_timeout(dev->tx_wait, !mt76_has_tx_pending(phy), timeout);
56 mt76_update_survey(phy);
57@@ -942,7 +943,7 @@ void mt76_set_channel(struct mt76_phy *phy)
58 if (!offchannel)
59 phy->main_chan = chandef->chan;
60
61- if (chandef->chan != phy->main_chan)
62+ if (chandef->chan != phy->main_chan || was_scanning)
63 memset(phy->chan_state, 0, sizeof(*phy->chan_state));
64 }
65 EXPORT_SYMBOL_GPL(mt76_set_channel);
66--
672.18.0
68