[][MAC80211][core][Fix color aging not being queued]
[Description]
Fix color aging work not being queue and stale color doesn't get aged out.
The sdata is not running when we first queue color_aging_work if we put it
in ieee80211_setup_sdata(). Move that to ieee80211_do_open() after sdata is
running.
[Release-log]
N/A
Change-Id: Ie2ea7466851206838c1c9c70eb318d8315adb9e7
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7289974
diff --git a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch
index 2ec36c4..b530b3b 100644
--- a/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch
+++ b/autobuild_mac80211_release/package/kernel/mac80211/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch
@@ -1,4 +1,4 @@
-From 61c6c0f49eb2809c2113b83b168a0c532d06da21 Mon Sep 17 00:00:00 2001
+From 84d68e0b64f56564560fc96b6e3ce10078462a01 Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Date: Wed, 8 Mar 2023 06:32:42 +0800
Subject: [PATCH] mac80211: mtk: ageout color bitmap
@@ -9,9 +9,9 @@
include/net/mac80211.h | 1 +
net/mac80211/cfg.c | 29 +++++++++++++++++++++++++++++
net/mac80211/ieee80211_i.h | 5 +++++
- net/mac80211/iface.c | 5 +++++
+ net/mac80211/iface.c | 7 +++++++
net/mac80211/rx.c | 1 +
- 5 files changed, 41 insertions(+)
+ 5 files changed, 43 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c6cadf7..6f8c661 100644
@@ -91,7 +91,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 d314f39..5feb702 100644
+index d314f39..00b0443 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -466,6 +466,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
@@ -102,16 +102,18 @@
if (sdata->wdev.cac_started) {
chandef = sdata->vif.bss_conf.chandef;
-@@ -1758,6 +1759,8 @@ 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;
+@@ -1391,6 +1392,10 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
+ set_bit(SDATA_STATE_RUNNING, &sdata->state);
+
+ switch (sdata->vif.type) {
++ case NL80211_IFTYPE_AP:
+ ieee80211_queue_delayed_work(&sdata->local->hw,
-+ &sdata->color_aging_work, 0);
++ &sdata->color_aging_work, HZ);
++ break;
+ case NL80211_IFTYPE_P2P_DEVICE:
+ rcu_assign_pointer(local->p2p_sdata, sdata);
break;
- case NL80211_IFTYPE_P2P_CLIENT:
- type = NL80211_IFTYPE_STATION;
-@@ -2166,6 +2169,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
+@@ -2166,6 +2171,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
ieee80211_dfs_cac_timer_work);
INIT_DELAYED_WORK(&sdata->dec_tailroom_needed_wk,
ieee80211_delayed_tailroom_dec);
diff --git a/autobuild_mac80211_release/package/kernel/mac80211_dev/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch b/autobuild_mac80211_release/package/kernel/mac80211_dev/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch
index 5d323be..b93c42f 100644
--- a/autobuild_mac80211_release/package/kernel/mac80211_dev/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch
+++ b/autobuild_mac80211_release/package/kernel/mac80211_dev/patches/subsys/mtk-0017-mac80211-mtk-aging-color-bitmap.patch
@@ -1,4 +1,4 @@
-From 2b96a2bd30821f7db9a5f29392e5652f0426de29 Mon Sep 17 00:00:00 2001
+From 638a487c558695eff644966027833704e583ab4d Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Date: Mon, 13 Mar 2023 05:36:59 +0800
Subject: [PATCH] mac80211: mtk: ageout color bitmap
@@ -8,10 +8,11 @@
---
include/net/mac80211.h | 1 +
net/mac80211/cfg.c | 30 ++++++++++++++++++++++++++++++
- net/mac80211/ieee80211_i.h | 6 ++++++
+ net/mac80211/ieee80211_i.h | 5 +++++
net/mac80211/iface.c | 5 +++++
+ net/mac80211/link.c | 2 ++
net/mac80211/rx.c | 1 +
- 5 files changed, 43 insertions(+)
+ 6 files changed, 44 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3cf1745..d044be5 100644
@@ -26,7 +27,7 @@
u32 unsol_bcast_probe_resp_interval;
struct cfg80211_bitrate_mask beacon_tx_rate;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
-index 5c9dda1..b792d7e 100644
+index 5c9dda1..343ce2b 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4755,6 +4755,36 @@ out:
@@ -38,7 +39,7 @@
+{
+ struct ieee80211_sub_if_data *sdata =
+ container_of(work, struct ieee80211_sub_if_data,
-+ color_aging_work.work);
++ deflink.color_aging_work.work);
+ struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
+ int i = 0;
+
@@ -57,7 +58,7 @@
+ }
+
+ ieee80211_queue_delayed_work(&sdata->local->hw,
-+ &sdata->color_aging_work, HZ);
++ &sdata->deflink.color_aging_work, HZ);
+
+unlock:
+ sdata_unlock(sdata);
@@ -67,19 +68,18 @@
ieee80211_set_radar_background(struct wiphy *wiphy,
struct cfg80211_chan_def *chandef)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
-index a10ef29..295f45b 100644
+index a10ef29..4f4dd89 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
-@@ -1111,6 +1111,8 @@ struct ieee80211_sub_if_data {
- } debugfs;
- #endif
+@@ -987,6 +987,7 @@ struct ieee80211_link_data {
+ struct cfg80211_chan_def csa_chandef;
+ struct work_struct color_change_finalize_work;
+ struct delayed_work color_aging_work;
-+
- /* must be last, dynamically sized area in this! */
- struct ieee80211_vif vif;
- };
-@@ -1930,8 +1932,12 @@ void ieee80211_csa_finalize_work(struct work_struct *work);
+
+ /* context reservation -- protected with chanctx_mtx */
+ struct ieee80211_chanctx *reserved_chanctx;
+@@ -1930,8 +1931,12 @@ void ieee80211_csa_finalize_work(struct work_struct *work);
int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
struct cfg80211_csa_settings *params);
@@ -93,35 +93,41 @@
/* 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 b80fb66..91ac7b0 100644
+index b80fb66..98682a0 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -541,6 +541,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
cancel_work_sync(&sdata->deflink.color_change_finalize_work);
cancel_delayed_work_sync(&sdata->deflink.dfs_cac_timer_work);
-+ cancel_delayed_work_sync(&sdata->color_aging_work);
++ cancel_delayed_work_sync(&sdata->deflink.color_aging_work);
if (sdata->wdev.cac_started) {
chandef = sdata->vif.bss_conf.chandef;
-@@ -1787,6 +1788,8 @@ 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;
-+ ieee80211_queue_delayed_work(&sdata->local->hw,
-+ &sdata->color_aging_work, 0);
- break;
- case NL80211_IFTYPE_P2P_CLIENT:
- type = NL80211_IFTYPE_STATION;
-@@ -2189,6 +2192,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
+@@ -1479,6 +1480,10 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
- INIT_DELAYED_WORK(&sdata->dec_tailroom_needed_wk,
- ieee80211_delayed_tailroom_dec);
-+ INIT_DELAYED_WORK(&sdata->color_aging_work,
+ set_bit(SDATA_STATE_RUNNING, &sdata->state);
+
++ if (sdata->vif.type == NL80211_IFTYPE_AP)
++ ieee80211_queue_delayed_work(&sdata->local->hw,
++ &sdata->deflink.color_aging_work, HZ);
++
+ return 0;
+ err_del_interface:
+ drv_remove_interface(local, sdata);
+diff --git a/net/mac80211/link.c b/net/mac80211/link.c
+index e309708..d34cdc2 100644
+--- a/net/mac80211/link.c
++++ b/net/mac80211/link.c
+@@ -43,6 +43,8 @@ void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,
+ INIT_LIST_HEAD(&link->reserved_chanctx_list);
+ INIT_DELAYED_WORK(&link->dfs_cac_timer_work,
+ ieee80211_dfs_cac_timer_work);
++ INIT_DELAYED_WORK(&link->color_aging_work,
+ ieee80211_color_aging_work);
- for (i = 0; i < NUM_NL80211_BANDS; i++) {
- struct ieee80211_supported_band *sband;
+ if (!deflink) {
+ switch (sdata->vif.type) {
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index fd2f650..67c768c 100644
--- a/net/mac80211/rx.c