| From e86b89d026fa963ff6c789747b9b373884956157 Mon Sep 17 00:00:00 2001 |
| From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| Date: Fri, 1 Dec 2023 08:48:35 +0800 |
| Subject: [PATCH] mac80211: mtk: ACS channel time is reset by ch_restore |
| |
| Issue: |
| There's a chance that the channel time for duty channel is zero in ACS |
| scan. |
| |
| Root cause: |
| The chan_stat may be reset when restore to duty channel. |
| Mac80211 will notify to hostapd when scan done and then restore to duty |
| channel. |
| And mt76 will clear scan flag after restore done. |
| If hostapd get the chan_stat before channel_restore, will get the |
| correct channel time; |
| If hostapd get the chan_stat after channel_restore, will get zero |
| channel time; |
| |
| Solution: |
| When channel switch, will check the mac80211 scan state but not the mt76 scan flag. |
| Mac80211 scan state will be set in scanning, and will be reset after |
| scan done and before restore to duty channel. |
| |
| Signed-off-by: fancy.liu <fancy.liu@mediatek.com> |
| --- |
| include/net/mac80211.h | 6 ++++++ |
| net/mac80211/util.c | 8 ++++++++ |
| 2 files changed, 14 insertions(+) |
| |
| diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
| index 91affd5..2da55d8 100644 |
| --- a/include/net/mac80211.h |
| +++ b/include/net/mac80211.h |
| @@ -6929,4 +6929,10 @@ static inline bool ieee80211_is_tx_data(struct sk_buff *skb) |
| ieee80211_is_data(hdr->frame_control); |
| } |
| |
| +/** |
| + * ieee80211_get_scanning - get scanning bitmask |
| + * |
| + * @hw: pointer as obtained from ieee80211_alloc_hw() |
| + */ |
| +unsigned long ieee80211_get_scanning(struct ieee80211_hw *hw); |
| #endif /* MAC80211_H */ |
| diff --git a/net/mac80211/util.c b/net/mac80211/util.c |
| index 8d36b05..26cd627 100644 |
| --- a/net/mac80211/util.c |
| +++ b/net/mac80211/util.c |
| @@ -4627,3 +4627,11 @@ u16 ieee80211_encode_usf(int listen_interval) |
| |
| return (u16) listen_interval; |
| } |
| + |
| +unsigned long ieee80211_get_scanning(struct ieee80211_hw *hw) |
| +{ |
| + struct ieee80211_local *local = hw_to_local(hw); |
| + |
| + return local->scanning; |
| +} |
| +EXPORT_SYMBOL(ieee80211_get_scanning); |
| \ No newline at end of file |
| -- |
| 2.18.0 |
| |