[][MAC80211][misc][Fix Bss Color Bitmap patch]
[Description]
Fix below few things:
1. Move variables from he_bss_color to bss_conf
2. Rename serial number of mac80211 patches
3. Fix function name typo for ieeee80211_obss_color_collision_notify
[Release-log]
N/A
Change-Id: Ibef30bb7163ef1dac08940d8343a6fc4d45fe6b6
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7216660
diff --git a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0014--mac80211-mtk-track-obss-color-bitmap.patch b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0014--mac80211-mtk-track-obss-color-bitmap.patch
deleted file mode 100644
index 18d8aab..0000000
--- a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0014--mac80211-mtk-track-obss-color-bitmap.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-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
-
diff --git a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0016-mac80211-mtk-track-obss-color-bitmap.patch b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0016-mac80211-mtk-track-obss-color-bitmap.patch
new file mode 100644
index 0000000..3ddcb67
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0016-mac80211-mtk-track-obss-color-bitmap.patch
@@ -0,0 +1,125 @@
+From eee41e0fa9bff506c8402b8cc86ae5e688fdc2c2 Mon Sep 17 00:00:00 2001
+From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
+Date: Wed, 8 Mar 2023 06:23:55 +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/mac80211.h | 5 +++--
+ net/mac80211/cfg.c | 4 ++--
+ net/mac80211/rx.c | 9 +++++++--
+ net/mac80211/trace.h | 21 +++++++++++++++++++++
+ 4 files changed, 33 insertions(+), 6 deletions(-)
+
+diff --git a/include/net/mac80211.h b/include/net/mac80211.h
+index 6419397..c6cadf7 100644
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -699,6 +699,7 @@ struct ieee80211_bss_conf {
+ } he_oper;
+ struct ieee80211_he_obss_pd he_obss_pd;
+ struct cfg80211_he_bss_color he_bss_color;
++ u64 used_color_bitmap;
+ struct ieee80211_fils_discovery fils_discovery;
+ u32 unsol_bcast_probe_resp_interval;
+ bool s1g;
+@@ -6875,7 +6876,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif);
+
+ /**
+- * ieeee80211_obss_color_collision_notify - notify userland about a BSS color
++ * ieee80211_obss_color_collision_notify - notify userland about a BSS color
+ * collision.
+ *
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+@@ -6883,7 +6884,7 @@ ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
+ * aware of.
+ */
+ void
+-ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
++ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
+ u64 color_bitmap);
+
+ /**
+diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
+index 0a6257d..86d231b 100644
+--- a/net/mac80211/cfg.c
++++ b/net/mac80211/cfg.c
+@@ -4435,7 +4435,7 @@ void ieee80211_color_change_finish(struct ieee80211_vif *vif)
+ EXPORT_SYMBOL_GPL(ieee80211_color_change_finish);
+
+ void
+-ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
++ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
+ u64 color_bitmap)
+ {
+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+@@ -4445,7 +4445,7 @@ ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
+
+ cfg80211_obss_color_collision_notify(sdata->dev, color_bitmap);
+ }
+-EXPORT_SYMBOL_GPL(ieeee80211_obss_color_collision_notify);
++EXPORT_SYMBOL_GPL(ieee80211_obss_color_collision_notify);
+
+ static int
+ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev,
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
+index eb16838..36fcf97 100644
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -3219,9 +3219,14 @@ 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);
++
++ bss_conf->used_color_bitmap |= BIT_ULL(color);
++
++ trace_bss_color_bitmap(color, bss_conf->used_color_bitmap);
++
+ if (color == bss_conf->he_bss_color.color)
+- ieeee80211_obss_color_collision_notify(&rx->sdata->vif,
+- BIT_ULL(color));
++ ieee80211_obss_color_collision_notify(&rx->sdata->vif,
++ bss_conf->used_color_bitmap);
+ }
+ }
+
+diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
+index bbda9e9..bd43aab 100644
+--- a/net/mac80211/trace.h
++++ b/net/mac80211/trace.h
+@@ -2901,6 +2901,27 @@ DEFINE_EVENT(sta_event, drv_net_fill_forward_path,
+ );
+ #endif
+
++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
++ )
++);
++
+ #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
+
+ #undef TRACE_INCLUDE_PATH
+--
+2.39.0
+
diff --git a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0015-mac80211-mtk-aging-color-bitmap.patch b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch
similarity index 74%
rename from autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0015-mac80211-mtk-aging-color-bitmap.patch
rename to autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch
index 4ed9142..3577abd 100644
--- a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0015-mac80211-mtk-aging-color-bitmap.patch
+++ b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch
@@ -1,32 +1,32 @@
-From f6cd955e1c042a00691fa80d231495024cfcf7a5 Mon Sep 17 00:00:00 2001
+From 13c1f52aa61fe71335711e16216ba6abb33a8ead Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
-Date: Tue, 15 Nov 2022 11:03:22 +0800
+Date: Wed, 8 Mar 2023 06:32:42 +0800
Subject: [PATCH] mac80211: mtk: ageout color bitmap
Adding a periodic work which runs once per second to check BSS color.
OBSS BSS Color will be ageout if not seen for 10 seconds.
---
- include/net/cfg80211.h | 1 +
+ include/net/mac80211.h | 1 +
net/mac80211/cfg.c | 25 +++++++++++++++++++++++++
- net/mac80211/ieee80211_i.h | 4 ++++
+ net/mac80211/ieee80211_i.h | 5 +++++
net/mac80211/iface.c | 5 +++++
net/mac80211/rx.c | 1 +
- 5 files changed, 36 insertions(+)
+ 5 files changed, 37 insertions(+)
-diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
-index e5175c2..3e826f0 100644
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -308,6 +308,7 @@ struct cfg80211_he_bss_color {
- bool enabled;
- bool partial;
+diff --git a/include/net/mac80211.h b/include/net/mac80211.h
+index c6cadf7..6f8c661 100644
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -700,6 +700,7 @@ struct ieee80211_bss_conf {
+ struct ieee80211_he_obss_pd he_obss_pd;
+ struct cfg80211_he_bss_color he_bss_color;
u64 used_color_bitmap;
+ u64 color_last_seen[64];
- };
-
- /**
+ struct ieee80211_fils_discovery fils_discovery;
+ u32 unsol_bcast_probe_resp_interval;
+ bool s1g;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
-index a7b6284..f084912 100644
+index 86d231b..82e44d2 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4425,6 +4425,31 @@ unlock:
@@ -38,17 +38,17 @@
+ struct ieee80211_sub_if_data *sdata =
+ container_of(work, struct ieee80211_sub_if_data,
+ color_aging_work.work);
-+ struct cfg80211_he_bss_color *he_bss_color = &sdata->vif.bss_conf.he_bss_color;
++ struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
+ int i = 0;
+
+ sdata_lock(sdata);
+
+ for (i = 0; i < IEEE80211_BSS_COLOR_MAX; i++) {
+ /* ageout if not seen for a period */
-+ if ((he_bss_color->used_color_bitmap & BIT_ULL(i)) &&
-+ time_before(he_bss_color->color_last_seen[i],
++ if ((bss_conf->used_color_bitmap & BIT_ULL(i)) &&
++ time_before(bss_conf->color_last_seen[i],
+ jiffies - IEEE80211_BSS_COLOR_AGEOUT_TIME * HZ)) {
-+ he_bss_color->used_color_bitmap &= ~BIT_ULL(i);
++ bss_conf->used_color_bitmap &= ~BIT_ULL(i);
+ }
+ }
+
@@ -62,7 +62,7 @@
{
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
-index 6edabd8..415f202 100644
+index 6edabd8..2519c14 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1033,6 +1033,8 @@ struct ieee80211_sub_if_data {
@@ -87,7 +87,7 @@
/* interface handling */
#define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
-index 43f6cb0..7f26828 100644
+index d314f39..ba25327 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -466,6 +466,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
@@ -99,7 +99,7 @@
if (sdata->wdev.cac_started) {
chandef = sdata->vif.bss_conf.chandef;
-@@ -1804,6 +1806,9 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
+@@ -1758,6 +1760,9 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
skb_queue_head_init(&sdata->u.ap.ps.bc_buf);
INIT_LIST_HEAD(&sdata->u.ap.vlans);
sdata->vif.bss_conf.bssid = sdata->vif.addr;
@@ -110,17 +110,17 @@
case NL80211_IFTYPE_P2P_CLIENT:
type = NL80211_IFTYPE_STATION;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
-index 789a41b..4a6491c 100644
+index 36fcf97..31d3bb4 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3221,6 +3221,7 @@ ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
IEEE80211_HE_OPERATION_BSS_COLOR_MASK);
- bss_conf->he_bss_color.used_color_bitmap |= BIT_ULL(color);
-+ bss_conf->he_bss_color.color_last_seen[color] = jiffies;
+ bss_conf->used_color_bitmap |= BIT_ULL(color);
++ bss_conf->color_last_seen[color] = jiffies;
+
+ trace_bss_color_bitmap(color, bss_conf->used_color_bitmap);
- trace_bss_color_bitmap(color,
- bss_conf->he_bss_color.used_color_bitmap);
--
2.39.0
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/1134-mt76-mt7915-add-vendor-cmd-to-get-available-color-bi.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/1134-mt76-mt7915-add-vendor-cmd-to-get-available-color-bi.patch
index ec25241..9718b76 100644
--- a/autobuild_mac80211_release/package/kernel/mt76/patches/1134-mt76-mt7915-add-vendor-cmd-to-get-available-color-bi.patch
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/1134-mt76-mt7915-add-vendor-cmd-to-get-available-color-bi.patch
@@ -47,7 +47,7 @@
+
+ if (nla_put_u64_64bit(skb,
+ MTK_VENDOR_ATTR_AVAL_BSS_COLOR_BMP,
-+ ~bss_conf->he_bss_color.used_color_bitmap, NL80211_ATTR_PAD))
++ ~bss_conf->used_color_bitmap, NL80211_ATTR_PAD))
+ return -ENOMEM;
+ len += 1;
+
diff --git a/autobuild_mac80211_release/package/network/services/hostapd/patches/mtk-0016-hostapd-mtk-Add-available-color-bitmap.patch b/autobuild_mac80211_release/package/network/services/hostapd/patches/mtk-0022-hostapd-mtk-Add-available-color-bitmap.patch
similarity index 100%
rename from autobuild_mac80211_release/package/network/services/hostapd/patches/mtk-0016-hostapd-mtk-Add-available-color-bitmap.patch
rename to autobuild_mac80211_release/package/network/services/hostapd/patches/mtk-0022-hostapd-mtk-Add-available-color-bitmap.patch