developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 1 | From 2f32a2318ed334c191f9336560e20d75bc1332ca Mon Sep 17 00:00:00 2001 |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 2 | From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com> |
| 3 | Date: Wed, 8 Mar 2023 06:23:55 +0800 |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 4 | Subject: [PATCH 15/19] mac80211: mtk: track obss color bitmap |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 5 | |
| 6 | Track OBSS BSS color when receive their beacon. |
| 7 | |
| 8 | Adding 2 tracepoint for debug, usage: |
| 9 | echo 1 > /sys/kernel/debug/tracing/events/mac80211/bss_color_bitmap/enable |
| 10 | echo 1 > /sys/kernel/debug/tracing/events/mac80211/bss_color_collision/enable |
| 11 | --- |
| 12 | include/net/mac80211.h | 5 +++-- |
| 13 | net/mac80211/cfg.c | 4 ++-- |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 14 | net/mac80211/rx.c | 7 ++++++- |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 15 | net/mac80211/trace.h | 21 +++++++++++++++++++++ |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 16 | 4 files changed, 32 insertions(+), 5 deletions(-) |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 17 | |
| 18 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 19 | index 7d824de..ba19152 100644 |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 20 | --- a/include/net/mac80211.h |
| 21 | +++ b/include/net/mac80211.h |
| 22 | @@ -699,6 +699,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 | bool s1g; |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 30 | @@ -6881,7 +6882,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 31 | 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. |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 39 | @@ -6890,7 +6891,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, |
| 40 | * @gfp: allocation flags |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 41 | */ |
| 42 | void |
| 43 | -ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif, |
| 44 | +ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif, |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 45 | u64 color_bitmap, gfp_t gfp); |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 49 | index 2a173dd..81cfaa6 100644 |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 50 | --- a/net/mac80211/cfg.c |
| 51 | +++ b/net/mac80211/cfg.c |
| 52 | @@ -4435,7 +4435,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, |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 58 | u64 color_bitmap, gfp_t gfp) |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 59 | { |
| 60 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); |
| 61 | @@ -4445,7 +4445,7 @@ ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif, |
| 62 | |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 63 | cfg80211_obss_color_collision_notify(sdata->dev, color_bitmap, gfp); |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 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, |
| 70 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 71 | index 230c4b0..feb9f90 100644 |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 72 | --- a/net/mac80211/rx.c |
| 73 | +++ b/net/mac80211/rx.c |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 74 | @@ -3219,8 +3219,13 @@ ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx) |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 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, |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 85 | + ieee80211_obss_color_collision_notify(&rx->sdata->vif, |
developer | e0cba19 | 2023-07-28 07:08:38 +0800 | [diff] [blame] | 86 | BIT_ULL(color), |
| 87 | GFP_ATOMIC); |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 88 | } |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 89 | diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 90 | index c34067c..d15dadd 100644 |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 91 | --- a/net/mac80211/trace.h |
| 92 | +++ b/net/mac80211/trace.h |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 93 | @@ -2908,6 +2908,27 @@ DEFINE_EVENT(sta_event, drv_net_fill_forward_path, |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 94 | ); |
| 95 | #endif |
| 96 | |
| 97 | +TRACE_EVENT(bss_color_bitmap, |
| 98 | + TP_PROTO(u8 color, |
| 99 | + u64 color_bitmap), |
| 100 | + |
| 101 | + TP_ARGS(color, color_bitmap), |
| 102 | + |
| 103 | + TP_STRUCT__entry( |
| 104 | + __field(u8, color) |
| 105 | + __field(u64, color_bitmap) |
| 106 | + ), |
| 107 | + |
| 108 | + TP_fast_assign( |
| 109 | + __entry->color = color; |
| 110 | + __entry->color_bitmap = color_bitmap; |
| 111 | + ), |
| 112 | + |
| 113 | + TP_printk( |
| 114 | + "color=%u color_bitmap=0x%llx", __entry->color, __entry->color_bitmap |
| 115 | + ) |
| 116 | +); |
| 117 | + |
| 118 | #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ |
| 119 | |
| 120 | #undef TRACE_INCLUDE_PATH |
| 121 | -- |
developer | ed7222c | 2023-04-14 07:19:52 +0800 | [diff] [blame] | 122 | 2.18.0 |
developer | 14bd31c | 2023-03-08 06:38:53 +0800 | [diff] [blame] | 123 | |