| From 40ceb2dcc486ddefb5e4cb69e4cd86906242872c Mon Sep 17 00:00:00 2001 |
| From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com> |
| Date: Tue, 15 Nov 2022 06:35:48 +0800 |
| Subject: [PATCH] mac80211: mtk: track obss color bitmap |
| |
| Track OBSS BSS color when receive their beacon. |
| |
| Adding 2 tracepoint for debug, usage: |
| echo 1 > /sys/kernel/debug/tracing/events/mac80211/bss_color_bitmap/enable |
| echo 1 > /sys/kernel/debug/tracing/events/mac80211/bss_color_collision/enable |
| --- |
| include/net/cfg80211.h | 1 + |
| net/mac80211/rx.c | 14 ++++++++++++-- |
| net/mac80211/trace.h | 35 +++++++++++++++++++++++++++++++++++ |
| 3 files changed, 48 insertions(+), 2 deletions(-) |
| |
| diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h |
| index c4c0926..e5175c2 100644 |
| --- a/include/net/cfg80211.h |
| +++ b/include/net/cfg80211.h |
| @@ -307,6 +307,7 @@ struct cfg80211_he_bss_color { |
| u8 color; |
| bool enabled; |
| bool partial; |
| + u64 used_color_bitmap; |
| }; |
| |
| /** |
| diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c |
| index eb16838..4a6491c 100644 |
| --- a/net/mac80211/rx.c |
| +++ b/net/mac80211/rx.c |
| @@ -3219,9 +3219,18 @@ ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx) |
| |
| color = le32_get_bits(he_oper->he_oper_params, |
| IEEE80211_HE_OPERATION_BSS_COLOR_MASK); |
| - if (color == bss_conf->he_bss_color.color) |
| + |
| + bss_conf->he_bss_color.used_color_bitmap |= BIT_ULL(color); |
| + |
| + trace_bss_color_bitmap(color, |
| + bss_conf->he_bss_color.used_color_bitmap); |
| + |
| + if (color == bss_conf->he_bss_color.color) { |
| + trace_bss_color_collision(color); |
| + |
| ieeee80211_obss_color_collision_notify(&rx->sdata->vif, |
| - BIT_ULL(color)); |
| + bss_conf->he_bss_color.used_color_bitmap); |
| + } |
| } |
| } |
| |
| diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h |
| index d91498f..013f5e4 100644 |
| --- a/net/mac80211/trace.h |
| +++ b/net/mac80211/trace.h |
| @@ -2899,6 +2899,41 @@ DEFINE_EVENT(sta_event, drv_net_fill_forward_path, |
| TP_ARGS(local, sdata, sta) |
| ); |
| |
| +TRACE_EVENT(bss_color_bitmap, |
| + TP_PROTO(u8 color, |
| + u64 color_bitmap), |
| + |
| + TP_ARGS(color, color_bitmap), |
| + |
| + TP_STRUCT__entry( |
| + __field(u8, color) |
| + __field(u64, color_bitmap) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->color = color; |
| + __entry->color_bitmap = color_bitmap; |
| + ), |
| + |
| + TP_printk( |
| + "color=%u color_bitmap=0x%llx", __entry->color, __entry->color_bitmap |
| + ) |
| +); |
| + |
| +TRACE_EVENT(bss_color_collision, |
| + TP_PROTO(u8 color), |
| + |
| + TP_ARGS(color), |
| + |
| + TP_STRUCT__entry(__field(u8, color)), |
| + |
| + TP_fast_assign( |
| + __entry->color = color; |
| + ), |
| + |
| + TP_printk("collision detected on color %u", __entry->color) |
| +); |
| + |
| #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ |
| |
| #undef TRACE_INCLUDE_PATH |
| -- |
| 2.36.1 |
| |