developer | 6bcdd6c | 2024-03-21 16:26:34 +0800 | [diff] [blame^] | 1 | From ef9482fa33cd00ed11ea3ac2fc968f01ba7b6644 Mon Sep 17 00:00:00 2001 |
| 2 | From: "fancy.liu" <fancy.liu@mediatek.com> |
| 3 | Date: Tue, 14 Nov 2023 10:13:24 +0800 |
| 4 | Subject: [PATCH 018/120] mtk: wifi: mt76: mt7996: ACS channel time too long on |
| 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 | |
| 19 | CR-Id: WCNCR00351054 |
| 20 | Signed-off-by: fancy.liu <fancy.liu@mediatek.com> |
| 21 | |
| 22 | Issue: |
| 23 | There's a chance that the channel time for duty channel is zero in ACS |
| 24 | scan. |
| 25 | |
| 26 | Root cause: |
| 27 | The chan_stat may be reset when restore to duty channel. |
| 28 | Mac80211 will notify to hostapd when scan done and then restore to duty |
| 29 | channel. |
| 30 | And mt76 will clear scan flag after restore done. |
| 31 | If hostapd get the chan_stat before channel_restore, will get the |
| 32 | correct channel time; |
| 33 | If hostapd get the chan_stat after channel_restore, will get zero |
| 34 | channel time; |
| 35 | |
| 36 | Solution: |
| 37 | When channel switch, will check the mac80211 scan state but not the mt76 scan flag. |
| 38 | Mac80211 scan state will be set in scanning, and will be reset after |
| 39 | scan done and before restore to duty channel. |
| 40 | |
| 41 | CR-Id: WCNCR00357653 |
| 42 | Signed-off-by: fancy.liu <fancy.liu@mediatek.com> |
| 43 | --- |
| 44 | mac80211.c | 3 ++- |
| 45 | 1 file changed, 2 insertions(+), 1 deletion(-) |
| 46 | |
| 47 | diff --git a/mac80211.c b/mac80211.c |
| 48 | index 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 | -- |
| 69 | 2.39.2 |
| 70 | |