blob: 279ccf255d4cb419b93b2e61d26ef82b2ee683e5 [file] [log] [blame]
developer1f55fcf2024-10-17 14:52:33 +08001From 5525cb05733de8ff8cd557ceeee088a586f9b12b Mon Sep 17 00:00:00 2001
developer66e89bc2024-04-23 14:50:01 +08002From: "fancy.liu" <fancy.liu@mediatek.com>
3Date: Tue, 14 Nov 2023 10:13:24 +0800
developer1f55fcf2024-10-17 14:52:33 +08004Subject: [PATCH 008/193] mtk: mt76: mt7996: ACS channel time too long on duty
developer05f3b2b2024-08-19 19:17:34 +08005 channel
developer66e89bc2024-04-23 14:50:01 +08006
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
developer66e89bc2024-04-23 14:50:01 +080019Issue:
20There's a chance that the channel time for duty channel is zero in ACS
21scan.
22
23Root cause:
24The chan_stat may be reset when restore to duty channel.
25Mac80211 will notify to hostapd when scan done and then restore to duty
26channel.
27And mt76 will clear scan flag after restore done.
28If hostapd get the chan_stat before channel_restore, will get the
29correct channel time;
30If hostapd get the chan_stat after channel_restore, will get zero
31channel time;
32
33Solution:
34When channel switch, will check the mac80211 scan state but not the mt76 scan flag.
35Mac80211 scan state will be set in scanning, and will be reset after
36scan done and before restore to duty channel.
37
developer66e89bc2024-04-23 14:50:01 +080038Signed-off-by: fancy.liu <fancy.liu@mediatek.com>
39---
40 mac80211.c | 3 ++-
41 1 file changed, 2 insertions(+), 1 deletion(-)
42
43diff --git a/mac80211.c b/mac80211.c
developer1f55fcf2024-10-17 14:52:33 +080044index 303f438..dc1ef40 100644
developer66e89bc2024-04-23 14:50:01 +080045--- a/mac80211.c
46+++ b/mac80211.c
developerd0c89452024-10-11 16:53:27 +080047@@ -927,6 +927,7 @@ int mt76_set_channel(struct mt76_phy *phy, struct cfg80211_chan_def *chandef,
48 struct mt76_dev *dev = phy->dev;
developer66e89bc2024-04-23 14:50:01 +080049 int timeout = HZ / 5;
developerd0c89452024-10-11 16:53:27 +080050 int ret;
51+ unsigned long was_scanning = ieee80211_get_scanning(phy->hw);
developer66e89bc2024-04-23 14:50:01 +080052
developerd0c89452024-10-11 16:53:27 +080053 cancel_delayed_work_sync(&phy->mac_work);
54
55@@ -948,7 +949,7 @@ int mt76_set_channel(struct mt76_phy *phy, struct cfg80211_chan_def *chandef,
developer66e89bc2024-04-23 14:50:01 +080056 if (!offchannel)
57 phy->main_chan = chandef->chan;
58
59- if (chandef->chan != phy->main_chan)
60+ if (chandef->chan != phy->main_chan || was_scanning)
61 memset(phy->chan_state, 0, sizeof(*phy->chan_state));
developerd0c89452024-10-11 16:53:27 +080062 mt76_worker_enable(&dev->tx_worker);
63
developer66e89bc2024-04-23 14:50:01 +080064--
developerd0c89452024-10-11 16:53:27 +0800652.45.2
developer66e89bc2024-04-23 14:50:01 +080066