developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 1 | From 49c81a4e339f9646fb32faa00935e88ea8c91ec5 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 | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 4 | Subject: [PATCH 008/223] mtk: mt76: mt7996: ACS channel time too long on duty |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 5 | channel |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 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 | Issue: |
| 20 | There's a chance that the channel time for duty channel is zero in ACS |
| 21 | scan. |
| 22 | |
| 23 | Root cause: |
| 24 | The chan_stat may be reset when restore to duty channel. |
| 25 | Mac80211 will notify to hostapd when scan done and then restore to duty |
| 26 | channel. |
| 27 | And mt76 will clear scan flag after restore done. |
| 28 | If hostapd get the chan_stat before channel_restore, will get the |
| 29 | correct channel time; |
| 30 | If hostapd get the chan_stat after channel_restore, will get zero |
| 31 | channel time; |
| 32 | |
| 33 | Solution: |
| 34 | When channel switch, will check the mac80211 scan state but not the mt76 scan flag. |
| 35 | Mac80211 scan state will be set in scanning, and will be reset after |
| 36 | scan done and before restore to duty channel. |
| 37 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 38 | Signed-off-by: fancy.liu <fancy.liu@mediatek.com> |
| 39 | --- |
| 40 | mac80211.c | 3 ++- |
| 41 | 1 file changed, 2 insertions(+), 1 deletion(-) |
| 42 | |
| 43 | diff --git a/mac80211.c b/mac80211.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 44 | index 303f4385..dc1ef40d 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 45 | --- a/mac80211.c |
| 46 | +++ b/mac80211.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 47 | @@ -927,6 +927,7 @@ int mt76_set_channel(struct mt76_phy *phy, struct cfg80211_chan_def *chandef, |
| 48 | struct mt76_dev *dev = phy->dev; |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 49 | int timeout = HZ / 5; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 50 | int ret; |
| 51 | + unsigned long was_scanning = ieee80211_get_scanning(phy->hw); |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 52 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 53 | 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, |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 56 | 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)); |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 62 | mt76_worker_enable(&dev->tx_worker); |
| 63 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 64 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame] | 65 | 2.45.2 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 66 | |