[rdkb][common][bsp][Refactor and sync wifi from openwrt]
[Description]
e6d9f8b2 [MAC80211][misc][Add Filogic 880 Non-MLO SDK Release. Add missing firmwares]
9def0c8f [MAC80211][WiFi7][ucode][Not to remove or create interface for non-primary MLD link]
c77412af [MAC80211][WiFi7][Misc][Add MLD configuration options]
d0bc5c22 [MAC80211][misc][Add Filogic 880 Non-MLO SDK Release]
01817e1f [mac80211][WiFi7][misc][Fix patch fail]
d6a80bd6 [MAC80211][WiFi6][Misc][Add lpi, duplicate mode and sku index]
0977e5a6 [MAC80211][WiFi6][hostapd][Add txpower vendor command]
2e2eb49f [MAC80211][WiFi6][mt76][Add support for lpi and duplicate mode]
c4856a8a [MAC80211][WiFi6][core][Add sta info flush and send deauth during DFS channel switch]
c586f5f5 [MAC80211][WiFi6][mt76][rebase patches]
fabcdbbd [MAC80211][WiFi6][mt76][Support thermal recal debug command]
1cba3dbf [MAC80211][WiFi6][mt76][Fix the fw version of wm and wa are on contrary]
99500b19 [MAC80211][WiFi6][core][Revert sending deauth frame for DFS channel switch]
[Release-log]
Change-Id: I357f4a5fec68ce0210927e1b4f172fcd3196139d
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch
new file mode 100644
index 0000000..43724ae
--- /dev/null
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch
@@ -0,0 +1,64 @@
+From ee0db868ee4d88493dfdc82f59e3b4e449ddddd5 Mon Sep 17 00:00:00 2001
+From: Oldřich Jedlička <oldium.pro@gmail.com>
+Date: Sat, 4 Nov 2023 15:13:33 +0100
+Subject: wifi: mac80211: do not pass AP_VLAN vif pointer to drivers during
+ flush
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+[ Upstream commit 3e3a2b645c043f7e3e488d5011478cefb69bbe8b ]
+
+This fixes WARN_ONs when using AP_VLANs after station removal. The flush
+call passed AP_VLAN vif to driver, but because these vifs are virtual and
+not registered with drivers, we need to translate to the correct AP vif
+first.
+
+Closes: https://github.com/openwrt/openwrt/issues/12420
+Fixes: 0b75a1b1e42e ("wifi: mac80211: flush queues on STA removal")
+Fixes: d00800a289c9 ("wifi: mac80211: add flush_sta method")
+Tested-by: Konstantin Demin <rockdrilla@gmail.com>
+Tested-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
+Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
+Link: https://lore.kernel.org/r/20231104141333.3710-1-oldium.pro@gmail.com
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/mac80211/driver-ops.h | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/net/mac80211/driver-ops.h
++++ b/net/mac80211/driver-ops.h
+@@ -23,7 +23,7 @@
+ static inline struct ieee80211_sub_if_data *
+ get_bss_sdata(struct ieee80211_sub_if_data *sdata)
+ {
+- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
++ if (sdata && sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+ sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
+ u.ap);
+
+@@ -638,10 +638,13 @@ static inline void drv_flush(struct ieee
+ struct ieee80211_sub_if_data *sdata,
+ u32 queues, bool drop)
+ {
+- struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL;
++ struct ieee80211_vif *vif;
+
+ might_sleep();
+
++ sdata = get_bss_sdata(sdata);
++ vif = sdata ? &sdata->vif : NULL;
++
+ if (sdata && !check_sdata_in_driver(sdata))
+ return;
+
+@@ -657,6 +660,8 @@ static inline void drv_flush_sta(struct
+ {
+ might_sleep();
+
++ sdata = get_bss_sdata(sdata);
++
+ if (sdata && !check_sdata_in_driver(sdata))
+ return;
+
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch
new file mode 100644
index 0000000..191eb67
--- /dev/null
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch
@@ -0,0 +1,34 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 3 Jan 2024 15:10:18 +0100
+Subject: [PATCH] wifi: mac80211: fix race condition on enabling fast-xmit
+
+fast-xmit must only be enabled after the sta has been uploaded to the driver,
+otherwise it could end up passing the not-yet-uploaded sta via drv_tx calls
+to the driver, leading to potential crashes because of uninitialized drv_priv
+data.
+Add a missing sta->uploaded check and re-check fast xmit after inserting a sta.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/sta_info.c
++++ b/net/mac80211/sta_info.c
+@@ -911,6 +911,7 @@ static int sta_info_insert_finish(struct
+
+ if (ieee80211_vif_is_mesh(&sdata->vif))
+ mesh_accept_plinks_update(sdata);
++ ieee80211_check_fast_xmit(sta);
+
+ return 0;
+ out_remove:
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -3033,7 +3033,7 @@ void ieee80211_check_fast_xmit(struct st
+ sdata->vif.type == NL80211_IFTYPE_STATION)
+ goto out;
+
+- if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED))
++ if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED) || !sta->uploaded)
+ goto out;
+
+ if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/780-avoid-crashing-missing-band.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/780-avoid-crashing-missing-band.patch
new file mode 100644
index 0000000..2bc11ef
--- /dev/null
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/780-avoid-crashing-missing-band.patch
@@ -0,0 +1,34 @@
+From: David Bauer <mail@david-bauer.net>
+Date: Thu, 30 Nov 2023 07:32:52 +0100
+Subject: [PATCH] mac80211: avoid crashing on invalid band info
+
+Frequent crashes have been observed on MT7916 based platforms. While the
+root of these crashes are currently unknown, they happen when decoding
+rate information of connected STAs in AP mode. The rate-information is
+associated with a band which is not available on the PHY.
+
+Check for this condition in order to avoid crashing the whole system.
+This patch should be removed once the roout cause has been found and
+fixed.
+
+Link: https://github.com/freifunk-gluon/gluon/issues/2980
+
+Signed-off-by: David Bauer <mail@david-bauer.net>
+---
+
+--- a/net/mac80211/sta_info.c
++++ b/net/mac80211/sta_info.c
+@@ -2422,6 +2422,13 @@ static void sta_stats_decode_rate(struct
+
+ sband = local->hw.wiphy->bands[band];
+
++ if (!sband) {
++ wiphy_warn(local->hw.wiphy,
++ "Invalid band %d\n",
++ band);
++ break;
++ }
++
+ if (WARN_ON_ONCE(!sband->bitrates))
+ break;
+
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
index 09537c4..889429a 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
@@ -1,5 +1,6 @@
#patch subsys (come from openwrt/lede/target/linux/mediatek)
SRC_URI_append = " \
+ file://001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch \
file://110-mac80211_keep_keys_on_stop_ap.patch \
file://120-cfg80211_allow_perm_addr_change.patch \
file://130-disable_auto_vif.patch \
@@ -13,8 +14,10 @@
file://311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch \
file://312-wifi-cfg80211-annotate-iftype_data-pointer-with-spar.patch \
file://313-wifi-cfg80211-export-DFS-CAC-time-and-usable-state-h.patch \
+ file://314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch \
file://320-cfg80211-allow-grace-period-for-DFS-available-after-.patch \
file://400-allow-ibss-mixed.patch \
+ file://780-avoid-crashing-missing-band.patch \
file://782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch \
file://bp-0001-backports-Revert-mac80211-use-the-new-drop-reasons-i.patch \
file://bp-0002-backports-update-kernel-version-check-for-eth_hw_add.patch \
diff --git a/recipes-wifi/linux-mac80211/files/patches/subsys/mtk-0024-mac80211-mtk-add-DFS-CAC-countdown-in-CSA-flow.patch b/recipes-wifi/linux-mac80211/files/patches/subsys/mtk-0024-mac80211-mtk-add-DFS-CAC-countdown-in-CSA-flow.patch
index 4a2dfea..f2fde36 100644
--- a/recipes-wifi/linux-mac80211/files/patches/subsys/mtk-0024-mac80211-mtk-add-DFS-CAC-countdown-in-CSA-flow.patch
+++ b/recipes-wifi/linux-mac80211/files/patches/subsys/mtk-0024-mac80211-mtk-add-DFS-CAC-countdown-in-CSA-flow.patch
@@ -1,18 +1,20 @@
-From 022bf2702e0dd6f67690ac2860aa465efb4bff07 Mon Sep 17 00:00:00 2001
+From d10310d3eb842ebc449271b45ad2f47634149385 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 15 Nov 2023 15:05:17 +0800
Subject: [PATCH] mac80211: mtk: add DFS CAC countdown in CSA flow
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
- include/net/cfg80211.h | 32 +++++++++++++++++++
- net/mac80211/cfg.c | 34 +++++++++++++++++++-
- net/mac80211/mlme.c | 6 +++-
- net/mac80211/util.c | 11 ++++++-
- net/wireless/chan.c | 71 +++++++++++++++++++++++++++++++++++++++++
- net/wireless/nl80211.c | 5 +--
- net/wireless/rdev-ops.h | 17 ++++++++++
- 7 files changed, 171 insertions(+), 5 deletions(-)
+ include/net/cfg80211.h | 32 +++++++++++++++++
+ net/mac80211/cfg.c | 45 +++++++++++++++++++++++-
+ net/mac80211/ieee80211_i.h | 2 ++
+ net/mac80211/iface.c | 2 ++
+ net/mac80211/mlme.c | 6 +++-
+ net/mac80211/util.c | 11 +++++-
+ net/wireless/chan.c | 71 ++++++++++++++++++++++++++++++++++++++
+ net/wireless/nl80211.c | 5 +--
+ net/wireless/rdev-ops.h | 17 +++++++++
+ 9 files changed, 186 insertions(+), 5 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 03f072f..a443b0d 100644
@@ -65,13 +67,22 @@
* cfg80211_ch_switch_notify - update wdev channel and notify userspace
* @dev: the device which switched channels
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
-index 56381f8..8a0833b 100644
+index 56381f8..3e6e903 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
-@@ -3328,6 +3328,28 @@ static int ieee80211_set_after_csa_beacon(struct ieee80211_sub_if_data *sdata,
+@@ -3328,6 +3328,39 @@ static int ieee80211_set_after_csa_beacon(struct ieee80211_sub_if_data *sdata,
return 0;
}
++void ieee80211_cac_sta_flush_work(struct work_struct *work)
++{
++ struct ieee80211_sub_if_data *sdata =
++ container_of(work, struct ieee80211_sub_if_data,
++ cac_sta_flush_work);
++
++ __sta_info_flush(sdata, true);
++}
++
+static int ieee80211_start_radar_detection_post_csa(struct wiphy *wiphy,
+ struct net_device *dev,
+ struct cfg80211_chan_def *chandef,
@@ -87,7 +98,9 @@
+ sdata->smps_mode = IEEE80211_SMPS_OFF;
+ sdata->needed_rx_chains = local->rx_chains;
+
++ ieee80211_queue_work(&local->hw, &sdata->cac_sta_flush_work);
++
-+ ieee80211_queue_delayed_work(&sdata->local->hw,
++ ieee80211_queue_delayed_work(&local->hw,
+ &sdata->dfs_cac_timer_work,
+ msecs_to_jiffies(cac_time_ms));
+
@@ -97,7 +110,7 @@
static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
-@@ -3361,6 +3383,11 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
+@@ -3361,6 +3394,11 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
&sdata->csa_chandef))
return -EINVAL;
@@ -109,7 +122,7 @@
sdata->vif.csa_active = false;
err = ieee80211_set_after_csa_beacon(sdata, &changed);
-@@ -4538,7 +4565,11 @@ ieee80211_skip_cac(struct wireless_dev *wdev)
+@@ -4538,7 +4576,11 @@ ieee80211_skip_cac(struct wireless_dev *wdev)
cancel_delayed_work(&sdata->dfs_cac_timer_work);
if (wdev->cac_started) {
@@ -122,7 +135,7 @@
cac_time_ms = wdev->cac_time_ms;
wdev->cac_start_time = jiffies -
msecs_to_jiffies(cac_time_ms + 1);
-@@ -4630,6 +4661,7 @@ const struct cfg80211_ops mac80211_config_ops = {
+@@ -4630,6 +4672,7 @@ const struct cfg80211_ops mac80211_config_ops = {
#endif
.get_channel = ieee80211_cfg_get_channel,
.start_radar_detection = ieee80211_start_radar_detection,
@@ -130,6 +143,46 @@
.end_cac = ieee80211_end_cac,
.channel_switch = ieee80211_channel_switch,
.set_qos_map = ieee80211_set_qos_map,
+diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
+index 2519c14..bb5906d 100644
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -962,6 +962,7 @@ struct ieee80211_sub_if_data {
+ struct mac80211_qos_map __rcu *qos_map;
+
+ struct work_struct csa_finalize_work;
++ struct work_struct cac_sta_flush_work;
+ bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
+ struct cfg80211_chan_def csa_chandef;
+
+@@ -1812,6 +1813,7 @@ int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
+ 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);
++void ieee80211_cac_sta_flush_work(struct work_struct *work);
+
+ #define IEEE80211_BSS_COLOR_AGEOUT_TIME 10
+ #define IEEE80211_BSS_COLOR_MAX 64
+diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
+index 00b0443..ef32d53 100644
+--- a/net/mac80211/iface.c
++++ b/net/mac80211/iface.c
+@@ -463,6 +463,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
+ sdata_unlock(sdata);
+
+ cancel_work_sync(&sdata->csa_finalize_work);
++ cancel_work_sync(&sdata->cac_sta_flush_work);
+ cancel_work_sync(&sdata->color_change_finalize_work);
+
+ cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
+@@ -1749,6 +1750,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
+ INIT_WORK(&sdata->work, ieee80211_iface_work);
+ INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work);
+ INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work);
++ INIT_WORK(&sdata->cac_sta_flush_work, ieee80211_cac_sta_flush_work);
+ INIT_WORK(&sdata->color_change_finalize_work, ieee80211_color_change_finalize_work);
+ INIT_LIST_HEAD(&sdata->assigned_chanctx_list);
+ INIT_LIST_HEAD(&sdata->reserved_chanctx_list);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 48053e4..e9ec32d 100644
--- a/net/mac80211/mlme.c
@@ -148,7 +201,7 @@
NL80211_RADAR_CAC_FINISHED,
GFP_KERNEL);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
-index 8d36b05..5360fae 100644
+index 26cd627..e07fe73 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -3873,7 +3873,16 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
diff --git a/recipes-wifi/linux-mac80211/files/patches/subsys/mtk-0025-mac80211-mtk-send-deauth-frame-if-CAC-is-required-du.patch b/recipes-wifi/linux-mac80211/files/patches/subsys/mtk-0025-mac80211-mtk-send-deauth-frame-if-CAC-is-required-du.patch
new file mode 100644
index 0000000..a74101d
--- /dev/null
+++ b/recipes-wifi/linux-mac80211/files/patches/subsys/mtk-0025-mac80211-mtk-send-deauth-frame-if-CAC-is-required-du.patch
@@ -0,0 +1,59 @@
+From 08661908d4c2fb5f8d7ca00e0e7e6b33a6ae6e31 Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Wed, 27 Dec 2023 14:26:22 +0800
+Subject: [PATCH] mac80211: mtk: send deauth frame if CAC is required during
+ CSA
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ net/mac80211/cfg.c | 27 +++++++++++++++++++++++++++
+ 1 file changed, 27 insertions(+)
+
+diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
+index 3e6e903..eb73834 100644
+--- a/net/mac80211/cfg.c
++++ b/net/mac80211/cfg.c
+@@ -3361,6 +3361,31 @@ static int ieee80211_start_radar_detection_post_csa(struct wiphy *wiphy,
+ return 1;
+ }
+
++static void ieee80211_csa_send_deauth(struct ieee80211_sub_if_data *sdata)
++{
++ struct ieee80211_local *local = sdata->local;
++ u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
++ u8 broadcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
++ bool send_deauth;
++
++ send_deauth = !cfg80211_chandef_identical(&sdata->vif.bss_conf.chandef,
++ &sdata->csa_chandef) &&
++ !cfg80211_reg_can_beacon_relax(local->hw.wiphy,
++ &sdata->csa_chandef,
++ sdata->wdev.iftype);
++ /* broadcast deauth frame if CAC is required */
++ if (!send_deauth)
++ return;
++
++ ieee80211_wake_vif_queues(local, sdata, IEEE80211_QUEUE_STOP_REASON_CSA);
++ ieee80211_send_deauth_disassoc(sdata, broadcast,
++ sdata->vif.bss_conf.bssid,
++ IEEE80211_STYPE_DEAUTH,
++ WLAN_REASON_DEAUTH_LEAVING,
++ send_deauth, frame_buf);
++ ieee80211_stop_vif_queues(local, sdata, IEEE80211_QUEUE_STOP_REASON_CSA);
++}
++
+ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
+ {
+ struct ieee80211_local *local = sdata->local;
+@@ -3371,6 +3396,8 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
+ lockdep_assert_held(&local->mtx);
+ lockdep_assert_held(&local->chanctx_mtx);
+
++ ieee80211_csa_send_deauth(sdata);
++
+ /*
+ * using reservation isn't immediate as it may be deferred until later
+ * with multi-vif. once reservation is complete it will re-schedule the
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mac80211/files/patches/subsys/subsys.inc b/recipes-wifi/linux-mac80211/files/patches/subsys/subsys.inc
index 9bb77d3..d5b5832 100644
--- a/recipes-wifi/linux-mac80211/files/patches/subsys/subsys.inc
+++ b/recipes-wifi/linux-mac80211/files/patches/subsys/subsys.inc
@@ -81,6 +81,7 @@
file://mtk-0023-mac80211-mtk-avoid-calling-switch_vif_chanctx-when-u.patch \
file://mtk-0024-mac80211-mtk-ACS-channel-time-is-reset-by-ch_restore.patch \
file://mtk-0024-mac80211-mtk-add-DFS-CAC-countdown-in-CSA-flow.patch \
+ file://mtk-0025-mac80211-mtk-send-deauth-frame-if-CAC-is-required-du.patch \
file://mtk-9900-mac80211-mtk-mask-kernel-version-limitation-and-fill.patch \
file://mtk-9901-mac80211-mtk-add-fill-receive-path-ops-to-get-wed-id.patch \
file://mtk-9902-mac80211-mtk-add-support-for-letting-drivers-registe.patch \