blob: 3562dff0b0f622437ca88b1f7f2efe4598eb5a67 [file] [log] [blame]
developer8eb72a32023-03-30 08:32:07 +08001From 3b4fed31dabb63ad6e1c9d29e18e90be228accd9 Mon Sep 17 00:00:00 2001
developerc9eaf902023-03-13 05:45:10 +08002From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
3Date: Mon, 13 Mar 2023 05:23:37 +0800
developer8eb72a32023-03-30 08:32:07 +08004Subject: [PATCH 14/15] mac80211: mtk: track obss color bitmap
developerc9eaf902023-03-13 05:45:10 +08005
6Track OBSS BSS color when receive their beacon.
7
8Adding 2 tracepoint for debug, usage:
9echo 1 > /sys/kernel/debug/tracing/events/mac80211/bss_color_bitmap/enable
10echo 1 > /sys/kernel/debug/tracing/events/mac80211/bss_color_collision/enable
11---
12 include/net/mac80211.h | 5 +++--
13 net/mac80211/cfg.c | 4 ++--
14 net/mac80211/rx.c | 9 +++++++--
15 net/mac80211/trace.h | 21 +++++++++++++++++++++
16 4 files changed, 33 insertions(+), 6 deletions(-)
17
18diff --git a/include/net/mac80211.h b/include/net/mac80211.h
developer8eb72a32023-03-30 08:32:07 +080019index cc02639..83bbf70 100644
developerc9eaf902023-03-13 05:45:10 +080020--- a/include/net/mac80211.h
21+++ b/include/net/mac80211.h
22@@ -729,6 +729,7 @@ struct ieee80211_bss_conf {
23 } he_oper;
24 struct ieee80211_he_obss_pd he_obss_pd;
25 struct cfg80211_he_bss_color he_bss_color;
26+ u64 used_color_bitmap;
27 struct ieee80211_fils_discovery fils_discovery;
28 u32 unsol_bcast_probe_resp_interval;
29 struct cfg80211_bitrate_mask beacon_tx_rate;
developer6ca17562023-03-24 17:07:44 +080030@@ -7248,7 +7249,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
developerc9eaf902023-03-13 05:45:10 +080031 struct ieee80211_vif *vif);
32
33 /**
34- * ieeee80211_obss_color_collision_notify - notify userland about a BSS color
35+ * ieee80211_obss_color_collision_notify - notify userland about a BSS color
36 * collision.
37 *
38 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
developer6ca17562023-03-24 17:07:44 +080039@@ -7257,7 +7258,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
developerc9eaf902023-03-13 05:45:10 +080040 * @gfp: allocation flags
41 */
42 void
43-ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
44+ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
45 u64 color_bitmap, gfp_t gfp);
46
47 /**
48diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
49index 3e35433..5c9dda1 100644
50--- a/net/mac80211/cfg.c
51+++ b/net/mac80211/cfg.c
52@@ -4698,7 +4698,7 @@ void ieee80211_color_change_finish(struct ieee80211_vif *vif)
53 EXPORT_SYMBOL_GPL(ieee80211_color_change_finish);
54
55 void
56-ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
57+ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
58 u64 color_bitmap, gfp_t gfp)
59 {
60 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
61@@ -4708,7 +4708,7 @@ ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
62
63 cfg80211_obss_color_collision_notify(sdata->dev, color_bitmap, gfp);
64 }
65-EXPORT_SYMBOL_GPL(ieeee80211_obss_color_collision_notify);
66+EXPORT_SYMBOL_GPL(ieee80211_obss_color_collision_notify);
67
68 static int
69 ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev,
70diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
developer8eb72a32023-03-30 08:32:07 +080071index 74cf1b6..bc5b471 100644
developerc9eaf902023-03-13 05:45:10 +080072--- a/net/mac80211/rx.c
73+++ b/net/mac80211/rx.c
74@@ -3338,9 +3338,14 @@ ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
75
76 color = le32_get_bits(he_oper->he_oper_params,
77 IEEE80211_HE_OPERATION_BSS_COLOR_MASK);
78+
79+ bss_conf->used_color_bitmap |= BIT_ULL(color);
80+
81+ trace_bss_color_bitmap(color, bss_conf->used_color_bitmap);
82+
83 if (color == bss_conf->he_bss_color.color)
84- ieeee80211_obss_color_collision_notify(&rx->sdata->vif,
85- BIT_ULL(color),
86+ ieee80211_obss_color_collision_notify(&rx->sdata->vif,
87+ bss_conf->used_color_bitmap,
88 GFP_ATOMIC);
89 }
90 }
91diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
developer8eb72a32023-03-30 08:32:07 +080092index e0ccf5f..f005207 100644
developerc9eaf902023-03-13 05:45:10 +080093--- a/net/mac80211/trace.h
94+++ b/net/mac80211/trace.h
developer6ca17562023-03-24 17:07:44 +080095@@ -3051,6 +3051,27 @@ TRACE_EVENT(stop_queue,
developerc9eaf902023-03-13 05:45:10 +080096 )
97 );
98
99+TRACE_EVENT(bss_color_bitmap,
100+ TP_PROTO(u8 color,
101+ u64 color_bitmap),
102+
103+ TP_ARGS(color, color_bitmap),
104+
105+ TP_STRUCT__entry(
106+ __field(u8, color)
107+ __field(u64, color_bitmap)
108+ ),
109+
110+ TP_fast_assign(
111+ __entry->color = color;
112+ __entry->color_bitmap = color_bitmap;
113+ ),
114+
115+ TP_printk(
116+ "color=%u color_bitmap=0x%llx", __entry->color, __entry->color_bitmap
117+ )
118+);
119+
120 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
121
122 #undef TRACE_INCLUDE_PATH
123--
developer8eb72a32023-03-30 08:32:07 +08001242.18.0
developerc9eaf902023-03-13 05:45:10 +0800125