blob: b6e976ae3cd1101ad9cf2b4661906e4b901f46d2 [file] [log] [blame]
developer23b6c0f2024-02-23 07:09:37 +08001From 618d7f6ad1b398bc21258559c80928febba3dfac Mon Sep 17 00:00:00 2001
developer5f4e6c32023-12-20 06:12:53 +08002From: "fancy.liu" <fancy.liu@mediatek.com>
3Date: Wed, 29 Nov 2023 13:51:13 +0800
developer23b6c0f2024-02-23 07:09:37 +08004Subject: [PATCH 34/37] mtk: mac80211: ACS channel time is reset by ch_restore
developer5f4e6c32023-12-20 06:12:53 +08005
6Issue:
7There's a chance that the channel time for duty channel is zero in ACS
8scan.
9
10Root cause:
11The chan_stat may be reset when restore to duty channel.
12Mac80211 will notify to hostapd when scan done and then restore to duty
13channel.
14And mt76 will clear scan flag after restore done.
15If hostapd get the chan_stat before channel_restore, will get the
16correct channel time;
17If hostapd get the chan_stat after channel_restore, will get zero
18channel time;
19
20Solution:
21When channel switch, will check the mac80211 scan state but not the mt76 scan flag.
22Mac80211 scan state will be set in scanning, and will be reset after
23scan done and before restore to duty channel.
24
25Signed-off-by: fancy.liu <fancy.liu@mediatek.com>
26---
27 include/net/mac80211.h | 7 +++++++
28 net/mac80211/util.c | 9 +++++++++
29 2 files changed, 16 insertions(+)
30
31diff --git a/include/net/mac80211.h b/include/net/mac80211.h
developer23b6c0f2024-02-23 07:09:37 +080032index ba8343f..453466a 100644
developer5f4e6c32023-12-20 06:12:53 +080033--- a/include/net/mac80211.h
34+++ b/include/net/mac80211.h
developer23b6c0f2024-02-23 07:09:37 +080035@@ -7485,4 +7485,11 @@ int ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links);
developer5f4e6c32023-12-20 06:12:53 +080036 void ieee80211_set_active_links_async(struct ieee80211_vif *vif,
37 u16 active_links);
38
39+/**
40+ * ieee80211_get_scanning - get scanning bitmask
41+ *
42+ * @hw: pointer as obtained from ieee80211_alloc_hw()
43+ */
44+unsigned long ieee80211_get_scanning(struct ieee80211_hw *hw);
45+
46 #endif /* MAC80211_H */
47diff --git a/net/mac80211/util.c b/net/mac80211/util.c
developer23b6c0f2024-02-23 07:09:37 +080048index fd82488..f0bb4e8 100644
developer5f4e6c32023-12-20 06:12:53 +080049--- a/net/mac80211/util.c
50+++ b/net/mac80211/util.c
developer23b6c0f2024-02-23 07:09:37 +080051@@ -5154,3 +5154,12 @@ void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id)
developer5f4e6c32023-12-20 06:12:53 +080052
53 *len_pos = elem_len;
54 }
55+
56+unsigned long ieee80211_get_scanning(struct ieee80211_hw *hw)
57+{
58+ struct ieee80211_local *local = hw_to_local(hw);
59+
60+ return local->scanning;
61+}
62+EXPORT_SYMBOL(ieee80211_get_scanning);
63+
64--
652.18.0
66