PKG_NAME:=mac80211
-PKG_VERSION:=6.1.24
-PKG_RELEASE:=4
+PKG_VERSION:=6.5
+PKG_RELEASE:=1
# PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/
-PKG_HASH:=5d39aca7e34c33cb9b3e366117b2e86841b7bdd37933679d6b1e61be6b150648
+PKG_HASH:=908c22dceba185eab83caa5a1e58ce6b3ebdc58f099c3fd3e11c7352ebfab2d7
PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
$(call KernelPackage/mac80211/Default)
TITLE:=mac80211 HW simulation device
DEPENDS+= +kmod-mac80211 +@DRIVER_11AX_SUPPORT +@DRIVER_11AC_SUPPORT
- FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
+ FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/virtual/mac80211_hwsim.ko
AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
endef
--- a/drivers/net/wireless/ath/Makefile
+++ b/drivers/net/wireless/ath/Makefile
-@@ -15,10 +15,10 @@ ath-objs := main.o \
+@@ -16,10 +16,10 @@ ath-objs := main.o \
regd.o \
hw.o \
key.o \
CFLAGS_trace.o := -I$(src)
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
-@@ -317,14 +317,7 @@ void _ath_dbg(struct ath_common *common,
+@@ -319,14 +319,7 @@ void _ath_dbg(struct ath_common *common,
#endif /* CPTCFG_ATH_DEBUG */
/** Returns string describing opmode, or NULL if unknown mode. */
help
--- a/local-symbols
+++ b/local-symbols
-@@ -102,6 +102,7 @@ ADM8211=
+@@ -101,6 +101,7 @@ ADM8211=
ATH_COMMON=
WLAN_VENDOR_ATH=
ATH_DEBUG=
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
-@@ -3370,6 +3370,8 @@ void regulatory_hint_country_ie(struct w
+@@ -3340,6 +3340,8 @@ void regulatory_hint_country_ie(struct w
enum environment_cap env = ENVIRON_ANY;
struct regulatory_request *request = NULL, *lr;
/* IE len must be evenly divisible by 2 */
if (country_ie_len & 0x01)
return;
-@@ -3621,6 +3623,7 @@ static bool is_wiphy_all_set_reg_flag(en
+@@ -3591,6 +3593,7 @@ static bool is_wiphy_all_set_reg_flag(en
void regulatory_hint_disconnect(void)
{
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
-@@ -86,6 +86,12 @@ config ATH10K_TRACING
+@@ -87,6 +87,12 @@ config ATH10K_TRACING
help
Select this to ath10k use tracing infrastructure.
void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature);
--- a/local-symbols
+++ b/local-symbols
-@@ -161,6 +161,7 @@ ATH10K_SNOC=
+@@ -160,6 +160,7 @@ ATH10K_SNOC=
ATH10K_DEBUG=
ATH10K_DEBUGFS=
ATH10K_SPECTRAL=
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
-@@ -3516,6 +3516,16 @@ int ath10k_core_register(struct ath10k *
+@@ -3507,6 +3507,16 @@ int ath10k_core_register(struct ath10k *
queue_work(ar->workqueue, &ar->register_work);
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -9909,6 +9909,21 @@ static int ath10k_mac_init_rd(struct ath
+@@ -9917,6 +9917,21 @@ static int ath10k_mac_init_rd(struct ath
return 0;
}
int ath10k_mac_register(struct ath10k *ar)
{
static const u32 cipher_suites[] = {
-@@ -10267,6 +10282,12 @@ int ath10k_mac_register(struct ath10k *a
+@@ -10275,6 +10290,12 @@ int ath10k_mac_register(struct ath10k *a
ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
create mode 100644 drivers/net/wireless/ath/ath10k/leds.h
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
-@@ -71,6 +71,16 @@ config ATH10K_DEBUGFS
+@@ -72,6 +72,16 @@ config ATH10K_DEBUGFS
If unsure, say Y to make it easier to debug problems.
ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o
--- a/local-symbols
+++ b/local-symbols
-@@ -162,6 +162,7 @@ ATH10K_DEBUG=
+@@ -161,6 +161,7 @@ ATH10K_DEBUG=
ATH10K_DEBUGFS=
ATH10K_SPECTRAL=
ATH10K_THERMAL=
.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
-@@ -3231,6 +3237,10 @@ int ath10k_core_start(struct ath10k *ar,
+@@ -3222,6 +3228,10 @@ int ath10k_core_start(struct ath10k *ar,
goto err_hif_stop;
}
return 0;
err_hif_stop:
-@@ -3489,9 +3499,18 @@ static void ath10k_core_register_work(st
+@@ -3480,9 +3490,18 @@ static void ath10k_core_register_work(st
goto err_spectral_destroy;
}
err_spectral_destroy:
ath10k_spectral_destroy(ar);
err_debug_destroy:
-@@ -3537,6 +3556,8 @@ void ath10k_core_unregister(struct ath10
+@@ -3528,6 +3547,8 @@ void ath10k_core_unregister(struct ath10
if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags))
return;
#include "htt.h"
#include "htc.h"
-@@ -1253,6 +1254,13 @@ struct ath10k {
+@@ -1256,6 +1257,13 @@ struct ath10k {
} testmode;
struct {
{
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
-@@ -4594,6 +4594,8 @@ static const struct wmi_ops wmi_tlv_ops
+@@ -4601,6 +4601,8 @@ static const struct wmi_ops wmi_tlv_ops
.gen_echo = ath10k_wmi_tlv_op_gen_echo,
.gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf,
.gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable,
static struct sk_buff *
ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id,
enum wmi_sta_ps_mode psmode)
-@@ -9160,6 +9203,9 @@ static const struct wmi_ops wmi_ops = {
+@@ -9138,6 +9181,9 @@ static const struct wmi_ops wmi_ops = {
.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
.gen_echo = ath10k_wmi_op_gen_echo,
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
-@@ -9230,6 +9276,8 @@ static const struct wmi_ops wmi_10_1_ops
+@@ -9208,6 +9254,8 @@ static const struct wmi_ops wmi_10_1_ops
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
.gen_echo = ath10k_wmi_op_gen_echo,
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
-@@ -9302,6 +9350,8 @@ static const struct wmi_ops wmi_10_2_ops
+@@ -9280,6 +9328,8 @@ static const struct wmi_ops wmi_10_2_ops
.gen_delba_send = ath10k_wmi_op_gen_delba_send,
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
/* .gen_pdev_enable_adaptive_cca not implemented */
};
-@@ -9373,6 +9423,8 @@ static const struct wmi_ops wmi_10_2_4_o
+@@ -9351,6 +9401,8 @@ static const struct wmi_ops wmi_10_2_4_o
ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing,
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
-@@ -9454,6 +9506,8 @@ static const struct wmi_ops wmi_10_4_ops
+@@ -9432,6 +9484,8 @@ static const struct wmi_ops wmi_10_4_ops
.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
.gen_echo = ath10k_wmi_op_gen_echo,
.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
-@@ -1309,6 +1309,10 @@ struct ath10k {
+@@ -1312,6 +1312,10 @@ struct ath10k {
s32 tx_power_2g_limit;
s32 tx_power_5g_limit;
if (ret)
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -10284,7 +10284,7 @@ int ath10k_mac_register(struct ath10k *a
+@@ -10292,7 +10292,7 @@ int ath10k_mac_register(struct ath10k *a
ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
#ifdef CPTCFG_MAC80211_LEDS
#include <linux/property.h>
#include <linux/dmi.h>
#include <linux/ctype.h>
-@@ -3407,6 +3408,8 @@ static int ath10k_core_probe_fw(struct a
+@@ -3398,6 +3399,8 @@ static int ath10k_core_probe_fw(struct a
device_get_mac_address(ar->dev, ar->mac_addr);
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
-@@ -10080,7 +10080,6 @@ int ath10k_mac_register(struct ath10k *a
+@@ -10088,7 +10088,6 @@ int ath10k_mac_register(struct ath10k *a
ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA);
ieee80211_hw_set(ar->hw, QUEUE_CONTROL);
ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG);
--- /dev/null
+From ed3725e15a154ebebf44e0c34806c57525483f92 Mon Sep 17 00:00:00 2001
+From: Rahul Bhattacharjee <quic_rbhattac@quicinc.com>
+Date: Fri, 21 Oct 2022 14:31:26 +0530
+Subject: [PATCH] wifi: ath11k: Fix qmi_msg_handler data structure
+ initialization
+
+qmi_msg_handler is required to be null terminated by QMI module.
+There might be a case where a handler for a msg id is not present in the
+handlers array which can lead to infinite loop while searching the handler
+and therefore out of bound access in qmi_invoke_handler().
+Hence update the initialization in qmi_msg_handler data structure.
+
+Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
+
+Signed-off-by: Rahul Bhattacharjee <quic_rbhattac@quicinc.com>
+Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
+Link: https://lore.kernel.org/r/20221021090126.28626-1-quic_rbhattac@quicinc.com
+---
+ drivers/net/wireless/ath/ath11k/qmi.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/wireless/ath/ath11k/qmi.c
++++ b/drivers/net/wireless/ath/ath11k/qmi.c
+@@ -1702,6 +1702,9 @@ static const struct qmi_elem_info qmi_wl
+ .data_type = QMI_EOTI,
+ .array_type = NO_ARRAY,
+ },
++
++ /* end of list */
++ {},
+ };
+
+ static int ath11k_qmi_host_cap_send(struct ath11k_base *ab)
+++ /dev/null
-From 81e60b2dfb2744ab6642c4aa62534b4f711fdc5d Mon Sep 17 00:00:00 2001
-From: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Date: Tue, 27 Sep 2022 09:18:54 +0300
-Subject: [PATCH] wifi: ath11k: stop tx queues immediately upon firmware exit
-
-Currently, recovery flag is set immediately upon firmware
-exit but tx queues are stopped once firmware arrives back
-and is ready which is during ath11k_core_restart. Once
-ieee80211 hw restart is completed, tx queues are resumed.
-If during the time delta between firmware exit and firmware
-ready, mac80211 send packets, currently ath11k will drop it
-since recovery flag will be set. But warning prints will
-come -
- "ath11k c000000.wifi: failed to transmit frame -108"
-
-If more tx packets are there, this could lead to flooding
-of above print.
-
-However, actually tx queues should be stopped immediately
-when firmware leaves. This will prevent packets to get
-dropped when firmware is recovering.
-
-Add fix to stop tx queues immediately after firmware exit.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20220923170235.18873-1-quic_adisi@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 5 +----
- drivers/net/wireless/ath/ath11k/core.h | 1 +
- drivers/net/wireless/ath/ath11k/qmi.c | 3 +++
- 3 files changed, 5 insertions(+), 4 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -1641,7 +1641,7 @@ static void ath11k_update_11d(struct wor
- }
- }
-
--static void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab)
-+void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab)
- {
- struct ath11k *ar;
- struct ath11k_pdev *pdev;
-@@ -1730,9 +1730,6 @@ static void ath11k_core_restart(struct w
- struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work);
- int ret;
-
-- if (!ab->is_reset)
-- ath11k_core_pre_reconfigure_recovery(ab);
--
- ret = ath11k_core_reconfigure_on_crash(ab);
- if (ret) {
- ath11k_err(ab, "failed to reconfigure driver on crash recovery\n");
---- a/drivers/net/wireless/ath/ath11k/core.h
-+++ b/drivers/net/wireless/ath/ath11k/core.h
-@@ -1158,6 +1158,7 @@ int ath11k_core_check_smbios(struct ath1
- void ath11k_core_halt(struct ath11k *ar);
- int ath11k_core_resume(struct ath11k_base *ab);
- int ath11k_core_suspend(struct ath11k_base *ab);
-+void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab);
-
- const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
- const char *filename);
---- a/drivers/net/wireless/ath/ath11k/qmi.c
-+++ b/drivers/net/wireless/ath/ath11k/qmi.c
-@@ -3164,6 +3164,9 @@ static void ath11k_qmi_driver_event_work
- case ATH11K_QMI_EVENT_SERVER_EXIT:
- set_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags);
- set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags);
-+
-+ if (!ab->is_reset)
-+ ath11k_core_pre_reconfigure_recovery(ab);
- break;
- case ATH11K_QMI_EVENT_REQUEST_MEM:
- ret = ath11k_qmi_event_mem_request(qmi);
+++ /dev/null
-From 45d2e268369b0c768d5a644f319758bcfd370521 Mon Sep 17 00:00:00 2001
-From: Baochen Qiang <quic_bqiang@quicinc.com>
-Date: Wed, 28 Sep 2022 09:51:40 +0800
-Subject: [PATCH] wifi: ath11k: Don't exit on wakeup failure
-
-Currently, ath11k_pcic_read() returns an error if wakeup()
-fails, this makes firmware crash debug quite hard because we can
-get nothing.
-
-Change to go ahead on wakeup failure, in that case we still may
-get something valid to check. There should be no mislead due
-to incorrect content because we are aware of the failure with the
-log printed.
-
-Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
-
-Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20220928015140.5431-1-quic_bqiang@quicinc.com
----
- drivers/net/wireless/ath/ath11k/pcic.c | 13 ++++++++++---
- 1 file changed, 10 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/pcic.c
-+++ b/drivers/net/wireless/ath/ath11k/pcic.c
-@@ -218,9 +218,16 @@ int ath11k_pcic_read(struct ath11k_base
- if (wakeup_required && ab->pci.ops->wakeup) {
- ret = ab->pci.ops->wakeup(ab);
- if (ret) {
-- ath11k_warn(ab, "failed to wakeup for read from 0x%x: %d\n",
-- start, ret);
-- return ret;
-+ ath11k_warn(ab,
-+ "wakeup failed, data may be invalid: %d",
-+ ret);
-+ /* Even though wakeup() failed, continue processing rather
-+ * than returning because some parts of the data may still
-+ * be valid and useful in some cases, e.g. could give us
-+ * some clues on firmware crash.
-+ * Mislead due to invalid data could be avoided because we
-+ * are aware of the wakeup failure.
-+ */
- }
- }
-
--- /dev/null
+From 7c15430822e71e90203d87e6d0cfe83fa058b0dc Mon Sep 17 00:00:00 2001
+From: Len Brown <len.brown@intel.com>
+Date: Wed, 1 Feb 2023 12:32:01 -0600
+Subject: [PATCH] wifi: ath11k: allow system suspend to survive ath11k
+
+When ath11k runs into internal errors upon suspend,
+it returns an error code to pci_pm_suspend, which
+aborts the entire system suspend.
+
+The driver should not abort system suspend, but should
+keep its internal errors to itself, and allow the system
+to suspend. Otherwise, a user can suspend a laptop
+by closing the lid and sealing it into a case, assuming
+that is will suspend, rather than heating up and draining
+the battery when in transit.
+
+In practice, the ath11k device seems to have plenty of transient
+errors, and subsequent suspend cycles after this failure
+often succeed.
+
+https://bugzilla.kernel.org/show_bug.cgi?id=216968
+
+Fixes: d1b0c33850d29 ("ath11k: implement suspend for QCA6390 PCI devices")
+
+Signed-off-by: Len Brown <len.brown@intel.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://lore.kernel.org/r/20230201183201.14431-1-len.brown@intel.com
+---
+ drivers/net/wireless/ath/ath11k/pci.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/ath/ath11k/pci.c
++++ b/drivers/net/wireless/ath/ath11k/pci.c
+@@ -998,7 +998,7 @@ static __maybe_unused int ath11k_pci_pm_
+ if (ret)
+ ath11k_warn(ab, "failed to resume core: %d\n", ret);
+
+- return ret;
++ return 0;
+ }
+
+ static SIMPLE_DEV_PM_OPS(ath11k_pci_pm_ops,
+++ /dev/null
-From a797f479bf3e02c6d179c2e6aeace7f9b22b0acd Mon Sep 17 00:00:00 2001
-From: Colin Ian King <colin.i.king@gmail.com>
-Date: Wed, 28 Sep 2022 15:38:34 +0100
-Subject: [PATCH] wifi: ath11k: Fix spelling mistake "chnange" -> "change"
-
-There is a spelling mistake in an ath11k_dbg debug message. Fix it.
-
-Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20220928143834.35189-1-colin.i.king@gmail.com
----
- drivers/net/wireless/ath/ath11k/wmi.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -6829,7 +6829,7 @@ static void ath11k_wmi_event_peer_sta_ps
- }
-
- ath11k_dbg(ab, ATH11K_DBG_WMI,
-- "peer sta ps chnange ev addr %pM state %u sup_bitmap %x ps_valid %u ts %u\n",
-+ "peer sta ps change ev addr %pM state %u sup_bitmap %x ps_valid %u ts %u\n",
- ev->peer_macaddr.addr, ev->peer_ps_state,
- ev->ps_supported_bitmap, ev->peer_ps_valid,
- ev->peer_ps_timestamp);
+++ /dev/null
-From 638b26652b0438563a76ec90014c8cba34db982b Mon Sep 17 00:00:00 2001
-From: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
-Date: Thu, 6 Oct 2022 06:28:42 +0530
-Subject: [PATCH 7/9] wifi: ath11k: suppress add interface error
-
-In the VIF (other than monitor type) creation request, we should not
-throw the error code when the monitor VIF creation fails, since the
-actual VIF creation succeeds. If we throw the error code from driver
-then the actual VIF creation get fail. So suppress the monitor VIF
-creation error by throwing warning message instead of error code.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.6.0.1-00760-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221006005842.8599-1-quic_periyasa@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 9 +++------
- 1 file changed, 3 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -6421,18 +6421,16 @@ static int ath11k_mac_op_add_interface(s
-
- ath11k_dp_vdev_tx_attach(ar, arvif);
-
-+ ath11k_debugfs_add_interface(arvif);
-+
- if (vif->type != NL80211_IFTYPE_MONITOR &&
- test_bit(ATH11K_FLAG_MONITOR_CONF_ENABLED, &ar->monitor_flags)) {
- ret = ath11k_mac_monitor_vdev_create(ar);
-- if (ret) {
-+ if (ret)
- ath11k_warn(ar->ab, "failed to create monitor vdev during add interface: %d",
- ret);
-- goto err_peer_del;
-- }
- }
-
-- ath11k_debugfs_add_interface(arvif);
--
- mutex_unlock(&ar->conf_mutex);
-
- return 0;
-@@ -6457,7 +6455,6 @@ err_vdev_del:
- spin_unlock_bh(&ar->data_lock);
-
- err:
-- ath11k_debugfs_remove_interface(arvif);
- mutex_unlock(&ar->conf_mutex);
-
- return ret;
+++ /dev/null
-From c362daa213cdeb0a9e7c2ed84849544c24505720 Mon Sep 17 00:00:00 2001
-From: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
-Date: Fri, 7 Oct 2022 10:41:30 +0530
-Subject: [PATCH 8/9] wifi: ath11k: add support to configure channel dwell time
-
-Add support to configure channel dwell time during scan.
-Dwell time help to stay on the channel for a specified duration
-during scan and aid userspace in finding WiFi networks. Very
-useful in passive scans where longer dwell times are needed
-to find the WiFi networks.
-
-Configure channel dwell time from duration of the scan request
-received from mac80211 when the duration is non-zero. When the
-scan request does not have duration value, use the default ones,
-the current implementation.
-
-Advertise corresponding feature flag NL80211_EXT_FEATURE_SET_SCAN_DWELL
-to enable the feature.
-
-Change is applicable for all ath11k hardware.
-
-Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
-
-Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
-Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221007051130.6067-1-quic_mpubbise@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 33 +++++++++++++++++++++++----
- 1 file changed, 29 insertions(+), 4 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -241,7 +241,10 @@ const struct htt_rx_ring_tlv_filter ath1
- #define ath11k_a_rates (ath11k_legacy_rates + 4)
- #define ath11k_a_rates_size (ARRAY_SIZE(ath11k_legacy_rates) - 4)
-
--#define ATH11K_MAC_SCAN_TIMEOUT_MSECS 200 /* in msecs */
-+#define ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD 200 /* in msecs */
-+
-+/* Overhead due to the processing of channel switch events from FW */
-+#define ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD 10 /* in msecs */
-
- static const u32 ath11k_smps_map[] = {
- [WLAN_HT_CAP_SM_PS_STATIC] = WMI_PEER_SMPS_STATIC,
-@@ -3612,6 +3615,7 @@ static int ath11k_mac_op_hw_scan(struct
- struct scan_req_params arg;
- int ret = 0;
- int i;
-+ u32 scan_timeout;
-
- mutex_lock(&ar->conf_mutex);
-
-@@ -3681,6 +3685,26 @@ static int ath11k_mac_op_hw_scan(struct
- ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask);
- }
-
-+ /* if duration is set, default dwell times will be overwritten */
-+ if (req->duration) {
-+ arg.dwell_time_active = req->duration;
-+ arg.dwell_time_active_2g = req->duration;
-+ arg.dwell_time_active_6g = req->duration;
-+ arg.dwell_time_passive = req->duration;
-+ arg.dwell_time_passive_6g = req->duration;
-+ arg.burst_duration = req->duration;
-+
-+ scan_timeout = min_t(u32, arg.max_rest_time *
-+ (arg.num_chan - 1) + (req->duration +
-+ ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) *
-+ arg.num_chan, arg.max_scan_time);
-+ } else {
-+ scan_timeout = arg.max_scan_time;
-+ }
-+
-+ /* Add a margin to account for event/command processing */
-+ scan_timeout += ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD;
-+
- ret = ath11k_start_scan(ar, &arg);
- if (ret) {
- ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret);
-@@ -3689,10 +3713,8 @@ static int ath11k_mac_op_hw_scan(struct
- spin_unlock_bh(&ar->data_lock);
- }
-
-- /* Add a 200ms margin to account for event/command processing */
- ieee80211_queue_delayed_work(ar->hw, &ar->scan.timeout,
-- msecs_to_jiffies(arg.max_scan_time +
-- ATH11K_MAC_SCAN_TIMEOUT_MSECS));
-+ msecs_to_jiffies(scan_timeout));
-
- exit:
- kfree(arg.chan_list);
-@@ -9060,6 +9082,9 @@ static int __ath11k_mac_register(struct
- NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP);
- }
-
-+ wiphy_ext_feature_set(ar->hw->wiphy,
-+ NL80211_EXT_FEATURE_SET_SCAN_DWELL);
-+
- ath11k_reg_init(ar);
-
- if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) {
+++ /dev/null
-From 3811fa1f231f1a3e29759efef4992116604aab8b Mon Sep 17 00:00:00 2001
-From: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
-Date: Tue, 11 Oct 2022 15:23:46 +0530
-Subject: [PATCH] wifi: ath11k: Fix firmware crash on vdev delete race
- condition
-
-Current code does not wait for vdev delete completion on vdev create
-failures and tries to send another vdev create followed by vdev set
-param to firmware with same vdev id. This causes firmware crash.
-Fix this crash by waiting for vdev delete completion on vdev
-create failures.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.6.0.1-00905-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221011095346.3901-1-quic_ssreeela@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 60 +++++++++++++++++----------
- 1 file changed, 37 insertions(+), 23 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -6233,6 +6233,40 @@ void ath11k_mac_11d_scan_stop_all(struct
- }
- }
-
-+static int ath11k_mac_vdev_delete(struct ath11k *ar, struct ath11k_vif *arvif)
-+{
-+ unsigned long time_left;
-+ struct ieee80211_vif *vif = arvif->vif;
-+ int ret = 0;
-+
-+ lockdep_assert_held(&ar->conf_mutex);
-+
-+ reinit_completion(&ar->vdev_delete_done);
-+
-+ ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id);
-+ if (ret) {
-+ ath11k_warn(ar->ab, "failed to delete WMI vdev %d: %d\n",
-+ arvif->vdev_id, ret);
-+ return ret;
-+ }
-+
-+ time_left = wait_for_completion_timeout(&ar->vdev_delete_done,
-+ ATH11K_VDEV_DELETE_TIMEOUT_HZ);
-+ if (time_left == 0) {
-+ ath11k_warn(ar->ab, "Timeout in receiving vdev delete response\n");
-+ return -ETIMEDOUT;
-+ }
-+
-+ ar->ab->free_vdev_map |= 1LL << (arvif->vdev_id);
-+ ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id);
-+ ar->num_created_vdevs--;
-+
-+ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n",
-+ vif->addr, arvif->vdev_id);
-+
-+ return ret;
-+}
-+
- static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif)
- {
-@@ -6468,10 +6502,7 @@ err_peer_del:
- }
-
- err_vdev_del:
-- ath11k_wmi_vdev_delete(ar, arvif->vdev_id);
-- ar->num_created_vdevs--;
-- ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id);
-- ab->free_vdev_map |= 1LL << arvif->vdev_id;
-+ ath11k_mac_vdev_delete(ar, arvif);
- spin_lock_bh(&ar->data_lock);
- list_del(&arvif->list);
- spin_unlock_bh(&ar->data_lock);
-@@ -6499,7 +6530,6 @@ static void ath11k_mac_op_remove_interfa
- struct ath11k *ar = hw->priv;
- struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
- struct ath11k_base *ab = ar->ab;
-- unsigned long time_left;
- int ret;
- int i;
-
-@@ -6520,29 +6550,13 @@ static void ath11k_mac_op_remove_interfa
- arvif->vdev_id, ret);
- }
-
-- reinit_completion(&ar->vdev_delete_done);
--
-- ret = ath11k_wmi_vdev_delete(ar, arvif->vdev_id);
-+ ret = ath11k_mac_vdev_delete(ar, arvif);
- if (ret) {
-- ath11k_warn(ab, "failed to delete WMI vdev %d: %d\n",
-+ ath11k_warn(ab, "failed to delete vdev %d: %d\n",
- arvif->vdev_id, ret);
- goto err_vdev_del;
- }
-
-- time_left = wait_for_completion_timeout(&ar->vdev_delete_done,
-- ATH11K_VDEV_DELETE_TIMEOUT_HZ);
-- if (time_left == 0) {
-- ath11k_warn(ab, "Timeout in receiving vdev delete response\n");
-- goto err_vdev_del;
-- }
--
-- ab->free_vdev_map |= 1LL << (arvif->vdev_id);
-- ar->allocated_vdev_map &= ~(1LL << arvif->vdev_id);
-- ar->num_created_vdevs--;
--
-- ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n",
-- vif->addr, arvif->vdev_id);
--
- if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
- clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags);
- ar->monitor_vdev_id = -1;
+++ /dev/null
-From f3ca72b0327101a074a871539e61775d43908ca4 Mon Sep 17 00:00:00 2001
-From: Nagarajan Maran <quic_nmaran@quicinc.com>
-Date: Fri, 14 Oct 2022 21:20:54 +0530
-Subject: [PATCH] wifi: ath11k: fix monitor vdev creation with firmware
- recovery
-
-During firmware recovery, the monitor interface is not
-getting created in the driver and firmware since
-the respective flags are not updated properly.
-
-So after firmware recovery is successful, when monitor
-interface is brought down manually, firmware assertion
-is observed, since we are trying to bring down the
-interface which is not yet created in the firmware.
-
-Fix this by updating the monitor flags properly per
-phy#, during firmware recovery.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Nagarajan Maran <quic_nmaran@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221014155054.11471-1-quic_nmaran@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -1677,6 +1677,10 @@ void ath11k_core_pre_reconfigure_recover
- ath11k_mac_tx_mgmt_pending_free, ar);
- idr_destroy(&ar->txmgmt_idr);
- wake_up(&ar->txmgmt_empty_waitq);
-+
-+ ar->monitor_vdev_id = -1;
-+ clear_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags);
-+ clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags);
- }
-
- wake_up(&ab->wmi_ab.tx_credits_wq);
+++ /dev/null
-From ed3725e15a154ebebf44e0c34806c57525483f92 Mon Sep 17 00:00:00 2001
-From: Rahul Bhattacharjee <quic_rbhattac@quicinc.com>
-Date: Fri, 21 Oct 2022 14:31:26 +0530
-Subject: [PATCH] wifi: ath11k: Fix qmi_msg_handler data structure
- initialization
-
-qmi_msg_handler is required to be null terminated by QMI module.
-There might be a case where a handler for a msg id is not present in the
-handlers array which can lead to infinite loop while searching the handler
-and therefore out of bound access in qmi_invoke_handler().
-Hence update the initialization in qmi_msg_handler data structure.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Rahul Bhattacharjee <quic_rbhattac@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221021090126.28626-1-quic_rbhattac@quicinc.com
----
- drivers/net/wireless/ath/ath11k/qmi.c | 3 +++
- 1 file changed, 3 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/qmi.c
-+++ b/drivers/net/wireless/ath/ath11k/qmi.c
-@@ -1702,6 +1702,9 @@ static struct qmi_elem_info qmi_wlfw_fw_
- .data_type = QMI_EOTI,
- .array_type = NO_ARRAY,
- },
-+
-+ /* end of list */
-+ {},
- };
-
- static int ath11k_qmi_host_cap_send(struct ath11k_base *ab)
+++ /dev/null
-From dd1c2322694522f674c874f5fa02ac5ae39135dd Mon Sep 17 00:00:00 2001
-From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
-Date: Mon, 31 Oct 2022 12:43:41 +0100
-Subject: [PATCH] wifi: ath11k: synchronize
- ath11k_mac_he_gi_to_nl80211_he_gi()'s return type
-
-ath11k_mac_he_gi_to_nl80211_he_gi() generates a valid warning with gcc-13:
- drivers/net/wireless/ath/ath11k/mac.c:321:20: error: conflicting types for 'ath11k_mac_he_gi_to_nl80211_he_gi' due to enum/integer mismatch; have 'enum nl80211_he_gi(u8)'
- drivers/net/wireless/ath/ath11k/mac.h:166:5: note: previous declaration of 'ath11k_mac_he_gi_to_nl80211_he_gi' with type 'u32(u8)'
-
-I.e. the type of the return value ath11k_mac_he_gi_to_nl80211_he_gi() in
-the declaration is u32, while the definition spells enum nl80211_he_gi.
-Synchronize them to the latter.
-
-Cc: Martin Liska <mliska@suse.cz>
-Cc: Kalle Valo <kvalo@kernel.org>
-Cc: "David S. Miller" <davem@davemloft.net>
-Cc: Eric Dumazet <edumazet@google.com>
-Cc: Jakub Kicinski <kuba@kernel.org>
-Cc: Paolo Abeni <pabeni@redhat.com>
-Cc: ath11k@lists.infradead.org
-Cc: linux-wireless@vger.kernel.org
-Cc: netdev@vger.kernel.org
-Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
-Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221031114341.10377-1-jirislaby@kernel.org
----
- drivers/net/wireless/ath/ath11k/mac.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.h
-+++ b/drivers/net/wireless/ath/ath11k/mac.h
-@@ -163,7 +163,7 @@ void ath11k_mac_drain_tx(struct ath11k *
- void ath11k_mac_peer_cleanup_all(struct ath11k *ar);
- int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx);
- u8 ath11k_mac_bw_to_mac80211_bw(u8 bw);
--u32 ath11k_mac_he_gi_to_nl80211_he_gi(u8 sgi);
-+enum nl80211_he_gi ath11k_mac_he_gi_to_nl80211_he_gi(u8 sgi);
- enum nl80211_he_ru_alloc ath11k_mac_phy_he_ru_to_nl80211_he_ru_alloc(u16 ru_phy);
- enum nl80211_he_ru_alloc ath11k_mac_he_ru_tones_to_nl80211_he_ru_alloc(u16 ru_tones);
- enum ath11k_supported_bw ath11k_mac_mac80211_bw_to_ath11k_bw(enum rate_info_bw bw);
+++ /dev/null
-From 93c1592889fca46d09d833455628bab05516cdbf Mon Sep 17 00:00:00 2001
-From: Jeff Johnson <quic_jjohnson@quicinc.com>
-Date: Wed, 14 Sep 2022 17:23:03 -0700
-Subject: [PATCH] wifi: ath11k: Make QMI message rules const
-
-Commit ff6d365898d4 ("soc: qcom: qmi: use const for struct
-qmi_elem_info") allows QMI message encoding/decoding rules to be
-const, so do that for ath11k.
-
-Compile tested only.
-
-Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20220915002303.12206-1-quic_jjohnson@quicinc.com
----
- drivers/net/wireless/ath/ath11k/qmi.c | 72 +++++++++++++--------------
- 1 file changed, 36 insertions(+), 36 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/qmi.c
-+++ b/drivers/net/wireless/ath/ath11k/qmi.c
-@@ -29,7 +29,7 @@ module_param_named(cold_boot_cal, ath11k
- MODULE_PARM_DESC(cold_boot_cal,
- "Decrease the channel switch time but increase the driver load time (Default: true)");
-
--static struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = {
- {
- .data_type = QMI_OPT_FLAG,
- .elem_len = 1,
-@@ -280,7 +280,7 @@ static struct qmi_elem_info qmi_wlanfw_h
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -297,7 +297,7 @@ static struct qmi_elem_info qmi_wlanfw_h
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei[] = {
- {
- .data_type = QMI_OPT_FLAG,
- .elem_len = 1,
-@@ -522,7 +522,7 @@ static struct qmi_elem_info qmi_wlanfw_i
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -558,7 +558,7 @@ static struct qmi_elem_info qmi_wlanfw_i
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_8_BYTE,
- .elem_len = 1,
-@@ -590,7 +590,7 @@ static struct qmi_elem_info qmi_wlanfw_m
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_4_BYTE,
- .elem_len = 1,
-@@ -632,7 +632,7 @@ static struct qmi_elem_info qmi_wlanfw_m
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei[] = {
- {
- .data_type = QMI_DATA_LEN,
- .elem_len = 1,
-@@ -659,7 +659,7 @@ static struct qmi_elem_info qmi_wlanfw_r
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_8_BYTE,
- .elem_len = 1,
-@@ -699,7 +699,7 @@ static struct qmi_elem_info qmi_wlanfw_m
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei[] = {
- {
- .data_type = QMI_DATA_LEN,
- .elem_len = 1,
-@@ -726,7 +726,7 @@ static struct qmi_elem_info qmi_wlanfw_r
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -744,7 +744,7 @@ static struct qmi_elem_info qmi_wlanfw_r
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei[] = {
- {
- .data_type = QMI_EOTI,
- .array_type = NO_ARRAY,
-@@ -752,7 +752,7 @@ static struct qmi_elem_info qmi_wlanfw_c
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_device_info_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_device_info_req_msg_v01_ei[] = {
- {
- .data_type = QMI_EOTI,
- .array_type = NO_ARRAY,
-@@ -760,7 +760,7 @@ static struct qmi_elem_info qmi_wlanfw_d
- },
- };
-
--static struct qmi_elem_info qmi_wlfw_device_info_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlfw_device_info_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -814,7 +814,7 @@ static struct qmi_elem_info qmi_wlfw_dev
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_4_BYTE,
- .elem_len = 1,
-@@ -840,7 +840,7 @@ static struct qmi_elem_info qmi_wlanfw_r
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_4_BYTE,
- .elem_len = 1,
-@@ -857,7 +857,7 @@ static struct qmi_elem_info qmi_wlanfw_r
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_4_BYTE,
- .elem_len = 1,
-@@ -873,7 +873,7 @@ static struct qmi_elem_info qmi_wlanfw_s
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_4_BYTE,
- .elem_len = 1,
-@@ -899,7 +899,7 @@ static struct qmi_elem_info qmi_wlanfw_f
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -1100,7 +1100,7 @@ static struct qmi_elem_info qmi_wlanfw_c
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_1_BYTE,
- .elem_len = 1,
-@@ -1235,7 +1235,7 @@ static struct qmi_elem_info qmi_wlanfw_b
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -1253,7 +1253,7 @@ static struct qmi_elem_info qmi_wlanfw_b
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_8_BYTE,
- .elem_len = 1,
-@@ -1277,7 +1277,7 @@ static struct qmi_elem_info qmi_wlanfw_m
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -1294,7 +1294,7 @@ static struct qmi_elem_info qmi_wlanfw_m
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_4_BYTE,
- .elem_len = 1,
-@@ -1347,7 +1347,7 @@ static struct qmi_elem_info qmi_wlanfw_c
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_4_BYTE,
- .elem_len = 1,
-@@ -1382,7 +1382,7 @@ static struct qmi_elem_info qmi_wlanfw_c
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_2_BYTE,
- .elem_len = 1,
-@@ -1406,7 +1406,7 @@ static struct qmi_elem_info qmi_wlanfw_s
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_4_BYTE,
- .elem_len = 1,
-@@ -1423,7 +1423,7 @@ static struct qmi_elem_info qmi_wlanfw_s
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei[] = {
- {
- .data_type = QMI_UNSIGNED_4_BYTE,
- .elem_len = 1,
-@@ -1458,7 +1458,7 @@ static struct qmi_elem_info qmi_wlanfw_w
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -1476,7 +1476,7 @@ static struct qmi_elem_info qmi_wlanfw_w
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei[] = {
- {
- .data_type = QMI_OPT_FLAG,
- .elem_len = 1,
-@@ -1615,7 +1615,7 @@ static struct qmi_elem_info qmi_wlanfw_w
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -1632,28 +1632,28 @@ static struct qmi_elem_info qmi_wlanfw_w
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei[] = {
- {
- .data_type = QMI_EOTI,
- .array_type = NO_ARRAY,
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei[] = {
- {
- .data_type = QMI_EOTI,
- .array_type = NO_ARRAY,
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei[] = {
- {
- .data_type = QMI_EOTI,
- .array_type = NO_ARRAY,
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_wlan_ini_req_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_wlan_ini_req_msg_v01_ei[] = {
- {
- .data_type = QMI_OPT_FLAG,
- .elem_len = 1,
-@@ -1679,7 +1679,7 @@ static struct qmi_elem_info qmi_wlanfw_w
- },
- };
-
--static struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = {
- {
- .data_type = QMI_STRUCT,
- .elem_len = 1,
-@@ -1697,7 +1697,7 @@ static struct qmi_elem_info qmi_wlanfw_w
- },
- };
-
--static struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = {
-+static const struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = {
- {
- .data_type = QMI_EOTI,
- .array_type = NO_ARRAY,
+++ /dev/null
-From a018750a2cceaf4427c4ee3d9ce3e83a171d5bd6 Mon Sep 17 00:00:00 2001
-From: Youghandhar Chintala <quic_youghand@quicinc.com>
-Date: Fri, 4 Nov 2022 14:24:03 +0530
-Subject: [PATCH] wifi: ath11k: Trigger sta disconnect on hardware restart
-
-Currently after the hardware restart triggered from the driver, the
-station interface connection remains intact, since a disconnect trigger
-is not sent to userspace. This can lead to a problem in targets where
-the wifi mac sequence is added by the firmware.
-
-After the target restart, its wifi mac sequence number gets reset to
-zero. Hence AP to which our device is connected will receive frames with
-a wifi mac sequence number jump to the past, thereby resulting in the
-AP dropping all these frames, until the frame arrives with a wifi mac
-sequence number which AP was expecting.
-
-To avoid such frame drops, its better to trigger a station disconnect
-upon target hardware restart which can be done with API
-ieee80211_reconfig_disconnect exposed to mac80211.
-
-The other targets are not affected by this change, since the hardware
-params flag is not set.
-
-Reported-by: kernel test robot <lkp@intel.com>
-
-Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
-
-Signed-off-by: Youghandhar Chintala <quic_youghand@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221104085403.11025-1-quic_youghand@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 6 ++++++
- drivers/net/wireless/ath/ath11k/hw.h | 1 +
- drivers/net/wireless/ath/ath11k/mac.c | 7 +++++++
- 3 files changed, 14 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -195,6 +195,7 @@ static const struct ath11k_hw_params ath
- .tcl_ring_retry = true,
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
-+ .support_fw_mac_sequence = false,
- },
- {
- .name = "qca6390 hw2.0",
-@@ -277,6 +278,7 @@ static const struct ath11k_hw_params ath
- .tcl_ring_retry = true,
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
-+ .support_fw_mac_sequence = true,
- },
- {
- .name = "qcn9074 hw1.0",
-@@ -356,6 +358,7 @@ static const struct ath11k_hw_params ath
- .tcl_ring_retry = true,
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
-+ .support_fw_mac_sequence = false,
- },
- {
- .name = "wcn6855 hw2.0",
-@@ -438,6 +441,7 @@ static const struct ath11k_hw_params ath
- .tcl_ring_retry = true,
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
-+ .support_fw_mac_sequence = true,
- },
- {
- .name = "wcn6855 hw2.1",
-@@ -519,6 +523,7 @@ static const struct ath11k_hw_params ath
- .tcl_ring_retry = true,
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
-+ .support_fw_mac_sequence = true,
- },
- {
- .name = "wcn6750 hw1.0",
-@@ -597,6 +602,7 @@ static const struct ath11k_hw_params ath
- .tcl_ring_retry = false,
- .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750,
- .smp2p_wow_exit = true,
-+ .support_fw_mac_sequence = true,
- },
- };
-
---- a/drivers/net/wireless/ath/ath11k/hw.h
-+++ b/drivers/net/wireless/ath/ath11k/hw.h
-@@ -219,6 +219,7 @@ struct ath11k_hw_params {
- bool tcl_ring_retry;
- u32 tx_ring_size;
- bool smp2p_wow_exit;
-+ bool support_fw_mac_sequence;
- };
-
- struct ath11k_hw_ops {
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -8010,6 +8010,7 @@ ath11k_mac_op_reconfig_complete(struct i
- struct ath11k *ar = hw->priv;
- struct ath11k_base *ab = ar->ab;
- int recovery_count;
-+ struct ath11k_vif *arvif;
-
- if (reconfig_type != IEEE80211_RECONFIG_TYPE_RESTART)
- return;
-@@ -8045,6 +8046,12 @@ ath11k_mac_op_reconfig_complete(struct i
- ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset success\n");
- }
- }
-+ if (ar->ab->hw_params.support_fw_mac_sequence) {
-+ list_for_each_entry(arvif, &ar->arvifs, list) {
-+ if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_STA)
-+ ieee80211_hw_restart_disconnect(arvif->vif);
-+ }
-+ }
- }
-
- mutex_unlock(&ar->conf_mutex);
+++ /dev/null
-From e44de90453bb2b46a523df78c39eb896bab35dcd Mon Sep 17 00:00:00 2001
-From: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
-Date: Tue, 29 Nov 2022 13:04:02 +0200
-Subject: [PATCH] wifi: ath11k: Fix race condition with struct
- htt_ppdu_stats_info
-
-A crash happens when running the traffic with multiple clients:
-
-Crash Signature : Unable to handle kernel paging request at
-virtual address ffffffd700970918 During the crash, PC points to
-"ieee80211_tx_rate_update+0x30/0x68 [mac80211]"
-LR points to "ath11k_dp_htt_htc_t2h_msg_handler+0x5a8/0x8a0 [ath11k]".
-
-Struct ppdu_stats_info is allocated and accessed from event callback via copy
-engine tasklet, this has a problem when freeing it from ath11k_mac_op_stop().
-
-Use data_lock during entire ath11k_dp_htt_get_ppdu_desc() call to protect
-struct htt_ppdu_stats_info access and to avoid race condition when accessing it
-from ath11k_mac_op_stop().
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
-Co-developed-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221124071104.22506-1-quic_kathirve@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dp_rx.c | 22 +++++++++++-----------
- 1 file changed, 11 insertions(+), 11 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
-@@ -1535,13 +1535,12 @@ struct htt_ppdu_stats_info *ath11k_dp_ht
- {
- struct htt_ppdu_stats_info *ppdu_info;
-
-- spin_lock_bh(&ar->data_lock);
-+ lockdep_assert_held(&ar->data_lock);
-+
- if (!list_empty(&ar->ppdu_stats_info)) {
- list_for_each_entry(ppdu_info, &ar->ppdu_stats_info, list) {
-- if (ppdu_info->ppdu_id == ppdu_id) {
-- spin_unlock_bh(&ar->data_lock);
-+ if (ppdu_info->ppdu_id == ppdu_id)
- return ppdu_info;
-- }
- }
-
- if (ar->ppdu_stat_list_depth > HTT_PPDU_DESC_MAX_DEPTH) {
-@@ -1553,16 +1552,13 @@ struct htt_ppdu_stats_info *ath11k_dp_ht
- kfree(ppdu_info);
- }
- }
-- spin_unlock_bh(&ar->data_lock);
-
- ppdu_info = kzalloc(sizeof(*ppdu_info), GFP_ATOMIC);
- if (!ppdu_info)
- return NULL;
-
-- spin_lock_bh(&ar->data_lock);
- list_add_tail(&ppdu_info->list, &ar->ppdu_stats_info);
- ar->ppdu_stat_list_depth++;
-- spin_unlock_bh(&ar->data_lock);
-
- return ppdu_info;
- }
-@@ -1586,16 +1582,17 @@ static int ath11k_htt_pull_ppdu_stats(st
- ar = ath11k_mac_get_ar_by_pdev_id(ab, pdev_id);
- if (!ar) {
- ret = -EINVAL;
-- goto exit;
-+ goto out;
- }
-
- if (ath11k_debugfs_is_pktlog_lite_mode_enabled(ar))
- trace_ath11k_htt_ppdu_stats(ar, skb->data, len);
-
-+ spin_lock_bh(&ar->data_lock);
- ppdu_info = ath11k_dp_htt_get_ppdu_desc(ar, ppdu_id);
- if (!ppdu_info) {
- ret = -EINVAL;
-- goto exit;
-+ goto out_unlock_data;
- }
-
- ppdu_info->ppdu_id = ppdu_id;
-@@ -1604,10 +1601,13 @@ static int ath11k_htt_pull_ppdu_stats(st
- (void *)ppdu_info);
- if (ret) {
- ath11k_warn(ab, "Failed to parse tlv %d\n", ret);
-- goto exit;
-+ goto out_unlock_data;
- }
-
--exit:
-+out_unlock_data:
-+ spin_unlock_bh(&ar->data_lock);
-+
-+out:
- rcu_read_unlock();
-
- return ret;
+++ /dev/null
-From 8dfe875aa24aec68baf6702018633c84c2c1feca Mon Sep 17 00:00:00 2001
-From: Sriram R <quic_srirrama@quicinc.com>
-Date: Fri, 2 Dec 2022 23:37:13 +0200
-Subject: [PATCH] wifi: ath11k: update hw params for IPQ5018
-
-Add new compatible string for IPQ5018 and add
-required hw params for IPQ5018. The hw descriptors size and
-datapath ops are similar to QCN9074, hence reuse the same.
-
-Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
-Co-developed-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221122132152.17771-3-quic_kathirve@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 71 ++++++++++++++++++++++++++
- drivers/net/wireless/ath/ath11k/core.h | 8 +++
- 2 files changed, 79 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -604,6 +604,77 @@ static const struct ath11k_hw_params ath
- .smp2p_wow_exit = true,
- .support_fw_mac_sequence = true,
- },
-+ {
-+ .hw_rev = ATH11K_HW_IPQ5018_HW10,
-+ .name = "ipq5018 hw1.0",
-+ .fw = {
-+ .dir = "IPQ5018/hw1.0",
-+ .board_size = 256 * 1024,
-+ .cal_offset = 128 * 1024,
-+ },
-+ .max_radios = MAX_RADIOS_5018,
-+ .bdf_addr = 0x4BA00000,
-+ /* hal_desc_sz and hw ops are similar to qcn9074 */
-+ .hal_desc_sz = sizeof(struct hal_rx_desc_qcn9074),
-+ .qmi_service_ins_id = ATH11K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ8074,
-+ .ring_mask = &ath11k_hw_ring_mask_ipq8074,
-+ .credit_flow = false,
-+ .max_tx_ring = 1,
-+ .spectral = {
-+ .fft_sz = 2,
-+ .fft_pad_sz = 0,
-+ .summary_pad_sz = 16,
-+ .fft_hdr_len = 24,
-+ .max_fft_bins = 1024,
-+ },
-+ .internal_sleep_clock = false,
-+ .host_ce_config = ath11k_host_ce_config_qcn9074,
-+ .ce_count = CE_CNT_5018,
-+ .rxdma1_enable = true,
-+ .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018,
-+ .rx_mac_buf_ring = false,
-+ .vdev_start_delay = false,
-+ .htt_peer_map_v2 = true,
-+ .interface_modes = BIT(NL80211_IFTYPE_STATION) |
-+ BIT(NL80211_IFTYPE_AP) |
-+ BIT(NL80211_IFTYPE_MESH_POINT),
-+ .supports_monitor = false,
-+ .supports_sta_ps = false,
-+ .supports_shadow_regs = false,
-+ .fw_mem_mode = 0,
-+ .num_vdevs = 16 + 1,
-+ .num_peers = 512,
-+ .supports_regdb = false,
-+ .idle_ps = false,
-+ .supports_suspend = false,
-+ .hal_params = &ath11k_hw_hal_params_ipq8074,
-+ .single_pdev_only = false,
-+ .cold_boot_calib = true,
-+ .fix_l1ss = true,
-+ .supports_dynamic_smps_6ghz = false,
-+ .alloc_cacheable_memory = true,
-+ .supports_rssi_stats = false,
-+ .fw_wmi_diag_event = false,
-+ .current_cc_support = false,
-+ .dbr_debug_support = true,
-+ .global_reset = false,
-+ .bios_sar_capa = NULL,
-+ .m3_fw_support = false,
-+ .fixed_bdf_addr = true,
-+ .fixed_mem_region = true,
-+ .static_window_map = false,
-+ .hybrid_bus_type = false,
-+ .fixed_fw_mem = false,
-+ .support_off_channel_tx = false,
-+ .supports_multi_bssid = false,
-+
-+ .sram_dump = {},
-+
-+ .tcl_ring_retry = true,
-+ .tx_ring_size = DP_TCL_DATA_RING_SIZE,
-+ .smp2p_wow_exit = false,
-+ .support_fw_mac_sequence = false,
-+ },
- };
-
- static inline struct ath11k_pdev *ath11k_core_get_single_pdev(struct ath11k_base *ab)
---- a/drivers/net/wireless/ath/ath11k/core.h
-+++ b/drivers/net/wireless/ath/ath11k/core.h
-@@ -142,6 +142,7 @@ enum ath11k_hw_rev {
- ATH11K_HW_WCN6855_HW20,
- ATH11K_HW_WCN6855_HW21,
- ATH11K_HW_WCN6750_HW10,
-+ ATH11K_HW_IPQ5018_HW10,
- };
-
- enum ath11k_firmware_mode {
-@@ -230,6 +231,13 @@ struct ath11k_he {
-
- #define MAX_RADIOS 3
-
-+/* ipq5018 hw param macros */
-+#define MAX_RADIOS_5018 1
-+#define CE_CNT_5018 6
-+#define TARGET_CE_CNT_5018 9
-+#define SVC_CE_MAP_LEN_5018 17
-+#define RXDMA_PER_PDEV_5018 1
-+
- enum {
- WMI_HOST_TP_SCALE_MAX = 0,
- WMI_HOST_TP_SCALE_50 = 1,
+++ /dev/null
-From 26af7aabd2d8225c6b2056234626ba5099610871 Mon Sep 17 00:00:00 2001
-From: Sriram R <quic_srirrama@quicinc.com>
-Date: Fri, 2 Dec 2022 23:37:14 +0200
-Subject: [PATCH] wifi: ath11k: update ce configurations for IPQ5018
-
-IPQ5018 is a single pdev device. Update host
-and target CE configurations accordingly.
-
-Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
-Co-developed-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221122132152.17771-4-quic_kathirve@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 4 +
- drivers/net/wireless/ath/ath11k/core.h | 3 +
- drivers/net/wireless/ath/ath11k/hw.c | 191 +++++++++++++++++++++++++
- 3 files changed, 198 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -630,6 +630,10 @@ static const struct ath11k_hw_params ath
- .internal_sleep_clock = false,
- .host_ce_config = ath11k_host_ce_config_qcn9074,
- .ce_count = CE_CNT_5018,
-+ .target_ce_config = ath11k_target_ce_config_wlan_ipq5018,
-+ .target_ce_count = TARGET_CE_CNT_5018,
-+ .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq5018,
-+ .svc_to_ce_map_len = SVC_CE_MAP_LEN_5018,
- .rxdma1_enable = true,
- .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018,
- .rx_mac_buf_ring = false,
---- a/drivers/net/wireless/ath/ath11k/core.h
-+++ b/drivers/net/wireless/ath/ath11k/core.h
-@@ -1145,6 +1145,9 @@ extern const struct service_to_pipe ath1
- extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390[];
- extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390[];
-
-+extern const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq5018[];
-+extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq5018[];
-+
- extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qcn9074[];
- extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qcn9074[];
- int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab);
---- a/drivers/net/wireless/ath/ath11k/hw.c
-+++ b/drivers/net/wireless/ath/ath11k/hw.c
-@@ -1972,6 +1972,197 @@ const struct ath11k_hw_ring_mask ath11k_
- },
- };
-
-+/* Target firmware's Copy Engine configuration for IPQ5018 */
-+const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq5018[] = {
-+ /* CE0: host->target HTC control and raw streams */
-+ {
-+ .pipenum = __cpu_to_le32(0),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT),
-+ .nentries = __cpu_to_le32(32),
-+ .nbytes_max = __cpu_to_le32(2048),
-+ .flags = __cpu_to_le32(CE_ATTR_FLAGS),
-+ .reserved = __cpu_to_le32(0),
-+ },
-+
-+ /* CE1: target->host HTT + HTC control */
-+ {
-+ .pipenum = __cpu_to_le32(1),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN),
-+ .nentries = __cpu_to_le32(32),
-+ .nbytes_max = __cpu_to_le32(2048),
-+ .flags = __cpu_to_le32(CE_ATTR_FLAGS),
-+ .reserved = __cpu_to_le32(0),
-+ },
-+
-+ /* CE2: target->host WMI */
-+ {
-+ .pipenum = __cpu_to_le32(2),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN),
-+ .nentries = __cpu_to_le32(32),
-+ .nbytes_max = __cpu_to_le32(2048),
-+ .flags = __cpu_to_le32(CE_ATTR_FLAGS),
-+ .reserved = __cpu_to_le32(0),
-+ },
-+
-+ /* CE3: host->target WMI */
-+ {
-+ .pipenum = __cpu_to_le32(3),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT),
-+ .nentries = __cpu_to_le32(32),
-+ .nbytes_max = __cpu_to_le32(2048),
-+ .flags = __cpu_to_le32(CE_ATTR_FLAGS),
-+ .reserved = __cpu_to_le32(0),
-+ },
-+
-+ /* CE4: host->target HTT */
-+ {
-+ .pipenum = __cpu_to_le32(4),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT),
-+ .nentries = __cpu_to_le32(256),
-+ .nbytes_max = __cpu_to_le32(256),
-+ .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
-+ .reserved = __cpu_to_le32(0),
-+ },
-+
-+ /* CE5: target->host Pktlog */
-+ {
-+ .pipenum = __cpu_to_le32(5),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN),
-+ .nentries = __cpu_to_le32(32),
-+ .nbytes_max = __cpu_to_le32(2048),
-+ .flags = __cpu_to_le32(CE_ATTR_FLAGS),
-+ .reserved = __cpu_to_le32(0),
-+ },
-+
-+ /* CE6: Reserved for target autonomous hif_memcpy */
-+ {
-+ .pipenum = __cpu_to_le32(6),
-+ .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
-+ .nentries = __cpu_to_le32(32),
-+ .nbytes_max = __cpu_to_le32(16384),
-+ .flags = __cpu_to_le32(CE_ATTR_FLAGS),
-+ .reserved = __cpu_to_le32(0),
-+ },
-+
-+ /* CE7 used only by Host */
-+ {
-+ .pipenum = __cpu_to_le32(7),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT),
-+ .nentries = __cpu_to_le32(32),
-+ .nbytes_max = __cpu_to_le32(2048),
-+ .flags = __cpu_to_le32(0x2000),
-+ .reserved = __cpu_to_le32(0),
-+ },
-+
-+ /* CE8 target->host used only by IPA */
-+ {
-+ .pipenum = __cpu_to_le32(8),
-+ .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
-+ .nentries = __cpu_to_le32(32),
-+ .nbytes_max = __cpu_to_le32(16384),
-+ .flags = __cpu_to_le32(CE_ATTR_FLAGS),
-+ .reserved = __cpu_to_le32(0),
-+ },
-+};
-+
-+/* Map from service/endpoint to Copy Engine for IPQ5018.
-+ * This table is derived from the CE TABLE, above.
-+ * It is passed to the Target at startup for use by firmware.
-+ */
-+const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq5018[] = {
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
-+ .pipenum = __cpu_to_le32(3),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
-+ .pipenum = __cpu_to_le32(2),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
-+ .pipenum = __cpu_to_le32(3),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
-+ .pipenum = __cpu_to_le32(2),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
-+ .pipenum = __cpu_to_le32(3),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
-+ .pipenum = __cpu_to_le32(2),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
-+ .pipenum = __cpu_to_le32(3),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
-+ .pipenum = __cpu_to_le32(2),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
-+ .pipenum = __cpu_to_le32(3),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
-+ .pipenum = __cpu_to_le32(2),
-+ },
-+
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
-+ .pipenum = __cpu_to_le32(0),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
-+ .pipenum = __cpu_to_le32(1),
-+ },
-+
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
-+ .pipenum = __cpu_to_le32(0),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
-+ .pipenum = __cpu_to_le32(1),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
-+ .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
-+ .pipenum = __cpu_to_le32(4),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
-+ .pipenum = __cpu_to_le32(1),
-+ },
-+ {
-+ .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG),
-+ .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
-+ .pipenum = __cpu_to_le32(5),
-+ },
-+
-+ /* (Additions here) */
-+
-+ { /* terminator entry */ }
-+};
-+
- const struct ath11k_hw_regs ipq8074_regs = {
- /* SW2TCL(x) R0 ring configuration address */
- .hal_tcl1_ring_base_lsb = 0x00000510,
+++ /dev/null
-From b42b3678c91f3ca6e0888bf5a15c1e8678fd5f2d Mon Sep 17 00:00:00 2001
-From: Sriram R <quic_srirrama@quicinc.com>
-Date: Fri, 2 Dec 2022 23:37:14 +0200
-Subject: [PATCH] wifi: ath11k: remap ce register space for IPQ5018
-
-In IPQ5018 ce register space is moved out of wcss unlike
-ipq8074 or ipq6018 and the space is not contiguous,
-hence remap the CE registers to a new space to access them.
-
-Register read/write is modified to check if the register to be written
-falls in the CE register space and corresponding register is written.
-Also adjust the interrupt register address to ce irq enable/disable.
-
-Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
-Co-developed-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221122132152.17771-5-quic_kathirve@quicinc.com
----
- drivers/net/wireless/ath/ath11k/ahb.c | 44 ++++++++++++++++++++++----
- drivers/net/wireless/ath/ath11k/ce.h | 16 ++++++++++
- drivers/net/wireless/ath/ath11k/core.c | 8 +++++
- drivers/net/wireless/ath/ath11k/core.h | 1 +
- drivers/net/wireless/ath/ath11k/hal.c | 17 ++++++----
- drivers/net/wireless/ath/ath11k/hal.h | 5 +++
- drivers/net/wireless/ath/ath11k/hw.c | 17 ++++++++++
- drivers/net/wireless/ath/ath11k/hw.h | 9 ++++++
- drivers/net/wireless/ath/ath11k/pci.c | 2 ++
- 9 files changed, 107 insertions(+), 12 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/ahb.c
-+++ b/drivers/net/wireless/ath/ath11k/ahb.c
-@@ -267,30 +267,42 @@ static void ath11k_ahb_clearbit32(struct
- static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id)
- {
- const struct ce_attr *ce_attr;
-+ const struct ce_ie_addr *ce_ie_addr = ab->hw_params.ce_ie_addr;
-+ u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr;
-+
-+ ie1_reg_addr = ce_ie_addr->ie1_reg_addr + ATH11K_CE_OFFSET(ab);
-+ ie2_reg_addr = ce_ie_addr->ie2_reg_addr + ATH11K_CE_OFFSET(ab);
-+ ie3_reg_addr = ce_ie_addr->ie3_reg_addr + ATH11K_CE_OFFSET(ab);
-
- ce_attr = &ab->hw_params.host_ce_config[ce_id];
- if (ce_attr->src_nentries)
-- ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_ADDRESS);
-+ ath11k_ahb_setbit32(ab, ce_id, ie1_reg_addr);
-
- if (ce_attr->dest_nentries) {
-- ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS);
-+ ath11k_ahb_setbit32(ab, ce_id, ie2_reg_addr);
- ath11k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT,
-- CE_HOST_IE_3_ADDRESS);
-+ ie3_reg_addr);
- }
- }
-
- static void ath11k_ahb_ce_irq_disable(struct ath11k_base *ab, u16 ce_id)
- {
- const struct ce_attr *ce_attr;
-+ const struct ce_ie_addr *ce_ie_addr = ab->hw_params.ce_ie_addr;
-+ u32 ie1_reg_addr, ie2_reg_addr, ie3_reg_addr;
-+
-+ ie1_reg_addr = ce_ie_addr->ie1_reg_addr + ATH11K_CE_OFFSET(ab);
-+ ie2_reg_addr = ce_ie_addr->ie2_reg_addr + ATH11K_CE_OFFSET(ab);
-+ ie3_reg_addr = ce_ie_addr->ie3_reg_addr + ATH11K_CE_OFFSET(ab);
-
- ce_attr = &ab->hw_params.host_ce_config[ce_id];
- if (ce_attr->src_nentries)
-- ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_ADDRESS);
-+ ath11k_ahb_clearbit32(ab, ce_id, ie1_reg_addr);
-
- if (ce_attr->dest_nentries) {
-- ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS);
-+ ath11k_ahb_clearbit32(ab, ce_id, ie2_reg_addr);
- ath11k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT,
-- CE_HOST_IE_3_ADDRESS);
-+ ie3_reg_addr);
- }
- }
-
-@@ -1142,10 +1154,26 @@ static int ath11k_ahb_probe(struct platf
- goto err_core_free;
- }
-
-+ ab->mem_ce = ab->mem;
-+
- ret = ath11k_core_pre_init(ab);
- if (ret)
- goto err_core_free;
-
-+ if (ab->hw_params.ce_remap) {
-+ const struct ce_remap *ce_remap = ab->hw_params.ce_remap;
-+ /* ce register space is moved out of wcss unlike ipq8074 or ipq6018
-+ * and the space is not contiguous, hence remapping the CE registers
-+ * to a new space for accessing them.
-+ */
-+ ab->mem_ce = ioremap(ce_remap->base, ce_remap->size);
-+ if (IS_ERR(ab->mem_ce)) {
-+ dev_err(&pdev->dev, "ce ioremap error\n");
-+ ret = -ENOMEM;
-+ goto err_core_free;
-+ }
-+ }
-+
- ret = ath11k_ahb_setup_resources(ab);
- if (ret)
- goto err_core_free;
-@@ -1236,6 +1264,10 @@ static void ath11k_ahb_free_resources(st
- ath11k_ahb_release_smp2p_handle(ab);
- ath11k_ahb_fw_resource_deinit(ab);
- ath11k_ce_free_pipes(ab);
-+
-+ if (ab->hw_params.ce_remap)
-+ iounmap(ab->mem_ce);
-+
- ath11k_core_free(ab);
- platform_set_drvdata(pdev, NULL);
- }
---- a/drivers/net/wireless/ath/ath11k/ce.h
-+++ b/drivers/net/wireless/ath/ath11k/ce.h
-@@ -49,6 +49,11 @@ void ath11k_ce_byte_swap(void *mem, u32
- #define CE_HOST_IE_2_ADDRESS 0x00A18040
- #define CE_HOST_IE_3_ADDRESS CE_HOST_IE_ADDRESS
-
-+/* CE IE registers are different for IPQ5018 */
-+#define CE_HOST_IPQ5018_IE_ADDRESS 0x0841804C
-+#define CE_HOST_IPQ5018_IE_2_ADDRESS 0x08418050
-+#define CE_HOST_IPQ5018_IE_3_ADDRESS CE_HOST_IPQ5018_IE_ADDRESS
-+
- #define CE_HOST_IE_3_SHIFT 0xC
-
- #define CE_RING_IDX_INCR(nentries_mask, idx) (((idx) + 1) & (nentries_mask))
-@@ -84,6 +89,17 @@ struct ce_pipe_config {
- __le32 reserved;
- };
-
-+struct ce_ie_addr {
-+ u32 ie1_reg_addr;
-+ u32 ie2_reg_addr;
-+ u32 ie3_reg_addr;
-+};
-+
-+struct ce_remap {
-+ u32 base;
-+ u32 size;
-+};
-+
- struct ce_attr {
- /* CE_ATTR_* values */
- unsigned int flags;
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -54,6 +54,7 @@ static const struct ath11k_hw_params ath
- .target_ce_count = 11,
- .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq8074,
- .svc_to_ce_map_len = 21,
-+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074,
- .single_pdev_only = false,
- .rxdma1_enable = true,
- .num_rxmda_per_pdev = 1,
-@@ -137,6 +138,7 @@ static const struct ath11k_hw_params ath
- .target_ce_count = 11,
- .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq6018,
- .svc_to_ce_map_len = 19,
-+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074,
- .single_pdev_only = false,
- .rxdma1_enable = true,
- .num_rxmda_per_pdev = 1,
-@@ -218,6 +220,7 @@ static const struct ath11k_hw_params ath
- .target_ce_count = 9,
- .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390,
- .svc_to_ce_map_len = 14,
-+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074,
- .single_pdev_only = true,
- .rxdma1_enable = false,
- .num_rxmda_per_pdev = 2,
-@@ -301,6 +304,7 @@ static const struct ath11k_hw_params ath
- .target_ce_count = 9,
- .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qcn9074,
- .svc_to_ce_map_len = 18,
-+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074,
- .rxdma1_enable = true,
- .num_rxmda_per_pdev = 1,
- .rx_mac_buf_ring = false,
-@@ -381,6 +385,7 @@ static const struct ath11k_hw_params ath
- .target_ce_count = 9,
- .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390,
- .svc_to_ce_map_len = 14,
-+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074,
- .single_pdev_only = true,
- .rxdma1_enable = false,
- .num_rxmda_per_pdev = 2,
-@@ -546,6 +551,7 @@ static const struct ath11k_hw_params ath
- .target_ce_count = 9,
- .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_qca6390,
- .svc_to_ce_map_len = 14,
-+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq8074,
- .single_pdev_only = true,
- .rxdma1_enable = false,
- .num_rxmda_per_pdev = 1,
-@@ -634,6 +640,8 @@ static const struct ath11k_hw_params ath
- .target_ce_count = TARGET_CE_CNT_5018,
- .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq5018,
- .svc_to_ce_map_len = SVC_CE_MAP_LEN_5018,
-+ .ce_ie_addr = &ath11k_ce_ie_addr_ipq5018,
-+ .ce_remap = &ath11k_ce_remap_ipq5018,
- .rxdma1_enable = true,
- .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018,
- .rx_mac_buf_ring = false,
---- a/drivers/net/wireless/ath/ath11k/core.h
-+++ b/drivers/net/wireless/ath/ath11k/core.h
-@@ -851,6 +851,7 @@ struct ath11k_base {
- struct ath11k_dp dp;
-
- void __iomem *mem;
-+ void __iomem *mem_ce;
- unsigned long mem_len;
-
- struct {
---- a/drivers/net/wireless/ath/ath11k/hal.c
-+++ b/drivers/net/wireless/ath/ath11k/hal.c
-@@ -1220,16 +1220,20 @@ static int ath11k_hal_srng_create_config
- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_TCL_REG + HAL_TCL_STATUS_RING_HP;
-
- s = &hal->srng_config[HAL_CE_SRC];
-- s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_BASE_LSB;
-- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_HP;
-+ s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_BASE_LSB +
-+ ATH11K_CE_OFFSET(ab);
-+ s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab) + HAL_CE_DST_RING_HP +
-+ ATH11K_CE_OFFSET(ab);
- s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) -
- HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab);
- s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_SRC_REG(ab) -
- HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab);
-
- s = &hal->srng_config[HAL_CE_DST];
-- s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_BASE_LSB;
-- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_HP;
-+ s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_BASE_LSB +
-+ ATH11K_CE_OFFSET(ab);
-+ s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_RING_HP +
-+ ATH11K_CE_OFFSET(ab);
- s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) -
- HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab);
- s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) -
-@@ -1237,8 +1241,9 @@ static int ath11k_hal_srng_create_config
-
- s = &hal->srng_config[HAL_CE_DST_STATUS];
- s->reg_start[0] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) +
-- HAL_CE_DST_STATUS_RING_BASE_LSB;
-- s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_HP;
-+ HAL_CE_DST_STATUS_RING_BASE_LSB + ATH11K_CE_OFFSET(ab);
-+ s->reg_start[1] = HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab) + HAL_CE_DST_STATUS_RING_HP +
-+ ATH11K_CE_OFFSET(ab);
- s->reg_size[0] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) -
- HAL_SEQ_WCSS_UMAC_CE0_DST_REG(ab);
- s->reg_size[1] = HAL_SEQ_WCSS_UMAC_CE1_DST_REG(ab) -
---- a/drivers/net/wireless/ath/ath11k/hal.h
-+++ b/drivers/net/wireless/ath/ath11k/hal.h
-@@ -321,6 +321,10 @@ struct ath11k_base;
- #define HAL_WBM2SW_RELEASE_RING_BASE_MSB_RING_SIZE 0x000fffff
- #define HAL_RXDMA_RING_MAX_SIZE 0x0000ffff
-
-+/* IPQ5018 ce registers */
-+#define HAL_IPQ5018_CE_WFSS_REG_BASE 0x08400000
-+#define HAL_IPQ5018_CE_SIZE 0x200000
-+
- /* Add any other errors here and return them in
- * ath11k_hal_rx_desc_get_err().
- */
-@@ -519,6 +523,7 @@ enum hal_srng_dir {
- #define HAL_SRNG_FLAGS_MSI_INTR 0x00020000
- #define HAL_SRNG_FLAGS_CACHED 0x20000000
- #define HAL_SRNG_FLAGS_LMAC_RING 0x80000000
-+#define HAL_SRNG_FLAGS_REMAP_CE_RING 0x10000000
-
- #define HAL_SRNG_TLV_HDR_TAG GENMASK(9, 1)
- #define HAL_SRNG_TLV_HDR_LEN GENMASK(25, 10)
---- a/drivers/net/wireless/ath/ath11k/hw.c
-+++ b/drivers/net/wireless/ath/ath11k/hw.c
-@@ -2163,6 +2163,23 @@ const struct service_to_pipe ath11k_targ
- { /* terminator entry */ }
- };
-
-+const struct ce_ie_addr ath11k_ce_ie_addr_ipq8074 = {
-+ .ie1_reg_addr = CE_HOST_IE_ADDRESS,
-+ .ie2_reg_addr = CE_HOST_IE_2_ADDRESS,
-+ .ie3_reg_addr = CE_HOST_IE_3_ADDRESS,
-+};
-+
-+const struct ce_ie_addr ath11k_ce_ie_addr_ipq5018 = {
-+ .ie1_reg_addr = CE_HOST_IPQ5018_IE_ADDRESS - HAL_IPQ5018_CE_WFSS_REG_BASE,
-+ .ie2_reg_addr = CE_HOST_IPQ5018_IE_2_ADDRESS - HAL_IPQ5018_CE_WFSS_REG_BASE,
-+ .ie3_reg_addr = CE_HOST_IPQ5018_IE_3_ADDRESS - HAL_IPQ5018_CE_WFSS_REG_BASE,
-+};
-+
-+const struct ce_remap ath11k_ce_remap_ipq5018 = {
-+ .base = HAL_IPQ5018_CE_WFSS_REG_BASE,
-+ .size = HAL_IPQ5018_CE_SIZE,
-+};
-+
- const struct ath11k_hw_regs ipq8074_regs = {
- /* SW2TCL(x) R0 ring configuration address */
- .hal_tcl1_ring_base_lsb = 0x00000510,
---- a/drivers/net/wireless/ath/ath11k/hw.h
-+++ b/drivers/net/wireless/ath/ath11k/hw.h
-@@ -80,6 +80,8 @@
- #define ATH11K_M3_FILE "m3.bin"
- #define ATH11K_REGDB_FILE_NAME "regdb.bin"
-
-+#define ATH11K_CE_OFFSET(ab) (ab->mem_ce - ab->mem)
-+
- enum ath11k_hw_rate_cck {
- ATH11K_HW_RATE_CCK_LP_11M = 0,
- ATH11K_HW_RATE_CCK_LP_5_5M,
-@@ -158,6 +160,8 @@ struct ath11k_hw_params {
- u32 target_ce_count;
- const struct service_to_pipe *svc_to_ce_map;
- u32 svc_to_ce_map_len;
-+ const struct ce_ie_addr *ce_ie_addr;
-+ const struct ce_remap *ce_remap;
-
- bool single_pdev_only;
-
-@@ -277,6 +281,11 @@ extern const struct ath11k_hw_ring_mask
- extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qcn9074;
- extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_wcn6750;
-
-+extern const struct ce_ie_addr ath11k_ce_ie_addr_ipq8074;
-+extern const struct ce_ie_addr ath11k_ce_ie_addr_ipq5018;
-+
-+extern const struct ce_remap ath11k_ce_remap_ipq5018;
-+
- extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq8074;
- extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_qca6390;
- extern const struct ath11k_hw_hal_params ath11k_hw_hal_params_wcn6750;
---- a/drivers/net/wireless/ath/ath11k/pci.c
-+++ b/drivers/net/wireless/ath/ath11k/pci.c
-@@ -543,6 +543,8 @@ static int ath11k_pci_claim(struct ath11
- goto clear_master;
- }
-
-+ ab->mem_ce = ab->mem;
-+
- ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab->mem);
- return 0;
-
+++ /dev/null
-From 711b80acbdfb9667a9cf8374e13320a6e624ce73 Mon Sep 17 00:00:00 2001
-From: Sriram R <quic_srirrama@quicinc.com>
-Date: Fri, 2 Dec 2022 23:37:14 +0200
-Subject: [PATCH] wifi: ath11k: update hal srng regs for IPQ5018
-
-IPQ5018 hal srng register address & offsets are not
-similar to IPQ8074/IPQ6018/QCN9074, hence define a
-new set of srng register group data for IPQ5018.
-
-Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
-Co-developed-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221122132152.17771-6-quic_kathirve@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 1 +
- drivers/net/wireless/ath/ath11k/hw.c | 79 ++++++++++++++++++++++++++
- drivers/net/wireless/ath/ath11k/hw.h | 1 +
- 3 files changed, 81 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -634,6 +634,7 @@ static const struct ath11k_hw_params ath
- .max_fft_bins = 1024,
- },
- .internal_sleep_clock = false,
-+ .regs = &ipq5018_regs,
- .host_ce_config = ath11k_host_ce_config_qcn9074,
- .ce_count = CE_CNT_5018,
- .target_ce_config = ath11k_target_ce_config_wlan_ipq5018,
---- a/drivers/net/wireless/ath/ath11k/hw.c
-+++ b/drivers/net/wireless/ath/ath11k/hw.c
-@@ -2645,6 +2645,85 @@ static const struct ath11k_hw_tcl2wbm_rb
- },
- };
-
-+const struct ath11k_hw_regs ipq5018_regs = {
-+ /* SW2TCL(x) R0 ring configuration address */
-+ .hal_tcl1_ring_base_lsb = 0x00000694,
-+ .hal_tcl1_ring_base_msb = 0x00000698,
-+ .hal_tcl1_ring_id = 0x0000069c,
-+ .hal_tcl1_ring_misc = 0x000006a4,
-+ .hal_tcl1_ring_tp_addr_lsb = 0x000006b0,
-+ .hal_tcl1_ring_tp_addr_msb = 0x000006b4,
-+ .hal_tcl1_ring_consumer_int_setup_ix0 = 0x000006c4,
-+ .hal_tcl1_ring_consumer_int_setup_ix1 = 0x000006c8,
-+ .hal_tcl1_ring_msi1_base_lsb = 0x000006dc,
-+ .hal_tcl1_ring_msi1_base_msb = 0x000006e0,
-+ .hal_tcl1_ring_msi1_data = 0x000006e4,
-+ .hal_tcl2_ring_base_lsb = 0x000006ec,
-+ .hal_tcl_ring_base_lsb = 0x0000079c,
-+
-+ /* TCL STATUS ring address */
-+ .hal_tcl_status_ring_base_lsb = 0x000008a4,
-+
-+ /* REO2SW(x) R0 ring configuration address */
-+ .hal_reo1_ring_base_lsb = 0x000001ec,
-+ .hal_reo1_ring_base_msb = 0x000001f0,
-+ .hal_reo1_ring_id = 0x000001f4,
-+ .hal_reo1_ring_misc = 0x000001fc,
-+ .hal_reo1_ring_hp_addr_lsb = 0x00000200,
-+ .hal_reo1_ring_hp_addr_msb = 0x00000204,
-+ .hal_reo1_ring_producer_int_setup = 0x00000210,
-+ .hal_reo1_ring_msi1_base_lsb = 0x00000234,
-+ .hal_reo1_ring_msi1_base_msb = 0x00000238,
-+ .hal_reo1_ring_msi1_data = 0x0000023c,
-+ .hal_reo2_ring_base_lsb = 0x00000244,
-+ .hal_reo1_aging_thresh_ix_0 = 0x00000564,
-+ .hal_reo1_aging_thresh_ix_1 = 0x00000568,
-+ .hal_reo1_aging_thresh_ix_2 = 0x0000056c,
-+ .hal_reo1_aging_thresh_ix_3 = 0x00000570,
-+
-+ /* REO2SW(x) R2 ring pointers (head/tail) address */
-+ .hal_reo1_ring_hp = 0x00003028,
-+ .hal_reo1_ring_tp = 0x0000302c,
-+ .hal_reo2_ring_hp = 0x00003030,
-+
-+ /* REO2TCL R0 ring configuration address */
-+ .hal_reo_tcl_ring_base_lsb = 0x000003fc,
-+ .hal_reo_tcl_ring_hp = 0x00003058,
-+
-+ /* SW2REO ring address */
-+ .hal_sw2reo_ring_base_lsb = 0x0000013c,
-+ .hal_sw2reo_ring_hp = 0x00003018,
-+
-+ /* REO CMD ring address */
-+ .hal_reo_cmd_ring_base_lsb = 0x000000e4,
-+ .hal_reo_cmd_ring_hp = 0x00003010,
-+
-+ /* REO status address */
-+ .hal_reo_status_ring_base_lsb = 0x00000504,
-+ .hal_reo_status_hp = 0x00003070,
-+
-+ /* WCSS relative address */
-+ .hal_seq_wcss_umac_ce0_src_reg = 0x08400000
-+ - HAL_IPQ5018_CE_WFSS_REG_BASE,
-+ .hal_seq_wcss_umac_ce0_dst_reg = 0x08401000
-+ - HAL_IPQ5018_CE_WFSS_REG_BASE,
-+ .hal_seq_wcss_umac_ce1_src_reg = 0x08402000
-+ - HAL_IPQ5018_CE_WFSS_REG_BASE,
-+ .hal_seq_wcss_umac_ce1_dst_reg = 0x08403000
-+ - HAL_IPQ5018_CE_WFSS_REG_BASE,
-+
-+ /* WBM Idle address */
-+ .hal_wbm_idle_link_ring_base_lsb = 0x00000874,
-+ .hal_wbm_idle_link_ring_misc = 0x00000884,
-+
-+ /* SW2WBM release address */
-+ .hal_wbm_release_ring_base_lsb = 0x000001ec,
-+
-+ /* WBM2SW release address */
-+ .hal_wbm0_release_ring_base_lsb = 0x00000924,
-+ .hal_wbm1_release_ring_base_lsb = 0x0000097c,
-+};
-+
- const struct ath11k_hw_hal_params ath11k_hw_hal_params_ipq8074 = {
- .rx_buf_rbm = HAL_RX_BUF_RBM_SW3_BM,
- .tcl2wbm_rbm_map = ath11k_hw_tcl2wbm_rbm_map_ipq8074,
---- a/drivers/net/wireless/ath/ath11k/hw.h
-+++ b/drivers/net/wireless/ath/ath11k/hw.h
-@@ -415,6 +415,7 @@ extern const struct ath11k_hw_regs qca63
- extern const struct ath11k_hw_regs qcn9074_regs;
- extern const struct ath11k_hw_regs wcn6855_regs;
- extern const struct ath11k_hw_regs wcn6750_regs;
-+extern const struct ath11k_hw_regs ipq5018_regs;
-
- static inline const char *ath11k_bd_ie_type_str(enum ath11k_bd_ie_type type)
- {
+++ /dev/null
-From ba60f2793d3a37a00da14bb56a26558a902d2831 Mon Sep 17 00:00:00 2001
-From: Sriram R <quic_srirrama@quicinc.com>
-Date: Fri, 2 Dec 2022 23:37:14 +0200
-Subject: [PATCH] wifi: ath11k: initialize hw_ops for IPQ5018
-
-The ipq5018_ops is initialized for IPQ5018. This is different from
-other platforms.
-
-Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
-Co-developed-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221122132152.17771-7-quic_kathirve@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 1 +
- drivers/net/wireless/ath/ath11k/hw.c | 40 ++++++++++++++++++++++++++
- drivers/net/wireless/ath/ath11k/hw.h | 1 +
- 3 files changed, 42 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -635,6 +635,7 @@ static const struct ath11k_hw_params ath
- },
- .internal_sleep_clock = false,
- .regs = &ipq5018_regs,
-+ .hw_ops = &ipq5018_ops,
- .host_ce_config = ath11k_host_ce_config_qcn9074,
- .ce_count = CE_CNT_5018,
- .target_ce_config = ath11k_target_ce_config_wlan_ipq5018,
---- a/drivers/net/wireless/ath/ath11k/hw.c
-+++ b/drivers/net/wireless/ath/ath11k/hw.c
-@@ -1084,6 +1084,46 @@ const struct ath11k_hw_ops wcn6750_ops =
- .get_ring_selector = ath11k_hw_wcn6750_get_tcl_ring_selector,
- };
-
-+/* IPQ5018 hw ops is similar to QCN9074 except for the dest ring remap */
-+const struct ath11k_hw_ops ipq5018_ops = {
-+ .get_hw_mac_from_pdev_id = ath11k_hw_ipq6018_mac_from_pdev_id,
-+ .wmi_init_config = ath11k_init_wmi_config_ipq8074,
-+ .mac_id_to_pdev_id = ath11k_hw_mac_id_to_pdev_id_ipq8074,
-+ .mac_id_to_srng_id = ath11k_hw_mac_id_to_srng_id_ipq8074,
-+ .tx_mesh_enable = ath11k_hw_qcn9074_tx_mesh_enable,
-+ .rx_desc_get_first_msdu = ath11k_hw_qcn9074_rx_desc_get_first_msdu,
-+ .rx_desc_get_last_msdu = ath11k_hw_qcn9074_rx_desc_get_last_msdu,
-+ .rx_desc_get_l3_pad_bytes = ath11k_hw_qcn9074_rx_desc_get_l3_pad_bytes,
-+ .rx_desc_get_hdr_status = ath11k_hw_qcn9074_rx_desc_get_hdr_status,
-+ .rx_desc_encrypt_valid = ath11k_hw_qcn9074_rx_desc_encrypt_valid,
-+ .rx_desc_get_encrypt_type = ath11k_hw_qcn9074_rx_desc_get_encrypt_type,
-+ .rx_desc_get_decap_type = ath11k_hw_qcn9074_rx_desc_get_decap_type,
-+ .rx_desc_get_mesh_ctl = ath11k_hw_qcn9074_rx_desc_get_mesh_ctl,
-+ .rx_desc_get_ldpc_support = ath11k_hw_qcn9074_rx_desc_get_ldpc_support,
-+ .rx_desc_get_mpdu_seq_ctl_vld = ath11k_hw_qcn9074_rx_desc_get_mpdu_seq_ctl_vld,
-+ .rx_desc_get_mpdu_fc_valid = ath11k_hw_qcn9074_rx_desc_get_mpdu_fc_valid,
-+ .rx_desc_get_mpdu_start_seq_no = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_seq_no,
-+ .rx_desc_get_msdu_len = ath11k_hw_qcn9074_rx_desc_get_msdu_len,
-+ .rx_desc_get_msdu_sgi = ath11k_hw_qcn9074_rx_desc_get_msdu_sgi,
-+ .rx_desc_get_msdu_rate_mcs = ath11k_hw_qcn9074_rx_desc_get_msdu_rate_mcs,
-+ .rx_desc_get_msdu_rx_bw = ath11k_hw_qcn9074_rx_desc_get_msdu_rx_bw,
-+ .rx_desc_get_msdu_freq = ath11k_hw_qcn9074_rx_desc_get_msdu_freq,
-+ .rx_desc_get_msdu_pkt_type = ath11k_hw_qcn9074_rx_desc_get_msdu_pkt_type,
-+ .rx_desc_get_msdu_nss = ath11k_hw_qcn9074_rx_desc_get_msdu_nss,
-+ .rx_desc_get_mpdu_tid = ath11k_hw_qcn9074_rx_desc_get_mpdu_tid,
-+ .rx_desc_get_mpdu_peer_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_peer_id,
-+ .rx_desc_copy_attn_end_tlv = ath11k_hw_qcn9074_rx_desc_copy_attn_end,
-+ .rx_desc_get_mpdu_start_tag = ath11k_hw_qcn9074_rx_desc_get_mpdu_start_tag,
-+ .rx_desc_get_mpdu_ppdu_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_ppdu_id,
-+ .rx_desc_set_msdu_len = ath11k_hw_qcn9074_rx_desc_set_msdu_len,
-+ .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention,
-+ .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload,
-+ .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid,
-+ .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid,
-+ .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2,
-+
-+};
-+
- #define ATH11K_TX_RING_MASK_0 BIT(0)
- #define ATH11K_TX_RING_MASK_1 BIT(1)
- #define ATH11K_TX_RING_MASK_2 BIT(2)
---- a/drivers/net/wireless/ath/ath11k/hw.h
-+++ b/drivers/net/wireless/ath/ath11k/hw.h
-@@ -275,6 +275,7 @@ extern const struct ath11k_hw_ops qca639
- extern const struct ath11k_hw_ops qcn9074_ops;
- extern const struct ath11k_hw_ops wcn6855_ops;
- extern const struct ath11k_hw_ops wcn6750_ops;
-+extern const struct ath11k_hw_ops ipq5018_ops;
-
- extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ipq8074;
- extern const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390;
+++ /dev/null
-From 69968f88f1770d61cae0febef805fd00d66cf6a1 Mon Sep 17 00:00:00 2001
-From: Sriram R <quic_srirrama@quicinc.com>
-Date: Fri, 2 Dec 2022 23:37:15 +0200
-Subject: [PATCH] wifi: ath11k: add new hw ops for IPQ5018 to get rx dest ring
- hashmap
-
-The Destination ring control register is different
-for IPQ5018 when compared to IPQ8074/IPQ6018/QCN9074.
-Hence create a new hw ops to fetch the hash ring map
-for different device variants. ipq5018 hw ops
-is similar to qcn9074 except for this change, so reuse
-all the qcn9074 ops for ipq5018.
-
-Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
-Co-developed-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221122132152.17771-8-quic_kathirve@quicinc.com
----
- drivers/net/wireless/ath/ath11k/hw.c | 44 ++++++++++++++++++++++++++++
- 1 file changed, 44 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/hw.c
-+++ b/drivers/net/wireless/ath/ath11k/hw.c
-@@ -791,6 +791,49 @@ static void ath11k_hw_wcn6855_reo_setup(
- ring_hash_map);
- }
-
-+static void ath11k_hw_ipq5018_reo_setup(struct ath11k_base *ab)
-+{
-+ u32 reo_base = HAL_SEQ_WCSS_UMAC_REO_REG;
-+ u32 val;
-+
-+ /* Each hash entry uses three bits to map to a particular ring. */
-+ u32 ring_hash_map = HAL_HASH_ROUTING_RING_SW1 << 0 |
-+ HAL_HASH_ROUTING_RING_SW2 << 4 |
-+ HAL_HASH_ROUTING_RING_SW3 << 8 |
-+ HAL_HASH_ROUTING_RING_SW4 << 12 |
-+ HAL_HASH_ROUTING_RING_SW1 << 16 |
-+ HAL_HASH_ROUTING_RING_SW2 << 20 |
-+ HAL_HASH_ROUTING_RING_SW3 << 24 |
-+ HAL_HASH_ROUTING_RING_SW4 << 28;
-+
-+ val = ath11k_hif_read32(ab, reo_base + HAL_REO1_GEN_ENABLE);
-+
-+ val &= ~HAL_REO1_GEN_ENABLE_FRAG_DST_RING;
-+ val |= FIELD_PREP(HAL_REO1_GEN_ENABLE_FRAG_DST_RING,
-+ HAL_SRNG_RING_ID_REO2SW1) |
-+ FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_LIST_ENABLE, 1) |
-+ FIELD_PREP(HAL_REO1_GEN_ENABLE_AGING_FLUSH_ENABLE, 1);
-+ ath11k_hif_write32(ab, reo_base + HAL_REO1_GEN_ENABLE, val);
-+
-+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_0(ab),
-+ HAL_DEFAULT_REO_TIMEOUT_USEC);
-+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_1(ab),
-+ HAL_DEFAULT_REO_TIMEOUT_USEC);
-+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_2(ab),
-+ HAL_DEFAULT_REO_TIMEOUT_USEC);
-+ ath11k_hif_write32(ab, reo_base + HAL_REO1_AGING_THRESH_IX_3(ab),
-+ HAL_DEFAULT_REO_TIMEOUT_USEC);
-+
-+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_0,
-+ ring_hash_map);
-+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_1,
-+ ring_hash_map);
-+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_2,
-+ ring_hash_map);
-+ ath11k_hif_write32(ab, reo_base + HAL_REO1_DEST_RING_CTRL_IX_3,
-+ ring_hash_map);
-+}
-+
- static u16 ath11k_hw_ipq8074_mpdu_info_get_peerid(u8 *tlv_data)
- {
- u16 peer_id = 0;
-@@ -1117,6 +1160,7 @@ const struct ath11k_hw_ops ipq5018_ops =
- .rx_desc_get_mpdu_ppdu_id = ath11k_hw_qcn9074_rx_desc_get_mpdu_ppdu_id,
- .rx_desc_set_msdu_len = ath11k_hw_qcn9074_rx_desc_set_msdu_len,
- .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention,
-+ .reo_setup = ath11k_hw_ipq5018_reo_setup,
- .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload,
- .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid,
- .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid,
+++ /dev/null
-From 25edca7bb18a2a40cc7e54c6f522e9b3c917e2c5 Mon Sep 17 00:00:00 2001
-From: Sriram R <quic_srirrama@quicinc.com>
-Date: Fri, 2 Dec 2022 23:37:15 +0200
-Subject: [PATCH] wifi: ath11k: add ipq5018 device support
-
-ipq5018 is a ahb 2ghz device, enable the compatible support for
-ipq5018 in ahb.
-
-Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
-Co-developed-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221122132152.17771-9-quic_kathirve@quicinc.com
----
- drivers/net/wireless/ath/ath11k/ahb.c | 3 +++
- 1 file changed, 3 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/ahb.c
-+++ b/drivers/net/wireless/ath/ath11k/ahb.c
-@@ -32,6 +32,9 @@ static const struct of_device_id ath11k_
- { .compatible = "qcom,wcn6750-wifi",
- .data = (void *)ATH11K_HW_WCN6750_HW10,
- },
-+ { .compatible = "qcom,ipq5018-wifi",
-+ .data = (void *)ATH11K_HW_IPQ5018_HW10,
-+ },
- { }
- };
-
+++ /dev/null
-From d45daa6d1a8da080f1b516c570a8428a7b9225e4 Mon Sep 17 00:00:00 2001
-From: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Date: Tue, 6 Dec 2022 00:51:25 +0530
-Subject: [PATCH] wifi: ath11k: Fix scan request param frame size warning
-
-Following warning was observed
-
-drivers/net/wireless/ath/ath11k/mac.c:2351:1: warning: the frame
-size of 1184 bytes is larger than 1024 bytes [-Wframe-larger-than=]
-
-A local variable is declared with a size larger than 1024 bytes
-this causing a compilation warning. Change the local variable to
-heap memory to fix the warning.
-
-Tested-on: IPQ8074 AHB WLAN.HK.2.7.0.1-01701-QCAHKSWPL_SILICONZ-1 v2
-
-Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221205192125.13533-1-quic_kathirve@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 83 +++++++++++++++------------
- 1 file changed, 45 insertions(+), 38 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -3612,7 +3612,7 @@ static int ath11k_mac_op_hw_scan(struct
- struct ath11k *ar = hw->priv;
- struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
- struct cfg80211_scan_request *req = &hw_req->req;
-- struct scan_req_params arg;
-+ struct scan_req_params *arg = NULL;
- int ret = 0;
- int i;
- u32 scan_timeout;
-@@ -3640,72 +3640,78 @@ static int ath11k_mac_op_hw_scan(struct
- if (ret)
- goto exit;
-
-- memset(&arg, 0, sizeof(arg));
-- ath11k_wmi_start_scan_init(ar, &arg);
-- arg.vdev_id = arvif->vdev_id;
-- arg.scan_id = ATH11K_SCAN_ID;
-+ arg = kzalloc(sizeof(*arg), GFP_KERNEL);
-+
-+ if (!arg) {
-+ ret = -ENOMEM;
-+ goto exit;
-+ }
-+
-+ ath11k_wmi_start_scan_init(ar, arg);
-+ arg->vdev_id = arvif->vdev_id;
-+ arg->scan_id = ATH11K_SCAN_ID;
-
- if (req->ie_len) {
-- arg.extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL);
-- if (!arg.extraie.ptr) {
-+ arg->extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL);
-+ if (!arg->extraie.ptr) {
- ret = -ENOMEM;
- goto exit;
- }
-- arg.extraie.len = req->ie_len;
-+ arg->extraie.len = req->ie_len;
- }
-
- if (req->n_ssids) {
-- arg.num_ssids = req->n_ssids;
-- for (i = 0; i < arg.num_ssids; i++) {
-- arg.ssid[i].length = req->ssids[i].ssid_len;
-- memcpy(&arg.ssid[i].ssid, req->ssids[i].ssid,
-+ arg->num_ssids = req->n_ssids;
-+ for (i = 0; i < arg->num_ssids; i++) {
-+ arg->ssid[i].length = req->ssids[i].ssid_len;
-+ memcpy(&arg->ssid[i].ssid, req->ssids[i].ssid,
- req->ssids[i].ssid_len);
- }
- } else {
-- arg.scan_flags |= WMI_SCAN_FLAG_PASSIVE;
-+ arg->scan_flags |= WMI_SCAN_FLAG_PASSIVE;
- }
-
- if (req->n_channels) {
-- arg.num_chan = req->n_channels;
-- arg.chan_list = kcalloc(arg.num_chan, sizeof(*arg.chan_list),
-- GFP_KERNEL);
-+ arg->num_chan = req->n_channels;
-+ arg->chan_list = kcalloc(arg->num_chan, sizeof(*arg->chan_list),
-+ GFP_KERNEL);
-
-- if (!arg.chan_list) {
-+ if (!arg->chan_list) {
- ret = -ENOMEM;
- goto exit;
- }
-
-- for (i = 0; i < arg.num_chan; i++)
-- arg.chan_list[i] = req->channels[i]->center_freq;
-+ for (i = 0; i < arg->num_chan; i++)
-+ arg->chan_list[i] = req->channels[i]->center_freq;
- }
-
- if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
-- arg.scan_f_add_spoofed_mac_in_probe = 1;
-- ether_addr_copy(arg.mac_addr.addr, req->mac_addr);
-- ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask);
-+ arg->scan_f_add_spoofed_mac_in_probe = 1;
-+ ether_addr_copy(arg->mac_addr.addr, req->mac_addr);
-+ ether_addr_copy(arg->mac_mask.addr, req->mac_addr_mask);
- }
-
- /* if duration is set, default dwell times will be overwritten */
- if (req->duration) {
-- arg.dwell_time_active = req->duration;
-- arg.dwell_time_active_2g = req->duration;
-- arg.dwell_time_active_6g = req->duration;
-- arg.dwell_time_passive = req->duration;
-- arg.dwell_time_passive_6g = req->duration;
-- arg.burst_duration = req->duration;
-+ arg->dwell_time_active = req->duration;
-+ arg->dwell_time_active_2g = req->duration;
-+ arg->dwell_time_active_6g = req->duration;
-+ arg->dwell_time_passive = req->duration;
-+ arg->dwell_time_passive_6g = req->duration;
-+ arg->burst_duration = req->duration;
-
-- scan_timeout = min_t(u32, arg.max_rest_time *
-- (arg.num_chan - 1) + (req->duration +
-+ scan_timeout = min_t(u32, arg->max_rest_time *
-+ (arg->num_chan - 1) + (req->duration +
- ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) *
-- arg.num_chan, arg.max_scan_time);
-+ arg->num_chan, arg->max_scan_time);
- } else {
-- scan_timeout = arg.max_scan_time;
-+ scan_timeout = arg->max_scan_time;
- }
-
- /* Add a margin to account for event/command processing */
- scan_timeout += ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD;
-
-- ret = ath11k_start_scan(ar, &arg);
-+ ret = ath11k_start_scan(ar, arg);
- if (ret) {
- ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret);
- spin_lock_bh(&ar->data_lock);
-@@ -3717,10 +3723,11 @@ static int ath11k_mac_op_hw_scan(struct
- msecs_to_jiffies(scan_timeout));
-
- exit:
-- kfree(arg.chan_list);
--
-- if (req->ie_len)
-- kfree(arg.extraie.ptr);
-+ if (arg) {
-+ kfree(arg->chan_list);
-+ kfree(arg->extraie.ptr);
-+ kfree(arg);
-+ }
-
- mutex_unlock(&ar->conf_mutex);
-
+++ /dev/null
-From a27c6a5853eb9d4f293b99be73a6891fe88263c7 Mon Sep 17 00:00:00 2001
-From: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
-Date: Tue, 10 Jan 2023 15:30:57 +0200
-Subject: [PATCH] wifi: ath11k: Add support to configure FTM responder role
-
-Fine Timing Measurement(FTM) support is used to measure round trip
-time between two nodes.
-
-Enable FTM responder feature using hw_params on supported device.
-Since FTM functionality is offloaded to firmware, adding the
-interface allows user space to enable or disable FTM responder.
-Also add support for advertising the same in extended capabilities.
-
-QCA6390, WCN6855 and WCN6750 do not support this feature.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
-Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221220044435.10506-1-quic_rajkbhag@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 8 ++++++++
- drivers/net/wireless/ath/ath11k/core.h | 1 +
- drivers/net/wireless/ath/ath11k/hw.h | 1 +
- drivers/net/wireless/ath/ath11k/mac.c | 20 +++++++++++++++++++-
- drivers/net/wireless/ath/ath11k/wmi.h | 1 +
- 5 files changed, 30 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -116,6 +116,7 @@ static const struct ath11k_hw_params ath
- .tcl_ring_retry = true,
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
-+ .ftm_responder = true,
- },
- {
- .hw_rev = ATH11K_HW_IPQ6018_HW10,
-@@ -198,6 +199,7 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = false,
-+ .ftm_responder = true,
- },
- {
- .name = "qca6390 hw2.0",
-@@ -282,6 +284,7 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = true,
-+ .ftm_responder = false,
- },
- {
- .name = "qcn9074 hw1.0",
-@@ -363,6 +366,7 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = false,
-+ .ftm_responder = true,
- },
- {
- .name = "wcn6855 hw2.0",
-@@ -447,6 +451,7 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = true,
-+ .ftm_responder = false,
- },
- {
- .name = "wcn6855 hw2.1",
-@@ -529,6 +534,7 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = true,
-+ .ftm_responder = false,
- },
- {
- .name = "wcn6750 hw1.0",
-@@ -609,6 +615,7 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750,
- .smp2p_wow_exit = true,
- .support_fw_mac_sequence = true,
-+ .ftm_responder = false,
- },
- {
- .hw_rev = ATH11K_HW_IPQ5018_HW10,
-@@ -688,6 +695,7 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = false,
-+ .ftm_responder = true,
- },
- };
-
---- a/drivers/net/wireless/ath/ath11k/core.h
-+++ b/drivers/net/wireless/ath/ath11k/core.h
-@@ -346,6 +346,7 @@ struct ath11k_vif {
-
- bool is_started;
- bool is_up;
-+ bool ftm_responder;
- bool spectral_enabled;
- bool ps;
- u32 aid;
---- a/drivers/net/wireless/ath/ath11k/hw.h
-+++ b/drivers/net/wireless/ath/ath11k/hw.h
-@@ -224,6 +224,7 @@ struct ath11k_hw_params {
- u32 tx_ring_size;
- bool smp2p_wow_exit;
- bool support_fw_mac_sequence;
-+ bool ftm_responder;
- };
-
- struct ath11k_hw_ops {
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -3110,7 +3110,7 @@ static void ath11k_mac_op_bss_info_chang
- u16 bitrate;
- int ret = 0;
- u8 rateidx;
-- u32 rate;
-+ u32 rate, param;
- u32 ipv4_cnt;
-
- mutex_lock(&ar->conf_mutex);
-@@ -3412,6 +3412,20 @@ static void ath11k_mac_op_bss_info_chang
- }
- }
-
-+ if (changed & BSS_CHANGED_FTM_RESPONDER &&
-+ arvif->ftm_responder != info->ftm_responder &&
-+ ar->ab->hw_params.ftm_responder &&
-+ (vif->type == NL80211_IFTYPE_AP ||
-+ vif->type == NL80211_IFTYPE_MESH_POINT)) {
-+ arvif->ftm_responder = info->ftm_responder;
-+ param = WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE;
-+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param,
-+ arvif->ftm_responder);
-+ if (ret)
-+ ath11k_warn(ar->ab, "Failed to set ftm responder %i: %d\n",
-+ arvif->vdev_id, ret);
-+ }
-+
- if (changed & BSS_CHANGED_FILS_DISCOVERY ||
- changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP)
- ath11k_mac_fils_discovery(arvif, info);
-@@ -9113,6 +9127,10 @@ static int __ath11k_mac_register(struct
- wiphy_ext_feature_set(ar->hw->wiphy,
- NL80211_EXT_FEATURE_SET_SCAN_DWELL);
-
-+ if (ab->hw_params.ftm_responder)
-+ wiphy_ext_feature_set(ar->hw->wiphy,
-+ NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
-+
- ath11k_reg_init(ar);
-
- if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) {
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -1073,6 +1073,7 @@ enum wmi_tlv_vdev_param {
- WMI_VDEV_PARAM_ENABLE_BCAST_PROBE_RESPONSE,
- WMI_VDEV_PARAM_FILS_MAX_CHANNEL_GUARD_TIME,
- WMI_VDEV_PARAM_HE_LTF = 0x74,
-+ WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE = 0x7d,
- WMI_VDEV_PARAM_BA_MODE = 0x7e,
- WMI_VDEV_PARAM_AUTORATE_MISC_CFG = 0x80,
- WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE = 0x87,
+++ /dev/null
-From e5e94d10c85653609a2893c8d0ef24a27471b68f Mon Sep 17 00:00:00 2001
-From: Wen Gong <quic_wgong@quicinc.com>
-Date: Tue, 10 Jan 2023 15:30:58 +0200
-Subject: [PATCH] wifi: ath11k: add channel 177 into 5 GHz channel list
-
-Add support for the 5 GHz channel 177 with center frequency 5885 MHz and
-operating class 125 per IEEE Std 802.11ax-2021, Table E-4.
-
-Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
-
-Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221220101912.30816-1-quic_wgong@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.h | 4 ++--
- drivers/net/wireless/ath/ath11k/mac.c | 1 +
- 2 files changed, 3 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/core.h
-+++ b/drivers/net/wireless/ath/ath11k/core.h
-@@ -521,8 +521,8 @@ struct ath11k_sta {
- #define ATH11K_MIN_5G_FREQ 4150
- #define ATH11K_MIN_6G_FREQ 5925
- #define ATH11K_MAX_6G_FREQ 7115
--#define ATH11K_NUM_CHANS 101
--#define ATH11K_MAX_5G_CHAN 173
-+#define ATH11K_NUM_CHANS 102
-+#define ATH11K_MAX_5G_CHAN 177
-
- enum ath11k_state {
- ATH11K_STATE_OFF,
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -96,6 +96,7 @@ static const struct ieee80211_channel at
- CHAN5G(165, 5825, 0),
- CHAN5G(169, 5845, 0),
- CHAN5G(173, 5865, 0),
-+ CHAN5G(177, 5885, 0),
- };
-
- static const struct ieee80211_channel ath11k_6ghz_channels[] = {
+++ /dev/null
-From 53a998c4d7284debd77734d01e1466e59a1d03b2 Mon Sep 17 00:00:00 2001
-From: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
-Date: Fri, 13 Jan 2023 12:02:09 +0530
-Subject: [PATCH] wifi: ath11k: fix ce memory mapping for ahb devices
-
-Currently ath11k_ahb module is not loaded successfully and the wifi
-interface is not created. Kernel trace is seen while loading the
-ath11k_ahb module. The issue is seen in all ath11k AHB devices except
-in IPQ5018.
-
-This happens because in ath11k_ahb_probe(), ab->mem_ce is initialized
-with the value of ab->mem. However, at this instant ab->mem is not
-yet set.
-
-Later, during write to a particular memory via ath11k_ahb_write32()
-this ab->mem_ce is used with particular offset. Since ab->mem_ce is
-not set properly this possibly leads to memory conflict to handle
-kernel paging request and the below trace is seen.
-
-[ 93.035047] Unable to handle kernel paging request at virtual address ffff800100a00000
-[ 93.035083] Mem abort info:
-[ 93.041869] ESR = 0x0000000096000045
-[ 93.044561] EC = 0x25: DABT (current EL), IL = 32 bits
-[ 93.048377] SET = 0, FnV = 0
-[ 93.053840] EA = 0, S1PTW = 0
-[ 93.056704] FSC = 0x05: level 1 translation fault
-[ 93.059745] Data abort info:
-[ 93.064603] ISV = 0, ISS = 0x00000045
-[ 93.067729] CM = 0, WnR = 1
-[ 93.071287] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000042219000
-[ 93.074409] [ffff800100a00000] pgd=100000007ffff003, p4d=100000007ffff003, pud=0000000000000000
-[ 93.081195] Internal error: Oops: 0000000096000045 [#1] PREEMPT SMP
-[ 93.089598] Modules linked in: ath11k_ahb ath11k_pci ath11k qmi_helpers
-[ 93.095851] CPU: 2 PID: 66 Comm: kworker/u8:3 Not tainted 6.1.0-rc8-wt-ath-658126-g58e4b9df840c-dirty #2
-[ 93.102454] Hardware name: Qualcomm Technologies, Inc. IPQ8074/AP-HK14 (DT)
-[ 93.112171] Workqueue: ath11k_qmi_driver_event ath11k_qmi_driver_event_work [ath11k]
-[ 93.118856] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
-[ 93.126838] pc : ath11k_ahb_write32+0xc/0x18 [ath11k_ahb]
-[ 93.133520] lr : ath11k_hal_srng_setup+0x860/0x8f0 [ath11k]
-[ 93.139075] sp : ffff80000aaebb70
-[ 93.144452] x29: ffff80000aaebb70 x28: 0000000000000020 x27: ffff80000aaebc50
-[ 93.147934] x26: ffff000004923750 x25: ffff000004921200 x24: ffff000004928000
-[ 93.155051] x23: 0000000000000020 x22: ffff000004930000 x21: ffff000004923200
-[ 93.162170] x20: ffff000004920000 x19: 00000000eea00000 x18: ffff0000049200f0
-[ 93.169288] x17: 0000000000000000 x16: 0000000000000000 x15: 000000000000025e
-[ 93.176405] x14: ffff000003c414f0 x13: 0000000000000000 x12: 0000000000000008
-[ 93.183524] x11: ffff000003c41488 x10: 0000000000000040 x9 : 0000000000000000
-[ 93.190641] x8 : ffff80000a9dd100 x7 : 0000000000000000 x6 : 000000000000003f
-[ 93.197759] x5 : ffff800100a00400 x4 : ffff8000031f4018 x3 : 0000000000000004
-[ 93.204877] x2 : 0000000047b62000 x1 : ffff800100a00000 x0 : ffff800012000000
-[ 93.211996] Call trace:
-[ 93.219104] ath11k_ahb_write32+0xc/0x18 [ath11k_ahb]
-[ 93.221366] ath11k_ce_init_ring+0x184/0x278 [ath11k]
-[ 93.226576] ath11k_ce_init_pipes+0x4c/0x1a0 [ath11k]
-[ 93.231610] ath11k_core_qmi_firmware_ready+0x3c/0x568 [ath11k]
-[ 93.236646] ath11k_qmi_driver_event_work+0x168/0x4f8 [ath11k]
-[ 93.242376] process_one_work+0x144/0x350
-[ 93.248275] worker_thread+0x120/0x430
-[ 93.252352] kthread+0xf4/0x110
-[ 93.255997] ret_from_fork+0x10/0x20
-[ 93.259043] Code: d503201f f94e1c00 8b214001 d50332bf (b9000022)
-[ 93.262863] ---[ end trace 0000000000000000 ]---
-
-However, for the device IPQ5018 ath11k_hw_params .ce_remap is
-defined. This parameter is used to recalculate ab->mem_ce and hence,
-this issue is not seen in IPQ5018.
-
-Hence, fix this by initializing ab->mem_ce after ab->mem is set.
-ab->mem is set inside the ath11k_ahb_setup_resources() therefore
-initialize ab->mem_ce after ath11k_ahb_setup_resources().
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Fixes: b42b3678c91f ("wifi: ath11k: remap ce register space for IPQ5018")
-
-Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230113063209.7256-1-quic_rajkbhag@quicinc.com
----
- drivers/net/wireless/ath/ath11k/ahb.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/ahb.c
-+++ b/drivers/net/wireless/ath/ath11k/ahb.c
-@@ -1157,12 +1157,16 @@ static int ath11k_ahb_probe(struct platf
- goto err_core_free;
- }
-
-- ab->mem_ce = ab->mem;
--
- ret = ath11k_core_pre_init(ab);
- if (ret)
- goto err_core_free;
-
-+ ret = ath11k_ahb_setup_resources(ab);
-+ if (ret)
-+ goto err_core_free;
-+
-+ ab->mem_ce = ab->mem;
-+
- if (ab->hw_params.ce_remap) {
- const struct ce_remap *ce_remap = ab->hw_params.ce_remap;
- /* ce register space is moved out of wcss unlike ipq8074 or ipq6018
-@@ -1177,10 +1181,6 @@ static int ath11k_ahb_probe(struct platf
- }
- }
-
-- ret = ath11k_ahb_setup_resources(ab);
-- if (ret)
-- goto err_core_free;
--
- ret = ath11k_ahb_fw_resources_init(ab);
- if (ret)
- goto err_core_free;
+++ /dev/null
-From cf8f3d4deb02a8fdc806c46d4112b69868544697 Mon Sep 17 00:00:00 2001
-From: Tamizh Chelvam Raja <quic_tamizhr@quicinc.com>
-Date: Wed, 15 Feb 2023 20:31:36 +0200
-Subject: [PATCH] wifi: ath11k: Set ext passive scan flag to adjust passive
- scan start time
-
-Set the WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE flag
-while sending the scan command. If this flag is enabled when the
-incoming scan request comes with a strict start time and its duration
-overlaps with next TBTT, then target adjust the start time accordingly
-for passive scan. Target supporting this feature will advertise
-WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01467-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Tamizh Chelvam Raja <quic_tamizhr@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221222131720.11368-1-quic_tamizhr@quicinc.com
----
- drivers/net/wireless/ath/ath11k/wmi.c | 8 ++++++++
- drivers/net/wireless/ath/ath11k/wmi.h | 3 +++
- 2 files changed, 11 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -2068,6 +2068,12 @@ void ath11k_wmi_start_scan_init(struct a
- WMI_SCAN_EVENT_FOREIGN_CHAN |
- WMI_SCAN_EVENT_DEQUEUED;
- arg->scan_flags |= WMI_SCAN_CHAN_STAT_EVENT;
-+
-+ if (test_bit(WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE,
-+ ar->ab->wmi_ab.svc_map))
-+ arg->scan_ctrl_flags_ext |=
-+ WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE;
-+
- arg->num_bssid = 1;
-
- /* fill bssid_list[0] with 0xff, otherwise bssid and RA will be
-@@ -2149,6 +2155,8 @@ ath11k_wmi_copy_scan_event_cntrl_flags(s
- /* for adaptive scan mode using 3 bits (21 - 23 bits) */
- WMI_SCAN_SET_DWELL_MODE(cmd->scan_ctrl_flags,
- param->adaptive_dwell_time_mode);
-+
-+ cmd->scan_ctrl_flags_ext = param->scan_ctrl_flags_ext;
- }
-
- int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar,
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -2093,6 +2093,7 @@ enum wmi_tlv_service {
- WMI_TLV_SERVICE_EXT2_MSG = 220,
- WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246,
- WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249,
-+ WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263,
-
- /* The second 128 bits */
- WMI_MAX_EXT_SERVICE = 256,
-@@ -3223,6 +3224,7 @@ struct wmi_start_scan_cmd {
-
- #define WMI_SCAN_DWELL_MODE_MASK 0x00E00000
- #define WMI_SCAN_DWELL_MODE_SHIFT 21
-+#define WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE 0x00000800
-
- enum {
- WMI_SCAN_DWELL_MODE_DEFAULT = 0,
-@@ -3270,6 +3272,7 @@ struct scan_req_params {
- };
- u32 scan_events;
- };
-+ u32 scan_ctrl_flags_ext;
- u32 dwell_time_active;
- u32 dwell_time_active_2g;
- u32 dwell_time_passive;
+++ /dev/null
-From 342fcde9d91460f01f65707e16368a1571271a3a Mon Sep 17 00:00:00 2001
-From: Yang Yingliang <yangyingliang@huawei.com>
-Date: Fri, 17 Feb 2023 11:00:31 +0800
-Subject: [PATCH] wifi: ath11k: fix return value check in ath11k_ahb_probe()
-
-ioremap() returns NULL pointer not PTR_ERR() when it fails,
-so replace the IS_ERR() check with NULL pointer check.
-
-Fixes: b42b3678c91f ("wifi: ath11k: remap ce register space for IPQ5018")
-Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230217030031.4021289-1-yangyingliang@huawei.com
----
- drivers/net/wireless/ath/ath11k/ahb.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/ahb.c
-+++ b/drivers/net/wireless/ath/ath11k/ahb.c
-@@ -1174,7 +1174,7 @@ static int ath11k_ahb_probe(struct platf
- * to a new space for accessing them.
- */
- ab->mem_ce = ioremap(ce_remap->base, ce_remap->size);
-- if (IS_ERR(ab->mem_ce)) {
-+ if (!ab->mem_ce) {
- dev_err(&pdev->dev, "ce ioremap error\n");
- ret = -ENOMEM;
- goto err_core_free;
+++ /dev/null
-From f117276638b7600b981b3fe28550823cfbe1ef23 Mon Sep 17 00:00:00 2001
-From: Douglas Anderson <dianders@chromium.org>
-Date: Wed, 1 Feb 2023 08:54:42 -0800
-Subject: [PATCH] wifi: ath11k: Use platform_get_irq() to get the interrupt
-
-As of commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ
-resource from DT core"), we need to use platform_get_irq() instead of
-platform_get_resource() to get our IRQs because
-platform_get_resource() simply won't get them anymore.
-
-This was already fixed in several other Atheros WiFi drivers,
-apparently in response to Zeal Robot reports. An example of another
-fix is commit 9503a1fc123d ("ath9k: Use platform_get_irq() to get the
-interrupt"). ath11k seems to have been missed in this effort, though.
-
-Without this change, WiFi wasn't coming up on my Qualcomm sc7280-based
-hardware. Specifically, "platform_get_resource(pdev, IORESOURCE_IRQ,
-i)" was failing even for i=0.
-
-Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
-
-Fixes: a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource from DT core")
-Fixes: 00402f49d26f ("ath11k: Add support for WCN6750 device")
-Signed-off-by: Douglas Anderson <dianders@chromium.org>
-Tested-by: Jun Yu <junyuu@chromium.org>
-Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230201084131.v2.1.I69cf3d56c97098287fe3a70084ee515098390b70@changeid
----
- drivers/net/wireless/ath/ath11k/ahb.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/ahb.c
-+++ b/drivers/net/wireless/ath/ath11k/ahb.c
-@@ -874,11 +874,11 @@ static int ath11k_ahb_setup_msi_resource
- ab->pci.msi.ep_base_data = int_prop + 32;
-
- for (i = 0; i < ab->pci.msi.config->total_vectors; i++) {
-- res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
-- if (!res)
-- return -ENODEV;
-+ ret = platform_get_irq(pdev, i);
-+ if (ret < 0)
-+ return ret;
-
-- ab->pci.msi.irqs[i] = res->start;
-+ ab->pci.msi.irqs[i] = ret;
- }
-
- set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags);
+++ /dev/null
-From 60b7d62ba8cdbd073997bff0f1cdae8d844002c0 Mon Sep 17 00:00:00 2001
-From: Christian Marangi <ansuelsmth@gmail.com>
-Date: Thu, 9 Feb 2023 23:26:22 +0100
-Subject: [PATCH] wifi: ath11k: fix SAC bug on peer addition with sta band
- migration
-
-Fix sleep in atomic context warning detected by Smatch static checker
-analyzer.
-
-Following the locking pattern for peer_rhash_add lock tbl_mtx_lock mutex
-always even if sta is not transitioning to another band.
-This is peer_add function and a more secure locking should not cause
-performance regression.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
-
-Fixes: d673cb6fe6c0 ("wifi: ath11k: fix peer addition/deletion error on sta band migration")
-Reported-by: Dan Carpenter <error27@gmail.com>
-Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230209222622.1751-1-ansuelsmth@gmail.com
----
- drivers/net/wireless/ath/ath11k/peer.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/peer.c
-+++ b/drivers/net/wireless/ath/ath11k/peer.c
-@@ -382,22 +382,23 @@ int ath11k_peer_create(struct ath11k *ar
- return -ENOBUFS;
- }
-
-+ mutex_lock(&ar->ab->tbl_mtx_lock);
- spin_lock_bh(&ar->ab->base_lock);
- peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr);
- if (peer) {
- if (peer->vdev_id == param->vdev_id) {
- spin_unlock_bh(&ar->ab->base_lock);
-+ mutex_unlock(&ar->ab->tbl_mtx_lock);
- return -EINVAL;
- }
-
- /* Assume sta is transitioning to another band.
- * Remove here the peer from rhash.
- */
-- mutex_lock(&ar->ab->tbl_mtx_lock);
- ath11k_peer_rhash_delete(ar->ab, peer);
-- mutex_unlock(&ar->ab->tbl_mtx_lock);
- }
- spin_unlock_bh(&ar->ab->base_lock);
-+ mutex_unlock(&ar->ab->tbl_mtx_lock);
-
- ret = ath11k_wmi_send_peer_create_cmd(ar, param);
- if (ret) {
+++ /dev/null
-From 7c15430822e71e90203d87e6d0cfe83fa058b0dc Mon Sep 17 00:00:00 2001
-From: Len Brown <len.brown@intel.com>
-Date: Wed, 1 Feb 2023 12:32:01 -0600
-Subject: [PATCH] wifi: ath11k: allow system suspend to survive ath11k
-
-When ath11k runs into internal errors upon suspend,
-it returns an error code to pci_pm_suspend, which
-aborts the entire system suspend.
-
-The driver should not abort system suspend, but should
-keep its internal errors to itself, and allow the system
-to suspend. Otherwise, a user can suspend a laptop
-by closing the lid and sealing it into a case, assuming
-that is will suspend, rather than heating up and draining
-the battery when in transit.
-
-In practice, the ath11k device seems to have plenty of transient
-errors, and subsequent suspend cycles after this failure
-often succeed.
-
-https://bugzilla.kernel.org/show_bug.cgi?id=216968
-
-Fixes: d1b0c33850d29 ("ath11k: implement suspend for QCA6390 PCI devices")
-
-Signed-off-by: Len Brown <len.brown@intel.com>
-Cc: stable@vger.kernel.org
-Signed-off-by: Kalle Valo <kvalo@kernel.org>
-Link: https://lore.kernel.org/r/20230201183201.14431-1-len.brown@intel.com
----
- drivers/net/wireless/ath/ath11k/pci.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/pci.c
-+++ b/drivers/net/wireless/ath/ath11k/pci.c
-@@ -998,7 +998,7 @@ static __maybe_unused int ath11k_pci_pm_
- if (ret)
- ath11k_warn(ab, "failed to resume core: %d\n", ret);
-
-- return ret;
-+ return 0;
- }
-
- static SIMPLE_DEV_PM_OPS(ath11k_pci_pm_ops,
+++ /dev/null
-From a96f10422e74cde27c100b321b127ec32ae75747 Mon Sep 17 00:00:00 2001
-From: Muna Sinada <quic_msinada@quicinc.com>
-Date: Fri, 24 Feb 2023 12:28:03 +0200
-Subject: [PATCH] wifi: ath11k: modify accessor macros to match index size
-
-HE PHY is only 11 bytes, therefore it should be using byte indexes
-instead of dword. Change corresponding macros to reflect this.
-
-Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/1666128501-12364-2-git-send-email-quic_msinada@quicinc.com
----
- drivers/net/wireless/ath/ath11k/wmi.h | 24 +++++++++++++-----------
- 1 file changed, 13 insertions(+), 11 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -2859,30 +2859,32 @@ struct rx_reorder_queue_remove_params {
- #define WMI_VDEV_PARAM_TXBF_SU_TX_BFER BIT(2)
- #define WMI_VDEV_PARAM_TXBF_MU_TX_BFER BIT(3)
-
--#define HECAP_PHYDWORD_0 0
--#define HECAP_PHYDWORD_1 1
--#define HECAP_PHYDWORD_2 2
-+#define HE_PHYCAP_BYTE_0 0
-+#define HE_PHYCAP_BYTE_1 1
-+#define HE_PHYCAP_BYTE_2 2
-+#define HE_PHYCAP_BYTE_3 3
-+#define HE_PHYCAP_BYTE_4 4
-
--#define HECAP_PHY_SU_BFER BIT(31)
-+#define HECAP_PHY_SU_BFER BIT(7)
- #define HECAP_PHY_SU_BFEE BIT(0)
- #define HECAP_PHY_MU_BFER BIT(1)
--#define HECAP_PHY_UL_MUMIMO BIT(22)
--#define HECAP_PHY_UL_MUOFDMA BIT(23)
-+#define HECAP_PHY_UL_MUMIMO BIT(6)
-+#define HECAP_PHY_UL_MUOFDMA BIT(7)
-
- #define HECAP_PHY_SUBFMR_GET(hecap_phy) \
-- FIELD_GET(HECAP_PHY_SU_BFER, hecap_phy[HECAP_PHYDWORD_0])
-+ FIELD_GET(HECAP_PHY_SU_BFER, hecap_phy[HE_PHYCAP_BYTE_3])
-
- #define HECAP_PHY_SUBFME_GET(hecap_phy) \
-- FIELD_GET(HECAP_PHY_SU_BFEE, hecap_phy[HECAP_PHYDWORD_1])
-+ FIELD_GET(HECAP_PHY_SU_BFEE, hecap_phy[HE_PHYCAP_BYTE_4])
-
- #define HECAP_PHY_MUBFMR_GET(hecap_phy) \
-- FIELD_GET(HECAP_PHY_MU_BFER, hecap_phy[HECAP_PHYDWORD_1])
-+ FIELD_GET(HECAP_PHY_MU_BFER, hecap_phy[HE_PHYCAP_BYTE_4])
-
- #define HECAP_PHY_ULMUMIMO_GET(hecap_phy) \
-- FIELD_GET(HECAP_PHY_UL_MUMIMO, hecap_phy[HECAP_PHYDWORD_0])
-+ FIELD_GET(HECAP_PHY_UL_MUMIMO, hecap_phy[HE_PHYCAP_BYTE_2])
-
- #define HECAP_PHY_ULOFDMA_GET(hecap_phy) \
-- FIELD_GET(HECAP_PHY_UL_MUOFDMA, hecap_phy[HECAP_PHYDWORD_0])
-+ FIELD_GET(HECAP_PHY_UL_MUOFDMA, hecap_phy[HE_PHYCAP_BYTE_2])
-
- #define HE_MODE_SU_TX_BFEE BIT(0)
- #define HE_MODE_SU_TX_BFER BIT(1)
+++ /dev/null
-From 38dfe775d0abf511341f37c1cb77b919a3ad410b Mon Sep 17 00:00:00 2001
-From: Muna Sinada <quic_msinada@quicinc.com>
-Date: Fri, 24 Feb 2023 12:28:04 +0200
-Subject: [PATCH] wifi: ath11k: push MU-MIMO params from hostapd to hardware
-
-In the previous behaviour only HE IE in management frames are changed
-regarding MU-MIMO configurations and not in hardware. Adding push of
-MU-MIMO configurations to the hardware as well.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1
-
-Co-developed-by: Anilkumar Kolli <quic_akolli@quicinc.com>
-Signed-off-by: Anilkumar Kolli <quic_akolli@quicinc.com>
-Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/1666128501-12364-3-git-send-email-quic_msinada@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 200 ++++++++++++++++----------
- drivers/net/wireless/ath/ath11k/wmi.h | 3 +
- 2 files changed, 130 insertions(+), 73 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -2699,6 +2699,117 @@ static int ath11k_setup_peer_smps(struct
- ath11k_smps_map[smps]);
- }
-
-+static bool ath11k_mac_set_he_txbf_conf(struct ath11k_vif *arvif)
-+{
-+ struct ath11k *ar = arvif->ar;
-+ u32 param, value;
-+ int ret;
-+
-+ if (!arvif->vif->bss_conf.he_support)
-+ return true;
-+
-+ param = WMI_VDEV_PARAM_SET_HEMU_MODE;
-+ value = 0;
-+ if (arvif->vif->bss_conf.he_su_beamformer) {
-+ value |= FIELD_PREP(HE_MODE_SU_TX_BFER, HE_SU_BFER_ENABLE);
-+ if (arvif->vif->bss_conf.he_mu_beamformer &&
-+ arvif->vdev_type == WMI_VDEV_TYPE_AP)
-+ value |= FIELD_PREP(HE_MODE_MU_TX_BFER, HE_MU_BFER_ENABLE);
-+ }
-+
-+ if (arvif->vif->type != NL80211_IFTYPE_MESH_POINT) {
-+ value |= FIELD_PREP(HE_MODE_DL_OFDMA, HE_DL_MUOFDMA_ENABLE) |
-+ FIELD_PREP(HE_MODE_UL_OFDMA, HE_UL_MUOFDMA_ENABLE);
-+
-+ if (arvif->vif->bss_conf.he_full_ul_mumimo)
-+ value |= FIELD_PREP(HE_MODE_UL_MUMIMO, HE_UL_MUMIMO_ENABLE);
-+
-+ if (arvif->vif->bss_conf.he_su_beamformee)
-+ value |= FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE);
-+ }
-+
-+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, value);
-+ if (ret) {
-+ ath11k_warn(ar->ab, "failed to set vdev %d HE MU mode: %d\n",
-+ arvif->vdev_id, ret);
-+ return false;
-+ }
-+
-+ param = WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE;
-+ value = FIELD_PREP(HE_VHT_SOUNDING_MODE, HE_VHT_SOUNDING_MODE_ENABLE) |
-+ FIELD_PREP(HE_TRIG_NONTRIG_SOUNDING_MODE,
-+ HE_TRIG_NONTRIG_SOUNDING_MODE_ENABLE);
-+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
-+ param, value);
-+ if (ret) {
-+ ath11k_warn(ar->ab, "failed to set vdev %d sounding mode: %d\n",
-+ arvif->vdev_id, ret);
-+ return false;
-+ }
-+ return true;
-+}
-+
-+static bool ath11k_mac_vif_recalc_sta_he_txbf(struct ath11k *ar,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_sta_he_cap *he_cap)
-+{
-+ struct ath11k_vif *arvif = (void *)vif->drv_priv;
-+ struct ieee80211_he_cap_elem he_cap_elem = {0};
-+ struct ieee80211_sta_he_cap *cap_band = NULL;
-+ struct cfg80211_chan_def def;
-+ u32 param = WMI_VDEV_PARAM_SET_HEMU_MODE;
-+ u32 hemode = 0;
-+ int ret;
-+
-+ if (!vif->bss_conf.he_support)
-+ return true;
-+
-+ if (vif->type != NL80211_IFTYPE_STATION)
-+ return false;
-+
-+ if (WARN_ON(ath11k_mac_vif_chan(vif, &def)))
-+ return false;
-+
-+ if (def.chan->band == NL80211_BAND_2GHZ)
-+ cap_band = &ar->mac.iftype[NL80211_BAND_2GHZ][vif->type].he_cap;
-+ else
-+ cap_band = &ar->mac.iftype[NL80211_BAND_5GHZ][vif->type].he_cap;
-+
-+ memcpy(&he_cap_elem, &cap_band->he_cap_elem, sizeof(he_cap_elem));
-+
-+ if (HECAP_PHY_SUBFME_GET(he_cap_elem.phy_cap_info)) {
-+ if (HECAP_PHY_SUBFMR_GET(he_cap->he_cap_elem.phy_cap_info))
-+ hemode |= FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE);
-+ if (HECAP_PHY_MUBFMR_GET(he_cap->he_cap_elem.phy_cap_info))
-+ hemode |= FIELD_PREP(HE_MODE_MU_TX_BFEE, HE_MU_BFEE_ENABLE);
-+ }
-+
-+ if (vif->type != NL80211_IFTYPE_MESH_POINT) {
-+ hemode |= FIELD_PREP(HE_MODE_DL_OFDMA, HE_DL_MUOFDMA_ENABLE) |
-+ FIELD_PREP(HE_MODE_UL_OFDMA, HE_UL_MUOFDMA_ENABLE);
-+
-+ if (HECAP_PHY_ULMUMIMO_GET(he_cap_elem.phy_cap_info))
-+ if (HECAP_PHY_ULMUMIMO_GET(he_cap->he_cap_elem.phy_cap_info))
-+ hemode |= FIELD_PREP(HE_MODE_UL_MUMIMO,
-+ HE_UL_MUMIMO_ENABLE);
-+
-+ if (FIELD_GET(HE_MODE_MU_TX_BFEE, hemode))
-+ hemode |= FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE);
-+
-+ if (FIELD_GET(HE_MODE_MU_TX_BFER, hemode))
-+ hemode |= FIELD_PREP(HE_MODE_SU_TX_BFER, HE_SU_BFER_ENABLE);
-+ }
-+
-+ ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id, param, hemode);
-+ if (ret) {
-+ ath11k_warn(ar->ab, "failed to submit vdev param txbf 0x%x: %d\n",
-+ hemode, ret);
-+ return false;
-+ }
-+
-+ return true;
-+}
-+
- static void ath11k_bss_assoc(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_bss_conf *bss_conf)
-@@ -2709,6 +2820,7 @@ static void ath11k_bss_assoc(struct ieee
- struct ieee80211_sta *ap_sta;
- struct ath11k_peer *peer;
- bool is_auth = false;
-+ struct ieee80211_sta_he_cap he_cap;
- int ret;
-
- lockdep_assert_held(&ar->conf_mutex);
-@@ -2726,6 +2838,9 @@ static void ath11k_bss_assoc(struct ieee
- return;
- }
-
-+ /* he_cap here is updated at assoc success for sta mode only */
-+ he_cap = ap_sta->deflink.he_cap;
-+
- ath11k_peer_assoc_prepare(ar, vif, ap_sta, &peer_arg, false);
-
- rcu_read_unlock();
-@@ -2753,6 +2868,12 @@ static void ath11k_bss_assoc(struct ieee
- return;
- }
-
-+ if (!ath11k_mac_vif_recalc_sta_he_txbf(ar, vif, &he_cap)) {
-+ ath11k_warn(ar->ab, "failed to recalc he txbf for vdev %i on bss %pM\n",
-+ arvif->vdev_id, bss_conf->bssid);
-+ return;
-+ }
-+
- WARN_ON(arvif->is_up);
-
- arvif->aid = vif->cfg.aid;
-@@ -3202,6 +3323,8 @@ static void ath11k_mac_op_bss_info_chang
- ether_addr_copy(arvif->bssid, info->bssid);
-
- if (changed & BSS_CHANGED_BEACON_ENABLED) {
-+ if (info->enable_beacon)
-+ ath11k_mac_set_he_txbf_conf(arvif);
- ath11k_control_beaconing(arvif, info);
-
- if (arvif->is_up && vif->bss_conf.he_support &&
-@@ -5392,6 +5515,10 @@ static int ath11k_mac_copy_he_cap(struct
-
- he_cap_elem->mac_cap_info[1] &=
- IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK;
-+ he_cap_elem->phy_cap_info[0] &=
-+ ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
-+ he_cap_elem->phy_cap_info[0] &=
-+ ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G;
-
- he_cap_elem->phy_cap_info[5] &=
- ~IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK;
-@@ -6026,69 +6153,6 @@ ath11k_mac_setup_vdev_create_params(stru
- }
- }
-
--static u32
--ath11k_mac_prepare_he_mode(struct ath11k_pdev *pdev, u32 viftype)
--{
-- struct ath11k_pdev_cap *pdev_cap = &pdev->cap;
-- struct ath11k_band_cap *cap_band = NULL;
-- u32 *hecap_phy_ptr = NULL;
-- u32 hemode = 0;
--
-- if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP)
-- cap_band = &pdev_cap->band[NL80211_BAND_2GHZ];
-- else
-- cap_band = &pdev_cap->band[NL80211_BAND_5GHZ];
--
-- hecap_phy_ptr = &cap_band->he_cap_phy_info[0];
--
-- hemode = FIELD_PREP(HE_MODE_SU_TX_BFEE, HE_SU_BFEE_ENABLE) |
-- FIELD_PREP(HE_MODE_SU_TX_BFER, HECAP_PHY_SUBFMR_GET(hecap_phy_ptr)) |
-- FIELD_PREP(HE_MODE_UL_MUMIMO, HECAP_PHY_ULMUMIMO_GET(hecap_phy_ptr));
--
-- /* TODO WDS and other modes */
-- if (viftype == NL80211_IFTYPE_AP) {
-- hemode |= FIELD_PREP(HE_MODE_MU_TX_BFER,
-- HECAP_PHY_MUBFMR_GET(hecap_phy_ptr)) |
-- FIELD_PREP(HE_MODE_DL_OFDMA, HE_DL_MUOFDMA_ENABLE) |
-- FIELD_PREP(HE_MODE_UL_OFDMA, HE_UL_MUOFDMA_ENABLE);
-- } else {
-- hemode |= FIELD_PREP(HE_MODE_MU_TX_BFEE, HE_MU_BFEE_ENABLE);
-- }
--
-- return hemode;
--}
--
--static int ath11k_set_he_mu_sounding_mode(struct ath11k *ar,
-- struct ath11k_vif *arvif)
--{
-- u32 param_id, param_value;
-- struct ath11k_base *ab = ar->ab;
-- int ret = 0;
--
-- param_id = WMI_VDEV_PARAM_SET_HEMU_MODE;
-- param_value = ath11k_mac_prepare_he_mode(ar->pdev, arvif->vif->type);
-- ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
-- param_id, param_value);
-- if (ret) {
-- ath11k_warn(ab, "failed to set vdev %d HE MU mode: %d param_value %x\n",
-- arvif->vdev_id, ret, param_value);
-- return ret;
-- }
-- param_id = WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE;
-- param_value =
-- FIELD_PREP(HE_VHT_SOUNDING_MODE, HE_VHT_SOUNDING_MODE_ENABLE) |
-- FIELD_PREP(HE_TRIG_NONTRIG_SOUNDING_MODE,
-- HE_TRIG_NONTRIG_SOUNDING_MODE_ENABLE);
-- ret = ath11k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
-- param_id, param_value);
-- if (ret) {
-- ath11k_warn(ab, "failed to set vdev %d HE MU mode: %d\n",
-- arvif->vdev_id, ret);
-- return ret;
-- }
-- return ret;
--}
--
- static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif)
- {
-@@ -6757,7 +6821,6 @@ ath11k_mac_vdev_start_restart(struct ath
- struct ath11k_base *ab = ar->ab;
- struct wmi_vdev_start_req_arg arg = {};
- const struct cfg80211_chan_def *chandef = &ctx->def;
-- int he_support = arvif->vif->bss_conf.he_support;
- int ret = 0;
-
- lockdep_assert_held(&ar->conf_mutex);
-@@ -6798,15 +6861,6 @@ ath11k_mac_vdev_start_restart(struct ath
- spin_lock_bh(&ab->base_lock);
- arg.regdomain = ar->ab->dfs_region;
- spin_unlock_bh(&ab->base_lock);
--
-- if (he_support) {
-- ret = ath11k_set_he_mu_sounding_mode(ar, arvif);
-- if (ret) {
-- ath11k_warn(ar->ab, "failed to set he mode vdev %i\n",
-- arg.vdev_id);
-- return ret;
-- }
-- }
- }
-
- arg.channel.passive |= !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR);
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -2897,8 +2897,11 @@ struct rx_reorder_queue_remove_params {
- #define HE_DL_MUOFDMA_ENABLE 1
- #define HE_UL_MUOFDMA_ENABLE 1
- #define HE_DL_MUMIMO_ENABLE 1
-+#define HE_UL_MUMIMO_ENABLE 1
- #define HE_MU_BFEE_ENABLE 1
- #define HE_SU_BFEE_ENABLE 1
-+#define HE_MU_BFER_ENABLE 1
-+#define HE_SU_BFER_ENABLE 1
-
- #define HE_VHT_SOUNDING_MODE_ENABLE 1
- #define HE_SU_MU_SOUNDING_MODE_ENABLE 1
+++ /dev/null
-From 8077c1bbbc28e527fb29143c46f32c6a9d6cadf0 Mon Sep 17 00:00:00 2001
-From: Muna Sinada <quic_msinada@quicinc.com>
-Date: Fri, 24 Feb 2023 12:28:04 +0200
-Subject: [PATCH] wifi: ath11k: move HE MCS mapper to a separate function
-
-Move HE MCS mapper to a separate function and call new function
-in ath11k_mac_copy_he_cap().
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/1666128501-12364-4-git-send-email-quic_msinada@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 34 +++++++++++++++++----------
- 1 file changed, 22 insertions(+), 12 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -5483,6 +5483,27 @@ static __le16 ath11k_mac_setup_he_6ghz_c
- return cpu_to_le16(bcap->he_6ghz_capa);
- }
-
-+static void ath11k_mac_set_hemcsmap(struct ath11k *ar,
-+ struct ath11k_pdev_cap *cap,
-+ struct ieee80211_sta_he_cap *he_cap,
-+ int band)
-+{
-+ struct ath11k_band_cap *band_cap = &cap->band[band];
-+
-+ he_cap->he_mcs_nss_supp.rx_mcs_80 =
-+ cpu_to_le16(band_cap->he_mcs & 0xffff);
-+ he_cap->he_mcs_nss_supp.tx_mcs_80 =
-+ cpu_to_le16(band_cap->he_mcs & 0xffff);
-+ he_cap->he_mcs_nss_supp.rx_mcs_160 =
-+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-+ he_cap->he_mcs_nss_supp.tx_mcs_160 =
-+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-+ he_cap->he_mcs_nss_supp.rx_mcs_80p80 =
-+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-+ he_cap->he_mcs_nss_supp.tx_mcs_80p80 =
-+ cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-+}
-+
- static int ath11k_mac_copy_he_cap(struct ath11k *ar,
- struct ath11k_pdev_cap *cap,
- struct ieee80211_sband_iftype_data *data,
-@@ -5544,18 +5565,7 @@ static int ath11k_mac_copy_he_cap(struct
- break;
- }
-
-- he_cap->he_mcs_nss_supp.rx_mcs_80 =
-- cpu_to_le16(band_cap->he_mcs & 0xffff);
-- he_cap->he_mcs_nss_supp.tx_mcs_80 =
-- cpu_to_le16(band_cap->he_mcs & 0xffff);
-- he_cap->he_mcs_nss_supp.rx_mcs_160 =
-- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-- he_cap->he_mcs_nss_supp.tx_mcs_160 =
-- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-- he_cap->he_mcs_nss_supp.rx_mcs_80p80 =
-- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-- he_cap->he_mcs_nss_supp.tx_mcs_80p80 =
-- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-+ ath11k_mac_set_hemcsmap(ar, cap, he_cap, band);
-
- memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres));
- if (he_cap_elem->phy_cap_info[6] &
+++ /dev/null
-From ebf82988f844dd98e6b007cffcc5e95986056995 Mon Sep 17 00:00:00 2001
-From: Muna Sinada <quic_msinada@quicinc.com>
-Date: Fri, 24 Feb 2023 12:28:04 +0200
-Subject: [PATCH] wifi: ath11k: generate rx and tx mcs maps for supported HE
- mcs
-
-Generate rx and tx mcs maps in ath11k_mac_set_hemcsmap() and set them
-in supported mcs/nss for HE capabilities.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/1666128501-12364-5-git-send-email-quic_msinada@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 30 ++++++++++++++++++++-------
- 1 file changed, 23 insertions(+), 7 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -5488,20 +5488,36 @@ static void ath11k_mac_set_hemcsmap(stru
- struct ieee80211_sta_he_cap *he_cap,
- int band)
- {
-- struct ath11k_band_cap *band_cap = &cap->band[band];
-+ u16 txmcs_map, rxmcs_map;
-+ u32 i;
-
-+ rxmcs_map = 0;
-+ txmcs_map = 0;
-+ for (i = 0; i < 8; i++) {
-+ if (i < ar->num_tx_chains &&
-+ (ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift) & BIT(i))
-+ txmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2);
-+ else
-+ txmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2);
-+
-+ if (i < ar->num_rx_chains &&
-+ (ar->cfg_rx_chainmask >> cap->tx_chain_mask_shift) & BIT(i))
-+ rxmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2);
-+ else
-+ rxmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2);
-+ }
- he_cap->he_mcs_nss_supp.rx_mcs_80 =
-- cpu_to_le16(band_cap->he_mcs & 0xffff);
-+ cpu_to_le16(rxmcs_map & 0xffff);
- he_cap->he_mcs_nss_supp.tx_mcs_80 =
-- cpu_to_le16(band_cap->he_mcs & 0xffff);
-+ cpu_to_le16(txmcs_map & 0xffff);
- he_cap->he_mcs_nss_supp.rx_mcs_160 =
-- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-+ cpu_to_le16(rxmcs_map & 0xffff);
- he_cap->he_mcs_nss_supp.tx_mcs_160 =
-- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-+ cpu_to_le16(txmcs_map & 0xffff);
- he_cap->he_mcs_nss_supp.rx_mcs_80p80 =
-- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-+ cpu_to_le16(rxmcs_map & 0xffff);
- he_cap->he_mcs_nss_supp.tx_mcs_80p80 =
-- cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-+ cpu_to_le16(txmcs_map & 0xffff);
- }
-
- static int ath11k_mac_copy_he_cap(struct ath11k *ar,
+++ /dev/null
-From 01c6c9fccbd51c1d9eab0f5794b0271b026178df Mon Sep 17 00:00:00 2001
-From: Abinaya Kalaiselvan <quic_akalaise@quicinc.com>
-Date: Mon, 19 Dec 2022 11:08:44 +0530
-Subject: [PATCH] wifi: ath11k: Add tx ack signal support for management
- packets
-
-Add support to notify tx ack signal values for management
-packets to userspace through nl80211 interface.
-
-Advertise NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT flag
-to enable this feature and it will be used for data
-packets as well.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Abinaya Kalaiselvan <quic_akalaise@quicinc.com>
-Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20221219053844.4084486-1-quic_mkenna@quicinc.com
----
- drivers/net/wireless/ath/ath11k/hw.c | 1 +
- drivers/net/wireless/ath/ath11k/mac.c | 5 +++++
- drivers/net/wireless/ath/ath11k/wmi.c | 27 ++++++++++++++++-----------
- drivers/net/wireless/ath/ath11k/wmi.h | 3 +++
- 4 files changed, 25 insertions(+), 11 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/hw.c
-+++ b/drivers/net/wireless/ath/ath11k/hw.c
-@@ -201,6 +201,7 @@ static void ath11k_init_wmi_config_ipq80
- config->twt_ap_pdev_count = ab->num_radios;
- config->twt_ap_sta_count = 1000;
- config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64;
-+ config->flag1 |= WMI_RSRC_CFG_FLAG1_ACK_RSSI;
- }
-
- static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw,
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -9174,6 +9174,11 @@ static int __ath11k_mac_register(struct
- goto err_free_if_combs;
- }
-
-+ if (test_bit(WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI,
-+ ar->ab->wmi_ab.svc_map))
-+ wiphy_ext_feature_set(ar->hw->wiphy,
-+ NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
-+
- ar->hw->queues = ATH11K_HW_MAX_QUEUES;
- ar->hw->wiphy->tx_queue_len = ATH11K_QUEUE_LEN;
- ar->hw->offchannel_tx_hw_queue = ATH11K_HW_MAX_QUEUES - 1;
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -5229,8 +5229,8 @@ static int ath11k_pull_mgmt_rx_params_tl
- return 0;
- }
-
--static int wmi_process_mgmt_tx_comp(struct ath11k *ar, u32 desc_id,
-- u32 status)
-+static int wmi_process_mgmt_tx_comp(struct ath11k *ar,
-+ struct wmi_mgmt_tx_compl_event *tx_compl_param)
- {
- struct sk_buff *msdu;
- struct ieee80211_tx_info *info;
-@@ -5238,24 +5238,29 @@ static int wmi_process_mgmt_tx_comp(stru
- int num_mgmt;
-
- spin_lock_bh(&ar->txmgmt_idr_lock);
-- msdu = idr_find(&ar->txmgmt_idr, desc_id);
-+ msdu = idr_find(&ar->txmgmt_idr, tx_compl_param->desc_id);
-
- if (!msdu) {
- ath11k_warn(ar->ab, "received mgmt tx compl for invalid msdu_id: %d\n",
-- desc_id);
-+ tx_compl_param->desc_id);
- spin_unlock_bh(&ar->txmgmt_idr_lock);
- return -ENOENT;
- }
-
-- idr_remove(&ar->txmgmt_idr, desc_id);
-+ idr_remove(&ar->txmgmt_idr, tx_compl_param->desc_id);
- spin_unlock_bh(&ar->txmgmt_idr_lock);
-
- skb_cb = ATH11K_SKB_CB(msdu);
- dma_unmap_single(ar->ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
-
- info = IEEE80211_SKB_CB(msdu);
-- if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && !status)
-+ if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) &&
-+ !tx_compl_param->status) {
- info->flags |= IEEE80211_TX_STAT_ACK;
-+ if (test_bit(WMI_TLV_SERVICE_TX_DATA_MGMT_ACK_RSSI,
-+ ar->ab->wmi_ab.svc_map))
-+ info->status.ack_signal = tx_compl_param->ack_rssi;
-+ }
-
- ieee80211_tx_status_irqsafe(ar->hw, msdu);
-
-@@ -5267,7 +5272,7 @@ static int wmi_process_mgmt_tx_comp(stru
-
- ath11k_dbg(ar->ab, ATH11K_DBG_WMI,
- "wmi mgmt tx comp pending %d desc id %d\n",
-- num_mgmt, desc_id);
-+ num_mgmt, tx_compl_param->desc_id);
-
- if (!num_mgmt)
- wake_up(&ar->txmgmt_empty_waitq);
-@@ -5300,6 +5305,7 @@ static int ath11k_pull_mgmt_tx_compl_par
- param->pdev_id = ev->pdev_id;
- param->desc_id = ev->desc_id;
- param->status = ev->status;
-+ param->ack_rssi = ev->ack_rssi;
-
- kfree(tb);
- return 0;
-@@ -7070,13 +7076,12 @@ static void ath11k_mgmt_tx_compl_event(s
- goto exit;
- }
-
-- wmi_process_mgmt_tx_comp(ar, tx_compl_param.desc_id,
-- tx_compl_param.status);
-+ wmi_process_mgmt_tx_comp(ar, &tx_compl_param);
-
- ath11k_dbg(ab, ATH11K_DBG_MGMT,
-- "mgmt tx compl ev pdev_id %d, desc_id %d, status %d",
-+ "mgmt tx compl ev pdev_id %d, desc_id %d, status %d ack_rssi %d",
- tx_compl_param.pdev_id, tx_compl_param.desc_id,
-- tx_compl_param.status);
-+ tx_compl_param.status, tx_compl_param.ack_rssi);
-
- exit:
- rcu_read_unlock();
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -2311,6 +2311,7 @@ struct wmi_init_cmd {
- } __packed;
-
- #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5)
-+#define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18)
-
- struct wmi_resource_config {
- u32 tlv_header;
-@@ -4550,6 +4551,8 @@ struct wmi_mgmt_tx_compl_event {
- u32 desc_id;
- u32 status;
- u32 pdev_id;
-+ u32 ppdu_id;
-+ u32 ack_rssi;
- } __packed;
-
- struct wmi_scan_event {
+++ /dev/null
-From 25e289e1f52e1f4fb1d07622c6a24f8d8a8e420d Mon Sep 17 00:00:00 2001
-From: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Date: Wed, 1 Mar 2023 16:20:58 +0200
-Subject: [PATCH] wifi: ath11k: use proper regulatory reference for bands
-
-Currently, during regulatory event, 2 GHz/5 GHz is referred
-to as 2G/5G including variable names. However, there is no
-such entity as 2G or 5G.
-
-Re-name such occurences to its proper name. No functional changes.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230110121024.14051-2-quic_adisi@quicinc.com
----
- drivers/net/wireless/ath/ath11k/reg.c | 20 ++++-----
- drivers/net/wireless/ath/ath11k/wmi.c | 58 ++++++++++++++-------------
- drivers/net/wireless/ath/ath11k/wmi.h | 28 ++++++-------
- 3 files changed, 54 insertions(+), 52 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/reg.c
-+++ b/drivers/net/wireless/ath/ath11k/reg.c
-@@ -619,7 +619,7 @@ ath11k_reg_build_regd(struct ath11k_base
- u32 flags;
- char alpha2[3];
-
-- num_rules = reg_info->num_5g_reg_rules + reg_info->num_2g_reg_rules;
-+ num_rules = reg_info->num_5ghz_reg_rules + reg_info->num_2ghz_reg_rules;
-
- if (!num_rules)
- goto ret;
-@@ -644,20 +644,20 @@ ath11k_reg_build_regd(struct ath11k_base
- alpha2, ath11k_reg_get_regdom_str(tmp_regd->dfs_region),
- reg_info->dfs_region, num_rules);
- /* Update reg_rules[] below. Firmware is expected to
-- * send these rules in order(2G rules first and then 5G)
-+ * send these rules in order(2 GHz rules first and then 5 GHz)
- */
- for (; i < num_rules; i++) {
-- if (reg_info->num_2g_reg_rules &&
-- (i < reg_info->num_2g_reg_rules)) {
-- reg_rule = reg_info->reg_rules_2g_ptr + i;
-+ if (reg_info->num_2ghz_reg_rules &&
-+ (i < reg_info->num_2ghz_reg_rules)) {
-+ reg_rule = reg_info->reg_rules_2ghz_ptr + i;
- max_bw = min_t(u16, reg_rule->max_bw,
-- reg_info->max_bw_2g);
-+ reg_info->max_bw_2ghz);
- flags = 0;
-- } else if (reg_info->num_5g_reg_rules &&
-- (j < reg_info->num_5g_reg_rules)) {
-- reg_rule = reg_info->reg_rules_5g_ptr + j++;
-+ } else if (reg_info->num_5ghz_reg_rules &&
-+ (j < reg_info->num_5ghz_reg_rules)) {
-+ reg_rule = reg_info->reg_rules_5ghz_ptr + j++;
- max_bw = min_t(u16, reg_rule->max_bw,
-- reg_info->max_bw_5g);
-+ reg_info->max_bw_5ghz);
-
- /* FW doesn't pass NL80211_RRF_AUTO_BW flag for
- * BW Auto correction, we can enable this by default
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -4959,7 +4959,7 @@ static int ath11k_pull_reg_chan_list_upd
- const void **tb;
- const struct wmi_reg_chan_list_cc_event *chan_list_event_hdr;
- struct wmi_regulatory_rule_struct *wmi_reg_rule;
-- u32 num_2g_reg_rules, num_5g_reg_rules;
-+ u32 num_2ghz_reg_rules, num_5ghz_reg_rules;
- int ret;
-
- ath11k_dbg(ab, ATH11K_DBG_WMI, "processing regulatory channel list\n");
-@@ -4978,10 +4978,10 @@ static int ath11k_pull_reg_chan_list_upd
- return -EPROTO;
- }
-
-- reg_info->num_2g_reg_rules = chan_list_event_hdr->num_2g_reg_rules;
-- reg_info->num_5g_reg_rules = chan_list_event_hdr->num_5g_reg_rules;
-+ reg_info->num_2ghz_reg_rules = chan_list_event_hdr->num_2ghz_reg_rules;
-+ reg_info->num_5ghz_reg_rules = chan_list_event_hdr->num_5ghz_reg_rules;
-
-- if (!(reg_info->num_2g_reg_rules + reg_info->num_5g_reg_rules)) {
-+ if (!(reg_info->num_2ghz_reg_rules + reg_info->num_5ghz_reg_rules)) {
- ath11k_warn(ab, "No regulatory rules available in the event info\n");
- kfree(tb);
- return -EINVAL;
-@@ -5008,46 +5008,48 @@ static int ath11k_pull_reg_chan_list_upd
- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_FAIL)
- reg_info->status_code = REG_SET_CC_STATUS_FAIL;
-
-- reg_info->min_bw_2g = chan_list_event_hdr->min_bw_2g;
-- reg_info->max_bw_2g = chan_list_event_hdr->max_bw_2g;
-- reg_info->min_bw_5g = chan_list_event_hdr->min_bw_5g;
-- reg_info->max_bw_5g = chan_list_event_hdr->max_bw_5g;
-+ reg_info->min_bw_2ghz = chan_list_event_hdr->min_bw_2ghz;
-+ reg_info->max_bw_2ghz = chan_list_event_hdr->max_bw_2ghz;
-+ reg_info->min_bw_5ghz = chan_list_event_hdr->min_bw_5ghz;
-+ reg_info->max_bw_5ghz = chan_list_event_hdr->max_bw_5ghz;
-
-- num_2g_reg_rules = reg_info->num_2g_reg_rules;
-- num_5g_reg_rules = reg_info->num_5g_reg_rules;
-+ num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules;
-+ num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules;
-
- ath11k_dbg(ab, ATH11K_DBG_WMI,
-- "%s:cc %s dsf %d BW: min_2g %d max_2g %d min_5g %d max_5g %d",
-+ "%s:cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
- __func__, reg_info->alpha2, reg_info->dfs_region,
-- reg_info->min_bw_2g, reg_info->max_bw_2g,
-- reg_info->min_bw_5g, reg_info->max_bw_5g);
-+ reg_info->min_bw_2ghz, reg_info->max_bw_2ghz,
-+ reg_info->min_bw_5ghz, reg_info->max_bw_5ghz);
-
- ath11k_dbg(ab, ATH11K_DBG_WMI,
-- "%s: num_2g_reg_rules %d num_5g_reg_rules %d", __func__,
-- num_2g_reg_rules, num_5g_reg_rules);
-+ "%s: num_2ghz_reg_rules %d num_5ghz_reg_rules %d", __func__,
-+ num_2ghz_reg_rules, num_5ghz_reg_rules);
-
- wmi_reg_rule =
- (struct wmi_regulatory_rule_struct *)((u8 *)chan_list_event_hdr
- + sizeof(*chan_list_event_hdr)
- + sizeof(struct wmi_tlv));
-
-- if (num_2g_reg_rules) {
-- reg_info->reg_rules_2g_ptr = create_reg_rules_from_wmi(num_2g_reg_rules,
-- wmi_reg_rule);
-- if (!reg_info->reg_rules_2g_ptr) {
-+ if (num_2ghz_reg_rules) {
-+ reg_info->reg_rules_2ghz_ptr =
-+ create_reg_rules_from_wmi(num_2ghz_reg_rules,
-+ wmi_reg_rule);
-+ if (!reg_info->reg_rules_2ghz_ptr) {
- kfree(tb);
-- ath11k_warn(ab, "Unable to Allocate memory for 2g rules\n");
-+ ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n");
- return -ENOMEM;
- }
- }
-
-- if (num_5g_reg_rules) {
-- wmi_reg_rule += num_2g_reg_rules;
-- reg_info->reg_rules_5g_ptr = create_reg_rules_from_wmi(num_5g_reg_rules,
-- wmi_reg_rule);
-- if (!reg_info->reg_rules_5g_ptr) {
-+ if (num_5ghz_reg_rules) {
-+ wmi_reg_rule += num_2ghz_reg_rules;
-+ reg_info->reg_rules_5ghz_ptr =
-+ create_reg_rules_from_wmi(num_5ghz_reg_rules,
-+ wmi_reg_rule);
-+ if (!reg_info->reg_rules_5ghz_ptr) {
- kfree(tb);
-- ath11k_warn(ab, "Unable to Allocate memory for 5g rules\n");
-+ ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n");
- return -ENOMEM;
- }
- }
-@@ -6619,8 +6621,8 @@ fallback:
- WARN_ON(1);
- mem_free:
- if (reg_info) {
-- kfree(reg_info->reg_rules_2g_ptr);
-- kfree(reg_info->reg_rules_5g_ptr);
-+ kfree(reg_info->reg_rules_2ghz_ptr);
-+ kfree(reg_info->reg_rules_5ghz_ptr);
- kfree(reg_info);
- }
- return ret;
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -4129,14 +4129,14 @@ struct cur_regulatory_info {
- u8 alpha2[REG_ALPHA2_LEN + 1];
- u32 dfs_region;
- u32 phybitmap;
-- u32 min_bw_2g;
-- u32 max_bw_2g;
-- u32 min_bw_5g;
-- u32 max_bw_5g;
-- u32 num_2g_reg_rules;
-- u32 num_5g_reg_rules;
-- struct cur_reg_rule *reg_rules_2g_ptr;
-- struct cur_reg_rule *reg_rules_5g_ptr;
-+ u32 min_bw_2ghz;
-+ u32 max_bw_2ghz;
-+ u32 min_bw_5ghz;
-+ u32 max_bw_5ghz;
-+ u32 num_2ghz_reg_rules;
-+ u32 num_5ghz_reg_rules;
-+ struct cur_reg_rule *reg_rules_2ghz_ptr;
-+ struct cur_reg_rule *reg_rules_5ghz_ptr;
- };
-
- struct wmi_reg_chan_list_cc_event {
-@@ -4148,12 +4148,12 @@ struct wmi_reg_chan_list_cc_event {
- u32 domain_code;
- u32 dfs_region;
- u32 phybitmap;
-- u32 min_bw_2g;
-- u32 max_bw_2g;
-- u32 min_bw_5g;
-- u32 max_bw_5g;
-- u32 num_2g_reg_rules;
-- u32 num_5g_reg_rules;
-+ u32 min_bw_2ghz;
-+ u32 max_bw_2ghz;
-+ u32 min_bw_5ghz;
-+ u32 max_bw_5ghz;
-+ u32 num_2ghz_reg_rules;
-+ u32 num_5ghz_reg_rules;
- } __packed;
-
- struct wmi_regulatory_rule_struct {
+++ /dev/null
-From 91fa00fa69224aae5afb720c5e68b22e4c4f7333 Mon Sep 17 00:00:00 2001
-From: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Date: Wed, 1 Mar 2023 16:20:59 +0200
-Subject: [PATCH] wifi: ath11k: add support to parse new WMI event for 6 GHz
-
-In order to support different power levels of 6 GHz AP and client,
-new WMI event for regulatory - WMI_REG_CHAN_LIST_CC_EXT_EVENTID is
-added in firmware. This event provides new parameters required for
-6 GHz regulatory rules.
-
-Add support for parsing 2.4 GHz, 5 GHz and 6 GHz reg rules and other
-parameters from WMI_REG_CHAN_LIST_CC_EXT_EVENTID.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Lavanya Suresh <quic_lavaks@quicinc.com>
-Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
-Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230110121024.14051-3-quic_adisi@quicinc.com
----
- drivers/net/wireless/ath/ath11k/reg.c | 37 ++-
- drivers/net/wireless/ath/ath11k/wmi.c | 418 +++++++++++++++++++++++++-
- drivers/net/wireless/ath/ath11k/wmi.h | 163 +++++++++-
- 3 files changed, 584 insertions(+), 34 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/reg.c
-+++ b/drivers/net/wireless/ath/ath11k/reg.c
-@@ -613,7 +613,7 @@ ath11k_reg_build_regd(struct ath11k_base
- {
- struct ieee80211_regdomain *tmp_regd, *default_regd, *new_regd = NULL;
- struct cur_reg_rule *reg_rule;
-- u8 i = 0, j = 0;
-+ u8 i = 0, j = 0, k = 0;
- u8 num_rules;
- u16 max_bw;
- u32 flags;
-@@ -621,6 +621,12 @@ ath11k_reg_build_regd(struct ath11k_base
-
- num_rules = reg_info->num_5ghz_reg_rules + reg_info->num_2ghz_reg_rules;
-
-+ /* FIXME: Currently taking reg rules for 6 GHz only from Indoor AP mode list.
-+ * This can be updated after complete 6 GHz regulatory support is added.
-+ */
-+ if (reg_info->is_ext_reg_event)
-+ num_rules += reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP];
-+
- if (!num_rules)
- goto ret;
-
-@@ -666,6 +672,14 @@ ath11k_reg_build_regd(struct ath11k_base
- * per other BW rule flags we pass from here
- */
- flags = NL80211_RRF_AUTO_BW;
-+ } else if (reg_info->is_ext_reg_event &&
-+ reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] &&
-+ (k < reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP])) {
-+ reg_rule = reg_info->reg_rules_6ghz_ap_ptr[WMI_REG_INDOOR_AP] +
-+ k++;
-+ max_bw = min_t(u16, reg_rule->max_bw,
-+ reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP]);
-+ flags = NL80211_RRF_AUTO_BW;
- } else {
- break;
- }
-@@ -693,12 +707,21 @@ ath11k_reg_build_regd(struct ath11k_base
- continue;
- }
-
-- ath11k_dbg(ab, ATH11K_DBG_REG,
-- "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
-- i + 1, reg_rule->start_freq, reg_rule->end_freq,
-- max_bw, reg_rule->ant_gain, reg_rule->reg_power,
-- tmp_regd->reg_rules[i].dfs_cac_ms,
-- flags);
-+ if (reg_info->is_ext_reg_event) {
-+ ath11k_dbg(ab, ATH11K_DBG_REG,
-+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d) (%d, %d)\n",
-+ i + 1, reg_rule->start_freq, reg_rule->end_freq,
-+ max_bw, reg_rule->ant_gain, reg_rule->reg_power,
-+ tmp_regd->reg_rules[i].dfs_cac_ms, flags,
-+ reg_rule->psd_flag, reg_rule->psd_eirp);
-+ } else {
-+ ath11k_dbg(ab, ATH11K_DBG_REG,
-+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
-+ i + 1, reg_rule->start_freq, reg_rule->end_freq,
-+ max_bw, reg_rule->ant_gain, reg_rule->reg_power,
-+ tmp_regd->reg_rules[i].dfs_cac_ms,
-+ flags);
-+ }
- }
-
- tmp_regd->n_reg_rules = i;
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -105,6 +105,8 @@ static const struct wmi_tlv_policy wmi_t
- = { .min_len = sizeof(struct wmi_vdev_stopped_event) },
- [WMI_TAG_REG_CHAN_LIST_CC_EVENT]
- = { .min_len = sizeof(struct wmi_reg_chan_list_cc_event) },
-+ [WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT]
-+ = { .min_len = sizeof(struct wmi_reg_chan_list_cc_ext_event) },
- [WMI_TAG_MGMT_RX_HDR]
- = { .min_len = sizeof(struct wmi_mgmt_rx_hdr) },
- [WMI_TAG_MGMT_TX_COMPL_EVENT]
-@@ -3974,6 +3976,10 @@ ath11k_wmi_copy_resource_config(struct w
- wmi_cfg->sched_params = tg_cfg->sched_params;
- wmi_cfg->twt_ap_pdev_count = tg_cfg->twt_ap_pdev_count;
- wmi_cfg->twt_ap_sta_count = tg_cfg->twt_ap_sta_count;
-+ wmi_cfg->host_service_flags &=
-+ ~(1 << WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT);
-+ wmi_cfg->host_service_flags |= (tg_cfg->is_reg_cc_ext_event_supported <<
-+ WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT);
- }
-
- static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
-@@ -4192,6 +4198,10 @@ int ath11k_wmi_cmd_init(struct ath11k_ba
-
- ab->hw_params.hw_ops->wmi_init_config(ab, &config);
-
-+ if (test_bit(WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT,
-+ ab->wmi_ab.svc_map))
-+ config.is_reg_cc_ext_event_supported = 1;
-+
- memcpy(&wmi_sc->wlan_resource_config, &config, sizeof(config));
-
- init_param.res_cfg = &wmi_sc->wlan_resource_config;
-@@ -4995,18 +5005,11 @@ static int ath11k_pull_reg_chan_list_upd
- reg_info->phy_id = chan_list_event_hdr->phy_id;
- reg_info->ctry_code = chan_list_event_hdr->country_id;
- reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code;
-- if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_PASS)
-- reg_info->status_code = REG_SET_CC_STATUS_PASS;
-- else if (chan_list_event_hdr->status_code == WMI_REG_CURRENT_ALPHA2_NOT_FOUND)
-- reg_info->status_code = REG_CURRENT_ALPHA2_NOT_FOUND;
-- else if (chan_list_event_hdr->status_code == WMI_REG_INIT_ALPHA2_NOT_FOUND)
-- reg_info->status_code = REG_INIT_ALPHA2_NOT_FOUND;
-- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_CHANGE_NOT_ALLOWED)
-- reg_info->status_code = REG_SET_CC_CHANGE_NOT_ALLOWED;
-- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_NO_MEMORY)
-- reg_info->status_code = REG_SET_CC_STATUS_NO_MEMORY;
-- else if (chan_list_event_hdr->status_code == WMI_REG_SET_CC_STATUS_FAIL)
-- reg_info->status_code = REG_SET_CC_STATUS_FAIL;
-+
-+ reg_info->status_code =
-+ ath11k_wmi_cc_setting_code_to_reg(chan_list_event_hdr->status_code);
-+
-+ reg_info->is_ext_reg_event = false;
-
- reg_info->min_bw_2ghz = chan_list_event_hdr->min_bw_2ghz;
- reg_info->max_bw_2ghz = chan_list_event_hdr->max_bw_2ghz;
-@@ -5060,6 +5063,372 @@ static int ath11k_pull_reg_chan_list_upd
- return 0;
- }
-
-+static struct cur_reg_rule
-+*create_ext_reg_rules_from_wmi(u32 num_reg_rules,
-+ struct wmi_regulatory_ext_rule *wmi_reg_rule)
-+{
-+ struct cur_reg_rule *reg_rule_ptr;
-+ u32 count;
-+
-+ reg_rule_ptr = kcalloc(num_reg_rules, sizeof(*reg_rule_ptr), GFP_ATOMIC);
-+
-+ if (!reg_rule_ptr)
-+ return NULL;
-+
-+ for (count = 0; count < num_reg_rules; count++) {
-+ reg_rule_ptr[count].start_freq =
-+ u32_get_bits(wmi_reg_rule[count].freq_info,
-+ REG_RULE_START_FREQ);
-+ reg_rule_ptr[count].end_freq =
-+ u32_get_bits(wmi_reg_rule[count].freq_info,
-+ REG_RULE_END_FREQ);
-+ reg_rule_ptr[count].max_bw =
-+ u32_get_bits(wmi_reg_rule[count].bw_pwr_info,
-+ REG_RULE_MAX_BW);
-+ reg_rule_ptr[count].reg_power =
-+ u32_get_bits(wmi_reg_rule[count].bw_pwr_info,
-+ REG_RULE_REG_PWR);
-+ reg_rule_ptr[count].ant_gain =
-+ u32_get_bits(wmi_reg_rule[count].bw_pwr_info,
-+ REG_RULE_ANT_GAIN);
-+ reg_rule_ptr[count].flags =
-+ u32_get_bits(wmi_reg_rule[count].flag_info,
-+ REG_RULE_FLAGS);
-+ reg_rule_ptr[count].psd_flag =
-+ u32_get_bits(wmi_reg_rule[count].psd_power_info,
-+ REG_RULE_PSD_INFO);
-+ reg_rule_ptr[count].psd_eirp =
-+ u32_get_bits(wmi_reg_rule[count].psd_power_info,
-+ REG_RULE_PSD_EIRP);
-+ }
-+
-+ return reg_rule_ptr;
-+}
-+
-+static u8
-+ath11k_invalid_5ghz_reg_ext_rules_from_wmi(u32 num_reg_rules,
-+ const struct wmi_regulatory_ext_rule *rule)
-+{
-+ u8 num_invalid_5ghz_rules = 0;
-+ u32 count, start_freq;
-+
-+ for (count = 0; count < num_reg_rules; count++) {
-+ start_freq = u32_get_bits(rule[count].freq_info,
-+ REG_RULE_START_FREQ);
-+
-+ if (start_freq >= ATH11K_MIN_6G_FREQ)
-+ num_invalid_5ghz_rules++;
-+ }
-+
-+ return num_invalid_5ghz_rules;
-+}
-+
-+static int ath11k_pull_reg_chan_list_ext_update_ev(struct ath11k_base *ab,
-+ struct sk_buff *skb,
-+ struct cur_regulatory_info *reg_info)
-+{
-+ const void **tb;
-+ const struct wmi_reg_chan_list_cc_ext_event *ext_chan_list_event_hdr;
-+ struct wmi_regulatory_ext_rule *ext_wmi_reg_rule;
-+ u32 num_2ghz_reg_rules, num_5ghz_reg_rules;
-+ u32 num_6ghz_reg_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE];
-+ u32 num_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE];
-+ u32 total_reg_rules = 0;
-+ int ret, i, j, num_invalid_5ghz_ext_rules = 0;
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI, "processing regulatory ext channel list\n");
-+
-+ tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC);
-+ if (IS_ERR(tb)) {
-+ ret = PTR_ERR(tb);
-+ ath11k_warn(ab, "failed to parse tlv: %d\n", ret);
-+ return ret;
-+ }
-+
-+ ext_chan_list_event_hdr = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT];
-+ if (!ext_chan_list_event_hdr) {
-+ ath11k_warn(ab, "failed to fetch reg chan list ext update ev\n");
-+ kfree(tb);
-+ return -EPROTO;
-+ }
-+
-+ reg_info->num_2ghz_reg_rules =
-+ ext_chan_list_event_hdr->num_2ghz_reg_rules;
-+ reg_info->num_5ghz_reg_rules =
-+ ext_chan_list_event_hdr->num_5ghz_reg_rules;
-+ reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] =
-+ ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_lpi;
-+ reg_info->num_6ghz_rules_ap[WMI_REG_STANDARD_POWER_AP] =
-+ ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_sp;
-+ reg_info->num_6ghz_rules_ap[WMI_REG_VERY_LOW_POWER_AP] =
-+ ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_vlp;
-+
-+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
-+ reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i] =
-+ ext_chan_list_event_hdr->num_6ghz_reg_rules_client_lpi[i];
-+ reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i] =
-+ ext_chan_list_event_hdr->num_6ghz_reg_rules_client_sp[i];
-+ reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i] =
-+ ext_chan_list_event_hdr->num_6ghz_reg_rules_client_vlp[i];
-+ }
-+
-+ num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules;
-+ num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules;
-+
-+ total_reg_rules += num_2ghz_reg_rules;
-+ total_reg_rules += num_5ghz_reg_rules;
-+
-+ if ((num_2ghz_reg_rules > MAX_REG_RULES) ||
-+ (num_5ghz_reg_rules > MAX_REG_RULES)) {
-+ ath11k_warn(ab, "Num reg rules for 2.4 GHz/5 GHz exceeds max limit (num_2ghz_reg_rules: %d num_5ghz_reg_rules: %d max_rules: %d)\n",
-+ num_2ghz_reg_rules, num_5ghz_reg_rules, MAX_REG_RULES);
-+ kfree(tb);
-+ return -EINVAL;
-+ }
-+
-+ for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) {
-+ num_6ghz_reg_rules_ap[i] = reg_info->num_6ghz_rules_ap[i];
-+
-+ if (num_6ghz_reg_rules_ap[i] > MAX_6GHZ_REG_RULES) {
-+ ath11k_warn(ab, "Num 6 GHz reg rules for AP mode(%d) exceeds max limit (num_6ghz_reg_rules_ap: %d, max_rules: %d)\n",
-+ i, num_6ghz_reg_rules_ap[i], MAX_6GHZ_REG_RULES);
-+ kfree(tb);
-+ return -EINVAL;
-+ }
-+
-+ total_reg_rules += num_6ghz_reg_rules_ap[i];
-+ }
-+
-+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
-+ num_6ghz_client[WMI_REG_INDOOR_AP][i] =
-+ reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i];
-+ total_reg_rules += num_6ghz_client[WMI_REG_INDOOR_AP][i];
-+
-+ num_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
-+ reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i];
-+ total_reg_rules += num_6ghz_client[WMI_REG_STANDARD_POWER_AP][i];
-+
-+ num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
-+ reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i];
-+ total_reg_rules += num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i];
-+
-+ if ((num_6ghz_client[WMI_REG_INDOOR_AP][i] > MAX_6GHZ_REG_RULES) ||
-+ (num_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] >
-+ MAX_6GHZ_REG_RULES) ||
-+ (num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] >
-+ MAX_6GHZ_REG_RULES)) {
-+ ath11k_warn(ab,
-+ "Num 6 GHz client reg rules exceeds max limit, for client(type: %d)\n",
-+ i);
-+ kfree(tb);
-+ return -EINVAL;
-+ }
-+ }
-+
-+ if (!total_reg_rules) {
-+ ath11k_warn(ab, "No reg rules available\n");
-+ kfree(tb);
-+ return -EINVAL;
-+ }
-+
-+ memcpy(reg_info->alpha2, &ext_chan_list_event_hdr->alpha2,
-+ REG_ALPHA2_LEN);
-+
-+ reg_info->dfs_region = ext_chan_list_event_hdr->dfs_region;
-+ reg_info->phybitmap = ext_chan_list_event_hdr->phybitmap;
-+ reg_info->num_phy = ext_chan_list_event_hdr->num_phy;
-+ reg_info->phy_id = ext_chan_list_event_hdr->phy_id;
-+ reg_info->ctry_code = ext_chan_list_event_hdr->country_id;
-+ reg_info->reg_dmn_pair = ext_chan_list_event_hdr->domain_code;
-+
-+ reg_info->status_code =
-+ ath11k_wmi_cc_setting_code_to_reg(ext_chan_list_event_hdr->status_code);
-+
-+ reg_info->is_ext_reg_event = true;
-+
-+ reg_info->min_bw_2ghz = ext_chan_list_event_hdr->min_bw_2ghz;
-+ reg_info->max_bw_2ghz = ext_chan_list_event_hdr->max_bw_2ghz;
-+ reg_info->min_bw_5ghz = ext_chan_list_event_hdr->min_bw_5ghz;
-+ reg_info->max_bw_5ghz = ext_chan_list_event_hdr->max_bw_5ghz;
-+
-+ reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP] =
-+ ext_chan_list_event_hdr->min_bw_6ghz_ap_lpi;
-+ reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP] =
-+ ext_chan_list_event_hdr->max_bw_6ghz_ap_lpi;
-+ reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
-+ ext_chan_list_event_hdr->min_bw_6ghz_ap_sp;
-+ reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
-+ ext_chan_list_event_hdr->max_bw_6ghz_ap_sp;
-+ reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
-+ ext_chan_list_event_hdr->min_bw_6ghz_ap_vlp;
-+ reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
-+ ext_chan_list_event_hdr->max_bw_6ghz_ap_vlp;
-+
-+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
-+ reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i] =
-+ ext_chan_list_event_hdr->min_bw_6ghz_client_lpi[i];
-+ reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i] =
-+ ext_chan_list_event_hdr->max_bw_6ghz_client_lpi[i];
-+ reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
-+ ext_chan_list_event_hdr->min_bw_6ghz_client_sp[i];
-+ reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
-+ ext_chan_list_event_hdr->max_bw_6ghz_client_sp[i];
-+ reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
-+ ext_chan_list_event_hdr->min_bw_6ghz_client_vlp[i];
-+ reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
-+ ext_chan_list_event_hdr->max_bw_6ghz_client_vlp[i];
-+ }
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "%s:cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
-+ __func__, reg_info->alpha2, reg_info->dfs_region,
-+ reg_info->min_bw_2ghz, reg_info->max_bw_2ghz,
-+ reg_info->min_bw_5ghz, reg_info->max_bw_5ghz);
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "num_2ghz_reg_rules %d num_5ghz_reg_rules %d",
-+ num_2ghz_reg_rules, num_5ghz_reg_rules);
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "num_6ghz_reg_rules_ap_lpi: %d num_6ghz_reg_rules_ap_sp: %d num_6ghz_reg_rules_ap_vlp: %d",
-+ num_6ghz_reg_rules_ap[WMI_REG_INDOOR_AP],
-+ num_6ghz_reg_rules_ap[WMI_REG_STANDARD_POWER_AP],
-+ num_6ghz_reg_rules_ap[WMI_REG_VERY_LOW_POWER_AP]);
-+
-+ j = WMI_REG_DEFAULT_CLIENT;
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "6 GHz Regular client: num_6ghz_reg_rules_lpi: %d num_6ghz_reg_rules_sp: %d num_6ghz_reg_rules_vlp: %d",
-+ num_6ghz_client[WMI_REG_INDOOR_AP][j],
-+ num_6ghz_client[WMI_REG_STANDARD_POWER_AP][j],
-+ num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]);
-+
-+ j = WMI_REG_SUBORDINATE_CLIENT;
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "6 GHz Subordinate client: num_6ghz_reg_rules_lpi: %d num_6ghz_reg_rules_sp: %d num_6ghz_reg_rules_vlp: %d",
-+ num_6ghz_client[WMI_REG_INDOOR_AP][j],
-+ num_6ghz_client[WMI_REG_STANDARD_POWER_AP][j],
-+ num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]);
-+
-+ ext_wmi_reg_rule =
-+ (struct wmi_regulatory_ext_rule *)((u8 *)ext_chan_list_event_hdr
-+ + sizeof(*ext_chan_list_event_hdr)
-+ + sizeof(struct wmi_tlv));
-+ if (num_2ghz_reg_rules) {
-+ reg_info->reg_rules_2ghz_ptr =
-+ create_ext_reg_rules_from_wmi(num_2ghz_reg_rules,
-+ ext_wmi_reg_rule);
-+
-+ if (!reg_info->reg_rules_2ghz_ptr) {
-+ kfree(tb);
-+ ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n");
-+ return -ENOMEM;
-+ }
-+ }
-+
-+ ext_wmi_reg_rule += num_2ghz_reg_rules;
-+
-+ /* Firmware might include 6 GHz reg rule in 5 GHz rule list
-+ * for few countries along with separate 6 GHz rule.
-+ * Having same 6 GHz reg rule in 5 GHz and 6 GHz rules list
-+ * causes intersect check to be true, and same rules will be
-+ * shown multiple times in iw cmd.
-+ * Hence, avoid parsing 6 GHz rule from 5 GHz reg rule list
-+ */
-+ num_invalid_5ghz_ext_rules =
-+ ath11k_invalid_5ghz_reg_ext_rules_from_wmi(num_5ghz_reg_rules,
-+ ext_wmi_reg_rule);
-+
-+ if (num_invalid_5ghz_ext_rules) {
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "CC: %s 5 GHz reg rules number %d from fw, %d number of invalid 5 GHz rules",
-+ reg_info->alpha2, reg_info->num_5ghz_reg_rules,
-+ num_invalid_5ghz_ext_rules);
-+
-+ num_5ghz_reg_rules = num_5ghz_reg_rules - num_invalid_5ghz_ext_rules;
-+ reg_info->num_5ghz_reg_rules = num_5ghz_reg_rules;
-+ }
-+
-+ if (num_5ghz_reg_rules) {
-+ reg_info->reg_rules_5ghz_ptr =
-+ create_ext_reg_rules_from_wmi(num_5ghz_reg_rules,
-+ ext_wmi_reg_rule);
-+
-+ if (!reg_info->reg_rules_5ghz_ptr) {
-+ kfree(tb);
-+ ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n");
-+ return -ENOMEM;
-+ }
-+ }
-+
-+ /* We have adjusted the number of 5 GHz reg rules above. But still those
-+ * many rules needs to be adjusted in ext_wmi_reg_rule.
-+ *
-+ * NOTE: num_invalid_5ghz_ext_rules will be 0 for rest other cases.
-+ */
-+ ext_wmi_reg_rule += (num_5ghz_reg_rules + num_invalid_5ghz_ext_rules);
-+
-+ for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) {
-+ reg_info->reg_rules_6ghz_ap_ptr[i] =
-+ create_ext_reg_rules_from_wmi(num_6ghz_reg_rules_ap[i],
-+ ext_wmi_reg_rule);
-+
-+ if (!reg_info->reg_rules_6ghz_ap_ptr[i]) {
-+ kfree(tb);
-+ ath11k_warn(ab, "Unable to Allocate memory for 6 GHz AP rules\n");
-+ return -ENOMEM;
-+ }
-+
-+ ext_wmi_reg_rule += num_6ghz_reg_rules_ap[i];
-+ }
-+
-+ for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) {
-+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
-+ reg_info->reg_rules_6ghz_client_ptr[j][i] =
-+ create_ext_reg_rules_from_wmi(num_6ghz_client[j][i],
-+ ext_wmi_reg_rule);
-+
-+ if (!reg_info->reg_rules_6ghz_client_ptr[j][i]) {
-+ kfree(tb);
-+ ath11k_warn(ab, "Unable to Allocate memory for 6 GHz client rules\n");
-+ return -ENOMEM;
-+ }
-+
-+ ext_wmi_reg_rule += num_6ghz_client[j][i];
-+ }
-+ }
-+
-+ reg_info->client_type = ext_chan_list_event_hdr->client_type;
-+ reg_info->rnr_tpe_usable = ext_chan_list_event_hdr->rnr_tpe_usable;
-+ reg_info->unspecified_ap_usable =
-+ ext_chan_list_event_hdr->unspecified_ap_usable;
-+ reg_info->domain_code_6ghz_ap[WMI_REG_INDOOR_AP] =
-+ ext_chan_list_event_hdr->domain_code_6ghz_ap_lpi;
-+ reg_info->domain_code_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
-+ ext_chan_list_event_hdr->domain_code_6ghz_ap_sp;
-+ reg_info->domain_code_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
-+ ext_chan_list_event_hdr->domain_code_6ghz_ap_vlp;
-+
-+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
-+ reg_info->domain_code_6ghz_client[WMI_REG_INDOOR_AP][i] =
-+ ext_chan_list_event_hdr->domain_code_6ghz_client_lpi[i];
-+ reg_info->domain_code_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
-+ ext_chan_list_event_hdr->domain_code_6ghz_client_sp[i];
-+ reg_info->domain_code_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
-+ ext_chan_list_event_hdr->domain_code_6ghz_client_vlp[i];
-+ }
-+
-+ reg_info->domain_code_6ghz_super_id =
-+ ext_chan_list_event_hdr->domain_code_6ghz_super_id;
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI, "6 GHz client_type: %d domain_code_6ghz_super_id: %d",
-+ reg_info->client_type, reg_info->domain_code_6ghz_super_id);
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory ext channel list\n");
-+
-+ kfree(tb);
-+ return 0;
-+}
-+
- static int ath11k_pull_peer_del_resp_ev(struct ath11k_base *ab, struct sk_buff *skb,
- struct wmi_peer_delete_resp_event *peer_del_resp)
- {
-@@ -6507,12 +6876,14 @@ static bool ath11k_reg_is_world_alpha(ch
- return false;
- }
-
--static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *skb)
-+static int ath11k_reg_chan_list_event(struct ath11k_base *ab,
-+ struct sk_buff *skb,
-+ enum wmi_reg_chan_list_cmd_type id)
- {
- struct cur_regulatory_info *reg_info = NULL;
- struct ieee80211_regdomain *regd = NULL;
- bool intersect = false;
-- int ret = 0, pdev_idx;
-+ int ret = 0, pdev_idx, i, j;
- struct ath11k *ar;
-
- reg_info = kzalloc(sizeof(*reg_info), GFP_ATOMIC);
-@@ -6521,7 +6892,11 @@ static int ath11k_reg_chan_list_event(st
- goto fallback;
- }
-
-- ret = ath11k_pull_reg_chan_list_update_ev(ab, skb, reg_info);
-+ if (id == WMI_REG_CHAN_LIST_CC_ID)
-+ ret = ath11k_pull_reg_chan_list_update_ev(ab, skb, reg_info);
-+ else
-+ ret = ath11k_pull_reg_chan_list_ext_update_ev(ab, skb, reg_info);
-+
- if (ret) {
- ath11k_warn(ab, "failed to extract regulatory info from received event\n");
- goto fallback;
-@@ -6623,6 +6998,14 @@ mem_free:
- if (reg_info) {
- kfree(reg_info->reg_rules_2ghz_ptr);
- kfree(reg_info->reg_rules_5ghz_ptr);
-+ if (reg_info->is_ext_reg_event) {
-+ for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++)
-+ kfree(reg_info->reg_rules_6ghz_ap_ptr[i]);
-+
-+ for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++)
-+ for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++)
-+ kfree(reg_info->reg_rules_6ghz_client_ptr[j][i]);
-+ }
- kfree(reg_info);
- }
- return ret;
-@@ -8054,7 +8437,10 @@ static void ath11k_wmi_tlv_op_rx(struct
- ath11k_service_ready_ext2_event(ab, skb);
- break;
- case WMI_REG_CHAN_LIST_CC_EVENTID:
-- ath11k_reg_chan_list_event(ab, skb);
-+ ath11k_reg_chan_list_event(ab, skb, WMI_REG_CHAN_LIST_CC_ID);
-+ break;
-+ case WMI_REG_CHAN_LIST_CC_EXT_EVENTID:
-+ ath11k_reg_chan_list_event(ab, skb, WMI_REG_CHAN_LIST_CC_EXT_ID);
- break;
- case WMI_READY_EVENTID:
- ath11k_ready_event(ab, skb);
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -797,6 +797,7 @@ enum wmi_tlv_event_id {
- WMI_RMC_NEW_LEADER_EVENTID = WMI_TLV_CMD(WMI_GRP_RMC),
- WMI_REG_CHAN_LIST_CC_EVENTID = WMI_TLV_CMD(WMI_GRP_REGULATORY),
- WMI_11D_NEW_COUNTRY_EVENTID,
-+ WMI_REG_CHAN_LIST_CC_EXT_EVENTID,
- WMI_NDI_CAP_RSP_EVENTID = WMI_TLV_CMD(WMI_GRP_PROTOTYPE),
- WMI_NDP_INITIATOR_RSP_EVENTID,
- WMI_NDP_RESPONDER_RSP_EVENTID,
-@@ -1865,6 +1866,8 @@ enum wmi_tlv_tag {
- WMI_TAG_PDEV_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
- WMI_TAG_PDEV_NON_SRG_OBSS_COLOR_ENABLE_BITMAP_CMD,
- WMI_TAG_PDEV_NON_SRG_OBSS_BSSID_ENABLE_BITMAP_CMD,
-+ WMI_TAG_REGULATORY_RULE_EXT_STRUCT = 0x3A9,
-+ WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT,
- WMI_TAG_PDEV_SET_BIOS_SAR_TABLE_CMD = 0x3D8,
- WMI_TAG_PDEV_SET_BIOS_GEO_TABLE_CMD,
- WMI_TAG_MAX
-@@ -2097,6 +2100,7 @@ enum wmi_tlv_service {
-
- /* The second 128 bits */
- WMI_MAX_EXT_SERVICE = 256,
-+ WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281,
- WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326,
-
- /* The third 128 bits */
-@@ -2313,6 +2317,8 @@ struct wmi_init_cmd {
- #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5)
- #define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18)
-
-+#define WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT 4
-+
- struct wmi_resource_config {
- u32 tlv_header;
- u32 num_vdevs;
-@@ -2372,6 +2378,15 @@ struct wmi_resource_config {
- u32 sched_params;
- u32 twt_ap_pdev_count;
- u32 twt_ap_sta_count;
-+ u32 max_nlo_ssids;
-+ u32 num_pkt_filters;
-+ u32 num_max_sta_vdevs;
-+ u32 max_bssid_indicator;
-+ u32 ul_resp_config;
-+ u32 msdu_flow_override_config0;
-+ u32 msdu_flow_override_config1;
-+ u32 flags2;
-+ u32 host_service_flags;
- } __packed;
-
- struct wmi_service_ready_event {
-@@ -2854,6 +2869,8 @@ struct rx_reorder_queue_remove_params {
- #define REG_RULE_MAX_BW 0x0000ffff
- #define REG_RULE_REG_PWR 0x00ff0000
- #define REG_RULE_ANT_GAIN 0xff000000
-+#define REG_RULE_PSD_INFO BIT(0)
-+#define REG_RULE_PSD_EIRP 0xff0000
-
- #define WMI_VDEV_PARAM_TXBF_SU_TX_BFEE BIT(0)
- #define WMI_VDEV_PARAM_TXBF_MU_TX_BFEE BIT(1)
-@@ -4049,6 +4066,7 @@ struct wmi_he_rate_set {
-
- #define MAX_REG_RULES 10
- #define REG_ALPHA2_LEN 2
-+#define MAX_6GHZ_REG_RULES 5
-
- enum wmi_start_event_param {
- WMI_VDEV_START_RESP_EVENT = 0,
-@@ -4079,16 +4097,6 @@ enum wmi_vdev_start_resp_status_code {
- WMI_VDEV_START_RESPONSE_INVALID_REGDOMAIN = 4,
- };
-
--;
--enum cc_setting_code {
-- REG_SET_CC_STATUS_PASS = 0,
-- REG_CURRENT_ALPHA2_NOT_FOUND = 1,
-- REG_INIT_ALPHA2_NOT_FOUND = 2,
-- REG_SET_CC_CHANGE_NOT_ALLOWED = 3,
-- REG_SET_CC_STATUS_NO_MEMORY = 4,
-- REG_SET_CC_STATUS_FAIL = 5,
--};
--
- /* Regaulatory Rule Flags Passed by FW */
- #define REGULATORY_CHAN_DISABLED BIT(0)
- #define REGULATORY_CHAN_NO_IR BIT(1)
-@@ -4102,13 +4110,72 @@ enum cc_setting_code {
- #define REGULATORY_CHAN_NO_20MHZ BIT(11)
- #define REGULATORY_CHAN_NO_10MHZ BIT(12)
-
--enum {
-+enum wmi_reg_chan_list_cmd_type {
-+ WMI_REG_CHAN_LIST_CC_ID = 0,
-+ WMI_REG_CHAN_LIST_CC_EXT_ID = 1,
-+};
-+
-+enum wmi_reg_cc_setting_code {
- WMI_REG_SET_CC_STATUS_PASS = 0,
- WMI_REG_CURRENT_ALPHA2_NOT_FOUND = 1,
- WMI_REG_INIT_ALPHA2_NOT_FOUND = 2,
- WMI_REG_SET_CC_CHANGE_NOT_ALLOWED = 3,
- WMI_REG_SET_CC_STATUS_NO_MEMORY = 4,
- WMI_REG_SET_CC_STATUS_FAIL = 5,
-+
-+ /* add new setting code above, update in
-+ * @enum cc_setting_code as well.
-+ * Also handle it in ath11k_wmi_cc_setting_code_to_reg()
-+ */
-+};
-+
-+enum cc_setting_code {
-+ REG_SET_CC_STATUS_PASS = 0,
-+ REG_CURRENT_ALPHA2_NOT_FOUND = 1,
-+ REG_INIT_ALPHA2_NOT_FOUND = 2,
-+ REG_SET_CC_CHANGE_NOT_ALLOWED = 3,
-+ REG_SET_CC_STATUS_NO_MEMORY = 4,
-+ REG_SET_CC_STATUS_FAIL = 5,
-+
-+ /* add new setting code above, update in
-+ * @enum wmi_reg_cc_setting_code as well.
-+ */
-+};
-+
-+static inline enum cc_setting_code
-+ath11k_wmi_cc_setting_code_to_reg(enum wmi_reg_cc_setting_code status_code)
-+{
-+ switch (status_code) {
-+ case WMI_REG_SET_CC_STATUS_PASS:
-+ return REG_SET_CC_STATUS_PASS;
-+ case WMI_REG_CURRENT_ALPHA2_NOT_FOUND:
-+ return REG_CURRENT_ALPHA2_NOT_FOUND;
-+ case WMI_REG_INIT_ALPHA2_NOT_FOUND:
-+ return REG_INIT_ALPHA2_NOT_FOUND;
-+ case WMI_REG_SET_CC_CHANGE_NOT_ALLOWED:
-+ return REG_SET_CC_CHANGE_NOT_ALLOWED;
-+ case WMI_REG_SET_CC_STATUS_NO_MEMORY:
-+ return REG_SET_CC_STATUS_NO_MEMORY;
-+ case WMI_REG_SET_CC_STATUS_FAIL:
-+ return REG_SET_CC_STATUS_FAIL;
-+ }
-+
-+ return REG_SET_CC_STATUS_FAIL;
-+}
-+
-+enum wmi_reg_6ghz_ap_type {
-+ WMI_REG_INDOOR_AP = 0,
-+ WMI_REG_STANDARD_POWER_AP = 1,
-+ WMI_REG_VERY_LOW_POWER_AP = 2,
-+
-+ WMI_REG_CURRENT_MAX_AP_TYPE,
-+ WMI_REG_MAX_AP_TYPE = 7,
-+};
-+
-+enum wmi_reg_6ghz_client_type {
-+ WMI_REG_DEFAULT_CLIENT = 0,
-+ WMI_REG_SUBORDINATE_CLIENT = 1,
-+ WMI_REG_MAX_CLIENT_TYPE = 2,
- };
-
- struct cur_reg_rule {
-@@ -4118,6 +4185,8 @@ struct cur_reg_rule {
- u8 reg_power;
- u8 ant_gain;
- u16 flags;
-+ bool psd_flag;
-+ s8 psd_eirp;
- };
-
- struct cur_regulatory_info {
-@@ -4137,6 +4206,22 @@ struct cur_regulatory_info {
- u32 num_5ghz_reg_rules;
- struct cur_reg_rule *reg_rules_2ghz_ptr;
- struct cur_reg_rule *reg_rules_5ghz_ptr;
-+ bool is_ext_reg_event;
-+ enum wmi_reg_6ghz_client_type client_type;
-+ bool rnr_tpe_usable;
-+ bool unspecified_ap_usable;
-+ u8 domain_code_6ghz_ap[WMI_REG_CURRENT_MAX_AP_TYPE];
-+ u8 domain_code_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE];
-+ u32 domain_code_6ghz_super_id;
-+ u32 min_bw_6ghz_ap[WMI_REG_CURRENT_MAX_AP_TYPE];
-+ u32 max_bw_6ghz_ap[WMI_REG_CURRENT_MAX_AP_TYPE];
-+ u32 min_bw_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE];
-+ u32 max_bw_6ghz_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE];
-+ u32 num_6ghz_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE];
-+ u32 num_6ghz_rules_client[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE];
-+ struct cur_reg_rule *reg_rules_6ghz_ap_ptr[WMI_REG_CURRENT_MAX_AP_TYPE];
-+ struct cur_reg_rule *reg_rules_6ghz_client_ptr
-+ [WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE];
- };
-
- struct wmi_reg_chan_list_cc_event {
-@@ -4163,6 +4248,61 @@ struct wmi_regulatory_rule_struct {
- u32 flag_info;
- };
-
-+#define WMI_REG_CLIENT_MAX 4
-+
-+struct wmi_reg_chan_list_cc_ext_event {
-+ u32 status_code;
-+ u32 phy_id;
-+ u32 alpha2;
-+ u32 num_phy;
-+ u32 country_id;
-+ u32 domain_code;
-+ u32 dfs_region;
-+ u32 phybitmap;
-+ u32 min_bw_2ghz;
-+ u32 max_bw_2ghz;
-+ u32 min_bw_5ghz;
-+ u32 max_bw_5ghz;
-+ u32 num_2ghz_reg_rules;
-+ u32 num_5ghz_reg_rules;
-+ u32 client_type;
-+ u32 rnr_tpe_usable;
-+ u32 unspecified_ap_usable;
-+ u32 domain_code_6ghz_ap_lpi;
-+ u32 domain_code_6ghz_ap_sp;
-+ u32 domain_code_6ghz_ap_vlp;
-+ u32 domain_code_6ghz_client_lpi[WMI_REG_CLIENT_MAX];
-+ u32 domain_code_6ghz_client_sp[WMI_REG_CLIENT_MAX];
-+ u32 domain_code_6ghz_client_vlp[WMI_REG_CLIENT_MAX];
-+ u32 domain_code_6ghz_super_id;
-+ u32 min_bw_6ghz_ap_sp;
-+ u32 max_bw_6ghz_ap_sp;
-+ u32 min_bw_6ghz_ap_lpi;
-+ u32 max_bw_6ghz_ap_lpi;
-+ u32 min_bw_6ghz_ap_vlp;
-+ u32 max_bw_6ghz_ap_vlp;
-+ u32 min_bw_6ghz_client_sp[WMI_REG_CLIENT_MAX];
-+ u32 max_bw_6ghz_client_sp[WMI_REG_CLIENT_MAX];
-+ u32 min_bw_6ghz_client_lpi[WMI_REG_CLIENT_MAX];
-+ u32 max_bw_6ghz_client_lpi[WMI_REG_CLIENT_MAX];
-+ u32 min_bw_6ghz_client_vlp[WMI_REG_CLIENT_MAX];
-+ u32 max_bw_6ghz_client_vlp[WMI_REG_CLIENT_MAX];
-+ u32 num_6ghz_reg_rules_ap_sp;
-+ u32 num_6ghz_reg_rules_ap_lpi;
-+ u32 num_6ghz_reg_rules_ap_vlp;
-+ u32 num_6ghz_reg_rules_client_sp[WMI_REG_CLIENT_MAX];
-+ u32 num_6ghz_reg_rules_client_lpi[WMI_REG_CLIENT_MAX];
-+ u32 num_6ghz_reg_rules_client_vlp[WMI_REG_CLIENT_MAX];
-+} __packed;
-+
-+struct wmi_regulatory_ext_rule {
-+ u32 tlv_header;
-+ u32 freq_info;
-+ u32 bw_pwr_info;
-+ u32 flag_info;
-+ u32 psd_power_info;
-+} __packed;
-+
- struct wmi_vdev_delete_resp_event {
- u32 vdev_id;
- } __packed;
-@@ -5358,6 +5498,7 @@ struct target_resource_config {
- u32 sched_params;
- u32 twt_ap_pdev_count;
- u32 twt_ap_sta_count;
-+ u8 is_reg_cc_ext_event_supported;
- };
-
- enum wmi_debug_log_param {
+++ /dev/null
-From e238e62ba8868a784e485eb94451c87cd1b85cee Mon Sep 17 00:00:00 2001
-From: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Date: Wed, 1 Mar 2023 16:20:59 +0200
-Subject: [PATCH] wifi: ath11k: add debug prints in regulatory WMI event
- processing
-
-Add some more debug prints in processing regulatory WMI event in order to
-increase more debuggability.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230110121024.14051-4-quic_adisi@quicinc.com
----
- drivers/net/wireless/ath/ath11k/reg.c | 2 +-
- drivers/net/wireless/ath/ath11k/wmi.c | 207 ++++++++++++++++++--------
- drivers/net/wireless/ath/ath11k/wmi.h | 142 ++++++++++++++++++
- 3 files changed, 291 insertions(+), 60 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/reg.c
-+++ b/drivers/net/wireless/ath/ath11k/reg.c
-@@ -646,7 +646,7 @@ ath11k_reg_build_regd(struct ath11k_base
- tmp_regd->dfs_region = ath11k_map_fw_dfs_region(reg_info->dfs_region);
-
- ath11k_dbg(ab, ATH11K_DBG_REG,
-- "\r\nCountry %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n",
-+ "Country %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n",
- alpha2, ath11k_reg_get_regdom_str(tmp_regd->dfs_region),
- reg_info->dfs_region, num_rules);
- /* Update reg_rules[] below. Firmware is expected to
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -4925,6 +4925,26 @@ static int ath11k_pull_vdev_start_resp_t
- return 0;
- }
-
-+static void ath11k_print_reg_rule(struct ath11k_base *ab, const char *band,
-+ u32 num_reg_rules,
-+ struct cur_reg_rule *reg_rule_ptr)
-+{
-+ struct cur_reg_rule *reg_rule = reg_rule_ptr;
-+ u32 count;
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI, "number of reg rules in %s band: %d\n",
-+ band, num_reg_rules);
-+
-+ for (count = 0; count < num_reg_rules; count++) {
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "reg rule %d: (%d - %d @ %d) (%d, %d) (FLAGS %d)\n",
-+ count + 1, reg_rule->start_freq, reg_rule->end_freq,
-+ reg_rule->max_bw, reg_rule->ant_gain,
-+ reg_rule->reg_power, reg_rule->flags);
-+ reg_rule++;
-+ }
-+}
-+
- static struct cur_reg_rule
- *create_reg_rules_from_wmi(u32 num_reg_rules,
- struct wmi_regulatory_rule_struct *wmi_reg_rule)
-@@ -5006,6 +5026,10 @@ static int ath11k_pull_reg_chan_list_upd
- reg_info->ctry_code = chan_list_event_hdr->country_id;
- reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code;
-
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "status_code %s",
-+ ath11k_cc_status_to_str(reg_info->status_code));
-+
- reg_info->status_code =
- ath11k_wmi_cc_setting_code_to_reg(chan_list_event_hdr->status_code);
-
-@@ -5020,13 +5044,13 @@ static int ath11k_pull_reg_chan_list_upd
- num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules;
-
- ath11k_dbg(ab, ATH11K_DBG_WMI,
-- "%s:cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
-- __func__, reg_info->alpha2, reg_info->dfs_region,
-+ "cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
-+ reg_info->alpha2, reg_info->dfs_region,
- reg_info->min_bw_2ghz, reg_info->max_bw_2ghz,
- reg_info->min_bw_5ghz, reg_info->max_bw_5ghz);
-
- ath11k_dbg(ab, ATH11K_DBG_WMI,
-- "%s: num_2ghz_reg_rules %d num_5ghz_reg_rules %d", __func__,
-+ "num_2ghz_reg_rules %d num_5ghz_reg_rules %d",
- num_2ghz_reg_rules, num_5ghz_reg_rules);
-
- wmi_reg_rule =
-@@ -5043,6 +5067,10 @@ static int ath11k_pull_reg_chan_list_upd
- ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n");
- return -ENOMEM;
- }
-+
-+ ath11k_print_reg_rule(ab, "2 GHz",
-+ num_2ghz_reg_rules,
-+ reg_info->reg_rules_2ghz_ptr);
- }
-
- if (num_5ghz_reg_rules) {
-@@ -5055,6 +5083,10 @@ static int ath11k_pull_reg_chan_list_upd
- ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n");
- return -ENOMEM;
- }
-+
-+ ath11k_print_reg_rule(ab, "5 GHz",
-+ num_5ghz_reg_rules,
-+ reg_info->reg_rules_5ghz_ptr);
- }
-
- ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory channel list\n");
-@@ -5128,7 +5160,7 @@ static int ath11k_pull_reg_chan_list_ext
- struct cur_regulatory_info *reg_info)
- {
- const void **tb;
-- const struct wmi_reg_chan_list_cc_ext_event *ext_chan_list_event_hdr;
-+ const struct wmi_reg_chan_list_cc_ext_event *ev;
- struct wmi_regulatory_ext_rule *ext_wmi_reg_rule;
- u32 num_2ghz_reg_rules, num_5ghz_reg_rules;
- u32 num_6ghz_reg_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE];
-@@ -5145,31 +5177,29 @@ static int ath11k_pull_reg_chan_list_ext
- return ret;
- }
-
-- ext_chan_list_event_hdr = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT];
-- if (!ext_chan_list_event_hdr) {
-+ ev = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT];
-+ if (!ev) {
- ath11k_warn(ab, "failed to fetch reg chan list ext update ev\n");
- kfree(tb);
- return -EPROTO;
- }
-
-- reg_info->num_2ghz_reg_rules =
-- ext_chan_list_event_hdr->num_2ghz_reg_rules;
-- reg_info->num_5ghz_reg_rules =
-- ext_chan_list_event_hdr->num_5ghz_reg_rules;
-+ reg_info->num_2ghz_reg_rules = ev->num_2ghz_reg_rules;
-+ reg_info->num_5ghz_reg_rules = ev->num_5ghz_reg_rules;
- reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] =
-- ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_lpi;
-+ ev->num_6ghz_reg_rules_ap_lpi;
- reg_info->num_6ghz_rules_ap[WMI_REG_STANDARD_POWER_AP] =
-- ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_sp;
-+ ev->num_6ghz_reg_rules_ap_sp;
- reg_info->num_6ghz_rules_ap[WMI_REG_VERY_LOW_POWER_AP] =
-- ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_vlp;
-+ ev->num_6ghz_reg_rules_ap_vlp;
-
- for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
- reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i] =
-- ext_chan_list_event_hdr->num_6ghz_reg_rules_client_lpi[i];
-+ ev->num_6ghz_reg_rules_client_lpi[i];
- reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i] =
-- ext_chan_list_event_hdr->num_6ghz_reg_rules_client_sp[i];
-+ ev->num_6ghz_reg_rules_client_sp[i];
- reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i] =
-- ext_chan_list_event_hdr->num_6ghz_reg_rules_client_vlp[i];
-+ ev->num_6ghz_reg_rules_client_vlp[i];
- }
-
- num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules;
-@@ -5231,57 +5261,79 @@ static int ath11k_pull_reg_chan_list_ext
- return -EINVAL;
- }
-
-- memcpy(reg_info->alpha2, &ext_chan_list_event_hdr->alpha2,
-- REG_ALPHA2_LEN);
-+ memcpy(reg_info->alpha2, &ev->alpha2, REG_ALPHA2_LEN);
-+
-+ reg_info->dfs_region = ev->dfs_region;
-+ reg_info->phybitmap = ev->phybitmap;
-+ reg_info->num_phy = ev->num_phy;
-+ reg_info->phy_id = ev->phy_id;
-+ reg_info->ctry_code = ev->country_id;
-+ reg_info->reg_dmn_pair = ev->domain_code;
-
-- reg_info->dfs_region = ext_chan_list_event_hdr->dfs_region;
-- reg_info->phybitmap = ext_chan_list_event_hdr->phybitmap;
-- reg_info->num_phy = ext_chan_list_event_hdr->num_phy;
-- reg_info->phy_id = ext_chan_list_event_hdr->phy_id;
-- reg_info->ctry_code = ext_chan_list_event_hdr->country_id;
-- reg_info->reg_dmn_pair = ext_chan_list_event_hdr->domain_code;
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "status_code %s",
-+ ath11k_cc_status_to_str(reg_info->status_code));
-
- reg_info->status_code =
-- ath11k_wmi_cc_setting_code_to_reg(ext_chan_list_event_hdr->status_code);
-+ ath11k_wmi_cc_setting_code_to_reg(ev->status_code);
-
- reg_info->is_ext_reg_event = true;
-
-- reg_info->min_bw_2ghz = ext_chan_list_event_hdr->min_bw_2ghz;
-- reg_info->max_bw_2ghz = ext_chan_list_event_hdr->max_bw_2ghz;
-- reg_info->min_bw_5ghz = ext_chan_list_event_hdr->min_bw_5ghz;
-- reg_info->max_bw_5ghz = ext_chan_list_event_hdr->max_bw_5ghz;
-+ reg_info->min_bw_2ghz = ev->min_bw_2ghz;
-+ reg_info->max_bw_2ghz = ev->max_bw_2ghz;
-+ reg_info->min_bw_5ghz = ev->min_bw_5ghz;
-+ reg_info->max_bw_5ghz = ev->max_bw_5ghz;
-
- reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP] =
-- ext_chan_list_event_hdr->min_bw_6ghz_ap_lpi;
-+ ev->min_bw_6ghz_ap_lpi;
- reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP] =
-- ext_chan_list_event_hdr->max_bw_6ghz_ap_lpi;
-+ ev->max_bw_6ghz_ap_lpi;
- reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
-- ext_chan_list_event_hdr->min_bw_6ghz_ap_sp;
-+ ev->min_bw_6ghz_ap_sp;
- reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
-- ext_chan_list_event_hdr->max_bw_6ghz_ap_sp;
-+ ev->max_bw_6ghz_ap_sp;
- reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
-- ext_chan_list_event_hdr->min_bw_6ghz_ap_vlp;
-+ ev->min_bw_6ghz_ap_vlp;
- reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
-- ext_chan_list_event_hdr->max_bw_6ghz_ap_vlp;
-+ ev->max_bw_6ghz_ap_vlp;
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "6 GHz AP BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n",
-+ reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP],
-+ reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP],
-+ reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP],
-+ reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP],
-+ reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP],
-+ reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP]);
-
- for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
- reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i] =
-- ext_chan_list_event_hdr->min_bw_6ghz_client_lpi[i];
-+ ev->min_bw_6ghz_client_lpi[i];
- reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i] =
-- ext_chan_list_event_hdr->max_bw_6ghz_client_lpi[i];
-+ ev->max_bw_6ghz_client_lpi[i];
- reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
-- ext_chan_list_event_hdr->min_bw_6ghz_client_sp[i];
-+ ev->min_bw_6ghz_client_sp[i];
- reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
-- ext_chan_list_event_hdr->max_bw_6ghz_client_sp[i];
-+ ev->max_bw_6ghz_client_sp[i];
- reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
-- ext_chan_list_event_hdr->min_bw_6ghz_client_vlp[i];
-+ ev->min_bw_6ghz_client_vlp[i];
- reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
-- ext_chan_list_event_hdr->max_bw_6ghz_client_vlp[i];
-+ ev->max_bw_6ghz_client_vlp[i];
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "6 GHz %s BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n",
-+ ath11k_6ghz_client_type_to_str(i),
-+ reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i],
-+ reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i],
-+ reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i],
-+ reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i],
-+ reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i],
-+ reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i]);
- }
-
- ath11k_dbg(ab, ATH11K_DBG_WMI,
-- "%s:cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
-- __func__, reg_info->alpha2, reg_info->dfs_region,
-+ "cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
-+ reg_info->alpha2, reg_info->dfs_region,
- reg_info->min_bw_2ghz, reg_info->max_bw_2ghz,
- reg_info->min_bw_5ghz, reg_info->max_bw_5ghz);
-
-@@ -5310,9 +5362,8 @@ static int ath11k_pull_reg_chan_list_ext
- num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]);
-
- ext_wmi_reg_rule =
-- (struct wmi_regulatory_ext_rule *)((u8 *)ext_chan_list_event_hdr
-- + sizeof(*ext_chan_list_event_hdr)
-- + sizeof(struct wmi_tlv));
-+ (struct wmi_regulatory_ext_rule *)((u8 *)ev + sizeof(*ev) +
-+ sizeof(struct wmi_tlv));
- if (num_2ghz_reg_rules) {
- reg_info->reg_rules_2ghz_ptr =
- create_ext_reg_rules_from_wmi(num_2ghz_reg_rules,
-@@ -5323,6 +5374,10 @@ static int ath11k_pull_reg_chan_list_ext
- ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n");
- return -ENOMEM;
- }
-+
-+ ath11k_print_reg_rule(ab, "2 GHz",
-+ num_2ghz_reg_rules,
-+ reg_info->reg_rules_2ghz_ptr);
- }
-
- ext_wmi_reg_rule += num_2ghz_reg_rules;
-@@ -5358,6 +5413,10 @@ static int ath11k_pull_reg_chan_list_ext
- ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n");
- return -ENOMEM;
- }
-+
-+ ath11k_print_reg_rule(ab, "5 GHz",
-+ num_5ghz_reg_rules,
-+ reg_info->reg_rules_5ghz_ptr);
- }
-
- /* We have adjusted the number of 5 GHz reg rules above. But still those
-@@ -5378,10 +5437,17 @@ static int ath11k_pull_reg_chan_list_ext
- return -ENOMEM;
- }
-
-+ ath11k_print_reg_rule(ab, ath11k_6ghz_ap_type_to_str(i),
-+ num_6ghz_reg_rules_ap[i],
-+ reg_info->reg_rules_6ghz_ap_ptr[i]);
-+
- ext_wmi_reg_rule += num_6ghz_reg_rules_ap[i];
- }
-
- for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) {
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "6 GHz AP type %s", ath11k_6ghz_ap_type_to_str(j));
-+
- for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
- reg_info->reg_rules_6ghz_client_ptr[j][i] =
- create_ext_reg_rules_from_wmi(num_6ghz_client[j][i],
-@@ -5393,35 +5459,58 @@ static int ath11k_pull_reg_chan_list_ext
- return -ENOMEM;
- }
-
-+ ath11k_print_reg_rule(ab,
-+ ath11k_6ghz_client_type_to_str(i),
-+ num_6ghz_client[j][i],
-+ reg_info->reg_rules_6ghz_client_ptr[j][i]);
-+
- ext_wmi_reg_rule += num_6ghz_client[j][i];
- }
- }
-
-- reg_info->client_type = ext_chan_list_event_hdr->client_type;
-- reg_info->rnr_tpe_usable = ext_chan_list_event_hdr->rnr_tpe_usable;
-+ reg_info->client_type = ev->client_type;
-+ reg_info->rnr_tpe_usable = ev->rnr_tpe_usable;
- reg_info->unspecified_ap_usable =
-- ext_chan_list_event_hdr->unspecified_ap_usable;
-+ ev->unspecified_ap_usable;
- reg_info->domain_code_6ghz_ap[WMI_REG_INDOOR_AP] =
-- ext_chan_list_event_hdr->domain_code_6ghz_ap_lpi;
-+ ev->domain_code_6ghz_ap_lpi;
- reg_info->domain_code_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
-- ext_chan_list_event_hdr->domain_code_6ghz_ap_sp;
-+ ev->domain_code_6ghz_ap_sp;
- reg_info->domain_code_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
-- ext_chan_list_event_hdr->domain_code_6ghz_ap_vlp;
-+ ev->domain_code_6ghz_ap_vlp;
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "6 GHz reg info client type %s rnr_tpe_usable %d unspecified_ap_usable %d AP sub domain: lpi %s, sp %s, vlp %s\n",
-+ ath11k_6ghz_client_type_to_str(reg_info->client_type),
-+ reg_info->rnr_tpe_usable,
-+ reg_info->unspecified_ap_usable,
-+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_lpi),
-+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_sp),
-+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_vlp));
-
- for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
- reg_info->domain_code_6ghz_client[WMI_REG_INDOOR_AP][i] =
-- ext_chan_list_event_hdr->domain_code_6ghz_client_lpi[i];
-+ ev->domain_code_6ghz_client_lpi[i];
- reg_info->domain_code_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
-- ext_chan_list_event_hdr->domain_code_6ghz_client_sp[i];
-+ ev->domain_code_6ghz_client_sp[i];
- reg_info->domain_code_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
-- ext_chan_list_event_hdr->domain_code_6ghz_client_vlp[i];
-+ ev->domain_code_6ghz_client_vlp[i];
-+
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "6 GHz client type %s client sub domain: lpi %s, sp %s, vlp %s\n",
-+ ath11k_6ghz_client_type_to_str(i),
-+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_lpi[i]),
-+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_sp[i]),
-+ ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_vlp[i])
-+ );
- }
-
-- reg_info->domain_code_6ghz_super_id =
-- ext_chan_list_event_hdr->domain_code_6ghz_super_id;
-+ reg_info->domain_code_6ghz_super_id = ev->domain_code_6ghz_super_id;
-
-- ath11k_dbg(ab, ATH11K_DBG_WMI, "6 GHz client_type: %d domain_code_6ghz_super_id: %d",
-- reg_info->client_type, reg_info->domain_code_6ghz_super_id);
-+ ath11k_dbg(ab, ATH11K_DBG_WMI,
-+ "6 GHz client_type %s 6 GHz super domain %s",
-+ ath11k_6ghz_client_type_to_str(reg_info->client_type),
-+ ath11k_super_reg_6ghz_to_str(reg_info->domain_code_6ghz_super_id));
-
- ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory ext channel list\n");
-
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -4139,6 +4139,7 @@ enum cc_setting_code {
-
- /* add new setting code above, update in
- * @enum wmi_reg_cc_setting_code as well.
-+ * Also handle it in ath11k_cc_status_to_str()
- */
- };
-
-@@ -4163,21 +4164,162 @@ ath11k_wmi_cc_setting_code_to_reg(enum w
- return REG_SET_CC_STATUS_FAIL;
- }
-
-+static inline const char *ath11k_cc_status_to_str(enum cc_setting_code code)
-+{
-+ switch (code) {
-+ case REG_SET_CC_STATUS_PASS:
-+ return "REG_SET_CC_STATUS_PASS";
-+ case REG_CURRENT_ALPHA2_NOT_FOUND:
-+ return "REG_CURRENT_ALPHA2_NOT_FOUND";
-+ case REG_INIT_ALPHA2_NOT_FOUND:
-+ return "REG_INIT_ALPHA2_NOT_FOUND";
-+ case REG_SET_CC_CHANGE_NOT_ALLOWED:
-+ return "REG_SET_CC_CHANGE_NOT_ALLOWED";
-+ case REG_SET_CC_STATUS_NO_MEMORY:
-+ return "REG_SET_CC_STATUS_NO_MEMORY";
-+ case REG_SET_CC_STATUS_FAIL:
-+ return "REG_SET_CC_STATUS_FAIL";
-+ }
-+
-+ return "Unknown CC status";
-+}
-+
- enum wmi_reg_6ghz_ap_type {
- WMI_REG_INDOOR_AP = 0,
- WMI_REG_STANDARD_POWER_AP = 1,
- WMI_REG_VERY_LOW_POWER_AP = 2,
-
-+ /* add AP type above, handle in ath11k_6ghz_ap_type_to_str()
-+ */
- WMI_REG_CURRENT_MAX_AP_TYPE,
- WMI_REG_MAX_AP_TYPE = 7,
- };
-
-+static inline const char *
-+ath11k_6ghz_ap_type_to_str(enum wmi_reg_6ghz_ap_type type)
-+{
-+ switch (type) {
-+ case WMI_REG_INDOOR_AP:
-+ return "INDOOR AP";
-+ case WMI_REG_STANDARD_POWER_AP:
-+ return "STANDARD POWER AP";
-+ case WMI_REG_VERY_LOW_POWER_AP:
-+ return "VERY LOW POWER AP";
-+ case WMI_REG_CURRENT_MAX_AP_TYPE:
-+ return "CURRENT_MAX_AP_TYPE";
-+ case WMI_REG_MAX_AP_TYPE:
-+ return "MAX_AP_TYPE";
-+ }
-+
-+ return "unknown 6 GHz AP type";
-+}
-+
- enum wmi_reg_6ghz_client_type {
- WMI_REG_DEFAULT_CLIENT = 0,
- WMI_REG_SUBORDINATE_CLIENT = 1,
- WMI_REG_MAX_CLIENT_TYPE = 2,
-+
-+ /* add client type above, handle it in
-+ * ath11k_6ghz_client_type_to_str()
-+ */
-+};
-+
-+static inline const char *
-+ath11k_6ghz_client_type_to_str(enum wmi_reg_6ghz_client_type type)
-+{
-+ switch (type) {
-+ case WMI_REG_DEFAULT_CLIENT:
-+ return "DEFAULT CLIENT";
-+ case WMI_REG_SUBORDINATE_CLIENT:
-+ return "SUBORDINATE CLIENT";
-+ case WMI_REG_MAX_CLIENT_TYPE:
-+ return "MAX_CLIENT_TYPE";
-+ }
-+
-+ return "unknown 6 GHz client type";
-+}
-+
-+enum reg_subdomains_6ghz {
-+ EMPTY_6GHZ = 0x0,
-+ FCC1_CLIENT_LPI_REGULAR_6GHZ = 0x01,
-+ FCC1_CLIENT_SP_6GHZ = 0x02,
-+ FCC1_AP_LPI_6GHZ = 0x03,
-+ FCC1_CLIENT_LPI_SUBORDINATE = FCC1_AP_LPI_6GHZ,
-+ FCC1_AP_SP_6GHZ = 0x04,
-+ ETSI1_LPI_6GHZ = 0x10,
-+ ETSI1_VLP_6GHZ = 0x11,
-+ ETSI2_LPI_6GHZ = 0x12,
-+ ETSI2_VLP_6GHZ = 0x13,
-+ APL1_LPI_6GHZ = 0x20,
-+ APL1_VLP_6GHZ = 0x21,
-+
-+ /* add sub-domain above, handle it in
-+ * ath11k_sub_reg_6ghz_to_str()
-+ */
-+};
-+
-+static inline const char *
-+ath11k_sub_reg_6ghz_to_str(enum reg_subdomains_6ghz sub_id)
-+{
-+ switch (sub_id) {
-+ case EMPTY_6GHZ:
-+ return "N/A";
-+ case FCC1_CLIENT_LPI_REGULAR_6GHZ:
-+ return "FCC1_CLIENT_LPI_REGULAR_6GHZ";
-+ case FCC1_CLIENT_SP_6GHZ:
-+ return "FCC1_CLIENT_SP_6GHZ";
-+ case FCC1_AP_LPI_6GHZ:
-+ return "FCC1_AP_LPI_6GHZ/FCC1_CLIENT_LPI_SUBORDINATE";
-+ case FCC1_AP_SP_6GHZ:
-+ return "FCC1_AP_SP_6GHZ";
-+ case ETSI1_LPI_6GHZ:
-+ return "ETSI1_LPI_6GHZ";
-+ case ETSI1_VLP_6GHZ:
-+ return "ETSI1_VLP_6GHZ";
-+ case ETSI2_LPI_6GHZ:
-+ return "ETSI2_LPI_6GHZ";
-+ case ETSI2_VLP_6GHZ:
-+ return "ETSI2_VLP_6GHZ";
-+ case APL1_LPI_6GHZ:
-+ return "APL1_LPI_6GHZ";
-+ case APL1_VLP_6GHZ:
-+ return "APL1_VLP_6GHZ";
-+ }
-+
-+ return "unknown sub reg id";
-+}
-+
-+enum reg_super_domain_6ghz {
-+ FCC1_6GHZ = 0x01,
-+ ETSI1_6GHZ = 0x02,
-+ ETSI2_6GHZ = 0x03,
-+ APL1_6GHZ = 0x04,
-+ FCC1_6GHZ_CL = 0x05,
-+
-+ /* add super domain above, handle it in
-+ * ath11k_super_reg_6ghz_to_str()
-+ */
- };
-
-+static inline const char *
-+ath11k_super_reg_6ghz_to_str(enum reg_super_domain_6ghz domain_id)
-+{
-+ switch (domain_id) {
-+ case FCC1_6GHZ:
-+ return "FCC1_6GHZ";
-+ case ETSI1_6GHZ:
-+ return "ETSI1_6GHZ";
-+ case ETSI2_6GHZ:
-+ return "ETSI2_6GHZ";
-+ case APL1_6GHZ:
-+ return "APL1_6GHZ";
-+ case FCC1_6GHZ_CL:
-+ return "FCC1_6GHZ_CL";
-+ }
-+
-+ return "unknown domain id";
-+}
-+
- struct cur_reg_rule {
- u16 start_freq;
- u16 end_freq;
+++ /dev/null
-From 3b1088a09ec9438523c251d8435e78988824bc0d Mon Sep 17 00:00:00 2001
-From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
-Date: Tue, 7 Mar 2023 16:22:39 -0600
-Subject: [PATCH] wifi: ath11k: Replace fake flex-array with flexible-array
- member
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Zero-length arrays as fake flexible arrays are deprecated and we are
-moving towards adopting C99 flexible-array members instead.
-
-Address 25 of the following warnings found with GCC-13 and
--fstrict-flex-arrays=3 enabled:
-drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c:30:51: warning: array subscript <unknown> is outside array bounds of ‘const u32[0]’ {aka ‘const unsigned int[]’} [-Warray-bounds=]
-
-This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
-routines on memcpy() and help us make progress towards globally
-enabling -fstrict-flex-arrays=3 [1].
-
-Link: https://github.com/KSPP/linux/issues/21
-Link: https://github.com/KSPP/linux/issues/266
-Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
-Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
-Reviewed-by: Simon Horman <simon.horman@corigine.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/ZAe5L5DtmsQxzqRH@work
----
- .../wireless/ath/ath11k/debugfs_htt_stats.h | 73 +++++++++++--------
- 1 file changed, 43 insertions(+), 30 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h
-+++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h
-@@ -143,7 +143,8 @@ enum htt_tx_pdev_underrun_enum {
- /* Bytes stored in little endian order */
- /* Length should be multiple of DWORD */
- struct htt_stats_string_tlv {
-- u32 data[0]; /* Can be variable length */
-+ /* Can be variable length */
-+ DECLARE_FLEX_ARRAY(u32, data);
- } __packed;
-
- #define HTT_STATS_MAC_ID GENMASK(7, 0)
-@@ -205,27 +206,32 @@ struct htt_tx_pdev_stats_cmn_tlv {
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_pdev_stats_urrn_tlv_v {
-- u32 urrn_stats[0]; /* HTT_TX_PDEV_MAX_URRN_STATS */
-+ /* HTT_TX_PDEV_MAX_URRN_STATS */
-+ DECLARE_FLEX_ARRAY(u32, urrn_stats);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_pdev_stats_flush_tlv_v {
-- u32 flush_errs[0]; /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */
-+ /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */
-+ DECLARE_FLEX_ARRAY(u32, flush_errs);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_pdev_stats_sifs_tlv_v {
-- u32 sifs_status[0]; /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */
-+ /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */
-+ DECLARE_FLEX_ARRAY(u32, sifs_status);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_pdev_stats_phy_err_tlv_v {
-- u32 phy_errs[0]; /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */
-+ /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */
-+ DECLARE_FLEX_ARRAY(u32, phy_errs);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_pdev_stats_sifs_hist_tlv_v {
-- u32 sifs_hist_status[0]; /* HTT_TX_PDEV_SIFS_BURST_HIST_STATS */
-+ /* HTT_TX_PDEV_SIFS_BURST_HIST_STATS */
-+ DECLARE_FLEX_ARRAY(u32, sifs_hist_status);
- };
-
- struct htt_tx_pdev_stats_tx_ppdu_stats_tlv_v {
-@@ -590,20 +596,20 @@ struct htt_tx_hwq_difs_latency_stats_tlv
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_hwq_cmd_result_stats_tlv_v {
-- /* Histogram of sched cmd result */
-- u32 cmd_result[0]; /* HTT_TX_HWQ_MAX_CMD_RESULT_STATS */
-+ /* Histogram of sched cmd result, HTT_TX_HWQ_MAX_CMD_RESULT_STATS */
-+ DECLARE_FLEX_ARRAY(u32, cmd_result);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_hwq_cmd_stall_stats_tlv_v {
-- /* Histogram of various pause conitions */
-- u32 cmd_stall_status[0]; /* HTT_TX_HWQ_MAX_CMD_STALL_STATS */
-+ /* Histogram of various pause conitions, HTT_TX_HWQ_MAX_CMD_STALL_STATS */
-+ DECLARE_FLEX_ARRAY(u32, cmd_stall_status);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_hwq_fes_result_stats_tlv_v {
-- /* Histogram of number of user fes result */
-- u32 fes_result[0]; /* HTT_TX_HWQ_MAX_FES_RESULT_STATS */
-+ /* Histogram of number of user fes result, HTT_TX_HWQ_MAX_FES_RESULT_STATS */
-+ DECLARE_FLEX_ARRAY(u32, fes_result);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size
-@@ -635,8 +641,8 @@ struct htt_tx_hwq_tried_mpdu_cnt_hist_tl
- * #define WAL_TXOP_USED_HISTOGRAM_INTERVAL 1000 ( 1 ms )
- */
- struct htt_tx_hwq_txop_used_cnt_hist_tlv_v {
-- /* Histogram of txop used cnt */
-- u32 txop_used_cnt_hist[0]; /* HTT_TX_HWQ_TXOP_USED_CNT_HIST */
-+ /* Histogram of txop used cnt, HTT_TX_HWQ_TXOP_USED_CNT_HIST */
-+ DECLARE_FLEX_ARRAY(u32, txop_used_cnt_hist);
- };
-
- /* == TX SELFGEN STATS == */
-@@ -804,17 +810,20 @@ struct htt_tx_pdev_mpdu_stats_tlv {
- /* == TX SCHED STATS == */
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_sched_txq_cmd_posted_tlv_v {
-- u32 sched_cmd_posted[0]; /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */
-+ /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */
-+ DECLARE_FLEX_ARRAY(u32, sched_cmd_posted);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_sched_txq_cmd_reaped_tlv_v {
-- u32 sched_cmd_reaped[0]; /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */
-+ /* HTT_TX_PDEV_SCHED_TX_MODE_MAX */
-+ DECLARE_FLEX_ARRAY(u32, sched_cmd_reaped);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_sched_txq_sched_order_su_tlv_v {
-- u32 sched_order_su[0]; /* HTT_TX_PDEV_NUM_SCHED_ORDER_LOG */
-+ /* HTT_TX_PDEV_NUM_SCHED_ORDER_LOG */
-+ DECLARE_FLEX_ARRAY(u32, sched_order_su);
- };
-
- enum htt_sched_txq_sched_ineligibility_tlv_enum {
-@@ -842,7 +851,7 @@ enum htt_sched_txq_sched_ineligibility_t
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_sched_txq_sched_ineligibility_tlv_v {
- /* indexed by htt_sched_txq_sched_ineligibility_tlv_enum */
-- u32 sched_ineligibility[0];
-+ DECLARE_FLEX_ARRAY(u32, sched_ineligibility);
- };
-
- #define HTT_TX_PDEV_STATS_SCHED_PER_TXQ_MAC_ID GENMASK(7, 0)
-@@ -888,18 +897,20 @@ struct htt_stats_tx_sched_cmn_tlv {
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_tqm_gen_mpdu_stats_tlv_v {
-- u32 gen_mpdu_end_reason[0]; /* HTT_TX_TQM_MAX_GEN_MPDU_END_REASON */
-+ /* HTT_TX_TQM_MAX_GEN_MPDU_END_REASON */
-+ DECLARE_FLEX_ARRAY(u32, gen_mpdu_end_reason);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_tqm_list_mpdu_stats_tlv_v {
-- u32 list_mpdu_end_reason[0]; /* HTT_TX_TQM_MAX_LIST_MPDU_END_REASON */
-+ /* HTT_TX_TQM_MAX_LIST_MPDU_END_REASON */
-+ DECLARE_FLEX_ARRAY(u32, list_mpdu_end_reason);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_tx_tqm_list_mpdu_cnt_tlv_v {
-- u32 list_mpdu_cnt_hist[0];
-- /* HTT_TX_TQM_MAX_LIST_MPDU_CNT_HISTOGRAM_BINS */
-+ /* HTT_TX_TQM_MAX_LIST_MPDU_CNT_HISTOGRAM_BINS */
-+ DECLARE_FLEX_ARRAY(u32, list_mpdu_cnt_hist);
- };
-
- struct htt_tx_tqm_pdev_stats_tlv_v {
-@@ -1098,7 +1109,7 @@ struct htt_tx_de_compl_stats_tlv {
- * ENTRIES_PER_BIN_COUNT)
- */
- struct htt_tx_de_fw2wbm_ring_full_hist_tlv {
-- u32 fw2wbm_ring_full_hist[0];
-+ DECLARE_FLEX_ARRAY(u32, fw2wbm_ring_full_hist);
- };
-
- struct htt_tx_de_cmn_stats_tlv {
-@@ -1151,7 +1162,7 @@ struct htt_ring_if_cmn_tlv {
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_sfm_client_user_tlv_v {
- /* Number of DWORDS used per user and per client */
-- u32 dwords_used_by_user_n[0];
-+ DECLARE_FLEX_ARRAY(u32, dwords_used_by_user_n);
- };
-
- struct htt_sfm_client_tlv {
-@@ -1436,12 +1447,14 @@ struct htt_rx_soc_fw_stats_tlv {
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_rx_soc_fw_refill_ring_empty_tlv_v {
-- u32 refill_ring_empty_cnt[0]; /* HTT_RX_STATS_REFILL_MAX_RING */
-+ /* HTT_RX_STATS_REFILL_MAX_RING */
-+ DECLARE_FLEX_ARRAY(u32, refill_ring_empty_cnt);
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_rx_soc_fw_refill_ring_num_refill_tlv_v {
-- u32 refill_ring_num_refill[0]; /* HTT_RX_STATS_REFILL_MAX_RING */
-+ /* HTT_RX_STATS_REFILL_MAX_RING */
-+ DECLARE_FLEX_ARRAY(u32, refill_ring_num_refill);
- };
-
- /* RXDMA error code from WBM released packets */
-@@ -1473,7 +1486,7 @@ enum htt_rx_rxdma_error_code_enum {
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_rx_soc_fw_refill_ring_num_rxdma_err_tlv_v {
-- u32 rxdma_err[0]; /* HTT_RX_RXDMA_MAX_ERR_CODE */
-+ DECLARE_FLEX_ARRAY(u32, rxdma_err); /* HTT_RX_RXDMA_MAX_ERR_CODE */
- };
-
- /* REO error code from WBM released packets */
-@@ -1505,7 +1518,7 @@ enum htt_rx_reo_error_code_enum {
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_rx_soc_fw_refill_ring_num_reo_err_tlv_v {
-- u32 reo_err[0]; /* HTT_RX_REO_MAX_ERR_CODE */
-+ DECLARE_FLEX_ARRAY(u32, reo_err); /* HTT_RX_REO_MAX_ERR_CODE */
- };
-
- /* == RX PDEV STATS == */
-@@ -1622,13 +1635,13 @@ struct htt_rx_pdev_fw_stats_phy_err_tlv
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_rx_pdev_fw_ring_mpdu_err_tlv_v {
- /* Num error MPDU for each RxDMA error type */
-- u32 fw_ring_mpdu_err[0]; /* HTT_RX_STATS_RXDMA_MAX_ERR */
-+ DECLARE_FLEX_ARRAY(u32, fw_ring_mpdu_err); /* HTT_RX_STATS_RXDMA_MAX_ERR */
- };
-
- /* NOTE: Variable length TLV, use length spec to infer array size */
- struct htt_rx_pdev_fw_mpdu_drop_tlv_v {
- /* Num MPDU dropped */
-- u32 fw_mpdu_drop[0]; /* HTT_RX_STATS_FW_DROP_REASON_MAX */
-+ DECLARE_FLEX_ARRAY(u32, fw_mpdu_drop); /* HTT_RX_STATS_FW_DROP_REASON_MAX */
- };
-
- #define HTT_PDEV_CCA_STATS_TX_FRAME_INFO_PRESENT (0x1)
+++ /dev/null
-From 5a78ac33e3cb8822da64dd1af196e83664b332b0 Mon Sep 17 00:00:00 2001
-From: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Date: Thu, 9 Mar 2023 15:23:08 +0530
-Subject: [PATCH] wifi: ath11k: fix deinitialization of firmware resources
-
-Currently, in ath11k_ahb_fw_resources_init(), iommu domain
-mapping is done only for the chipsets having fixed firmware
-memory. Also, for such chipsets, mapping is done only if it
-does not have TrustZone support.
-
-During deinitialization, only if TrustZone support is not there,
-iommu is unmapped back. However, for non fixed firmware memory
-chipsets, TrustZone support is not there and this makes the
-condition check to true and it tries to unmap the memory which
-was not mapped during initialization.
-
-This leads to the following trace -
-
-[ 83.198790] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
-[ 83.259537] Modules linked in: ath11k_ahb ath11k qmi_helpers
-.. snip ..
-[ 83.280286] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
-[ 83.287228] pc : __iommu_unmap+0x30/0x140
-[ 83.293907] lr : iommu_unmap+0x5c/0xa4
-[ 83.298072] sp : ffff80000b3abad0
-.. snip ..
-[ 83.369175] Call trace:
-[ 83.376282] __iommu_unmap+0x30/0x140
-[ 83.378541] iommu_unmap+0x5c/0xa4
-[ 83.382360] ath11k_ahb_fw_resource_deinit.part.12+0x2c/0xac [ath11k_ahb]
-[ 83.385666] ath11k_ahb_free_resources+0x140/0x17c [ath11k_ahb]
-[ 83.392521] ath11k_ahb_shutdown+0x34/0x40 [ath11k_ahb]
-[ 83.398248] platform_shutdown+0x20/0x2c
-[ 83.403455] device_shutdown+0x16c/0x1c4
-[ 83.407621] kernel_restart_prepare+0x34/0x3c
-[ 83.411529] kernel_restart+0x14/0x74
-[ 83.415781] __do_sys_reboot+0x1c4/0x22c
-[ 83.419427] __arm64_sys_reboot+0x1c/0x24
-[ 83.423420] invoke_syscall+0x44/0xfc
-[ 83.427326] el0_svc_common.constprop.3+0xac/0xe8
-[ 83.430974] do_el0_svc+0xa0/0xa8
-[ 83.435659] el0_svc+0x1c/0x44
-[ 83.438957] el0t_64_sync_handler+0x60/0x144
-[ 83.441910] el0t_64_sync+0x15c/0x160
-[ 83.446343] Code: aa0103f4 f9400001 f90027a1 d2800001 (f94006a0)
-[ 83.449903] ---[ end trace 0000000000000000 ]---
-
-This can be reproduced by probing an AHB chipset which is not
-having a fixed memory region. During reboot (or rmmod) trace
-can be seen.
-
-Fix this issue by adding a condition check on firmware fixed memory
-hw_param as done in the counter initialization function.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Fixes: f9eec4947add ("ath11k: Add support for targets without trustzone")
-Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230309095308.24937-1-quic_adisi@quicinc.com
----
- drivers/net/wireless/ath/ath11k/ahb.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/ahb.c
-+++ b/drivers/net/wireless/ath/ath11k/ahb.c
-@@ -1078,6 +1078,12 @@ static int ath11k_ahb_fw_resource_deinit
- struct iommu_domain *iommu;
- size_t unmapped_size;
-
-+ /* Chipsets not requiring MSA would have not initialized
-+ * MSA resources, return success in such cases.
-+ */
-+ if (!ab->hw_params.fixed_fw_mem)
-+ return 0;
-+
- if (ab_ahb->fw.use_tz)
- return 0;
-
+++ /dev/null
-From 68e93ac5a31d4975b25f819b2dfe914c72abc3bb Mon Sep 17 00:00:00 2001
-From: Harshitha Prem <quic_hprem@quicinc.com>
-Date: Wed, 15 Mar 2023 12:24:43 +0200
-Subject: [PATCH] wifi: ath11k: fix BUFFER_DONE read on monitor ring rx buffer
-
-Perform dma_sync_single_for_cpu() on monitor ring rx buffer before
-reading BUFFER_DONE tag and do dma_unmap_single() only after device
-had set BUFFER_DONE tag to the buffer.
-
-Also when BUFFER_DONE tag is not set, allow the buffer to get read
-next time without freeing skb.
-
-This helps to fix AP+Monitor VAP with flood traffic scenario to see
-monitor ring rx buffer overrun missing BUFFER_DONE tag to be set.
-
-Also remove redundant rx dma buf free performed on DP
-rx_mon_status_refill_ring.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sathishkumar Muruganandam <quic_murugana@quicinc.com>
-Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230309164434.32660-1-quic_hprem@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dp_rx.c | 57 ++++++++++---------------
- 1 file changed, 23 insertions(+), 34 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
-@@ -435,7 +435,6 @@ fail_free_skb:
- static int ath11k_dp_rxdma_buf_ring_free(struct ath11k *ar,
- struct dp_rxdma_ring *rx_ring)
- {
-- struct ath11k_pdev_dp *dp = &ar->dp;
- struct sk_buff *skb;
- int buf_id;
-
-@@ -453,28 +452,6 @@ static int ath11k_dp_rxdma_buf_ring_free
- idr_destroy(&rx_ring->bufs_idr);
- spin_unlock_bh(&rx_ring->idr_lock);
-
-- /* if rxdma1_enable is false, mon_status_refill_ring
-- * isn't setup, so don't clean.
-- */
-- if (!ar->ab->hw_params.rxdma1_enable)
-- return 0;
--
-- rx_ring = &dp->rx_mon_status_refill_ring[0];
--
-- spin_lock_bh(&rx_ring->idr_lock);
-- idr_for_each_entry(&rx_ring->bufs_idr, skb, buf_id) {
-- idr_remove(&rx_ring->bufs_idr, buf_id);
-- /* XXX: Understand where internal driver does this dma_unmap
-- * of rxdma_buffer.
-- */
-- dma_unmap_single(ar->ab->dev, ATH11K_SKB_RXCB(skb)->paddr,
-- skb->len + skb_tailroom(skb), DMA_BIDIRECTIONAL);
-- dev_kfree_skb_any(skb);
-- }
--
-- idr_destroy(&rx_ring->bufs_idr);
-- spin_unlock_bh(&rx_ring->idr_lock);
--
- return 0;
- }
-
-@@ -3029,39 +3006,51 @@ static int ath11k_dp_rx_reap_mon_status_
-
- spin_lock_bh(&rx_ring->idr_lock);
- skb = idr_find(&rx_ring->bufs_idr, buf_id);
-+ spin_unlock_bh(&rx_ring->idr_lock);
-+
- if (!skb) {
- ath11k_warn(ab, "rx monitor status with invalid buf_id %d\n",
- buf_id);
-- spin_unlock_bh(&rx_ring->idr_lock);
- pmon->buf_state = DP_MON_STATUS_REPLINISH;
- goto move_next;
- }
-
-- idr_remove(&rx_ring->bufs_idr, buf_id);
-- spin_unlock_bh(&rx_ring->idr_lock);
--
- rxcb = ATH11K_SKB_RXCB(skb);
-
-- dma_unmap_single(ab->dev, rxcb->paddr,
-- skb->len + skb_tailroom(skb),
-- DMA_FROM_DEVICE);
-+ dma_sync_single_for_cpu(ab->dev, rxcb->paddr,
-+ skb->len + skb_tailroom(skb),
-+ DMA_FROM_DEVICE);
-
- tlv = (struct hal_tlv_hdr *)skb->data;
- if (FIELD_GET(HAL_TLV_HDR_TAG, tlv->tl) !=
- HAL_RX_STATUS_BUFFER_DONE) {
-- ath11k_warn(ab, "mon status DONE not set %lx\n",
-+ ath11k_warn(ab, "mon status DONE not set %lx, buf_id %d\n",
- FIELD_GET(HAL_TLV_HDR_TAG,
-- tlv->tl));
-- dev_kfree_skb_any(skb);
-+ tlv->tl), buf_id);
-+ /* If done status is missing, hold onto status
-+ * ring until status is done for this status
-+ * ring buffer.
-+ * Keep HP in mon_status_ring unchanged,
-+ * and break from here.
-+ * Check status for same buffer for next time
-+ */
- pmon->buf_state = DP_MON_STATUS_NO_DMA;
-- goto move_next;
-+ break;
- }
-
-+ spin_lock_bh(&rx_ring->idr_lock);
-+ idr_remove(&rx_ring->bufs_idr, buf_id);
-+ spin_unlock_bh(&rx_ring->idr_lock);
- if (ab->hw_params.full_monitor_mode) {
- ath11k_dp_rx_mon_update_status_buf_state(pmon, tlv);
- if (paddr == pmon->mon_status_paddr)
- pmon->buf_state = DP_MON_STATUS_MATCH;
- }
-+
-+ dma_unmap_single(ab->dev, rxcb->paddr,
-+ skb->len + skb_tailroom(skb),
-+ DMA_FROM_DEVICE);
-+
- __skb_queue_tail(skb_list, skb);
- } else {
- pmon->buf_state = DP_MON_STATUS_REPLINISH;
+++ /dev/null
-From 8b4d2f080afbd4280ecca0f4b3ceea943a7a86d0 Mon Sep 17 00:00:00 2001
-From: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
-Date: Thu, 23 Mar 2023 11:39:13 +0530
-Subject: [PATCH] wifi: ath11k: Optimize 6 GHz scan time
-
-Currently, time taken to scan all supported channels on WCN6750
-is ~8 seconds and connection time is almost 10 seconds. WCN6750
-supports three Wi-Fi bands (i.e., 2.4/5/6 GHz) and the numbers of
-channels for scan come around ~100 channels (default case).
-Since the chip doesn't have support for DBS (Dual Band Simultaneous),
-scans cannot be parallelized resulting in longer scan times.
-
-Among the 100 odd channels, ~60 channels are in 6 GHz band. Therefore,
-optimizing the scan for 6 GHz channels will bring down the overall
-scan time.
-
-WCN6750 firmware has support to scan a 6 GHz channel based on co-located
-AP information i.e., RNR IE which is found in the legacy 2.4/5 GHz scan
-results. When a scan request with all supported channel list is enqueued
-to the firmware, then based on WMI_SCAN_CHAN_FLAG_SCAN_ONLY_IF_RNR_FOUND
-scan channel flag, firmware will scan only those 6 GHz channels for which
-RNR IEs are found in the legacy scan results.
-
-In the proposed design, based on NL80211_SCAN_FLAG_COLOCATED_6GHZ scan
-flag, driver will set the WMI_SCAN_CHAN_FLAG_SCAN_ONLY_IF_RNR_FOUND flag
-for non-PSC channels. Since there is high probability to find 6 GHz APs
-on PSC channels, these channels are always scanned. Only non-PSC channels
-are selectively scanned based on cached RNR information from the legacy
-scan results.
-
-If NL80211_SCAN_FLAG_COLOCATED_6GHZ is not set in the scan flags,
-then scan will happen on all supported channels (default behavior).
-
-With these optimizations, scan time is improved by 1.5-1.8 seconds on
-WCN6750. Similar savings have been observed on WCN6855.
-
-Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
-Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.16
-
-Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230323060913.10097-1-quic_mpubbise@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 25 +++++++++++++++++++++++--
- drivers/net/wireless/ath/ath11k/wmi.h | 4 ++++
- 2 files changed, 27 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -3819,8 +3819,29 @@ static int ath11k_mac_op_hw_scan(struct
- goto exit;
- }
-
-- for (i = 0; i < arg->num_chan; i++)
-- arg->chan_list[i] = req->channels[i]->center_freq;
-+ for (i = 0; i < arg->num_chan; i++) {
-+ if (test_bit(WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL,
-+ ar->ab->wmi_ab.svc_map)) {
-+ arg->chan_list[i] =
-+ u32_encode_bits(req->channels[i]->center_freq,
-+ WMI_SCAN_CONFIG_PER_CHANNEL_MASK);
-+
-+ /* If NL80211_SCAN_FLAG_COLOCATED_6GHZ is set in scan
-+ * flags, then scan all PSC channels in 6 GHz band and
-+ * those non-PSC channels where RNR IE is found during
-+ * the legacy 2.4/5 GHz scan.
-+ * If NL80211_SCAN_FLAG_COLOCATED_6GHZ is not set,
-+ * then all channels in 6 GHz will be scanned.
-+ */
-+ if (req->channels[i]->band == NL80211_BAND_6GHZ &&
-+ req->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ &&
-+ !cfg80211_channel_is_psc(req->channels[i]))
-+ arg->chan_list[i] |=
-+ WMI_SCAN_CH_FLAG_SCAN_ONLY_IF_RNR_FOUND;
-+ } else {
-+ arg->chan_list[i] = req->channels[i]->center_freq;
-+ }
-+ }
- }
-
- if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -2100,6 +2100,7 @@ enum wmi_tlv_service {
-
- /* The second 128 bits */
- WMI_MAX_EXT_SERVICE = 256,
-+ WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL = 265,
- WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281,
- WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326,
-
-@@ -3249,6 +3250,9 @@ struct wmi_start_scan_cmd {
- #define WMI_SCAN_DWELL_MODE_SHIFT 21
- #define WMI_SCAN_FLAG_EXT_PASSIVE_SCAN_START_TIME_ENHANCE 0x00000800
-
-+#define WMI_SCAN_CONFIG_PER_CHANNEL_MASK GENMASK(19, 0)
-+#define WMI_SCAN_CH_FLAG_SCAN_ONLY_IF_RNR_FOUND BIT(20)
-+
- enum {
- WMI_SCAN_DWELL_MODE_DEFAULT = 0,
- WMI_SCAN_DWELL_MODE_CONSERVATIVE = 1,
+++ /dev/null
-From 813968c24126cc5c8320cd5db0e262069a535063 Mon Sep 17 00:00:00 2001
-From: Ganesh Babu Jothiram <quic_gjothira@quicinc.com>
-Date: Fri, 24 Mar 2023 16:57:00 +0200
-Subject: [PATCH] wifi: ath11k: Configure the FTM responder role using firmware
- capability flag
-
-Fine Time Measurement(FTM) is offloaded feature to firmware.
-Hence, the configuration of FTM responder role is done using
-firmware capability flag instead of hw param.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Ganesh Babu Jothiram <quic_gjothira@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230317072034.8217-1-quic_gjothira@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 8 --------
- drivers/net/wireless/ath/ath11k/hw.h | 1 -
- drivers/net/wireless/ath/ath11k/mac.c | 4 ++--
- 3 files changed, 2 insertions(+), 11 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -116,7 +116,6 @@ static const struct ath11k_hw_params ath
- .tcl_ring_retry = true,
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
-- .ftm_responder = true,
- },
- {
- .hw_rev = ATH11K_HW_IPQ6018_HW10,
-@@ -199,7 +198,6 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = false,
-- .ftm_responder = true,
- },
- {
- .name = "qca6390 hw2.0",
-@@ -284,7 +282,6 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = true,
-- .ftm_responder = false,
- },
- {
- .name = "qcn9074 hw1.0",
-@@ -366,7 +363,6 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = false,
-- .ftm_responder = true,
- },
- {
- .name = "wcn6855 hw2.0",
-@@ -451,7 +447,6 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = true,
-- .ftm_responder = false,
- },
- {
- .name = "wcn6855 hw2.1",
-@@ -534,7 +529,6 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = true,
-- .ftm_responder = false,
- },
- {
- .name = "wcn6750 hw1.0",
-@@ -615,7 +609,6 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE_WCN6750,
- .smp2p_wow_exit = true,
- .support_fw_mac_sequence = true,
-- .ftm_responder = false,
- },
- {
- .hw_rev = ATH11K_HW_IPQ5018_HW10,
-@@ -695,7 +688,6 @@ static const struct ath11k_hw_params ath
- .tx_ring_size = DP_TCL_DATA_RING_SIZE,
- .smp2p_wow_exit = false,
- .support_fw_mac_sequence = false,
-- .ftm_responder = true,
- },
- };
-
---- a/drivers/net/wireless/ath/ath11k/hw.h
-+++ b/drivers/net/wireless/ath/ath11k/hw.h
-@@ -224,7 +224,6 @@ struct ath11k_hw_params {
- u32 tx_ring_size;
- bool smp2p_wow_exit;
- bool support_fw_mac_sequence;
-- bool ftm_responder;
- };
-
- struct ath11k_hw_ops {
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -3538,7 +3538,7 @@ static void ath11k_mac_op_bss_info_chang
-
- if (changed & BSS_CHANGED_FTM_RESPONDER &&
- arvif->ftm_responder != info->ftm_responder &&
-- ar->ab->hw_params.ftm_responder &&
-+ test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map) &&
- (vif->type == NL80211_IFTYPE_AP ||
- vif->type == NL80211_IFTYPE_MESH_POINT)) {
- arvif->ftm_responder = info->ftm_responder;
-@@ -9234,7 +9234,7 @@ static int __ath11k_mac_register(struct
- wiphy_ext_feature_set(ar->hw->wiphy,
- NL80211_EXT_FEATURE_SET_SCAN_DWELL);
-
-- if (ab->hw_params.ftm_responder)
-+ if (test_bit(WMI_TLV_SERVICE_RTT, ar->ab->wmi_ab.svc_map))
- wiphy_ext_feature_set(ar->hw->wiphy,
- NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
-
+++ /dev/null
-From 031ffa6c2cd305a57ccc6d610f2decd956b2e7f6 Mon Sep 17 00:00:00 2001
-From: P Praneesh <quic_ppranees@quicinc.com>
-Date: Fri, 24 Mar 2023 16:57:00 +0200
-Subject: [PATCH] wifi: ath11k: fix rssi station dump not updated in QCN9074
-
-In QCN9074, station dump signal values display default value which
-is -95 dbm, since there is firmware header change for HAL_RX_MPDU_START
-between QCN9074 and IPQ8074 which cause wrong peer_id fetch from msdu.
-Fix this by updating hal_rx_mpdu_info with corresponding QCN9074 tlv
-format.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01695-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230320110312.20639-1-quic_ppranees@quicinc.com
----
- drivers/net/wireless/ath/ath11k/hal_rx.c | 10 ++++++++-
- drivers/net/wireless/ath/ath11k/hal_rx.h | 18 +++++++++++++++-
- drivers/net/wireless/ath/ath11k/hw.c | 27 ++++++++++++++++--------
- drivers/net/wireless/ath/ath11k/hw.h | 2 +-
- 4 files changed, 45 insertions(+), 12 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/hal_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/hal_rx.c
-@@ -865,6 +865,12 @@ ath11k_hal_rx_populate_mu_user_info(void
- ath11k_hal_rx_populate_byte_count(rx_tlv, ppdu_info, rx_user_status);
- }
-
-+static u16 ath11k_hal_rx_mpduinfo_get_peerid(struct ath11k_base *ab,
-+ struct hal_rx_mpdu_info *mpdu_info)
-+{
-+ return ab->hw_params.hw_ops->mpdu_info_get_peerid(mpdu_info);
-+}
-+
- static enum hal_rx_mon_status
- ath11k_hal_rx_parse_mon_status_tlv(struct ath11k_base *ab,
- struct hal_rx_mon_ppdu_info *ppdu_info,
-@@ -1459,9 +1465,11 @@ ath11k_hal_rx_parse_mon_status_tlv(struc
- break;
- }
- case HAL_RX_MPDU_START: {
-+ struct hal_rx_mpdu_info *mpdu_info =
-+ (struct hal_rx_mpdu_info *)tlv_data;
- u16 peer_id;
-
-- peer_id = ab->hw_params.hw_ops->mpdu_info_get_peerid(tlv_data);
-+ peer_id = ath11k_hal_rx_mpduinfo_get_peerid(ab, mpdu_info);
- if (peer_id)
- ppdu_info->peer_id = peer_id;
- break;
---- a/drivers/net/wireless/ath/ath11k/hal_rx.h
-+++ b/drivers/net/wireless/ath/ath11k/hal_rx.h
-@@ -405,7 +405,7 @@ struct hal_rx_phyrx_rssi_legacy_info {
- #define HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855 GENMASK(15, 0)
- #define HAL_RX_MPDU_INFO_INFO1_MPDU_LEN GENMASK(13, 0)
-
--struct hal_rx_mpdu_info {
-+struct hal_rx_mpdu_info_ipq8074 {
- __le32 rsvd0;
- __le32 info0;
- __le32 rsvd1[11];
-@@ -413,12 +413,28 @@ struct hal_rx_mpdu_info {
- __le32 rsvd2[9];
- } __packed;
-
-+struct hal_rx_mpdu_info_qcn9074 {
-+ __le32 rsvd0[10];
-+ __le32 info0;
-+ __le32 rsvd1[2];
-+ __le32 info1;
-+ __le32 rsvd2[9];
-+} __packed;
-+
- struct hal_rx_mpdu_info_wcn6855 {
- __le32 rsvd0[8];
- __le32 info0;
- __le32 rsvd1[14];
- } __packed;
-
-+struct hal_rx_mpdu_info {
-+ union {
-+ struct hal_rx_mpdu_info_ipq8074 ipq8074;
-+ struct hal_rx_mpdu_info_qcn9074 qcn9074;
-+ struct hal_rx_mpdu_info_wcn6855 wcn6855;
-+ } u;
-+} __packed;
-+
- #define HAL_RX_PPDU_END_DURATION GENMASK(23, 0)
- struct hal_rx_ppdu_end_duration {
- __le32 rsvd0[9];
---- a/drivers/net/wireless/ath/ath11k/hw.c
-+++ b/drivers/net/wireless/ath/ath11k/hw.c
-@@ -835,26 +835,35 @@ static void ath11k_hw_ipq5018_reo_setup(
- ring_hash_map);
- }
-
--static u16 ath11k_hw_ipq8074_mpdu_info_get_peerid(u8 *tlv_data)
-+static u16
-+ath11k_hw_ipq8074_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info)
- {
- u16 peer_id = 0;
-- struct hal_rx_mpdu_info *mpdu_info =
-- (struct hal_rx_mpdu_info *)tlv_data;
-
- peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID,
-- __le32_to_cpu(mpdu_info->info0));
-+ __le32_to_cpu(mpdu_info->u.ipq8074.info0));
-
- return peer_id;
- }
-
--static u16 ath11k_hw_wcn6855_mpdu_info_get_peerid(u8 *tlv_data)
-+static u16
-+ath11k_hw_qcn9074_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info)
-+{
-+ u16 peer_id = 0;
-+
-+ peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID,
-+ __le32_to_cpu(mpdu_info->u.qcn9074.info0));
-+
-+ return peer_id;
-+}
-+
-+static u16
-+ath11k_hw_wcn6855_mpdu_info_get_peerid(struct hal_rx_mpdu_info *mpdu_info)
- {
- u16 peer_id = 0;
-- struct hal_rx_mpdu_info_wcn6855 *mpdu_info =
-- (struct hal_rx_mpdu_info_wcn6855 *)tlv_data;
-
- peer_id = FIELD_GET(HAL_RX_MPDU_INFO_INFO0_PEERID_WCN6855,
-- __le32_to_cpu(mpdu_info->info0));
-+ __le32_to_cpu(mpdu_info->u.wcn6855.info0));
- return peer_id;
- }
-
-@@ -1042,7 +1051,7 @@ const struct ath11k_hw_ops qcn9074_ops =
- .rx_desc_get_attention = ath11k_hw_qcn9074_rx_desc_get_attention,
- .rx_desc_get_msdu_payload = ath11k_hw_qcn9074_rx_desc_get_msdu_payload,
- .reo_setup = ath11k_hw_ipq8074_reo_setup,
-- .mpdu_info_get_peerid = ath11k_hw_ipq8074_mpdu_info_get_peerid,
-+ .mpdu_info_get_peerid = ath11k_hw_qcn9074_mpdu_info_get_peerid,
- .rx_desc_mac_addr2_valid = ath11k_hw_ipq9074_rx_desc_mac_addr2_valid,
- .rx_desc_mpdu_start_addr2 = ath11k_hw_ipq9074_rx_desc_mpdu_start_addr2,
- .get_ring_selector = ath11k_hw_ipq8074_get_tcl_ring_selector,
---- a/drivers/net/wireless/ath/ath11k/hw.h
-+++ b/drivers/net/wireless/ath/ath11k/hw.h
-@@ -263,7 +263,7 @@ struct ath11k_hw_ops {
- struct rx_attention *(*rx_desc_get_attention)(struct hal_rx_desc *desc);
- u8 *(*rx_desc_get_msdu_payload)(struct hal_rx_desc *desc);
- void (*reo_setup)(struct ath11k_base *ab);
-- u16 (*mpdu_info_get_peerid)(u8 *tlv_data);
-+ u16 (*mpdu_info_get_peerid)(struct hal_rx_mpdu_info *mpdu_info);
- bool (*rx_desc_mac_addr2_valid)(struct hal_rx_desc *desc);
- u8* (*rx_desc_mpdu_start_addr2)(struct hal_rx_desc *desc);
- u32 (*get_ring_selector)(struct sk_buff *skb);
+++ /dev/null
-From 447b0398a9cd41ca343dfd43e555af92d6214487 Mon Sep 17 00:00:00 2001
-From: Bhagavathi Perumal S <quic_bperumal@quicinc.com>
-Date: Fri, 24 Mar 2023 16:57:00 +0200
-Subject: [PATCH] wifi: ath11k: Fix invalid management rx frame length issue
-
-The WMI management rx event has multiple arrays of TLVs, however the common
-WMI TLV parser won't handle multiple TLV tags of same type.
-So the multiple array tags of WMI management rx TLV is parsed incorrectly
-and the length calculated becomes wrong when the target sends multiple
-array tags.
-
-Add separate TLV parser to handle multiple arrays for WMI management rx
-TLV. This fixes invalid length issue when the target sends multiple array
-tags.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Bhagavathi Perumal S <quic_bperumal@quicinc.com>
-Co-developed-by: Nagarajan Maran <quic_nmaran@quicinc.com>
-Signed-off-by: Nagarajan Maran <quic_nmaran@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230320133840.30162-1-quic_nmaran@quicinc.com
----
- drivers/net/wireless/ath/ath11k/wmi.c | 45 +++++++++++++++++++++------
- 1 file changed, 35 insertions(+), 10 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -82,6 +82,12 @@ struct wmi_tlv_fw_stats_parse {
- bool chain_rssi_done;
- };
-
-+struct wmi_tlv_mgmt_rx_parse {
-+ const struct wmi_mgmt_rx_hdr *fixed;
-+ const u8 *frame_buf;
-+ bool frame_buf_done;
-+};
-+
- static const struct wmi_tlv_policy wmi_tlv_policies[] = {
- [WMI_TAG_ARRAY_BYTE]
- = { .min_len = 0 },
-@@ -5633,28 +5639,49 @@ static int ath11k_pull_vdev_stopped_para
- return 0;
- }
-
-+static int ath11k_wmi_tlv_mgmt_rx_parse(struct ath11k_base *ab,
-+ u16 tag, u16 len,
-+ const void *ptr, void *data)
-+{
-+ struct wmi_tlv_mgmt_rx_parse *parse = data;
-+
-+ switch (tag) {
-+ case WMI_TAG_MGMT_RX_HDR:
-+ parse->fixed = ptr;
-+ break;
-+ case WMI_TAG_ARRAY_BYTE:
-+ if (!parse->frame_buf_done) {
-+ parse->frame_buf = ptr;
-+ parse->frame_buf_done = true;
-+ }
-+ break;
-+ }
-+ return 0;
-+}
-+
- static int ath11k_pull_mgmt_rx_params_tlv(struct ath11k_base *ab,
- struct sk_buff *skb,
- struct mgmt_rx_event_params *hdr)
- {
-- const void **tb;
-+ struct wmi_tlv_mgmt_rx_parse parse = { };
- const struct wmi_mgmt_rx_hdr *ev;
- const u8 *frame;
- int ret;
-
-- tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC);
-- if (IS_ERR(tb)) {
-- ret = PTR_ERR(tb);
-- ath11k_warn(ab, "failed to parse tlv: %d\n", ret);
-+ ret = ath11k_wmi_tlv_iter(ab, skb->data, skb->len,
-+ ath11k_wmi_tlv_mgmt_rx_parse,
-+ &parse);
-+ if (ret) {
-+ ath11k_warn(ab, "failed to parse mgmt rx tlv %d\n",
-+ ret);
- return ret;
- }
-
-- ev = tb[WMI_TAG_MGMT_RX_HDR];
-- frame = tb[WMI_TAG_ARRAY_BYTE];
-+ ev = parse.fixed;
-+ frame = parse.frame_buf;
-
- if (!ev || !frame) {
- ath11k_warn(ab, "failed to fetch mgmt rx hdr");
-- kfree(tb);
- return -EPROTO;
- }
-
-@@ -5673,7 +5700,6 @@ static int ath11k_pull_mgmt_rx_params_tl
-
- if (skb->len < (frame - skb->data) + hdr->buf_len) {
- ath11k_warn(ab, "invalid length in mgmt rx hdr ev");
-- kfree(tb);
- return -EPROTO;
- }
-
-@@ -5685,7 +5711,6 @@ static int ath11k_pull_mgmt_rx_params_tl
-
- ath11k_ce_byte_swap(skb->data, hdr->buf_len);
-
-- kfree(tb);
- return 0;
- }
-
+++ /dev/null
-From 756a7f90878f0866fd2fe167ef37e90b47326b96 Mon Sep 17 00:00:00 2001
-From: P Praneesh <quic_ppranees@quicinc.com>
-Date: Fri, 24 Mar 2023 16:57:01 +0200
-Subject: [PATCH] wifi: ath11k: fix writing to unintended memory region
-
-While initializing spectral, the magic value is getting written to the
-invalid memory address leading to random boot-up crash. This occurs
-due to the incorrect index increment in ath11k_dbring_fill_magic_value
-function. Fix it by replacing the existing logic with memset32 to ensure
-there is no invalid memory access.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01838-QCAHKSWPL_SILICONZ-1
-
-Fixes: d3d358efc553 ("ath11k: add spectral/CFR buffer validation support")
-Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230321052900.16895-1-quic_ppranees@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dbring.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/dbring.c
-+++ b/drivers/net/wireless/ath/ath11k/dbring.c
-@@ -26,13 +26,13 @@ int ath11k_dbring_validate_buffer(struct
- static void ath11k_dbring_fill_magic_value(struct ath11k *ar,
- void *buffer, u32 size)
- {
-- u32 *temp;
-- int idx;
-+ /* memset32 function fills buffer payload with the ATH11K_DB_MAGIC_VALUE
-+ * and the variable size is expected to be the number of u32 values
-+ * to be stored, not the number of bytes.
-+ */
-+ size = size / sizeof(u32);
-
-- size = size >> 2;
--
-- for (idx = 0, temp = buffer; idx < size; idx++, temp++)
-- *temp++ = ATH11K_DB_MAGIC_VALUE;
-+ memset32(buffer, ATH11K_DB_MAGIC_VALUE, size);
- }
-
- static int ath11k_dbring_bufs_replenish(struct ath11k *ar,
+++ /dev/null
-From e89a51aedf380bc60219dc9afa96c36507060fb3 Mon Sep 17 00:00:00 2001
-From: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
-Date: Wed, 15 Mar 2023 21:48:17 +0530
-Subject: [PATCH] wifi: ath11k: Send 11d scan start before WMI_START_SCAN_CMDID
-
-Firmwares advertising the support of triggering 11d algorithm on the
-scan results of a regular scan expects driver to send
-WMI_11D_SCAN_START_CMDID before sending WMI_START_SCAN_CMDID.
-Triggering 11d algorithm on the scan results of a normal scan helps
-in completely avoiding a separate 11d scan for determining regdomain.
-This indirectly helps in speeding up connections on station
-interfaces on the chipsets supporting 11D scan.
-
-To enable this feature, send WMI_11D_SCAN_START_CMDID just before
-sending WMI_START_SCAN_CMDID if the firmware advertises
-WMI_TLV_SERVICE_SUPPORT_11D_FOR_HOST_SCAN service flag.
-
-WCN6750 & WCN6855 supports this feature.
-
-Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-01160-QCAMSLSWPLZ-1
-Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23
-
-Signed-off-by: Manikanta Pubbisetty <quic_mpubbise@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230315161817.29627-1-quic_mpubbise@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++++++++
- drivers/net/wireless/ath/ath11k/wmi.h | 1 +
- 2 files changed, 13 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -3755,6 +3755,18 @@ static int ath11k_mac_op_hw_scan(struct
- int i;
- u32 scan_timeout;
-
-+ /* Firmwares advertising the support of triggering 11D algorithm
-+ * on the scan results of a regular scan expects driver to send
-+ * WMI_11D_SCAN_START_CMDID before sending WMI_START_SCAN_CMDID.
-+ * With this feature, separate 11D scan can be avoided since
-+ * regdomain can be determined with the scan results of the
-+ * regular scan.
-+ */
-+ if (ar->state_11d == ATH11K_11D_PREPARING &&
-+ test_bit(WMI_TLV_SERVICE_SUPPORT_11D_FOR_HOST_SCAN,
-+ ar->ab->wmi_ab.svc_map))
-+ ath11k_mac_11d_scan_start(ar, arvif->vdev_id);
-+
- mutex_lock(&ar->conf_mutex);
-
- spin_lock_bh(&ar->data_lock);
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -2103,6 +2103,7 @@ enum wmi_tlv_service {
- WMI_TLV_SERVICE_SCAN_CONFIG_PER_CHANNEL = 265,
- WMI_TLV_SERVICE_REG_CC_EXT_EVENT_SUPPORT = 281,
- WMI_TLV_SERVICE_BIOS_SAR_SUPPORT = 326,
-+ WMI_TLV_SERVICE_SUPPORT_11D_FOR_HOST_SCAN = 357,
-
- /* The third 128 bits */
- WMI_MAX_EXT2_SERVICE = 384
+++ /dev/null
-From f812e2a9f85d6bea78957ccb5197e4491316848b Mon Sep 17 00:00:00 2001
-From: Cai Huoqing <cai.huoqing@linux.dev>
-Date: Thu, 23 Mar 2023 19:26:09 +0800
-Subject: [PATCH] wifi: ath11k: Remove redundant pci_clear_master
-
-Remove pci_clear_master to simplify the code,
-the bus-mastering is also cleared in do_pci_disable_device,
-like this:
-./drivers/pci/pci.c:2197
-static void do_pci_disable_device(struct pci_dev *dev)
-{
- u16 pci_command;
-
- pci_read_config_word(dev, PCI_COMMAND, &pci_command);
- if (pci_command & PCI_COMMAND_MASTER) {
- pci_command &= ~PCI_COMMAND_MASTER;
- pci_write_config_word(dev, PCI_COMMAND, pci_command);
- }
-
- pcibios_disable_device(dev);
-}.
-And dev->is_busmaster is set to 0 in pci_disable_device.
-
-Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230323112613.7550-1-cai.huoqing@linux.dev
----
- drivers/net/wireless/ath/ath11k/pci.c | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/pci.c
-+++ b/drivers/net/wireless/ath/ath11k/pci.c
-@@ -540,7 +540,7 @@ static int ath11k_pci_claim(struct ath11
- if (!ab->mem) {
- ath11k_err(ab, "failed to map pci bar %d\n", ATH11K_PCI_BAR_NUM);
- ret = -EIO;
-- goto clear_master;
-+ goto release_region;
- }
-
- ab->mem_ce = ab->mem;
-@@ -548,8 +548,6 @@ static int ath11k_pci_claim(struct ath11
- ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab->mem);
- return 0;
-
--clear_master:
-- pci_clear_master(pdev);
- release_region:
- pci_release_region(pdev, ATH11K_PCI_BAR_NUM);
- disable_device:
-@@ -565,7 +563,6 @@ static void ath11k_pci_free_region(struc
-
- pci_iounmap(pci_dev, ab->mem);
- ab->mem = NULL;
-- pci_clear_master(pci_dev);
- pci_release_region(pci_dev, ATH11K_PCI_BAR_NUM);
- if (pci_is_enabled(pci_dev))
- pci_disable_device(pci_dev);
+++ /dev/null
-From 5c690db63b45c6c4c4932b13173af71df369dba5 Mon Sep 17 00:00:00 2001
-From: Tamizh Chelvam Raja <quic_tamizhr@quicinc.com>
-Date: Tue, 28 Mar 2023 12:41:50 +0530
-Subject: [PATCH] wifi: ath11k: Disable Spectral scan upon removing interface
-
-Host might receive spectral events during interface
-down sequence and this might create below errors.
-
-failed to handle dma buf release event -22
-failed to handle dma buf release event -22
-
-Fix this by disabling spectral config during remove interface.
-
-Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Tamizh Chelvam Raja <quic_tamizhr@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230328071150.29645-1-quic_tamizhr@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -6685,6 +6685,11 @@ static void ath11k_mac_op_remove_interfa
- ath11k_dbg(ab, ATH11K_DBG_MAC, "mac remove interface (vdev %d)\n",
- arvif->vdev_id);
-
-+ ret = ath11k_spectral_vif_stop(arvif);
-+ if (ret)
-+ ath11k_warn(ab, "failed to stop spectral for vdev %i: %d\n",
-+ arvif->vdev_id, ret);
-+
- if (arvif->vdev_type == WMI_VDEV_TYPE_STA)
- ath11k_mac_11d_scan_stop(ar);
-
+++ /dev/null
-From abf57d84973ce1abcb67504ac0df8aea1fe09a76 Mon Sep 17 00:00:00 2001
-From: Youghandhar Chintala <quic_youghand@quicinc.com>
-Date: Tue, 28 Mar 2023 17:04:55 +0530
-Subject: [PATCH] wifi: ath11k: enable SAR support on WCN6750
-
-Currently, SAR is enabled only on WCN6855, enable this for WCN6750 too. This
-functionality gets triggered, when the user space application calls
-NL80211_CMD_SET_SAR_SPECS.
-
-Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
-
-Signed-off-by: Youghandhar Chintala <quic_youghand@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230328113455.11252-1-quic_youghand@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -593,7 +593,7 @@ static const struct ath11k_hw_params ath
- .current_cc_support = true,
- .dbr_debug_support = false,
- .global_reset = false,
-- .bios_sar_capa = NULL,
-+ .bios_sar_capa = &ath11k_hw_sar_capa_wcn6855,
- .m3_fw_support = false,
- .fixed_bdf_addr = false,
- .fixed_mem_region = false,
+++ /dev/null
-From 06c58473969239e00d76b683edd511952060ca56 Mon Sep 17 00:00:00 2001
-From: Takashi Iwai <tiwai@suse.de>
-Date: Thu, 30 Mar 2023 16:37:18 +0200
-Subject: [PATCH] wifi: ath11k: pci: Add more MODULE_FIRMWARE() entries
-
-As there are a few more models supported by the driver, let's add the
-missing MODULE_FIRMWARE() entries for them. The lack of them resulted
-in the missing device enablement on some systems, such as the
-installation image of openSUSE.
-
-While we are at it, use the wildcard instead of listing each firmware
-files individually for each.
-
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Reviewed-by: Simon Horman <simon.horman@corigine.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230330143718.19511-1-tiwai@suse.de
----
- drivers/net/wireless/ath/ath11k/pci.c | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/pci.c
-+++ b/drivers/net/wireless/ath/ath11k/pci.c
-@@ -1036,7 +1036,8 @@ module_exit(ath11k_pci_exit);
- MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax WLAN PCIe devices");
- MODULE_LICENSE("Dual BSD/GPL");
-
--/* QCA639x 2.0 firmware files */
--MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/" ATH11K_BOARD_API2_FILE);
--MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/" ATH11K_AMSS_FILE);
--MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/" ATH11K_M3_FILE);
-+/* firmware files */
-+MODULE_FIRMWARE(ATH11K_FW_DIR "/QCA6390/hw2.0/*");
-+MODULE_FIRMWARE(ATH11K_FW_DIR "/QCN9074/hw1.0/*");
-+MODULE_FIRMWARE(ATH11K_FW_DIR "/WCN6855/hw2.0/*");
-+MODULE_FIRMWARE(ATH11K_FW_DIR "/WCN6855/hw2.1/*");
+++ /dev/null
-From a87a9110ac0dcbfd9458b6665c141fa1c16a669d Mon Sep 17 00:00:00 2001
-From: Kalle Valo <quic_kvalo@quicinc.com>
-Date: Wed, 5 Apr 2023 12:04:25 +0300
-Subject: [PATCH] wifi: ath11k: print a warning when crypto_alloc_shash() fails
-
-Christoph reported that ath11k failed to initialise when michael_mic.ko
-module was not installed. To make it easier to notice that case print a
-warning when crypto_alloc_shash() fails.
-
-Compile tested only.
-
-Reported-by: Christoph Hellwig <hch@lst.de>
-Link: https://lore.kernel.org/all/20221130133016.GC3055@lst.de/
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230405090425.1351-1-kvalo@kernel.org
----
- drivers/net/wireless/ath/ath11k/dp_rx.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
-@@ -3106,8 +3106,11 @@ int ath11k_peer_rx_frag_setup(struct ath
- int i;
-
- tfm = crypto_alloc_shash("michael_mic", 0, 0);
-- if (IS_ERR(tfm))
-+ if (IS_ERR(tfm)) {
-+ ath11k_warn(ab, "failed to allocate michael_mic shash: %ld\n",
-+ PTR_ERR(tfm));
- return PTR_ERR(tfm);
-+ }
-
- spin_lock_bh(&ab->base_lock);
-
+++ /dev/null
-From a06bfb3c9f69f303692cdae87bc0899d2ae8b2a6 Mon Sep 17 00:00:00 2001
-From: Harshitha Prem <quic_hprem@quicinc.com>
-Date: Tue, 4 Apr 2023 00:11:54 +0530
-Subject: [PATCH] wifi: ath11k: Ignore frags from uninitialized peer in dp.
-
-When max virtual ap interfaces are configured in all the bands with
-ACS and hostapd restart is done every 60s, a crash is observed at
-random times.
-In this certain scenario, a fragmented packet is received for
-self peer, for which rx_tid and rx_frags are not initialized in
-datapath. While handling this fragment, crash is observed as the
-rx_frag list is uninitialised and when we walk in
-ath11k_dp_rx_h_sort_frags, skb null leads to exception.
-
-To address this, before processing received fragments we check
-dp_setup_done flag is set to ensure that peer has completed its
-dp peer setup for fragment queue, else ignore processing the
-fragments.
-
-Call trace:
- ath11k_dp_process_rx_err+0x550/0x1084 [ath11k]
- ath11k_dp_service_srng+0x70/0x370 [ath11k]
- 0xffffffc009693a04
- __napi_poll+0x30/0xa4
- net_rx_action+0x118/0x270
- __do_softirq+0x10c/0x244
- irq_exit+0x64/0xb4
- __handle_domain_irq+0x88/0xac
- gic_handle_irq+0x74/0xbc
- el1_irq+0xf0/0x1c0
- arch_cpu_idle+0x10/0x18
- do_idle+0x104/0x248
- cpu_startup_entry+0x20/0x64
- rest_init+0xd0/0xdc
- arch_call_rest_init+0xc/0x14
- start_kernel+0x480/0x4b8
- Code: f9400281 f94066a2 91405021 b94a0023 (f9406401)
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
-Signed-off-by: Nagarajan Maran <quic_nmaran@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230403184155.8670-2-quic_nmaran@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dp.c | 4 +++-
- drivers/net/wireless/ath/ath11k/dp_rx.c | 8 ++++++++
- drivers/net/wireless/ath/ath11k/peer.h | 1 +
- 3 files changed, 12 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp.c
-+++ b/drivers/net/wireless/ath/ath11k/dp.c
-@@ -36,6 +36,7 @@ void ath11k_dp_peer_cleanup(struct ath11
- }
-
- ath11k_peer_rx_tid_cleanup(ar, peer);
-+ peer->dp_setup_done = false;
- crypto_free_shash(peer->tfm_mmic);
- spin_unlock_bh(&ab->base_lock);
- }
-@@ -72,7 +73,8 @@ int ath11k_dp_peer_setup(struct ath11k *
- ret = ath11k_peer_rx_frag_setup(ar, addr, vdev_id);
- if (ret) {
- ath11k_warn(ab, "failed to setup rx defrag context\n");
-- return ret;
-+ tid--;
-+ goto peer_clean;
- }
-
- /* TODO: Setup other peer specific resource used in data path */
---- a/drivers/net/wireless/ath/ath11k/dp_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
-@@ -3130,6 +3130,7 @@ int ath11k_peer_rx_frag_setup(struct ath
- }
-
- peer->tfm_mmic = tfm;
-+ peer->dp_setup_done = true;
- spin_unlock_bh(&ab->base_lock);
-
- return 0;
-@@ -3575,6 +3576,13 @@ static int ath11k_dp_rx_frag_h_mpdu(stru
- ret = -ENOENT;
- goto out_unlock;
- }
-+ if (!peer->dp_setup_done) {
-+ ath11k_warn(ab, "The peer %pM [%d] has uninitialized datapath\n",
-+ peer->addr, peer_id);
-+ ret = -ENOENT;
-+ goto out_unlock;
-+ }
-+
- rx_tid = &peer->rx_tid[tid];
-
- if ((!skb_queue_empty(&rx_tid->rx_frags) && seqno != rx_tid->cur_sn) ||
---- a/drivers/net/wireless/ath/ath11k/peer.h
-+++ b/drivers/net/wireless/ath/ath11k/peer.h
-@@ -35,6 +35,7 @@ struct ath11k_peer {
- u16 sec_type;
- u16 sec_type_grp;
- bool is_authorized;
-+ bool dp_setup_done;
- };
-
- void ath11k_peer_unmap_event(struct ath11k_base *ab, u16 peer_id);
+++ /dev/null
-From 41e02bf4ae32cf2ac47b08b4caaa9c1a032e4ce7 Mon Sep 17 00:00:00 2001
-From: Harshitha Prem <quic_hprem@quicinc.com>
-Date: Tue, 4 Apr 2023 00:11:55 +0530
-Subject: [PATCH] wifi: ath11k: fix undefined behavior with __fls in dp
-
-"__fls" would have an undefined behavior if the argument is passed
-as "0". Hence, added changes to handle the same.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
-Signed-off-by: Nagarajan Maran <quic_nmaran@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230403184155.8670-3-quic_nmaran@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
-@@ -3598,7 +3598,7 @@ static int ath11k_dp_rx_frag_h_mpdu(stru
- goto out_unlock;
- }
-
-- if (frag_no > __fls(rx_tid->rx_frag_bitmap))
-+ if (!rx_tid->rx_frag_bitmap || (frag_no > __fls(rx_tid->rx_frag_bitmap)))
- __skb_queue_tail(&rx_tid->rx_frags, msdu);
- else
- ath11k_dp_rx_h_sort_frags(ar, &rx_tid->rx_frags, msdu);
+++ /dev/null
-From 93a91f40c25c3d0e61f8540a7accf105090f9995 Mon Sep 17 00:00:00 2001
-From: Harshitha Prem <quic_hprem@quicinc.com>
-Date: Mon, 17 Apr 2023 13:35:00 +0300
-Subject: [PATCH] wifi: ath11k: fix double free of peer rx_tid during reo cmd
- failure
-
-Peer rx_tid is locally copied thrice during peer_rx_tid_cleanup to
-send REO_CMD_UPDATE_RX_QUEUE followed by REO_CMD_FLUSH_CACHE to flush
-all aged REO descriptors from HW cache.
-
-When sending REO_CMD_FLUSH_CACHE fails, we do dma unmap of already
-mapped rx_tid->vaddr and free it. This is not checked during
-reo_cmd_list_cleanup() and dp_reo_cmd_free() before trying to free and
-unmap again.
-
-Fix this by setting rx_tid->vaddr NULL in rx tid delete and also
-wherever freeing it to check in reo_cmd_list_cleanup() and
-reo_cmd_free() before trying to free again.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sathishkumar Muruganandam <quic_murugana@quicinc.com>
-Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230403182420.23375-2-quic_hprem@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dp_rx.c | 43 ++++++++++++++++++-------
- 1 file changed, 31 insertions(+), 12 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
-@@ -668,13 +668,18 @@ void ath11k_dp_reo_cmd_list_cleanup(stru
- struct ath11k_dp *dp = &ab->dp;
- struct dp_reo_cmd *cmd, *tmp;
- struct dp_reo_cache_flush_elem *cmd_cache, *tmp_cache;
-+ struct dp_rx_tid *rx_tid;
-
- spin_lock_bh(&dp->reo_cmd_lock);
- list_for_each_entry_safe(cmd, tmp, &dp->reo_cmd_list, list) {
- list_del(&cmd->list);
-- dma_unmap_single(ab->dev, cmd->data.paddr,
-- cmd->data.size, DMA_BIDIRECTIONAL);
-- kfree(cmd->data.vaddr);
-+ rx_tid = &cmd->data;
-+ if (rx_tid->vaddr) {
-+ dma_unmap_single(ab->dev, rx_tid->paddr,
-+ rx_tid->size, DMA_BIDIRECTIONAL);
-+ kfree(rx_tid->vaddr);
-+ rx_tid->vaddr = NULL;
-+ }
- kfree(cmd);
- }
-
-@@ -682,9 +687,13 @@ void ath11k_dp_reo_cmd_list_cleanup(stru
- &dp->reo_cmd_cache_flush_list, list) {
- list_del(&cmd_cache->list);
- dp->reo_cmd_cache_flush_count--;
-- dma_unmap_single(ab->dev, cmd_cache->data.paddr,
-- cmd_cache->data.size, DMA_BIDIRECTIONAL);
-- kfree(cmd_cache->data.vaddr);
-+ rx_tid = &cmd_cache->data;
-+ if (rx_tid->vaddr) {
-+ dma_unmap_single(ab->dev, rx_tid->paddr,
-+ rx_tid->size, DMA_BIDIRECTIONAL);
-+ kfree(rx_tid->vaddr);
-+ rx_tid->vaddr = NULL;
-+ }
- kfree(cmd_cache);
- }
- spin_unlock_bh(&dp->reo_cmd_lock);
-@@ -698,10 +707,12 @@ static void ath11k_dp_reo_cmd_free(struc
- if (status != HAL_REO_CMD_SUCCESS)
- ath11k_warn(dp->ab, "failed to flush rx tid hw desc, tid %d status %d\n",
- rx_tid->tid, status);
--
-- dma_unmap_single(dp->ab->dev, rx_tid->paddr, rx_tid->size,
-- DMA_BIDIRECTIONAL);
-- kfree(rx_tid->vaddr);
-+ if (rx_tid->vaddr) {
-+ dma_unmap_single(dp->ab->dev, rx_tid->paddr, rx_tid->size,
-+ DMA_BIDIRECTIONAL);
-+ kfree(rx_tid->vaddr);
-+ rx_tid->vaddr = NULL;
-+ }
- }
-
- static void ath11k_dp_reo_cache_flush(struct ath11k_base *ab,
-@@ -740,6 +751,7 @@ static void ath11k_dp_reo_cache_flush(st
- dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size,
- DMA_BIDIRECTIONAL);
- kfree(rx_tid->vaddr);
-+ rx_tid->vaddr = NULL;
- }
- }
-
-@@ -792,6 +804,7 @@ free_desc:
- dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size,
- DMA_BIDIRECTIONAL);
- kfree(rx_tid->vaddr);
-+ rx_tid->vaddr = NULL;
- }
-
- void ath11k_peer_rx_tid_delete(struct ath11k *ar,
-@@ -804,6 +817,8 @@ void ath11k_peer_rx_tid_delete(struct at
- if (!rx_tid->active)
- return;
-
-+ rx_tid->active = false;
-+
- cmd.flag = HAL_REO_CMD_FLG_NEED_STATUS;
- cmd.addr_lo = lower_32_bits(rx_tid->paddr);
- cmd.addr_hi = upper_32_bits(rx_tid->paddr);
-@@ -818,9 +833,11 @@ void ath11k_peer_rx_tid_delete(struct at
- dma_unmap_single(ar->ab->dev, rx_tid->paddr, rx_tid->size,
- DMA_BIDIRECTIONAL);
- kfree(rx_tid->vaddr);
-+ rx_tid->vaddr = NULL;
- }
-
-- rx_tid->active = false;
-+ rx_tid->paddr = 0;
-+ rx_tid->size = 0;
- }
-
- static int ath11k_dp_rx_link_desc_return(struct ath11k_base *ab,
-@@ -967,6 +984,7 @@ static void ath11k_dp_rx_tid_mem_free(st
- dma_unmap_single(ab->dev, rx_tid->paddr, rx_tid->size,
- DMA_BIDIRECTIONAL);
- kfree(rx_tid->vaddr);
-+ rx_tid->vaddr = NULL;
-
- rx_tid->active = false;
-
-@@ -1067,7 +1085,8 @@ int ath11k_peer_rx_tid_setup(struct ath1
- return ret;
-
- err_mem_free:
-- kfree(vaddr);
-+ kfree(rx_tid->vaddr);
-+ rx_tid->vaddr = NULL;
-
- return ret;
- }
+++ /dev/null
-From a8ae833657a45746debde85c38bb7f070d344026 Mon Sep 17 00:00:00 2001
-From: Harshitha Prem <quic_hprem@quicinc.com>
-Date: Mon, 17 Apr 2023 13:35:01 +0300
-Subject: [PATCH] wifi: ath11k: Prevent REO cmd failures
-
-Prevent REO cmd failures causing double free by increasing REO cmd
-ring size and moving REO status ring mask to IRQ group 3 from group
-0 to separate from tx completion ring on IRQ group 0 which may delay
-reo status processing.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sathishkumar Muruganandam <quic_murugana@quicinc.com>
-Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230403182420.23375-3-quic_hprem@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dp.h | 2 +-
- drivers/net/wireless/ath/ath11k/hw.c | 1 +
- 2 files changed, 2 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp.h
-+++ b/drivers/net/wireless/ath/ath11k/dp.h
-@@ -214,7 +214,7 @@ struct ath11k_pdev_dp {
- #define DP_REO_REINJECT_RING_SIZE 32
- #define DP_RX_RELEASE_RING_SIZE 1024
- #define DP_REO_EXCEPTION_RING_SIZE 128
--#define DP_REO_CMD_RING_SIZE 128
-+#define DP_REO_CMD_RING_SIZE 256
- #define DP_REO_STATUS_RING_SIZE 2048
- #define DP_RXDMA_BUF_RING_SIZE 4096
- #define DP_RXDMA_REFILL_RING_SIZE 2048
---- a/drivers/net/wireless/ath/ath11k/hw.c
-+++ b/drivers/net/wireless/ath/ath11k/hw.c
-@@ -1233,6 +1233,7 @@ const struct ath11k_hw_ring_mask ath11k_
- ATH11K_RX_WBM_REL_RING_MASK_0,
- },
- .reo_status = {
-+ 0, 0, 0,
- ATH11K_REO_STATUS_RING_MASK_0,
- },
- .rxdma2host = {
+++ /dev/null
-From 20487cc3ff36bbfa9505f0a078ba98f09abfc717 Mon Sep 17 00:00:00 2001
-From: Harshitha Prem <quic_hprem@quicinc.com>
-Date: Mon, 17 Apr 2023 13:35:01 +0300
-Subject: [PATCH] wifi: ath11k: add peer mac information in failure cases
-
-During reo command failure, the peer mac detail for which the reo
-command was not successful is unknown. Hence, to improve the
-debuggability, add the peer mac information in the failure cases
-which would be useful during multi client cases.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sathishkumar Muruganandam <quic_murugana@quicinc.com>
-Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230403182420.23375-4-quic_hprem@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dp_rx.c | 16 ++++++++++------
- 1 file changed, 10 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
-@@ -1009,7 +1009,8 @@ int ath11k_peer_rx_tid_setup(struct ath1
-
- peer = ath11k_peer_find(ab, vdev_id, peer_mac);
- if (!peer) {
-- ath11k_warn(ab, "failed to find the peer to set up rx tid\n");
-+ ath11k_warn(ab, "failed to find the peer %pM to set up rx tid\n",
-+ peer_mac);
- spin_unlock_bh(&ab->base_lock);
- return -ENOENT;
- }
-@@ -1022,7 +1023,8 @@ int ath11k_peer_rx_tid_setup(struct ath1
- ba_win_sz, ssn, true);
- spin_unlock_bh(&ab->base_lock);
- if (ret) {
-- ath11k_warn(ab, "failed to update reo for rx tid %d\n", tid);
-+ ath11k_warn(ab, "failed to update reo for peer %pM rx tid %d\n: %d",
-+ peer_mac, tid, ret);
- return ret;
- }
-
-@@ -1030,8 +1032,8 @@ int ath11k_peer_rx_tid_setup(struct ath1
- peer_mac, paddr,
- tid, 1, ba_win_sz);
- if (ret)
-- ath11k_warn(ab, "failed to send wmi command to update rx reorder queue, tid :%d (%d)\n",
-- tid, ret);
-+ ath11k_warn(ab, "failed to send wmi rx reorder queue for peer %pM tid %d: %d\n",
-+ peer_mac, tid, ret);
- return ret;
- }
-
-@@ -1064,6 +1066,8 @@ int ath11k_peer_rx_tid_setup(struct ath1
- ret = dma_mapping_error(ab->dev, paddr);
- if (ret) {
- spin_unlock_bh(&ab->base_lock);
-+ ath11k_warn(ab, "failed to setup dma map for peer %pM rx tid %d: %d\n",
-+ peer_mac, tid, ret);
- goto err_mem_free;
- }
-
-@@ -1077,8 +1081,8 @@ int ath11k_peer_rx_tid_setup(struct ath1
- ret = ath11k_wmi_peer_rx_reorder_queue_setup(ar, vdev_id, peer_mac,
- paddr, tid, 1, ba_win_sz);
- if (ret) {
-- ath11k_warn(ar->ab, "failed to setup rx reorder queue, tid :%d (%d)\n",
-- tid, ret);
-+ ath11k_warn(ar->ab, "failed to setup rx reorder queue for peer %pM tid %d: %d\n",
-+ peer_mac, tid, ret);
- ath11k_dp_rx_tid_mem_free(ab, peer_mac, vdev_id, tid);
- }
-
+++ /dev/null
-From 6257c702264c44d74c6b71f0c62a7665da2dc356 Mon Sep 17 00:00:00 2001
-From: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
-Date: Mon, 17 Apr 2023 13:35:02 +0300
-Subject: [PATCH] wifi: ath11k: fix tx status reporting in encap offload mode
-
-ieee80211_tx_status() treats packets in 802.11 frame format and
-tries to extract sta address from packet header. When tx encap
-offload is enabled, this becomes invalid operation. Hence, switch
-to using ieee80211_tx_status_ext() after filling in station
-address for handling both 802.11 and 802.3 frames.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230403195738.25367-2-quic_pradeepc@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dp.h | 4 +++
- drivers/net/wireless/ath/ath11k/dp_tx.c | 33 ++++++++++++++++++++++++-
- drivers/net/wireless/ath/ath11k/dp_tx.h | 1 +
- 3 files changed, 37 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp.h
-+++ b/drivers/net/wireless/ath/ath11k/dp.h
-@@ -303,12 +303,16 @@ struct ath11k_dp {
-
- #define HTT_TX_WBM_COMP_STATUS_OFFSET 8
-
-+#define HTT_INVALID_PEER_ID 0xffff
-+
- /* HTT tx completion is overlaid in wbm_release_ring */
- #define HTT_TX_WBM_COMP_INFO0_STATUS GENMASK(12, 9)
- #define HTT_TX_WBM_COMP_INFO0_REINJECT_REASON GENMASK(16, 13)
- #define HTT_TX_WBM_COMP_INFO0_REINJECT_REASON GENMASK(16, 13)
-
- #define HTT_TX_WBM_COMP_INFO1_ACK_RSSI GENMASK(31, 24)
-+#define HTT_TX_WBM_COMP_INFO2_SW_PEER_ID GENMASK(15, 0)
-+#define HTT_TX_WBM_COMP_INFO2_VALID BIT(21)
-
- struct htt_tx_wbm_completion {
- u32 info0;
---- a/drivers/net/wireless/ath/ath11k/dp_tx.c
-+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c
-@@ -316,10 +316,12 @@ ath11k_dp_tx_htt_tx_complete_buf(struct
- struct dp_tx_ring *tx_ring,
- struct ath11k_dp_htt_wbm_tx_status *ts)
- {
-+ struct ieee80211_tx_status status = { 0 };
- struct sk_buff *msdu;
- struct ieee80211_tx_info *info;
- struct ath11k_skb_cb *skb_cb;
- struct ath11k *ar;
-+ struct ath11k_peer *peer;
-
- spin_lock(&tx_ring->tx_idr_lock);
- msdu = idr_remove(&tx_ring->txbuf_idr, ts->msdu_id);
-@@ -341,6 +343,11 @@ ath11k_dp_tx_htt_tx_complete_buf(struct
-
- dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
-
-+ if (!skb_cb->vif) {
-+ dev_kfree_skb_any(msdu);
-+ return;
-+ }
-+
- memset(&info->status, 0, sizeof(info->status));
-
- if (ts->acked) {
-@@ -355,7 +362,23 @@ ath11k_dp_tx_htt_tx_complete_buf(struct
- }
- }
-
-- ieee80211_tx_status(ar->hw, msdu);
-+ spin_lock_bh(&ab->base_lock);
-+ peer = ath11k_peer_find_by_id(ab, ts->peer_id);
-+ if (!peer || !peer->sta) {
-+ ath11k_dbg(ab, ATH11K_DBG_DATA,
-+ "dp_tx: failed to find the peer with peer_id %d\n",
-+ ts->peer_id);
-+ spin_unlock_bh(&ab->base_lock);
-+ dev_kfree_skb_any(msdu);
-+ return;
-+ }
-+ spin_unlock_bh(&ab->base_lock);
-+
-+ status.sta = peer->sta;
-+ status.info = info;
-+ status.skb = msdu;
-+
-+ ieee80211_tx_status_ext(ar->hw, &status);
- }
-
- static void
-@@ -379,7 +402,15 @@ ath11k_dp_tx_process_htt_tx_complete(str
- ts.msdu_id = msdu_id;
- ts.ack_rssi = FIELD_GET(HTT_TX_WBM_COMP_INFO1_ACK_RSSI,
- status_desc->info1);
-+
-+ if (FIELD_GET(HTT_TX_WBM_COMP_INFO2_VALID, status_desc->info2))
-+ ts.peer_id = FIELD_GET(HTT_TX_WBM_COMP_INFO2_SW_PEER_ID,
-+ status_desc->info2);
-+ else
-+ ts.peer_id = HTT_INVALID_PEER_ID;
-+
- ath11k_dp_tx_htt_tx_complete_buf(ab, tx_ring, &ts);
-+
- break;
- case HAL_WBM_REL_HTT_TX_COMP_STATUS_REINJ:
- case HAL_WBM_REL_HTT_TX_COMP_STATUS_INSPECT:
---- a/drivers/net/wireless/ath/ath11k/dp_tx.h
-+++ b/drivers/net/wireless/ath/ath11k/dp_tx.h
-@@ -13,6 +13,7 @@ struct ath11k_dp_htt_wbm_tx_status {
- u32 msdu_id;
- bool acked;
- int ack_rssi;
-+ u16 peer_id;
- };
-
- void ath11k_dp_tx_update_txcompl(struct ath11k *ar, struct hal_tx_status *ts);
+++ /dev/null
-From 2f0c9ac8362da09c80f1cd422ef7fd6fa9b252b9 Mon Sep 17 00:00:00 2001
-From: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
-Date: Mon, 17 Apr 2023 13:35:02 +0300
-Subject: [PATCH] wifi: ath11k: Fix incorrect update of radiotap fields
-
-Fix incorrect update of ppdu stats causing incorrect radiotap
-fields.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230403195738.25367-3-quic_pradeepc@quicinc.com
----
- drivers/net/wireless/ath/ath11k/hal_rx.c | 4 ++--
- drivers/net/wireless/ath/ath11k/hal_rx.h | 2 +-
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/hal_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/hal_rx.c
-@@ -1029,7 +1029,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struc
- info1 = __le32_to_cpu(vht_sig->info1);
-
- ppdu_info->ldpc = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING,
-- info0);
-+ info1);
- ppdu_info->mcs = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_MCS,
- info1);
- gi_setting = FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_GI_SETTING,
-@@ -1452,7 +1452,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struc
- * PHYRX_OTHER_RECEIVE_INFO TLV.
- */
- ppdu_info->rssi_comb =
-- FIELD_GET(HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB,
-+ FIELD_GET(HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB,
- __le32_to_cpu(rssi->info0));
-
- if (db2dbm) {
---- a/drivers/net/wireless/ath/ath11k/hal_rx.h
-+++ b/drivers/net/wireless/ath/ath11k/hal_rx.h
-@@ -385,7 +385,7 @@ struct hal_rx_he_sig_b2_ofdma_info {
- __le32 info0;
- } __packed;
-
--#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB GENMASK(15, 8)
-+#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RSSI_COMB GENMASK(15, 8)
-
- #define HAL_RX_PHYRX_RSSI_PREAMBLE_PRI20 GENMASK(7, 0)
-
+++ /dev/null
-From f9fff67d2d7ca6fa8066132003a3deef654c55b1 Mon Sep 17 00:00:00 2001
-From: Nagarajan Maran <quic_nmaran@quicinc.com>
-Date: Mon, 17 Apr 2023 13:35:02 +0300
-Subject: [PATCH] wifi: ath11k: Fix SKB corruption in REO destination ring
-
-While running traffics for a long time, randomly an RX descriptor
-filled with value "0" from REO destination ring is received.
-This descriptor which is invalid causes the wrong SKB (SKB stored in
-the IDR lookup with buffer id "0") to be fetched which in turn
-causes SKB memory corruption issue and the same leads to crash
-after some time.
-
-Changed the start id for idr allocation to "1" and the buffer id "0"
-is reserved for error validation. Introduced Sanity check to validate
-the descriptor, before processing the SKB.
-
-Crash Signature :
-
-Unable to handle kernel paging request at virtual address 3f004900
-PC points to "b15_dma_inv_range+0x30/0x50"
-LR points to "dma_cache_maint_page+0x8c/0x128".
-The Backtrace obtained is as follows:
-[<8031716c>] (b15_dma_inv_range) from [<80313a4c>] (dma_cache_maint_page+0x8c/0x128)
-[<80313a4c>] (dma_cache_maint_page) from [<80313b90>] (__dma_page_dev_to_cpu+0x28/0xcc)
-[<80313b90>] (__dma_page_dev_to_cpu) from [<7fb5dd68>] (ath11k_dp_process_rx+0x1e8/0x4a4 [ath11k])
-[<7fb5dd68>] (ath11k_dp_process_rx [ath11k]) from [<7fb53c20>] (ath11k_dp_service_srng+0xb0/0x2ac [ath11k])
-[<7fb53c20>] (ath11k_dp_service_srng [ath11k]) from [<7f67bba4>] (ath11k_pci_ext_grp_napi_poll+0x1c/0x78 [ath11k_pci])
-[<7f67bba4>] (ath11k_pci_ext_grp_napi_poll [ath11k_pci]) from [<807d5cf4>] (__napi_poll+0x28/0xb8)
-[<807d5cf4>] (__napi_poll) from [<807d5f28>] (net_rx_action+0xf0/0x280)
-[<807d5f28>] (net_rx_action) from [<80302148>] (__do_softirq+0xd0/0x280)
-[<80302148>] (__do_softirq) from [<80320408>] (irq_exit+0x74/0xd4)
-[<80320408>] (irq_exit) from [<803638a4>] (__handle_domain_irq+0x90/0xb4)
-[<803638a4>] (__handle_domain_irq) from [<805bedec>] (gic_handle_irq+0x58/0x90)
-[<805bedec>] (gic_handle_irq) from [<80301a78>] (__irq_svc+0x58/0x8c)
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Nagarajan Maran <quic_nmaran@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230403191533.28114-1-quic_nmaran@quicinc.com
----
- drivers/net/wireless/ath/ath11k/dp_rx.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/dp_rx.c
-+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
-@@ -389,10 +389,10 @@ int ath11k_dp_rxbufs_replenish(struct at
- goto fail_free_skb;
-
- spin_lock_bh(&rx_ring->idr_lock);
-- buf_id = idr_alloc(&rx_ring->bufs_idr, skb, 0,
-- rx_ring->bufs_max * 3, GFP_ATOMIC);
-+ buf_id = idr_alloc(&rx_ring->bufs_idr, skb, 1,
-+ (rx_ring->bufs_max * 3) + 1, GFP_ATOMIC);
- spin_unlock_bh(&rx_ring->idr_lock);
-- if (buf_id < 0)
-+ if (buf_id <= 0)
- goto fail_dma_unmap;
-
- desc = ath11k_hal_srng_src_get_next_entry(ab, srng);
-@@ -2665,6 +2665,9 @@ try_again:
- cookie);
- mac_id = FIELD_GET(DP_RXDMA_BUF_COOKIE_PDEV_ID, cookie);
-
-+ if (unlikely(buf_id == 0))
-+ continue;
-+
- ar = ab->pdevs[mac_id].ar;
- rx_ring = &ar->dp.rx_refill_buf_ring;
- spin_lock_bh(&rx_ring->idr_lock);
+++ /dev/null
-From b100722a777f6455d913666a376f81342b2cb995 Mon Sep 17 00:00:00 2001
-From: Muna Sinada <quic_msinada@quicinc.com>
-Date: Mon, 17 Apr 2023 13:22:27 -0700
-Subject: [PATCH] wifi: ath11k: Remove disabling of 80+80 and 160 MHz
-
-This is a regression fix for 80+80 and 160 MHz support bits being
-cleared, therefore not adverised. Remove disable of 80+80 and 160 MHz
-capability flags and assign valid center frequency 2 similar to
-VHT80_80.
-
-Fixes: 38dfe775d0ab ("wifi: ath11k: push MU-MIMO params from hostapd to hardware")
-Reported-by: Robert Marko <robert.marko@sartura.hr>
-Tested-by: Robert Marko <robert.marko@sartura.hr> # IPQ8074 WLAN.HK.2.9.0.1-01385-QCAHKSWPL_SILICONZ-1
-Link: https://bugzilla.kernel.org/show_bug.cgi?id=217299
-Co-developed-by: P Praneesh <quic_ppranees@quicinc.com>
-Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
-Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/1681762947-13882-1-git-send-email-quic_msinada@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 4 ----
- drivers/net/wireless/ath/ath11k/wmi.c | 3 ++-
- 2 files changed, 2 insertions(+), 5 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -5585,10 +5585,6 @@ static int ath11k_mac_copy_he_cap(struct
-
- he_cap_elem->mac_cap_info[1] &=
- IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK;
-- he_cap_elem->phy_cap_info[0] &=
-- ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
-- he_cap_elem->phy_cap_info[0] &=
-- ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G;
-
- he_cap_elem->phy_cap_info[5] &=
- ~IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK;
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -871,7 +871,8 @@ static void ath11k_wmi_put_wmi_channel(s
-
- chan->band_center_freq2 = arg->channel.band_center_freq1;
-
-- } else if (arg->channel.mode == MODE_11AC_VHT80_80) {
-+ } else if ((arg->channel.mode == MODE_11AC_VHT80_80) ||
-+ (arg->channel.mode == MODE_11AX_HE80_80)) {
- chan->band_center_freq2 = arg->channel.band_center_freq2;
- } else {
- chan->band_center_freq2 = 0;
+++ /dev/null
-From e2ceb1de2f83aafd8003f0b72dfd4b7441e97d14 Mon Sep 17 00:00:00 2001
-From: Maxime Bizon <mbizon@freebox.fr>
-Date: Fri, 21 Apr 2023 16:54:45 +0200
-Subject: [PATCH] wifi: ath11k: fix registration of 6Ghz-only phy without the
- full channel range
-
-Because of what seems to be a typo, a 6Ghz-only phy for which the BDF
-does not allow the 7115Mhz channel will fail to register:
-
- WARNING: CPU: 2 PID: 106 at net/wireless/core.c:907 wiphy_register+0x914/0x954
- Modules linked in: ath11k_pci sbsa_gwdt
- CPU: 2 PID: 106 Comm: kworker/u8:5 Not tainted 6.3.0-rc7-next-20230418-00549-g1e096a17625a-dirty #9
- Hardware name: Freebox V7R Board (DT)
- Workqueue: ath11k_qmi_driver_event ath11k_qmi_driver_event_work
- pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
- pc : wiphy_register+0x914/0x954
- lr : ieee80211_register_hw+0x67c/0xc10
- sp : ffffff800b123aa0
- x29: ffffff800b123aa0 x28: 0000000000000000 x27: 0000000000000000
- x26: 0000000000000000 x25: 0000000000000006 x24: ffffffc008d51418
- x23: ffffffc008cb0838 x22: ffffff80176c2460 x21: 0000000000000168
- x20: ffffff80176c0000 x19: ffffff80176c03e0 x18: 0000000000000014
- x17: 00000000cbef338c x16: 00000000d2a26f21 x15: 00000000ad6bb85f
- x14: 0000000000000020 x13: 0000000000000020 x12: 00000000ffffffbd
- x11: 0000000000000208 x10: 00000000fffffdf7 x9 : ffffffc009394718
- x8 : ffffff80176c0528 x7 : 000000007fffffff x6 : 0000000000000006
- x5 : 0000000000000005 x4 : ffffff800b304284 x3 : ffffff800b304284
- x2 : ffffff800b304d98 x1 : 0000000000000000 x0 : 0000000000000000
- Call trace:
- wiphy_register+0x914/0x954
- ieee80211_register_hw+0x67c/0xc10
- ath11k_mac_register+0x7c4/0xe10
- ath11k_core_qmi_firmware_ready+0x1f4/0x570
- ath11k_qmi_driver_event_work+0x198/0x590
- process_one_work+0x1b8/0x328
- worker_thread+0x6c/0x414
- kthread+0x100/0x104
- ret_from_fork+0x10/0x20
- ---[ end trace 0000000000000000 ]---
- ath11k_pci 0002:01:00.0: ieee80211 registration failed: -22
- ath11k_pci 0002:01:00.0: failed register the radio with mac80211: -22
- ath11k_pci 0002:01:00.0: failed to create pdev core: -22
-
-Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230421145445.2612280-1-mbizon@freebox.fr
----
- drivers/net/wireless/ath/ath11k/mac.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -8892,7 +8892,7 @@ static int ath11k_mac_setup_channels_rat
- }
-
- if (supported_bands & WMI_HOST_WLAN_5G_CAP) {
-- if (reg_cap->high_5ghz_chan >= ATH11K_MAX_6G_FREQ) {
-+ if (reg_cap->high_5ghz_chan >= ATH11K_MIN_6G_FREQ) {
- channels = kmemdup(ath11k_6ghz_channels,
- sizeof(ath11k_6ghz_channels), GFP_KERNEL);
- if (!channels) {
+++ /dev/null
-From 695df2f417d25202bdac9cde3c82d2acb6492b4d Mon Sep 17 00:00:00 2001
-From: Arnd Bergmann <arnd@arndb.de>
-Date: Fri, 5 May 2023 16:11:25 +0300
-Subject: [PATCH] wifi: ath: work around false-positive stringop-overread
- warning
-
-In a rare arm64 randconfig build, I got multiple warnings for ath11k
-and ath12k:
-
-In function 'ath11k_peer_assoc_h_ht',
- inlined from 'ath11k_peer_assoc_prepare' at drivers/net/wireless/ath/ath11k/mac.c:2665:2:
-drivers/net/wireless/ath/ath11k/mac.c:1709:13: error: 'ath11k_peer_assoc_h_ht_masked' reading 10 bytes from a region of size 0 [-Werror=stringop-overread]
- 1709 | if (ath11k_peer_assoc_h_ht_masked(ht_mcs_mask))
- | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This happens whenever gcc-13 fails to inline one of the functions
-that take a fixed-length array argument but gets passed a pointer.
-
-Change these functions to all take a regular pointer argument
-instead.
-
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230417205447.1800912-1-arnd@kernel.org
----
- drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -433,7 +433,7 @@ u8 ath11k_mac_bitrate_to_idx(const struc
- }
-
- static u32
--ath11k_mac_max_ht_nss(const u8 ht_mcs_mask[IEEE80211_HT_MCS_MASK_LEN])
-+ath11k_mac_max_ht_nss(const u8 *ht_mcs_mask)
- {
- int nss;
-
-@@ -445,7 +445,7 @@ ath11k_mac_max_ht_nss(const u8 ht_mcs_ma
- }
-
- static u32
--ath11k_mac_max_vht_nss(const u16 vht_mcs_mask[NL80211_VHT_NSS_MAX])
-+ath11k_mac_max_vht_nss(const u16 *vht_mcs_mask)
- {
- int nss;
-
-@@ -457,7 +457,7 @@ ath11k_mac_max_vht_nss(const u16 vht_mcs
- }
-
- static u32
--ath11k_mac_max_he_nss(const u16 he_mcs_mask[NL80211_HE_NSS_MAX])
-+ath11k_mac_max_he_nss(const u16 *he_mcs_mask)
- {
- int nss;
-
-@@ -1658,7 +1658,7 @@ static void ath11k_peer_assoc_h_rates(st
- }
-
- static bool
--ath11k_peer_assoc_h_ht_masked(const u8 ht_mcs_mask[IEEE80211_HT_MCS_MASK_LEN])
-+ath11k_peer_assoc_h_ht_masked(const u8 *ht_mcs_mask)
- {
- int nss;
-
-@@ -1670,7 +1670,7 @@ ath11k_peer_assoc_h_ht_masked(const u8 h
- }
-
- static bool
--ath11k_peer_assoc_h_vht_masked(const u16 vht_mcs_mask[])
-+ath11k_peer_assoc_h_vht_masked(const u16 *vht_mcs_mask)
- {
- int nss;
-
-@@ -2065,7 +2065,7 @@ static u16 ath11k_peer_assoc_h_he_limit(
- }
-
- static bool
--ath11k_peer_assoc_h_he_masked(const u16 he_mcs_mask[NL80211_HE_NSS_MAX])
-+ath11k_peer_assoc_h_he_masked(const u16 *he_mcs_mask)
- {
- int nss;
-
+++ /dev/null
-From a08dbb04d7365a04d52882143cf196005bfc88c3 Mon Sep 17 00:00:00 2001
-From: Aloka Dixit <quic_alokad@quicinc.com>
-Date: Fri, 5 May 2023 16:11:27 +0300
-Subject: [PATCH 71/77] wifi: ath11k: driver settings for MBSSID and EMA
-
-Advertise the driver support for multiple BSSID (MBSSID) and
-enhanced multi-BSSID advertisements (EMA) by setting extended
-capabilities.
-
-Configure mbssid_max_interfaces and ema_max_profile_periodicity
-fields in structure wiphy which are used to advertise maximum number
-of interfaces and profile periodicity supported by the driver.
-
-Add new WMI fields to configure maximum vdev count supported for
-MBSSID and profile periodicity in case of EMA.
-Setting WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET flag
-indicates that the firmware should track and update the DTIM counts
-for each non-transmitted profile.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
-Co-developed-by: John Crispin <john@phrozen.org>
-Signed-off-by: John Crispin <john@phrozen.org>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230405221648.17950-2-quic_alokad@quicinc.com
----
- drivers/net/wireless/ath/ath11k/hw.c | 3 +++
- drivers/net/wireless/ath/ath11k/hw.h | 1 +
- drivers/net/wireless/ath/ath11k/mac.c | 7 +++++++
- drivers/net/wireless/ath/ath11k/wmi.c | 3 +++
- drivers/net/wireless/ath/ath11k/wmi.h | 6 ++++++
- 5 files changed, 20 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/hw.c
-+++ b/drivers/net/wireless/ath/ath11k/hw.c
-@@ -202,6 +202,9 @@ static void ath11k_init_wmi_config_ipq80
- config->twt_ap_sta_count = 1000;
- config->flag1 |= WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64;
- config->flag1 |= WMI_RSRC_CFG_FLAG1_ACK_RSSI;
-+ config->ema_max_vap_cnt = ab->num_radios;
-+ config->ema_max_profile_period = TARGET_EMA_MAX_PROFILE_PERIOD;
-+ config->beacon_tx_offload_max_vdev += config->ema_max_vap_cnt;
- }
-
- static int ath11k_hw_mac_id_to_pdev_id_ipq8074(struct ath11k_hw_params *hw,
---- a/drivers/net/wireless/ath/ath11k/hw.h
-+++ b/drivers/net/wireless/ath/ath11k/hw.h
-@@ -64,6 +64,7 @@
- #define TARGET_NUM_WDS_ENTRIES 32
- #define TARGET_DMA_BURST_SIZE 1
- #define TARGET_RX_BATCHMODE 1
-+#define TARGET_EMA_MAX_PROFILE_PERIOD 8
-
- #define ATH11K_HW_MAX_QUEUES 4
- #define ATH11K_QUEUE_LEN 4096
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -9001,19 +9001,23 @@ static int ath11k_mac_setup_iface_combin
-
- static const u8 ath11k_if_types_ext_capa[] = {
- [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
-+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
- [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
- };
-
- static const u8 ath11k_if_types_ext_capa_sta[] = {
- [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
-+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
- [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
- [9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT,
- };
-
- static const u8 ath11k_if_types_ext_capa_ap[] = {
- [0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
-+ [2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
- [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
- [9] = WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT,
-+ [10] = WLAN_EXT_CAPA11_EMA_SUPPORT,
- };
-
- static const struct wiphy_iftype_ext_capab ath11k_iftypes_ext_capa[] = {
-@@ -9251,6 +9255,9 @@ static int __ath11k_mac_register(struct
- wiphy_ext_feature_set(ar->hw->wiphy,
- NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
-
-+ ar->hw->wiphy->mbssid_max_interfaces = TARGET_NUM_VDEVS(ab);
-+ ar->hw->wiphy->ema_max_profile_periodicity = TARGET_EMA_MAX_PROFILE_PERIOD;
-+
- ath11k_reg_init(ar);
-
- if (!test_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags)) {
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -3987,6 +3987,9 @@ ath11k_wmi_copy_resource_config(struct w
- ~(1 << WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT);
- wmi_cfg->host_service_flags |= (tg_cfg->is_reg_cc_ext_event_supported <<
- WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT);
-+ wmi_cfg->flags2 = WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET;
-+ wmi_cfg->ema_max_vap_cnt = tg_cfg->ema_max_vap_cnt;
-+ wmi_cfg->ema_max_profile_period = tg_cfg->ema_max_profile_period;
- }
-
- static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -2317,6 +2317,7 @@ struct wmi_init_cmd {
- } __packed;
-
- #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 BIT(5)
-+#define WMI_RSRC_CFG_FLAG2_CALC_NEXT_DTIM_COUNT_SET BIT(9)
- #define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18)
-
- #define WMI_CFG_HOST_SERVICE_FLAG_REG_CC_EXT 4
-@@ -2389,6 +2390,9 @@ struct wmi_resource_config {
- u32 msdu_flow_override_config1;
- u32 flags2;
- u32 host_service_flags;
-+ u32 max_rnr_neighbours;
-+ u32 ema_max_vap_cnt;
-+ u32 ema_max_profile_period;
- } __packed;
-
- struct wmi_service_ready_event {
-@@ -5646,6 +5650,8 @@ struct target_resource_config {
- u32 twt_ap_pdev_count;
- u32 twt_ap_sta_count;
- u8 is_reg_cc_ext_event_supported;
-+ u32 ema_max_vap_cnt;
-+ u32 ema_max_profile_period;
- };
-
- enum wmi_debug_log_param {
+++ /dev/null
-From 5a81610acf66c4ad6e1a1fbd09f3f555fca863b1 Mon Sep 17 00:00:00 2001
-From: Aloka Dixit <quic_alokad@quicinc.com>
-Date: Fri, 5 May 2023 16:11:27 +0300
-Subject: [PATCH 72/77] wifi: ath11k: MBSSID configuration during vdev
- create/start
-
-Configure multiple BSSID flags and index of the transmitting interface
-in vdev create/start commands depending on the service bit
-WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
-Co-developed-by: John Crispin <john@phrozen.org>
-Signed-off-by: John Crispin <john@phrozen.org>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230405221648.17950-3-quic_alokad@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 70 +++++++++++++++++++++++++--
- drivers/net/wireless/ath/ath11k/wmi.c | 5 ++
- drivers/net/wireless/ath/ath11k/wmi.h | 19 ++++++++
- 3 files changed, 90 insertions(+), 4 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -6181,17 +6181,62 @@ static void ath11k_mac_op_stop(struct ie
- atomic_set(&ar->num_pending_mgmt_tx, 0);
- }
-
--static void
--ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif,
-- struct vdev_create_params *params)
-+static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif,
-+ u32 *flags, u32 *tx_vdev_id)
-+{
-+ struct ath11k *ar = arvif->ar;
-+ struct ath11k_vif *tx_arvif;
-+ struct ieee80211_vif *tx_vif;
-+
-+ *tx_vdev_id = 0;
-+ tx_vif = arvif->vif->mbssid_tx_vif;
-+ if (!tx_vif) {
-+ *flags = WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP;
-+ return 0;
-+ }
-+
-+ tx_arvif = (void *)tx_vif->drv_priv;
-+
-+ if (arvif->vif->bss_conf.nontransmitted) {
-+ if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
-+ return -EINVAL;
-+
-+ *flags = WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP;
-+ *tx_vdev_id = ath11k_vif_to_arvif(tx_vif)->vdev_id;
-+ } else if (tx_arvif == arvif) {
-+ *flags = WMI_HOST_VDEV_FLAGS_TRANSMIT_AP;
-+ } else {
-+ return -EINVAL;
-+ }
-+
-+ if (arvif->vif->bss_conf.ema_ap)
-+ *flags |= WMI_HOST_VDEV_FLAGS_EMA_MODE;
-+
-+ return 0;
-+}
-+
-+static int ath11k_mac_setup_vdev_create_params(struct ath11k_vif *arvif,
-+ struct vdev_create_params *params)
- {
- struct ath11k *ar = arvif->ar;
- struct ath11k_pdev *pdev = ar->pdev;
-+ int ret;
-
- params->if_id = arvif->vdev_id;
- params->type = arvif->vdev_type;
- params->subtype = arvif->vdev_subtype;
- params->pdev_id = pdev->pdev_id;
-+ params->mbssid_flags = 0;
-+ params->mbssid_tx_vdev_id = 0;
-+
-+ if (!test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT,
-+ ar->ab->wmi_ab.svc_map)) {
-+ ret = ath11k_mac_setup_vdev_params_mbssid(arvif,
-+ ¶ms->mbssid_flags,
-+ ¶ms->mbssid_tx_vdev_id);
-+ if (ret)
-+ return ret;
-+ }
-
- if (pdev->cap.supported_bands & WMI_HOST_WLAN_2G_CAP) {
- params->chains[NL80211_BAND_2GHZ].tx = ar->num_tx_chains;
-@@ -6206,6 +6251,7 @@ ath11k_mac_setup_vdev_create_params(stru
- params->chains[NL80211_BAND_6GHZ].tx = ar->num_tx_chains;
- params->chains[NL80211_BAND_6GHZ].rx = ar->num_rx_chains;
- }
-+ return 0;
- }
-
- static void ath11k_mac_op_update_vif_offload(struct ieee80211_hw *hw,
-@@ -6500,7 +6546,12 @@ static int ath11k_mac_op_add_interface(s
- for (i = 0; i < ARRAY_SIZE(vif->hw_queue); i++)
- vif->hw_queue[i] = i % (ATH11K_HW_MAX_QUEUES - 1);
-
-- ath11k_mac_setup_vdev_create_params(arvif, &vdev_param);
-+ ret = ath11k_mac_setup_vdev_create_params(arvif, &vdev_param);
-+ if (ret) {
-+ ath11k_warn(ab, "failed to create vdev parameters %d: %d\n",
-+ arvif->vdev_id, ret);
-+ goto err;
-+ }
-
- ret = ath11k_wmi_vdev_create(ar, vif->addr, &vdev_param);
- if (ret) {
-@@ -6905,6 +6956,17 @@ ath11k_mac_vdev_start_restart(struct ath
- arg.pref_tx_streams = ar->num_tx_chains;
- arg.pref_rx_streams = ar->num_rx_chains;
-
-+ arg.mbssid_flags = 0;
-+ arg.mbssid_tx_vdev_id = 0;
-+ if (test_bit(WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT,
-+ ar->ab->wmi_ab.svc_map)) {
-+ ret = ath11k_mac_setup_vdev_params_mbssid(arvif,
-+ &arg.mbssid_flags,
-+ &arg.mbssid_tx_vdev_id);
-+ if (ret)
-+ return ret;
-+ }
-+
- if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
- arg.ssid = arvif->u.ap.ssid;
- arg.ssid_len = arvif->u.ap.ssid_len;
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -724,6 +724,9 @@ int ath11k_wmi_vdev_create(struct ath11k
- cmd->vdev_subtype = param->subtype;
- cmd->num_cfg_txrx_streams = WMI_NUM_SUPPORTED_BAND_MAX;
- cmd->pdev_id = param->pdev_id;
-+ cmd->mbssid_flags = param->mbssid_flags;
-+ cmd->mbssid_tx_vdev_id = param->mbssid_tx_vdev_id;
-+
- ether_addr_copy(cmd->vdev_macaddr.addr, macaddr);
-
- ptr = skb->data + sizeof(*cmd);
-@@ -941,6 +944,8 @@ int ath11k_wmi_vdev_start(struct ath11k
- cmd->cac_duration_ms = arg->cac_duration_ms;
- cmd->regdomain = arg->regdomain;
- cmd->he_ops = arg->he_ops;
-+ cmd->mbssid_flags = arg->mbssid_flags;
-+ cmd->mbssid_tx_vdev_id = arg->mbssid_tx_vdev_id;
-
- if (!restart) {
- if (arg->ssid) {
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -137,6 +137,14 @@ enum {
- WMI_AUTORATE_3200NS_GI = BIT(11),
- };
-
-+enum {
-+ WMI_HOST_VDEV_FLAGS_NON_MBSSID_AP = 0x00000001,
-+ WMI_HOST_VDEV_FLAGS_TRANSMIT_AP = 0x00000002,
-+ WMI_HOST_VDEV_FLAGS_NON_TRANSMIT_AP = 0x00000004,
-+ WMI_HOST_VDEV_FLAGS_EMA_MODE = 0x00000008,
-+ WMI_HOST_VDEV_FLAGS_SCAN_MODE_VAP = 0x00000010,
-+};
-+
- /*
- * wmi command groups.
- */
-@@ -2096,6 +2104,7 @@ enum wmi_tlv_service {
- WMI_TLV_SERVICE_EXT2_MSG = 220,
- WMI_TLV_SERVICE_PEER_POWER_SAVE_DURATION_SUPPORT = 246,
- WMI_TLV_SERVICE_SRG_SRP_SPATIAL_REUSE_SUPPORT = 249,
-+ WMI_TLV_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT = 253,
- WMI_TLV_SERVICE_PASSIVE_SCAN_START_TIME_ENHANCE = 263,
-
- /* The second 128 bits */
-@@ -2583,6 +2592,8 @@ struct vdev_create_params {
- u8 rx;
- } chains[NUM_NL80211_BANDS];
- u32 pdev_id;
-+ u32 mbssid_flags;
-+ u32 mbssid_tx_vdev_id;
- };
-
- struct wmi_vdev_create_cmd {
-@@ -2593,6 +2604,8 @@ struct wmi_vdev_create_cmd {
- struct wmi_mac_addr vdev_macaddr;
- u32 num_cfg_txrx_streams;
- u32 pdev_id;
-+ u32 mbssid_flags;
-+ u32 mbssid_tx_vdev_id;
- } __packed;
-
- struct wmi_vdev_txrx_streams {
-@@ -2656,6 +2669,9 @@ struct wmi_vdev_start_request_cmd {
- u32 he_ops;
- u32 cac_duration_ms;
- u32 regdomain;
-+ u32 min_data_rate;
-+ u32 mbssid_flags;
-+ u32 mbssid_tx_vdev_id;
- } __packed;
-
- #define MGMT_TX_DL_FRM_LEN 64
-@@ -2825,6 +2841,9 @@ struct wmi_vdev_start_req_arg {
- u32 pref_rx_streams;
- u32 pref_tx_streams;
- u32 num_noa_descriptors;
-+ u32 min_data_rate;
-+ u32 mbssid_flags;
-+ u32 mbssid_tx_vdev_id;
- };
-
- struct peer_create_params {
+++ /dev/null
-From cf604e72bc6e6db68c7fcaa8779b03ec14b8d2fa Mon Sep 17 00:00:00 2001
-From: Aloka Dixit <quic_alokad@quicinc.com>
-Date: Fri, 5 May 2023 16:11:27 +0300
-Subject: [PATCH 73/77] wifi: ath11k: rename MBSSID fields in wmi_vdev_up_cmd
-
-Rename trans_bssid to tx_vdev_bssid to make it similar to vdev_bssid.
-
-Rename profile_num to nontx_profile_cnt, and profile_idx to
-nontx_profile_idx which makes it clear that these store configurations
-related to MBSSID non-transmitting profiles.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230405221648.17950-4-quic_alokad@quicinc.com
----
- drivers/net/wireless/ath/ath11k/wmi.c | 6 +++---
- drivers/net/wireless/ath/ath11k/wmi.h | 6 +++---
- 2 files changed, 6 insertions(+), 6 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -1029,10 +1029,10 @@ int ath11k_wmi_vdev_up(struct ath11k *ar
- bss_conf = &arvif->vif->bss_conf;
-
- if (bss_conf->nontransmitted) {
-- ether_addr_copy(cmd->trans_bssid.addr,
-+ ether_addr_copy(cmd->tx_vdev_bssid.addr,
- bss_conf->transmitter_bssid);
-- cmd->profile_idx = bss_conf->bssid_index;
-- cmd->profile_num = bss_conf->bssid_indicator;
-+ cmd->nontx_profile_idx = bss_conf->bssid_index;
-+ cmd->nontx_profile_cnt = bss_conf->bssid_indicator;
- }
- }
-
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -2625,9 +2625,9 @@ struct wmi_vdev_up_cmd {
- u32 vdev_id;
- u32 vdev_assoc_id;
- struct wmi_mac_addr vdev_bssid;
-- struct wmi_mac_addr trans_bssid;
-- u32 profile_idx;
-- u32 profile_num;
-+ struct wmi_mac_addr tx_vdev_bssid;
-+ u32 nontx_profile_idx;
-+ u32 nontx_profile_cnt;
- } __packed;
-
- struct wmi_vdev_stop_cmd {
+++ /dev/null
-From c82dc33f252fd8883be66f2d0230af0fd734c683 Mon Sep 17 00:00:00 2001
-From: Aloka Dixit <quic_alokad@quicinc.com>
-Date: Fri, 5 May 2023 16:11:27 +0300
-Subject: [PATCH 74/77] wifi: ath11k: MBSSID parameter configuration in AP mode
-
-Include MBSSID parameters in WMI vdev up operation.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
-Co-developed-by: John Crispin <john@phrozen.org>
-Signed-off-by: John Crispin <john@phrozen.org>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230405221648.17950-5-quic_alokad@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 29 +++++++++++++++++++++------
- drivers/net/wireless/ath/ath11k/wmi.c | 8 +++++++-
- drivers/net/wireless/ath/ath11k/wmi.h | 3 ++-
- 3 files changed, 32 insertions(+), 8 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -964,7 +964,7 @@ static int ath11k_mac_monitor_vdev_start
- return ret;
- }
-
-- ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr);
-+ ret = ath11k_wmi_vdev_up(ar, vdev_id, 0, ar->mac_addr, NULL, 0, 0);
- if (ret) {
- ath11k_warn(ar->ab, "failed to put up monitor vdev %i: %d\n",
- vdev_id, ret);
-@@ -1423,6 +1423,7 @@ static void ath11k_control_beaconing(str
- struct ieee80211_bss_conf *info)
- {
- struct ath11k *ar = arvif->ar;
-+ struct ath11k_vif *tx_arvif = NULL;
- int ret = 0;
-
- lockdep_assert_held(&arvif->ar->conf_mutex);
-@@ -1451,8 +1452,14 @@ static void ath11k_control_beaconing(str
-
- ether_addr_copy(arvif->bssid, info->bssid);
-
-+ if (arvif->vif->mbssid_tx_vif)
-+ tx_arvif = (struct ath11k_vif *)arvif->vif->mbssid_tx_vif->drv_priv;
-+
- ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
-- arvif->bssid);
-+ arvif->bssid,
-+ tx_arvif ? tx_arvif->bssid : NULL,
-+ info->bssid_index,
-+ 1 << info->bssid_indicator);
- if (ret) {
- ath11k_warn(ar->ab, "failed to bring up vdev %d: %i\n",
- arvif->vdev_id, ret);
-@@ -2879,7 +2886,8 @@ static void ath11k_bss_assoc(struct ieee
- arvif->aid = vif->cfg.aid;
- ether_addr_copy(arvif->bssid, bss_conf->bssid);
-
-- ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid);
-+ ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, arvif->aid, arvif->bssid,
-+ NULL, 0, 0);
- if (ret) {
- ath11k_warn(ar->ab, "failed to set vdev %d up: %d\n",
- arvif->vdev_id, ret);
-@@ -7133,7 +7141,8 @@ ath11k_mac_update_vif_chan(struct ath11k
- int n_vifs)
- {
- struct ath11k_base *ab = ar->ab;
-- struct ath11k_vif *arvif;
-+ struct ath11k_vif *arvif, *tx_arvif = NULL;
-+ struct ieee80211_vif *mbssid_tx_vif;
- int ret;
- int i;
- bool monitor_vif = false;
-@@ -7187,8 +7196,15 @@ ath11k_mac_update_vif_chan(struct ath11k
- ath11k_warn(ab, "failed to update bcn tmpl during csa: %d\n",
- ret);
-
-+ mbssid_tx_vif = arvif->vif->mbssid_tx_vif;
-+ if (mbssid_tx_vif)
-+ tx_arvif = (struct ath11k_vif *)mbssid_tx_vif->drv_priv;
-+
- ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
-- arvif->bssid);
-+ arvif->bssid,
-+ tx_arvif ? tx_arvif->bssid : NULL,
-+ arvif->vif->bss_conf.bssid_index,
-+ 1 << arvif->vif->bss_conf.bssid_indicator);
- if (ret) {
- ath11k_warn(ab, "failed to bring vdev up %d: %d\n",
- arvif->vdev_id, ret);
-@@ -7306,7 +7322,8 @@ static int ath11k_start_vdev_delay(struc
- }
-
- if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
-- ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr);
-+ ret = ath11k_wmi_vdev_up(ar, arvif->vdev_id, 0, ar->mac_addr,
-+ NULL, 0, 0);
- if (ret) {
- ath11k_warn(ab, "failed put monitor up: %d\n", ret);
- return ret;
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -1001,7 +1001,8 @@ int ath11k_wmi_vdev_start(struct ath11k
- return ret;
- }
-
--int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, const u8 *bssid)
-+int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, const u8 *bssid,
-+ u8 *tx_bssid, u32 nontx_profile_idx, u32 nontx_profile_cnt)
- {
- struct ath11k_pdev_wmi *wmi = ar->wmi;
- struct wmi_vdev_up_cmd *cmd;
-@@ -1025,6 +1026,11 @@ int ath11k_wmi_vdev_up(struct ath11k *ar
-
- ether_addr_copy(cmd->vdev_bssid.addr, bssid);
-
-+ cmd->nontx_profile_idx = nontx_profile_idx;
-+ cmd->nontx_profile_cnt = nontx_profile_cnt;
-+ if (tx_bssid)
-+ ether_addr_copy(cmd->tx_vdev_bssid.addr, tx_bssid);
-+
- if (arvif && arvif->vif->type == NL80211_IFTYPE_STATION) {
- bss_conf = &arvif->vif->bss_conf;
-
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -6301,7 +6301,8 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a
- struct sk_buff *bcn);
- int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id);
- int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid,
-- const u8 *bssid);
-+ const u8 *bssid, u8 *tx_bssid, u32 nontx_profile_idx,
-+ u32 nontx_profile_cnt);
- int ath11k_wmi_vdev_stop(struct ath11k *ar, u8 vdev_id);
- int ath11k_wmi_vdev_start(struct ath11k *ar, struct wmi_vdev_start_req_arg *arg,
- bool restart);
+++ /dev/null
-From cb9bea773c85e372931cd7a177db4165adf29d95 Mon Sep 17 00:00:00 2001
-From: Aloka Dixit <quic_alokad@quicinc.com>
-Date: Fri, 5 May 2023 16:11:28 +0300
-Subject: [PATCH 75/77] wifi: ath11k: refactor vif parameter configurations
-
-Security parameters for each non-transmitting profile can be
-different when MBSSID is enabled and this information is included
-in the MBSSID element in the Beacon frame. Current implementation
-to set rsnie_present and wpaie_present does not parse this element
-hence it applies only to the transmitting interface.
-
-Move the code to a separate function to make additions for
-non-transmitting interfaces cleaner.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230405221648.17950-6-quic_alokad@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 41 ++++++++++++++++-----------
- 1 file changed, 24 insertions(+), 17 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -1351,28 +1351,14 @@ err_mon_del:
- return ret;
- }
-
--static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
-+static void ath11k_mac_set_vif_params(struct ath11k_vif *arvif,
-+ struct sk_buff *bcn)
- {
-- struct ath11k *ar = arvif->ar;
-- struct ath11k_base *ab = ar->ab;
-- struct ieee80211_hw *hw = ar->hw;
-- struct ieee80211_vif *vif = arvif->vif;
-- struct ieee80211_mutable_offsets offs = {};
-- struct sk_buff *bcn;
- struct ieee80211_mgmt *mgmt;
- u8 *ies;
-- int ret;
--
-- if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
-- return 0;
--
-- bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0);
-- if (!bcn) {
-- ath11k_warn(ab, "failed to get beacon template from mac80211\n");
-- return -EPERM;
-- }
-
- ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn);
-+ mgmt = (struct ieee80211_mgmt *)bcn->data;
- ies += sizeof(mgmt->u.beacon);
-
- if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies)))
-@@ -1386,7 +1372,28 @@ static int ath11k_mac_setup_bcn_tmpl(str
- arvif->wpaie_present = true;
- else
- arvif->wpaie_present = false;
-+}
-+
-+static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
-+{
-+ struct ath11k *ar = arvif->ar;
-+ struct ath11k_base *ab = ar->ab;
-+ struct ieee80211_hw *hw = ar->hw;
-+ struct ieee80211_vif *vif = arvif->vif;
-+ struct ieee80211_mutable_offsets offs = {};
-+ struct sk_buff *bcn;
-+ int ret;
-+
-+ if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
-+ return 0;
-+
-+ bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0);
-+ if (!bcn) {
-+ ath11k_warn(ab, "failed to get beacon template from mac80211\n");
-+ return -EPERM;
-+ }
-
-+ ath11k_mac_set_vif_params(arvif, bcn);
- ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn);
-
- kfree_skb(bcn);
+++ /dev/null
-From 335a92765d308dfe22826f5562cd4b4389b45e71 Mon Sep 17 00:00:00 2001
-From: Aloka Dixit <quic_alokad@quicinc.com>
-Date: Fri, 5 May 2023 16:11:28 +0300
-Subject: [PATCH 76/77] wifi: ath11k: MBSSID beacon support
-
-- Split ath11k_mac_setup_bcn_tmpl() to move the beacon retrieval and
- WMI command to a new function, ath11k_mac_setup_bcn_tmpl_legacy().
- In the original function add checks to use the transmitting interface
- when MBSSID is enabled.
-- Set rsnie_present and wpaie_present fields for the non-transmitting
- interfaces when MBSSID is enabled.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
-Co-developed-by: John Crispin <john@phrozen.org>
-Signed-off-by: John Crispin <john@phrozen.org>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230405221648.17950-7-quic_alokad@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 116 ++++++++++++++++++++++++--
- drivers/net/wireless/ath/ath11k/wmi.c | 1 +
- 2 files changed, 112 insertions(+), 5 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -1351,6 +1351,84 @@ err_mon_del:
- return ret;
- }
-
-+static void ath11k_mac_setup_nontx_vif_rsnie(struct ath11k_vif *arvif,
-+ bool tx_arvif_rsnie_present,
-+ const u8 *profile, u8 profile_len)
-+{
-+ if (cfg80211_find_ie(WLAN_EID_RSN, profile, profile_len)) {
-+ arvif->rsnie_present = true;
-+ } else if (tx_arvif_rsnie_present) {
-+ int i;
-+ u8 nie_len;
-+ const u8 *nie = cfg80211_find_ext_ie(WLAN_EID_EXT_NON_INHERITANCE,
-+ profile, profile_len);
-+ if (!nie)
-+ return;
-+
-+ nie_len = nie[1];
-+ nie += 2;
-+ for (i = 0; i < nie_len; i++) {
-+ if (nie[i] == WLAN_EID_RSN) {
-+ arvif->rsnie_present = false;
-+ break;
-+ }
-+ }
-+ }
-+}
-+
-+static bool ath11k_mac_set_nontx_vif_params(struct ath11k_vif *tx_arvif,
-+ struct ath11k_vif *arvif,
-+ struct sk_buff *bcn)
-+{
-+ struct ieee80211_mgmt *mgmt;
-+ const u8 *ies, *profile, *next_profile;
-+ int ies_len;
-+
-+ ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn);
-+ mgmt = (struct ieee80211_mgmt *)bcn->data;
-+ ies += sizeof(mgmt->u.beacon);
-+ ies_len = skb_tail_pointer(bcn) - ies;
-+
-+ ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ies, ies_len);
-+ arvif->rsnie_present = tx_arvif->rsnie_present;
-+
-+ while (ies) {
-+ u8 mbssid_len;
-+
-+ ies_len -= (2 + ies[1]);
-+ mbssid_len = ies[1] - 1;
-+ profile = &ies[3];
-+
-+ while (mbssid_len) {
-+ u8 profile_len;
-+
-+ profile_len = profile[1];
-+ next_profile = profile + (2 + profile_len);
-+ mbssid_len -= (2 + profile_len);
-+
-+ profile += 2;
-+ profile_len -= (2 + profile[1]);
-+ profile += (2 + profile[1]); /* nontx capabilities */
-+ profile_len -= (2 + profile[1]);
-+ profile += (2 + profile[1]); /* SSID */
-+ if (profile[2] == arvif->vif->bss_conf.bssid_index) {
-+ profile_len -= 5;
-+ profile = profile + 5;
-+ ath11k_mac_setup_nontx_vif_rsnie(arvif,
-+ tx_arvif->rsnie_present,
-+ profile,
-+ profile_len);
-+ return true;
-+ }
-+ profile = next_profile;
-+ }
-+ ies = cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, profile,
-+ ies_len);
-+ }
-+
-+ return false;
-+}
-+
- static void ath11k_mac_set_vif_params(struct ath11k_vif *arvif,
- struct sk_buff *bcn)
- {
-@@ -1374,18 +1452,26 @@ static void ath11k_mac_set_vif_params(st
- arvif->wpaie_present = false;
- }
-
--static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
-+static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif)
- {
- struct ath11k *ar = arvif->ar;
- struct ath11k_base *ab = ar->ab;
-+ struct ath11k_vif *tx_arvif = arvif;
- struct ieee80211_hw *hw = ar->hw;
- struct ieee80211_vif *vif = arvif->vif;
- struct ieee80211_mutable_offsets offs = {};
- struct sk_buff *bcn;
- int ret;
-
-- if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
-- return 0;
-+ if (arvif->vif->mbssid_tx_vif) {
-+ tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv;
-+ if (tx_arvif != arvif) {
-+ ar = tx_arvif->ar;
-+ ab = ar->ab;
-+ hw = ar->hw;
-+ vif = tx_arvif->vif;
-+ }
-+ }
-
- bcn = ieee80211_beacon_get_template(hw, vif, &offs, 0);
- if (!bcn) {
-@@ -1393,9 +1479,12 @@ static int ath11k_mac_setup_bcn_tmpl(str
- return -EPERM;
- }
-
-- ath11k_mac_set_vif_params(arvif, bcn);
-- ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn);
-+ if (tx_arvif == arvif)
-+ ath11k_mac_set_vif_params(tx_arvif, bcn);
-+ else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn))
-+ return -EINVAL;
-
-+ ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn);
- kfree_skb(bcn);
-
- if (ret)
-@@ -1405,6 +1494,23 @@ static int ath11k_mac_setup_bcn_tmpl(str
- return ret;
- }
-
-+static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif)
-+{
-+ struct ieee80211_vif *vif = arvif->vif;
-+
-+ if (arvif->vdev_type != WMI_VDEV_TYPE_AP)
-+ return 0;
-+
-+ /* Target does not expect beacon templates for the already up
-+ * non-transmitting interfaces, and results in a crash if sent.
-+ */
-+ if (vif->mbssid_tx_vif &&
-+ arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up)
-+ return 0;
-+
-+ return ath11k_mac_setup_bcn_tmpl_mbssid(arvif);
-+}
-+
- void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif)
- {
- struct ieee80211_vif *vif = arvif->vif;
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -1737,6 +1737,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a
- }
-
- cmd->buf_len = bcn->len;
-+ cmd->mbssid_ie_offset = offs->mbssid_off;
-
- ptr = skb->data + sizeof(*cmd);
-
+++ /dev/null
-From 87bd401138161008fdb82fbca6e213af117bfeb9 Mon Sep 17 00:00:00 2001
-From: Aloka Dixit <quic_alokad@quicinc.com>
-Date: Fri, 5 May 2023 16:11:28 +0300
-Subject: [PATCH 77/77] wifi: ath11k: EMA beacon support
-
-Add new function ath11k_mac_setup_bcn_tmpl_ema() which invokes the new
-API provided by MAC80211 to retrieve EMA beacons.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
-Co-developed-by: John Crispin <john@phrozen.org>
-Signed-off-by: John Crispin <john@phrozen.org>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230405221648.17950-8-quic_alokad@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 59 ++++++++++++++++++++++++++-
- drivers/net/wireless/ath/ath11k/wmi.c | 3 +-
- drivers/net/wireless/ath/ath11k/wmi.h | 11 ++++-
- 3 files changed, 70 insertions(+), 3 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -1452,6 +1452,60 @@ static void ath11k_mac_set_vif_params(st
- arvif->wpaie_present = false;
- }
-
-+static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif)
-+{
-+ struct ath11k_vif *tx_arvif;
-+ struct ieee80211_ema_beacons *beacons;
-+ int ret = 0;
-+ bool nontx_vif_params_set = false;
-+ u32 params = 0;
-+ u8 i = 0;
-+
-+ tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv;
-+
-+ beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
-+ tx_arvif->vif, 0);
-+ if (!beacons || !beacons->cnt) {
-+ ath11k_warn(arvif->ar->ab,
-+ "failed to get ema beacon templates from mac80211\n");
-+ return -EPERM;
-+ }
-+
-+ if (tx_arvif == arvif)
-+ ath11k_mac_set_vif_params(tx_arvif, beacons->bcn[0].skb);
-+ else
-+ arvif->wpaie_present = tx_arvif->wpaie_present;
-+
-+ for (i = 0; i < beacons->cnt; i++) {
-+ if (tx_arvif != arvif && !nontx_vif_params_set)
-+ nontx_vif_params_set =
-+ ath11k_mac_set_nontx_vif_params(tx_arvif, arvif,
-+ beacons->bcn[i].skb);
-+
-+ params = beacons->cnt;
-+ params |= (i << WMI_EMA_TMPL_IDX_SHIFT);
-+ params |= ((!i ? 1 : 0) << WMI_EMA_FIRST_TMPL_SHIFT);
-+ params |= ((i + 1 == beacons->cnt ? 1 : 0) << WMI_EMA_LAST_TMPL_SHIFT);
-+
-+ ret = ath11k_wmi_bcn_tmpl(tx_arvif->ar, tx_arvif->vdev_id,
-+ &beacons->bcn[i].offs,
-+ beacons->bcn[i].skb, params);
-+ if (ret) {
-+ ath11k_warn(tx_arvif->ar->ab,
-+ "failed to set ema beacon template id %i error %d\n",
-+ i, ret);
-+ break;
-+ }
-+ }
-+
-+ ieee80211_beacon_free_ema_list(beacons);
-+
-+ if (tx_arvif != arvif && !nontx_vif_params_set)
-+ return -EINVAL; /* Profile not found in the beacons */
-+
-+ return ret;
-+}
-+
- static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif)
- {
- struct ath11k *ar = arvif->ar;
-@@ -1484,7 +1538,7 @@ static int ath11k_mac_setup_bcn_tmpl_mbs
- else if (!ath11k_mac_set_nontx_vif_params(tx_arvif, arvif, bcn))
- return -EINVAL;
-
-- ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn);
-+ ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn, 0);
- kfree_skb(bcn);
-
- if (ret)
-@@ -1508,6 +1562,9 @@ static int ath11k_mac_setup_bcn_tmpl(str
- arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up)
- return 0;
-
-+ if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif)
-+ return ath11k_mac_setup_bcn_tmpl_ema(arvif);
-+
- return ath11k_mac_setup_bcn_tmpl_mbssid(arvif);
- }
-
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -1699,7 +1699,7 @@ int ath11k_wmi_send_bcn_offload_control_
-
- int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id,
- struct ieee80211_mutable_offsets *offs,
-- struct sk_buff *bcn)
-+ struct sk_buff *bcn, u32 ema_params)
- {
- struct ath11k_pdev_wmi *wmi = ar->wmi;
- struct wmi_bcn_tmpl_cmd *cmd;
-@@ -1738,6 +1738,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *a
-
- cmd->buf_len = bcn->len;
- cmd->mbssid_ie_offset = offs->mbssid_off;
-+ cmd->ema_params = ema_params;
-
- ptr = skb->data + sizeof(*cmd);
-
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -3566,6 +3566,10 @@ struct wmi_get_pdev_temperature_cmd {
-
- #define WMI_BEACON_TX_BUFFER_SIZE 512
-
-+#define WMI_EMA_TMPL_IDX_SHIFT 8
-+#define WMI_EMA_FIRST_TMPL_SHIFT 16
-+#define WMI_EMA_LAST_TMPL_SHIFT 24
-+
- struct wmi_bcn_tmpl_cmd {
- u32 tlv_header;
- u32 vdev_id;
-@@ -3576,6 +3580,11 @@ struct wmi_bcn_tmpl_cmd {
- u32 csa_event_bitmap;
- u32 mbssid_ie_offset;
- u32 esp_ie_offset;
-+ u32 csc_switch_count_offset;
-+ u32 csc_event_bitmap;
-+ u32 mu_edca_ie_offset;
-+ u32 feature_enable_bitmap;
-+ u32 ema_params;
- } __packed;
-
- struct wmi_key_seq_counter {
-@@ -6298,7 +6307,7 @@ int ath11k_wmi_mgmt_send(struct ath11k *
- struct sk_buff *frame);
- int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id,
- struct ieee80211_mutable_offsets *offs,
-- struct sk_buff *bcn);
-+ struct sk_buff *bcn, u32 ema_param);
- int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id);
- int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid,
- const u8 *bssid, u8 *tx_bssid, u32 nontx_profile_idx,
+++ /dev/null
-From 570eec3d40505c30babbe3b8f85a38496c975ab2 Mon Sep 17 00:00:00 2001
-From: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
-Date: Tue, 9 May 2023 20:07:23 +0300
-Subject: [PATCH] wifi: ath11k: Relocate the func
- ath11k_mac_bitrate_mask_num_ht_rates() and change hweight16 to hweight8
-
-Relocate the function ath11k_mac_bitrate_mask_num_ht_rates() definition
-to call this function from other functions which helps to avoid the
-compilation error (function not defined).
-
-ht_mcs[] is 1 byte array and it is enough to use hweight8() instead
-of hweight16(). Hence, fixed the same.
-
-Tested on: Compile tested only.
-
-Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230504092033.3542456-2-quic_mkenna@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 30 +++++++++++++--------------
- 1 file changed, 15 insertions(+), 15 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -1,7 +1,7 @@
- // SPDX-License-Identifier: BSD-3-Clause-Clear
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
-+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #include <net/mac80211.h>
-@@ -4338,6 +4338,20 @@ exit:
- }
-
- static int
-+ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar,
-+ enum nl80211_band band,
-+ const struct cfg80211_bitrate_mask *mask)
-+{
-+ int num_rates = 0;
-+ int i;
-+
-+ for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++)
-+ num_rates += hweight8(mask->control[band].ht_mcs[i]);
-+
-+ return num_rates;
-+}
-+
-+static int
- ath11k_mac_bitrate_mask_num_vht_rates(struct ath11k *ar,
- enum nl80211_band band,
- const struct cfg80211_bitrate_mask *mask)
-@@ -7791,20 +7805,6 @@ static void ath11k_mac_op_flush(struct i
- ath11k_mac_flush_tx_complete(ar);
- }
-
--static int
--ath11k_mac_bitrate_mask_num_ht_rates(struct ath11k *ar,
-- enum nl80211_band band,
-- const struct cfg80211_bitrate_mask *mask)
--{
-- int num_rates = 0;
-- int i;
--
-- for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++)
-- num_rates += hweight16(mask->control[band].ht_mcs[i]);
--
-- return num_rates;
--}
--
- static bool
- ath11k_mac_has_single_legacy_rate(struct ath11k *ar,
- enum nl80211_band band,
+++ /dev/null
-From df8e3729ffc0aa645839693f74ee7b6d999cdf64 Mon Sep 17 00:00:00 2001
-From: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
-Date: Tue, 9 May 2023 20:07:24 +0300
-Subject: [PATCH] wifi: ath11k: Send HT fixed rate in WMI peer fixed param
-
-Due to the firmware behavior with HT fixed rate setting,
-HT fixed rate MCS with NSS > 1 are treated as NSS = 1
-HT rates in the firmware and enables the HT fixed rate of
-NSS = 1.
-
-This leads to HT fixed rate is always configured for NSS = 1
-even though the user sets NSS = 2 or > 1 HT fixed MCS in the
-set bitrate command.
-
-Currently HT fixed MCS is sent via WMI peer assoc command.
-Fix this issue, by sending the HT fixed rate MCS in WMI peer
-fixed param instead of sending in peer assoc command.
-
-Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230504092033.3542456-3-quic_mkenna@quicinc.com
----
- drivers/net/wireless/ath/ath11k/mac.c | 63 ++++++++++++++++++++++++++-
- 1 file changed, 61 insertions(+), 2 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -4480,6 +4480,54 @@ ath11k_mac_set_peer_he_fixed_rate(struct
- return ret;
- }
-
-+static int
-+ath11k_mac_set_peer_ht_fixed_rate(struct ath11k_vif *arvif,
-+ struct ieee80211_sta *sta,
-+ const struct cfg80211_bitrate_mask *mask,
-+ enum nl80211_band band)
-+{
-+ struct ath11k *ar = arvif->ar;
-+ u8 ht_rate, nss = 0;
-+ u32 rate_code;
-+ int ret, i;
-+
-+ lockdep_assert_held(&ar->conf_mutex);
-+
-+ for (i = 0; i < ARRAY_SIZE(mask->control[band].ht_mcs); i++) {
-+ if (hweight8(mask->control[band].ht_mcs[i]) == 1) {
-+ nss = i + 1;
-+ ht_rate = ffs(mask->control[band].ht_mcs[i]) - 1;
-+ }
-+ }
-+
-+ if (!nss) {
-+ ath11k_warn(ar->ab, "No single HT Fixed rate found to set for %pM",
-+ sta->addr);
-+ return -EINVAL;
-+ }
-+
-+ /* Avoid updating invalid nss as fixed rate*/
-+ if (nss > sta->deflink.rx_nss)
-+ return -EINVAL;
-+
-+ ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
-+ "Setting Fixed HT Rate for peer %pM. Device will not switch to any other selected rates",
-+ sta->addr);
-+
-+ rate_code = ATH11K_HW_RATE_CODE(ht_rate, nss - 1,
-+ WMI_RATE_PREAMBLE_HT);
-+ ret = ath11k_wmi_set_peer_param(ar, sta->addr,
-+ arvif->vdev_id,
-+ WMI_PEER_PARAM_FIXED_RATE,
-+ rate_code);
-+ if (ret)
-+ ath11k_warn(ar->ab,
-+ "failed to update STA %pM HT Fixed Rate %d: %d\n",
-+ sta->addr, rate_code, ret);
-+
-+ return ret;
-+}
-+
- static int ath11k_station_assoc(struct ath11k *ar,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta,
-@@ -4491,7 +4539,7 @@ static int ath11k_station_assoc(struct a
- struct cfg80211_chan_def def;
- enum nl80211_band band;
- struct cfg80211_bitrate_mask *mask;
-- u8 num_vht_rates, num_he_rates;
-+ u8 num_ht_rates, num_vht_rates, num_he_rates;
-
- lockdep_assert_held(&ar->conf_mutex);
-
-@@ -4519,6 +4567,7 @@ static int ath11k_station_assoc(struct a
-
- num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask);
- num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band, mask);
-+ num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band, mask);
-
- /* If single VHT/HE rate is configured (by set_bitrate_mask()),
- * peer_assoc will disable VHT/HE. This is now enabled by a peer specific
-@@ -4535,6 +4584,11 @@ static int ath11k_station_assoc(struct a
- band);
- if (ret)
- return ret;
-+ } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) {
-+ ret = ath11k_mac_set_peer_ht_fixed_rate(arvif, sta, mask,
-+ band);
-+ if (ret)
-+ return ret;
- }
-
- /* Re-assoc is run only to update supported rates for given station. It
-@@ -4608,7 +4662,7 @@ static void ath11k_sta_rc_update_wk(stru
- const u16 *vht_mcs_mask;
- const u16 *he_mcs_mask;
- u32 changed, bw, nss, smps, bw_prev;
-- int err, num_vht_rates, num_he_rates;
-+ int err, num_ht_rates, num_vht_rates, num_he_rates;
- const struct cfg80211_bitrate_mask *mask;
- struct peer_assoc_params peer_arg;
- enum wmi_phy_mode peer_phymode;
-@@ -4724,6 +4778,8 @@ static void ath11k_sta_rc_update_wk(stru
-
- if (changed & IEEE80211_RC_SUPP_RATES_CHANGED) {
- mask = &arvif->bitrate_mask;
-+ num_ht_rates = ath11k_mac_bitrate_mask_num_ht_rates(ar, band,
-+ mask);
- num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band,
- mask);
- num_he_rates = ath11k_mac_bitrate_mask_num_he_rates(ar, band,
-@@ -4746,6 +4802,9 @@ static void ath11k_sta_rc_update_wk(stru
- } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) {
- ath11k_mac_set_peer_he_fixed_rate(arvif, sta, mask,
- band);
-+ } else if (sta->deflink.ht_cap.ht_supported && num_ht_rates == 1) {
-+ ath11k_mac_set_peer_ht_fixed_rate(arvif, sta, mask,
-+ band);
- } else {
- /* If the peer is non-VHT/HE or no fixed VHT/HE rate
- * is provided in the new bitrate mask we set the
+++ /dev/null
-From 88ca89202f8e8afb5225eb5244d79cd67c15d744 Mon Sep 17 00:00:00 2001
-From: Wen Gong <quic_wgong@quicinc.com>
-Date: Fri, 26 May 2023 12:41:06 +0300
-Subject: [PATCH] wifi: ath11k: add support default regdb while searching
- board-2.bin for WCN6855
-
-Sometimes board-2.bin does not have the regdb data which matched the
-parameters such as vendor, device, subsystem-vendor, subsystem-device
-and etc. Add default regdb data with 'bus=%s' into board-2.bin for
-WCN6855, then ath11k use 'bus=pci' to search regdb data in board-2.bin
-for WCN6855.
-
-kernel: [ 122.515808] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262'
-kernel: [ 122.517240] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564
-kernel: [ 122.517280] ath11k_pci 0000:03:00.0: failed to fetch regdb data for bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262 from ath11k/WCN6855/hw2.0/board-2.bin
-kernel: [ 122.517464] ath11k_pci 0000:03:00.0: boot using board name 'bus=pci'
-kernel: [ 122.518901] ath11k_pci 0000:03:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 6179564
-kernel: [ 122.518915] ath11k_pci 0000:03:00.0: board name
-kernel: [ 122.518917] ath11k_pci 0000:03:00.0: 00000000: 62 75 73 3d 70 63 69 bus=pci
-kernel: [ 122.518918] ath11k_pci 0000:03:00.0: boot found match regdb data for name 'bus=pci'
-kernel: [ 122.518920] ath11k_pci 0000:03:00.0: boot found regdb data for 'bus=pci'
-kernel: [ 122.518921] ath11k_pci 0000:03:00.0: fetched regdb
-
-Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
-
-Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230517133959.8224-1-quic_wgong@quicinc.com
----
- drivers/net/wireless/ath/ath11k/core.c | 53 +++++++++++++++++++-------
- 1 file changed, 40 insertions(+), 13 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -961,7 +961,8 @@ int ath11k_core_check_dt(struct ath11k_b
- }
-
- static int __ath11k_core_create_board_name(struct ath11k_base *ab, char *name,
-- size_t name_len, bool with_variant)
-+ size_t name_len, bool with_variant,
-+ bool bus_type_mode)
- {
- /* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */
- char variant[9 + ATH11K_QMI_BDF_EXT_STR_LENGTH] = { 0 };
-@@ -972,15 +973,20 @@ static int __ath11k_core_create_board_na
-
- switch (ab->id.bdf_search) {
- case ATH11K_BDF_SEARCH_BUS_AND_BOARD:
-- scnprintf(name, name_len,
-- "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s",
-- ath11k_bus_str(ab->hif.bus),
-- ab->id.vendor, ab->id.device,
-- ab->id.subsystem_vendor,
-- ab->id.subsystem_device,
-- ab->qmi.target.chip_id,
-- ab->qmi.target.board_id,
-- variant);
-+ if (bus_type_mode)
-+ scnprintf(name, name_len,
-+ "bus=%s",
-+ ath11k_bus_str(ab->hif.bus));
-+ else
-+ scnprintf(name, name_len,
-+ "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s",
-+ ath11k_bus_str(ab->hif.bus),
-+ ab->id.vendor, ab->id.device,
-+ ab->id.subsystem_vendor,
-+ ab->id.subsystem_device,
-+ ab->qmi.target.chip_id,
-+ ab->qmi.target.board_id,
-+ variant);
- break;
- default:
- scnprintf(name, name_len,
-@@ -999,13 +1005,19 @@ static int __ath11k_core_create_board_na
- static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name,
- size_t name_len)
- {
-- return __ath11k_core_create_board_name(ab, name, name_len, true);
-+ return __ath11k_core_create_board_name(ab, name, name_len, true, false);
- }
-
- static int ath11k_core_create_fallback_board_name(struct ath11k_base *ab, char *name,
- size_t name_len)
- {
-- return __ath11k_core_create_board_name(ab, name, name_len, false);
-+ return __ath11k_core_create_board_name(ab, name, name_len, false, false);
-+}
-+
-+static int ath11k_core_create_bus_type_board_name(struct ath11k_base *ab, char *name,
-+ size_t name_len)
-+{
-+ return __ath11k_core_create_board_name(ab, name, name_len, false, true);
- }
-
- const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab,
-@@ -1309,7 +1321,7 @@ success:
-
- int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd)
- {
-- char boardname[BOARD_NAME_SIZE];
-+ char boardname[BOARD_NAME_SIZE], default_boardname[BOARD_NAME_SIZE];
- int ret;
-
- ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE);
-@@ -1323,6 +1335,21 @@ int ath11k_core_fetch_regdb(struct ath11
- ATH11K_BD_IE_REGDB,
- ATH11K_BD_IE_REGDB_NAME,
- ATH11K_BD_IE_REGDB_DATA);
-+ if (!ret)
-+ goto exit;
-+
-+ ret = ath11k_core_create_bus_type_board_name(ab, default_boardname,
-+ BOARD_NAME_SIZE);
-+ if (ret) {
-+ ath11k_dbg(ab, ATH11K_DBG_BOOT,
-+ "failed to create default board name for regdb: %d", ret);
-+ goto exit;
-+ }
-+
-+ ret = ath11k_core_fetch_board_data_api_n(ab, bd, default_boardname,
-+ ATH11K_BD_IE_REGDB,
-+ ATH11K_BD_IE_REGDB_NAME,
-+ ATH11K_BD_IE_REGDB_DATA);
- if (!ret)
- goto exit;
-
+++ /dev/null
-From 86f85575a3f6a20cef1c8bb98e78585fe3a53ccc Mon Sep 17 00:00:00 2001
-From: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
-Date: Fri, 26 May 2023 12:41:06 +0300
-Subject: [PATCH 82/84] wifi: ath11k: remove unused function
- ath11k_tm_event_wmi()
-
-The function ath11k_tm_event_wmi() is only defined and it is not used
-anywhere. Hence remove the unused.
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
-Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230517135934.16408-2-quic_rajkbhag@quicinc.com
----
- drivers/net/wireless/ath/ath11k/testmode.c | 64 +---------------------
- drivers/net/wireless/ath/ath11k/testmode.h | 8 +--
- 2 files changed, 2 insertions(+), 70 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/testmode.c
-+++ b/drivers/net/wireless/ath/ath11k/testmode.c
-@@ -1,6 +1,7 @@
- // SPDX-License-Identifier: BSD-3-Clause-Clear
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #include "testmode.h"
-@@ -20,69 +21,6 @@ static const struct nla_policy ath11k_tm
- [ATH11K_TM_ATTR_VERSION_MINOR] = { .type = NLA_U32 },
- };
-
--/* Returns true if callee consumes the skb and the skb should be discarded.
-- * Returns false if skb is not used. Does not sleep.
-- */
--bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb)
--{
-- struct sk_buff *nl_skb;
-- bool consumed;
-- int ret;
--
-- ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE,
-- "testmode event wmi cmd_id %d skb %pK skb->len %d\n",
-- cmd_id, skb, skb->len);
--
-- ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", skb->data, skb->len);
--
-- spin_lock_bh(&ar->data_lock);
--
-- consumed = true;
--
-- nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy,
-- 2 * sizeof(u32) + skb->len,
-- GFP_ATOMIC);
-- if (!nl_skb) {
-- ath11k_warn(ar->ab,
-- "failed to allocate skb for testmode wmi event\n");
-- goto out;
-- }
--
-- ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ATH11K_TM_CMD_WMI);
-- if (ret) {
-- ath11k_warn(ar->ab,
-- "failed to put testmode wmi event cmd attribute: %d\n",
-- ret);
-- kfree_skb(nl_skb);
-- goto out;
-- }
--
-- ret = nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id);
-- if (ret) {
-- ath11k_warn(ar->ab,
-- "failed to put testmode wmi even cmd_id: %d\n",
-- ret);
-- kfree_skb(nl_skb);
-- goto out;
-- }
--
-- ret = nla_put(nl_skb, ATH11K_TM_ATTR_DATA, skb->len, skb->data);
-- if (ret) {
-- ath11k_warn(ar->ab,
-- "failed to copy skb to testmode wmi event: %d\n",
-- ret);
-- kfree_skb(nl_skb);
-- goto out;
-- }
--
-- cfg80211_testmode_event(nl_skb, GFP_ATOMIC);
--
--out:
-- spin_unlock_bh(&ar->data_lock);
--
-- return consumed;
--}
--
- static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[])
- {
- struct sk_buff *skb;
---- a/drivers/net/wireless/ath/ath11k/testmode.h
-+++ b/drivers/net/wireless/ath/ath11k/testmode.h
-@@ -1,24 +1,18 @@
- /* SPDX-License-Identifier: BSD-3-Clause-Clear */
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #include "core.h"
-
- #ifdef CPTCFG_NL80211_TESTMODE
-
--bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id, struct sk_buff *skb);
- int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- void *data, int len);
-
- #else
-
--static inline bool ath11k_tm_event_wmi(struct ath11k *ar, u32 cmd_id,
-- struct sk_buff *skb)
--{
-- return false;
--}
--
- static inline int ath11k_tm_cmd(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- void *data, int len)
+++ /dev/null
-From b43310e44edc823a7f02af1e1e2b4e8a9abc7d91 Mon Sep 17 00:00:00 2001
-From: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
-Date: Fri, 26 May 2023 12:41:07 +0300
-Subject: [PATCH 83/84] wifi: ath11k: factory test mode support
-
-Add support to process factory test mode commands (FTM) for calibration.
-By default firmware start with NORMAL mode and to process the FTM commands
-firmware needs to be restarted in FTM mode using module parameter ftm_mode.
-The pre-request is all the radios should be down before starting the test.
-
-When start command ATH11K_TM_CMD_TESTMODE_START is received, ar->state
-is set to Test Mode. If the FTM command or event length is greater
-than 256 bytes, it will be broken down into multiple segments and
-encoded with TLV header if it is segmented commands, else it is sent
-to firmware as it is.
-
-On receiving UTF event from firmware, if it is segmented event, the driver
-will wait until it receives all the segments and notify the complete
-data to user application. In case the segmented sequence are missed or
-lost from the firmware, driver will skip the already received partial data.
-
-In case of unsegmented UTF event from firmware, driver notifies the
-data to the user application as it comes. Applications handles
-the data further.
-
-Command to boot in ftm mode:
-
-insmod ath11k ftm_mode=1
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Govindaraj Saminathan <quic_gsaminat@quicinc.com>
-Co-developed-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
-Signed-off-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
-Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230517135934.16408-4-quic_rajkbhag@quicinc.com
----
- drivers/net/wireless/ath/ath11k/ahb.c | 3 +-
- drivers/net/wireless/ath/ath11k/core.c | 21 +-
- drivers/net/wireless/ath/ath11k/core.h | 16 +-
- drivers/net/wireless/ath/ath11k/debug.h | 1 +
- drivers/net/wireless/ath/ath11k/mac.c | 11 +-
- drivers/net/wireless/ath/ath11k/pci.c | 3 +-
- drivers/net/wireless/ath/ath11k/testmode.c | 350 ++++++++++++++++++-
- drivers/net/wireless/ath/ath11k/testmode.h | 6 +
- drivers/net/wireless/ath/ath11k/testmode_i.h | 18 +-
- drivers/net/wireless/ath/ath11k/wmi.c | 11 +-
- drivers/net/wireless/ath/ath11k/wmi.h | 22 ++
- drivers/net/wireless/ath/ath11k/wow.c | 3 +-
- 12 files changed, 444 insertions(+), 21 deletions(-)
-
---- a/drivers/net/wireless/ath/ath11k/ahb.c
-+++ b/drivers/net/wireless/ath/ath11k/ahb.c
-@@ -1,7 +1,7 @@
- // SPDX-License-Identifier: BSD-3-Clause-Clear
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
-+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #include <linux/module.h>
-@@ -1155,6 +1155,7 @@ static int ath11k_ahb_probe(struct platf
- ab->hif.ops = hif_ops;
- ab->pdev = pdev;
- ab->hw_rev = hw_rev;
-+ ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL;
- platform_set_drvdata(pdev, ab);
-
- ret = ath11k_pcic_register_pci_ops(ab, pci_ops);
---- a/drivers/net/wireless/ath/ath11k/core.c
-+++ b/drivers/net/wireless/ath/ath11k/core.c
-@@ -1,7 +1,7 @@
- // SPDX-License-Identifier: BSD-3-Clause-Clear
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
-+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #include <linux/module.h>
-@@ -32,6 +32,10 @@ module_param_named(frame_mode, ath11k_fr
- MODULE_PARM_DESC(frame_mode,
- "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)");
-
-+bool ath11k_ftm_mode;
-+module_param_named(ftm_mode, ath11k_ftm_mode, bool, 0444);
-+MODULE_PARM_DESC(ftm_mode, "Boots up in factory test mode");
-+
- static const struct ath11k_hw_params ath11k_hw_params[] = {
- {
- .hw_rev = ATH11K_HW_IPQ8074,
-@@ -1381,6 +1385,11 @@ static int ath11k_core_soc_create(struct
- {
- int ret;
-
-+ if (ath11k_ftm_mode) {
-+ ab->fw_mode = ATH11K_FIRMWARE_MODE_FTM;
-+ ath11k_info(ab, "Booting in factory test mode\n");
-+ }
-+
- ret = ath11k_qmi_init_service(ab);
- if (ret) {
- ath11k_err(ab, "failed to initialize qmi :%d\n", ret);
-@@ -1607,7 +1616,7 @@ int ath11k_core_qmi_firmware_ready(struc
- {
- int ret;
-
-- ret = ath11k_core_start_firmware(ab, ATH11K_FIRMWARE_MODE_NORMAL);
-+ ret = ath11k_core_start_firmware(ab, ab->fw_mode);
- if (ret) {
- ath11k_err(ab, "failed to start firmware: %d\n", ret);
- return ret;
-@@ -1772,7 +1781,8 @@ void ath11k_core_pre_reconfigure_recover
- for (i = 0; i < ab->num_radios; i++) {
- pdev = &ab->pdevs[i];
- ar = pdev->ar;
-- if (!ar || ar->state == ATH11K_STATE_OFF)
-+ if (!ar || ar->state == ATH11K_STATE_OFF ||
-+ ar->state == ATH11K_STATE_FTM)
- continue;
-
- ieee80211_stop_queues(ar->hw);
-@@ -1841,7 +1851,12 @@ static void ath11k_core_post_reconfigure
- ath11k_warn(ab,
- "device is wedged, will not restart radio %d\n", i);
- break;
-+ case ATH11K_STATE_FTM:
-+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE,
-+ "fw mode reset done radio %d\n", i);
-+ break;
- }
-+
- mutex_unlock(&ar->conf_mutex);
- }
- complete(&ab->driver_recovery);
---- a/drivers/net/wireless/ath/ath11k/core.h
-+++ b/drivers/net/wireless/ath/ath11k/core.h
-@@ -1,7 +1,7 @@
- /* SPDX-License-Identifier: BSD-3-Clause-Clear */
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
-+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #ifndef ATH11K_CORE_H
-@@ -52,6 +52,7 @@
- #define ATH11K_SMBIOS_BDF_EXT_MAGIC "BDF_"
-
- extern unsigned int ath11k_frame_mode;
-+extern bool ath11k_ftm_mode;
-
- #define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ)
-
-@@ -277,6 +278,7 @@ enum ath11k_dev_flags {
- ATH11K_FLAG_FIXED_MEM_RGN,
- ATH11K_FLAG_DEVICE_INIT_DONE,
- ATH11K_FLAG_MULTI_MSI_VECTORS,
-+ ATH11K_FLAG_FTM_SEGMENTED,
- };
-
- enum ath11k_monitor_flags {
-@@ -530,6 +532,7 @@ enum ath11k_state {
- ATH11K_STATE_RESTARTING,
- ATH11K_STATE_RESTARTED,
- ATH11K_STATE_WEDGED,
-+ ATH11K_STATE_FTM,
- /* Add other states as required */
- };
-
-@@ -709,6 +712,8 @@ struct ath11k {
- u32 last_ppdu_id;
- u32 cached_ppdu_id;
- int monitor_vdev_id;
-+ struct completion fw_mode_reset;
-+ u8 ftm_msgref;
- #ifdef CPTCFG_ATH11K_DEBUGFS
- struct ath11k_debug debug;
- #endif
-@@ -838,6 +843,7 @@ struct ath11k_msi_config {
- /* Master structure to hold the hw data which may be used in core module */
- struct ath11k_base {
- enum ath11k_hw_rev hw_rev;
-+ enum ath11k_firmware_mode fw_mode;
- struct platform_device *pdev;
- struct device *dev;
- struct ath11k_qmi qmi;
-@@ -978,6 +984,14 @@ struct ath11k_base {
- const struct ath11k_pci_ops *ops;
- } pci;
-
-+#ifdef CPTCFG_NL80211_TESTMODE
-+ struct {
-+ u32 data_pos;
-+ u32 expected_seq;
-+ u8 *eventdata;
-+ } testmode;
-+#endif
-+
- /* must be last */
- u8 drv_priv[] __aligned(sizeof(void *));
- };
---- a/drivers/net/wireless/ath/ath11k/debug.h
-+++ b/drivers/net/wireless/ath/ath11k/debug.h
-@@ -1,6 +1,7 @@
- /* SPDX-License-Identifier: BSD-3-Clause-Clear */
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #ifndef _ATH11K_DEBUG_H_
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -643,7 +643,10 @@ struct ath11k *ath11k_mac_get_ar_by_pdev
- return NULL;
-
- for (i = 0; i < ab->num_radios; i++) {
-- pdev = rcu_dereference(ab->pdevs_active[i]);
-+ if (ab->fw_mode == ATH11K_FIRMWARE_MODE_FTM)
-+ pdev = &ab->pdevs[i];
-+ else
-+ pdev = rcu_dereference(ab->pdevs_active[i]);
-
- if (pdev && pdev->pdev_id == pdev_id)
- return (pdev->ar ? pdev->ar : NULL);
-@@ -6271,6 +6274,11 @@ static int ath11k_mac_op_start(struct ie
- struct ath11k_pdev *pdev = ar->pdev;
- int ret;
-
-+ if (ath11k_ftm_mode) {
-+ ath11k_warn(ab, "mac operations not supported in factory test mode\n");
-+ return -EOPNOTSUPP;
-+ }
-+
- ath11k_mac_drain_tx(ar);
- mutex_lock(&ar->conf_mutex);
-
-@@ -6285,6 +6293,7 @@ static int ath11k_mac_op_start(struct ie
- case ATH11K_STATE_RESTARTED:
- case ATH11K_STATE_WEDGED:
- case ATH11K_STATE_ON:
-+ case ATH11K_STATE_FTM:
- WARN_ON(1);
- ret = -EINVAL;
- goto err;
---- a/drivers/net/wireless/ath/ath11k/pci.c
-+++ b/drivers/net/wireless/ath/ath11k/pci.c
-@@ -1,7 +1,7 @@
- // SPDX-License-Identifier: BSD-3-Clause-Clear
- /*
- * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
-- * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved.
-+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #include <linux/module.h>
-@@ -745,6 +745,7 @@ static int ath11k_pci_probe(struct pci_d
- ab_pci->ab = ab;
- ab_pci->pdev = pdev;
- ab->hif.ops = &ath11k_pci_hif_ops;
-+ ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL;
- pci_set_drvdata(pdev, ab);
- spin_lock_init(&ab_pci->window_lock);
-
---- a/drivers/net/wireless/ath/ath11k/testmode.c
-+++ b/drivers/net/wireless/ath/ath11k/testmode.c
-@@ -12,6 +12,9 @@
- #include "core.h"
- #include "testmode_i.h"
-
-+#define ATH11K_FTM_SEGHDR_CURRENT_SEQ GENMASK(3, 0)
-+#define ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS GENMASK(7, 4)
-+
- static const struct nla_policy ath11k_tm_policy[ATH11K_TM_ATTR_MAX + 1] = {
- [ATH11K_TM_ATTR_CMD] = { .type = NLA_U32 },
- [ATH11K_TM_ATTR_DATA] = { .type = NLA_BINARY,
-@@ -21,13 +24,217 @@ static const struct nla_policy ath11k_tm
- [ATH11K_TM_ATTR_VERSION_MINOR] = { .type = NLA_U32 },
- };
-
-+static struct ath11k *ath11k_tm_get_ar(struct ath11k_base *ab)
-+{
-+ struct ath11k_pdev *pdev;
-+ struct ath11k *ar = NULL;
-+ int i;
-+
-+ for (i = 0; i < ab->num_radios; i++) {
-+ pdev = &ab->pdevs[i];
-+ ar = pdev->ar;
-+
-+ if (ar && ar->state == ATH11K_STATE_FTM)
-+ break;
-+ }
-+
-+ return ar;
-+}
-+
-+/* This function handles unsegmented events. Data in various events are aggregated
-+ * in application layer, this event is unsegmented from host perspective.
-+ */
-+static void ath11k_tm_wmi_event_unsegmented(struct ath11k_base *ab, u32 cmd_id,
-+ struct sk_buff *skb)
-+{
-+ struct sk_buff *nl_skb;
-+ struct ath11k *ar;
-+
-+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE,
-+ "event wmi cmd_id %d skb length %d\n",
-+ cmd_id, skb->len);
-+ ath11k_dbg_dump(ab, ATH11K_DBG_TESTMODE, NULL, "", skb->data, skb->len);
-+
-+ ar = ath11k_tm_get_ar(ab);
-+ if (!ar) {
-+ ath11k_warn(ab, "testmode event not handled due to invalid pdev\n");
-+ return;
-+ }
-+
-+ spin_lock_bh(&ar->data_lock);
-+
-+ nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy,
-+ 2 * nla_total_size(sizeof(u32)) +
-+ nla_total_size(skb->len),
-+ GFP_ATOMIC);
-+ if (!nl_skb) {
-+ ath11k_warn(ab,
-+ "failed to allocate skb for unsegmented testmode wmi event\n");
-+ goto out;
-+ }
-+
-+ if (nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD, ATH11K_TM_CMD_WMI) ||
-+ nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id) ||
-+ nla_put(nl_skb, ATH11K_TM_ATTR_DATA, skb->len, skb->data)) {
-+ ath11k_warn(ab, "failed to populate testmode unsegmented event\n");
-+ kfree_skb(nl_skb);
-+ goto out;
-+ }
-+
-+ cfg80211_testmode_event(nl_skb, GFP_ATOMIC);
-+ spin_unlock_bh(&ar->data_lock);
-+ return;
-+
-+out:
-+ spin_unlock_bh(&ar->data_lock);
-+ ath11k_warn(ab, "Failed to send testmode event to higher layers\n");
-+}
-+
-+/* This function handles segmented events. Data of various events received
-+ * from firmware is aggregated and sent to application layer
-+ */
-+static int ath11k_tm_process_event(struct ath11k_base *ab, u32 cmd_id,
-+ const struct wmi_ftm_event_msg *ftm_msg,
-+ u16 length)
-+{
-+ struct sk_buff *nl_skb;
-+ int ret = 0;
-+ struct ath11k *ar;
-+ u8 const *buf_pos;
-+ u16 datalen;
-+ u8 total_segments, current_seq;
-+ u32 data_pos;
-+ u32 pdev_id;
-+
-+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE,
-+ "event wmi cmd_id %d ftm event msg %pK datalen %d\n",
-+ cmd_id, ftm_msg, length);
-+ ath11k_dbg_dump(ab, ATH11K_DBG_TESTMODE, NULL, "", ftm_msg, length);
-+ pdev_id = DP_HW2SW_MACID(ftm_msg->seg_hdr.pdev_id);
-+
-+ if (pdev_id >= ab->num_radios) {
-+ ath11k_warn(ab, "testmode event not handled due to invalid pdev id: %d\n",
-+ pdev_id);
-+ return -EINVAL;
-+ }
-+
-+ ar = ab->pdevs[pdev_id].ar;
-+ if (!ar) {
-+ ath11k_warn(ab, "testmode event not handled due to absence of pdev\n");
-+ return -ENODEV;
-+ }
-+
-+ current_seq = FIELD_GET(ATH11K_FTM_SEGHDR_CURRENT_SEQ,
-+ ftm_msg->seg_hdr.segmentinfo);
-+ total_segments = FIELD_GET(ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS,
-+ ftm_msg->seg_hdr.segmentinfo);
-+ datalen = length - (sizeof(struct wmi_ftm_seg_hdr));
-+ buf_pos = ftm_msg->data;
-+
-+ spin_lock_bh(&ar->data_lock);
-+
-+ if (current_seq == 0) {
-+ ab->testmode.expected_seq = 0;
-+ ab->testmode.data_pos = 0;
-+ }
-+
-+ data_pos = ab->testmode.data_pos;
-+
-+ if ((data_pos + datalen) > ATH11K_FTM_EVENT_MAX_BUF_LENGTH) {
-+ ath11k_warn(ab, "Invalid ftm event length at %d: %d\n",
-+ data_pos, datalen);
-+ ret = -EINVAL;
-+ goto out;
-+ }
-+
-+ memcpy(&ab->testmode.eventdata[data_pos], buf_pos, datalen);
-+ data_pos += datalen;
-+
-+ if (++ab->testmode.expected_seq != total_segments) {
-+ ab->testmode.data_pos = data_pos;
-+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE,
-+ "partial data received current_seq %d total_seg %d\n",
-+ current_seq, total_segments);
-+ goto out;
-+ }
-+
-+ ath11k_dbg(ab, ATH11K_DBG_TESTMODE,
-+ "total data length pos %d len %d\n",
-+ data_pos, ftm_msg->seg_hdr.len);
-+ nl_skb = cfg80211_testmode_alloc_event_skb(ar->hw->wiphy,
-+ 2 * nla_total_size(sizeof(u32)) +
-+ nla_total_size(data_pos),
-+ GFP_ATOMIC);
-+ if (!nl_skb) {
-+ ath11k_warn(ab,
-+ "failed to allocate skb for segmented testmode wmi event\n");
-+ ret = -ENOMEM;
-+ goto out;
-+ }
-+
-+ if (nla_put_u32(nl_skb, ATH11K_TM_ATTR_CMD,
-+ ATH11K_TM_CMD_WMI_FTM) ||
-+ nla_put_u32(nl_skb, ATH11K_TM_ATTR_WMI_CMDID, cmd_id) ||
-+ nla_put(nl_skb, ATH11K_TM_ATTR_DATA, data_pos,
-+ &ab->testmode.eventdata[0])) {
-+ ath11k_warn(ab, "failed to populate segmented testmode event");
-+ kfree_skb(nl_skb);
-+ ret = -ENOBUFS;
-+ goto out;
-+ }
-+
-+ cfg80211_testmode_event(nl_skb, GFP_ATOMIC);
-+
-+out:
-+ spin_unlock_bh(&ar->data_lock);
-+ return ret;
-+}
-+
-+static void ath11k_tm_wmi_event_segmented(struct ath11k_base *ab, u32 cmd_id,
-+ struct sk_buff *skb)
-+{
-+ const void **tb;
-+ const struct wmi_ftm_event_msg *ev;
-+ u16 length;
-+ int ret;
-+
-+ tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC);
-+ if (IS_ERR(tb)) {
-+ ret = PTR_ERR(tb);
-+ ath11k_warn(ab, "failed to parse ftm event tlv: %d\n", ret);
-+ return;
-+ }
-+
-+ ev = tb[WMI_TAG_ARRAY_BYTE];
-+ if (!ev) {
-+ ath11k_warn(ab, "failed to fetch ftm msg\n");
-+ kfree(tb);
-+ return;
-+ }
-+
-+ length = skb->len - TLV_HDR_SIZE;
-+ ret = ath11k_tm_process_event(ab, cmd_id, ev, length);
-+ if (ret)
-+ ath11k_warn(ab, "Failed to process ftm event\n");
-+
-+ kfree(tb);
-+}
-+
-+void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, struct sk_buff *skb)
-+{
-+ if (test_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags))
-+ ath11k_tm_wmi_event_segmented(ab, cmd_id, skb);
-+ else
-+ ath11k_tm_wmi_event_unsegmented(ab, cmd_id, skb);
-+}
-+
- static int ath11k_tm_cmd_get_version(struct ath11k *ar, struct nlattr *tb[])
- {
- struct sk_buff *skb;
- int ret;
-
- ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE,
-- "testmode cmd get version_major %d version_minor %d\n",
-+ "cmd get version_major %d version_minor %d\n",
- ATH11K_TESTMODE_VERSION_MAJOR,
- ATH11K_TESTMODE_VERSION_MINOR);
-
-@@ -53,6 +260,43 @@ static int ath11k_tm_cmd_get_version(str
- return cfg80211_testmode_reply(skb);
- }
-
-+static int ath11k_tm_cmd_testmode_start(struct ath11k *ar, struct nlattr *tb[])
-+{
-+ int ret;
-+
-+ mutex_lock(&ar->conf_mutex);
-+
-+ if (ar->state == ATH11K_STATE_FTM) {
-+ ret = -EALREADY;
-+ goto err;
-+ }
-+
-+ /* start utf only when the driver is not in use */
-+ if (ar->state != ATH11K_STATE_OFF) {
-+ ret = -EBUSY;
-+ goto err;
-+ }
-+
-+ ar->ab->testmode.eventdata = kzalloc(ATH11K_FTM_EVENT_MAX_BUF_LENGTH,
-+ GFP_KERNEL);
-+ if (!ar->ab->testmode.eventdata) {
-+ ret = -ENOMEM;
-+ goto err;
-+ }
-+
-+ ar->state = ATH11K_STATE_FTM;
-+ ar->ftm_msgref = 0;
-+
-+ mutex_unlock(&ar->conf_mutex);
-+
-+ ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE, "cmd start\n");
-+ return 0;
-+
-+err:
-+ mutex_unlock(&ar->conf_mutex);
-+ return ret;
-+}
-+
- static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[])
- {
- struct ath11k_pdev_wmi *wmi = ar->wmi;
-@@ -63,11 +307,6 @@ static int ath11k_tm_cmd_wmi(struct ath1
-
- mutex_lock(&ar->conf_mutex);
-
-- if (ar->state != ATH11K_STATE_ON) {
-- ret = -ENETDOWN;
-- goto out;
-- }
--
- if (!tb[ATH11K_TM_ATTR_DATA]) {
- ret = -EINVAL;
- goto out;
-@@ -80,11 +319,17 @@ static int ath11k_tm_cmd_wmi(struct ath1
-
- buf = nla_data(tb[ATH11K_TM_ATTR_DATA]);
- buf_len = nla_len(tb[ATH11K_TM_ATTR_DATA]);
-+ if (!buf_len) {
-+ ath11k_warn(ar->ab, "No data present in testmode wmi command\n");
-+ ret = -EINVAL;
-+ goto out;
-+ }
-+
- cmd_id = nla_get_u32(tb[ATH11K_TM_ATTR_WMI_CMDID]);
-
- ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE,
-- "testmode cmd wmi cmd_id %d buf %pK buf_len %d\n",
-- cmd_id, buf, buf_len);
-+ "cmd wmi cmd_id %d buf length %d\n",
-+ cmd_id, buf_len);
-
- ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", buf, buf_len);
-
-@@ -111,6 +356,91 @@ out:
- return ret;
- }
-
-+static int ath11k_tm_cmd_wmi_ftm(struct ath11k *ar, struct nlattr *tb[])
-+{
-+ struct ath11k_pdev_wmi *wmi = ar->wmi;
-+ struct ath11k_base *ab = ar->ab;
-+ struct sk_buff *skb;
-+ u32 cmd_id, buf_len, hdr_info;
-+ int ret;
-+ void *buf;
-+ u8 segnumber = 0, seginfo;
-+ u16 chunk_len, total_bytes, num_segments;
-+ u8 *bufpos;
-+ struct wmi_ftm_cmd *ftm_cmd;
-+
-+ set_bit(ATH11K_FLAG_FTM_SEGMENTED, &ab->dev_flags);
-+
-+ mutex_lock(&ar->conf_mutex);
-+
-+ if (ar->state != ATH11K_STATE_FTM) {
-+ ret = -ENETDOWN;
-+ goto out;
-+ }
-+
-+ if (!tb[ATH11K_TM_ATTR_DATA]) {
-+ ret = -EINVAL;
-+ goto out;
-+ }
-+
-+ buf = nla_data(tb[ATH11K_TM_ATTR_DATA]);
-+ buf_len = nla_len(tb[ATH11K_TM_ATTR_DATA]);
-+ cmd_id = WMI_PDEV_UTF_CMDID;
-+
-+ ath11k_dbg(ar->ab, ATH11K_DBG_TESTMODE,
-+ "cmd wmi ftm cmd_id %d buffer length %d\n",
-+ cmd_id, buf_len);
-+ ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", buf, buf_len);
-+
-+ bufpos = buf;
-+ total_bytes = buf_len;
-+ num_segments = total_bytes / MAX_WMI_UTF_LEN;
-+
-+ if (buf_len - (num_segments * MAX_WMI_UTF_LEN))
-+ num_segments++;
-+
-+ while (buf_len) {
-+ chunk_len = min_t(u16, buf_len, MAX_WMI_UTF_LEN);
-+
-+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, (chunk_len +
-+ sizeof(struct wmi_ftm_cmd)));
-+ if (!skb) {
-+ ret = -ENOMEM;
-+ goto out;
-+ }
-+
-+ ftm_cmd = (struct wmi_ftm_cmd *)skb->data;
-+ hdr_info = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) |
-+ FIELD_PREP(WMI_TLV_LEN, (chunk_len +
-+ sizeof(struct wmi_ftm_seg_hdr)));
-+ ftm_cmd->tlv_header = hdr_info;
-+ ftm_cmd->seg_hdr.len = total_bytes;
-+ ftm_cmd->seg_hdr.msgref = ar->ftm_msgref;
-+ seginfo = FIELD_PREP(ATH11K_FTM_SEGHDR_TOTAL_SEGMENTS, num_segments) |
-+ FIELD_PREP(ATH11K_FTM_SEGHDR_CURRENT_SEQ, segnumber);
-+ ftm_cmd->seg_hdr.segmentinfo = seginfo;
-+ segnumber++;
-+
-+ memcpy(&ftm_cmd->data, bufpos, chunk_len);
-+
-+ ret = ath11k_wmi_cmd_send(wmi, skb, cmd_id);
-+ if (ret) {
-+ ath11k_warn(ar->ab, "failed to send wmi ftm command: %d\n", ret);
-+ goto out;
-+ }
-+
-+ buf_len -= chunk_len;
-+ bufpos += chunk_len;
-+ }
-+
-+ ar->ftm_msgref++;
-+ ret = 0;
-+
-+out:
-+ mutex_unlock(&ar->conf_mutex);
-+ return ret;
-+}
-+
- int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- void *data, int len)
- {
-@@ -131,6 +461,10 @@ int ath11k_tm_cmd(struct ieee80211_hw *h
- return ath11k_tm_cmd_get_version(ar, tb);
- case ATH11K_TM_CMD_WMI:
- return ath11k_tm_cmd_wmi(ar, tb);
-+ case ATH11K_TM_CMD_TESTMODE_START:
-+ return ath11k_tm_cmd_testmode_start(ar, tb);
-+ case ATH11K_TM_CMD_WMI_FTM:
-+ return ath11k_tm_cmd_wmi_ftm(ar, tb);
- default:
- return -EOPNOTSUPP;
- }
---- a/drivers/net/wireless/ath/ath11k/testmode.h
-+++ b/drivers/net/wireless/ath/ath11k/testmode.h
-@@ -8,11 +8,17 @@
-
- #ifdef CPTCFG_NL80211_TESTMODE
-
-+void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id, struct sk_buff *skb);
- int ath11k_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- void *data, int len);
-
- #else
-
-+static inline void ath11k_tm_wmi_event(struct ath11k_base *ab, u32 cmd_id,
-+ struct sk_buff *skb)
-+{
-+}
-+
- static inline int ath11k_tm_cmd(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- void *data, int len)
---- a/drivers/net/wireless/ath/ath11k/testmode_i.h
-+++ b/drivers/net/wireless/ath/ath11k/testmode_i.h
-@@ -1,6 +1,7 @@
- /* SPDX-License-Identifier: BSD-3-Clause-Clear */
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- /* "API" level of the ath11k testmode interface. Bump it after every
-@@ -11,9 +12,10 @@
- /* Bump this after every _compatible_ interface change, for example
- * addition of a new command or an attribute.
- */
--#define ATH11K_TESTMODE_VERSION_MINOR 0
-+#define ATH11K_TESTMODE_VERSION_MINOR 1
-
- #define ATH11K_TM_DATA_MAX_LEN 5000
-+#define ATH11K_FTM_EVENT_MAX_BUF_LENGTH 2048
-
- enum ath11k_tm_attr {
- __ATH11K_TM_ATTR_INVALID = 0,
-@@ -47,4 +49,18 @@ enum ath11k_tm_cmd {
- * ATH11K_TM_ATTR_DATA.
- */
- ATH11K_TM_CMD_WMI = 1,
-+
-+ /* Boots the UTF firmware, the netdev interface must be down at the
-+ * time.
-+ */
-+ ATH11K_TM_CMD_TESTMODE_START = 2,
-+
-+ /* The command used to transmit a FTM WMI command to the firmware
-+ * and the event to receive WMI events from the firmware. The data
-+ * received only contain the payload, need to add the tlv header
-+ * and send the cmd to firmware with command id WMI_PDEV_UTF_CMDID.
-+ * The data payload size could be large and the driver needs to
-+ * send segmented data to firmware.
-+ */
-+ ATH11K_TM_CMD_WMI_FTM = 3,
- };
---- a/drivers/net/wireless/ath/ath11k/wmi.c
-+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -1,7 +1,7 @@
- // SPDX-License-Identifier: BSD-3-Clause-Clear
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-- * Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved.
-+ * Copyright (c) 2021, 2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
- #include <linux/skbuff.h>
- #include <linux/ctype.h>
-@@ -19,6 +19,7 @@
- #include "mac.h"
- #include "hw.h"
- #include "peer.h"
-+#include "testmode.h"
-
- struct wmi_tlv_policy {
- size_t min_len;
-@@ -237,9 +238,8 @@ static int ath11k_wmi_tlv_parse(struct a
- (void *)tb);
- }
-
--static const void **
--ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr,
-- size_t len, gfp_t gfp)
-+const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr,
-+ size_t len, gfp_t gfp)
- {
- const void **tb;
- int ret;
-@@ -8628,6 +8628,9 @@ static void ath11k_wmi_tlv_op_rx(struct
- case WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID:
- ath11k_wmi_pdev_csa_switch_count_status_event(ab, skb);
- break;
-+ case WMI_PDEV_UTF_EVENTID:
-+ ath11k_tm_wmi_event(ab, id, skb);
-+ break;
- case WMI_PDEV_TEMPERATURE_EVENTID:
- ath11k_wmi_pdev_temperature_event(ab, skb);
- break;
---- a/drivers/net/wireless/ath/ath11k/wmi.h
-+++ b/drivers/net/wireless/ath/ath11k/wmi.h
-@@ -1,6 +1,7 @@
- /* SPDX-License-Identifier: BSD-3-Clause-Clear */
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #ifndef ATH11K_WMI_H
-@@ -68,6 +69,7 @@ struct wmi_tlv {
-
- #define WMI_APPEND_TO_EXISTING_CHAN_LIST_FLAG 1
-
-+#define MAX_WMI_UTF_LEN 252
- #define WMI_BA_MODE_BUFFER_SIZE_256 3
- /*
- * HW mode config type replicated from FW header
-@@ -3564,6 +3566,24 @@ struct wmi_get_pdev_temperature_cmd {
- u32 pdev_id;
- } __packed;
-
-+struct wmi_ftm_seg_hdr {
-+ u32 len;
-+ u32 msgref;
-+ u32 segmentinfo;
-+ u32 pdev_id;
-+} __packed;
-+
-+struct wmi_ftm_cmd {
-+ u32 tlv_header;
-+ struct wmi_ftm_seg_hdr seg_hdr;
-+ u8 data[];
-+} __packed;
-+
-+struct wmi_ftm_event_msg {
-+ struct wmi_ftm_seg_hdr seg_hdr;
-+ u8 data[];
-+} __packed;
-+
- #define WMI_BEACON_TX_BUFFER_SIZE 512
-
- #define WMI_EMA_TMPL_IDX_SHIFT 8
-@@ -6300,6 +6320,8 @@ enum wmi_sta_keepalive_method {
- #define WMI_STA_KEEPALIVE_INTERVAL_DEFAULT 30
- #define WMI_STA_KEEPALIVE_INTERVAL_DISABLE 0
-
-+const void **ath11k_wmi_tlv_parse_alloc(struct ath11k_base *ab, const void *ptr,
-+ size_t len, gfp_t gfp);
- int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb,
- u32 cmd_id);
- struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc, u32 len);
---- a/drivers/net/wireless/ath/ath11k/wow.c
-+++ b/drivers/net/wireless/ath/ath11k/wow.c
-@@ -1,7 +1,7 @@
- // SPDX-License-Identifier: BSD-3-Clause-Clear
- /*
- * Copyright (c) 2020 The Linux Foundation. All rights reserved.
-- * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
-+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #include <linux/delay.h>
-@@ -838,6 +838,7 @@ exit:
- case ATH11K_STATE_RESTARTING:
- case ATH11K_STATE_RESTARTED:
- case ATH11K_STATE_WEDGED:
-+ case ATH11K_STATE_FTM:
- ath11k_warn(ar->ab, "encountered unexpected device state %d on resume, cannot recover\n",
- ar->state);
- ret = -EIO;
+++ /dev/null
-From 8aeba427296bff6a6051686f1d139c89a0b00e4c Mon Sep 17 00:00:00 2001
-From: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
-Date: Fri, 26 May 2023 12:41:07 +0300
-Subject: [PATCH 84/84] wifi: ath11k: Allow ath11k to boot without caldata in
- ftm mode
-
-Currently, if ath11k is unable to load the calibration data file it will
-always exit. However the calibration data may not be present in factory
-test mode, so update the logic to allow the driver to execute in FTM mode
-even if downloading the calibration data fails.
-
-Tested-on : IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
-Signed-off-by: Raj Kumar Bhagat <quic_rajkbhag@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230517135934.16408-5-quic_rajkbhag@quicinc.com
----
- drivers/net/wireless/ath/ath11k/qmi.c | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
---- a/drivers/net/wireless/ath/ath11k/qmi.c
-+++ b/drivers/net/wireless/ath/ath11k/qmi.c
-@@ -1,7 +1,7 @@
- // SPDX-License-Identifier: BSD-3-Clause-Clear
- /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
-- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
-+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
- */
-
- #include <linux/elf.h>
-@@ -2460,6 +2460,14 @@ static int ath11k_qmi_load_bdf_qmi(struc
-
- fw_entry = ath11k_core_firmware_request(ab, ATH11K_DEFAULT_CAL_FILE);
- if (IS_ERR(fw_entry)) {
-+ /* Caldata may not be present during first time calibration in
-+ * factory hence allow to boot without loading caldata in ftm mode
-+ */
-+ if (ath11k_ftm_mode) {
-+ ath11k_info(ab,
-+ "Booting without cal data file in factory test mode\n");
-+ return 0;
-+ }
- ret = PTR_ERR(fw_entry);
- ath11k_warn(ab,
- "qmi failed to load CAL data file:%s\n",
+++ /dev/null
-From 2d4f9093e2d8531ad0a2bb98fe5b36dc8addf2a2 Mon Sep 17 00:00:00 2001
-From: Nidhi Jain <quic_nidhjain@quicinc.com>
-Date: Fri, 26 May 2023 12:41:07 +0300
-Subject: [PATCH] wifi: ath11k: Add HTT stats for PHY reset case
-
-New HTT stats are added with stats type 37 to
-provide PHY reset stats and PHY reset counter stats.
-
-PHY reset stats are used to display the current
-PHY-related operation information such as band, CCA
-threshold, current operating channel etc.,
-
-PHY reset counter stats are used to display the
-PHY reset counter values like calibration counts,
-temperature based recalibration counts etc.,
-
-Usage:
-echo 37 > /sys/kernel/debug/ieee80211/phyX/ath11k/htt_stats_type
-cat /sys/kernel/debug/ieee80211/phyx/ath11k/htt_stats
-
-Output:
-
-HTT_PHY_RESET_STATS_TLV:
-pdev_id = 0
-chan_mhz = 5180
-chan_band_center_freq1 = 5210
-chan_band_center_freq2 = 0
-chan_phy_mode = 18
-chan_flags = 0x8
-chan_num = 36
-reset_cause = 0x50000
-prev_reset_cause = 0x50000
-phy_warm_reset_src = 0x0
-rx_gain_tbl_mode = 0
-xbar_val = 0xfac688
-force_calibration = 0
-phyrf_mode = 0
-phy_homechan = 0
-phy_tx_ch_mask = 0x3
-phy_rx_ch_mask = 0x3
-phybb_ini_mask = 0x5
-phyrf_ini_mask = 0x0
-phy_dfs_en_mask = 0x0
-phy_sscan_en_mask = 0x0
-phy_synth_sel_mask = 0x0
-phy_adfs_freq = 0
-cck_fir_settings = 0x0
-phy_dyn_pri_chan = 6
-cca_thresh = 0x26232020
-dyn_cca_status = 0
-rxdesense_thresh_hw = 0xcfe0afe
-rxdesense_thresh_sw = 0xcfe0afe
-
-HTT_PHY_RESET_COUNTERS_TLV:
-pdev_id = 0
-cf_active_low_fail_cnt = 0
-cf_active_low_pass_cnt = 0
-phy_off_through_vreg_cnt = 0
-force_calibration_cnt = 0
-rf_mode_switch_phy_off_cnt = 0
-
-Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
-
-Signed-off-by: Nidhi Jain <quic_nidhjain@quicinc.com>
-Signed-off-by: Maharaja Kennadyrajan <quic_mkenna@quicinc.com>
-Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
-Link: https://lore.kernel.org/r/20230517141242.2754293-1-quic_mkenna@quicinc.com
----
- .../wireless/ath/ath11k/debugfs_htt_stats.c | 114 ++++++++++++++++++
- .../wireless/ath/ath11k/debugfs_htt_stats.h | 43 +++++++
- 2 files changed, 157 insertions(+)
-
---- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c
-+++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c
-@@ -4011,6 +4011,114 @@ void htt_print_phy_stats_tlv(const void
- stats_req->buf_len = len;
- }
-
-+static inline void
-+htt_print_phy_reset_counters_tlv(const void *tag_buf,
-+ u16 tag_len,
-+ struct debug_htt_stats_req *stats_req)
-+{
-+ const struct htt_phy_reset_counters_tlv *htt_stats_buf = tag_buf;
-+ u8 *buf = stats_req->buf;
-+ u32 len = stats_req->buf_len;
-+ u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE;
-+
-+ if (tag_len < sizeof(*htt_stats_buf))
-+ return;
-+
-+ len += scnprintf(buf + len, buf_len - len, "HTT_PHY_RESET_COUNTERS_TLV:\n");
-+
-+ len += scnprintf(buf + len, buf_len - len, "pdev_id = %u\n",
-+ htt_stats_buf->pdev_id);
-+ len += scnprintf(buf + len, buf_len - len, "cf_active_low_fail_cnt = %u\n",
-+ htt_stats_buf->cf_active_low_fail_cnt);
-+ len += scnprintf(buf + len, buf_len - len, "cf_active_low_pass_cnt = %u\n",
-+ htt_stats_buf->cf_active_low_pass_cnt);
-+ len += scnprintf(buf + len, buf_len - len, "phy_off_through_vreg_cnt = %u\n",
-+ htt_stats_buf->phy_off_through_vreg_cnt);
-+ len += scnprintf(buf + len, buf_len - len, "force_calibration_cnt = %u\n",
-+ htt_stats_buf->force_calibration_cnt);
-+ len += scnprintf(buf + len, buf_len - len, "rf_mode_switch_phy_off_cnt = %u\n",
-+ htt_stats_buf->rf_mode_switch_phy_off_cnt);
-+
-+ stats_req->buf_len = len;
-+}
-+
-+static inline void
-+htt_print_phy_reset_stats_tlv(const void *tag_buf,
-+ u16 tag_len,
-+ struct debug_htt_stats_req *stats_req)
-+{
-+ const struct htt_phy_reset_stats_tlv *htt_stats_buf = tag_buf;
-+ u8 *buf = stats_req->buf;
-+ u32 len = stats_req->buf_len;
-+ u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE;
-+
-+ if (tag_len < sizeof(*htt_stats_buf))
-+ return;
-+
-+ len += scnprintf(buf + len, buf_len - len, "HTT_PHY_RESET_STATS_TLV:\n");
-+
-+ len += scnprintf(buf + len, buf_len - len, "pdev_id = %u\n",
-+ htt_stats_buf->pdev_id);
-+ len += scnprintf(buf + len, buf_len - len, "chan_mhz = %u\n",
-+ htt_stats_buf->chan_mhz);
-+ len += scnprintf(buf + len, buf_len - len, "chan_band_center_freq1 = %u\n",
-+ htt_stats_buf->chan_band_center_freq1);
-+ len += scnprintf(buf + len, buf_len - len, "chan_band_center_freq2 = %u\n",
-+ htt_stats_buf->chan_band_center_freq2);
-+ len += scnprintf(buf + len, buf_len - len, "chan_phy_mode = %u\n",
-+ htt_stats_buf->chan_phy_mode);
-+ len += scnprintf(buf + len, buf_len - len, "chan_flags = 0x%0x\n",
-+ htt_stats_buf->chan_flags);
-+ len += scnprintf(buf + len, buf_len - len, "chan_num = %u\n",
-+ htt_stats_buf->chan_num);
-+ len += scnprintf(buf + len, buf_len - len, "reset_cause = 0x%0x\n",
-+ htt_stats_buf->reset_cause);
-+ len += scnprintf(buf + len, buf_len - len, "prev_reset_cause = 0x%0x\n",
-+ htt_stats_buf->prev_reset_cause);
-+ len += scnprintf(buf + len, buf_len - len, "phy_warm_reset_src = 0x%0x\n",
-+ htt_stats_buf->phy_warm_reset_src);
-+ len += scnprintf(buf + len, buf_len - len, "rx_gain_tbl_mode = %d\n",
-+ htt_stats_buf->rx_gain_tbl_mode);
-+ len += scnprintf(buf + len, buf_len - len, "xbar_val = 0x%0x\n",
-+ htt_stats_buf->xbar_val);
-+ len += scnprintf(buf + len, buf_len - len, "force_calibration = %u\n",
-+ htt_stats_buf->force_calibration);
-+ len += scnprintf(buf + len, buf_len - len, "phyrf_mode = %u\n",
-+ htt_stats_buf->phyrf_mode);
-+ len += scnprintf(buf + len, buf_len - len, "phy_homechan = %u\n",
-+ htt_stats_buf->phy_homechan);
-+ len += scnprintf(buf + len, buf_len - len, "phy_tx_ch_mask = 0x%0x\n",
-+ htt_stats_buf->phy_tx_ch_mask);
-+ len += scnprintf(buf + len, buf_len - len, "phy_rx_ch_mask = 0x%0x\n",
-+ htt_stats_buf->phy_rx_ch_mask);
-+ len += scnprintf(buf + len, buf_len - len, "phybb_ini_mask = 0x%0x\n",
-+ htt_stats_buf->phybb_ini_mask);
-+ len += scnprintf(buf + len, buf_len - len, "phyrf_ini_mask = 0x%0x\n",
-+ htt_stats_buf->phyrf_ini_mask);
-+ len += scnprintf(buf + len, buf_len - len, "phy_dfs_en_mask = 0x%0x\n",
-+ htt_stats_buf->phy_dfs_en_mask);
-+ len += scnprintf(buf + len, buf_len - len, "phy_sscan_en_mask = 0x%0x\n",
-+ htt_stats_buf->phy_sscan_en_mask);
-+ len += scnprintf(buf + len, buf_len - len, "phy_synth_sel_mask = 0x%0x\n",
-+ htt_stats_buf->phy_synth_sel_mask);
-+ len += scnprintf(buf + len, buf_len - len, "phy_adfs_freq = %u\n",
-+ htt_stats_buf->phy_adfs_freq);
-+ len += scnprintf(buf + len, buf_len - len, "cck_fir_settings = 0x%0x\n",
-+ htt_stats_buf->cck_fir_settings);
-+ len += scnprintf(buf + len, buf_len - len, "phy_dyn_pri_chan = %u\n",
-+ htt_stats_buf->phy_dyn_pri_chan);
-+ len += scnprintf(buf + len, buf_len - len, "cca_thresh = 0x%0x\n",
-+ htt_stats_buf->cca_thresh);
-+ len += scnprintf(buf + len, buf_len - len, "dyn_cca_status = %u\n",
-+ htt_stats_buf->dyn_cca_status);
-+ len += scnprintf(buf + len, buf_len - len, "rxdesense_thresh_hw = 0x%x\n",
-+ htt_stats_buf->rxdesense_thresh_hw);
-+ len += scnprintf(buf + len, buf_len - len, "rxdesense_thresh_sw = 0x%x\n",
-+ htt_stats_buf->rxdesense_thresh_sw);
-+
-+ stats_req->buf_len = len;
-+}
-+
- static inline
- void htt_print_peer_ctrl_path_txrx_stats_tlv(const void *tag_buf,
- struct debug_htt_stats_req *stats_req)
-@@ -4425,6 +4533,12 @@ static int ath11k_dbg_htt_ext_stats_pars
- case HTT_STATS_PHY_STATS_TAG:
- htt_print_phy_stats_tlv(tag_buf, stats_req);
- break;
-+ case HTT_STATS_PHY_RESET_COUNTERS_TAG:
-+ htt_print_phy_reset_counters_tlv(tag_buf, len, stats_req);
-+ break;
-+ case HTT_STATS_PHY_RESET_STATS_TAG:
-+ htt_print_phy_reset_stats_tlv(tag_buf, len, stats_req);
-+ break;
- case HTT_STATS_PEER_CTRL_PATH_TXRX_STATS_TAG:
- htt_print_peer_ctrl_path_txrx_stats_tlv(tag_buf, stats_req);
- break;
---- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h
-+++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h
-@@ -111,6 +111,8 @@ enum htt_tlv_tag_t {
- HTT_STATS_TXBF_OFDMA_STEER_STATS_TAG = 116,
- HTT_STATS_PHY_COUNTERS_TAG = 121,
- HTT_STATS_PHY_STATS_TAG = 122,
-+ HTT_STATS_PHY_RESET_COUNTERS_TAG = 123,
-+ HTT_STATS_PHY_RESET_STATS_TAG = 124,
-
- HTT_STATS_MAX_TAG,
- };
-@@ -1964,6 +1966,47 @@ struct htt_phy_stats_tlv {
- u32 fw_run_time;
- };
-
-+struct htt_phy_reset_counters_tlv {
-+ u32 pdev_id;
-+ u32 cf_active_low_fail_cnt;
-+ u32 cf_active_low_pass_cnt;
-+ u32 phy_off_through_vreg_cnt;
-+ u32 force_calibration_cnt;
-+ u32 rf_mode_switch_phy_off_cnt;
-+};
-+
-+struct htt_phy_reset_stats_tlv {
-+ u32 pdev_id;
-+ u32 chan_mhz;
-+ u32 chan_band_center_freq1;
-+ u32 chan_band_center_freq2;
-+ u32 chan_phy_mode;
-+ u32 chan_flags;
-+ u32 chan_num;
-+ u32 reset_cause;
-+ u32 prev_reset_cause;
-+ u32 phy_warm_reset_src;
-+ u32 rx_gain_tbl_mode;
-+ u32 xbar_val;
-+ u32 force_calibration;
-+ u32 phyrf_mode;
-+ u32 phy_homechan;
-+ u32 phy_tx_ch_mask;
-+ u32 phy_rx_ch_mask;
-+ u32 phybb_ini_mask;
-+ u32 phyrf_ini_mask;
-+ u32 phy_dfs_en_mask;
-+ u32 phy_sscan_en_mask;
-+ u32 phy_synth_sel_mask;
-+ u32 phy_adfs_freq;
-+ u32 cck_fir_settings;
-+ u32 phy_dyn_pri_chan;
-+ u32 cca_thresh;
-+ u32 dyn_cca_status;
-+ u32 rxdesense_thresh_hw;
-+ u32 rxdesense_thresh_sw;
-+};
-+
- struct htt_peer_ctrl_path_txrx_stats_tlv {
- /* peer mac address */
- u8 peer_mac_addr[ETH_ALEN];
int ath11k_thermal_set_throttling(struct ath11k *ar, u32 throttle_state);
--- a/local-symbols
+++ b/local-symbols
-@@ -174,6 +174,7 @@ ATH11K_DEBUG=
+@@ -173,6 +173,7 @@ ATH11K_DEBUG=
ATH11K_DEBUGFS=
ATH11K_TRACING=
ATH11K_SPECTRAL=
+ATH11K_THERMAL=
- WLAN_VENDOR_ATMEL=
- ATMEL=
- PCI_ATMEL=
+ ATH12K=
+ ATH12K_DEBUG=
+ ATH12K_TRACING=
{
.hw_rev = ATH11K_HW_IPQ8074,
.name = "ipq8074 hw2.0",
-@@ -1953,7 +1953,8 @@ static void ath11k_core_reset(struct wor
+@@ -1954,7 +1954,8 @@ static void ath11k_core_reset(struct wor
static int ath11k_init_hw_params(struct ath11k_base *ab)
{
const struct ath11k_hw_params *hw_params = NULL;
for (i = 0; i < ARRAY_SIZE(ath11k_hw_params); i++) {
hw_params = &ath11k_hw_params[i];
-@@ -1969,7 +1970,30 @@ static int ath11k_init_hw_params(struct
+@@ -1970,7 +1971,30 @@ static int ath11k_init_hw_params(struct
ab->hw_params = *hw_params;
#endif
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
-@@ -6996,24 +6996,12 @@ static void ath11k_wmi_htc_tx_complete(s
+@@ -7059,24 +7059,12 @@ static void ath11k_wmi_htc_tx_complete(s
wake_up(&wmi->tx_ce_desc_wq);
}
int ret = 0, pdev_idx, i, j;
struct ath11k *ar;
-@@ -7075,17 +7063,7 @@ static int ath11k_reg_chan_list_event(st
+@@ -7140,17 +7128,7 @@ static int ath11k_reg_chan_list_event(st
(char *)reg_info->alpha2, 2))
goto mem_free;
+ ath_dbg(ath9k_hw_common(ah), RESET,
+ "reset MAC via external reset\n");
-- REG_WRITE(ah, AR_RTC_RESET, 1);
+- REG_WRITE(ah, AR_RTC_RESET(ah), 1);
+ err = ah->external_reset();
+ if (err) {
+ ath_err(ath9k_hw_common(ah),
}
+ if (AR_SREV_9550(ah)) {
-+ REG_WRITE(ah, AR_RTC_RESET, 0);
++ REG_WRITE(ah, AR_RTC_RESET(ah), 0);
+ udelay(10);
+ }
+
-+ REG_WRITE(ah, AR_RTC_RESET, 1);
++ REG_WRITE(ah, AR_RTC_RESET(ah), 1);
+ udelay(10);
+
return true;
+ if (AR_SREV_9300(ah) || AR_SREV_9580(ah))
+ REG_CLR_BIT(ah, AR_CFG, AR_CFG_HALT_REQ);
+
- REG_WRITE(ah, AR_RTC_RC, rst_flags);
+ REG_WRITE(ah, AR_RTC_RC(ah), rst_flags);
REGWRITE_BUFFER_FLUSH(ah);
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -88,7 +88,7 @@ int ath_descdma_setup(struct ath_softc *
+@@ -89,7 +89,7 @@ int ath_descdma_setup(struct ath_softc *
(_l) &= ((_sz) - 1); \
} while (0)
debugfs_create_devm_seqfile(sc->dev, "interrupt", sc->debug.debugfs_phy,
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
-@@ -149,6 +149,7 @@ struct ath_common {
+@@ -151,6 +151,7 @@ struct ath_common {
int debug_mask;
enum ath_device_state state;
unsigned long op_flags;
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -843,6 +843,9 @@ static inline int ath9k_dump_btcoex(stru
+@@ -844,6 +844,9 @@ static inline int ath9k_dump_btcoex(stru
#ifdef CPTCFG_MAC80211_LEDS
void ath_init_leds(struct ath_softc *sc);
void ath_deinit_leds(struct ath_softc *sc);
#else
static inline void ath_init_leds(struct ath_softc *sc)
{
-@@ -979,6 +982,13 @@ void ath_ant_comb_scan(struct ath_softc
+@@ -980,6 +983,13 @@ void ath_ant_comb_scan(struct ath_softc
#define ATH9K_NUM_CHANCTX 2 /* supports 2 operating channels */
struct ath_softc {
struct ieee80211_hw *hw;
struct device *dev;
-@@ -1032,9 +1042,8 @@ struct ath_softc {
+@@ -1033,9 +1043,8 @@ struct ath_softc {
spinlock_t chan_lock;
#ifdef CPTCFG_MAC80211_LEDS
+{
+ int i, j;
+
-+ REG_RMW_FIELD(ah, AR_PHY_TEST, AR_PHY_TEST_BBB_OBS_SEL, 1);
-+ REG_CLR_BIT(ah, AR_PHY_TEST, AR_PHY_TEST_RX_OBS_SEL_BIT5);
-+ REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, AR_PHY_TEST_CTL_RX_OBS_SEL, 0);
++ REG_RMW_FIELD(ah, AR_PHY_TEST(ah), AR_PHY_TEST_BBB_OBS_SEL, 1);
++ REG_CLR_BIT(ah, AR_PHY_TEST(ah), AR_PHY_TEST_RX_OBS_SEL_BIT5);
++ REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS(ah), AR_PHY_TEST_CTL_RX_OBS_SEL, 0);
+
+ memset(buf, 0, len);
+ for (i = 0; i < len; i++) {
---
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -24,6 +24,7 @@
+@@ -25,6 +25,7 @@
#include <linux/completion.h>
#include <linux/time.h>
#include <linux/hw_random.h>
#include "common.h"
#include "debug.h"
-@@ -989,6 +990,14 @@ struct ath_led {
+@@ -990,6 +991,14 @@ struct ath_led {
struct led_classdev cdev;
};
struct ath_softc {
struct ieee80211_hw *hw;
struct device *dev;
-@@ -1044,6 +1053,9 @@ struct ath_softc {
+@@ -1045,6 +1054,9 @@ struct ath_softc {
#ifdef CPTCFG_MAC80211_LEDS
const char *led_default_trigger;
struct list_head leds;
+ gchip);
+ struct ath_hw *ah = gc->sc->sc_ah;
+
-+ return !((REG_READ(ah, AR_GPIO_OE_OUT) >> (offset * 2)) & 3);
++ return !((REG_READ(ah, AR_GPIO_OE_OUT(ah)) >> (offset * 2)) & 3);
+}
+
+/* gpio_chip handler : get GPIO pin value */
---
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -1055,6 +1055,7 @@ struct ath_softc {
+@@ -1056,6 +1056,7 @@ struct ath_softc {
struct list_head leds;
#ifdef CONFIG_GPIOLIB
struct ath9k_gpio_chip *gpiochip;
--- a/local-symbols
+++ b/local-symbols
-@@ -129,6 +129,7 @@ ATH9K_WOW=
+@@ -128,6 +128,7 @@ ATH9K_WOW=
ATH9K_RFKILL=
ATH9K_CHANNEL_CONTEXT=
ATH9K_PCOEM=
};
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -25,6 +25,7 @@
+@@ -26,6 +26,7 @@
#include <linux/time.h>
#include <linux/hw_random.h>
#include <linux/gpio/driver.h>
#include "common.h"
#include "debug.h"
-@@ -1011,6 +1012,9 @@ struct ath_softc {
+@@ -1012,6 +1013,9 @@ struct ath_softc {
struct ath_hw *sc_ah;
void __iomem *mem;
int irq;
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -713,8 +713,36 @@ static struct wireless_dev *brcmf_cfg802
+@@ -979,8 +979,36 @@ static struct wireless_dev *brcmf_cfg802
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_pub *drvr = cfg->pub;
struct wireless_dev *wdev;
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
-@@ -2976,6 +2976,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
+@@ -3327,6 +3327,10 @@ brcmf_cfg80211_set_power_mgmt(struct wip
* preference in cfg struct to apply this to
* FW later while initializing the dongle
*/
void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
struct brcmf_mp_device *settings)
{
-@@ -106,6 +136,8 @@ void brcmf_of_probe(struct device *dev,
+@@ -113,6 +143,8 @@ void brcmf_of_probe(struct device *dev,
of_node_put(root);
}
#include "of.h"
static int brcmf_of_get_country_codes(struct device *dev,
-@@ -168,3 +169,38 @@ void brcmf_of_probe(struct device *dev,
+@@ -175,3 +176,38 @@ void brcmf_of_probe(struct device *dev,
sdio->oob_irq_nr = irq;
sdio->oob_irq_flags = irqf;
}
#define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500)
#define CTL_DONE_TIMEOUT msecs_to_jiffies(2500)
-@@ -634,7 +635,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b
+@@ -632,7 +633,7 @@ MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "b
/* per-board firmware binaries */
MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.bin");
BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x0000001F, 43241B0),
BRCMF_FW_ENTRY(BRCM_CC_43241_CHIP_ID, 0x00000020, 43241B4),
-@@ -662,6 +663,9 @@ static const struct brcmf_firmware_mappi
+@@ -660,6 +661,9 @@ static const struct brcmf_firmware_mappi
BRCMF_FW_ENTRY(CY_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752)
};
#define TXCTL_CREDITS 2
static void pkt_align(struct sk_buff *p, int len, int align)
-@@ -4193,6 +4197,9 @@ static const struct brcmf_bus_ops brcmf_
+@@ -4201,6 +4205,9 @@ static const struct brcmf_bus_ops brcmf_
#define BRCMF_SDIO_FW_NVRAM 1
#define BRCMF_SDIO_FW_CLM 2
static void brcmf_sdio_firmware_callback(struct device *dev, int err,
struct brcmf_fw_request *fwreq)
{
-@@ -4208,6 +4215,22 @@ static void brcmf_sdio_firmware_callback
+@@ -4216,6 +4223,22 @@ static void brcmf_sdio_firmware_callback
brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
if (err)
goto fail;
-@@ -4418,7 +4441,7 @@ brcmf_sdio_prepare_fw_request(struct brc
+@@ -4426,7 +4449,7 @@ brcmf_sdio_prepare_fw_request(struct brc
fwreq = brcmf_fw_alloc_request(bus->ci->chip, bus->ci->chiprev,
brcmf_sdio_fwnames,
fwnames, ARRAY_SIZE(fwnames));
if (!fwreq)
return NULL;
-@@ -4438,6 +4461,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
+@@ -4446,6 +4469,9 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
struct brcmf_sdio *bus;
struct workqueue_struct *wq;
struct brcmf_fw_request *fwreq;
brcmf_dbg(TRACE, "Enter\n");
-@@ -4520,6 +4546,21 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
+@@ -4528,6 +4554,21 @@ struct brcmf_sdio *brcmf_sdio_probe(stru
brcmf_dbg(INFO, "completed!!\n");
--- a/local-symbols
+++ b/local-symbols
-@@ -470,43 +470,6 @@ USB_VL600=
+@@ -491,43 +491,6 @@ USB_VL600=
USB_NET_CH9200=
USB_NET_AQC111=
USB_RTL8153_ECM=
depends on CORDIC
--- a/Kconfig.local
+++ b/Kconfig.local
-@@ -1414,117 +1414,6 @@ config BACKPORTED_USB_NET_AQC111
+@@ -1477,117 +1477,6 @@ config BACKPORTED_USB_NET_AQC111
config BACKPORTED_USB_RTL8153_ECM
tristate
default USB_RTL8153_ECM
---- a/drivers/net/wireless/mac80211_hwsim.c
-+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -5363,7 +5363,9 @@ static struct genl_family hwsim_genl_fam
+--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
++++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
+@@ -6179,7 +6179,9 @@ static struct genl_family hwsim_genl_fam
.module = THIS_MODULE,
.small_ops = hwsim_ops,
.n_small_ops = ARRAY_SIZE(hwsim_ops),
+#if LINUX_VERSION_IS_GEQ(6,1,0)
- .resv_start_op = HWSIM_CMD_DEL_MAC_ADDR + 1,
+ .resv_start_op = HWSIM_CMD_REPORT_PMSR + 1, // match with __HWSIM_CMD_MAX
+#endif
.mcgrps = hwsim_mcgrps,
.n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
};
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
-@@ -17233,7 +17233,9 @@ static struct genl_family nl80211_fam __
+@@ -17509,7 +17509,9 @@ static struct genl_family nl80211_fam __
.n_ops = ARRAY_SIZE(nl80211_ops),
.small_ops = nl80211_small_ops,
.n_small_ops = ARRAY_SIZE(nl80211_small_ops),
--- /dev/null
+--- a/net/wireless/sysfs.c
++++ b/net/wireless/sysfs.c
+@@ -154,7 +154,11 @@ static SIMPLE_DEV_PM_OPS(wiphy_pm_ops, w
+ #define WIPHY_PM_OPS NULL
+ #endif
+
++#if LINUX_VERSION_IS_GEQ(6,2,0)
+ static const void *wiphy_namespace(const struct device *d)
++#else
++static const void *wiphy_namespace(struct device *d)
++#endif
+ {
+ struct wiphy *wiphy = container_of(d, struct wiphy, dev);
+
+++ /dev/null
---- a/backport-include/linux/skbuff.h
-+++ b/backport-include/linux/skbuff.h
-@@ -144,4 +144,8 @@ static inline u64 skb_get_kcov_handle(st
- #define napi_build_skb build_skb
- #endif
-
-+#if LINUX_VERSION_IS_LESS(5,11,0)
-+#define napi_build_skb build_skb
-+#endif
-+
- #endif /* __BACKPORT_SKBUFF_H */
--- /dev/null
+From: Felix Fietkau <nbd@nbd.name>
+Date: Mon, 17 Apr 2023 19:42:38 +0200
+Subject: [PATCH] Revert "wifi: iwlwifi: Use generic thermal_zone_get_trip()
+ function"
+
+This reverts commit 3d2f20ad46f83b333025f5e8e4afc34be8f13c4c.
+---
+
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+@@ -531,7 +531,7 @@ struct iwl_mvm_tt_mgmt {
+ * @tzone: thermal zone device data
+ */
+ struct iwl_mvm_thermal_device {
+- struct thermal_trip trips[IWL_MAX_DTS_TRIPS];
++ s16 temp_trips[IWL_MAX_DTS_TRIPS];
+ u8 fw_trips_index[IWL_MAX_DTS_TRIPS];
+ struct thermal_zone_device *tzone;
+ };
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+@@ -573,11 +573,11 @@ int iwl_mvm_send_temp_report_ths_cmd(str
+ * and uncompressed, the FW should get it compressed and sorted
+ */
+
+- /* compress trips to cmd array, remove uninitialized values*/
++ /* compress temp_trips to cmd array, remove uninitialized values*/
+ for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) {
+- if (mvm->tz_device.trips[i].temperature != INT_MIN) {
++ if (mvm->tz_device.temp_trips[i] != S16_MIN) {
+ cmd.thresholds[idx++] =
+- cpu_to_le16((s16)(mvm->tz_device.trips[i].temperature / 1000));
++ cpu_to_le16(mvm->tz_device.temp_trips[i]);
+ }
+ }
+ cmd.num_temps = cpu_to_le32(idx);
+@@ -593,8 +593,8 @@ int iwl_mvm_send_temp_report_ths_cmd(str
+ */
+ for (i = 0; i < idx; i++) {
+ for (j = 0; j < IWL_MAX_DTS_TRIPS; j++) {
+- if ((int)(le16_to_cpu(cmd.thresholds[i]) * 1000) ==
+- mvm->tz_device.trips[j].temperature)
++ if (le16_to_cpu(cmd.thresholds[i]) ==
++ mvm->tz_device.temp_trips[j])
+ mvm->tz_device.fw_trips_index[i] = j;
+ }
+ }
+@@ -638,12 +638,37 @@ out:
+ return ret;
+ }
+
++static int iwl_mvm_tzone_get_trip_temp(struct thermal_zone_device *device,
++ int trip, int *temp)
++{
++ struct iwl_mvm *mvm = (struct iwl_mvm *)device->devdata;
++
++ if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS)
++ return -EINVAL;
++
++ *temp = mvm->tz_device.temp_trips[trip] * 1000;
++
++ return 0;
++}
++
++static int iwl_mvm_tzone_get_trip_type(struct thermal_zone_device *device,
++ int trip, enum thermal_trip_type *type)
++{
++ if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS)
++ return -EINVAL;
++
++ *type = THERMAL_TRIP_PASSIVE;
++
++ return 0;
++}
++
+ static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device,
+ int trip, int temp)
+ {
+ struct iwl_mvm *mvm = thermal_zone_device_priv(device);
+ struct iwl_mvm_thermal_device *tzone;
+- int ret;
++ int i, ret;
++ s16 temperature;
+
+ mutex_lock(&mvm->mutex);
+
+@@ -653,17 +678,40 @@ static int iwl_mvm_tzone_set_trip_temp(s
+ goto out;
+ }
+
++ if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) {
++ ret = -EINVAL;
++ goto out;
++ }
++
+ if ((temp / 1000) > S16_MAX) {
+ ret = -EINVAL;
+ goto out;
+ }
+
++ temperature = (s16)(temp / 1000);
+ tzone = &mvm->tz_device;
++
+ if (!tzone) {
+ ret = -EIO;
+ goto out;
+ }
+
++ /* no updates*/
++ if (tzone->temp_trips[trip] == temperature) {
++ ret = 0;
++ goto out;
++ }
++
++ /* already existing temperature */
++ for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) {
++ if (tzone->temp_trips[i] == temperature) {
++ ret = -EINVAL;
++ goto out;
++ }
++ }
++
++ tzone->temp_trips[trip] = temperature;
++
+ ret = iwl_mvm_send_temp_report_ths_cmd(mvm);
+ out:
+ mutex_unlock(&mvm->mutex);
+@@ -672,6 +720,8 @@ out:
+
+ static struct thermal_zone_device_ops tzone_ops = {
+ .get_temp = iwl_mvm_tzone_get_temp,
++ .get_trip_temp = iwl_mvm_tzone_get_trip_temp,
++ .get_trip_type = iwl_mvm_tzone_get_trip_type,
+ .set_trip_temp = iwl_mvm_tzone_set_trip_temp,
+ };
+
+@@ -693,8 +743,7 @@ static void iwl_mvm_thermal_zone_registe
+ BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH);
+
+ sprintf(name, "iwlwifi_%u", atomic_inc_return(&counter) & 0xFF);
+- mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name,
+- mvm->tz_device.trips,
++ mvm->tz_device.tzone = thermal_zone_device_register(name,
+ IWL_MAX_DTS_TRIPS,
+ IWL_WRITABLE_TRIPS_MSK,
+ mvm, &tzone_ops,
+@@ -717,10 +766,8 @@ static void iwl_mvm_thermal_zone_registe
+ /* 0 is a valid temperature,
+ * so initialize the array with S16_MIN which invalid temperature
+ */
+- for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) {
+- mvm->tz_device.trips[i].temperature = INT_MIN;
+- mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE;
+- }
++ for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++)
++ mvm->tz_device.temp_trips[i] = S16_MIN;
+ }
+
+ static int iwl_mvm_tcool_get_max_state(struct thermal_cooling_device *cdev,
--- /dev/null
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -16400,8 +16400,7 @@ static u32 nl80211_internal_flags[] = {
+ #undef SELECTOR
+ };
+
+-static int nl80211_pre_doit(const struct genl_split_ops *ops,
+- struct sk_buff *skb,
++static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb,
+ struct genl_info *info)
+ {
+ struct cfg80211_registered_device *rdev = NULL;
+@@ -16502,8 +16501,7 @@ out_unlock:
+ return err;
+ }
+
+-static void nl80211_post_doit(const struct genl_split_ops *ops,
+- struct sk_buff *skb,
++static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb,
+ struct genl_info *info)
+ {
+ u32 internal_flags = nl80211_internal_flags[ops->internal_flags];
--- a/drivers/net/wireless/marvell/libertas/cfg.c
+++ b/drivers/net/wireless/marvell/libertas/cfg.c
-@@ -2052,6 +2052,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
+@@ -2101,6 +2101,8 @@ struct wireless_dev *lbs_cfg_alloc(struc
goto err_wiphy_new;
}
--- a/drivers/net/wireless/marvell/libertas/cfg.c
+++ b/drivers/net/wireless/marvell/libertas/cfg.c
-@@ -2128,6 +2128,8 @@ int lbs_cfg_register(struct lbs_private
+@@ -2178,6 +2178,8 @@ int lbs_cfg_register(struct lbs_private
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
wdev->wiphy->reg_notifier = lbs_reg_notifier;
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
-@@ -1099,6 +1099,8 @@ void mwifiex_cancel_all_pending_cmd(stru
+@@ -1100,6 +1100,8 @@ void mwifiex_cancel_all_pending_cmd(stru
void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter);
void mwifiex_cancel_scan(struct mwifiex_adapter *adapter);
--- a/local-symbols
+++ b/local-symbols
-@@ -347,6 +347,7 @@ RT2X00_LIB_FIRMWARE=
+@@ -350,6 +350,7 @@ RT2X00_LIB_FIRMWARE=
RT2X00_LIB_CRYPTO=
RT2X00_LIB_LEDS=
RT2X00_LIB_DEBUGFS=
DECLARE_KFIFO_PTR(txstatus_fifo, u32);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1419,6 +1419,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
+@@ -1420,6 +1420,10 @@ int rt2x00lib_probe_dev(struct rt2x00_de
INIT_DELAYED_WORK(&rt2x00dev->autowakeup_work, rt2x00lib_autowakeup);
INIT_WORK(&rt2x00dev->sleep_work, rt2x00lib_sleep);
/*
* Let the driver probe the device to detect the capabilities.
*/
-@@ -1559,6 +1563,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
+@@ -1560,6 +1564,11 @@ void rt2x00lib_remove_dev(struct rt2x00_
* Free the driver data.
*/
kfree(rt2x00dev->drv_data);
#include "rt2x00.h"
#include "rt2800lib.h"
-@@ -11131,6 +11132,17 @@ static int rt2800_init_eeprom(struct rt2
+@@ -11129,6 +11130,17 @@ static int rt2800_init_eeprom(struct rt2
rt2800_init_led(rt2x00dev, &rt2x00dev->led_assoc, LED_TYPE_ASSOC);
rt2800_init_led(rt2x00dev, &rt2x00dev->led_qual, LED_TYPE_QUALITY);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -1358,7 +1358,7 @@ static inline void rt2x00lib_set_if_comb
+@@ -1359,7 +1359,7 @@ static inline void rt2x00lib_set_if_comb
*/
if_limit = &rt2x00dev->if_limits_ap;
if_limit->max = rt2x00dev->ops->max_ap_intf;
}
bbp = rt2800_bbp_read(rt2x00dev, 4);
-@@ -10583,6 +10624,7 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -10581,6 +10622,7 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
rt2800_r_calibration(rt2x00dev);
rt2800_rf_self_txdc_cal(rt2x00dev);
rt2800_rxdcoc_calibration(rt2x00dev);
-@@ -10590,6 +10632,22 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -10588,6 +10630,22 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_bw_filter_calibration(rt2x00dev, false);
rt2800_loft_iq_calibration(rt2x00dev);
rt2800_rxiq_calibration(rt2x00dev);
/* BBP for G band GLRT function (BBP_128 ~ BBP_221) */
rt2800_bbp_glrt_write(rt2x00dev, 0, 0x00);
-@@ -10408,31 +10436,36 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -10406,31 +10434,36 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write(rt2x00dev, 42, 0x5B);
rt2800_rfcsr_write(rt2x00dev, 43, 0x00);
/* Initialize RF channel register to default value */
rt2800_rfcsr_write_chanreg(rt2x00dev, 0, 0x03);
-@@ -10498,63 +10531,71 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -10496,63 +10529,71 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write_bank(rt2x00dev, 6, 45, 0xC5);
/* Initialize RF DC calibration register to default value */
rt2800_rfcsr_write_dccal(rt2x00dev, 0, 0x47);
-@@ -10617,12 +10658,17 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -10615,12 +10656,17 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write_dccal(rt2x00dev, 62, 0x00);
rt2800_rfcsr_write_dccal(rt2x00dev, 63, 0x00);
rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg);
if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX)))
-@@ -10688,30 +10617,143 @@ static void rt2800_init_rfcsr_6352(struc
+@@ -10686,30 +10615,143 @@ static void rt2800_init_rfcsr_6352(struc
rt2800_rfcsr_write_dccal(rt2x00dev, 5, 0x00);
rt2800_rfcsr_write_dccal(rt2x00dev, 17, 0x7C);
}
}
}
-@@ -10804,6 +10846,10 @@ int rt2800_enable_radio(struct rt2x00_de
+@@ -10802,6 +10844,10 @@ int rt2800_enable_radio(struct rt2x00_de
rt2800_init_bbp(rt2x00dev);
rt2800_init_rfcsr(rt2x00dev);
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
-@@ -1519,7 +1519,6 @@ static int ieee80211_stop_ap(struct wiph
+@@ -1632,7 +1632,6 @@ static int ieee80211_stop_ap(struct wiph
link_conf->bssid_indicator = 0;
__sta_info_flush(sdata, true);
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
-@@ -2727,6 +2727,8 @@ static int ieee80211_scan(struct wiphy *
+@@ -2843,6 +2843,8 @@ static int ieee80211_scan(struct wiphy *
*/
fallthrough;
case NL80211_IFTYPE_AP:
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
-@@ -554,6 +554,7 @@ __sta_info_alloc(struct ieee80211_sub_if
+@@ -558,6 +558,7 @@ __sta_info_alloc(struct ieee80211_sub_if
INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames);
INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
mutex_init(&sta->ampdu_mlme.mtx);
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
-@@ -90,6 +90,8 @@ extern const u8 ieee80211_ac_to_qos_mask
+@@ -92,6 +92,8 @@ extern const u8 ieee80211_ac_to_qos_mask
*/
#define AIRTIME_ACTIVE_DURATION (HZ / 10)
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
-@@ -3984,7 +3984,7 @@ struct ieee80211_txq *ieee80211_next_txq
+@@ -4059,7 +4059,7 @@ struct ieee80211_txq *ieee80211_next_txq
if (deficit < 0)
sta->airtime[txqi->txq.ac].deficit +=
if (deficit < 0 || !aql_check) {
list_move_tail(&txqi->schedule_order,
-@@ -4127,7 +4127,8 @@ bool ieee80211_txq_may_transmit(struct i
+@@ -4202,7 +4202,8 @@ bool ieee80211_txq_may_transmit(struct i
}
sta = container_of(iter->txq.sta, struct sta_info, sta);
if (ieee80211_sta_deficit(sta, ac) < 0)
list_move_tail(&iter->schedule_order, &local->active_txqs[ac]);
}
-@@ -4135,7 +4136,7 @@ bool ieee80211_txq_may_transmit(struct i
+@@ -4210,7 +4211,7 @@ bool ieee80211_txq_may_transmit(struct i
if (sta->airtime[ac].deficit >= 0)
goto out;
+++ /dev/null
-From: Alexander Wetzel <alexander@wetzel-home.de>
-Date: Sun, 9 Oct 2022 18:30:38 +0200
-Subject: [PATCH] wifi: mac80211: add internal handler for wake_tx_queue
-
-Start to align the TX handling to only use internal TX queues (iTXQs):
-
-Provide a handler for drivers not having a custom wake_tx_queue
-callback and update the documentation.
-
-Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -89,15 +89,13 @@
- /**
- * DOC: mac80211 software tx queueing
- *
-- * mac80211 provides an optional intermediate queueing implementation designed
-- * to allow the driver to keep hardware queues short and provide some fairness
-- * between different stations/interfaces.
-- * In this model, the driver pulls data frames from the mac80211 queue instead
-- * of letting mac80211 push them via drv_tx().
-- * Other frames (e.g. control or management) are still pushed using drv_tx().
-+ * mac80211 uses an intermediate queueing implementation, designed to allow the
-+ * driver to keep hardware queues short and to provide some fairness between
-+ * different stations/interfaces.
- *
-- * Drivers indicate that they use this model by implementing the .wake_tx_queue
-- * driver operation.
-+ * Drivers must provide the .wake_tx_queue driver operation by either
-+ * linking it to ieee80211_handle_wake_tx_queue() or implementing a custom
-+ * handler.
- *
- * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with
- * another per-sta for non-data/non-mgmt and bufferable management frames, and
-@@ -106,9 +104,12 @@
- * The driver is expected to initialize its private per-queue data for stations
- * and interfaces in the .add_interface and .sta_add ops.
- *
-- * The driver can't access the queue directly. To dequeue a frame from a
-- * txq, it calls ieee80211_tx_dequeue(). Whenever mac80211 adds a new frame to a
-- * queue, it calls the .wake_tx_queue driver op.
-+ * The driver can't access the internal TX queues (iTXQs) directly.
-+ * Whenever mac80211 adds a new frame to a queue, it calls the .wake_tx_queue
-+ * driver op.
-+ * Drivers implementing a custom .wake_tx_queue op can get them by calling
-+ * ieee80211_tx_dequeue(). Drivers using ieee80211_handle_wake_tx_queue() will
-+ * simply get the individual frames pushed via the .tx driver operation.
- *
- * Drivers can optionally delegate responsibility for scheduling queues to
- * mac80211, to take advantage of airtime fairness accounting. In this case, to
-@@ -2248,8 +2249,8 @@ struct ieee80211_link_sta {
- * For non MLO STA it will point to the deflink data. For MLO STA
- * ieee80211_sta_recalc_aggregates() must be called to update it.
- * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not.
-- * @txq: per-TID data TX queues (if driver uses the TXQ abstraction); note that
-- * the last entry (%IEEE80211_NUM_TIDS) is used for non-data frames
-+ * @txq: per-TID data TX queues; note that the last entry (%IEEE80211_NUM_TIDS)
-+ * is used for non-data frames
- * @deflink: This holds the default link STA information, for non MLO STA all link
- * specific STA information is accessed through @deflink or through
- * link[0] which points to address of @deflink. For MLO Link STA
-@@ -5687,7 +5688,7 @@ void ieee80211_key_replay(struct ieee802
- * @hw: pointer as obtained from ieee80211_alloc_hw().
- * @queue: queue number (counted from zero).
- *
-- * Drivers should use this function instead of netif_wake_queue.
-+ * Drivers must use this function instead of netif_wake_queue.
- */
- void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
-
-@@ -5696,7 +5697,7 @@ void ieee80211_wake_queue(struct ieee802
- * @hw: pointer as obtained from ieee80211_alloc_hw().
- * @queue: queue number (counted from zero).
- *
-- * Drivers should use this function instead of netif_stop_queue.
-+ * Drivers must use this function instead of netif_stop_queue.
- */
- void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
-
-@@ -5705,7 +5706,7 @@ void ieee80211_stop_queue(struct ieee802
- * @hw: pointer as obtained from ieee80211_alloc_hw().
- * @queue: queue number (counted from zero).
- *
-- * Drivers should use this function instead of netif_stop_queue.
-+ * Drivers must use this function instead of netif_queue_stopped.
- *
- * Return: %true if the queue is stopped. %false otherwise.
- */
-@@ -5716,7 +5717,7 @@ int ieee80211_queue_stopped(struct ieee8
- * ieee80211_stop_queues - stop all queues
- * @hw: pointer as obtained from ieee80211_alloc_hw().
- *
-- * Drivers should use this function instead of netif_stop_queue.
-+ * Drivers must use this function instead of netif_tx_stop_all_queues.
- */
- void ieee80211_stop_queues(struct ieee80211_hw *hw);
-
-@@ -5724,7 +5725,7 @@ void ieee80211_stop_queues(struct ieee80
- * ieee80211_wake_queues - wake all queues
- * @hw: pointer as obtained from ieee80211_alloc_hw().
- *
-- * Drivers should use this function instead of netif_wake_queue.
-+ * Drivers must use this function instead of netif_tx_wake_all_queues.
- */
- void ieee80211_wake_queues(struct ieee80211_hw *hw);
-
-@@ -6946,6 +6947,18 @@ static inline struct sk_buff *ieee80211_
- }
-
- /**
-+ * ieee80211_handle_wake_tx_queue - mac80211 handler for wake_tx_queue callback
-+ *
-+ * @hw: pointer as obtained from wake_tx_queue() callback().
-+ * @txq: pointer as obtained from wake_tx_queue() callback().
-+ *
-+ * Drivers can use this function for the mandatory mac80211 wake_tx_queue
-+ * callback in struct ieee80211_ops. They should not call this function.
-+ */
-+void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,
-+ struct ieee80211_txq *txq);
-+
-+/**
- * ieee80211_next_txq - get next tx queue to pull packets from
- *
- * @hw: pointer as obtained from ieee80211_alloc_hw()
---- a/net/mac80211/util.c
-+++ b/net/mac80211/util.c
-@@ -288,6 +288,52 @@ __le16 ieee80211_ctstoself_duration(stru
- }
- EXPORT_SYMBOL(ieee80211_ctstoself_duration);
-
-+static void wake_tx_push_queue(struct ieee80211_local *local,
-+ struct ieee80211_sub_if_data *sdata,
-+ struct ieee80211_txq *queue)
-+{
-+ int q = sdata->vif.hw_queue[queue->ac];
-+ struct ieee80211_tx_control control = {
-+ .sta = queue->sta,
-+ };
-+ struct sk_buff *skb;
-+ unsigned long flags;
-+ bool q_stopped;
-+
-+ while (1) {
-+ spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
-+ q_stopped = local->queue_stop_reasons[q];
-+ spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
-+
-+ if (q_stopped)
-+ break;
-+
-+ skb = ieee80211_tx_dequeue(&local->hw, queue);
-+ if (!skb)
-+ break;
-+
-+ drv_tx(local, &control, skb);
-+ }
-+}
-+
-+/* wake_tx_queue handler for driver not implementing a custom one*/
-+void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,
-+ struct ieee80211_txq *txq)
-+{
-+ struct ieee80211_local *local = hw_to_local(hw);
-+ struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif);
-+ struct ieee80211_txq *queue;
-+
-+ /* Use ieee80211_next_txq() for airtime fairness accounting */
-+ ieee80211_txq_schedule_start(hw, txq->ac);
-+ while ((queue = ieee80211_next_txq(hw, txq->ac))) {
-+ wake_tx_push_queue(local, sdata, queue);
-+ ieee80211_return_txq(hw, queue, false);
-+ }
-+ ieee80211_txq_schedule_end(hw, txq->ac);
-+}
-+EXPORT_SYMBOL(ieee80211_handle_wake_tx_queue);
-+
- static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
- {
- struct ieee80211_local *local = sdata->local;
+++ /dev/null
-From: Alexander Wetzel <alexander@wetzel-home.de>
-Date: Sun, 9 Oct 2022 18:30:39 +0200
-Subject: [PATCH] wifi: mac80211: add wake_tx_queue callback to drivers
-
-mac80211 is fully switching over to the internal TX queue (iTXQ)
-implementation. Update all drivers not yet providing the now mandatory
-wake_tx_queue() callback.
-
-As an side effect the netdev interfaces of all updated drivers will
-switch to the noqueue qdisc.
-
-Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
-[add staging drivers]
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/drivers/net/wireless/admtek/adm8211.c
-+++ b/drivers/net/wireless/admtek/adm8211.c
-@@ -1760,6 +1760,7 @@ static int adm8211_alloc_rings(struct ie
-
- static const struct ieee80211_ops adm8211_ops = {
- .tx = adm8211_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = adm8211_start,
- .stop = adm8211_stop,
- .add_interface = adm8211_add_interface,
---- a/drivers/net/wireless/ath/ar5523/ar5523.c
-+++ b/drivers/net/wireless/ath/ar5523/ar5523.c
-@@ -1361,6 +1361,7 @@ static const struct ieee80211_ops ar5523
- .start = ar5523_start,
- .stop = ar5523_stop,
- .tx = ar5523_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .set_rts_threshold = ar5523_set_rts_threshold,
- .add_interface = ar5523_add_interface,
- .remove_interface = ar5523_remove_interface,
---- a/drivers/net/wireless/ath/ath11k/mac.c
-+++ b/drivers/net/wireless/ath/ath11k/mac.c
-@@ -8587,6 +8587,7 @@ err_fallback:
-
- static const struct ieee80211_ops ath11k_ops = {
- .tx = ath11k_mac_op_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = ath11k_mac_op_start,
- .stop = ath11k_mac_op_stop,
- .reconfig_complete = ath11k_mac_op_reconfig_complete,
---- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
-+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
-@@ -781,6 +781,7 @@ static int ath5k_set_ringparam(struct ie
-
- const struct ieee80211_ops ath5k_hw_ops = {
- .tx = ath5k_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = ath5k_start,
- .stop = ath5k_stop,
- .add_interface = ath5k_add_interface,
---- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
-+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
-@@ -1870,6 +1870,7 @@ static void ath9k_htc_channel_switch_bea
-
- struct ieee80211_ops ath9k_htc_ops = {
- .tx = ath9k_htc_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = ath9k_htc_start,
- .stop = ath9k_htc_stop,
- .add_interface = ath9k_htc_add_interface,
---- a/drivers/net/wireless/ath/carl9170/main.c
-+++ b/drivers/net/wireless/ath/carl9170/main.c
-@@ -1715,6 +1715,7 @@ static const struct ieee80211_ops carl91
- .start = carl9170_op_start,
- .stop = carl9170_op_stop,
- .tx = carl9170_op_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .flush = carl9170_op_flush,
- .add_interface = carl9170_op_add_interface,
- .remove_interface = carl9170_op_remove_interface,
---- a/drivers/net/wireless/ath/wcn36xx/main.c
-+++ b/drivers/net/wireless/ath/wcn36xx/main.c
-@@ -1362,6 +1362,7 @@ static const struct ieee80211_ops wcn36x
- .prepare_multicast = wcn36xx_prepare_multicast,
- .configure_filter = wcn36xx_configure_filter,
- .tx = wcn36xx_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .set_key = wcn36xx_set_key,
- .hw_scan = wcn36xx_hw_scan,
- .cancel_hw_scan = wcn36xx_cancel_hw_scan,
---- a/drivers/net/wireless/atmel/at76c50x-usb.c
-+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
-@@ -2187,6 +2187,7 @@ static int at76_set_key(struct ieee80211
-
- static const struct ieee80211_ops at76_ops = {
- .tx = at76_mac80211_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .add_interface = at76_add_interface,
- .remove_interface = at76_remove_interface,
- .config = at76_config,
---- a/drivers/net/wireless/broadcom/b43/main.c
-+++ b/drivers/net/wireless/broadcom/b43/main.c
-@@ -5171,6 +5171,7 @@ static int b43_op_get_survey(struct ieee
-
- static const struct ieee80211_ops b43_hw_ops = {
- .tx = b43_op_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .conf_tx = b43_op_conf_tx,
- .add_interface = b43_op_add_interface,
- .remove_interface = b43_op_remove_interface,
---- a/drivers/net/wireless/broadcom/b43legacy/main.c
-+++ b/drivers/net/wireless/broadcom/b43legacy/main.c
-@@ -3532,6 +3532,7 @@ static int b43legacy_op_get_survey(struc
-
- static const struct ieee80211_ops b43legacy_hw_ops = {
- .tx = b43legacy_op_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .conf_tx = b43legacy_op_conf_tx,
- .add_interface = b43legacy_op_add_interface,
- .remove_interface = b43legacy_op_remove_interface,
---- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
-@@ -962,6 +962,7 @@ static int brcms_ops_beacon_set_tim(stru
-
- static const struct ieee80211_ops brcms_ops = {
- .tx = brcms_ops_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = brcms_ops_start,
- .stop = brcms_ops_stop,
- .add_interface = brcms_ops_add_interface,
---- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c
-+++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
-@@ -3439,6 +3439,7 @@ static const struct attribute_group il39
-
- static struct ieee80211_ops il3945_mac_ops __ro_after_init = {
- .tx = il3945_mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = il3945_mac_start,
- .stop = il3945_mac_stop,
- .add_interface = il_mac_add_interface,
---- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
-+++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
-@@ -6308,6 +6308,7 @@ il4965_tx_queue_set_status(struct il_pri
-
- static const struct ieee80211_ops il4965_mac_ops = {
- .tx = il4965_mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = il4965_mac_start,
- .stop = il4965_mac_stop,
- .add_interface = il_mac_add_interface,
---- a/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
-+++ b/drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c
-@@ -1571,6 +1571,7 @@ static void iwlagn_mac_sta_notify(struct
-
- const struct ieee80211_ops iwlagn_hw_ops = {
- .tx = iwlagn_mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = iwlagn_mac_start,
- .stop = iwlagn_mac_stop,
- #ifdef CONFIG_PM_SLEEP
---- a/drivers/net/wireless/intersil/p54/main.c
-+++ b/drivers/net/wireless/intersil/p54/main.c
-@@ -705,6 +705,7 @@ static void p54_set_coverage_class(struc
-
- static const struct ieee80211_ops p54_ops = {
- .tx = p54_tx_80211,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = p54_start,
- .stop = p54_stop,
- .add_interface = p54_add_interface,
---- a/drivers/net/wireless/mac80211_hwsim.c
-+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -3109,6 +3109,7 @@ static int mac80211_hwsim_change_sta_lin
-
- #define HWSIM_COMMON_OPS \
- .tx = mac80211_hwsim_tx, \
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue, \
- .start = mac80211_hwsim_start, \
- .stop = mac80211_hwsim_stop, \
- .add_interface = mac80211_hwsim_add_interface, \
---- a/drivers/net/wireless/marvell/libertas_tf/main.c
-+++ b/drivers/net/wireless/marvell/libertas_tf/main.c
-@@ -474,6 +474,7 @@ static int lbtf_op_get_survey(struct iee
-
- static const struct ieee80211_ops lbtf_ops = {
- .tx = lbtf_op_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = lbtf_op_start,
- .stop = lbtf_op_stop,
- .add_interface = lbtf_op_add_interface,
---- a/drivers/net/wireless/marvell/mwl8k.c
-+++ b/drivers/net/wireless/marvell/mwl8k.c
-@@ -5611,6 +5611,7 @@ static void mwl8k_sw_scan_complete(struc
-
- static const struct ieee80211_ops mwl8k_ops = {
- .tx = mwl8k_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = mwl8k_start,
- .stop = mwl8k_stop,
- .add_interface = mwl8k_add_interface,
---- a/drivers/net/wireless/mediatek/mt7601u/main.c
-+++ b/drivers/net/wireless/mediatek/mt7601u/main.c
-@@ -406,6 +406,7 @@ out:
-
- const struct ieee80211_ops mt7601u_ops = {
- .tx = mt7601u_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = mt7601u_start,
- .stop = mt7601u_stop,
- .add_interface = mt7601u_add_interface,
---- a/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2400pci.c
-@@ -1706,6 +1706,7 @@ static int rt2400pci_tx_last_beacon(stru
-
- static const struct ieee80211_ops rt2400pci_mac80211_ops = {
- .tx = rt2x00mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rt2x00mac_start,
- .stop = rt2x00mac_stop,
- .add_interface = rt2x00mac_add_interface,
---- a/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2500pci.c
-@@ -2004,6 +2004,7 @@ static int rt2500pci_tx_last_beacon(stru
-
- static const struct ieee80211_ops rt2500pci_mac80211_ops = {
- .tx = rt2x00mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rt2x00mac_start,
- .stop = rt2x00mac_stop,
- .add_interface = rt2x00mac_add_interface,
---- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
-@@ -1795,6 +1795,7 @@ static int rt2500usb_probe_hw(struct rt2
-
- static const struct ieee80211_ops rt2500usb_mac80211_ops = {
- .tx = rt2x00mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rt2x00mac_start,
- .stop = rt2x00mac_stop,
- .add_interface = rt2x00mac_add_interface,
---- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
-@@ -288,6 +288,7 @@ static int rt2800pci_read_eeprom(struct
-
- static const struct ieee80211_ops rt2800pci_mac80211_ops = {
- .tx = rt2x00mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rt2x00mac_start,
- .stop = rt2x00mac_stop,
- .add_interface = rt2x00mac_add_interface,
---- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
-@@ -133,6 +133,7 @@ static int rt2800soc_write_firmware(stru
-
- static const struct ieee80211_ops rt2800soc_mac80211_ops = {
- .tx = rt2x00mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rt2x00mac_start,
- .stop = rt2x00mac_stop,
- .add_interface = rt2x00mac_add_interface,
---- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
-@@ -630,6 +630,7 @@ static int rt2800usb_probe_hw(struct rt2
-
- static const struct ieee80211_ops rt2800usb_mac80211_ops = {
- .tx = rt2x00mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rt2x00mac_start,
- .stop = rt2x00mac_stop,
- .add_interface = rt2x00mac_add_interface,
---- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
-@@ -2873,6 +2873,7 @@ static u64 rt61pci_get_tsf(struct ieee80
-
- static const struct ieee80211_ops rt61pci_mac80211_ops = {
- .tx = rt2x00mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rt2x00mac_start,
- .stop = rt2x00mac_stop,
- .add_interface = rt2x00mac_add_interface,
---- a/drivers/net/wireless/ralink/rt2x00/rt73usb.c
-+++ b/drivers/net/wireless/ralink/rt2x00/rt73usb.c
-@@ -2292,6 +2292,7 @@ static u64 rt73usb_get_tsf(struct ieee80
-
- static const struct ieee80211_ops rt73usb_mac80211_ops = {
- .tx = rt2x00mac_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rt2x00mac_start,
- .stop = rt2x00mac_stop,
- .add_interface = rt2x00mac_add_interface,
---- a/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
-+++ b/drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c
-@@ -1608,6 +1608,7 @@ static void rtl8180_configure_filter(str
-
- static const struct ieee80211_ops rtl8180_ops = {
- .tx = rtl8180_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rtl8180_start,
- .stop = rtl8180_stop,
- .add_interface = rtl8180_add_interface,
---- a/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c
-+++ b/drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c
-@@ -1378,6 +1378,7 @@ static int rtl8187_conf_tx(struct ieee80
-
- static const struct ieee80211_ops rtl8187_ops = {
- .tx = rtl8187_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rtl8187_start,
- .stop = rtl8187_stop,
- .add_interface = rtl8187_add_interface,
---- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
-+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
-@@ -6548,6 +6548,7 @@ static void rtl8xxxu_stop(struct ieee802
-
- static const struct ieee80211_ops rtl8xxxu_ops = {
- .tx = rtl8xxxu_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .add_interface = rtl8xxxu_add_interface,
- .remove_interface = rtl8xxxu_remove_interface,
- .config = rtl8xxxu_config,
---- a/drivers/net/wireless/realtek/rtlwifi/core.c
-+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
-@@ -1912,6 +1912,7 @@ const struct ieee80211_ops rtl_ops = {
- .start = rtl_op_start,
- .stop = rtl_op_stop,
- .tx = rtl_op_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .add_interface = rtl_op_add_interface,
- .remove_interface = rtl_op_remove_interface,
- .change_interface = rtl_op_change_interface,
---- a/drivers/net/wireless/realtek/rtw88/mac80211.c
-+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
-@@ -896,6 +896,7 @@ static void rtw_ops_sta_rc_update(struct
-
- const struct ieee80211_ops rtw_ops = {
- .tx = rtw_ops_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .wake_tx_queue = rtw_ops_wake_tx_queue,
- .start = rtw_ops_start,
- .stop = rtw_ops_stop,
---- a/drivers/net/wireless/realtek/rtw89/mac80211.c
-+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
-@@ -918,6 +918,7 @@ static int rtw89_ops_set_tid_config(stru
-
- const struct ieee80211_ops rtw89_ops = {
- .tx = rtw89_ops_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .wake_tx_queue = rtw89_ops_wake_tx_queue,
- .start = rtw89_ops_start,
- .stop = rtw89_ops_stop,
---- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
-+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
-@@ -1958,6 +1958,7 @@ static int rsi_mac80211_resume(struct ie
-
- static const struct ieee80211_ops mac80211_ops = {
- .tx = rsi_mac80211_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = rsi_mac80211_start,
- .stop = rsi_mac80211_stop,
- .add_interface = rsi_mac80211_add_interface,
---- a/drivers/net/wireless/st/cw1200/main.c
-+++ b/drivers/net/wireless/st/cw1200/main.c
-@@ -209,6 +209,7 @@ static const struct ieee80211_ops cw1200
- .remove_interface = cw1200_remove_interface,
- .change_interface = cw1200_change_interface,
- .tx = cw1200_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .hw_scan = cw1200_hw_scan,
- .set_tim = cw1200_set_tim,
- .sta_notify = cw1200_sta_notify,
---- a/drivers/net/wireless/ti/wl1251/main.c
-+++ b/drivers/net/wireless/ti/wl1251/main.c
-@@ -1359,6 +1359,7 @@ static const struct ieee80211_ops wl1251
- .prepare_multicast = wl1251_op_prepare_multicast,
- .configure_filter = wl1251_op_configure_filter,
- .tx = wl1251_op_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .set_key = wl1251_op_set_key,
- .hw_scan = wl1251_op_hw_scan,
- .bss_info_changed = wl1251_op_bss_info_changed,
---- a/drivers/net/wireless/ti/wlcore/main.c
-+++ b/drivers/net/wireless/ti/wlcore/main.c
-@@ -5942,6 +5942,7 @@ static const struct ieee80211_ops wl1271
- .prepare_multicast = wl1271_op_prepare_multicast,
- .configure_filter = wl1271_op_configure_filter,
- .tx = wl1271_op_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .set_key = wlcore_op_set_key,
- .hw_scan = wl1271_op_hw_scan,
- .cancel_hw_scan = wl1271_op_cancel_hw_scan,
---- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c
-+++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c
-@@ -1344,6 +1344,7 @@ static u64 zd_op_get_tsf(struct ieee8021
-
- static const struct ieee80211_ops zd_ops = {
- .tx = zd_op_tx,
-+ .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .start = zd_op_start,
- .stop = zd_op_stop,
- .add_interface = zd_op_add_interface,
+++ /dev/null
-From: Alexander Wetzel <alexander@wetzel-home.de>
-Date: Sun, 9 Oct 2022 18:30:40 +0200
-Subject: [PATCH] wifi: mac80211: Drop support for TX push path
-
-All drivers are now using mac80211 internal queues (iTXQs).
-Drop mac80211 internal support for the old push path.
-
-Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -4346,9 +4346,6 @@ static int ieee80211_get_txq_stats(struc
- struct ieee80211_sub_if_data *sdata;
- int ret = 0;
-
-- if (!local->ops->wake_tx_queue)
-- return 1;
--
- spin_lock_bh(&local->fq.lock);
- rcu_read_lock();
-
---- a/net/mac80211/debugfs.c
-+++ b/net/mac80211/debugfs.c
-@@ -663,9 +663,7 @@ void debugfs_hw_add(struct ieee80211_loc
- DEBUGFS_ADD_MODE(force_tx_status, 0600);
- DEBUGFS_ADD_MODE(aql_enable, 0600);
- DEBUGFS_ADD(aql_pending);
--
-- if (local->ops->wake_tx_queue)
-- DEBUGFS_ADD_MODE(aqm, 0600);
-+ DEBUGFS_ADD_MODE(aqm, 0600);
-
- DEBUGFS_ADD_MODE(airtime_flags, 0600);
-
---- a/net/mac80211/debugfs_netdev.c
-+++ b/net/mac80211/debugfs_netdev.c
-@@ -677,8 +677,7 @@ static void add_common_files(struct ieee
- DEBUGFS_ADD(rc_rateidx_vht_mcs_mask_5ghz);
- DEBUGFS_ADD(hw_queues);
-
-- if (sdata->local->ops->wake_tx_queue &&
-- sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
-+ if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
- sdata->vif.type != NL80211_IFTYPE_NAN)
- DEBUGFS_ADD(aqm);
- }
---- a/net/mac80211/debugfs_sta.c
-+++ b/net/mac80211/debugfs_sta.c
-@@ -1057,10 +1057,8 @@ void ieee80211_sta_debugfs_add(struct st
- DEBUGFS_ADD_COUNTER(rx_fragments, deflink.rx_stats.fragments);
- DEBUGFS_ADD_COUNTER(tx_filtered, deflink.status_stats.filtered);
-
-- if (local->ops->wake_tx_queue) {
-- DEBUGFS_ADD(aqm);
-- DEBUGFS_ADD(airtime);
-- }
-+ DEBUGFS_ADD(aqm);
-+ DEBUGFS_ADD(airtime);
-
- if (wiphy_ext_feature_isset(local->hw.wiphy,
- NL80211_EXT_FEATURE_AQL))
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -2294,7 +2294,6 @@ void ieee80211_wake_queue_by_reason(stru
- void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
- enum queue_stop_reason reason,
- bool refcounted);
--void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue);
- void ieee80211_add_pending_skb(struct ieee80211_local *local,
- struct sk_buff *skb);
- void ieee80211_add_pending_skbs(struct ieee80211_local *local,
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -460,12 +460,6 @@ static void ieee80211_do_stop(struct iee
- if (cancel_scan)
- ieee80211_scan_cancel(local);
-
-- /*
-- * Stop TX on this interface first.
-- */
-- if (!local->ops->wake_tx_queue && sdata->dev)
-- netif_tx_stop_all_queues(sdata->dev);
--
- ieee80211_roc_purge(local, sdata);
-
- switch (sdata->vif.type) {
-@@ -813,13 +807,6 @@ static void ieee80211_uninit(struct net_
- ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev));
- }
-
--static u16 ieee80211_netdev_select_queue(struct net_device *dev,
-- struct sk_buff *skb,
-- struct net_device *sb_dev)
--{
-- return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
--}
--
- static void
- ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
- {
-@@ -833,7 +820,6 @@ static const struct net_device_ops ieee8
- .ndo_start_xmit = ieee80211_subif_start_xmit,
- .ndo_set_rx_mode = ieee80211_set_multicast_list,
- .ndo_set_mac_address = ieee80211_change_mac,
-- .ndo_select_queue = ieee80211_netdev_select_queue,
- .ndo_get_stats64 = ieee80211_get_stats64,
- };
-
-@@ -941,7 +927,6 @@ static const struct net_device_ops ieee8
- .ndo_start_xmit = ieee80211_subif_start_xmit_8023,
- .ndo_set_rx_mode = ieee80211_set_multicast_list,
- .ndo_set_mac_address = ieee80211_change_mac,
-- .ndo_select_queue = ieee80211_netdev_select_queue,
- .ndo_get_stats64 = ieee80211_get_stats64,
- .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
- };
-@@ -1443,35 +1428,6 @@ int ieee80211_do_open(struct wireless_de
-
- ieee80211_recalc_ps(local);
-
-- if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
-- sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
-- local->ops->wake_tx_queue) {
-- /* XXX: for AP_VLAN, actually track AP queues */
-- if (dev)
-- netif_tx_start_all_queues(dev);
-- } else if (dev) {
-- unsigned long flags;
-- int n_acs = IEEE80211_NUM_ACS;
-- int ac;
--
-- if (local->hw.queues < IEEE80211_NUM_ACS)
-- n_acs = 1;
--
-- spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
-- if (sdata->vif.cab_queue == IEEE80211_INVAL_HW_QUEUE ||
-- (local->queue_stop_reasons[sdata->vif.cab_queue] == 0 &&
-- skb_queue_empty(&local->pending[sdata->vif.cab_queue]))) {
-- for (ac = 0; ac < n_acs; ac++) {
-- int ac_queue = sdata->vif.hw_queue[ac];
--
-- if (local->queue_stop_reasons[ac_queue] == 0 &&
-- skb_queue_empty(&local->pending[ac_queue]))
-- netif_start_subqueue(dev, ac);
-- }
-- }
-- spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
-- }
--
- set_bit(SDATA_STATE_RUNNING, &sdata->state);
-
- return 0;
-@@ -1501,17 +1457,12 @@ static void ieee80211_if_setup(struct ne
- {
- ether_setup(dev);
- dev->priv_flags &= ~IFF_TX_SKB_SHARING;
-+ dev->priv_flags |= IFF_NO_QUEUE;
- dev->netdev_ops = &ieee80211_dataif_ops;
- dev->needs_free_netdev = true;
- dev->priv_destructor = ieee80211_if_free;
- }
-
--static void ieee80211_if_setup_no_queue(struct net_device *dev)
--{
-- ieee80211_if_setup(dev);
-- dev->priv_flags |= IFF_NO_QUEUE;
--}
--
- static void ieee80211_iface_process_skb(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata,
- struct sk_buff *skb)
-@@ -2096,9 +2047,7 @@ int ieee80211_if_add(struct ieee80211_lo
- struct net_device *ndev = NULL;
- struct ieee80211_sub_if_data *sdata = NULL;
- struct txq_info *txqi;
-- void (*if_setup)(struct net_device *dev);
- int ret, i;
-- int txqs = 1;
-
- ASSERT_RTNL();
-
-@@ -2121,30 +2070,18 @@ int ieee80211_if_add(struct ieee80211_lo
- sizeof(void *));
- int txq_size = 0;
-
-- if (local->ops->wake_tx_queue &&
-- type != NL80211_IFTYPE_AP_VLAN &&
-+ if (type != NL80211_IFTYPE_AP_VLAN &&
- (type != NL80211_IFTYPE_MONITOR ||
- (params->flags & MONITOR_FLAG_ACTIVE)))
- txq_size += sizeof(struct txq_info) +
- local->hw.txq_data_size;
-
-- if (local->ops->wake_tx_queue) {
-- if_setup = ieee80211_if_setup_no_queue;
-- } else {
-- if_setup = ieee80211_if_setup;
-- if (local->hw.queues >= IEEE80211_NUM_ACS)
-- txqs = IEEE80211_NUM_ACS;
-- }
--
- ndev = alloc_netdev_mqs(size + txq_size,
- name, name_assign_type,
-- if_setup, txqs, 1);
-+ ieee80211_if_setup, 1, 1);
- if (!ndev)
- return -ENOMEM;
-
-- if (!local->ops->wake_tx_queue && local->hw.wiphy->tx_queue_len)
-- ndev->tx_queue_len = local->hw.wiphy->tx_queue_len;
--
- dev_net_set(ndev, wiphy_net(local->hw.wiphy));
-
- ndev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -630,7 +630,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
-
- if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config ||
- !ops->add_interface || !ops->remove_interface ||
-- !ops->configure_filter))
-+ !ops->configure_filter || !ops->wake_tx_queue))
- return NULL;
-
- if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove)))
-@@ -719,9 +719,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
- if (!ops->set_key)
- wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
-
-- if (ops->wake_tx_queue)
-- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TXQS);
--
-+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_TXQS);
- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_RRM);
-
- wiphy->bss_priv_size = sizeof(struct ieee80211_bss);
-@@ -834,10 +832,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
- atomic_set(&local->agg_queue_stop[i], 0);
- }
- tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending);
--
-- if (ops->wake_tx_queue)
-- tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs);
--
-+ tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs);
- tasklet_setup(&local->tasklet, ieee80211_tasklet_handler);
-
- skb_queue_head_init(&local->skb_queue);
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -1571,9 +1571,6 @@ static void sta_ps_start(struct sta_info
-
- ieee80211_clear_fast_xmit(sta);
-
-- if (!sta->sta.txq[0])
-- return;
--
- for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) {
- struct ieee80211_txq *txq = sta->sta.txq[tid];
- struct txq_info *txqi = to_txq_info(txq);
---- a/net/mac80211/sta_info.c
-+++ b/net/mac80211/sta_info.c
-@@ -140,17 +140,15 @@ static void __cleanup_single_sta(struct
- atomic_dec(&ps->num_sta_ps);
- }
-
-- if (sta->sta.txq[0]) {
-- for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
-- struct txq_info *txqi;
-+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
-+ struct txq_info *txqi;
-
-- if (!sta->sta.txq[i])
-- continue;
-+ if (!sta->sta.txq[i])
-+ continue;
-
-- txqi = to_txq_info(sta->sta.txq[i]);
-+ txqi = to_txq_info(sta->sta.txq[i]);
-
-- ieee80211_txq_purge(local, txqi);
-- }
-+ ieee80211_txq_purge(local, txqi);
- }
-
- for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
-@@ -425,8 +423,7 @@ void sta_info_free(struct ieee80211_loca
-
- sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
-
-- if (sta->sta.txq[0])
-- kfree(to_txq_info(sta->sta.txq[0]));
-+ kfree(to_txq_info(sta->sta.txq[0]));
- kfree(rcu_dereference_raw(sta->sta.rates));
- #ifdef CPTCFG_MAC80211_MESH
- kfree(sta->mesh);
-@@ -527,6 +524,8 @@ __sta_info_alloc(struct ieee80211_sub_if
- struct ieee80211_local *local = sdata->local;
- struct ieee80211_hw *hw = &local->hw;
- struct sta_info *sta;
-+ void *txq_data;
-+ int size;
- int i;
-
- sta = kzalloc(sizeof(*sta) + hw->sta_data_size, gfp);
-@@ -597,21 +596,18 @@ __sta_info_alloc(struct ieee80211_sub_if
-
- sta->last_connected = ktime_get_seconds();
-
-- if (local->ops->wake_tx_queue) {
-- void *txq_data;
-- int size = sizeof(struct txq_info) +
-- ALIGN(hw->txq_data_size, sizeof(void *));
-+ size = sizeof(struct txq_info) +
-+ ALIGN(hw->txq_data_size, sizeof(void *));
-
-- txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp);
-- if (!txq_data)
-- goto free;
-+ txq_data = kcalloc(ARRAY_SIZE(sta->sta.txq), size, gfp);
-+ if (!txq_data)
-+ goto free;
-
-- for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
-- struct txq_info *txq = txq_data + i * size;
-+ for (i = 0; i < ARRAY_SIZE(sta->sta.txq); i++) {
-+ struct txq_info *txq = txq_data + i * size;
-
-- /* might not do anything for the bufferable MMPDU TXQ */
-- ieee80211_txq_init(sdata, sta, txq, i);
-- }
-+ /* might not do anything for the (bufferable) MMPDU TXQ */
-+ ieee80211_txq_init(sdata, sta, txq, i);
- }
-
- if (sta_prepare_rate_control(local, sta, gfp))
-@@ -685,8 +681,7 @@ __sta_info_alloc(struct ieee80211_sub_if
- return sta;
-
- free_txq:
-- if (sta->sta.txq[0])
-- kfree(to_txq_info(sta->sta.txq[0]));
-+ kfree(to_txq_info(sta->sta.txq[0]));
- free:
- sta_info_free_link(&sta->deflink);
- #ifdef CPTCFG_MAC80211_MESH
-@@ -1960,9 +1955,6 @@ ieee80211_sta_ps_deliver_response(struct
- * TIM recalculation.
- */
-
-- if (!sta->sta.txq[0])
-- return;
--
- for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) {
- if (!sta->sta.txq[tid] ||
- !(driver_release_tids & BIT(tid)) ||
-@@ -2447,7 +2439,7 @@ static void sta_set_tidstats(struct sta_
- tidstats->tx_msdu_failed = sta->deflink.status_stats.msdu_failed[tid];
- }
-
-- if (local->ops->wake_tx_queue && tid < IEEE80211_NUM_TIDS) {
-+ if (tid < IEEE80211_NUM_TIDS) {
- spin_lock_bh(&local->fq.lock);
- rcu_read_lock();
-
-@@ -2775,9 +2767,6 @@ unsigned long ieee80211_sta_last_active(
-
- static void sta_update_codel_params(struct sta_info *sta, u32 thr)
- {
-- if (!sta->sdata->local->ops->wake_tx_queue)
-- return;
--
- if (thr && thr < STA_SLOW_THRESHOLD * sta->local->num_sta) {
- sta->cparams.target = MS2TIME(50);
- sta->cparams.interval = MS2TIME(300);
---- a/net/mac80211/tdls.c
-+++ b/net/mac80211/tdls.c
-@@ -1016,7 +1016,6 @@ ieee80211_tdls_prep_mgmt_packet(struct w
- skb->priority = 256 + 5;
- break;
- }
-- skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb));
-
- /*
- * Set the WLAN_TDLS_TEARDOWN flag to indicate a teardown in progress.
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -1600,9 +1600,6 @@ int ieee80211_txq_setup_flows(struct iee
- bool supp_vht = false;
- enum nl80211_band band;
-
-- if (!local->ops->wake_tx_queue)
-- return 0;
--
- ret = fq_init(fq, 4096);
- if (ret)
- return ret;
-@@ -1650,9 +1647,6 @@ void ieee80211_txq_teardown_flows(struct
- {
- struct fq *fq = &local->fq;
-
-- if (!local->ops->wake_tx_queue)
-- return;
--
- kfree(local->cvars);
- local->cvars = NULL;
-
-@@ -1669,8 +1663,7 @@ static bool ieee80211_queue_skb(struct i
- struct ieee80211_vif *vif;
- struct txq_info *txqi;
-
-- if (!local->ops->wake_tx_queue ||
-- sdata->vif.type == NL80211_IFTYPE_MONITOR)
-+ if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
- return false;
-
- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
-@@ -4193,12 +4186,7 @@ void __ieee80211_subif_start_xmit(struct
- if (IS_ERR(sta))
- sta = NULL;
-
-- if (local->ops->wake_tx_queue) {
-- u16 queue = __ieee80211_select_queue(sdata, sta, skb);
-- skb_set_queue_mapping(skb, queue);
-- skb_get_hash(skb);
-- }
--
-+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb));
- ieee80211_aggr_check(sdata, sta, skb);
-
- sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
-@@ -4509,11 +4497,7 @@ static void ieee80211_8023_xmit(struct i
- struct tid_ampdu_tx *tid_tx;
- u8 tid;
-
-- if (local->ops->wake_tx_queue) {
-- u16 queue = __ieee80211_select_queue(sdata, sta, skb);
-- skb_set_queue_mapping(skb, queue);
-- skb_get_hash(skb);
-- }
-+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb));
-
- if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)) &&
- test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state))
-@@ -4767,9 +4751,6 @@ void ieee80211_tx_pending(struct tasklet
- if (!txok)
- break;
- }
--
-- if (skb_queue_empty(&local->pending[i]))
-- ieee80211_propagate_queue_wake(local, i);
- }
- spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
-
-@@ -5962,10 +5943,9 @@ int ieee80211_tx_control_port(struct wip
- }
-
- if (!IS_ERR(sta)) {
-- u16 queue = __ieee80211_select_queue(sdata, sta, skb);
-+ u16 queue = ieee80211_select_queue(sdata, sta, skb);
-
- skb_set_queue_mapping(skb, queue);
-- skb_get_hash(skb);
-
- /*
- * for MLO STA, the SA should be the AP MLD address, but
---- a/net/mac80211/util.c
-+++ b/net/mac80211/util.c
-@@ -444,39 +444,6 @@ void ieee80211_wake_txqs(struct tasklet_
- spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
- }
-
--void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue)
--{
-- struct ieee80211_sub_if_data *sdata;
-- int n_acs = IEEE80211_NUM_ACS;
--
-- if (local->ops->wake_tx_queue)
-- return;
--
-- if (local->hw.queues < IEEE80211_NUM_ACS)
-- n_acs = 1;
--
-- list_for_each_entry_rcu(sdata, &local->interfaces, list) {
-- int ac;
--
-- if (!sdata->dev)
-- continue;
--
-- if (sdata->vif.cab_queue != IEEE80211_INVAL_HW_QUEUE &&
-- local->queue_stop_reasons[sdata->vif.cab_queue] != 0)
-- continue;
--
-- for (ac = 0; ac < n_acs; ac++) {
-- int ac_queue = sdata->vif.hw_queue[ac];
--
-- if (ac_queue == queue ||
-- (sdata->vif.cab_queue == queue &&
-- local->queue_stop_reasons[ac_queue] == 0 &&
-- skb_queue_empty(&local->pending[ac_queue])))
-- netif_wake_subqueue(sdata->dev, ac);
-- }
-- }
--}
--
- static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
- enum queue_stop_reason reason,
- bool refcounted,
-@@ -507,11 +474,7 @@ static void __ieee80211_wake_queue(struc
- /* someone still has this queue stopped */
- return;
-
-- if (skb_queue_empty(&local->pending[queue])) {
-- rcu_read_lock();
-- ieee80211_propagate_queue_wake(local, queue);
-- rcu_read_unlock();
-- } else
-+ if (!skb_queue_empty(&local->pending[queue]))
- tasklet_schedule(&local->tx_pending_tasklet);
-
- /*
-@@ -521,12 +484,10 @@ static void __ieee80211_wake_queue(struc
- * release someone's lock, but it is fine because all the callers of
- * __ieee80211_wake_queue call it right before releasing the lock.
- */
-- if (local->ops->wake_tx_queue) {
-- if (reason == IEEE80211_QUEUE_STOP_REASON_DRIVER)
-- tasklet_schedule(&local->wake_txqs_tasklet);
-- else
-- _ieee80211_wake_txqs(local, flags);
-- }
-+ if (reason == IEEE80211_QUEUE_STOP_REASON_DRIVER)
-+ tasklet_schedule(&local->wake_txqs_tasklet);
-+ else
-+ _ieee80211_wake_txqs(local, flags);
- }
-
- void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
-@@ -554,8 +515,6 @@ static void __ieee80211_stop_queue(struc
- bool refcounted)
- {
- struct ieee80211_local *local = hw_to_local(hw);
-- struct ieee80211_sub_if_data *sdata;
-- int n_acs = IEEE80211_NUM_ACS;
-
- trace_stop_queue(local, queue, reason);
-
-@@ -567,27 +526,7 @@ static void __ieee80211_stop_queue(struc
- else
- local->q_stop_reasons[queue][reason]++;
-
-- if (__test_and_set_bit(reason, &local->queue_stop_reasons[queue]))
-- return;
--
-- if (local->hw.queues < IEEE80211_NUM_ACS)
-- n_acs = 1;
--
-- rcu_read_lock();
-- list_for_each_entry_rcu(sdata, &local->interfaces, list) {
-- int ac;
--
-- if (!sdata->dev)
-- continue;
--
-- for (ac = 0; ac < n_acs; ac++) {
-- if (!local->ops->wake_tx_queue &&
-- (sdata->vif.hw_queue[ac] == queue ||
-- sdata->vif.cab_queue == queue))
-- netif_stop_subqueue(sdata->dev, ac);
-- }
-- }
-- rcu_read_unlock();
-+ set_bit(reason, &local->queue_stop_reasons[queue]);
- }
-
- void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
---- a/net/mac80211/wme.c
-+++ b/net/mac80211/wme.c
-@@ -122,6 +122,9 @@ u16 ieee80211_select_queue_80211(struct
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
- u8 *p;
-
-+ /* Ensure hash is set prior to potential SW encryption */
-+ skb_get_hash(skb);
-+
- if ((info->control.flags & IEEE80211_TX_CTRL_DONT_REORDER) ||
- local->hw.queues < IEEE80211_NUM_ACS)
- return 0;
-@@ -141,13 +144,16 @@ u16 ieee80211_select_queue_80211(struct
- return ieee80211_downgrade_queue(sdata, NULL, skb);
- }
-
--u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
-- struct sta_info *sta, struct sk_buff *skb)
-+u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta, struct sk_buff *skb)
- {
- const struct ethhdr *eth = (void *)skb->data;
- struct mac80211_qos_map *qos_map;
- bool qos;
-
-+ /* Ensure hash is set prior to potential SW encryption */
-+ skb_get_hash(skb);
-+
- /* all mesh/ocb stations are required to support WME */
- if ((sdata->vif.type == NL80211_IFTYPE_MESH_POINT &&
- !is_multicast_ether_addr(eth->h_dest)) ||
-@@ -178,59 +184,6 @@ u16 __ieee80211_select_queue(struct ieee
- return ieee80211_downgrade_queue(sdata, sta, skb);
- }
-
--
--/* Indicate which queue to use. */
--u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
-- struct sk_buff *skb)
--{
-- struct ieee80211_local *local = sdata->local;
-- struct sta_info *sta = NULL;
-- const u8 *ra = NULL;
-- u16 ret;
--
-- /* when using iTXQ, we can do this later */
-- if (local->ops->wake_tx_queue)
-- return 0;
--
-- if (local->hw.queues < IEEE80211_NUM_ACS || skb->len < 6) {
-- skb->priority = 0; /* required for correct WPA/11i MIC */
-- return 0;
-- }
--
-- rcu_read_lock();
-- switch (sdata->vif.type) {
-- case NL80211_IFTYPE_AP_VLAN:
-- sta = rcu_dereference(sdata->u.vlan.sta);
-- if (sta)
-- break;
-- fallthrough;
-- case NL80211_IFTYPE_AP:
-- ra = skb->data;
-- break;
-- case NL80211_IFTYPE_STATION:
-- /* might be a TDLS station */
-- sta = sta_info_get(sdata, skb->data);
-- if (sta)
-- break;
--
-- ra = sdata->deflink.u.mgd.bssid;
-- break;
-- case NL80211_IFTYPE_ADHOC:
-- ra = skb->data;
-- break;
-- default:
-- break;
-- }
--
-- if (!sta && ra && !is_multicast_ether_addr(ra))
-- sta = sta_info_get(sdata, ra);
--
-- ret = __ieee80211_select_queue(sdata, sta, skb);
--
-- rcu_read_unlock();
-- return ret;
--}
--
- /**
- * ieee80211_set_qos_hdr - Fill in the QoS header if there is one.
- *
---- a/net/mac80211/wme.h
-+++ b/net/mac80211/wme.h
-@@ -13,10 +13,8 @@
- u16 ieee80211_select_queue_80211(struct ieee80211_sub_if_data *sdata,
- struct sk_buff *skb,
- struct ieee80211_hdr *hdr);
--u16 __ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
-- struct sta_info *sta, struct sk_buff *skb);
- u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
-- struct sk_buff *skb);
-+ struct sta_info *sta, struct sk_buff *skb);
- void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
- struct sk_buff *skb);
-
+++ /dev/null
-From: Johannes Berg <johannes.berg@intel.com>
-Date: Mon, 10 Oct 2022 19:17:46 +0200
-Subject: [PATCH] wifi: realtek: remove duplicated wake_tx_queue
-
-By accident, the previous patch duplicated the initialization
-of the wake_tx_queue callback. Fix that by removing the new
-initializations.
-
-Fixes: a790cc3a4fad ("wifi: mac80211: add wake_tx_queue callback to drivers")
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/drivers/net/wireless/realtek/rtw88/mac80211.c
-+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
-@@ -896,7 +896,6 @@ static void rtw_ops_sta_rc_update(struct
-
- const struct ieee80211_ops rtw_ops = {
- .tx = rtw_ops_tx,
-- .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .wake_tx_queue = rtw_ops_wake_tx_queue,
- .start = rtw_ops_start,
- .stop = rtw_ops_stop,
---- a/drivers/net/wireless/realtek/rtw89/mac80211.c
-+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
-@@ -918,7 +918,6 @@ static int rtw89_ops_set_tid_config(stru
-
- const struct ieee80211_ops rtw89_ops = {
- .tx = rtw89_ops_tx,
-- .wake_tx_queue = ieee80211_handle_wake_tx_queue,
- .wake_tx_queue = rtw89_ops_wake_tx_queue,
- .start = rtw89_ops_start,
- .stop = rtw89_ops_stop,
--- /dev/null
+From: Felix Fietkau <nbd@nbd.name>
+Date: Fri, 30 Jun 2023 13:11:51 +0200
+Subject: [PATCH] mac80211: split mesh fast tx cache into
+ local/proxied/forwarded
+
+Depending on the origin of the packets (and their SA), 802.11 + mesh headers
+could be filled in differently. In order to properly deal with that, add a
+new field to the lookup key, indicating the type (local, proxied or
+forwarded). This can fix spurious packet drop issues that depend on the order
+in which nodes/hosts communicate with each other.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/mesh.c
++++ b/net/mac80211/mesh.c
+@@ -765,6 +765,9 @@ bool ieee80211_mesh_xmit_fast(struct iee
+ struct sk_buff *skb, u32 ctrl_flags)
+ {
+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
++ struct ieee80211_mesh_fast_tx_key key = {
++ .type = MESH_FAST_TX_TYPE_LOCAL
++ };
+ struct ieee80211_mesh_fast_tx *entry;
+ struct ieee80211s_hdr *meshhdr;
+ u8 sa[ETH_ALEN] __aligned(2);
+@@ -800,7 +803,10 @@ bool ieee80211_mesh_xmit_fast(struct iee
+ return false;
+ }
+
+- entry = mesh_fast_tx_get(sdata, skb->data);
++ ether_addr_copy(key.addr, skb->data);
++ if (!ether_addr_equal(skb->data + ETH_ALEN, sdata->vif.addr))
++ key.type = MESH_FAST_TX_TYPE_PROXIED;
++ entry = mesh_fast_tx_get(sdata, &key);
+ if (!entry)
+ return false;
+
+--- a/net/mac80211/mesh.h
++++ b/net/mac80211/mesh.h
+@@ -134,9 +134,33 @@ struct mesh_path {
+ #define MESH_FAST_TX_CACHE_TIMEOUT 8000 /* msecs */
+
+ /**
++ * enum ieee80211_mesh_fast_tx_type - cached mesh fast tx entry type
++ *
++ * @MESH_FAST_TX_TYPE_LOCAL: tx from the local vif address as SA
++ * @MESH_FAST_TX_TYPE_PROXIED: local tx with a different SA (e.g. bridged)
++ * @MESH_FAST_TX_TYPE_FORWARDED: forwarded from a different mesh point
++ */
++enum ieee80211_mesh_fast_tx_type {
++ MESH_FAST_TX_TYPE_LOCAL,
++ MESH_FAST_TX_TYPE_PROXIED,
++ MESH_FAST_TX_TYPE_FORWARDED,
++};
++
++/**
++ * struct ieee80211_mesh_fast_tx_key - cached mesh fast tx entry key
++ *
++ * @addr: The Ethernet DA for this entry
++ * @type: cache entry type
++ */
++struct ieee80211_mesh_fast_tx_key {
++ u8 addr[ETH_ALEN] __aligned(2);
++ enum ieee80211_mesh_fast_tx_type type;
++};
++
++/**
+ * struct ieee80211_mesh_fast_tx - cached mesh fast tx entry
+ * @rhash: rhashtable pointer
+- * @addr_key: The Ethernet DA which is the key for this entry
++ * @key: the lookup key for this cache entry
+ * @fast_tx: base fast_tx data
+ * @hdr: cached mesh and rfc1042 headers
+ * @hdrlen: length of mesh + rfc1042
+@@ -147,7 +171,7 @@ struct mesh_path {
+ */
+ struct ieee80211_mesh_fast_tx {
+ struct rhash_head rhash;
+- u8 addr_key[ETH_ALEN] __aligned(2);
++ struct ieee80211_mesh_fast_tx_key key;
+
+ struct ieee80211_fast_tx fast_tx;
+ u8 hdr[sizeof(struct ieee80211s_hdr) + sizeof(rfc1042_header)];
+@@ -334,7 +358,8 @@ void mesh_path_tx_root_frame(struct ieee
+
+ bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt);
+ struct ieee80211_mesh_fast_tx *
+-mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr);
++mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata,
++ struct ieee80211_mesh_fast_tx_key *key);
+ bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata,
+ struct sk_buff *skb, u32 ctrl_flags);
+ void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata,
+--- a/net/mac80211/mesh_pathtbl.c
++++ b/net/mac80211/mesh_pathtbl.c
+@@ -36,8 +36,8 @@ static const struct rhashtable_params me
+ static const struct rhashtable_params fast_tx_rht_params = {
+ .nelem_hint = 10,
+ .automatic_shrinking = true,
+- .key_len = ETH_ALEN,
+- .key_offset = offsetof(struct ieee80211_mesh_fast_tx, addr_key),
++ .key_len = sizeof(struct ieee80211_mesh_fast_tx_key),
++ .key_offset = offsetof(struct ieee80211_mesh_fast_tx, key),
+ .head_offset = offsetof(struct ieee80211_mesh_fast_tx, rhash),
+ .hashfn = mesh_table_hash,
+ };
+@@ -426,20 +426,21 @@ static void mesh_fast_tx_entry_free(stru
+ }
+
+ struct ieee80211_mesh_fast_tx *
+-mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr)
++mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata,
++ struct ieee80211_mesh_fast_tx_key *key)
+ {
+ struct ieee80211_mesh_fast_tx *entry;
+ struct mesh_tx_cache *cache;
+
+ cache = &sdata->u.mesh.tx_cache;
+- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params);
++ entry = rhashtable_lookup(&cache->rht, key, fast_tx_rht_params);
+ if (!entry)
+ return NULL;
+
+ if (!(entry->mpath->flags & MESH_PATH_ACTIVE) ||
+ mpath_expired(entry->mpath)) {
+ spin_lock_bh(&cache->walk_lock);
+- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params);
++ entry = rhashtable_lookup(&cache->rht, key, fast_tx_rht_params);
+ if (entry)
+ mesh_fast_tx_entry_free(cache, entry);
+ spin_unlock_bh(&cache->walk_lock);
+@@ -484,18 +485,24 @@ void mesh_fast_tx_cache(struct ieee80211
+ if (!sta)
+ return;
+
++ build.key.type = MESH_FAST_TX_TYPE_LOCAL;
+ if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) {
+ /* This is required to keep the mppath alive */
+ mppath = mpp_path_lookup(sdata, meshhdr->eaddr1);
+ if (!mppath)
+ return;
+ build.mppath = mppath;
++ if (!ether_addr_equal(meshhdr->eaddr2, sdata->vif.addr))
++ build.key.type = MESH_FAST_TX_TYPE_PROXIED;
+ } else if (ieee80211_has_a4(hdr->frame_control)) {
+ mppath = mpath;
+ } else {
+ return;
+ }
+
++ if (!ether_addr_equal(hdr->addr4, sdata->vif.addr))
++ build.key.type = MESH_FAST_TX_TYPE_FORWARDED;
++
+ /* rate limit, in case fast xmit can't be enabled */
+ if (mppath->fast_tx_check == jiffies)
+ return;
+@@ -542,7 +549,7 @@ void mesh_fast_tx_cache(struct ieee80211
+ }
+ }
+
+- memcpy(build.addr_key, mppath->dst, ETH_ALEN);
++ memcpy(build.key.addr, mppath->dst, ETH_ALEN);
+ build.timestamp = jiffies;
+ build.fast_tx.band = info->band;
+ build.fast_tx.da_offs = offsetof(struct ieee80211_hdr, addr3);
+@@ -644,13 +651,19 @@ void mesh_fast_tx_flush_addr(struct ieee
+ const u8 *addr)
+ {
+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache;
++ struct ieee80211_mesh_fast_tx_key key = {};
+ struct ieee80211_mesh_fast_tx *entry;
++ int i;
+
++ ether_addr_copy(key.addr, addr);
+ cache = &sdata->u.mesh.tx_cache;
+ spin_lock_bh(&cache->walk_lock);
+- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params);
+- if (entry)
+- mesh_fast_tx_entry_free(cache, entry);
++ for (i = MESH_FAST_TX_TYPE_LOCAL; i < MESH_FAST_TX_TYPE_FORWARDED; i++) {
++ key.type = i;
++ entry = rhashtable_lookup(&cache->rht, &key, fast_tx_rht_params);
++ if (entry)
++ mesh_fast_tx_entry_free(cache, entry);
++ }
+ spin_unlock_bh(&cache->walk_lock);
+ }
+
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -2727,7 +2727,10 @@ ieee80211_rx_mesh_fast_forward(struct ie
+ struct sk_buff *skb, int hdrlen)
+ {
+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
+- struct ieee80211_mesh_fast_tx *entry = NULL;
++ struct ieee80211_mesh_fast_tx_key key = {
++ .type = MESH_FAST_TX_TYPE_FORWARDED
++ };
++ struct ieee80211_mesh_fast_tx *entry;
+ struct ieee80211s_hdr *mesh_hdr;
+ struct tid_ampdu_tx *tid_tx;
+ struct sta_info *sta;
+@@ -2736,9 +2739,13 @@ ieee80211_rx_mesh_fast_forward(struct ie
+
+ mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(eth));
+ if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6)
+- entry = mesh_fast_tx_get(sdata, mesh_hdr->eaddr1);
++ ether_addr_copy(key.addr, mesh_hdr->eaddr1);
+ else if (!(mesh_hdr->flags & MESH_FLAGS_AE))
+- entry = mesh_fast_tx_get(sdata, skb->data);
++ ether_addr_copy(key.addr, skb->data);
++ else
++ return false;
++
++ entry = mesh_fast_tx_get(sdata, &key);
+ if (!entry)
+ return false;
+
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sun, 9 Oct 2022 20:15:46 +0200
-Subject: [PATCH] mac80211: add support for restricting netdev features per vif
-
-This can be used to selectively disable feature flags for checksum offload,
-scatter/gather or GSO by changing vif->netdev_features.
-Removing features from vif->netdev_features does not affect the netdev
-features themselves, but instead fixes up skbs in the tx path so that the
-offloads are not needed in the driver.
-
-Aside from making it easier to deal with vif type based hardware limitations,
-this also makes it possible to optimize performance on hardware without native
-GSO support by declaring GSO support in hw->netdev_features and removing it
-from vif->netdev_features. This allows mac80211 to handle GSO segmentation
-after the sta lookup, but before itxq enqueue, thus reducing the number of
-unnecessary sta lookups, as well as some other per-packet processing.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/include/net/fq_impl.h
-+++ b/include/net/fq_impl.h
-@@ -200,6 +200,7 @@ static void fq_tin_enqueue(struct fq *fq
- fq_skb_free_t free_func)
- {
- struct fq_flow *flow;
-+ struct sk_buff *next;
- bool oom;
-
- lockdep_assert_held(&fq->lock);
-@@ -214,11 +215,15 @@ static void fq_tin_enqueue(struct fq *fq
- }
-
- flow->tin = tin;
-- flow->backlog += skb->len;
-- tin->backlog_bytes += skb->len;
-- tin->backlog_packets++;
-- fq->memory_usage += skb->truesize;
-- fq->backlog++;
-+ skb_list_walk_safe(skb, skb, next) {
-+ skb_mark_not_on_list(skb);
-+ flow->backlog += skb->len;
-+ tin->backlog_bytes += skb->len;
-+ tin->backlog_packets++;
-+ fq->memory_usage += skb->truesize;
-+ fq->backlog++;
-+ __skb_queue_tail(&flow->queue, skb);
-+ }
-
- if (list_empty(&flow->flowchain)) {
- flow->deficit = fq->quantum;
-@@ -226,7 +231,6 @@ static void fq_tin_enqueue(struct fq *fq
- &tin->new_flows);
- }
-
-- __skb_queue_tail(&flow->queue, skb);
- oom = (fq->memory_usage > fq->memory_limit);
- while (fq->backlog > fq->limit || oom) {
- flow = fq_find_fattest_flow(fq);
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -1807,6 +1807,10 @@ struct ieee80211_vif_cfg {
- * @addr: address of this interface
- * @p2p: indicates whether this AP or STA interface is a p2p
- * interface, i.e. a GO or p2p-sta respectively
-+ * @netdev_features: tx netdev features supported by the hardware for this
-+ * vif. mac80211 initializes this to hw->netdev_features, and the driver
-+ * can mask out specific tx features. mac80211 will handle software fixup
-+ * for masked offloads (GSO, CSUM)
- * @driver_flags: flags/capabilities the driver has for this interface,
- * these need to be set (or cleared) when the interface is added
- * or, if supported by the driver, the interface type is changed
-@@ -1846,6 +1850,7 @@ struct ieee80211_vif {
-
- struct ieee80211_txq *txq;
-
-+ netdev_features_t netdev_features;
- u32 driver_flags;
- u32 offload_flags;
-
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -2181,6 +2181,7 @@ int ieee80211_if_add(struct ieee80211_lo
- ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
- ndev->hw_features |= ndev->features &
- MAC80211_SUPPORTED_FEATURES_TX;
-+ sdata->vif.netdev_features = local->hw.netdev_features;
-
- netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops);
-
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -1356,7 +1356,11 @@ static struct txq_info *ieee80211_get_tx
-
- static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb)
- {
-- IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time();
-+ struct sk_buff *next;
-+ codel_time_t now = codel_get_time();
-+
-+ skb_list_walk_safe(skb, skb, next)
-+ IEEE80211_SKB_CB(skb)->control.enqueue_time = now;
- }
-
- static u32 codel_skb_len_func(const struct sk_buff *skb)
-@@ -3579,55 +3583,79 @@ ieee80211_xmit_fast_finish(struct ieee80
- return TX_CONTINUE;
- }
-
--static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
-- struct sta_info *sta,
-- struct ieee80211_fast_tx *fast_tx,
-- struct sk_buff *skb)
-+static netdev_features_t
-+ieee80211_sdata_netdev_features(struct ieee80211_sub_if_data *sdata)
- {
-- struct ieee80211_local *local = sdata->local;
-- u16 ethertype = (skb->data[12] << 8) | skb->data[13];
-- int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
-- int hw_headroom = sdata->local->hw.extra_tx_headroom;
-- struct ethhdr eth;
-- struct ieee80211_tx_info *info;
-- struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
-- struct ieee80211_tx_data tx;
-- ieee80211_tx_result r;
-- struct tid_ampdu_tx *tid_tx = NULL;
-- u8 tid = IEEE80211_NUM_TIDS;
-+ if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
-+ return sdata->vif.netdev_features;
-
-- /* control port protocol needs a lot of special handling */
-- if (cpu_to_be16(ethertype) == sdata->control_port_protocol)
-- return false;
-+ if (!sdata->bss)
-+ return 0;
-
-- /* only RFC 1042 SNAP */
-- if (ethertype < ETH_P_802_3_MIN)
-- return false;
-+ sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, u.ap);
-+ return sdata->vif.netdev_features;
-+}
-
-- /* don't handle TX status request here either */
-- if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)
-- return false;
-+static struct sk_buff *
-+ieee80211_tx_skb_fixup(struct sk_buff *skb, netdev_features_t features)
-+{
-+ if (skb_is_gso(skb)) {
-+ struct sk_buff *segs;
-
-- if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
-- tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
-- tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
-- if (tid_tx) {
-- if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state))
-- return false;
-- if (tid_tx->timeout)
-- tid_tx->last_tx = jiffies;
-- }
-+ segs = skb_gso_segment(skb, features);
-+ if (!segs)
-+ return skb;
-+ if (IS_ERR(segs))
-+ goto free;
-+
-+ consume_skb(skb);
-+ return segs;
- }
-
-- /* after this point (skb is modified) we cannot return false */
-+ if (skb_needs_linearize(skb, features) && __skb_linearize(skb))
-+ goto free;
-+
-+ if (skb->ip_summed == CHECKSUM_PARTIAL) {
-+ int ofs = skb_checksum_start_offset(skb);
-+
-+ if (skb->encapsulation)
-+ skb_set_inner_transport_header(skb, ofs);
-+ else
-+ skb_set_transport_header(skb, ofs);
-+
-+ if (skb_csum_hwoffload_help(skb, features))
-+ goto free;
-+ }
-+
-+ skb_mark_not_on_list(skb);
-+ return skb;
-+
-+free:
-+ kfree_skb(skb);
-+ return NULL;
-+}
-+
-+static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta,
-+ struct ieee80211_fast_tx *fast_tx,
-+ struct sk_buff *skb, u8 tid, bool ampdu)
-+{
-+ struct ieee80211_local *local = sdata->local;
-+ struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
-+ struct ieee80211_tx_info *info;
-+ struct ieee80211_tx_data tx;
-+ ieee80211_tx_result r;
-+ int hw_headroom = sdata->local->hw.extra_tx_headroom;
-+ int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
-+ struct ethhdr eth;
-
- skb = skb_share_check(skb, GFP_ATOMIC);
- if (unlikely(!skb))
-- return true;
-+ return;
-
- if ((hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) &&
- ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb))
-- return true;
-+ return;
-
- /* will not be crypto-handled beyond what we do here, so use false
- * as the may-encrypt argument for the resize to not account for
-@@ -3636,10 +3664,8 @@ static bool ieee80211_xmit_fast(struct i
- if (unlikely(ieee80211_skb_resize(sdata, skb,
- max_t(int, extra_head + hw_headroom -
- skb_headroom(skb), 0),
-- ENCRYPT_NO))) {
-- kfree_skb(skb);
-- return true;
-- }
-+ ENCRYPT_NO)))
-+ goto free;
-
- memcpy(ð, skb->data, ETH_HLEN - 2);
- hdr = skb_push(skb, extra_head);
-@@ -3653,7 +3679,7 @@ static bool ieee80211_xmit_fast(struct i
- info->control.vif = &sdata->vif;
- info->flags = IEEE80211_TX_CTL_FIRST_FRAGMENT |
- IEEE80211_TX_CTL_DONTFRAG |
-- (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0);
-+ (ampdu ? IEEE80211_TX_CTL_AMPDU : 0);
- info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT |
- u32_encode_bits(IEEE80211_LINK_UNSPECIFIED,
- IEEE80211_TX_CTRL_MLO_LINK);
-@@ -3677,16 +3703,14 @@ static bool ieee80211_xmit_fast(struct i
- tx.key = fast_tx->key;
-
- if (ieee80211_queue_skb(local, sdata, sta, skb))
-- return true;
-+ return;
-
- tx.skb = skb;
- r = ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs,
- fast_tx->key, &tx);
- tx.skb = NULL;
-- if (r == TX_DROP) {
-- kfree_skb(skb);
-- return true;
-- }
-+ if (r == TX_DROP)
-+ goto free;
-
- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
- sdata = container_of(sdata->bss,
-@@ -3694,6 +3718,56 @@ static bool ieee80211_xmit_fast(struct i
-
- __skb_queue_tail(&tx.skbs, skb);
- ieee80211_tx_frags(local, &sdata->vif, sta, &tx.skbs, false);
-+ return;
-+
-+free:
-+ kfree_skb(skb);
-+}
-+
-+static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta,
-+ struct ieee80211_fast_tx *fast_tx,
-+ struct sk_buff *skb)
-+{
-+ u16 ethertype = (skb->data[12] << 8) | skb->data[13];
-+ struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
-+ struct tid_ampdu_tx *tid_tx = NULL;
-+ struct sk_buff *next;
-+ u8 tid = IEEE80211_NUM_TIDS;
-+
-+ /* control port protocol needs a lot of special handling */
-+ if (cpu_to_be16(ethertype) == sdata->control_port_protocol)
-+ return false;
-+
-+ /* only RFC 1042 SNAP */
-+ if (ethertype < ETH_P_802_3_MIN)
-+ return false;
-+
-+ /* don't handle TX status request here either */
-+ if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)
-+ return false;
-+
-+ if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
-+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
-+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
-+ if (tid_tx) {
-+ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state))
-+ return false;
-+ if (tid_tx->timeout)
-+ tid_tx->last_tx = jiffies;
-+ }
-+ }
-+
-+ /* after this point (skb is modified) we cannot return false */
-+ skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata));
-+ if (!skb)
-+ return true;
-+
-+ skb_list_walk_safe(skb, skb, next) {
-+ skb_mark_not_on_list(skb);
-+ __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid, tid_tx);
-+ }
-+
- return true;
- }
-
-@@ -4201,31 +4275,14 @@ void __ieee80211_subif_start_xmit(struct
- goto out;
- }
-
-- if (skb_is_gso(skb)) {
-- struct sk_buff *segs;
--
-- segs = skb_gso_segment(skb, 0);
-- if (IS_ERR(segs)) {
-- goto out_free;
-- } else if (segs) {
-- consume_skb(skb);
-- skb = segs;
-- }
-- } else {
-- /* we cannot process non-linear frames on this path */
-- if (skb_linearize(skb))
-- goto out_free;
--
-- /* the frame could be fragmented, software-encrypted, and other
-- * things so we cannot really handle checksum offload with it -
-- * fix it up in software before we handle anything else.
-- */
-- if (skb->ip_summed == CHECKSUM_PARTIAL) {
-- skb_set_transport_header(skb,
-- skb_checksum_start_offset(skb));
-- if (skb_checksum_help(skb))
-- goto out_free;
-- }
-+ /* the frame could be fragmented, software-encrypted, and other
-+ * things so we cannot really handle checksum or GSO offload.
-+ * fix it up in software before we handle anything else.
-+ */
-+ skb = ieee80211_tx_skb_fixup(skb, 0);
-+ if (!skb) {
-+ len = 0;
-+ goto out;
- }
-
- skb_list_walk_safe(skb, skb, next) {
-@@ -4443,9 +4500,11 @@ normal:
- return NETDEV_TX_OK;
- }
-
--static bool ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata,
-- struct sk_buff *skb, struct sta_info *sta,
-- bool txpending)
-+
-+
-+static bool __ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata,
-+ struct sk_buff *skb, struct sta_info *sta,
-+ bool txpending)
- {
- struct ieee80211_local *local = sdata->local;
- struct ieee80211_tx_control control = {};
-@@ -4454,14 +4513,6 @@ static bool ieee80211_tx_8023(struct iee
- unsigned long flags;
- int q = info->hw_queue;
-
-- if (sta)
-- sk_pacing_shift_update(skb->sk, local->hw.tx_sk_pacing_shift);
--
-- ieee80211_tpt_led_trig_tx(local, skb->len);
--
-- if (ieee80211_queue_skb(local, sdata, sta, skb))
-- return true;
--
- spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
-
- if (local->queue_stop_reasons[q] ||
-@@ -4488,6 +4539,26 @@ static bool ieee80211_tx_8023(struct iee
- return true;
- }
-
-+static bool ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata,
-+ struct sk_buff *skb, struct sta_info *sta,
-+ bool txpending)
-+{
-+ struct ieee80211_local *local = sdata->local;
-+ struct sk_buff *next;
-+ bool ret = true;
-+
-+ if (ieee80211_queue_skb(local, sdata, sta, skb))
-+ return true;
-+
-+ skb_list_walk_safe(skb, skb, next) {
-+ skb_mark_not_on_list(skb);
-+ if (!__ieee80211_tx_8023(sdata, skb, sta, txpending))
-+ ret = false;
-+ }
-+
-+ return ret;
-+}
-+
- static void ieee80211_8023_xmit(struct ieee80211_sub_if_data *sdata,
- struct net_device *dev, struct sta_info *sta,
- struct ieee80211_key *key, struct sk_buff *skb)
-@@ -4495,9 +4566,13 @@ static void ieee80211_8023_xmit(struct i
- struct ieee80211_tx_info *info;
- struct ieee80211_local *local = sdata->local;
- struct tid_ampdu_tx *tid_tx;
-+ struct sk_buff *seg, *next;
-+ unsigned int skbs = 0, len = 0;
-+ u16 queue;
- u8 tid;
-
-- skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb));
-+ queue = ieee80211_select_queue(sdata, sta, skb);
-+ skb_set_queue_mapping(skb, queue);
-
- if (unlikely(test_bit(SCAN_SW_SCANNING, &local->scanning)) &&
- test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state))
-@@ -4507,9 +4582,6 @@ static void ieee80211_8023_xmit(struct i
- if (unlikely(!skb))
- return;
-
-- info = IEEE80211_SKB_CB(skb);
-- memset(info, 0, sizeof(*info));
--
- ieee80211_aggr_check(sdata, sta, skb);
-
- tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
-@@ -4523,22 +4595,20 @@ static void ieee80211_8023_xmit(struct i
- return;
- }
-
-- info->flags |= IEEE80211_TX_CTL_AMPDU;
- if (tid_tx->timeout)
- tid_tx->last_tx = jiffies;
- }
-
-- if (unlikely(skb->sk &&
-- skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS))
-- info->ack_frame_id = ieee80211_store_ack_skb(local, skb,
-- &info->flags, NULL);
-+ skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata));
-+ if (!skb)
-+ return;
-
-- info->hw_queue = sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
-+ info = IEEE80211_SKB_CB(skb);
-+ memset(info, 0, sizeof(*info));
-+ if (tid_tx)
-+ info->flags |= IEEE80211_TX_CTL_AMPDU;
-
-- dev_sw_netstats_tx_add(dev, 1, skb->len);
--
-- sta->deflink.tx_stats.bytes[skb_get_queue_mapping(skb)] += skb->len;
-- sta->deflink.tx_stats.packets[skb_get_queue_mapping(skb)]++;
-+ info->hw_queue = sdata->vif.hw_queue[queue];
-
- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
- sdata = container_of(sdata->bss,
-@@ -4550,6 +4620,24 @@ static void ieee80211_8023_xmit(struct i
- if (key)
- info->control.hw_key = &key->conf;
-
-+ skb_list_walk_safe(skb, seg, next) {
-+ skbs++;
-+ len += seg->len;
-+ if (seg != skb)
-+ memcpy(IEEE80211_SKB_CB(seg), info, sizeof(*info));
-+ }
-+
-+ if (unlikely(skb->sk &&
-+ skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS))
-+ info->ack_frame_id = ieee80211_store_ack_skb(local, skb,
-+ &info->flags, NULL);
-+
-+ dev_sw_netstats_tx_add(dev, skbs, len);
-+ sta->deflink.tx_stats.packets[queue] += skbs;
-+ sta->deflink.tx_stats.bytes[queue] += len;
-+
-+ ieee80211_tpt_led_trig_tx(local, len);
-+
- ieee80211_tx_8023(sdata, skb, sta, false);
-
- return;
-@@ -4591,6 +4679,7 @@ netdev_tx_t ieee80211_subif_start_xmit_8
- key->conf.cipher == WLAN_CIPHER_SUITE_TKIP))
- goto skip_offload;
-
-+ sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
- ieee80211_8023_xmit(sdata, dev, sta, key, skb);
- goto out;
-
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Thu, 1 Dec 2022 14:57:30 +0100
-Subject: [PATCH] wifi: mac80211: fix and simplify unencrypted drop check for
- mesh
-
-ieee80211_drop_unencrypted is called from ieee80211_rx_h_mesh_fwding and
-ieee80211_frame_allowed.
-
-Since ieee80211_rx_h_mesh_fwding can forward packets for other mesh nodes
-and is called earlier, it needs to check the decryptions status and if the
-packet is using the control protocol on its own, instead of deferring to
-the later call from ieee80211_frame_allowed.
-
-Because of that, ieee80211_drop_unencrypted has a mesh specific check
-that skips over the mesh header in order to check the payload protocol.
-This code is invalid when called from ieee80211_frame_allowed, since that
-happens after the 802.11->802.3 conversion.
-
-Fix this by moving the mesh specific check directly into
-ieee80211_rx_h_mesh_fwding.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
-Link: https://lore.kernel.org/r/20221201135730.19723-1-nbd@nbd.name
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2403,7 +2403,6 @@ static int ieee80211_802_1x_port_control
-
- static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)
- {
-- struct ieee80211_hdr *hdr = (void *)rx->skb->data;
- struct sk_buff *skb = rx->skb;
- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
-
-@@ -2414,31 +2413,6 @@ static int ieee80211_drop_unencrypted(st
- if (status->flag & RX_FLAG_DECRYPTED)
- return 0;
-
-- /* check mesh EAPOL frames first */
-- if (unlikely(rx->sta && ieee80211_vif_is_mesh(&rx->sdata->vif) &&
-- ieee80211_is_data(fc))) {
-- struct ieee80211s_hdr *mesh_hdr;
-- u16 hdr_len = ieee80211_hdrlen(fc);
-- u16 ethertype_offset;
-- __be16 ethertype;
--
-- if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr))
-- goto drop_check;
--
-- /* make sure fixed part of mesh header is there, also checks skb len */
-- if (!pskb_may_pull(rx->skb, hdr_len + 6))
-- goto drop_check;
--
-- mesh_hdr = (struct ieee80211s_hdr *)(skb->data + hdr_len);
-- ethertype_offset = hdr_len + ieee80211_get_mesh_hdrlen(mesh_hdr) +
-- sizeof(rfc1042_header);
--
-- if (skb_copy_bits(rx->skb, ethertype_offset, ðertype, 2) == 0 &&
-- ethertype == rx->sdata->control_port_protocol)
-- return 0;
-- }
--
--drop_check:
- /* Drop unencrypted frames if key is set. */
- if (unlikely(!ieee80211_has_protected(fc) &&
- !ieee80211_is_any_nullfunc(fc) &&
-@@ -2892,8 +2866,16 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
- hdr = (struct ieee80211_hdr *) skb->data;
- mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
-
-- if (ieee80211_drop_unencrypted(rx, hdr->frame_control))
-- return RX_DROP_MONITOR;
-+ if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) {
-+ int offset = hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr) +
-+ sizeof(rfc1042_header);
-+ __be16 ethertype;
-+
-+ if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr) ||
-+ skb_copy_bits(rx->skb, offset, ðertype, 2) != 0 ||
-+ ethertype != rx->sdata->control_port_protocol)
-+ return RX_DROP_MONITOR;
-+ }
-
- /* frame is in RMC, don't forward */
- if (ieee80211_is_data(hdr->frame_control) &&
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Fri, 2 Dec 2022 13:53:11 +0100
-Subject: [PATCH] wifi: cfg80211: move A-MSDU check in
- ieee80211_data_to_8023_exthdr
-
-When parsing the outer A-MSDU header, don't check for inner bridge tunnel
-or RFC1042 headers. This is handled by ieee80211_amsdu_to_8023s already.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/wireless/util.c
-+++ b/net/wireless/util.c
-@@ -631,8 +631,9 @@ int ieee80211_data_to_8023_exthdr(struct
- break;
- }
-
-- if (likely(skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 &&
-- ((!is_amsdu && ether_addr_equal(payload.hdr, rfc1042_header) &&
-+ if (likely(!is_amsdu &&
-+ skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 &&
-+ ((ether_addr_equal(payload.hdr, rfc1042_header) &&
- payload.proto != htons(ETH_P_AARP) &&
- payload.proto != htons(ETH_P_IPX)) ||
- ether_addr_equal(payload.hdr, bridge_tunnel_header)))) {
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Fri, 2 Dec 2022 13:54:15 +0100
-Subject: [PATCH] wifi: cfg80211: factor out bridge tunnel / RFC1042 header
- check
-
-The same check is done in multiple places, unify it.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/wireless/util.c
-+++ b/net/wireless/util.c
-@@ -542,6 +542,21 @@ unsigned int ieee80211_get_mesh_hdrlen(s
- }
- EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
-
-+static bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto)
-+{
-+ const __be16 *hdr_proto = hdr + ETH_ALEN;
-+
-+ if (!(ether_addr_equal(hdr, rfc1042_header) &&
-+ *hdr_proto != htons(ETH_P_AARP) &&
-+ *hdr_proto != htons(ETH_P_IPX)) &&
-+ !ether_addr_equal(hdr, bridge_tunnel_header))
-+ return false;
-+
-+ *proto = *hdr_proto;
-+
-+ return true;
-+}
-+
- int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
- const u8 *addr, enum nl80211_iftype iftype,
- u8 data_offset, bool is_amsdu)
-@@ -633,14 +648,9 @@ int ieee80211_data_to_8023_exthdr(struct
-
- if (likely(!is_amsdu &&
- skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 &&
-- ((ether_addr_equal(payload.hdr, rfc1042_header) &&
-- payload.proto != htons(ETH_P_AARP) &&
-- payload.proto != htons(ETH_P_IPX)) ||
-- ether_addr_equal(payload.hdr, bridge_tunnel_header)))) {
-- /* remove RFC1042 or Bridge-Tunnel encapsulation and
-- * replace EtherType */
-+ ieee80211_get_8023_tunnel_proto(&payload, &tmp.h_proto))) {
-+ /* remove RFC1042 or Bridge-Tunnel encapsulation */
- hdrlen += ETH_ALEN + 2;
-- tmp.h_proto = payload.proto;
- skb_postpull_rcsum(skb, &payload, ETH_ALEN + 2);
- } else {
- tmp.h_proto = htons(skb->len - hdrlen);
-@@ -756,8 +766,6 @@ void ieee80211_amsdu_to_8023s(struct sk_
- {
- unsigned int hlen = ALIGN(extra_headroom, 4);
- struct sk_buff *frame = NULL;
-- u16 ethertype;
-- u8 *payload;
- int offset = 0, remaining;
- struct ethhdr eth;
- bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
-@@ -811,14 +819,8 @@ void ieee80211_amsdu_to_8023s(struct sk_
- frame->dev = skb->dev;
- frame->priority = skb->priority;
-
-- payload = frame->data;
-- ethertype = (payload[6] << 8) | payload[7];
-- if (likely((ether_addr_equal(payload, rfc1042_header) &&
-- ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) ||
-- ether_addr_equal(payload, bridge_tunnel_header))) {
-- eth.h_proto = htons(ethertype);
-+ if (likely(ieee80211_get_8023_tunnel_proto(frame->data, ð.h_proto)))
- skb_pull(frame, ETH_ALEN + 2);
-- }
-
- memcpy(skb_push(frame, sizeof(eth)), ð, sizeof(eth));
- __skb_queue_tail(list, frame);
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Fri, 2 Dec 2022 17:01:46 +0100
-Subject: [PATCH] wifi: mac80211: remove mesh forwarding congestion check
-
-Now that all drivers use iTXQ, it does not make sense to check to drop
-tx forwarding packets when the driver has stopped the queues.
-fq_codel will take care of dropping packets when the queues fill up
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/debugfs_netdev.c
-+++ b/net/mac80211/debugfs_netdev.c
-@@ -603,8 +603,6 @@ IEEE80211_IF_FILE(fwded_mcast, u.mesh.ms
- IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC);
- IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC);
- IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC);
--IEEE80211_IF_FILE(dropped_frames_congestion,
-- u.mesh.mshstats.dropped_frames_congestion, DEC);
- IEEE80211_IF_FILE(dropped_frames_no_route,
- u.mesh.mshstats.dropped_frames_no_route, DEC);
-
-@@ -740,7 +738,6 @@ static void add_mesh_stats(struct ieee80
- MESHSTATS_ADD(fwded_frames);
- MESHSTATS_ADD(dropped_frames_ttl);
- MESHSTATS_ADD(dropped_frames_no_route);
-- MESHSTATS_ADD(dropped_frames_congestion);
- #undef MESHSTATS_ADD
- }
-
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -329,7 +329,6 @@ struct mesh_stats {
- __u32 fwded_frames; /* Mesh total forwarded frames */
- __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/
- __u32 dropped_frames_no_route; /* Not transmitted, no route found */
-- __u32 dropped_frames_congestion;/* Not forwarded due to congestion */
- };
-
- #define PREQ_Q_F_START 0x1
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2926,11 +2926,6 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
- return RX_CONTINUE;
-
- ac = ieee802_1d_to_ac[skb->priority];
-- q = sdata->vif.hw_queue[ac];
-- if (ieee80211_queue_stopped(&local->hw, q)) {
-- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
-- return RX_DROP_MONITOR;
-- }
- skb_set_queue_mapping(skb, ac);
-
- if (!--mesh_hdr->ttl) {
+++ /dev/null
-From 986e43b19ae9176093da35e0a844e65c8bf9ede7 Mon Sep 17 00:00:00 2001
-From: Felix Fietkau <nbd@nbd.name>
-Date: Mon, 13 Feb 2023 11:08:54 +0100
-Subject: [PATCH] wifi: mac80211: fix receiving A-MSDU frames on mesh
- interfaces
-
-The current mac80211 mesh A-MSDU receive path fails to parse A-MSDU packets
-on mesh interfaces, because it assumes that the Mesh Control field is always
-directly after the 802.11 header.
-802.11-2020 9.3.2.2.2 Figure 9-70 shows that the Mesh Control field is
-actually part of the A-MSDU subframe header.
-This makes more sense, since it allows packets for multiple different
-destinations to be included in the same A-MSDU, as long as RA and TID are
-still the same.
-Another issue is the fact that the A-MSDU subframe length field was apparently
-accidentally defined as little-endian in the standard.
-
-In order to fix this, the mesh forwarding path needs happen at a different
-point in the receive path.
-
-ieee80211_data_to_8023_exthdr is changed to ignore the mesh control field
-and leave it in after the ethernet header. This also affects the source/dest
-MAC address fields, which now in the case of mesh point to the mesh SA/DA.
-
-ieee80211_amsdu_to_8023s is changed to deal with the endian difference and
-to add the Mesh Control length to the subframe length, since it's not covered
-by the MSDU length field.
-
-With these changes, the mac80211 will get the same packet structure for
-converted regular data packets and unpacked A-MSDU subframes.
-
-The mesh forwarding checks are now only performed after the A-MSDU decap.
-For locally received packets, the Mesh Control header is stripped away.
-For forwarded packets, a new 802.11 header gets added.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
-Link: https://lore.kernel.org/r/20230213100855.34315-4-nbd@nbd.name
-[fix fortify build error]
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
- .../wireless/marvell/mwifiex/11n_rxreorder.c | 2 +-
- include/net/cfg80211.h | 27 +-
- net/mac80211/rx.c | 350 ++++++++++--------
- net/wireless/util.c | 120 +++---
- 4 files changed, 297 insertions(+), 202 deletions(-)
-
---- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
-+++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
-@@ -33,7 +33,7 @@ static int mwifiex_11n_dispatch_amsdu_pk
- skb_trim(skb, le16_to_cpu(local_rx_pd->rx_pkt_length));
-
- ieee80211_amsdu_to_8023s(skb, &list, priv->curr_addr,
-- priv->wdev.iftype, 0, NULL, NULL);
-+ priv->wdev.iftype, 0, NULL, NULL, false);
-
- while (!skb_queue_empty(&list)) {
- struct rx_packet_hdr *rx_hdr;
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -6208,11 +6208,36 @@ static inline int ieee80211_data_to_8023
- * @extra_headroom: The hardware extra headroom for SKBs in the @list.
- * @check_da: DA to check in the inner ethernet header, or NULL
- * @check_sa: SA to check in the inner ethernet header, or NULL
-+ * @mesh_control: A-MSDU subframe header includes the mesh control field
- */
- void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
- const u8 *addr, enum nl80211_iftype iftype,
- const unsigned int extra_headroom,
-- const u8 *check_da, const u8 *check_sa);
-+ const u8 *check_da, const u8 *check_sa,
-+ bool mesh_control);
-+
-+/**
-+ * ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol
-+ *
-+ * Check for RFC1042 or bridge tunnel header and fetch the encapsulated
-+ * protocol.
-+ *
-+ * @hdr: pointer to the MSDU payload
-+ * @proto: destination pointer to store the protocol
-+ * Return: true if encapsulation was found
-+ */
-+bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto);
-+
-+/**
-+ * ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames
-+ *
-+ * Strip the mesh header, which was left in by ieee80211_data_to_8023 as part
-+ * of the MSDU data. Also move any source/destination addresses from the mesh
-+ * header to the ethernet header (if present).
-+ *
-+ * @skb: The 802.3 frame with embedded mesh header
-+ */
-+int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb);
-
- /**
- * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2720,6 +2720,174 @@ ieee80211_deliver_skb(struct ieee80211_r
- }
- }
-
-+static ieee80211_rx_result
-+ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta,
-+ struct sk_buff *skb)
-+{
-+#ifdef CPTCFG_MAC80211_MESH
-+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-+ struct ieee80211_local *local = sdata->local;
-+ uint16_t fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA;
-+ struct ieee80211_hdr hdr = {
-+ .frame_control = cpu_to_le16(fc)
-+ };
-+ struct ieee80211_hdr *fwd_hdr;
-+ struct ieee80211s_hdr *mesh_hdr;
-+ struct ieee80211_tx_info *info;
-+ struct sk_buff *fwd_skb;
-+ struct ethhdr *eth;
-+ bool multicast;
-+ int tailroom = 0;
-+ int hdrlen, mesh_hdrlen;
-+ u8 *qos;
-+
-+ if (!ieee80211_vif_is_mesh(&sdata->vif))
-+ return RX_CONTINUE;
-+
-+ if (!pskb_may_pull(skb, sizeof(*eth) + 6))
-+ return RX_DROP_MONITOR;
-+
-+ mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(*eth));
-+ mesh_hdrlen = ieee80211_get_mesh_hdrlen(mesh_hdr);
-+
-+ if (!pskb_may_pull(skb, sizeof(*eth) + mesh_hdrlen))
-+ return RX_DROP_MONITOR;
-+
-+ eth = (struct ethhdr *)skb->data;
-+ multicast = is_multicast_ether_addr(eth->h_dest);
-+
-+ mesh_hdr = (struct ieee80211s_hdr *)(eth + 1);
-+ if (!mesh_hdr->ttl)
-+ return RX_DROP_MONITOR;
-+
-+ /* frame is in RMC, don't forward */
-+ if (is_multicast_ether_addr(eth->h_dest) &&
-+ mesh_rmc_check(sdata, eth->h_source, mesh_hdr))
-+ return RX_DROP_MONITOR;
-+
-+ /* Frame has reached destination. Don't forward */
-+ if (ether_addr_equal(sdata->vif.addr, eth->h_dest))
-+ goto rx_accept;
-+
-+ if (!ifmsh->mshcfg.dot11MeshForwarding) {
-+ if (is_multicast_ether_addr(eth->h_dest))
-+ goto rx_accept;
-+
-+ return RX_DROP_MONITOR;
-+ }
-+
-+ /* forward packet */
-+ if (sdata->crypto_tx_tailroom_needed_cnt)
-+ tailroom = IEEE80211_ENCRYPT_TAILROOM;
-+
-+ if (!--mesh_hdr->ttl) {
-+ if (multicast)
-+ goto rx_accept;
-+
-+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
-+ return RX_DROP_MONITOR;
-+ }
-+
-+ if (mesh_hdr->flags & MESH_FLAGS_AE) {
-+ struct mesh_path *mppath;
-+ char *proxied_addr;
-+
-+ if (multicast)
-+ proxied_addr = mesh_hdr->eaddr1;
-+ else if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6)
-+ /* has_a4 already checked in ieee80211_rx_mesh_check */
-+ proxied_addr = mesh_hdr->eaddr2;
-+ else
-+ return RX_DROP_MONITOR;
-+
-+ rcu_read_lock();
-+ mppath = mpp_path_lookup(sdata, proxied_addr);
-+ if (!mppath) {
-+ mpp_path_add(sdata, proxied_addr, eth->h_source);
-+ } else {
-+ spin_lock_bh(&mppath->state_lock);
-+ if (!ether_addr_equal(mppath->mpp, eth->h_source))
-+ memcpy(mppath->mpp, eth->h_source, ETH_ALEN);
-+ mppath->exp_time = jiffies;
-+ spin_unlock_bh(&mppath->state_lock);
-+ }
-+ rcu_read_unlock();
-+ }
-+
-+ skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]);
-+
-+ ieee80211_fill_mesh_addresses(&hdr, &hdr.frame_control,
-+ eth->h_dest, eth->h_source);
-+ hdrlen = ieee80211_hdrlen(hdr.frame_control);
-+ if (multicast) {
-+ int extra_head = sizeof(struct ieee80211_hdr) - sizeof(*eth);
-+
-+ fwd_skb = skb_copy_expand(skb, local->tx_headroom + extra_head +
-+ IEEE80211_ENCRYPT_HEADROOM,
-+ tailroom, GFP_ATOMIC);
-+ if (!fwd_skb)
-+ goto rx_accept;
-+ } else {
-+ fwd_skb = skb;
-+ skb = NULL;
-+
-+ if (skb_cow_head(fwd_skb, hdrlen - sizeof(struct ethhdr)))
-+ return RX_DROP_UNUSABLE;
-+ }
-+
-+ fwd_hdr = skb_push(fwd_skb, hdrlen - sizeof(struct ethhdr));
-+ memcpy(fwd_hdr, &hdr, hdrlen - 2);
-+ qos = ieee80211_get_qos_ctl(fwd_hdr);
-+ qos[0] = qos[1] = 0;
-+
-+ skb_reset_mac_header(fwd_skb);
-+ hdrlen += mesh_hdrlen;
-+ if (ieee80211_get_8023_tunnel_proto(fwd_skb->data + hdrlen,
-+ &fwd_skb->protocol))
-+ hdrlen += ETH_ALEN;
-+ else
-+ fwd_skb->protocol = htons(fwd_skb->len - hdrlen);
-+ skb_set_network_header(fwd_skb, hdrlen);
-+
-+ info = IEEE80211_SKB_CB(fwd_skb);
-+ memset(info, 0, sizeof(*info));
-+ info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
-+ info->control.vif = &sdata->vif;
-+ info->control.jiffies = jiffies;
-+ if (multicast) {
-+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast);
-+ memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
-+ /* update power mode indication when forwarding */
-+ ieee80211_mps_set_frame_flags(sdata, NULL, fwd_hdr);
-+ } else if (!mesh_nexthop_lookup(sdata, fwd_skb)) {
-+ /* mesh power mode flags updated in mesh_nexthop_lookup */
-+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast);
-+ } else {
-+ /* unable to resolve next hop */
-+ if (sta)
-+ mesh_path_error_tx(sdata, ifmsh->mshcfg.element_ttl,
-+ hdr.addr3, 0,
-+ WLAN_REASON_MESH_PATH_NOFORWARD,
-+ sta->sta.addr);
-+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route);
-+ kfree_skb(fwd_skb);
-+ goto rx_accept;
-+ }
-+
-+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames);
-+ fwd_skb->dev = sdata->dev;
-+ ieee80211_add_pending_skb(local, fwd_skb);
-+
-+rx_accept:
-+ if (!skb)
-+ return RX_QUEUED;
-+
-+ ieee80211_strip_8023_mesh_hdr(skb);
-+#endif
-+
-+ return RX_CONTINUE;
-+}
-+
- static ieee80211_rx_result debug_noinline
- __ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx, u8 data_offset)
- {
-@@ -2728,8 +2896,10 @@ __ieee80211_rx_h_amsdu(struct ieee80211_
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
- __le16 fc = hdr->frame_control;
- struct sk_buff_head frame_list;
-+ static ieee80211_rx_result res;
- struct ethhdr ethhdr;
- const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source;
-+ bool mesh = false;
-
- if (unlikely(ieee80211_has_a4(hdr->frame_control))) {
- check_da = NULL;
-@@ -2746,6 +2916,8 @@ __ieee80211_rx_h_amsdu(struct ieee80211_
- break;
- case NL80211_IFTYPE_MESH_POINT:
- check_sa = NULL;
-+ check_da = NULL;
-+ mesh = true;
- break;
- default:
- break;
-@@ -2763,17 +2935,29 @@ __ieee80211_rx_h_amsdu(struct ieee80211_
- ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
- rx->sdata->vif.type,
- rx->local->hw.extra_tx_headroom,
-- check_da, check_sa);
-+ check_da, check_sa, mesh);
-
- while (!skb_queue_empty(&frame_list)) {
- rx->skb = __skb_dequeue(&frame_list);
-
-- if (!ieee80211_frame_allowed(rx, fc)) {
-- dev_kfree_skb(rx->skb);
-+ res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb);
-+ switch (res) {
-+ case RX_QUEUED:
- continue;
-+ case RX_CONTINUE:
-+ break;
-+ default:
-+ goto free;
- }
-
-+ if (!ieee80211_frame_allowed(rx, fc))
-+ goto free;
-+
- ieee80211_deliver_skb(rx);
-+ continue;
-+
-+free:
-+ dev_kfree_skb(rx->skb);
- }
-
- return RX_QUEUED;
-@@ -2806,6 +2990,8 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
- if (!rx->sdata->u.mgd.use_4addr)
- return RX_DROP_UNUSABLE;
- break;
-+ case NL80211_IFTYPE_MESH_POINT:
-+ break;
- default:
- return RX_DROP_UNUSABLE;
- }
-@@ -2834,155 +3020,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx
- return __ieee80211_rx_h_amsdu(rx, 0);
- }
-
--#ifdef CPTCFG_MAC80211_MESH
--static ieee80211_rx_result
--ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
--{
-- struct ieee80211_hdr *fwd_hdr, *hdr;
-- struct ieee80211_tx_info *info;
-- struct ieee80211s_hdr *mesh_hdr;
-- struct sk_buff *skb = rx->skb, *fwd_skb;
-- struct ieee80211_local *local = rx->local;
-- struct ieee80211_sub_if_data *sdata = rx->sdata;
-- struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-- u16 ac, q, hdrlen;
-- int tailroom = 0;
--
-- hdr = (struct ieee80211_hdr *) skb->data;
-- hdrlen = ieee80211_hdrlen(hdr->frame_control);
--
-- /* make sure fixed part of mesh header is there, also checks skb len */
-- if (!pskb_may_pull(rx->skb, hdrlen + 6))
-- return RX_DROP_MONITOR;
--
-- mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
--
-- /* make sure full mesh header is there, also checks skb len */
-- if (!pskb_may_pull(rx->skb,
-- hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr)))
-- return RX_DROP_MONITOR;
--
-- /* reload pointers */
-- hdr = (struct ieee80211_hdr *) skb->data;
-- mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
--
-- if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) {
-- int offset = hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr) +
-- sizeof(rfc1042_header);
-- __be16 ethertype;
--
-- if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr) ||
-- skb_copy_bits(rx->skb, offset, ðertype, 2) != 0 ||
-- ethertype != rx->sdata->control_port_protocol)
-- return RX_DROP_MONITOR;
-- }
--
-- /* frame is in RMC, don't forward */
-- if (ieee80211_is_data(hdr->frame_control) &&
-- is_multicast_ether_addr(hdr->addr1) &&
-- mesh_rmc_check(rx->sdata, hdr->addr3, mesh_hdr))
-- return RX_DROP_MONITOR;
--
-- if (!ieee80211_is_data(hdr->frame_control))
-- return RX_CONTINUE;
--
-- if (!mesh_hdr->ttl)
-- return RX_DROP_MONITOR;
--
-- if (mesh_hdr->flags & MESH_FLAGS_AE) {
-- struct mesh_path *mppath;
-- char *proxied_addr;
-- char *mpp_addr;
--
-- if (is_multicast_ether_addr(hdr->addr1)) {
-- mpp_addr = hdr->addr3;
-- proxied_addr = mesh_hdr->eaddr1;
-- } else if ((mesh_hdr->flags & MESH_FLAGS_AE) ==
-- MESH_FLAGS_AE_A5_A6) {
-- /* has_a4 already checked in ieee80211_rx_mesh_check */
-- mpp_addr = hdr->addr4;
-- proxied_addr = mesh_hdr->eaddr2;
-- } else {
-- return RX_DROP_MONITOR;
-- }
--
-- rcu_read_lock();
-- mppath = mpp_path_lookup(sdata, proxied_addr);
-- if (!mppath) {
-- mpp_path_add(sdata, proxied_addr, mpp_addr);
-- } else {
-- spin_lock_bh(&mppath->state_lock);
-- if (!ether_addr_equal(mppath->mpp, mpp_addr))
-- memcpy(mppath->mpp, mpp_addr, ETH_ALEN);
-- mppath->exp_time = jiffies;
-- spin_unlock_bh(&mppath->state_lock);
-- }
-- rcu_read_unlock();
-- }
--
-- /* Frame has reached destination. Don't forward */
-- if (!is_multicast_ether_addr(hdr->addr1) &&
-- ether_addr_equal(sdata->vif.addr, hdr->addr3))
-- return RX_CONTINUE;
--
-- ac = ieee802_1d_to_ac[skb->priority];
-- skb_set_queue_mapping(skb, ac);
--
-- if (!--mesh_hdr->ttl) {
-- if (!is_multicast_ether_addr(hdr->addr1))
-- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh,
-- dropped_frames_ttl);
-- goto out;
-- }
--
-- if (!ifmsh->mshcfg.dot11MeshForwarding)
-- goto out;
--
-- if (sdata->crypto_tx_tailroom_needed_cnt)
-- tailroom = IEEE80211_ENCRYPT_TAILROOM;
--
-- fwd_skb = skb_copy_expand(skb, local->tx_headroom +
-- IEEE80211_ENCRYPT_HEADROOM,
-- tailroom, GFP_ATOMIC);
-- if (!fwd_skb)
-- goto out;
--
-- fwd_skb->dev = sdata->dev;
-- fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data;
-- fwd_hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_RETRY);
-- info = IEEE80211_SKB_CB(fwd_skb);
-- memset(info, 0, sizeof(*info));
-- info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
-- info->control.vif = &rx->sdata->vif;
-- info->control.jiffies = jiffies;
-- if (is_multicast_ether_addr(fwd_hdr->addr1)) {
-- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast);
-- memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
-- /* update power mode indication when forwarding */
-- ieee80211_mps_set_frame_flags(sdata, NULL, fwd_hdr);
-- } else if (!mesh_nexthop_lookup(sdata, fwd_skb)) {
-- /* mesh power mode flags updated in mesh_nexthop_lookup */
-- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast);
-- } else {
-- /* unable to resolve next hop */
-- mesh_path_error_tx(sdata, ifmsh->mshcfg.element_ttl,
-- fwd_hdr->addr3, 0,
-- WLAN_REASON_MESH_PATH_NOFORWARD,
-- fwd_hdr->addr2);
-- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route);
-- kfree_skb(fwd_skb);
-- return RX_DROP_MONITOR;
-- }
--
-- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames);
-- ieee80211_add_pending_skb(local, fwd_skb);
-- out:
-- if (is_multicast_ether_addr(hdr->addr1))
-- return RX_CONTINUE;
-- return RX_DROP_MONITOR;
--}
--#endif
--
- static ieee80211_rx_result debug_noinline
- ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
- {
-@@ -2991,6 +3028,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_
- struct net_device *dev = sdata->dev;
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
- __le16 fc = hdr->frame_control;
-+ static ieee80211_rx_result res;
- bool port_control;
- int err;
-
-@@ -3017,6 +3055,10 @@ ieee80211_rx_h_data(struct ieee80211_rx_
- if (unlikely(err))
- return RX_DROP_UNUSABLE;
-
-+ res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb);
-+ if (res != RX_CONTINUE)
-+ return res;
-+
- if (!ieee80211_frame_allowed(rx, fc))
- return RX_DROP_MONITOR;
-
-@@ -3987,10 +4029,6 @@ static void ieee80211_rx_handlers(struct
- CALL_RXH(ieee80211_rx_h_defragment);
- CALL_RXH(ieee80211_rx_h_michael_mic_verify);
- /* must be after MMIC verify so header is counted in MPDU mic */
--#ifdef CPTCFG_MAC80211_MESH
-- if (ieee80211_vif_is_mesh(&rx->sdata->vif))
-- CALL_RXH(ieee80211_rx_h_mesh_fwding);
--#endif
- CALL_RXH(ieee80211_rx_h_amsdu);
- CALL_RXH(ieee80211_rx_h_data);
-
---- a/net/wireless/util.c
-+++ b/net/wireless/util.c
-@@ -542,7 +542,7 @@ unsigned int ieee80211_get_mesh_hdrlen(s
- }
- EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
-
--static bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto)
-+bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto)
- {
- const __be16 *hdr_proto = hdr + ETH_ALEN;
-
-@@ -556,6 +556,49 @@ static bool ieee80211_get_8023_tunnel_pr
-
- return true;
- }
-+EXPORT_SYMBOL(ieee80211_get_8023_tunnel_proto);
-+
-+int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb)
-+{
-+ const void *mesh_addr;
-+ struct {
-+ struct ethhdr eth;
-+ u8 flags;
-+ } payload;
-+ int hdrlen;
-+ int ret;
-+
-+ ret = skb_copy_bits(skb, 0, &payload, sizeof(payload));
-+ if (ret)
-+ return ret;
-+
-+ hdrlen = sizeof(payload.eth) + __ieee80211_get_mesh_hdrlen(payload.flags);
-+
-+ if (likely(pskb_may_pull(skb, hdrlen + 8) &&
-+ ieee80211_get_8023_tunnel_proto(skb->data + hdrlen,
-+ &payload.eth.h_proto)))
-+ hdrlen += ETH_ALEN + 2;
-+ else if (!pskb_may_pull(skb, hdrlen))
-+ return -EINVAL;
-+
-+ mesh_addr = skb->data + sizeof(payload.eth) + ETH_ALEN;
-+ switch (payload.flags & MESH_FLAGS_AE) {
-+ case MESH_FLAGS_AE_A4:
-+ memcpy(&payload.eth.h_source, mesh_addr, ETH_ALEN);
-+ break;
-+ case MESH_FLAGS_AE_A5_A6:
-+ memcpy(&payload.eth, mesh_addr, 2 * ETH_ALEN);
-+ break;
-+ default:
-+ break;
-+ }
-+
-+ pskb_pull(skb, hdrlen - sizeof(payload.eth));
-+ memcpy(skb->data, &payload.eth, sizeof(payload.eth));
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL(ieee80211_strip_8023_mesh_hdr);
-
- int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
- const u8 *addr, enum nl80211_iftype iftype,
-@@ -568,7 +611,6 @@ int ieee80211_data_to_8023_exthdr(struct
- } payload;
- struct ethhdr tmp;
- u16 hdrlen;
-- u8 mesh_flags = 0;
-
- if (unlikely(!ieee80211_is_data_present(hdr->frame_control)))
- return -1;
-@@ -589,12 +631,6 @@ int ieee80211_data_to_8023_exthdr(struct
- memcpy(tmp.h_dest, ieee80211_get_DA(hdr), ETH_ALEN);
- memcpy(tmp.h_source, ieee80211_get_SA(hdr), ETH_ALEN);
-
-- if (iftype == NL80211_IFTYPE_MESH_POINT &&
-- skb_copy_bits(skb, hdrlen, &mesh_flags, 1) < 0)
-- return -1;
--
-- mesh_flags &= MESH_FLAGS_AE;
--
- switch (hdr->frame_control &
- cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
- case cpu_to_le16(IEEE80211_FCTL_TODS):
-@@ -608,17 +644,6 @@ int ieee80211_data_to_8023_exthdr(struct
- iftype != NL80211_IFTYPE_AP_VLAN &&
- iftype != NL80211_IFTYPE_STATION))
- return -1;
-- if (iftype == NL80211_IFTYPE_MESH_POINT) {
-- if (mesh_flags == MESH_FLAGS_AE_A4)
-- return -1;
-- if (mesh_flags == MESH_FLAGS_AE_A5_A6 &&
-- skb_copy_bits(skb, hdrlen +
-- offsetof(struct ieee80211s_hdr, eaddr1),
-- tmp.h_dest, 2 * ETH_ALEN) < 0)
-- return -1;
--
-- hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
-- }
- break;
- case cpu_to_le16(IEEE80211_FCTL_FROMDS):
- if ((iftype != NL80211_IFTYPE_STATION &&
-@@ -627,16 +652,6 @@ int ieee80211_data_to_8023_exthdr(struct
- (is_multicast_ether_addr(tmp.h_dest) &&
- ether_addr_equal(tmp.h_source, addr)))
- return -1;
-- if (iftype == NL80211_IFTYPE_MESH_POINT) {
-- if (mesh_flags == MESH_FLAGS_AE_A5_A6)
-- return -1;
-- if (mesh_flags == MESH_FLAGS_AE_A4 &&
-- skb_copy_bits(skb, hdrlen +
-- offsetof(struct ieee80211s_hdr, eaddr1),
-- tmp.h_source, ETH_ALEN) < 0)
-- return -1;
-- hdrlen += __ieee80211_get_mesh_hdrlen(mesh_flags);
-- }
- break;
- case cpu_to_le16(0):
- if (iftype != NL80211_IFTYPE_ADHOC &&
-@@ -646,7 +661,7 @@ int ieee80211_data_to_8023_exthdr(struct
- break;
- }
-
-- if (likely(!is_amsdu &&
-+ if (likely(!is_amsdu && iftype != NL80211_IFTYPE_MESH_POINT &&
- skb_copy_bits(skb, hdrlen, &payload, sizeof(payload)) == 0 &&
- ieee80211_get_8023_tunnel_proto(&payload, &tmp.h_proto))) {
- /* remove RFC1042 or Bridge-Tunnel encapsulation */
-@@ -722,7 +737,8 @@ __ieee80211_amsdu_copy_frag(struct sk_bu
-
- static struct sk_buff *
- __ieee80211_amsdu_copy(struct sk_buff *skb, unsigned int hlen,
-- int offset, int len, bool reuse_frag)
-+ int offset, int len, bool reuse_frag,
-+ int min_len)
- {
- struct sk_buff *frame;
- int cur_len = len;
-@@ -736,7 +752,7 @@ __ieee80211_amsdu_copy(struct sk_buff *s
- * in the stack later.
- */
- if (reuse_frag)
-- cur_len = min_t(int, len, 32);
-+ cur_len = min_t(int, len, min_len);
-
- /*
- * Allocate and reserve two bytes more for payload
-@@ -746,6 +762,7 @@ __ieee80211_amsdu_copy(struct sk_buff *s
- if (!frame)
- return NULL;
-
-+ frame->priority = skb->priority;
- skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2);
- skb_copy_bits(skb, offset, skb_put(frame, cur_len), cur_len);
-
-@@ -762,23 +779,37 @@ __ieee80211_amsdu_copy(struct sk_buff *s
- void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
- const u8 *addr, enum nl80211_iftype iftype,
- const unsigned int extra_headroom,
-- const u8 *check_da, const u8 *check_sa)
-+ const u8 *check_da, const u8 *check_sa,
-+ bool mesh_control)
- {
- unsigned int hlen = ALIGN(extra_headroom, 4);
- struct sk_buff *frame = NULL;
- int offset = 0, remaining;
-- struct ethhdr eth;
-+ struct {
-+ struct ethhdr eth;
-+ uint8_t flags;
-+ } hdr;
- bool reuse_frag = skb->head_frag && !skb_has_frag_list(skb);
- bool reuse_skb = false;
- bool last = false;
-+ int copy_len = sizeof(hdr.eth);
-+
-+ if (iftype == NL80211_IFTYPE_MESH_POINT)
-+ copy_len = sizeof(hdr);
-
- while (!last) {
- unsigned int subframe_len;
-- int len;
-+ int len, mesh_len = 0;
- u8 padding;
-
-- skb_copy_bits(skb, offset, ð, sizeof(eth));
-- len = ntohs(eth.h_proto);
-+ skb_copy_bits(skb, offset, &hdr, copy_len);
-+ if (iftype == NL80211_IFTYPE_MESH_POINT)
-+ mesh_len = __ieee80211_get_mesh_hdrlen(hdr.flags);
-+ if (mesh_control)
-+ len = le16_to_cpu(*(__le16 *)&hdr.eth.h_proto) + mesh_len;
-+ else
-+ len = ntohs(hdr.eth.h_proto);
-+
- subframe_len = sizeof(struct ethhdr) + len;
- padding = (4 - subframe_len) & 0x3;
-
-@@ -787,16 +818,16 @@ void ieee80211_amsdu_to_8023s(struct sk_
- if (subframe_len > remaining)
- goto purge;
- /* mitigate A-MSDU aggregation injection attacks */
-- if (ether_addr_equal(eth.h_dest, rfc1042_header))
-+ if (ether_addr_equal(hdr.eth.h_dest, rfc1042_header))
- goto purge;
-
- offset += sizeof(struct ethhdr);
- last = remaining <= subframe_len + padding;
-
- /* FIXME: should we really accept multicast DA? */
-- if ((check_da && !is_multicast_ether_addr(eth.h_dest) &&
-- !ether_addr_equal(check_da, eth.h_dest)) ||
-- (check_sa && !ether_addr_equal(check_sa, eth.h_source))) {
-+ if ((check_da && !is_multicast_ether_addr(hdr.eth.h_dest) &&
-+ !ether_addr_equal(check_da, hdr.eth.h_dest)) ||
-+ (check_sa && !ether_addr_equal(check_sa, hdr.eth.h_source))) {
- offset += len + padding;
- continue;
- }
-@@ -808,7 +839,7 @@ void ieee80211_amsdu_to_8023s(struct sk_
- reuse_skb = true;
- } else {
- frame = __ieee80211_amsdu_copy(skb, hlen, offset, len,
-- reuse_frag);
-+ reuse_frag, 32 + mesh_len);
- if (!frame)
- goto purge;
-
-@@ -819,10 +850,11 @@ void ieee80211_amsdu_to_8023s(struct sk_
- frame->dev = skb->dev;
- frame->priority = skb->priority;
-
-- if (likely(ieee80211_get_8023_tunnel_proto(frame->data, ð.h_proto)))
-+ if (likely(iftype != NL80211_IFTYPE_MESH_POINT &&
-+ ieee80211_get_8023_tunnel_proto(frame->data, &hdr.eth.h_proto)))
- skb_pull(frame, ETH_ALEN + 2);
-
-- memcpy(skb_push(frame, sizeof(eth)), ð, sizeof(eth));
-+ memcpy(skb_push(frame, sizeof(hdr.eth)), &hdr.eth, sizeof(hdr.eth));
- __skb_queue_tail(list, frame);
- }
-
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Fri, 9 Dec 2022 21:15:04 +0100
-Subject: [PATCH] wifi: mac80211: add a workaround for receiving
- non-standard mesh A-MSDU
-
-At least ath10k and ath11k supported hardware (maybe more) does not implement
-mesh A-MSDU aggregation in a standard compliant way.
-802.11-2020 9.3.2.2.2 declares that the Mesh Control field is part of the
-A-MSDU header. As such, its length must not be included in the subframe
-length field.
-Hardware affected by this bug treats the mesh control field as part of the
-MSDU data and sets the length accordingly.
-In order to avoid packet loss, keep track of which stations are affected
-by this and take it into account when converting A-MSDU to 802.3 + mesh control
-packets.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -6194,6 +6194,19 @@ static inline int ieee80211_data_to_8023
- }
-
- /**
-+ * ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid
-+ *
-+ * This is used to detect non-standard A-MSDU frames, e.g. the ones generated
-+ * by ath10k and ath11k, where the subframe length includes the length of the
-+ * mesh control field.
-+ *
-+ * @skb: The input A-MSDU frame without any headers.
-+ * @mesh_hdr: use standard compliant mesh A-MSDU subframe header
-+ * Returns: true if subframe header lengths are valid for the @mesh_hdr mode
-+ */
-+bool ieee80211_is_valid_amsdu(struct sk_buff *skb, bool mesh_hdr);
-+
-+/**
- * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
- *
- * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2899,7 +2899,6 @@ __ieee80211_rx_h_amsdu(struct ieee80211_
- static ieee80211_rx_result res;
- struct ethhdr ethhdr;
- const u8 *check_da = ethhdr.h_dest, *check_sa = ethhdr.h_source;
-- bool mesh = false;
-
- if (unlikely(ieee80211_has_a4(hdr->frame_control))) {
- check_da = NULL;
-@@ -2917,7 +2916,6 @@ __ieee80211_rx_h_amsdu(struct ieee80211_
- case NL80211_IFTYPE_MESH_POINT:
- check_sa = NULL;
- check_da = NULL;
-- mesh = true;
- break;
- default:
- break;
-@@ -2932,10 +2930,21 @@ __ieee80211_rx_h_amsdu(struct ieee80211_
- data_offset, true))
- return RX_DROP_UNUSABLE;
-
-+ if (rx->sta && rx->sta->amsdu_mesh_control < 0) {
-+ bool valid_std = ieee80211_is_valid_amsdu(skb, true);
-+ bool valid_nonstd = ieee80211_is_valid_amsdu(skb, false);
-+
-+ if (valid_std && !valid_nonstd)
-+ rx->sta->amsdu_mesh_control = 1;
-+ else if (valid_nonstd && !valid_std)
-+ rx->sta->amsdu_mesh_control = 0;
-+ }
-+
- ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr,
- rx->sdata->vif.type,
- rx->local->hw.extra_tx_headroom,
-- check_da, check_sa, mesh);
-+ check_da, check_sa,
-+ rx->sta->amsdu_mesh_control);
-
- while (!skb_queue_empty(&frame_list)) {
- rx->skb = __skb_dequeue(&frame_list);
---- a/net/mac80211/sta_info.c
-+++ b/net/mac80211/sta_info.c
-@@ -591,6 +591,9 @@ __sta_info_alloc(struct ieee80211_sub_if
-
- sta->sta_state = IEEE80211_STA_NONE;
-
-+ if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
-+ sta->amsdu_mesh_control = -1;
-+
- /* Mark TID as unreserved */
- sta->reserved_tid = IEEE80211_TID_UNRESERVED;
-
---- a/net/mac80211/sta_info.h
-+++ b/net/mac80211/sta_info.h
-@@ -702,6 +702,7 @@ struct sta_info {
- struct codel_params cparams;
-
- u8 reserved_tid;
-+ s8 amsdu_mesh_control;
-
- struct cfg80211_chan_def tdls_chandef;
-
---- a/net/wireless/util.c
-+++ b/net/wireless/util.c
-@@ -776,6 +776,38 @@ __ieee80211_amsdu_copy(struct sk_buff *s
- return frame;
- }
-
-+bool ieee80211_is_valid_amsdu(struct sk_buff *skb, bool mesh_hdr)
-+{
-+ int offset = 0, remaining, subframe_len, padding;
-+
-+ for (offset = 0; offset < skb->len; offset += subframe_len + padding) {
-+ struct {
-+ __be16 len;
-+ u8 mesh_flags;
-+ } hdr;
-+ u16 len;
-+
-+ if (skb_copy_bits(skb, offset + 2 * ETH_ALEN, &hdr, sizeof(hdr)) < 0)
-+ return false;
-+
-+ if (mesh_hdr)
-+ len = le16_to_cpu(*(__le16 *)&hdr.len) +
-+ __ieee80211_get_mesh_hdrlen(hdr.mesh_flags);
-+ else
-+ len = ntohs(hdr.len);
-+
-+ subframe_len = sizeof(struct ethhdr) + len;
-+ padding = (4 - subframe_len) & 0x3;
-+ remaining = skb->len - offset;
-+
-+ if (subframe_len > remaining)
-+ return false;
-+ }
-+
-+ return true;
-+}
-+EXPORT_SYMBOL(ieee80211_is_valid_amsdu);
-+
- void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
- const u8 *addr, enum nl80211_iftype iftype,
- const unsigned int extra_headroom,
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Wed, 15 Feb 2023 15:21:37 +0100
-Subject: [PATCH] wifi: mac80211: fix race in mesh sequence number
- assignment
-
-Since the sequence number is shared across different tx queues, it needs
-to be atomic in order to avoid accidental duplicate assignment
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -696,7 +696,7 @@ struct ieee80211_if_mesh {
- struct mesh_stats mshstats;
- struct mesh_config mshcfg;
- atomic_t estab_plinks;
-- u32 mesh_seqnum;
-+ atomic_t mesh_seqnum;
- bool accepting_plinks;
- int num_gates;
- struct beacon_data __rcu *beacon;
---- a/net/mac80211/mesh.c
-+++ b/net/mac80211/mesh.c
-@@ -752,10 +752,8 @@ unsigned int ieee80211_new_mesh_header(s
-
- meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL;
-
-- /* FIXME: racy -- TX on multiple queues can be concurrent */
-- put_unaligned(cpu_to_le32(sdata->u.mesh.mesh_seqnum), &meshhdr->seqnum);
-- sdata->u.mesh.mesh_seqnum++;
--
-+ put_unaligned_le32(atomic_inc_return(&sdata->u.mesh.mesh_seqnum),
-+ &meshhdr->seqnum);
- if (addr4or5 && !addr6) {
- meshhdr->flags |= MESH_FLAGS_AE_A4;
- memcpy(meshhdr->eaddr1, addr4or5, ETH_ALEN);
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sun, 26 Feb 2023 13:53:08 +0100
-Subject: [PATCH] wifi: mac80211: mesh fast xmit support
-
-Previously, fast xmit only worked on interface types where initially a
-sta lookup is performed, and a cached header can be attached to the sta,
-requiring only some fields to be updated at runtime.
-
-This technique is not directly applicable for a mesh device type due
-to the dynamic nature of the topology and protocol. There are more
-addresses that need to be filled, and there is an extra header with a
-dynamic length based on the addressing mode.
-
-Change the code to cache entries contain a copy of the mesh subframe header +
-bridge tunnel header, as well as an embedded struct ieee80211_fast_tx, which
-contains the information for building the 802.11 header.
-
-Add a mesh specific early fast xmit call, which looks up a cached entry and
-adds only the mesh subframe header, before passing it over to the generic
-fast xmit code.
-
-To ensure the changes in network are reflected in these cached headers,
-flush affected cached entries on path changes, as well as other conditions
-that currently trigger a fast xmit check in other modes (key changes etc.)
-
-This code is loosely based on a previous implementation by:
-Sriram R <quic_srirrama@quicinc.com>
-
-Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -37,6 +37,7 @@
- extern const struct cfg80211_ops mac80211_config_ops;
-
- struct ieee80211_local;
-+struct ieee80211_mesh_fast_tx;
-
- /* Maximum number of broadcast/multicast frames to buffer when some of the
- * associated stations are using power saving. */
-@@ -656,6 +657,19 @@ struct mesh_table {
- atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */
- };
-
-+/**
-+ * struct mesh_tx_cache - mesh fast xmit header cache
-+ *
-+ * @rht: hash table containing struct ieee80211_mesh_fast_tx, using skb DA as key
-+ * @walk_head: linked list containing all ieee80211_mesh_fast_tx objects
-+ * @walk_lock: lock protecting walk_head and rht
-+ */
-+struct mesh_tx_cache {
-+ struct rhashtable rht;
-+ struct hlist_head walk_head;
-+ spinlock_t walk_lock;
-+};
-+
- struct ieee80211_if_mesh {
- struct timer_list housekeeping_timer;
- struct timer_list mesh_path_timer;
-@@ -734,6 +748,7 @@ struct ieee80211_if_mesh {
- struct mesh_table mpp_paths; /* Store paths for MPP&MAP */
- int mesh_paths_generation;
- int mpp_paths_generation;
-+ struct mesh_tx_cache tx_cache;
- };
-
- #ifdef CPTCFG_MAC80211_MESH
-@@ -2002,6 +2017,11 @@ int ieee80211_tx_control_port(struct wip
- int link_id, u64 *cookie);
- int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
- const u8 *buf, size_t len);
-+void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta,
-+ struct ieee80211_fast_tx *fast_tx,
-+ struct sk_buff *skb, bool ampdu,
-+ const u8 *da, const u8 *sa);
-
- /* HT */
- void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
---- a/net/mac80211/mesh.c
-+++ b/net/mac80211/mesh.c
-@@ -10,6 +10,7 @@
- #include <asm/unaligned.h>
- #include "ieee80211_i.h"
- #include "mesh.h"
-+#include "wme.h"
- #include "driver-ops.h"
-
- static int mesh_allocated;
-@@ -698,6 +699,95 @@ ieee80211_mesh_update_bss_params(struct
- __le32_to_cpu(he_oper->he_oper_params);
- }
-
-+bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata,
-+ struct sk_buff *skb, u32 ctrl_flags)
-+{
-+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-+ struct ieee80211_mesh_fast_tx *entry;
-+ struct ieee80211s_hdr *meshhdr;
-+ u8 sa[ETH_ALEN] __aligned(2);
-+ struct tid_ampdu_tx *tid_tx;
-+ struct sta_info *sta;
-+ bool copy_sa = false;
-+ u16 ethertype;
-+ u8 tid;
-+
-+ if (ctrl_flags & IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP)
-+ return false;
-+
-+ if (ifmsh->mshcfg.dot11MeshNolearn)
-+ return false;
-+
-+ /* Add support for these cases later */
-+ if (ifmsh->ps_peers_light_sleep || ifmsh->ps_peers_deep_sleep)
-+ return false;
-+
-+ if (is_multicast_ether_addr(skb->data))
-+ return false;
-+
-+ ethertype = (skb->data[12] << 8) | skb->data[13];
-+ if (ethertype < ETH_P_802_3_MIN)
-+ return false;
-+
-+ if (skb->sk && skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)
-+ return false;
-+
-+ if (skb->ip_summed == CHECKSUM_PARTIAL) {
-+ skb_set_transport_header(skb, skb_checksum_start_offset(skb));
-+ if (skb_checksum_help(skb))
-+ return false;
-+ }
-+
-+ entry = mesh_fast_tx_get(sdata, skb->data);
-+ if (!entry)
-+ return false;
-+
-+ if (skb_headroom(skb) < entry->hdrlen + entry->fast_tx.hdr_len)
-+ return false;
-+
-+ sta = rcu_dereference(entry->mpath->next_hop);
-+ if (!sta)
-+ return false;
-+
-+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
-+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
-+ if (tid_tx) {
-+ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state))
-+ return false;
-+ if (tid_tx->timeout)
-+ tid_tx->last_tx = jiffies;
-+ }
-+
-+ skb = skb_share_check(skb, GFP_ATOMIC);
-+ if (!skb)
-+ return true;
-+
-+ skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb));
-+
-+ meshhdr = (struct ieee80211s_hdr *)entry->hdr;
-+ if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) {
-+ /* preserve SA from eth header for 6-addr frames */
-+ ether_addr_copy(sa, skb->data + ETH_ALEN);
-+ copy_sa = true;
-+ }
-+
-+ memcpy(skb_push(skb, entry->hdrlen - 2 * ETH_ALEN), entry->hdr,
-+ entry->hdrlen);
-+
-+ meshhdr = (struct ieee80211s_hdr *)skb->data;
-+ put_unaligned_le32(atomic_inc_return(&sdata->u.mesh.mesh_seqnum),
-+ &meshhdr->seqnum);
-+ meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL;
-+ if (copy_sa)
-+ ether_addr_copy(meshhdr->eaddr2, sa);
-+
-+ skb_push(skb, 2 * ETH_ALEN);
-+ __ieee80211_xmit_fast(sdata, sta, &entry->fast_tx, skb, tid_tx,
-+ entry->mpath->dst, sdata->vif.addr);
-+
-+ return true;
-+}
-+
- /**
- * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame
- * @hdr: 802.11 frame header
-@@ -780,6 +870,8 @@ static void ieee80211_mesh_housekeeping(
- changed = mesh_accept_plinks_update(sdata);
- ieee80211_mbss_info_change_notify(sdata, changed);
-
-+ mesh_fast_tx_gc(sdata);
-+
- mod_timer(&ifmsh->housekeeping_timer,
- round_jiffies(jiffies +
- IEEE80211_MESH_HOUSEKEEPING_INTERVAL));
---- a/net/mac80211/mesh.h
-+++ b/net/mac80211/mesh.h
-@@ -122,11 +122,41 @@ struct mesh_path {
- u8 rann_snd_addr[ETH_ALEN];
- u32 rann_metric;
- unsigned long last_preq_to_root;
-+ unsigned long fast_tx_check;
- bool is_root;
- bool is_gate;
- u32 path_change_count;
- };
-
-+#define MESH_FAST_TX_CACHE_MAX_SIZE 512
-+#define MESH_FAST_TX_CACHE_THRESHOLD_SIZE 384
-+#define MESH_FAST_TX_CACHE_TIMEOUT 8000 /* msecs */
-+
-+/**
-+ * struct ieee80211_mesh_fast_tx - cached mesh fast tx entry
-+ * @rhash: rhashtable pointer
-+ * @addr_key: The Ethernet DA which is the key for this entry
-+ * @fast_tx: base fast_tx data
-+ * @hdr: cached mesh and rfc1042 headers
-+ * @hdrlen: length of mesh + rfc1042
-+ * @walk_list: list containing all the fast tx entries
-+ * @mpath: mesh path corresponding to the Mesh DA
-+ * @mppath: MPP entry corresponding to this DA
-+ * @timestamp: Last used time of this entry
-+ */
-+struct ieee80211_mesh_fast_tx {
-+ struct rhash_head rhash;
-+ u8 addr_key[ETH_ALEN] __aligned(2);
-+
-+ struct ieee80211_fast_tx fast_tx;
-+ u8 hdr[sizeof(struct ieee80211s_hdr) + sizeof(rfc1042_header)];
-+ u16 hdrlen;
-+
-+ struct mesh_path *mpath, *mppath;
-+ struct hlist_node walk_list;
-+ unsigned long timestamp;
-+};
-+
- /* Recent multicast cache */
- /* RMC_BUCKETS must be a power of 2, maximum 256 */
- #define RMC_BUCKETS 256
-@@ -298,6 +328,20 @@ void mesh_path_discard_frame(struct ieee
- void mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata);
-
- bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt);
-+struct ieee80211_mesh_fast_tx *
-+mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr);
-+bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata,
-+ struct sk_buff *skb, u32 ctrl_flags);
-+void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata,
-+ struct sk_buff *skb, struct mesh_path *mpath);
-+void mesh_fast_tx_gc(struct ieee80211_sub_if_data *sdata);
-+void mesh_fast_tx_flush_addr(struct ieee80211_sub_if_data *sdata,
-+ const u8 *addr);
-+void mesh_fast_tx_flush_mpath(struct mesh_path *mpath);
-+void mesh_fast_tx_flush_sta(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta);
-+void mesh_path_refresh(struct ieee80211_sub_if_data *sdata,
-+ struct mesh_path *mpath, const u8 *addr);
-
- #ifdef CPTCFG_MAC80211_MESH
- static inline
---- a/net/mac80211/mesh_hwmp.c
-+++ b/net/mac80211/mesh_hwmp.c
-@@ -394,6 +394,7 @@ static u32 hwmp_route_info_get(struct ie
- u32 orig_sn, orig_metric;
- unsigned long orig_lifetime, exp_time;
- u32 last_hop_metric, new_metric;
-+ bool flush_mpath = false;
- bool process = true;
- u8 hopcount;
-
-@@ -491,8 +492,10 @@ static u32 hwmp_route_info_get(struct ie
- }
-
- if (fresh_info) {
-- if (rcu_access_pointer(mpath->next_hop) != sta)
-+ if (rcu_access_pointer(mpath->next_hop) != sta) {
- mpath->path_change_count++;
-+ flush_mpath = true;
-+ }
- mesh_path_assign_nexthop(mpath, sta);
- mpath->flags |= MESH_PATH_SN_VALID;
- mpath->metric = new_metric;
-@@ -502,6 +505,8 @@ static u32 hwmp_route_info_get(struct ie
- mpath->hop_count = hopcount;
- mesh_path_activate(mpath);
- spin_unlock_bh(&mpath->state_lock);
-+ if (flush_mpath)
-+ mesh_fast_tx_flush_mpath(mpath);
- ewma_mesh_fail_avg_init(&sta->mesh->fail_avg);
- /* init it at a low value - 0 start is tricky */
- ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1);
-@@ -539,8 +544,10 @@ static u32 hwmp_route_info_get(struct ie
- }
-
- if (fresh_info) {
-- if (rcu_access_pointer(mpath->next_hop) != sta)
-+ if (rcu_access_pointer(mpath->next_hop) != sta) {
- mpath->path_change_count++;
-+ flush_mpath = true;
-+ }
- mesh_path_assign_nexthop(mpath, sta);
- mpath->metric = last_hop_metric;
- mpath->exp_time = time_after(mpath->exp_time, exp_time)
-@@ -548,6 +555,8 @@ static u32 hwmp_route_info_get(struct ie
- mpath->hop_count = 1;
- mesh_path_activate(mpath);
- spin_unlock_bh(&mpath->state_lock);
-+ if (flush_mpath)
-+ mesh_fast_tx_flush_mpath(mpath);
- ewma_mesh_fail_avg_init(&sta->mesh->fail_avg);
- /* init it at a low value - 0 start is tricky */
- ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1);
-@@ -1215,6 +1224,20 @@ static int mesh_nexthop_lookup_nolearn(s
- return 0;
- }
-
-+void mesh_path_refresh(struct ieee80211_sub_if_data *sdata,
-+ struct mesh_path *mpath, const u8 *addr)
-+{
-+ if (mpath->flags & (MESH_PATH_REQ_QUEUED | MESH_PATH_FIXED |
-+ MESH_PATH_RESOLVING))
-+ return;
-+
-+ if (time_after(jiffies,
-+ mpath->exp_time -
-+ msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) &&
-+ (!addr || ether_addr_equal(sdata->vif.addr, addr)))
-+ mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
-+}
-+
- /**
- * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling
- * this function is considered "using" the associated mpath, so preempt a path
-@@ -1242,19 +1265,15 @@ int mesh_nexthop_lookup(struct ieee80211
- if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE))
- return -ENOENT;
-
-- if (time_after(jiffies,
-- mpath->exp_time -
-- msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) &&
-- ether_addr_equal(sdata->vif.addr, hdr->addr4) &&
-- !(mpath->flags & MESH_PATH_RESOLVING) &&
-- !(mpath->flags & MESH_PATH_FIXED))
-- mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
-+ mesh_path_refresh(sdata, mpath, hdr->addr4);
-
- next_hop = rcu_dereference(mpath->next_hop);
- if (next_hop) {
- memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN);
- memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
- ieee80211_mps_set_frame_flags(sdata, next_hop, hdr);
-+ if (ieee80211_hw_check(&sdata->local->hw, SUPPORT_FAST_XMIT))
-+ mesh_fast_tx_cache(sdata, skb, mpath);
- return 0;
- }
-
---- a/net/mac80211/mesh_pathtbl.c
-+++ b/net/mac80211/mesh_pathtbl.c
-@@ -14,6 +14,7 @@
- #include "wme.h"
- #include "ieee80211_i.h"
- #include "mesh.h"
-+#include <linux/rhashtable.h>
-
- static void mesh_path_free_rcu(struct mesh_table *tbl, struct mesh_path *mpath);
-
-@@ -32,6 +33,41 @@ static const struct rhashtable_params me
- .hashfn = mesh_table_hash,
- };
-
-+static const struct rhashtable_params fast_tx_rht_params = {
-+ .nelem_hint = 10,
-+ .automatic_shrinking = true,
-+ .key_len = ETH_ALEN,
-+ .key_offset = offsetof(struct ieee80211_mesh_fast_tx, addr_key),
-+ .head_offset = offsetof(struct ieee80211_mesh_fast_tx, rhash),
-+ .hashfn = mesh_table_hash,
-+};
-+
-+static void __mesh_fast_tx_entry_free(void *ptr, void *tblptr)
-+{
-+ struct ieee80211_mesh_fast_tx *entry = ptr;
-+
-+ kfree_rcu(entry, fast_tx.rcu_head);
-+}
-+
-+static void mesh_fast_tx_deinit(struct ieee80211_sub_if_data *sdata)
-+{
-+ struct mesh_tx_cache *cache;
-+
-+ cache = &sdata->u.mesh.tx_cache;
-+ rhashtable_free_and_destroy(&cache->rht,
-+ __mesh_fast_tx_entry_free, NULL);
-+}
-+
-+static void mesh_fast_tx_init(struct ieee80211_sub_if_data *sdata)
-+{
-+ struct mesh_tx_cache *cache;
-+
-+ cache = &sdata->u.mesh.tx_cache;
-+ rhashtable_init(&cache->rht, &fast_tx_rht_params);
-+ INIT_HLIST_HEAD(&cache->walk_head);
-+ spin_lock_init(&cache->walk_lock);
-+}
-+
- static inline bool mpath_expired(struct mesh_path *mpath)
- {
- return (mpath->flags & MESH_PATH_ACTIVE) &&
-@@ -381,6 +417,243 @@ struct mesh_path *mesh_path_new(struct i
- return new_mpath;
- }
-
-+static void mesh_fast_tx_entry_free(struct mesh_tx_cache *cache,
-+ struct ieee80211_mesh_fast_tx *entry)
-+{
-+ hlist_del_rcu(&entry->walk_list);
-+ rhashtable_remove_fast(&cache->rht, &entry->rhash, fast_tx_rht_params);
-+ kfree_rcu(entry, fast_tx.rcu_head);
-+}
-+
-+struct ieee80211_mesh_fast_tx *
-+mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr)
-+{
-+ struct ieee80211_mesh_fast_tx *entry;
-+ struct mesh_tx_cache *cache;
-+
-+ cache = &sdata->u.mesh.tx_cache;
-+ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params);
-+ if (!entry)
-+ return NULL;
-+
-+ if (!(entry->mpath->flags & MESH_PATH_ACTIVE) ||
-+ mpath_expired(entry->mpath)) {
-+ spin_lock_bh(&cache->walk_lock);
-+ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params);
-+ if (entry)
-+ mesh_fast_tx_entry_free(cache, entry);
-+ spin_unlock_bh(&cache->walk_lock);
-+ return NULL;
-+ }
-+
-+ mesh_path_refresh(sdata, entry->mpath, NULL);
-+ if (entry->mppath)
-+ entry->mppath->exp_time = jiffies;
-+ entry->timestamp = jiffies;
-+
-+ return entry;
-+}
-+
-+void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata,
-+ struct sk_buff *skb, struct mesh_path *mpath)
-+{
-+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-+ struct ieee80211_mesh_fast_tx *entry, *prev;
-+ struct ieee80211_mesh_fast_tx build = {};
-+ struct ieee80211s_hdr *meshhdr;
-+ struct mesh_tx_cache *cache;
-+ struct ieee80211_key *key;
-+ struct mesh_path *mppath;
-+ struct sta_info *sta;
-+ u8 *qc;
-+
-+ if (sdata->noack_map ||
-+ !ieee80211_is_data_qos(hdr->frame_control))
-+ return;
-+
-+ build.fast_tx.hdr_len = ieee80211_hdrlen(hdr->frame_control);
-+ meshhdr = (struct ieee80211s_hdr *)(skb->data + build.fast_tx.hdr_len);
-+ build.hdrlen = ieee80211_get_mesh_hdrlen(meshhdr);
-+
-+ cache = &sdata->u.mesh.tx_cache;
-+ if (atomic_read(&cache->rht.nelems) >= MESH_FAST_TX_CACHE_MAX_SIZE)
-+ return;
-+
-+ sta = rcu_dereference(mpath->next_hop);
-+ if (!sta)
-+ return;
-+
-+ if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) {
-+ /* This is required to keep the mppath alive */
-+ mppath = mpp_path_lookup(sdata, meshhdr->eaddr1);
-+ if (!mppath)
-+ return;
-+ build.mppath = mppath;
-+ } else if (ieee80211_has_a4(hdr->frame_control)) {
-+ mppath = mpath;
-+ } else {
-+ return;
-+ }
-+
-+ /* rate limit, in case fast xmit can't be enabled */
-+ if (mppath->fast_tx_check == jiffies)
-+ return;
-+
-+ mppath->fast_tx_check = jiffies;
-+
-+ /*
-+ * Same use of the sta lock as in ieee80211_check_fast_xmit, in order
-+ * to protect against concurrent sta key updates.
-+ */
-+ spin_lock_bh(&sta->lock);
-+ key = rcu_access_pointer(sta->ptk[sta->ptk_idx]);
-+ if (!key)
-+ key = rcu_access_pointer(sdata->default_unicast_key);
-+ build.fast_tx.key = key;
-+
-+ if (key) {
-+ bool gen_iv, iv_spc;
-+
-+ gen_iv = key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV;
-+ iv_spc = key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE;
-+
-+ if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) ||
-+ (key->flags & KEY_FLAG_TAINTED))
-+ goto unlock_sta;
-+
-+ switch (key->conf.cipher) {
-+ case WLAN_CIPHER_SUITE_CCMP:
-+ case WLAN_CIPHER_SUITE_CCMP_256:
-+ if (gen_iv)
-+ build.fast_tx.pn_offs = build.fast_tx.hdr_len;
-+ if (gen_iv || iv_spc)
-+ build.fast_tx.hdr_len += IEEE80211_CCMP_HDR_LEN;
-+ break;
-+ case WLAN_CIPHER_SUITE_GCMP:
-+ case WLAN_CIPHER_SUITE_GCMP_256:
-+ if (gen_iv)
-+ build.fast_tx.pn_offs = build.fast_tx.hdr_len;
-+ if (gen_iv || iv_spc)
-+ build.fast_tx.hdr_len += IEEE80211_GCMP_HDR_LEN;
-+ break;
-+ default:
-+ goto unlock_sta;
-+ }
-+ }
-+
-+ memcpy(build.addr_key, mppath->dst, ETH_ALEN);
-+ build.timestamp = jiffies;
-+ build.fast_tx.band = info->band;
-+ build.fast_tx.da_offs = offsetof(struct ieee80211_hdr, addr3);
-+ build.fast_tx.sa_offs = offsetof(struct ieee80211_hdr, addr4);
-+ build.mpath = mpath;
-+ memcpy(build.hdr, meshhdr, build.hdrlen);
-+ memcpy(build.hdr + build.hdrlen, rfc1042_header, sizeof(rfc1042_header));
-+ build.hdrlen += sizeof(rfc1042_header);
-+ memcpy(build.fast_tx.hdr, hdr, build.fast_tx.hdr_len);
-+
-+ hdr = (struct ieee80211_hdr *)build.fast_tx.hdr;
-+ if (build.fast_tx.key)
-+ hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
-+
-+ qc = ieee80211_get_qos_ctl(hdr);
-+ qc[1] |= IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT >> 8;
-+
-+ entry = kmemdup(&build, sizeof(build), GFP_ATOMIC);
-+ if (!entry)
-+ goto unlock_sta;
-+
-+ spin_lock(&cache->walk_lock);
-+ prev = rhashtable_lookup_get_insert_fast(&cache->rht,
-+ &entry->rhash,
-+ fast_tx_rht_params);
-+ if (unlikely(IS_ERR(prev))) {
-+ kfree(entry);
-+ goto unlock_cache;
-+ }
-+
-+ /*
-+ * replace any previous entry in the hash table, in case we're
-+ * replacing it with a different type (e.g. mpath -> mpp)
-+ */
-+ if (unlikely(prev)) {
-+ rhashtable_replace_fast(&cache->rht, &prev->rhash,
-+ &entry->rhash, fast_tx_rht_params);
-+ hlist_del_rcu(&prev->walk_list);
-+ kfree_rcu(prev, fast_tx.rcu_head);
-+ }
-+
-+ hlist_add_head(&entry->walk_list, &cache->walk_head);
-+
-+unlock_cache:
-+ spin_unlock(&cache->walk_lock);
-+unlock_sta:
-+ spin_unlock_bh(&sta->lock);
-+}
-+
-+void mesh_fast_tx_gc(struct ieee80211_sub_if_data *sdata)
-+{
-+ unsigned long timeout = msecs_to_jiffies(MESH_FAST_TX_CACHE_TIMEOUT);
-+ struct mesh_tx_cache *cache;
-+ struct ieee80211_mesh_fast_tx *entry;
-+ struct hlist_node *n;
-+
-+ cache = &sdata->u.mesh.tx_cache;
-+ if (atomic_read(&cache->rht.nelems) < MESH_FAST_TX_CACHE_THRESHOLD_SIZE)
-+ return;
-+
-+ spin_lock_bh(&cache->walk_lock);
-+ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list)
-+ if (!time_is_after_jiffies(entry->timestamp + timeout))
-+ mesh_fast_tx_entry_free(cache, entry);
-+ spin_unlock_bh(&cache->walk_lock);
-+}
-+
-+void mesh_fast_tx_flush_mpath(struct mesh_path *mpath)
-+{
-+ struct ieee80211_sub_if_data *sdata = mpath->sdata;
-+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache;
-+ struct ieee80211_mesh_fast_tx *entry;
-+ struct hlist_node *n;
-+
-+ cache = &sdata->u.mesh.tx_cache;
-+ spin_lock_bh(&cache->walk_lock);
-+ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list)
-+ if (entry->mpath == mpath)
-+ mesh_fast_tx_entry_free(cache, entry);
-+ spin_unlock_bh(&cache->walk_lock);
-+}
-+
-+void mesh_fast_tx_flush_sta(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta)
-+{
-+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache;
-+ struct ieee80211_mesh_fast_tx *entry;
-+ struct hlist_node *n;
-+
-+ cache = &sdata->u.mesh.tx_cache;
-+ spin_lock_bh(&cache->walk_lock);
-+ hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list)
-+ if (rcu_access_pointer(entry->mpath->next_hop) == sta)
-+ mesh_fast_tx_entry_free(cache, entry);
-+ spin_unlock_bh(&cache->walk_lock);
-+}
-+
-+void mesh_fast_tx_flush_addr(struct ieee80211_sub_if_data *sdata,
-+ const u8 *addr)
-+{
-+ struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache;
-+ struct ieee80211_mesh_fast_tx *entry;
-+
-+ cache = &sdata->u.mesh.tx_cache;
-+ spin_lock_bh(&cache->walk_lock);
-+ entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params);
-+ if (entry)
-+ mesh_fast_tx_entry_free(cache, entry);
-+ spin_unlock_bh(&cache->walk_lock);
-+}
-+
- /**
- * mesh_path_add - allocate and add a new path to the mesh path table
- * @dst: destination address of the path (ETH_ALEN length)
-@@ -464,6 +737,8 @@ int mpp_path_add(struct ieee80211_sub_if
-
- if (ret)
- kfree(new_mpath);
-+ else
-+ mesh_fast_tx_flush_addr(sdata, dst);
-
- sdata->u.mesh.mpp_paths_generation++;
- return ret;
-@@ -523,6 +798,10 @@ static void __mesh_path_del(struct mesh_
- {
- hlist_del_rcu(&mpath->walk_list);
- rhashtable_remove_fast(&tbl->rhead, &mpath->rhash, mesh_rht_params);
-+ if (tbl == &mpath->sdata->u.mesh.mpp_paths)
-+ mesh_fast_tx_flush_addr(mpath->sdata, mpath->dst);
-+ else
-+ mesh_fast_tx_flush_mpath(mpath);
- mesh_path_free_rcu(tbl, mpath);
- }
-
-@@ -747,6 +1026,7 @@ void mesh_path_fix_nexthop(struct mesh_p
- mpath->exp_time = 0;
- mpath->flags = MESH_PATH_FIXED | MESH_PATH_SN_VALID;
- mesh_path_activate(mpath);
-+ mesh_fast_tx_flush_mpath(mpath);
- spin_unlock_bh(&mpath->state_lock);
- ewma_mesh_fail_avg_init(&next_hop->mesh->fail_avg);
- /* init it at a low value - 0 start is tricky */
-@@ -758,6 +1038,7 @@ void mesh_pathtbl_init(struct ieee80211_
- {
- mesh_table_init(&sdata->u.mesh.mesh_paths);
- mesh_table_init(&sdata->u.mesh.mpp_paths);
-+ mesh_fast_tx_init(sdata);
- }
-
- static
-@@ -785,6 +1066,7 @@ void mesh_path_expire(struct ieee80211_s
-
- void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata)
- {
-+ mesh_fast_tx_deinit(sdata);
- mesh_table_free(&sdata->u.mesh.mesh_paths);
- mesh_table_free(&sdata->u.mesh.mpp_paths);
- }
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2791,6 +2791,7 @@ ieee80211_rx_mesh_data(struct ieee80211_
- if (mesh_hdr->flags & MESH_FLAGS_AE) {
- struct mesh_path *mppath;
- char *proxied_addr;
-+ bool update = false;
-
- if (multicast)
- proxied_addr = mesh_hdr->eaddr1;
-@@ -2806,11 +2807,18 @@ ieee80211_rx_mesh_data(struct ieee80211_
- mpp_path_add(sdata, proxied_addr, eth->h_source);
- } else {
- spin_lock_bh(&mppath->state_lock);
-- if (!ether_addr_equal(mppath->mpp, eth->h_source))
-+ if (!ether_addr_equal(mppath->mpp, eth->h_source)) {
- memcpy(mppath->mpp, eth->h_source, ETH_ALEN);
-+ update = true;
-+ }
- mppath->exp_time = jiffies;
- spin_unlock_bh(&mppath->state_lock);
- }
-+
-+ /* flush fast xmit cache if the address path changed */
-+ if (update)
-+ mesh_fast_tx_flush_addr(sdata, proxied_addr);
-+
- rcu_read_unlock();
- }
-
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -3022,6 +3022,9 @@ void ieee80211_check_fast_xmit(struct st
- if (!ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT))
- return;
-
-+ if (ieee80211_vif_is_mesh(&sdata->vif))
-+ mesh_fast_tx_flush_sta(sdata, sta);
-+
- /* Locking here protects both the pointer itself, and against concurrent
- * invocations winning data access races to, e.g., the key pointer that
- * is used.
-@@ -3403,6 +3406,9 @@ static bool ieee80211_amsdu_aggregate(st
- if (sdata->vif.offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED)
- return false;
-
-+ if (ieee80211_vif_is_mesh(&sdata->vif))
-+ return false;
-+
- if (skb_is_gso(skb))
- return false;
-
-@@ -3635,10 +3641,11 @@ free:
- return NULL;
- }
-
--static void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
-- struct sta_info *sta,
-- struct ieee80211_fast_tx *fast_tx,
-- struct sk_buff *skb, u8 tid, bool ampdu)
-+void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta,
-+ struct ieee80211_fast_tx *fast_tx,
-+ struct sk_buff *skb, bool ampdu,
-+ const u8 *da, const u8 *sa)
- {
- struct ieee80211_local *local = sdata->local;
- struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
-@@ -3647,7 +3654,6 @@ static void __ieee80211_xmit_fast(struct
- ieee80211_tx_result r;
- int hw_headroom = sdata->local->hw.extra_tx_headroom;
- int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
-- struct ethhdr eth;
-
- skb = skb_share_check(skb, GFP_ATOMIC);
- if (unlikely(!skb))
-@@ -3667,11 +3673,10 @@ static void __ieee80211_xmit_fast(struct
- ENCRYPT_NO)))
- goto free;
-
-- memcpy(ð, skb->data, ETH_HLEN - 2);
- hdr = skb_push(skb, extra_head);
- memcpy(skb->data, fast_tx->hdr, fast_tx->hdr_len);
-- memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN);
-- memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN);
-+ memcpy(skb->data + fast_tx->da_offs, da, ETH_ALEN);
-+ memcpy(skb->data + fast_tx->sa_offs, sa, ETH_ALEN);
-
- info = IEEE80211_SKB_CB(skb);
- memset(info, 0, sizeof(*info));
-@@ -3690,7 +3695,8 @@ static void __ieee80211_xmit_fast(struct
- #endif
-
- if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
-- tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
-+ u8 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
-+
- *ieee80211_get_qos_ctl(hdr) = tid;
- }
-
-@@ -3733,6 +3739,7 @@ static bool ieee80211_xmit_fast(struct i
- struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
- struct tid_ampdu_tx *tid_tx = NULL;
- struct sk_buff *next;
-+ struct ethhdr eth;
- u8 tid = IEEE80211_NUM_TIDS;
-
- /* control port protocol needs a lot of special handling */
-@@ -3758,6 +3765,8 @@ static bool ieee80211_xmit_fast(struct i
- }
- }
-
-+ memcpy(ð, skb->data, ETH_HLEN - 2);
-+
- /* after this point (skb is modified) we cannot return false */
- skb = ieee80211_tx_skb_fixup(skb, ieee80211_sdata_netdev_features(sdata));
- if (!skb)
-@@ -3765,7 +3774,8 @@ static bool ieee80211_xmit_fast(struct i
-
- skb_list_walk_safe(skb, skb, next) {
- skb_mark_not_on_list(skb);
-- __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid, tid_tx);
-+ __ieee80211_xmit_fast(sdata, sta, fast_tx, skb, tid_tx,
-+ eth.h_dest, eth.h_source);
- }
-
- return true;
-@@ -4252,8 +4262,15 @@ void __ieee80211_subif_start_xmit(struct
- return;
- }
-
-+ sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
-+
- rcu_read_lock();
-
-+ if (ieee80211_vif_is_mesh(&sdata->vif) &&
-+ ieee80211_hw_check(&local->hw, SUPPORT_FAST_XMIT) &&
-+ ieee80211_mesh_xmit_fast(sdata, skb, ctrl_flags))
-+ goto out;
-+
- if (ieee80211_lookup_ra_sta(sdata, skb, &sta))
- goto out_free;
-
-@@ -4263,8 +4280,6 @@ void __ieee80211_subif_start_xmit(struct
- skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, sta, skb));
- ieee80211_aggr_check(sdata, sta, skb);
-
-- sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift);
--
- if (sta) {
- struct ieee80211_fast_tx *fast_tx;
-
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Thu, 16 Feb 2023 11:07:30 +0100
-Subject: [PATCH] wifi: mac80211: use mesh header cache to speed up mesh
- forwarding
-
-Significantly reduces mesh forwarding path CPU usage and enables the
-direct use of iTXQ.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2720,6 +2720,65 @@ ieee80211_deliver_skb(struct ieee80211_r
- }
- }
-
-+#ifdef CPTCFG_MAC80211_MESH
-+static bool
-+ieee80211_rx_mesh_fast_forward(struct ieee80211_sub_if_data *sdata,
-+ struct sk_buff *skb, int hdrlen)
-+{
-+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-+ struct ieee80211_mesh_fast_tx *entry = NULL;
-+ struct ieee80211s_hdr *mesh_hdr;
-+ struct tid_ampdu_tx *tid_tx;
-+ struct sta_info *sta;
-+ struct ethhdr eth;
-+ u8 tid;
-+
-+ mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(eth));
-+ if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6)
-+ entry = mesh_fast_tx_get(sdata, mesh_hdr->eaddr1);
-+ else if (!(mesh_hdr->flags & MESH_FLAGS_AE))
-+ entry = mesh_fast_tx_get(sdata, skb->data);
-+ if (!entry)
-+ return false;
-+
-+ sta = rcu_dereference(entry->mpath->next_hop);
-+ if (!sta)
-+ return false;
-+
-+ if (skb_linearize(skb))
-+ return false;
-+
-+ tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
-+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
-+ if (tid_tx) {
-+ if (!test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state))
-+ return false;
-+
-+ if (tid_tx->timeout)
-+ tid_tx->last_tx = jiffies;
-+ }
-+
-+ ieee80211_aggr_check(sdata, sta, skb);
-+
-+ if (ieee80211_get_8023_tunnel_proto(skb->data + hdrlen,
-+ &skb->protocol))
-+ hdrlen += ETH_ALEN;
-+ else
-+ skb->protocol = htons(skb->len - hdrlen);
-+ skb_set_network_header(skb, hdrlen + 2);
-+
-+ skb->dev = sdata->dev;
-+ memcpy(ð, skb->data, ETH_HLEN - 2);
-+ skb_pull(skb, 2);
-+ __ieee80211_xmit_fast(sdata, sta, &entry->fast_tx, skb, tid_tx,
-+ eth.h_dest, eth.h_source);
-+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast);
-+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames);
-+
-+ return true;
-+}
-+#endif
-+
- static ieee80211_rx_result
- ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta,
- struct sk_buff *skb)
-@@ -2824,6 +2883,10 @@ ieee80211_rx_mesh_data(struct ieee80211_
-
- skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]);
-
-+ if (!multicast &&
-+ ieee80211_rx_mesh_fast_forward(sdata, skb, mesh_hdrlen))
-+ return RX_QUEUED;
-+
- ieee80211_fill_mesh_addresses(&hdr, &hdr.frame_control,
- eth->h_dest, eth->h_source);
- hdrlen = ieee80211_hdrlen(hdr.frame_control);
-@@ -2862,6 +2925,7 @@ ieee80211_rx_mesh_data(struct ieee80211_
- info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
- info->control.vif = &sdata->vif;
- info->control.jiffies = jiffies;
-+ fwd_skb->dev = sdata->dev;
- if (multicast) {
- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast);
- memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN);
-@@ -2883,7 +2947,6 @@ ieee80211_rx_mesh_data(struct ieee80211_
- }
-
- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames);
-- fwd_skb->dev = sdata->dev;
- ieee80211_add_pending_skb(local, fwd_skb);
-
- rx_accept:
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -2022,6 +2022,8 @@ void __ieee80211_xmit_fast(struct ieee80
- struct ieee80211_fast_tx *fast_tx,
- struct sk_buff *skb, bool ampdu,
- const u8 *da, const u8 *sa);
-+void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta, struct sk_buff *skb);
-
- /* HT */
- void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -1191,10 +1191,8 @@ static bool ieee80211_tx_prep_agg(struct
- return queued;
- }
-
--static void
--ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata,
-- struct sta_info *sta,
-- struct sk_buff *skb)
-+void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta, struct sk_buff *skb)
- {
- struct rate_control_ref *ref = sdata->local->rate_ctrl;
- u16 tid;
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Mon, 20 Feb 2023 12:50:50 +0100
-Subject: [PATCH] mac80211: fix mesh forwarding
-
-Linearize packets (needed for forwarding A-MSDU subframes).
-Fix network header offset to fix flow dissector (and fair queueing).
-
-Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2904,6 +2904,9 @@ ieee80211_rx_mesh_data(struct ieee80211_
-
- if (skb_cow_head(fwd_skb, hdrlen - sizeof(struct ethhdr)))
- return RX_DROP_UNUSABLE;
-+
-+ if (skb_linearize(fwd_skb))
-+ return RX_DROP_UNUSABLE;
- }
-
- fwd_hdr = skb_push(fwd_skb, hdrlen - sizeof(struct ethhdr));
-@@ -2918,7 +2921,7 @@ ieee80211_rx_mesh_data(struct ieee80211_
- hdrlen += ETH_ALEN;
- else
- fwd_skb->protocol = htons(fwd_skb->len - hdrlen);
-- skb_set_network_header(fwd_skb, hdrlen);
-+ skb_set_network_header(fwd_skb, hdrlen + 2);
-
- info = IEEE80211_SKB_CB(fwd_skb);
- memset(info, 0, sizeof(*info));
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sun, 26 Feb 2023 20:30:20 +0100
-Subject: [PATCH] wifi: mac80211: fix mesh path discovery based on unicast
- packets
-
-If a packet has reached its intended destination, it was bumped to the code
-that accepts it, without first checking if a mesh_path needs to be created
-based on the discovered source.
-Fix this by moving the destination address check further down
-
-Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2824,17 +2824,6 @@ ieee80211_rx_mesh_data(struct ieee80211_
- mesh_rmc_check(sdata, eth->h_source, mesh_hdr))
- return RX_DROP_MONITOR;
-
-- /* Frame has reached destination. Don't forward */
-- if (ether_addr_equal(sdata->vif.addr, eth->h_dest))
-- goto rx_accept;
--
-- if (!ifmsh->mshcfg.dot11MeshForwarding) {
-- if (is_multicast_ether_addr(eth->h_dest))
-- goto rx_accept;
--
-- return RX_DROP_MONITOR;
-- }
--
- /* forward packet */
- if (sdata->crypto_tx_tailroom_needed_cnt)
- tailroom = IEEE80211_ENCRYPT_TAILROOM;
-@@ -2881,6 +2870,17 @@ ieee80211_rx_mesh_data(struct ieee80211_
- rcu_read_unlock();
- }
-
-+ /* Frame has reached destination. Don't forward */
-+ if (ether_addr_equal(sdata->vif.addr, eth->h_dest))
-+ goto rx_accept;
-+
-+ if (!ifmsh->mshcfg.dot11MeshForwarding) {
-+ if (is_multicast_ether_addr(eth->h_dest))
-+ goto rx_accept;
-+
-+ return RX_DROP_MONITOR;
-+ }
-+
- skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]);
-
- if (!multicast &&
+++ /dev/null
-From: Muna Sinada <quic_msinada@quicinc.com>
-Date: Wed, 5 Oct 2022 14:54:45 -0700
-Subject: [PATCH] wifi: mac80211: Add VHT MU-MIMO related flags in
- ieee80211_bss_conf
-
-Adding flags for SU Beamformer, SU Beamformee, MU Beamformer and
-MU Beamformee for VHT. This is utilized to pass MU-MIMO
-configurations from user space to driver in AP mode.
-
-Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
-Link: https://lore.kernel.org/r/1665006886-23874-1-git-send-email-quic_msinada@quicinc.com
-[fixed indentation, removed redundant !!]
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -653,6 +653,14 @@ struct ieee80211_fils_discovery {
- * write-protected by sdata_lock and local->mtx so holding either is fine
- * for read access.
- * @color_change_color: the bss color that will be used after the change.
-+ * @vht_su_beamformer: in AP mode, does this BSS support operation as an VHT SU
-+ * beamformer
-+ * @vht_su_beamformee: in AP mode, does this BSS support operation as an VHT SU
-+ * beamformee
-+ * @vht_mu_beamformer: in AP mode, does this BSS support operation as an VHT MU
-+ * beamformer
-+ * @vht_mu_beamformee: in AP mode, does this BSS support operation as an VHT MU
-+ * beamformee
- */
- struct ieee80211_bss_conf {
- const u8 *bssid;
-@@ -726,6 +734,11 @@ struct ieee80211_bss_conf {
-
- bool color_change_active;
- u8 color_change_color;
-+
-+ bool vht_su_beamformer;
-+ bool vht_su_beamformee;
-+ bool vht_mu_beamformer;
-+ bool vht_mu_beamformee;
- };
-
- /**
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -1252,6 +1252,21 @@ static int ieee80211_start_ap(struct wip
- prev_beacon_int = link_conf->beacon_int;
- link_conf->beacon_int = params->beacon_interval;
-
-+ if (params->vht_cap) {
-+ link_conf->vht_su_beamformer =
-+ params->vht_cap->vht_cap_info &
-+ cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);
-+ link_conf->vht_su_beamformee =
-+ params->vht_cap->vht_cap_info &
-+ cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE);
-+ link_conf->vht_mu_beamformer =
-+ params->vht_cap->vht_cap_info &
-+ cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE);
-+ link_conf->vht_mu_beamformee =
-+ params->vht_cap->vht_cap_info &
-+ cpu_to_le32(IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
-+ }
-+
- if (params->he_cap && params->he_oper) {
- link_conf->he_support = true;
- link_conf->htc_trig_based_pkt_ext =
+++ /dev/null
-From: Muna Sinada <quic_msinada@quicinc.com>
-Date: Wed, 5 Oct 2022 14:54:46 -0700
-Subject: [PATCH] wifi: mac80211: Add HE MU-MIMO related flags in
- ieee80211_bss_conf
-
-Adding flags for SU Beamformer, SU Beamformee, MU Beamformer and Full
-Bandwidth UL MU-MIMO for HE. This is utilized to pass MU-MIMO
-configurations from user space to driver in AP mode.
-
-Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
-Link: https://lore.kernel.org/r/1665006886-23874-2-git-send-email-quic_msinada@quicinc.com
-[fixed indentation, removed redundant !!]
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -661,6 +661,15 @@ struct ieee80211_fils_discovery {
- * beamformer
- * @vht_mu_beamformee: in AP mode, does this BSS support operation as an VHT MU
- * beamformee
-+ * @he_su_beamformer: in AP-mode, does this BSS support operation as an HE SU
-+ * beamformer
-+ * @he_su_beamformee: in AP-mode, does this BSS support operation as an HE SU
-+ * beamformee
-+ * @he_mu_beamformer: in AP-mode, does this BSS support operation as an HE MU
-+ * beamformer
-+ * @he_full_ul_mumimo: does this BSS support the reception (AP) or transmission
-+ * (non-AP STA) of an HE TB PPDU on an RU that spans the entire PPDU
-+ * bandwidth
- */
- struct ieee80211_bss_conf {
- const u8 *bssid;
-@@ -739,6 +748,10 @@ struct ieee80211_bss_conf {
- bool vht_su_beamformee;
- bool vht_mu_beamformer;
- bool vht_mu_beamformee;
-+ bool he_su_beamformer;
-+ bool he_su_beamformee;
-+ bool he_mu_beamformer;
-+ bool he_full_ul_mumimo;
- };
-
- /**
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -1281,6 +1281,21 @@ static int ieee80211_start_ap(struct wip
- changed |= BSS_CHANGED_HE_BSS_COLOR;
- }
-
-+ if (params->he_cap) {
-+ link_conf->he_su_beamformer =
-+ params->he_cap->phy_cap_info[3] &
-+ IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER;
-+ link_conf->he_su_beamformee =
-+ params->he_cap->phy_cap_info[4] &
-+ IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE;
-+ link_conf->he_mu_beamformer =
-+ params->he_cap->phy_cap_info[4] &
-+ IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER;
-+ link_conf->he_full_ul_mumimo =
-+ params->he_cap->phy_cap_info[2] &
-+ IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO;
-+ }
-+
- if (sdata->vif.type == NL80211_IFTYPE_AP &&
- params->mbssid_config.tx_wdev) {
- err = ieee80211_set_ap_mbssid_options(sdata,
+++ /dev/null
-From: Ryder Lee <ryder.lee@mediatek.com>
-Date: Sat, 18 Feb 2023 01:50:05 +0800
-Subject: [PATCH] wifi: mac80211: introduce
- ieee80211_refresh_tx_agg_session_timer()
-
-This allows low level drivers to refresh the tx agg session timer, based on
-querying stats from the firmware usually. Especially for some mt76 devices
-support .net_fill_forward_path would bypass mac80211, which leads to tx BA
-session timeout for certain clients.
-
-Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -5964,6 +5964,18 @@ void ieee80211_queue_delayed_work(struct
- unsigned long delay);
-
- /**
-+ * ieee80211_refresh_tx_agg_session_timer - Refresh a tx agg session timer.
-+ * @sta: the station for which to start a BA session
-+ * @tid: the TID to BA on.
-+ *
-+ * This function allows low level driver to refresh tx agg session timer
-+ * to maintain BA session, the session level will still be managed by the
-+ * mac80211.
-+ */
-+void ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta,
-+ u16 tid);
-+
-+/**
- * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
- * @sta: the station for which to start a BA session
- * @tid: the TID to BA on.
---- a/net/mac80211/agg-tx.c
-+++ b/net/mac80211/agg-tx.c
-@@ -554,6 +554,23 @@ void ieee80211_tx_ba_session_handle_star
- ieee80211_send_addba_with_timeout(sta, tid_tx);
- }
-
-+void ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *pubsta,
-+ u16 tid)
-+{
-+ struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
-+ struct tid_ampdu_tx *tid_tx;
-+
-+ if (WARN_ON_ONCE(tid >= IEEE80211_NUM_TIDS))
-+ return;
-+
-+ tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]);
-+ if (!tid_tx)
-+ return;
-+
-+ tid_tx->last_tx = jiffies;
-+}
-+EXPORT_SYMBOL(ieee80211_refresh_tx_agg_session_timer);
-+
- /*
- * After accepting the AddBA Response we activated a timer,
- * resetting it after each frame that we send.
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Thu, 2 Mar 2023 13:52:29 +0100
-Subject: [PATCH] wifi: mac80211: add mesh fast-rx support
-
-This helps bring down rx CPU usage by avoiding calls to the rx handlers in
-the slow path. Supports forwarding and local rx, including A-MSDU.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -4564,6 +4564,12 @@ void ieee80211_check_fast_rx(struct sta_
- }
-
- break;
-+ case NL80211_IFTYPE_MESH_POINT:
-+ fastrx.expected_ds_bits = cpu_to_le16(IEEE80211_FCTL_FROMDS |
-+ IEEE80211_FCTL_TODS);
-+ fastrx.da_offs = offsetof(struct ieee80211_hdr, addr3);
-+ fastrx.sa_offs = offsetof(struct ieee80211_hdr, addr4);
-+ break;
- default:
- goto clear;
- }
-@@ -4772,6 +4778,7 @@ static bool ieee80211_invoke_fast_rx(str
- struct sk_buff *skb = rx->skb;
- struct ieee80211_hdr *hdr = (void *)skb->data;
- struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
-+ static ieee80211_rx_result res;
- int orig_len = skb->len;
- int hdrlen = ieee80211_hdrlen(hdr->frame_control);
- int snap_offs = hdrlen;
-@@ -4833,7 +4840,8 @@ static bool ieee80211_invoke_fast_rx(str
- snap_offs += IEEE80211_CCMP_HDR_LEN;
- }
-
-- if (!(status->rx_flags & IEEE80211_RX_AMSDU)) {
-+ if (!ieee80211_vif_is_mesh(&rx->sdata->vif) &&
-+ !(status->rx_flags & IEEE80211_RX_AMSDU)) {
- if (!pskb_may_pull(skb, snap_offs + sizeof(*payload)))
- return false;
-
-@@ -4872,13 +4880,29 @@ static bool ieee80211_invoke_fast_rx(str
- /* do the header conversion - first grab the addresses */
- ether_addr_copy(addrs.da, skb->data + fast_rx->da_offs);
- ether_addr_copy(addrs.sa, skb->data + fast_rx->sa_offs);
-- skb_postpull_rcsum(skb, skb->data + snap_offs,
-- sizeof(rfc1042_header) + 2);
-- /* remove the SNAP but leave the ethertype */
-- skb_pull(skb, snap_offs + sizeof(rfc1042_header));
-+ if (ieee80211_vif_is_mesh(&rx->sdata->vif)) {
-+ skb_pull(skb, snap_offs - 2);
-+ put_unaligned_be16(skb->len - 2, skb->data);
-+ } else {
-+ skb_postpull_rcsum(skb, skb->data + snap_offs,
-+ sizeof(rfc1042_header) + 2);
-+
-+ /* remove the SNAP but leave the ethertype */
-+ skb_pull(skb, snap_offs + sizeof(rfc1042_header));
-+ }
- /* push the addresses in front */
- memcpy(skb_push(skb, sizeof(addrs)), &addrs, sizeof(addrs));
-
-+ res = ieee80211_rx_mesh_data(rx->sdata, rx->sta, rx->skb);
-+ switch (res) {
-+ case RX_QUEUED:
-+ return true;
-+ case RX_CONTINUE:
-+ break;
-+ default:
-+ goto drop;
-+ }
-+
- ieee80211_rx_8023(rx, fast_rx, orig_len);
-
- return true;
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Mon, 20 Mar 2023 14:28:08 +0100
-Subject: [PATCH] wifi: mac80211: add support for letting drivers register tc
- offload support
-
-On newer MediaTek SoCs (e.g. MT7986), WLAN->WLAN or WLAN->Ethernet flows can
-be offloaded by the SoC. In order to support that, the .ndo_setup_tc op is
-needed.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -4192,6 +4192,10 @@ struct ieee80211_prep_tx_info {
- * Note that a sta can also be inserted or removed with valid links,
- * i.e. passed to @sta_add/@sta_state with sta->valid_links not zero.
- * In fact, cannot change from having valid_links and not having them.
-+ * @net_setup_tc: Called from .ndo_setup_tc in order to prepare hardware
-+ * flow offloading for flows originating from the vif.
-+ * Note that the driver must not assume that the vif driver_data is valid
-+ * at this point, since the callback can be called during netdev teardown.
- */
- struct ieee80211_ops {
- void (*tx)(struct ieee80211_hw *hw,
-@@ -4547,6 +4551,11 @@ struct ieee80211_ops {
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta,
- u16 old_links, u16 new_links);
-+ int (*net_setup_tc)(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct net_device *dev,
-+ enum tc_setup_type type,
-+ void *type_data);
- };
-
- /**
---- a/net/mac80211/driver-ops.h
-+++ b/net/mac80211/driver-ops.h
-@@ -1470,6 +1470,23 @@ static inline int drv_net_fill_forward_p
- return ret;
- }
-
-+static inline int drv_net_setup_tc(struct ieee80211_local *local,
-+ struct ieee80211_sub_if_data *sdata,
-+ struct net_device *dev,
-+ enum tc_setup_type type, void *type_data)
-+{
-+ int ret = -EOPNOTSUPP;
-+
-+ sdata = get_bss_sdata(sdata);
-+ trace_drv_net_setup_tc(local, sdata, type);
-+ if (local->ops->net_setup_tc)
-+ ret = local->ops->net_setup_tc(&local->hw, &sdata->vif, dev,
-+ type, type_data);
-+ trace_drv_return_int(local, ret);
-+
-+ return ret;
-+}
-+
- int drv_change_vif_links(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata,
- u16 old_links, u16 new_links,
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -1939,7 +1939,8 @@ void ieee80211_color_collision_detection
- /* interface handling */
- #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
- NETIF_F_HW_CSUM | NETIF_F_SG | \
-- NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE)
-+ NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE | \
-+ NETIF_F_HW_TC)
- #define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM)
- #define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \
- MAC80211_SUPPORTED_FEATURES_RX)
---- a/net/mac80211/iface.c
-+++ b/net/mac80211/iface.c
-@@ -813,6 +813,21 @@ ieee80211_get_stats64(struct net_device
- dev_fetch_sw_netstats(stats, dev->tstats);
- }
-
-+static int ieee80211_netdev_setup_tc(struct net_device *dev,
-+ enum tc_setup_type type, void *type_data)
-+{
-+ struct ieee80211_sub_if_data *sdata;
-+ struct ieee80211_local *local;
-+
-+ sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-+ local = sdata->local;
-+
-+ if (!local->ops->net_setup_tc)
-+ return -EOPNOTSUPP;
-+
-+ return drv_net_setup_tc(local, sdata, dev, type, type_data);
-+}
-+
- static const struct net_device_ops ieee80211_dataif_ops = {
- .ndo_open = ieee80211_open,
- .ndo_stop = ieee80211_stop,
-@@ -821,6 +836,7 @@ static const struct net_device_ops ieee8
- .ndo_set_rx_mode = ieee80211_set_multicast_list,
- .ndo_set_mac_address = ieee80211_change_mac,
- .ndo_get_stats64 = ieee80211_get_stats64,
-+ .ndo_setup_tc = ieee80211_netdev_setup_tc,
- };
-
- static u16 ieee80211_monitor_select_queue(struct net_device *dev,
-@@ -929,6 +945,7 @@ static const struct net_device_ops ieee8
- .ndo_set_mac_address = ieee80211_change_mac,
- .ndo_get_stats64 = ieee80211_get_stats64,
- .ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
-+ .ndo_setup_tc = ieee80211_netdev_setup_tc,
- };
-
- static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype)
---- a/net/mac80211/trace.h
-+++ b/net/mac80211/trace.h
-@@ -2478,6 +2478,31 @@ DEFINE_EVENT(sta_event, drv_net_fill_for
- TP_ARGS(local, sdata, sta)
- );
-
-+TRACE_EVENT(drv_net_setup_tc,
-+ TP_PROTO(struct ieee80211_local *local,
-+ struct ieee80211_sub_if_data *sdata,
-+ u8 type),
-+
-+ TP_ARGS(local, sdata, type),
-+
-+ TP_STRUCT__entry(
-+ LOCAL_ENTRY
-+ VIF_ENTRY
-+ __field(u8, type)
-+ ),
-+
-+ TP_fast_assign(
-+ LOCAL_ASSIGN;
-+ VIF_ASSIGN;
-+ __entry->type = type;
-+ ),
-+
-+ TP_printk(
-+ LOCAL_PR_FMT VIF_PR_FMT " type:%d\n",
-+ LOCAL_PR_ARG, VIF_PR_ARG, __entry->type
-+ )
-+);
-+
- TRACE_EVENT(drv_change_vif_links,
- TP_PROTO(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata,
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Sun, 26 Mar 2023 17:11:34 +0200
-Subject: [PATCH] wifi: mac80211: fix receiving mesh packets in forwarding=0
- networks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When forwarding is set to 0, frames are typically sent with ttl=1.
-Move the ttl decrement check below the check for local receive in order to
-fix packet drops.
-
-Reported-by: Thomas Hühn <thomas.huehn@hs-nordhausen.de>
-Reported-by: Nick Hainke <vincent@systemli.org>
-Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2828,14 +2828,6 @@ ieee80211_rx_mesh_data(struct ieee80211_
- if (sdata->crypto_tx_tailroom_needed_cnt)
- tailroom = IEEE80211_ENCRYPT_TAILROOM;
-
-- if (!--mesh_hdr->ttl) {
-- if (multicast)
-- goto rx_accept;
--
-- IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
-- return RX_DROP_MONITOR;
-- }
--
- if (mesh_hdr->flags & MESH_FLAGS_AE) {
- struct mesh_path *mppath;
- char *proxied_addr;
-@@ -2874,6 +2866,14 @@ ieee80211_rx_mesh_data(struct ieee80211_
- if (ether_addr_equal(sdata->vif.addr, eth->h_dest))
- goto rx_accept;
-
-+ if (!--mesh_hdr->ttl) {
-+ if (multicast)
-+ goto rx_accept;
-+
-+ IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
-+ return RX_DROP_MONITOR;
-+ }
-+
- if (!ifmsh->mshcfg.dot11MeshForwarding) {
- if (is_multicast_ether_addr(eth->h_dest))
- goto rx_accept;
+++ /dev/null
-From: Johannes Berg <johannes.berg@intel.com>
-Date: Wed, 29 Mar 2023 16:46:26 +0200
-Subject: [PATCH] wifi: ieee80211: correctly mark FTM frames non-bufferable
-
-The checks of whether or not a frame is bufferable were not
-taking into account that some action frames aren't, such as
-FTM. Check this, which requires some changes to the function
-ieee80211_is_bufferable_mmpdu() since we need the whole skb
-for the checks now.
-
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-Reviewed-by: Greenman, Gregory <gregory.greenman@intel.com>
-Reviewed-by: Peer, Ilan <ilan.peer@intel.com>
----
-
---- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
-+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
-@@ -601,8 +601,9 @@ static void iwl_mvm_skb_prepare_status(s
-
- static int iwl_mvm_get_ctrl_vif_queue(struct iwl_mvm *mvm,
- struct ieee80211_tx_info *info,
-- struct ieee80211_hdr *hdr)
-+ struct sk_buff *skb)
- {
-+ struct ieee80211_hdr *hdr = (void *)skb->data;
- struct iwl_mvm_vif *mvmvif =
- iwl_mvm_vif_from_mac80211(info->control.vif);
- __le16 fc = hdr->frame_control;
-@@ -621,7 +622,7 @@ static int iwl_mvm_get_ctrl_vif_queue(st
- * reason 7 ("Class 3 frame received from nonassociated STA").
- */
- if (ieee80211_is_mgmt(fc) &&
-- (!ieee80211_is_bufferable_mmpdu(fc) ||
-+ (!ieee80211_is_bufferable_mmpdu(skb) ||
- ieee80211_is_deauth(fc) || ieee80211_is_disassoc(fc)))
- return mvm->probe_queue;
-
-@@ -740,7 +741,7 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mv
- else
- sta_id = mvmvif->mcast_sta.sta_id;
-
-- queue = iwl_mvm_get_ctrl_vif_queue(mvm, &info, hdr);
-+ queue = iwl_mvm_get_ctrl_vif_queue(mvm, &info, skb);
- } else if (info.control.vif->type == NL80211_IFTYPE_MONITOR) {
- queue = mvm->snif_queue;
- sta_id = mvm->snif_sta.sta_id;
---- a/include/linux/ieee80211.h
-+++ b/include/linux/ieee80211.h
-@@ -772,20 +772,6 @@ static inline bool ieee80211_is_any_null
- }
-
- /**
-- * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU
-- * @fc: frame control field in little-endian byteorder
-- */
--static inline bool ieee80211_is_bufferable_mmpdu(__le16 fc)
--{
-- /* IEEE 802.11-2012, definition of "bufferable management frame";
-- * note that this ignores the IBSS special case. */
-- return ieee80211_is_mgmt(fc) &&
-- (ieee80211_is_action(fc) ||
-- ieee80211_is_disassoc(fc) ||
-- ieee80211_is_deauth(fc));
--}
--
--/**
- * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
- * @seq_ctrl: frame sequence control bytes in little-endian byteorder
- */
-@@ -4121,6 +4107,44 @@ static inline u8 *ieee80211_get_DA(struc
- }
-
- /**
-+ * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU
-+ * @skb: the skb to check, starting with the 802.11 header
-+ */
-+static inline bool ieee80211_is_bufferable_mmpdu(struct sk_buff *skb)
-+{
-+ struct ieee80211_mgmt *mgmt = (void *)skb->data;
-+ __le16 fc = mgmt->frame_control;
-+
-+ /*
-+ * IEEE 802.11 REVme D2.0 definition of bufferable MMPDU;
-+ * note that this ignores the IBSS special case.
-+ */
-+ if (!ieee80211_is_mgmt(fc))
-+ return false;
-+
-+ if (ieee80211_is_disassoc(fc) || ieee80211_is_deauth(fc))
-+ return true;
-+
-+ if (!ieee80211_is_action(fc))
-+ return false;
-+
-+ if (skb->len < offsetofend(typeof(*mgmt), u.action.u.ftm.action_code))
-+ return true;
-+
-+ /* action frame - additionally check for non-bufferable FTM */
-+
-+ if (mgmt->u.action.category != WLAN_CATEGORY_PUBLIC &&
-+ mgmt->u.action.category != WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION)
-+ return true;
-+
-+ if (mgmt->u.action.u.ftm.action_code == WLAN_PUB_ACTION_FTM_REQUEST ||
-+ mgmt->u.action.u.ftm.action_code == WLAN_PUBLIC_ACTION_FTM_RESPONSE)
-+ return false;
-+
-+ return true;
-+}
-+
-+/**
- * _ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
- * @hdr: the frame (buffer must include at least the first octet of payload)
- */
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -488,7 +488,7 @@ ieee80211_tx_h_unicast_ps_buf(struct iee
- int ac = skb_get_queue_mapping(tx->skb);
-
- if (ieee80211_is_mgmt(hdr->frame_control) &&
-- !ieee80211_is_bufferable_mmpdu(hdr->frame_control)) {
-+ !ieee80211_is_bufferable_mmpdu(tx->skb)) {
- info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER;
- return TX_CONTINUE;
- }
-@@ -1326,7 +1326,7 @@ static struct txq_info *ieee80211_get_tx
- if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) &&
- unlikely(!ieee80211_is_data_present(hdr->frame_control))) {
- if ((!ieee80211_is_mgmt(hdr->frame_control) ||
-- ieee80211_is_bufferable_mmpdu(hdr->frame_control) ||
-+ ieee80211_is_bufferable_mmpdu(skb) ||
- vif->type == NL80211_IFTYPE_STATION) &&
- sta && sta->uploaded) {
- /*
+++ /dev/null
-From: Johannes Berg <johannes.berg@intel.com>
-Date: Mon, 13 Mar 2023 11:42:12 +0100
-Subject: [PATCH] wifi: mac80211: flush queues on STA removal
-
-When we remove a station, we first make it unreachable,
-then we (must) remove its keys, and then remove the
-station itself. Depending on the hardware design, if
-we have hardware crypto at all, frames still sitting
-on hardware queues may then be transmitted without a
-valid key, possibly unencrypted or with a fixed key.
-
-Fix this by flushing the queues when removing stations
-so this cannot happen.
-
-Cc: stable@vger.kernel.org
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-Reviewed-by: Greenman, Gregory <gregory.greenman@intel.com>
----
-
---- a/net/mac80211/sta_info.c
-+++ b/net/mac80211/sta_info.c
-@@ -1271,6 +1271,14 @@ static void __sta_info_destroy_part2(str
- WARN_ON_ONCE(ret);
- }
-
-+ /* Flush queues before removing keys, as that might remove them
-+ * from hardware, and then depending on the offload method, any
-+ * frames sitting on hardware queues might be sent out without
-+ * any encryption at all.
-+ */
-+ if (local->ops->set_key)
-+ ieee80211_flush_queues(local, sta->sdata, false);
-+
- /* now keys can no longer be reached */
- ieee80211_free_sta_keys(local, sta);
-
+++ /dev/null
-From: Johannes Berg <johannes.berg@intel.com>
-Date: Mon, 13 Mar 2023 12:02:58 +0100
-Subject: [PATCH] wifi: iwlwifi: mvm: support flush on AP interfaces
-
-Support TX flush on AP interfaces so that we will do a
-proper flush for frames on the queue before keys are
-removed.
-
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-Reviewed-by: Greenman, Gregory <gregory.greenman@intel.com>
----
-
---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
-+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
-@@ -4854,9 +4854,6 @@ static void iwl_mvm_mac_flush(struct iee
- return;
- }
-
-- if (vif->type != NL80211_IFTYPE_STATION)
-- return;
--
- /* Make sure we're done with the deferred traffic before flushing */
- flush_work(&mvm->add_stream_wk);
-
-@@ -4874,9 +4871,6 @@ static void iwl_mvm_mac_flush(struct iee
- if (mvmsta->vif != vif)
- continue;
-
-- /* make sure only TDLS peers or the AP are flushed */
-- WARN_ON(i != mvmvif->ap_sta_id && !sta->tdls);
--
- if (drop) {
- if (iwl_mvm_flush_sta(mvm, mvmsta, false))
- IWL_ERR(mvm, "flush request fail\n");
+++ /dev/null
-From: Johannes Berg <johannes.berg@intel.com>
-Date: Mon, 13 Mar 2023 11:53:51 +0100
-Subject: [PATCH] wifi: mac80211: add flush_sta method
-
-Some drivers like iwlwifi might have per-STA queues, so we
-may want to flush/drop just those queues rather than all
-when removing a station. Add a separate method for that.
-
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-Reviewed-by: Greenman, Gregory <gregory.greenman@intel.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -3918,6 +3918,10 @@ struct ieee80211_prep_tx_info {
- * Note that vif can be NULL.
- * The callback can sleep.
- *
-+ * @flush_sta: Flush or drop all pending frames from the hardware queue(s) for
-+ * the given station, as it's about to be removed.
-+ * The callback can sleep.
-+ *
- * @channel_switch: Drivers that need (or want) to offload the channel
- * switch operation for CSAs received from the AP may implement this
- * callback. They must then call ieee80211_chswitch_done() to indicate
-@@ -4372,6 +4376,8 @@ struct ieee80211_ops {
- #endif
- void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- u32 queues, bool drop);
-+ void (*flush_sta)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ struct ieee80211_sta *sta);
- void (*channel_switch)(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_channel_switch *ch_switch);
---- a/net/mac80211/driver-ops.h
-+++ b/net/mac80211/driver-ops.h
-@@ -617,6 +617,21 @@ static inline void drv_flush(struct ieee
- trace_drv_return_void(local);
- }
-
-+static inline void drv_flush_sta(struct ieee80211_local *local,
-+ struct ieee80211_sub_if_data *sdata,
-+ struct sta_info *sta)
-+{
-+ might_sleep();
-+
-+ if (sdata && !check_sdata_in_driver(sdata))
-+ return;
-+
-+ trace_drv_flush_sta(local, sdata, &sta->sta);
-+ if (local->ops->flush_sta)
-+ local->ops->flush_sta(&local->hw, &sdata->vif, &sta->sta);
-+ trace_drv_return_void(local);
-+}
-+
- static inline void drv_channel_switch(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata,
- struct ieee80211_channel_switch *ch_switch)
---- a/net/mac80211/sta_info.c
-+++ b/net/mac80211/sta_info.c
-@@ -1276,8 +1276,12 @@ static void __sta_info_destroy_part2(str
- * frames sitting on hardware queues might be sent out without
- * any encryption at all.
- */
-- if (local->ops->set_key)
-- ieee80211_flush_queues(local, sta->sdata, false);
-+ if (local->ops->set_key) {
-+ if (local->ops->flush_sta)
-+ drv_flush_sta(local, sta->sdata, sta);
-+ else
-+ ieee80211_flush_queues(local, sta->sdata, false);
-+ }
-
- /* now keys can no longer be reached */
- ieee80211_free_sta_keys(local, sta);
---- a/net/mac80211/trace.h
-+++ b/net/mac80211/trace.h
-@@ -1177,6 +1177,13 @@ TRACE_EVENT(drv_flush,
- )
- );
-
-+DEFINE_EVENT(sta_event, drv_flush_sta,
-+ TP_PROTO(struct ieee80211_local *local,
-+ struct ieee80211_sub_if_data *sdata,
-+ struct ieee80211_sta *sta),
-+ TP_ARGS(local, sdata, sta)
-+);
-+
- TRACE_EVENT(drv_channel_switch,
- TP_PROTO(struct ieee80211_local *local,
- struct ieee80211_sub_if_data *sdata,
+++ /dev/null
-From: Johannes Berg <johannes.berg@intel.com>
-Date: Mon, 13 Mar 2023 12:05:35 +0100
-Subject: [PATCH] wifi: iwlwifi: mvm: support new flush_sta method
-
-For iwlwifi this is simple to implement, and on newer hardware
-it's an improvement since we have per-station queues.
-
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-Reviewed-by: Greenman, Gregory <gregory.greenman@intel.com>
----
-
---- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
-+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
-@@ -4890,6 +4890,31 @@ static void iwl_mvm_mac_flush(struct iee
- iwl_trans_wait_tx_queues_empty(mvm->trans, msk);
- }
-
-+static void iwl_mvm_mac_flush_sta(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_sta *sta)
-+{
-+ struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
-+ int i;
-+
-+ mutex_lock(&mvm->mutex);
-+ for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
-+ struct iwl_mvm_sta *mvmsta;
-+ struct ieee80211_sta *tmp;
-+
-+ tmp = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
-+ lockdep_is_held(&mvm->mutex));
-+ if (tmp != sta)
-+ continue;
-+
-+ mvmsta = iwl_mvm_sta_from_mac80211(sta);
-+
-+ if (iwl_mvm_flush_sta(mvm, mvmsta, false))
-+ IWL_ERR(mvm, "flush request fail\n");
-+ }
-+ mutex_unlock(&mvm->mutex);
-+}
-+
- static int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx,
- struct survey_info *survey)
- {
-@@ -5417,6 +5442,7 @@ const struct ieee80211_ops iwl_mvm_hw_op
- .mgd_complete_tx = iwl_mvm_mac_mgd_complete_tx,
- .mgd_protect_tdls_discover = iwl_mvm_mac_mgd_protect_tdls_discover,
- .flush = iwl_mvm_mac_flush,
-+ .flush_sta = iwl_mvm_mac_flush_sta,
- .sched_scan_start = iwl_mvm_mac_sched_scan_start,
- .sched_scan_stop = iwl_mvm_mac_sched_scan_stop,
- .set_key = iwl_mvm_mac_set_key,
+++ /dev/null
-From: Ryder Lee <ryder.lee@mediatek.com>
-Date: Sat, 18 Feb 2023 01:49:25 +0800
-Subject: [PATCH] wifi: mac80211: add LDPC related flags in ieee80211_bss_conf
-
-This is utilized to pass LDPC configurations from user space
-(i.e. hostapd) to driver.
-
-Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
-Link: https://lore.kernel.org/r/1de696aaa34efd77a926eb657b8c0fda05aaa177.1676628065.git.ryder.lee@mediatek.com
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -653,6 +653,9 @@ struct ieee80211_fils_discovery {
- * write-protected by sdata_lock and local->mtx so holding either is fine
- * for read access.
- * @color_change_color: the bss color that will be used after the change.
-+ * @ht_ldpc: in AP mode, indicates interface has HT LDPC capability.
-+ * @vht_ldpc: in AP mode, indicates interface has VHT LDPC capability.
-+ * @he_ldpc: in AP mode, indicates interface has HE LDPC capability.
- * @vht_su_beamformer: in AP mode, does this BSS support operation as an VHT SU
- * beamformer
- * @vht_su_beamformee: in AP mode, does this BSS support operation as an VHT SU
-@@ -744,6 +747,9 @@ struct ieee80211_bss_conf {
- bool color_change_active;
- u8 color_change_color;
-
-+ bool ht_ldpc;
-+ bool vht_ldpc;
-+ bool he_ldpc;
- bool vht_su_beamformer;
- bool vht_su_beamformee;
- bool vht_mu_beamformer;
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -1252,7 +1252,15 @@ static int ieee80211_start_ap(struct wip
- prev_beacon_int = link_conf->beacon_int;
- link_conf->beacon_int = params->beacon_interval;
-
-+ if (params->ht_cap)
-+ link_conf->ht_ldpc =
-+ params->ht_cap->cap_info &
-+ cpu_to_le16(IEEE80211_HT_CAP_LDPC_CODING);
-+
- if (params->vht_cap) {
-+ link_conf->vht_ldpc =
-+ params->vht_cap->vht_cap_info &
-+ cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC);
- link_conf->vht_su_beamformer =
- params->vht_cap->vht_cap_info &
- cpu_to_le32(IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE);
-@@ -1282,6 +1290,9 @@ static int ieee80211_start_ap(struct wip
- }
-
- if (params->he_cap) {
-+ link_conf->he_ldpc =
-+ params->he_cap->phy_cap_info[1] &
-+ IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD;
- link_conf->he_su_beamformer =
- params->he_cap->phy_cap_info[3] &
- IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER;
+++ /dev/null
-From bd54f3c29077f23dad92ef82a78061b40be30c65 Mon Sep 17 00:00:00 2001
-From: Aloka Dixit <quic_alokad@quicinc.com>
-Date: Mon, 5 Dec 2022 16:50:37 -0800
-Subject: [PATCH] wifi: mac80211: generate EMA beacons in AP mode
-
-Add APIs to generate an array of beacons for an EMA AP (enhanced
-multiple BSSID advertisements), each including a single MBSSID element.
-EMA profile periodicity equals the count of elements.
-
-- ieee80211_beacon_get_template_ema_list() - Generate and return all
-EMA beacon templates. Drivers must call ieee80211_beacon_free_ema_list()
-to free the memory. No change in the prototype for the existing API,
-ieee80211_beacon_get_template(), which should be used for non-EMA AP.
-
-- ieee80211_beacon_get_template_ema_index() - Generate a beacon which
-includes the multiple BSSID element at the given index. Drivers can use
-this function in a loop until NULL is returned which indicates end of
-available MBSSID elements.
-
-- ieee80211_beacon_free_ema_list() - free the memory allocated for the
-list of EMA beacon templates.
-
-Modify existing functions ieee80211_beacon_get_ap(),
-ieee80211_get_mbssid_beacon_len() and ieee80211_beacon_add_mbssid()
-to accept a new parameter for EMA index.
-
-Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
-Co-developed-by: John Crispin <john@phrozen.org>
-Signed-off-by: John Crispin <john@phrozen.org>
-Link: https://lore.kernel.org/r/20221206005040.3177-2-quic_alokad@quicinc.com
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
----
- include/net/mac80211.h | 68 +++++++++++++++++++
- net/mac80211/cfg.c | 11 +--
- net/mac80211/ieee80211_i.h | 10 ++-
- net/mac80211/tx.c | 134 ++++++++++++++++++++++++++++++++++---
- 4 files changed, 205 insertions(+), 18 deletions(-)
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -5252,6 +5252,74 @@ ieee80211_beacon_get_template(struct iee
- unsigned int link_id);
-
- /**
-+ * ieee80211_beacon_get_template_ema_index - EMA beacon template generation
-+ * @hw: pointer obtained from ieee80211_alloc_hw().
-+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
-+ * @offs: &struct ieee80211_mutable_offsets pointer to struct that will
-+ * receive the offsets that may be updated by the driver.
-+ * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP).
-+ * @ema_index: index of the beacon in the EMA set.
-+ *
-+ * This function follows the same rules as ieee80211_beacon_get_template()
-+ * but returns a beacon template which includes multiple BSSID element at the
-+ * requested index.
-+ *
-+ * Return: The beacon template. %NULL indicates the end of EMA templates.
-+ */
-+struct sk_buff *
-+ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_mutable_offsets *offs,
-+ unsigned int link_id, u8 ema_index);
-+
-+/**
-+ * struct ieee80211_ema_beacons - List of EMA beacons
-+ * @cnt: count of EMA beacons.
-+ *
-+ * @bcn: array of EMA beacons.
-+ * @bcn.skb: the skb containing this specific beacon
-+ * @bcn.offs: &struct ieee80211_mutable_offsets pointer to struct that will
-+ * receive the offsets that may be updated by the driver.
-+ */
-+struct ieee80211_ema_beacons {
-+ u8 cnt;
-+ struct {
-+ struct sk_buff *skb;
-+ struct ieee80211_mutable_offsets offs;
-+ } bcn[];
-+};
-+
-+/**
-+ * ieee80211_beacon_get_template_ema_list - EMA beacon template generation
-+ * @hw: pointer obtained from ieee80211_alloc_hw().
-+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
-+ * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP)
-+ *
-+ * This function follows the same rules as ieee80211_beacon_get_template()
-+ * but allocates and returns a pointer to list of all beacon templates required
-+ * to cover all profiles in the multiple BSSID set. Each template includes only
-+ * one multiple BSSID element.
-+ *
-+ * Driver must call ieee80211_beacon_free_ema_list() to free the memory.
-+ *
-+ * Return: EMA beacon templates of type struct ieee80211_ema_beacons *.
-+ * %NULL on error.
-+ */
-+struct ieee80211_ema_beacons *
-+ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ unsigned int link_id);
-+
-+/**
-+ * ieee80211_beacon_free_ema_list - free an EMA beacon template list
-+ * @ema_beacons: list of EMA beacons of type &struct ieee80211_ema_beacons pointers.
-+ *
-+ * This function will free a list previously acquired by calling
-+ * ieee80211_beacon_get_template_ema_list()
-+ */
-+void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons);
-+
-+/**
- * ieee80211_beacon_get_tim - beacon generation function
- * @hw: pointer obtained from ieee80211_alloc_hw().
- * @vif: &struct ieee80211_vif pointer from the add_interface callback.
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -1122,11 +1122,11 @@ static int ieee80211_assign_beacon(struc
- if (params->mbssid_ies) {
- mbssid = params->mbssid_ies;
- size += struct_size(new->mbssid_ies, elem, mbssid->cnt);
-- size += ieee80211_get_mbssid_beacon_len(mbssid);
-+ size += ieee80211_get_mbssid_beacon_len(mbssid, mbssid->cnt);
- } else if (old && old->mbssid_ies) {
- mbssid = old->mbssid_ies;
- size += struct_size(new->mbssid_ies, elem, mbssid->cnt);
-- size += ieee80211_get_mbssid_beacon_len(mbssid);
-+ size += ieee80211_get_mbssid_beacon_len(mbssid, mbssid->cnt);
- }
-
- new = kzalloc(size, GFP_KERNEL);
-@@ -3384,8 +3384,11 @@ cfg80211_beacon_dup(struct cfg80211_beac
-
- len = beacon->head_len + beacon->tail_len + beacon->beacon_ies_len +
- beacon->proberesp_ies_len + beacon->assocresp_ies_len +
-- beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len +
-- ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies);
-+ beacon->probe_resp_len + beacon->lci_len + beacon->civicloc_len;
-+
-+ if (beacon->mbssid_ies)
-+ len += ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies,
-+ beacon->mbssid_ies->cnt);
-
- new_beacon = kzalloc(sizeof(*new_beacon) + len, GFP_KERNEL);
- if (!new_beacon)
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -1182,13 +1182,17 @@ ieee80211_vif_get_shift(struct ieee80211
- }
-
- static inline int
--ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems)
-+ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems, u8 i)
- {
-- int i, len = 0;
-+ int len = 0;
-
-- if (!elems)
-+ if (!elems || !elems->cnt || i > elems->cnt)
- return 0;
-
-+ if (i < elems->cnt)
-+ return elems->elem[i].len;
-+
-+ /* i == elems->cnt, calculate total length of all MBSSID elements */
- for (i = 0; i < elems->cnt; i++)
- len += elems->elem[i].len;
-
---- a/net/mac80211/tx.c
-+++ b/net/mac80211/tx.c
-@@ -5205,13 +5205,20 @@ ieee80211_beacon_get_finish(struct ieee8
- }
-
- static void
--ieee80211_beacon_add_mbssid(struct sk_buff *skb, struct beacon_data *beacon)
-+ieee80211_beacon_add_mbssid(struct sk_buff *skb, struct beacon_data *beacon,
-+ u8 i)
- {
-- int i;
-+ if (!beacon->mbssid_ies || !beacon->mbssid_ies->cnt ||
-+ i > beacon->mbssid_ies->cnt)
-+ return;
-
-- if (!beacon->mbssid_ies)
-+ if (i < beacon->mbssid_ies->cnt) {
-+ skb_put_data(skb, beacon->mbssid_ies->elem[i].data,
-+ beacon->mbssid_ies->elem[i].len);
- return;
-+ }
-
-+ /* i == beacon->mbssid_ies->cnt, include all MBSSID elements */
- for (i = 0; i < beacon->mbssid_ies->cnt; i++)
- skb_put_data(skb, beacon->mbssid_ies->elem[i].data,
- beacon->mbssid_ies->elem[i].len);
-@@ -5224,7 +5231,8 @@ ieee80211_beacon_get_ap(struct ieee80211
- struct ieee80211_mutable_offsets *offs,
- bool is_template,
- struct beacon_data *beacon,
-- struct ieee80211_chanctx_conf *chanctx_conf)
-+ struct ieee80211_chanctx_conf *chanctx_conf,
-+ u8 ema_index)
- {
- struct ieee80211_local *local = hw_to_local(hw);
- struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
-@@ -5243,7 +5251,9 @@ ieee80211_beacon_get_ap(struct ieee80211
- /* headroom, head length,
- * tail length, maximum TIM length and multiple BSSID length
- */
-- mbssid_len = ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies);
-+ mbssid_len = ieee80211_get_mbssid_beacon_len(beacon->mbssid_ies,
-+ ema_index);
-+
- skb = dev_alloc_skb(local->tx_headroom + beacon->head_len +
- beacon->tail_len + 256 +
- local->hw.extra_beacon_tailroom + mbssid_len);
-@@ -5261,7 +5271,7 @@ ieee80211_beacon_get_ap(struct ieee80211
- offs->cntdwn_counter_offs[0] = beacon->cntdwn_counter_offsets[0];
-
- if (mbssid_len) {
-- ieee80211_beacon_add_mbssid(skb, beacon);
-+ ieee80211_beacon_add_mbssid(skb, beacon, ema_index);
- offs->mbssid_off = skb->len - mbssid_len;
- }
-
-@@ -5280,12 +5290,51 @@ ieee80211_beacon_get_ap(struct ieee80211
- return skb;
- }
-
-+static struct ieee80211_ema_beacons *
-+ieee80211_beacon_get_ap_ema_list(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_link_data *link,
-+ struct ieee80211_mutable_offsets *offs,
-+ bool is_template, struct beacon_data *beacon,
-+ struct ieee80211_chanctx_conf *chanctx_conf)
-+{
-+ struct ieee80211_ema_beacons *ema = NULL;
-+
-+ if (!beacon->mbssid_ies || !beacon->mbssid_ies->cnt)
-+ return NULL;
-+
-+ ema = kzalloc(struct_size(ema, bcn, beacon->mbssid_ies->cnt),
-+ GFP_ATOMIC);
-+ if (!ema)
-+ return NULL;
-+
-+ for (ema->cnt = 0; ema->cnt < beacon->mbssid_ies->cnt; ema->cnt++) {
-+ ema->bcn[ema->cnt].skb =
-+ ieee80211_beacon_get_ap(hw, vif, link,
-+ &ema->bcn[ema->cnt].offs,
-+ is_template, beacon,
-+ chanctx_conf, ema->cnt);
-+ if (!ema->bcn[ema->cnt].skb)
-+ break;
-+ }
-+
-+ if (ema->cnt == beacon->mbssid_ies->cnt)
-+ return ema;
-+
-+ ieee80211_beacon_free_ema_list(ema);
-+ return NULL;
-+}
-+
-+#define IEEE80211_INCLUDE_ALL_MBSSID_ELEMS -1
-+
- static struct sk_buff *
- __ieee80211_beacon_get(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_mutable_offsets *offs,
- bool is_template,
-- unsigned int link_id)
-+ unsigned int link_id,
-+ int ema_index,
-+ struct ieee80211_ema_beacons **ema_beacons)
- {
- struct ieee80211_local *local = hw_to_local(hw);
- struct beacon_data *beacon = NULL;
-@@ -5314,8 +5363,29 @@ __ieee80211_beacon_get(struct ieee80211_
- if (!beacon)
- goto out;
-
-- skb = ieee80211_beacon_get_ap(hw, vif, link, offs, is_template,
-- beacon, chanctx_conf);
-+ if (ema_beacons) {
-+ *ema_beacons =
-+ ieee80211_beacon_get_ap_ema_list(hw, vif, link,
-+ offs,
-+ is_template,
-+ beacon,
-+ chanctx_conf);
-+ } else {
-+ if (beacon->mbssid_ies && beacon->mbssid_ies->cnt) {
-+ if (ema_index >= beacon->mbssid_ies->cnt)
-+ goto out; /* End of MBSSID elements */
-+
-+ if (ema_index <= IEEE80211_INCLUDE_ALL_MBSSID_ELEMS)
-+ ema_index = beacon->mbssid_ies->cnt;
-+ } else {
-+ ema_index = 0;
-+ }
-+
-+ skb = ieee80211_beacon_get_ap(hw, vif, link, offs,
-+ is_template, beacon,
-+ chanctx_conf,
-+ ema_index);
-+ }
- } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
- struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
- struct ieee80211_hdr *hdr;
-@@ -5403,10 +5473,50 @@ ieee80211_beacon_get_template(struct iee
- struct ieee80211_mutable_offsets *offs,
- unsigned int link_id)
- {
-- return __ieee80211_beacon_get(hw, vif, offs, true, link_id);
-+ return __ieee80211_beacon_get(hw, vif, offs, true, link_id,
-+ IEEE80211_INCLUDE_ALL_MBSSID_ELEMS, NULL);
- }
- EXPORT_SYMBOL(ieee80211_beacon_get_template);
-
-+struct sk_buff *
-+ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_mutable_offsets *offs,
-+ unsigned int link_id, u8 ema_index)
-+{
-+ return __ieee80211_beacon_get(hw, vif, offs, true, link_id, ema_index,
-+ NULL);
-+}
-+EXPORT_SYMBOL(ieee80211_beacon_get_template_ema_index);
-+
-+void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons)
-+{
-+ u8 i;
-+
-+ if (!ema_beacons)
-+ return;
-+
-+ for (i = 0; i < ema_beacons->cnt; i++)
-+ kfree_skb(ema_beacons->bcn[i].skb);
-+
-+ kfree(ema_beacons);
-+}
-+EXPORT_SYMBOL(ieee80211_beacon_free_ema_list);
-+
-+struct ieee80211_ema_beacons *
-+ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ unsigned int link_id)
-+{
-+ struct ieee80211_ema_beacons *ema_beacons = NULL;
-+
-+ WARN_ON(__ieee80211_beacon_get(hw, vif, NULL, false, link_id, 0,
-+ &ema_beacons));
-+
-+ return ema_beacons;
-+}
-+EXPORT_SYMBOL(ieee80211_beacon_get_template_ema_list);
-+
- struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- u16 *tim_offset, u16 *tim_length,
-@@ -5414,7 +5524,9 @@ struct sk_buff *ieee80211_beacon_get_tim
- {
- struct ieee80211_mutable_offsets offs = {};
- struct sk_buff *bcn = __ieee80211_beacon_get(hw, vif, &offs, false,
-- link_id);
-+ link_id,
-+ IEEE80211_INCLUDE_ALL_MBSSID_ELEMS,
-+ NULL);
- struct sk_buff *copy;
- int shift;
-
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Thu, 22 Jun 2023 18:02:25 +0200
-Subject: [PATCH] mac80211: fix sband iftype data lookup for AP_VLAN
-
-AP_VLAN interfaces are virtual, so doesn't really exist as a type for
-capabilities. When passed in as a type, AP is the one that's really intended.
-
-Fixes: c4cbaf7973a7 ("cfg80211: Add support for HE")
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -567,6 +567,9 @@ ieee80211_get_sband_iftype_data(const st
- if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
- return NULL;
-
-+ if (iftype == NL80211_IFTYPE_AP_VLAN)
-+ iftype = NL80211_IFTYPE_AP;
-+
- for (i = 0; i < sband->n_iftype_data; i++) {
- const struct ieee80211_sband_iftype_data *data =
- &sband->iftype_data[i];
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Fri, 30 Jun 2023 13:11:51 +0200
-Subject: [PATCH] mac80211: split mesh fast tx cache into
- local/proxied/forwarded
-
-Depending on the origin of the packets (and their SA), 802.11 + mesh headers
-could be filled in differently. In order to properly deal with that, add a
-new field to the lookup key, indicating the type (local, proxied or
-forwarded). This can fix spurious packet drop issues that depend on the order
-in which nodes/hosts communicate with each other.
-
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/mac80211/mesh.c
-+++ b/net/mac80211/mesh.c
-@@ -703,6 +703,9 @@ bool ieee80211_mesh_xmit_fast(struct iee
- struct sk_buff *skb, u32 ctrl_flags)
- {
- struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-+ struct ieee80211_mesh_fast_tx_key key = {
-+ .type = MESH_FAST_TX_TYPE_LOCAL
-+ };
- struct ieee80211_mesh_fast_tx *entry;
- struct ieee80211s_hdr *meshhdr;
- u8 sa[ETH_ALEN] __aligned(2);
-@@ -738,7 +741,10 @@ bool ieee80211_mesh_xmit_fast(struct iee
- return false;
- }
-
-- entry = mesh_fast_tx_get(sdata, skb->data);
-+ ether_addr_copy(key.addr, skb->data);
-+ if (!ether_addr_equal(skb->data + ETH_ALEN, sdata->vif.addr))
-+ key.type = MESH_FAST_TX_TYPE_PROXIED;
-+ entry = mesh_fast_tx_get(sdata, &key);
- if (!entry)
- return false;
-
---- a/net/mac80211/mesh.h
-+++ b/net/mac80211/mesh.h
-@@ -133,9 +133,33 @@ struct mesh_path {
- #define MESH_FAST_TX_CACHE_TIMEOUT 8000 /* msecs */
-
- /**
-+ * enum ieee80211_mesh_fast_tx_type - cached mesh fast tx entry type
-+ *
-+ * @MESH_FAST_TX_TYPE_LOCAL: tx from the local vif address as SA
-+ * @MESH_FAST_TX_TYPE_PROXIED: local tx with a different SA (e.g. bridged)
-+ * @MESH_FAST_TX_TYPE_FORWARDED: forwarded from a different mesh point
-+ */
-+enum ieee80211_mesh_fast_tx_type {
-+ MESH_FAST_TX_TYPE_LOCAL,
-+ MESH_FAST_TX_TYPE_PROXIED,
-+ MESH_FAST_TX_TYPE_FORWARDED,
-+};
-+
-+/**
-+ * struct ieee80211_mesh_fast_tx_key - cached mesh fast tx entry key
-+ *
-+ * @addr: The Ethernet DA for this entry
-+ * @type: cache entry type
-+ */
-+struct ieee80211_mesh_fast_tx_key {
-+ u8 addr[ETH_ALEN] __aligned(2);
-+ enum ieee80211_mesh_fast_tx_type type;
-+};
-+
-+/**
- * struct ieee80211_mesh_fast_tx - cached mesh fast tx entry
- * @rhash: rhashtable pointer
-- * @addr_key: The Ethernet DA which is the key for this entry
-+ * @key: the lookup key for this cache entry
- * @fast_tx: base fast_tx data
- * @hdr: cached mesh and rfc1042 headers
- * @hdrlen: length of mesh + rfc1042
-@@ -146,7 +170,7 @@ struct mesh_path {
- */
- struct ieee80211_mesh_fast_tx {
- struct rhash_head rhash;
-- u8 addr_key[ETH_ALEN] __aligned(2);
-+ struct ieee80211_mesh_fast_tx_key key;
-
- struct ieee80211_fast_tx fast_tx;
- u8 hdr[sizeof(struct ieee80211s_hdr) + sizeof(rfc1042_header)];
-@@ -329,7 +353,8 @@ void mesh_path_tx_root_frame(struct ieee
-
- bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt);
- struct ieee80211_mesh_fast_tx *
--mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr);
-+mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata,
-+ struct ieee80211_mesh_fast_tx_key *key);
- bool ieee80211_mesh_xmit_fast(struct ieee80211_sub_if_data *sdata,
- struct sk_buff *skb, u32 ctrl_flags);
- void mesh_fast_tx_cache(struct ieee80211_sub_if_data *sdata,
---- a/net/mac80211/mesh_pathtbl.c
-+++ b/net/mac80211/mesh_pathtbl.c
-@@ -36,8 +36,8 @@ static const struct rhashtable_params me
- static const struct rhashtable_params fast_tx_rht_params = {
- .nelem_hint = 10,
- .automatic_shrinking = true,
-- .key_len = ETH_ALEN,
-- .key_offset = offsetof(struct ieee80211_mesh_fast_tx, addr_key),
-+ .key_len = sizeof(struct ieee80211_mesh_fast_tx_key),
-+ .key_offset = offsetof(struct ieee80211_mesh_fast_tx, key),
- .head_offset = offsetof(struct ieee80211_mesh_fast_tx, rhash),
- .hashfn = mesh_table_hash,
- };
-@@ -426,20 +426,21 @@ static void mesh_fast_tx_entry_free(stru
- }
-
- struct ieee80211_mesh_fast_tx *
--mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata, const u8 *addr)
-+mesh_fast_tx_get(struct ieee80211_sub_if_data *sdata,
-+ struct ieee80211_mesh_fast_tx_key *key)
- {
- struct ieee80211_mesh_fast_tx *entry;
- struct mesh_tx_cache *cache;
-
- cache = &sdata->u.mesh.tx_cache;
-- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params);
-+ entry = rhashtable_lookup(&cache->rht, key, fast_tx_rht_params);
- if (!entry)
- return NULL;
-
- if (!(entry->mpath->flags & MESH_PATH_ACTIVE) ||
- mpath_expired(entry->mpath)) {
- spin_lock_bh(&cache->walk_lock);
-- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params);
-+ entry = rhashtable_lookup(&cache->rht, key, fast_tx_rht_params);
- if (entry)
- mesh_fast_tx_entry_free(cache, entry);
- spin_unlock_bh(&cache->walk_lock);
-@@ -484,18 +485,24 @@ void mesh_fast_tx_cache(struct ieee80211
- if (!sta)
- return;
-
-+ build.key.type = MESH_FAST_TX_TYPE_LOCAL;
- if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) {
- /* This is required to keep the mppath alive */
- mppath = mpp_path_lookup(sdata, meshhdr->eaddr1);
- if (!mppath)
- return;
- build.mppath = mppath;
-+ if (!ether_addr_equal(meshhdr->eaddr2, sdata->vif.addr))
-+ build.key.type = MESH_FAST_TX_TYPE_PROXIED;
- } else if (ieee80211_has_a4(hdr->frame_control)) {
- mppath = mpath;
- } else {
- return;
- }
-
-+ if (!ether_addr_equal(hdr->addr4, sdata->vif.addr))
-+ build.key.type = MESH_FAST_TX_TYPE_FORWARDED;
-+
- /* rate limit, in case fast xmit can't be enabled */
- if (mppath->fast_tx_check == jiffies)
- return;
-@@ -542,7 +549,7 @@ void mesh_fast_tx_cache(struct ieee80211
- }
- }
-
-- memcpy(build.addr_key, mppath->dst, ETH_ALEN);
-+ memcpy(build.key.addr, mppath->dst, ETH_ALEN);
- build.timestamp = jiffies;
- build.fast_tx.band = info->band;
- build.fast_tx.da_offs = offsetof(struct ieee80211_hdr, addr3);
-@@ -644,13 +651,19 @@ void mesh_fast_tx_flush_addr(struct ieee
- const u8 *addr)
- {
- struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache;
-+ struct ieee80211_mesh_fast_tx_key key = {};
- struct ieee80211_mesh_fast_tx *entry;
-+ int i;
-
-+ ether_addr_copy(key.addr, addr);
- cache = &sdata->u.mesh.tx_cache;
- spin_lock_bh(&cache->walk_lock);
-- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params);
-- if (entry)
-- mesh_fast_tx_entry_free(cache, entry);
-+ for (i = MESH_FAST_TX_TYPE_LOCAL; i < MESH_FAST_TX_TYPE_FORWARDED; i++) {
-+ key.type = i;
-+ entry = rhashtable_lookup(&cache->rht, &key, fast_tx_rht_params);
-+ if (entry)
-+ mesh_fast_tx_entry_free(cache, entry);
-+ }
- spin_unlock_bh(&cache->walk_lock);
- }
-
---- a/net/mac80211/rx.c
-+++ b/net/mac80211/rx.c
-@@ -2726,7 +2726,10 @@ ieee80211_rx_mesh_fast_forward(struct ie
- struct sk_buff *skb, int hdrlen)
- {
- struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-- struct ieee80211_mesh_fast_tx *entry = NULL;
-+ struct ieee80211_mesh_fast_tx_key key = {
-+ .type = MESH_FAST_TX_TYPE_FORWARDED
-+ };
-+ struct ieee80211_mesh_fast_tx *entry;
- struct ieee80211s_hdr *mesh_hdr;
- struct tid_ampdu_tx *tid_tx;
- struct sta_info *sta;
-@@ -2735,9 +2738,13 @@ ieee80211_rx_mesh_fast_forward(struct ie
-
- mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(eth));
- if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6)
-- entry = mesh_fast_tx_get(sdata, mesh_hdr->eaddr1);
-+ ether_addr_copy(key.addr, mesh_hdr->eaddr1);
- else if (!(mesh_hdr->flags & MESH_FLAGS_AE))
-- entry = mesh_fast_tx_get(sdata, skb->data);
-+ ether_addr_copy(key.addr, skb->data);
-+ else
-+ return false;
-+
-+ entry = mesh_fast_tx_get(sdata, &key);
- if (!entry)
- return false;
-
+++ /dev/null
-From: Felix Fietkau <nbd@nbd.name>
-Date: Tue, 11 Jul 2023 13:30:12 +0200
-Subject: [PATCH] wifi: cfg80211: fix receving mesh packets without RFC1042
- header
-
-Fix ethernet header length field after stripping the mesh header
-
-Cc: stable@vger.kernel.org
-Link: https://lore.kernel.org/all/CT5GNZSK28AI.2K6M69OXM9RW5@syracuse/
-Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
-Reported-by: Nicolas Escande <nico.escande@gmail.com>
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
----
-
---- a/net/wireless/util.c
-+++ b/net/wireless/util.c
-@@ -580,6 +580,8 @@ int ieee80211_strip_8023_mesh_hdr(struct
- hdrlen += ETH_ALEN + 2;
- else if (!pskb_may_pull(skb, hdrlen))
- return -EINVAL;
-+ else
-+ payload.eth.h_proto = htons(skb->len - hdrlen);
-
- mesh_addr = skb->data + sizeof(payload.eth) + ETH_ALEN;
- switch (payload.flags & MESH_FLAGS_AE) {
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
-@@ -614,21 +614,6 @@ static int wiphy_verify_combinations(str
+@@ -649,21 +649,6 @@ static int wiphy_verify_combinations(str
c->limits[j].max > 1))
return -EINVAL;