blob: b9c34b66ef0268f63be2c172ea233fce8ff8611d [file] [log] [blame]
developer6bcdd6c2024-03-21 16:26:34 +08001From ef9482fa33cd00ed11ea3ac2fc968f01ba7b6644 Mon Sep 17 00:00:00 2001
2From: "fancy.liu" <fancy.liu@mediatek.com>
3Date: Tue, 14 Nov 2023 10:13:24 +0800
4Subject: [PATCH 018/120] mtk: wifi: mt76: mt7996: ACS channel time too long on
5 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
19CR-Id: WCNCR00351054
20Signed-off-by: fancy.liu <fancy.liu@mediatek.com>
21
22Issue:
23There's a chance that the channel time for duty channel is zero in ACS
24scan.
25
26Root cause:
27The chan_stat may be reset when restore to duty channel.
28Mac80211 will notify to hostapd when scan done and then restore to duty
29channel.
30And mt76 will clear scan flag after restore done.
31If hostapd get the chan_stat before channel_restore, will get the
32correct channel time;
33If hostapd get the chan_stat after channel_restore, will get zero
34channel time;
35
36Solution:
37When channel switch, will check the mac80211 scan state but not the mt76 scan flag.
38Mac80211 scan state will be set in scanning, and will be reset after
39scan done and before restore to duty channel.
40
41CR-Id: WCNCR00357653
42Signed-off-by: fancy.liu <fancy.liu@mediatek.com>
43---
44 mac80211.c | 3 ++-
45 1 file changed, 2 insertions(+), 1 deletion(-)
46
47diff --git a/mac80211.c b/mac80211.c
48index 6f8b85d85..7a61d3c19 100644
49--- a/mac80211.c
50+++ b/mac80211.c
51@@ -928,6 +928,7 @@ void mt76_set_channel(struct mt76_phy *phy)
52 struct cfg80211_chan_def *chandef = &hw->conf.chandef;
53 bool offchannel = hw->conf.flags & IEEE80211_CONF_OFFCHANNEL;
54 int timeout = HZ / 5;
55+ unsigned long was_scanning = ieee80211_get_scanning(hw);
56
57 wait_event_timeout(dev->tx_wait, !mt76_has_tx_pending(phy), timeout);
58 mt76_update_survey(phy);
59@@ -942,7 +943,7 @@ void mt76_set_channel(struct mt76_phy *phy)
60 if (!offchannel)
61 phy->main_chan = chandef->chan;
62
63- if (chandef->chan != phy->main_chan)
64+ if (chandef->chan != phy->main_chan || was_scanning)
65 memset(phy->chan_state, 0, sizeof(*phy->chan_state));
66 }
67 EXPORT_SYMBOL_GPL(mt76_set_channel);
68--
692.39.2
70