developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame] | 1 | From e6a8b61c776db565c532515af002156da38f2f48 Mon Sep 17 00:00:00 2001 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 2 | From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| 3 | Date: Sat, 18 Nov 2023 07:36:45 +0800 |
developer | a20cdc2 | 2024-05-31 18:57:31 +0800 | [diff] [blame] | 4 | Subject: [PATCH 06/21] wifi: mt76: ACS channel time too long on duty channel |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 5 | |
| 6 | Issue: |
| 7 | There's a chance that the channel time for duty channel is zero in ACS |
| 8 | scan. |
| 9 | |
| 10 | Root cause: |
| 11 | The chan_stat may be reset when restore to duty channel. |
| 12 | Mac80211 will notify to hostapd when scan done and then restore to duty |
| 13 | channel. |
| 14 | And mt76 will clear scan flag after restore done. |
| 15 | If hostapd get the chan_stat before channel_restore, will get the |
| 16 | correct channel time; |
| 17 | If hostapd get the chan_stat after channel_restore, will get zero |
| 18 | channel time; |
| 19 | |
| 20 | Solution: |
| 21 | When channel switch, will check the mac80211 scan state but not the mt76 scan flag. |
| 22 | Mac80211 scan state will be set in scanning, and will be reset after |
| 23 | scan done and before restore to duty channel. |
| 24 | --- |
| 25 | mac80211.c | 3 ++- |
| 26 | 1 file changed, 2 insertions(+), 1 deletion(-) |
| 27 | |
| 28 | diff --git a/mac80211.c b/mac80211.c |
developer | dc9eeae | 2024-04-08 14:36:46 +0800 | [diff] [blame] | 29 | index e7b763b..bc20f60 100644 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 30 | --- a/mac80211.c |
| 31 | +++ b/mac80211.c |
developer | dc9eeae | 2024-04-08 14:36:46 +0800 | [diff] [blame] | 32 | @@ -927,6 +927,7 @@ void mt76_set_channel(struct mt76_phy *phy) |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 33 | struct cfg80211_chan_def *chandef = &hw->conf.chandef; |
| 34 | bool offchannel = hw->conf.flags & IEEE80211_CONF_OFFCHANNEL; |
| 35 | int timeout = HZ / 5; |
| 36 | + unsigned long was_scanning = ieee80211_get_scanning(hw); |
| 37 | |
| 38 | wait_event_timeout(dev->tx_wait, !mt76_has_tx_pending(phy), timeout); |
| 39 | mt76_update_survey(phy); |
developer | dc9eeae | 2024-04-08 14:36:46 +0800 | [diff] [blame] | 40 | @@ -941,7 +942,7 @@ void mt76_set_channel(struct mt76_phy *phy) |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 41 | if (!offchannel) |
| 42 | phy->main_chan = chandef->chan; |
| 43 | |
| 44 | - if (chandef->chan != phy->main_chan) |
| 45 | + if (chandef->chan != phy->main_chan || was_scanning) |
| 46 | memset(phy->chan_state, 0, sizeof(*phy->chan_state)); |
| 47 | } |
| 48 | EXPORT_SYMBOL_GPL(mt76_set_channel); |
| 49 | -- |
| 50 | 2.18.0 |
| 51 | |