developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1 | From d2d45d00e7644e62f366203a17924f0e2025853a Mon Sep 17 00:00:00 2001 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2 | From: "fancy.liu" <fancy.liu@mediatek.com> |
| 3 | Date: Tue, 14 Nov 2023 10:13:24 +0800 |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 4 | Subject: [PATCH 014/116] mtk: wifi: mt76: mt7996: ACS channel time too long on |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 5 | duty channel |
| 6 | |
| 7 | Step and issue: |
| 8 | 1. Set channel to 36 in hostapd config; |
| 9 | 2. Bootup; |
| 10 | 3. Enable ACS through UCI command and reload; |
| 11 | 4. Check hostapd log, channel 36 channel_time is much longer than other channels. |
| 12 | |
| 13 | Root cause: |
| 14 | The reset chan_stat condition missed duty channel. |
| 15 | |
| 16 | Solution: |
| 17 | When scan start, need to reset chan_stat in each channel switch. |
| 18 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 19 | Signed-off-by: fancy.liu <fancy.liu@mediatek.com> |
| 20 | |
| 21 | Issue: |
| 22 | There's a chance that the channel time for duty channel is zero in ACS |
| 23 | scan. |
| 24 | |
| 25 | Root cause: |
| 26 | The chan_stat may be reset when restore to duty channel. |
| 27 | Mac80211 will notify to hostapd when scan done and then restore to duty |
| 28 | channel. |
| 29 | And mt76 will clear scan flag after restore done. |
| 30 | If hostapd get the chan_stat before channel_restore, will get the |
| 31 | correct channel time; |
| 32 | If hostapd get the chan_stat after channel_restore, will get zero |
| 33 | channel time; |
| 34 | |
| 35 | Solution: |
| 36 | When channel switch, will check the mac80211 scan state but not the mt76 scan flag. |
| 37 | Mac80211 scan state will be set in scanning, and will be reset after |
| 38 | scan done and before restore to duty channel. |
| 39 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 40 | Signed-off-by: fancy.liu <fancy.liu@mediatek.com> |
| 41 | --- |
| 42 | mac80211.c | 3 ++- |
| 43 | 1 file changed, 2 insertions(+), 1 deletion(-) |
| 44 | |
| 45 | diff --git a/mac80211.c b/mac80211.c |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 46 | index e4675bf..d291caa 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 47 | --- a/mac80211.c |
| 48 | +++ b/mac80211.c |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 49 | @@ -928,6 +928,7 @@ void mt76_set_channel(struct mt76_phy *phy) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 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); |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 57 | @@ -942,7 +943,7 @@ void mt76_set_channel(struct mt76_phy *phy) |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 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 | -- |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 67 | 2.18.0 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 68 | |