developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 1 | From 529ea5156b39398b24801eabcb3f1531ca53d3ca Mon Sep 17 00:00:00 2001 |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 2 | From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com> |
| 3 | Date: Mon, 13 Mar 2023 05:23:37 +0800 |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 12/21] mac80211: mtk: track obss color bitmap |
developer | c9eaf90 | 2023-03-13 05:45:10 +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 | --- |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 12 | include/net/mac80211.h | 1 + |
| 13 | net/mac80211/rx.c | 6 +++++- |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 14 | net/mac80211/trace.h | 21 +++++++++++++++++++++ |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 15 | 3 files changed, 27 insertions(+), 1 deletion(-) |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 16 | |
| 17 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 18 | index 2c282e6..b90e828 100644 |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 19 | --- a/include/net/mac80211.h |
| 20 | +++ b/include/net/mac80211.h |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 21 | @@ -744,6 +744,7 @@ struct ieee80211_bss_conf { |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 22 | } he_oper; |
| 23 | struct ieee80211_he_obss_pd he_obss_pd; |
| 24 | struct cfg80211_he_bss_color he_bss_color; |
| 25 | + u64 used_color_bitmap; |
| 26 | struct ieee80211_fils_discovery fils_discovery; |
| 27 | u32 unsol_bcast_probe_resp_interval; |
| 28 | struct cfg80211_bitrate_mask beacon_tx_rate; |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 29 | diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 30 | index 56abe67..cf41b93 100644 |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 31 | --- a/net/mac80211/rx.c |
| 32 | +++ b/net/mac80211/rx.c |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 33 | @@ -3349,9 +3349,13 @@ ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx) |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 34 | |
| 35 | color = le32_get_bits(he_oper->he_oper_params, |
| 36 | IEEE80211_HE_OPERATION_BSS_COLOR_MASK); |
| 37 | + |
| 38 | + bss_conf->used_color_bitmap |= BIT_ULL(color); |
| 39 | + |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 40 | + // trace_bss_color_bitmap(color, bss_conf->used_color_bitmap); |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 41 | if (color == bss_conf->he_bss_color.color) |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 42 | ieee80211_obss_color_collision_notify(&rx->sdata->vif, |
| 43 | - BIT_ULL(color), |
| 44 | + bss_conf->used_color_bitmap, |
| 45 | GFP_ATOMIC); |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 46 | } |
| 47 | } |
| 48 | diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 49 | index b8c53b4..814aed6 100644 |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 50 | --- a/net/mac80211/trace.h |
| 51 | +++ b/net/mac80211/trace.h |
developer | 83ad30d | 2023-09-12 17:28:06 +0800 | [diff] [blame^] | 52 | @@ -3060,6 +3060,27 @@ TRACE_EVENT(stop_queue, |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 53 | ) |
| 54 | ); |
| 55 | |
| 56 | +TRACE_EVENT(bss_color_bitmap, |
| 57 | + TP_PROTO(u8 color, |
| 58 | + u64 color_bitmap), |
| 59 | + |
| 60 | + TP_ARGS(color, color_bitmap), |
| 61 | + |
| 62 | + TP_STRUCT__entry( |
| 63 | + __field(u8, color) |
| 64 | + __field(u64, color_bitmap) |
| 65 | + ), |
| 66 | + |
| 67 | + TP_fast_assign( |
| 68 | + __entry->color = color; |
| 69 | + __entry->color_bitmap = color_bitmap; |
| 70 | + ), |
| 71 | + |
| 72 | + TP_printk( |
| 73 | + "color=%u color_bitmap=0x%llx", __entry->color, __entry->color_bitmap |
| 74 | + ) |
| 75 | +); |
| 76 | + |
| 77 | #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ |
| 78 | |
| 79 | #undef TRACE_INCLUDE_PATH |
| 80 | -- |
developer | ebaa551 | 2023-04-19 18:23:21 +0800 | [diff] [blame] | 81 | 2.39.2 |
developer | c9eaf90 | 2023-03-13 05:45:10 +0800 | [diff] [blame] | 82 | |