diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 715e851a1..e51208aab 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=5.15.8-1 -PKG_RELEASE:=2 -PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.8/ -PKG_HASH:=9f71b659c034f19d156532ec780fcb606cee3c4ccc42e2f8ef18dd3e9f1b6820 +PKG_VERSION:=5.15.33-1 +PKG_RELEASE:=1 +PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.33/ +PKG_HASH:=1b6b3bded4c81814ebebe2d194c2f8966d2399005b85ebb0557285b6e73f5422 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk index 793ee3ef1..66b5bf2f8 100644 --- a/package/kernel/mac80211/ath.mk +++ b/package/kernel/mac80211/ath.mk @@ -269,7 +269,8 @@ define KernelPackage/ath10k FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko - AUTOLOAD:=$(call AutoProbe,ath10k_pci) + AUTOLOAD:=$(call AutoProbe,ath10k_core ath10k_pci) + MODPARAMS.ath10k_core:=frame_mode=2 VARIANT:=regular endef @@ -287,7 +288,6 @@ define KernelPackage/ath10k/config depends on PACKAGE_kmod-ath10k || PACKAGE_kmod-ath10k-smallbuffers config ATH10K_THERMAL - default y bool "Enable thermal sensors and throttling support" depends on PACKAGE_kmod-ath10k || PACKAGE_kmod-ath10k-smallbuffers @@ -395,7 +395,7 @@ endef define KernelPackage/ar5523 $(call KernelPackage/mac80211/Default) TITLE:=Driver for Atheros AR5523 USB sticks - DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core + DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ar5523/ar5523.ko AUTOLOAD:=$(call AutoProbe,ar5523) endef diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 89f409051..25f99eecf 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -28,8 +28,8 @@ drv_mac80211_init_device_config() { config_add_string tx_burst config_add_string distance config_add_int beacon_int chanbw frag rts - config_add_int rxantenna txantenna antenna_gain txpower - config_add_boolean noscan ht_coex acs_exclude_dfs + config_add_int rxantenna txantenna antenna_gain txpower min_tx_power + config_add_boolean noscan ht_coex acs_exclude_dfs background_radar config_add_array ht_capab config_add_array channels config_add_array scan_list @@ -137,13 +137,15 @@ mac80211_hostapd_setup_base() { [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && append base_cfg "acs_exclude_dfs=1" "$N" - json_get_vars noscan ht_coex vendor_vht + json_get_vars noscan ht_coex min_tx_power:0 json_get_values ht_capab_list ht_capab tx_burst json_get_values channel_list channels [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ channel_list="$channel" + [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" + set_default noscan 0 [ "$noscan" -gt 0 ] && hostapd_noscan=1 @@ -273,6 +275,11 @@ mac80211_hostapd_setup_base() { vht_center_seg0=$idx ;; esac + [ "$band" = "5g" ] && { + json_get_vars background_radar:0 + + [ "$background_radar" -eq 1 ] && append base_cfg "enable_background_radar=1" "$N" + } [ "$band" = "6g" ] && { op_class= case "$htmode" in @@ -283,7 +290,7 @@ mac80211_hostapd_setup_base() { } [ "$hwmode" = "a" ] || enable_ac=0 - if [ "$enable_ac" != "0" -o "$vendor_vht" = "1" ]; then + if [ "$enable_ac" != "0" ]; then json_get_vars \ rxldpc:1 \ short_gi_80:1 \ diff --git a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch index 506beb79c..514cfd9e5 100644 --- a/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch +++ b/package/kernel/mac80211/patches/ath/402-ath_regd_optional.patch @@ -82,7 +82,7 @@ help --- a/local-symbols +++ b/local-symbols -@@ -76,6 +76,7 @@ ADM8211= +@@ -83,6 +83,7 @@ ADM8211= ATH_COMMON= WLAN_VENDOR_ATH= ATH_DEBUG= diff --git a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch index 833e2411c..c8eef504c 100644 --- a/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch +++ b/package/kernel/mac80211/patches/ath/404-regd_no_assoc_hints.patch @@ -1,6 +1,6 @@ --- a/net/wireless/reg.c +++ b/net/wireless/reg.c -@@ -3299,6 +3299,8 @@ void regulatory_hint_country_ie(struct w +@@ -3304,6 +3304,8 @@ void regulatory_hint_country_ie(struct w enum environment_cap env = ENVIRON_ANY; struct regulatory_request *request = NULL, *lr; @@ -9,7 +9,7 @@ /* IE len must be evenly divisible by 2 */ if (country_ie_len & 0x01) return; -@@ -3550,6 +3552,7 @@ static bool is_wiphy_all_set_reg_flag(en +@@ -3555,6 +3557,7 @@ static bool is_wiphy_all_set_reg_flag(en void regulatory_hint_disconnect(void) { diff --git a/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch b/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch index 0886fd688..de6f9d9bb 100644 --- a/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch +++ b/package/kernel/mac80211/patches/ath10k/080-ath10k_thermal_config.patch @@ -37,7 +37,7 @@ void ath10k_thermal_event_temperature(struct ath10k *ar, int temperature); --- a/local-symbols +++ b/local-symbols -@@ -135,6 +135,7 @@ ATH10K_SNOC= +@@ -142,6 +142,7 @@ ATH10K_SNOC= ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= diff --git a/package/kernel/mac80211/patches/ath10k/081-01-ath10k-improve-tx-status-reporting.patch b/package/kernel/mac80211/patches/ath10k/081-01-ath10k-improve-tx-status-reporting.patch new file mode 100644 index 000000000..c02485091 --- /dev/null +++ b/package/kernel/mac80211/patches/ath10k/081-01-ath10k-improve-tx-status-reporting.patch @@ -0,0 +1,69 @@ +From 2587d5198aa5adcbd8896aae4a2404dc13d48637 Mon Sep 17 00:00:00 2001 +From: Sergey Ryazanov +Date: Wed, 18 May 2022 10:27:26 +0300 +Subject: ath10k: improve tx status reporting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +We use ieee80211_tx_status() to report each completed tx frame. +Internally, this function calls sta_info_get_by_addrs(), what has a +couple of drawbacks: +1. additional station lookup causes a performance degradation; +2. mac80211 can not properly account Ethernet encapsulated frames due + to the inability to properly determine the destination (station) MAC + address since ieee80211_tx_status() assumes the frame has a 802.11 + header. + +The latter is especially destructive if we want to use hardware frames +encapsulation. + +To fix both of these issues, replace ieee80211_tx_status() with +ieee80211_tx_status_ext() call and feed it station pointer from the tx +queue associated with the transmitted frame. + +Tested-on: QCA9888 hw2.0 PCI 10.4-3.9.0.2-00131 +Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1 + +Signed-off-by: Sergey Ryazanov +Tested-by: Oldřich Jedlička # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880) +Tested-by: Edward Matijevic # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1) +Tested-by: Edward Matijevic # QCA9377 PCI in Sta mode +Tested-by: Zhijun You # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159) +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220516032519.29831-2-ryazanov.s.a@gmail.com +--- + drivers/net/wireless/ath/ath10k/txrx.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath10k/txrx.c ++++ b/drivers/net/wireless/ath/ath10k/txrx.c +@@ -43,6 +43,7 @@ out: + int ath10k_txrx_tx_unref(struct ath10k_htt *htt, + const struct htt_tx_done *tx_done) + { ++ struct ieee80211_tx_status status; + struct ath10k *ar = htt->ar; + struct device *dev = ar->dev; + struct ieee80211_tx_info *info; +@@ -128,7 +129,19 @@ int ath10k_txrx_tx_unref(struct ath10k_h + info->status.is_valid_ack_signal = true; + } + +- ieee80211_tx_status(htt->ar->hw, msdu); ++ memset(&status, 0, sizeof(status)); ++ status.skb = msdu; ++ status.info = info; ++ ++ rcu_read_lock(); ++ ++ if (txq) ++ status.sta = txq->sta; ++ ++ ieee80211_tx_status_ext(htt->ar->hw, &status); ++ ++ rcu_read_unlock(); ++ + /* we do not own the msdu anymore */ + + return 0; diff --git a/package/kernel/mac80211/patches/ath10k/081-02-ath10k-turn-rawmode-into-frame-mode.patch b/package/kernel/mac80211/patches/ath10k/081-02-ath10k-turn-rawmode-into-frame-mode.patch new file mode 100644 index 000000000..e67281552 --- /dev/null +++ b/package/kernel/mac80211/patches/ath10k/081-02-ath10k-turn-rawmode-into-frame-mode.patch @@ -0,0 +1,74 @@ +From a09740548275a74b897654b3aca5af589289b57a Mon Sep 17 00:00:00 2001 +From: Sergey Ryazanov +Date: Mon, 16 May 2022 13:26:00 +0300 +Subject: ath10k: turn rawmode into frame_mode + +Turn boolean rawmode module param into integer frame_mode param that +contains value from ath10k_hw_txrx_mode enum. As earlier the default +param value is non-RAW (native Wi-Fi) encapsulation. The param name +is selected to be consistent with the similar ath11k param. + +This is a preparation step for upcoming encapsulation offloading +support. + +Signed-off-by: Sergey Ryazanov +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220516032519.29831-4-ryazanov.s.a@gmail.com +--- + drivers/net/wireless/ath/ath10k/core.c | 11 +++++++---- + drivers/net/wireless/ath/ath10k/core.h | 1 + + 2 files changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -32,9 +32,11 @@ EXPORT_SYMBOL(ath10k_debug_mask); + static unsigned int ath10k_cryptmode_param; + static bool uart_print; + static bool skip_otp; +-static bool rawmode; + static bool fw_diag_log; + ++/* frame mode values are mapped as per enum ath10k_hw_txrx_mode */ ++unsigned int ath10k_frame_mode = ATH10K_HW_TXRX_NATIVE_WIFI; ++ + unsigned long ath10k_coredump_mask = BIT(ATH10K_FW_CRASH_DUMP_REGISTERS) | + BIT(ATH10K_FW_CRASH_DUMP_CE_DATA); + +@@ -43,15 +45,16 @@ module_param_named(debug_mask, ath10k_de + module_param_named(cryptmode, ath10k_cryptmode_param, uint, 0644); + module_param(uart_print, bool, 0644); + module_param(skip_otp, bool, 0644); +-module_param(rawmode, bool, 0644); + module_param(fw_diag_log, bool, 0644); ++module_param_named(frame_mode, ath10k_frame_mode, uint, 0644); + module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444); + + MODULE_PARM_DESC(debug_mask, "Debugging mask"); + MODULE_PARM_DESC(uart_print, "Uart target debugging"); + MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode"); + MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software"); +-MODULE_PARM_DESC(rawmode, "Use raw 802.11 frame datapath"); ++MODULE_PARM_DESC(frame_mode, ++ "Datapath frame mode (0: raw, 1: native wifi (default))"); + MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file"); + MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging"); + +@@ -2487,7 +2490,7 @@ static int ath10k_core_init_firmware_fea + ar->htt.max_num_amsdu = ATH10K_HTT_MAX_NUM_AMSDU_DEFAULT; + ar->htt.max_num_ampdu = ATH10K_HTT_MAX_NUM_AMPDU_DEFAULT; + +- if (rawmode) { ++ if (ath10k_frame_mode == ATH10K_HW_TXRX_RAW) { + if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT, + fw_file->fw_features)) { + ath10k_err(ar, "rawmode = 1 requires support from firmware"); +--- a/drivers/net/wireless/ath/ath10k/core.h ++++ b/drivers/net/wireless/ath/ath10k/core.h +@@ -1311,6 +1311,7 @@ static inline bool ath10k_peer_stats_ena + return false; + } + ++extern unsigned int ath10k_frame_mode; + extern unsigned long ath10k_coredump_mask; + + void ath10k_core_napi_sync_disable(struct ath10k *ar); diff --git a/package/kernel/mac80211/patches/ath10k/081-03-ath10k-htt-tx-do-not-interpret-Eth-frames-as-WiFi.patch b/package/kernel/mac80211/patches/ath10k/081-03-ath10k-htt-tx-do-not-interpret-Eth-frames-as-WiFi.patch new file mode 100644 index 000000000..a669c77fe --- /dev/null +++ b/package/kernel/mac80211/patches/ath10k/081-03-ath10k-htt-tx-do-not-interpret-Eth-frames-as-WiFi.patch @@ -0,0 +1,163 @@ +From 70f119fb82af7f7417dc659faf02c91e1f853739 Mon Sep 17 00:00:00 2001 +From: Sergey Ryazanov +Date: Mon, 16 May 2022 13:26:00 +0300 +Subject: ath10k: htt_tx: do not interpret Eth frames as WiFi + +The xmit path for the Ethernet encapsulated frames become more or less +usable since d740d8fd2439 ("ath10k: unify tx mode and dispatch"). This +change reorganize the xmit path in a manageable way to properly support +various tx modes, but misses that the Ethernet encapsulated frame is a +special case. We do not have an IEEE 802.11 header at the begining of +them. But the HTT Tx handler still interprets first bytes of each frame +as an IEEE 802.11 Frame Control field. + +Than this code was copied by e62ee5c381c5 ("ath10k: Add support for +htt_data_tx_desc_64 descriptor") and a2097d6444c3 ("ath10k: htt: High +latency TX support") to another handlers. In fact the issue in the high +latency (HL) handler was introduced by 83ac260151e7 ("ath10k: add mic +bytes for pmf management packet"). + +Ethernet encapsulated frame tx mode stay unused until 75d85fd9993c +("ath10k: introduce basic tdls functionality") started using it for TDLS +frames to avoid key selection issue in some firmwares. + +Trying to interpret the begining of an Ethernet encapsulated frame as an +IEEE 802.11 header was not hurt us noticeably since we need to meet two +conditions: (1) xmit should be performed towards a TDLS peer, and (2) +the TDLS peer should have a specific OUI part of its MAC address. Looks +like that the rareness in TDLS communications of OUIs that can be +interpreted as an 802.11 management frame saves users from facing this +issue earlier. + +Improve Ethernet tx mode support in the HTT Tx handler by avoiding +interpreting its first bytes as an IEEE 802.11 header. While at it, make +the ieee80211_hdr variable local to the code block that is guarded by +!is_eth check. In this way, we clarify in which cases a frame can be +interpreted as IEEE 802.11, and saves us from similar issues in the +future. + +Credits: this change as part of xmit encapsulation offloading support +was originally made by QCA and then submitted for inclusion by John +Crispin [1]. But the whole work was not accepted due to the lack of a +part for 64-bits descriptors [2]. Zhijun You then pointed this out to me +in a reply to my initial RFC patch series. And I made this slightly +reworked version that covered all the HTT Tx handler variants. + +1. https://lore.kernel.org/all/20191216092207.31032-1-john@phrozen.org/ +2. https://patchwork.kernel.org/project/linux-wireless/patch/20191216092207.31032-1-john@phrozen.org/ + +Reported-by: Zhijun You +Signed-off-by: Vasanthakumar Thiagarajan +Signed-off-by: John Crispin +Signed-off-by: Sergey Ryazanov +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220516032519.29831-3-ryazanov.s.a@gmail.com +--- + drivers/net/wireless/ath/ath10k/htt_tx.c | 61 ++++++++++++++++++-------------- + 1 file changed, 35 insertions(+), 26 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/htt_tx.c ++++ b/drivers/net/wireless/ath/ath10k/htt_tx.c +@@ -1295,7 +1295,6 @@ static int ath10k_htt_tx_hl(struct ath10 + struct ath10k *ar = htt->ar; + int res, data_len; + struct htt_cmd_hdr *cmd_hdr; +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; + struct htt_data_tx_desc *tx_desc; + struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu); + struct sk_buff *tmp_skb; +@@ -1306,11 +1305,15 @@ static int ath10k_htt_tx_hl(struct ath10 + u16 flags1 = 0; + u16 msdu_id = 0; + +- if ((ieee80211_is_action(hdr->frame_control) || +- ieee80211_is_deauth(hdr->frame_control) || +- ieee80211_is_disassoc(hdr->frame_control)) && +- ieee80211_has_protected(hdr->frame_control)) { +- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); ++ if (!is_eth) { ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; ++ ++ if ((ieee80211_is_action(hdr->frame_control) || ++ ieee80211_is_deauth(hdr->frame_control) || ++ ieee80211_is_disassoc(hdr->frame_control)) && ++ ieee80211_has_protected(hdr->frame_control)) { ++ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); ++ } + } + + data_len = msdu->len; +@@ -1407,7 +1410,6 @@ static int ath10k_htt_tx_32(struct ath10 + { + struct ath10k *ar = htt->ar; + struct device *dev = ar->dev; +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu); + struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu); + struct ath10k_hif_sg_item sg_items[2]; +@@ -1439,15 +1441,19 @@ static int ath10k_htt_tx_32(struct ath10 + txbuf_paddr = htt->txbuf.paddr + + (sizeof(struct ath10k_htt_txbuf_32) * msdu_id); + +- if ((ieee80211_is_action(hdr->frame_control) || +- ieee80211_is_deauth(hdr->frame_control) || +- ieee80211_is_disassoc(hdr->frame_control)) && +- ieee80211_has_protected(hdr->frame_control)) { +- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); +- } else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) && +- txmode == ATH10K_HW_TXRX_RAW && +- ieee80211_has_protected(hdr->frame_control)) { +- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); ++ if (!is_eth) { ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; ++ ++ if ((ieee80211_is_action(hdr->frame_control) || ++ ieee80211_is_deauth(hdr->frame_control) || ++ ieee80211_is_disassoc(hdr->frame_control)) && ++ ieee80211_has_protected(hdr->frame_control)) { ++ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); ++ } else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) && ++ txmode == ATH10K_HW_TXRX_RAW && ++ ieee80211_has_protected(hdr->frame_control)) { ++ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); ++ } + } + + skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len, +@@ -1609,7 +1615,6 @@ static int ath10k_htt_tx_64(struct ath10 + { + struct ath10k *ar = htt->ar; + struct device *dev = ar->dev; +- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu); + struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu); + struct ath10k_hif_sg_item sg_items[2]; +@@ -1641,15 +1646,19 @@ static int ath10k_htt_tx_64(struct ath10 + txbuf_paddr = htt->txbuf.paddr + + (sizeof(struct ath10k_htt_txbuf_64) * msdu_id); + +- if ((ieee80211_is_action(hdr->frame_control) || +- ieee80211_is_deauth(hdr->frame_control) || +- ieee80211_is_disassoc(hdr->frame_control)) && +- ieee80211_has_protected(hdr->frame_control)) { +- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); +- } else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) && +- txmode == ATH10K_HW_TXRX_RAW && +- ieee80211_has_protected(hdr->frame_control)) { +- skb_put(msdu, IEEE80211_CCMP_MIC_LEN); ++ if (!is_eth) { ++ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)msdu->data; ++ ++ if ((ieee80211_is_action(hdr->frame_control) || ++ ieee80211_is_deauth(hdr->frame_control) || ++ ieee80211_is_disassoc(hdr->frame_control)) && ++ ieee80211_has_protected(hdr->frame_control)) { ++ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); ++ } else if (!(skb_cb->flags & ATH10K_SKB_F_NO_HWCRYPT) && ++ txmode == ATH10K_HW_TXRX_RAW && ++ ieee80211_has_protected(hdr->frame_control)) { ++ skb_put(msdu, IEEE80211_CCMP_MIC_LEN); ++ } + } + + skb_cb->paddr = dma_map_single(dev, msdu->data, msdu->len, diff --git a/package/kernel/mac80211/patches/ath10k/081-04-ath10k-add-encapsulation-offloading-support.patch b/package/kernel/mac80211/patches/ath10k/081-04-ath10k-add-encapsulation-offloading-support.patch new file mode 100644 index 000000000..cb02dede6 --- /dev/null +++ b/package/kernel/mac80211/patches/ath10k/081-04-ath10k-add-encapsulation-offloading-support.patch @@ -0,0 +1,194 @@ +From af6d8265c47e46881b80c6b073f53c8c4af52d28 Mon Sep 17 00:00:00 2001 +From: Sergey Ryazanov +Date: Mon, 16 May 2022 13:26:00 +0300 +Subject: ath10k: add encapsulation offloading support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Frame encapsulation from Ethernet into the IEEE 802.11 frame format +takes a considerable host CPU time on the xmit path. The firmware is +able to do this operation for us, so enable encapsulation offloading for +AP and Sta interface types to improve overall system performance. + +The driver is almost ready for encapsulation offloading support. There +are only a few places where the driver assumes the frame format is IEEE +802.11 that need to be fixed. + +Encapsulation offloading is currently disabled by default and the driver +utilizes mac80211 encapsulation support. To activate offloading, the +frame_mode=2 parameter should be passed during module loading. + +On a QCA9563+QCA9888-based access point in bridged mode, encapsulation +offloading increases TCP 16-streams DL throughput from 365 to 396 mbps +(+8%) and UDP DL throughput from 436 to 483 mbps (+11%). + +Tested-on: QCA9888 hw2.0 PCI 10.4-3.9.0.2-00131 +Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00157-QCARMSWPZ-1 +Signed-off-by: Sergey Ryazanov +Tested-by: Oldřich Jedlička # TP-Link Archer C7 v4 & v5 (QCA9563 + QCA9880) +Tested-by: Edward Matijevic # TP-Link Archer C2600 (IPQ8064 + QCA9980 10.4.1.00030-1) +Tested-by: Edward Matijevic # QCA9377 PCI in Sta mode +Tested-by: Zhijun You # NETGEAR R7800 (QCA9984 10.4-3.9.0.2-00159) +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220516032519.29831-5-ryazanov.s.a@gmail.com +--- + drivers/net/wireless/ath/ath10k/core.c | 2 +- + drivers/net/wireless/ath/ath10k/mac.c | 67 +++++++++++++++++++++++++++------- + 2 files changed, 55 insertions(+), 14 deletions(-) + +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -54,7 +54,7 @@ MODULE_PARM_DESC(uart_print, "Uart targe + MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration in testmode"); + MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software"); + MODULE_PARM_DESC(frame_mode, +- "Datapath frame mode (0: raw, 1: native wifi (default))"); ++ "Datapath frame mode (0: raw, 1: native wifi (default), 2: ethernet)"); + MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash file"); + MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging"); + +--- a/drivers/net/wireless/ath/ath10k/mac.c ++++ b/drivers/net/wireless/ath/ath10k/mac.c +@@ -3710,6 +3710,9 @@ ath10k_mac_tx_h_get_txmode(struct ath10k + const struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); + __le16 fc = hdr->frame_control; + ++ if (IEEE80211_SKB_CB(skb)->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) ++ return ATH10K_HW_TXRX_ETHERNET; ++ + if (!vif || vif->type == NL80211_IFTYPE_MONITOR) + return ATH10K_HW_TXRX_RAW; + +@@ -3870,6 +3873,12 @@ static void ath10k_mac_tx_h_fill_cb(stru + bool noack = false; + + cb->flags = 0; ++ ++ if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) { ++ cb->flags |= ATH10K_SKB_F_QOS; /* Assume data frames are QoS */ ++ goto finish_cb_fill; ++ } ++ + if (!ath10k_tx_h_use_hwcrypto(vif, skb)) + cb->flags |= ATH10K_SKB_F_NO_HWCRYPT; + +@@ -3908,6 +3917,7 @@ static void ath10k_mac_tx_h_fill_cb(stru + cb->flags |= ATH10K_SKB_F_RAW_TX; + } + ++finish_cb_fill: + cb->vif = vif; + cb->txq = txq; + cb->airtime_est = airtime; +@@ -4031,7 +4041,11 @@ static int ath10k_mac_tx(struct ath10k * + ath10k_tx_h_seq_no(vif, skb); + break; + case ATH10K_HW_TXRX_ETHERNET: +- ath10k_tx_h_8023(skb); ++ /* Convert 802.11->802.3 header only if the frame was erlier ++ * encapsulated to 802.11 by mac80211. Otherwise pass it as is. ++ */ ++ if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) ++ ath10k_tx_h_8023(skb); + break; + case ATH10K_HW_TXRX_RAW: + if (!test_bit(ATH10K_FLAG_RAW_MODE, &ar->dev_flags) && +@@ -4643,12 +4657,10 @@ static void ath10k_mac_op_tx(struct ieee + struct ieee80211_vif *vif = info->control.vif; + struct ieee80211_sta *sta = control->sta; + struct ieee80211_txq *txq = NULL; +- struct ieee80211_hdr *hdr = (void *)skb->data; + enum ath10k_hw_txrx_mode txmode; + enum ath10k_mac_tx_path txpath; + bool is_htt; + bool is_mgmt; +- bool is_presp; + int ret; + u16 airtime; + +@@ -4662,8 +4674,14 @@ static void ath10k_mac_op_tx(struct ieee + is_mgmt = (txpath == ATH10K_MAC_TX_HTT_MGMT); + + if (is_htt) { ++ bool is_presp = false; ++ + spin_lock_bh(&ar->htt.tx_lock); +- is_presp = ieee80211_is_probe_resp(hdr->frame_control); ++ if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) { ++ struct ieee80211_hdr *hdr = (void *)skb->data; ++ ++ is_presp = ieee80211_is_probe_resp(hdr->frame_control); ++ } + + ret = ath10k_htt_tx_inc_pending(htt); + if (ret) { +@@ -5447,6 +5465,30 @@ static int ath10k_mac_set_txbf_conf(stru + ar->wmi.vdev_param->txbf, value); + } + ++static void ath10k_update_vif_offload(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif) ++{ ++ struct ath10k_vif *arvif = (void *)vif->drv_priv; ++ struct ath10k *ar = hw->priv; ++ u32 vdev_param; ++ int ret; ++ ++ if (ath10k_frame_mode != ATH10K_HW_TXRX_ETHERNET || ++ ar->wmi.vdev_param->tx_encap_type == WMI_VDEV_PARAM_UNSUPPORTED || ++ (vif->type != NL80211_IFTYPE_STATION && ++ vif->type != NL80211_IFTYPE_AP)) ++ vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; ++ ++ vdev_param = ar->wmi.vdev_param->tx_encap_type; ++ ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, ++ ATH10K_HW_TXRX_NATIVE_WIFI); ++ /* 10.X firmware does not support this VDEV parameter. Do not warn */ ++ if (ret && ret != -EOPNOTSUPP) { ++ ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n", ++ arvif->vdev_id, ret); ++ } ++} ++ + /* + * TODO: + * Figure out how to handle WMI_VDEV_SUBTYPE_P2P_DEVICE, +@@ -5656,15 +5698,7 @@ static int ath10k_add_interface(struct i + + arvif->def_wep_key_idx = -1; + +- vdev_param = ar->wmi.vdev_param->tx_encap_type; +- ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, +- ATH10K_HW_TXRX_NATIVE_WIFI); +- /* 10.X firmware does not support this VDEV parameter. Do not warn */ +- if (ret && ret != -EOPNOTSUPP) { +- ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n", +- arvif->vdev_id, ret); +- goto err_vdev_delete; +- } ++ ath10k_update_vif_offload(hw, vif); + + /* Configuring number of spatial stream for monitor interface is causing + * target assert in qca9888 and qca6174. +@@ -9352,6 +9386,7 @@ static const struct ieee80211_ops ath10k + .stop = ath10k_stop, + .config = ath10k_config, + .add_interface = ath10k_add_interface, ++ .update_vif_offload = ath10k_update_vif_offload, + .remove_interface = ath10k_remove_interface, + .configure_filter = ath10k_configure_filter, + .bss_info_changed = ath10k_bss_info_changed, +@@ -10021,6 +10056,12 @@ int ath10k_mac_register(struct ath10k *a + if (test_bit(WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, ar->wmi.svc_map)) + ieee80211_hw_set(ar->hw, SUPPORTS_TDLS_BUFFER_STA); + ++ if (ath10k_frame_mode == ATH10K_HW_TXRX_ETHERNET) { ++ if (ar->wmi.vdev_param->tx_encap_type != ++ WMI_VDEV_PARAM_UNSUPPORTED) ++ ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); ++ } ++ + ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; + ar->hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; + ar->hw->wiphy->max_remain_on_channel_duration = 5000; diff --git a/package/kernel/mac80211/patches/ath10k/100-ath10k-support-bus-and-device-specific-API-1-BDF-sel.patch b/package/kernel/mac80211/patches/ath10k/100-ath10k-support-bus-and-device-specific-API-1-BDF-sel.patch new file mode 100644 index 000000000..7ef418e50 --- /dev/null +++ b/package/kernel/mac80211/patches/ath10k/100-ath10k-support-bus-and-device-specific-API-1-BDF-sel.patch @@ -0,0 +1,65 @@ +From f2a7064a78b22f2b68b9fcbc8a6f4c5e61c5ba64 Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Sun, 10 Oct 2021 00:17:11 +0200 +Subject: [PATCH] ath10k: support bus and device specific API 1 BDF selection + +Some ath10k IPQ40xx devices like the MikroTik hAP ac2 and ac3 require the +BDF-s to be extracted from the device storage instead of shipping packaged +API 2 BDF-s. + +This is required as MikroTik has started shipping boards that require BDF-s +to be updated, as otherwise their WLAN performance really suffers. +This is however impossible as the devices that require this are release +under the same revision and its not possible to differentiate them from +devices using the older BDF-s. + +In OpenWrt we are extracting the calibration data during runtime and we are +able to extract the BDF-s in the same manner, however we cannot package the +BDF-s to API 2 format on the fly and can only use API 1 to provide BDF-s on +the fly. +This is an issue as the ath10k driver explicitly looks only for the +board.bin file and not for something like board-bus-device.bin like it does +for pre-cal data. +Due to this we have no way of providing correct BDF-s on the fly, so lets +extend the ath10k driver to first look for BDF-s in the +board-bus-device.bin format, for example: board-ahb-a800000.wifi.bin +If that fails, look for the default board file name as defined previously. + +Signed-off-by: Robert Marko +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20211009221711.2315352-1-robimarko@gmail.com +--- + drivers/net/wireless/ath/ath10k/core.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath10k/core.c ++++ b/drivers/net/wireless/ath/ath10k/core.c +@@ -1202,6 +1202,7 @@ success: + static int ath10k_core_fetch_board_data_api_1(struct ath10k *ar, int bd_ie_type) + { + const struct firmware *fw; ++ char boardname[100]; + + if (bd_ie_type == ATH10K_BD_IE_BOARD) { + if (!ar->hw_params.fw.board) { +@@ -1209,9 +1210,19 @@ static int ath10k_core_fetch_board_data_ + return -EINVAL; + } + ++ scnprintf(boardname, sizeof(boardname), "board-%s-%s.bin", ++ ath10k_bus_str(ar->hif.bus), dev_name(ar->dev)); ++ + ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar, + ar->hw_params.fw.dir, +- ar->hw_params.fw.board); ++ boardname); ++ if (IS_ERR(ar->normal_mode_fw.board)) { ++ fw = ath10k_fetch_fw_file(ar, ++ ar->hw_params.fw.dir, ++ ar->hw_params.fw.board); ++ ar->normal_mode_fw.board = fw; ++ } ++ + if (IS_ERR(ar->normal_mode_fw.board)) + return PTR_ERR(ar->normal_mode_fw.board); + diff --git a/package/kernel/mac80211/patches/ath10k/120-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch b/package/kernel/mac80211/patches/ath10k/120-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch index 6728a69ef..c7a00b7e4 100644 --- a/package/kernel/mac80211/patches/ath10k/120-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch +++ b/package/kernel/mac80211/patches/ath10k/120-ath10k-fetch-calibration-data-via-nvmem-subsystem.patch @@ -34,7 +34,7 @@ Signed-off-by: Christian Lamparter #include #include "core.h" -@@ -935,7 +936,8 @@ static int ath10k_core_get_board_id_from +@@ -955,7 +956,8 @@ static int ath10k_core_get_board_id_from } if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT || @@ -44,7 +44,7 @@ Signed-off-by: Christian Lamparter bmi_board_id_param = BMI_PARAM_GET_FLASH_BOARD_ID; else bmi_board_id_param = BMI_PARAM_GET_EEPROM_BOARD_ID; -@@ -1726,7 +1728,8 @@ static int ath10k_download_and_run_otp(s +@@ -1757,7 +1759,8 @@ static int ath10k_download_and_run_otp(s /* As of now pre-cal is valid for 10_4 variants */ if (ar->cal_mode == ATH10K_PRE_CAL_MODE_DT || @@ -54,7 +54,7 @@ Signed-off-by: Christian Lamparter bmi_otp_exe_param = BMI_PARAM_FLASH_SECTION_ALL; ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result); -@@ -1853,6 +1856,39 @@ out_free: +@@ -1884,6 +1887,39 @@ out_free: return ret; } @@ -94,7 +94,7 @@ Signed-off-by: Christian Lamparter int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name, struct ath10k_fw_file *fw_file) { -@@ -2087,6 +2123,18 @@ static int ath10k_core_pre_cal_download( +@@ -2118,6 +2154,18 @@ static int ath10k_core_pre_cal_download( { int ret; @@ -113,7 +113,7 @@ Signed-off-by: Christian Lamparter ret = ath10k_download_cal_file(ar, ar->pre_cal_file); if (ret == 0) { ar->cal_mode = ATH10K_PRE_CAL_MODE_FILE; -@@ -2153,6 +2201,18 @@ static int ath10k_download_cal_data(stru +@@ -2184,6 +2232,18 @@ static int ath10k_download_cal_data(stru "pre cal download procedure failed, try cal file: %d\n", ret); diff --git a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch index 710cd4526..e47fb012f 100644 --- a/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch +++ b/package/kernel/mac80211/patches/ath10k/921-ath10k_init_devices_synchronously.patch @@ -14,7 +14,7 @@ Signed-off-by: Sven Eckelmann --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c -@@ -3412,6 +3412,16 @@ int ath10k_core_register(struct ath10k * +@@ -3443,6 +3443,16 @@ int ath10k_core_register(struct ath10k * queue_work(ar->workqueue, &ar->register_work); diff --git a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch index b60db1946..9cbc52b88 100644 --- a/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch +++ b/package/kernel/mac80211/patches/ath10k/930-ath10k_add_tpt_led_trigger.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -9843,6 +9843,21 @@ static int ath10k_mac_init_rd(struct ath +@@ -9878,6 +9878,21 @@ static int ath10k_mac_init_rd(struct ath return 0; } @@ -22,7 +22,7 @@ int ath10k_mac_register(struct ath10k *ar) { static const u32 cipher_suites[] = { -@@ -10195,6 +10210,12 @@ int ath10k_mac_register(struct ath10k *a +@@ -10236,6 +10251,12 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch index 65d67b2e0..f1e7f5ecc 100644 --- a/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch +++ b/package/kernel/mac80211/patches/ath10k/974-ath10k_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch @@ -114,7 +114,7 @@ v13: ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o --- a/local-symbols +++ b/local-symbols -@@ -136,6 +136,7 @@ ATH10K_DEBUG= +@@ -143,6 +143,7 @@ ATH10K_DEBUG= ATH10K_DEBUGFS= ATH10K_SPECTRAL= ATH10K_THERMAL= @@ -132,7 +132,7 @@ v13: unsigned int ath10k_debug_mask; EXPORT_SYMBOL(ath10k_debug_mask); -@@ -62,6 +63,7 @@ static const struct ath10k_hw_params ath +@@ -65,6 +66,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA988X_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca988x hw2.0", @@ -140,7 +140,7 @@ v13: .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -133,6 +135,7 @@ static const struct ath10k_hw_params ath +@@ -138,6 +140,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9887_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9887 hw1.0", @@ -148,7 +148,7 @@ v13: .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, -@@ -344,6 +347,7 @@ static const struct ath10k_hw_params ath +@@ -355,6 +358,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA99X0_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca99x0 hw2.0", @@ -156,7 +156,7 @@ v13: .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .otp_exe_param = 0x00000700, -@@ -385,6 +389,7 @@ static const struct ath10k_hw_params ath +@@ -397,6 +401,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9984_1_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9984/qca9994 hw1.0", @@ -164,7 +164,7 @@ v13: .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -433,6 +438,7 @@ static const struct ath10k_hw_params ath +@@ -446,6 +451,7 @@ static const struct ath10k_hw_params ath .dev_id = QCA9888_2_0_DEVICE_ID, .bus = ATH10K_BUS_PCI, .name = "qca9888 hw2.0", @@ -172,7 +172,7 @@ v13: .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, -@@ -3127,6 +3133,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -3158,6 +3164,10 @@ int ath10k_core_start(struct ath10k *ar, goto err_hif_stop; } @@ -183,7 +183,7 @@ v13: return 0; err_hif_stop: -@@ -3385,9 +3395,18 @@ static void ath10k_core_register_work(st +@@ -3416,9 +3426,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -202,7 +202,7 @@ v13: err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -3433,6 +3452,8 @@ void ath10k_core_unregister(struct ath10 +@@ -3464,6 +3483,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; diff --git a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch index da31ad578..4c1b73b1c 100644 --- a/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/mac80211/patches/ath10k/975-ath10k-use-tpt-trigger-by-default.patch @@ -42,7 +42,7 @@ Signed-off-by: Mathias Kresin if (ret) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -10212,7 +10212,7 @@ int ath10k_mac_register(struct ath10k *a +@@ -10253,7 +10253,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; #ifdef CPTCFG_MAC80211_LEDS diff --git a/package/kernel/mac80211/patches/ath10k/983-ath10k-allow-vht-on-2g.patch b/package/kernel/mac80211/patches/ath10k/983-ath10k-allow-vht-on-2g.patch deleted file mode 100644 index 78a09b9ae..000000000 --- a/package/kernel/mac80211/patches/ath10k/983-ath10k-allow-vht-on-2g.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/drivers/net/wireless/ath/ath10k/mac.c -+++ b/drivers/net/wireless/ath/ath10k/mac.c -@@ -4841,6 +4841,7 @@ static void ath10k_mac_setup_ht_vht_cap( - if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) { - band = &ar->mac.sbands[NL80211_BAND_2GHZ]; - band->ht_cap = ht_cap; -+ band->vht_cap = vht_cap; - } - if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) { - band = &ar->mac.sbands[NL80211_BAND_5GHZ]; diff --git a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch index e14329cce..80da07de8 100644 --- a/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch +++ b/package/kernel/mac80211/patches/ath10k/984-ath10k-Try-to-get-mac-address-from-dts.patch @@ -26,7 +26,7 @@ Signed-off-by: Ansuel Smith #include #include #include -@@ -3303,6 +3304,8 @@ static int ath10k_core_probe_fw(struct a +@@ -3334,6 +3335,8 @@ static int ath10k_core_probe_fw(struct a device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr)); diff --git a/package/kernel/mac80211/patches/ath11k/0002-ath11k-fix-4-addr-tx-failure-for-AP-and-STA-modes.patch b/package/kernel/mac80211/patches/ath11k/0001-ath11k-fix-4-addr-tx-failure-for-AP-and-STA-modes.patch similarity index 89% rename from package/kernel/mac80211/patches/ath11k/0002-ath11k-fix-4-addr-tx-failure-for-AP-and-STA-modes.patch rename to package/kernel/mac80211/patches/ath11k/0001-ath11k-fix-4-addr-tx-failure-for-AP-and-STA-modes.patch index a88ffa5ff..69e6b43ee 100644 --- a/package/kernel/mac80211/patches/ath11k/0002-ath11k-fix-4-addr-tx-failure-for-AP-and-STA-modes.patch +++ b/package/kernel/mac80211/patches/ath11k/0001-ath11k-fix-4-addr-tx-failure-for-AP-and-STA-modes.patch @@ -1,7 +1,7 @@ From 34c67dc366419e06129dad0f32f521842bdff9bc Mon Sep 17 00:00:00 2001 From: Sathishkumar Muruganandam Date: Wed, 21 Jul 2021 00:31:46 +0300 -Subject: [PATCH 002/120] ath11k: fix 4-addr tx failure for AP and STA modes +Subject: [PATCH] ath11k: fix 4-addr tx failure for AP and STA modes Ath11k FW requires peer parameter WMI_PEER_USE_4ADDR to be set for 4-addr peers allowing 4-address frame transmission to those peers. @@ -35,7 +35,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-1-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -362,6 +362,7 @@ struct ath11k_sta { +@@ -368,6 +368,7 @@ struct ath11k_sta { enum hal_pn_type pn_type; struct work_struct update_wk; @@ -43,7 +43,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-1-jouni@codeaurora.org struct rate_info txrate; struct rate_info last_txrate; u64 rx_duration; -@@ -374,6 +375,8 @@ struct ath11k_sta { +@@ -380,6 +381,8 @@ struct ath11k_sta { /* protected by conf_mutex */ bool aggr_mode; #endif @@ -54,7 +54,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-1-jouni@codeaurora.org #define ATH11K_MIN_5G_FREQ 4150 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3155,6 +3155,31 @@ static void ath11k_sta_rc_update_wk(stru +@@ -3161,6 +3161,31 @@ static void ath11k_sta_rc_update_wk(stru mutex_unlock(&ar->conf_mutex); } @@ -86,7 +86,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-1-jouni@codeaurora.org static int ath11k_mac_inc_num_stations(struct ath11k_vif *arvif, struct ieee80211_sta *sta) { -@@ -3234,11 +3259,13 @@ static int ath11k_mac_station_add(struct +@@ -3240,11 +3265,13 @@ static int ath11k_mac_station_add(struct } if (ieee80211_vif_is_mesh(vif)) { @@ -101,7 +101,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-1-jouni@codeaurora.org sta->addr, ret); goto free_tx_stats; } -@@ -3291,8 +3318,10 @@ static int ath11k_mac_op_sta_state(struc +@@ -3297,8 +3324,10 @@ static int ath11k_mac_op_sta_state(struc /* cancel must be done outside the mutex to avoid deadlock */ if ((old_state == IEEE80211_STA_NONE && @@ -113,7 +113,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-1-jouni@codeaurora.org mutex_lock(&ar->conf_mutex); -@@ -3301,6 +3330,7 @@ static int ath11k_mac_op_sta_state(struc +@@ -3307,6 +3336,7 @@ static int ath11k_mac_op_sta_state(struc memset(arsta, 0, sizeof(*arsta)); arsta->arvif = arvif; INIT_WORK(&arsta->update_wk, ath11k_sta_rc_update_wk); @@ -121,7 +121,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-1-jouni@codeaurora.org ret = ath11k_mac_station_add(ar, vif, sta); if (ret) -@@ -3395,6 +3425,19 @@ out: +@@ -3401,6 +3431,19 @@ out: return ret; } @@ -141,7 +141,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-1-jouni@codeaurora.org static void ath11k_mac_op_sta_rc_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta, -@@ -6180,6 +6223,7 @@ static const struct ieee80211_ops ath11k +@@ -6190,6 +6233,7 @@ static const struct ieee80211_ops ath11k .cancel_hw_scan = ath11k_mac_op_cancel_hw_scan, .set_key = ath11k_mac_op_set_key, .sta_state = ath11k_mac_op_sta_state, diff --git a/package/kernel/mac80211/patches/ath11k/0003-ath11k-fix-4addr-multicast-packet-tx.patch b/package/kernel/mac80211/patches/ath11k/0002-ath11k-fix-4addr-multicast-packet-tx.patch similarity index 95% rename from package/kernel/mac80211/patches/ath11k/0003-ath11k-fix-4addr-multicast-packet-tx.patch rename to package/kernel/mac80211/patches/ath11k/0002-ath11k-fix-4addr-multicast-packet-tx.patch index ca1399b5d..dba737ef7 100644 --- a/package/kernel/mac80211/patches/ath11k/0003-ath11k-fix-4addr-multicast-packet-tx.patch +++ b/package/kernel/mac80211/patches/ath11k/0002-ath11k-fix-4addr-multicast-packet-tx.patch @@ -1,7 +1,7 @@ From e20cfa3b62aeb1b5fc5ffa86a007af97f9954767 Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Wed, 21 Jul 2021 00:31:47 +0300 -Subject: [PATCH 003/120] ath11k: fix 4addr multicast packet tx +Subject: [PATCH] ath11k: fix 4addr multicast packet tx In 4addr, AP wired backbone to STA wired backbone ping fails due to ARP request not getting answered. Here 4addr ARP multicast packet is sent in @@ -25,7 +25,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-2-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -377,6 +377,7 @@ struct ath11k_sta { +@@ -383,6 +383,7 @@ struct ath11k_sta { #endif bool use_4addr_set; @@ -74,7 +74,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-2-jouni@codeaurora.org enum hal_reo_cmd_type type, --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -4356,6 +4356,7 @@ static void ath11k_mac_op_tx(struct ieee +@@ -4366,6 +4366,7 @@ static void ath11k_mac_op_tx(struct ieee struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_key_conf *key = info->control.hw_key; @@ -82,7 +82,7 @@ Link: https://lore.kernel.org/r/20210720213147.90042-2-jouni@codeaurora.org u32 info_flags = info->flags; bool is_prb_rsp; int ret; -@@ -4381,7 +4382,10 @@ static void ath11k_mac_op_tx(struct ieee +@@ -4391,7 +4392,10 @@ static void ath11k_mac_op_tx(struct ieee return; } diff --git a/package/kernel/mac80211/patches/ath11k/0004-ath11k-Rename-atf_config-to-flag1-in-target_resource.patch b/package/kernel/mac80211/patches/ath11k/0003-ath11k-Rename-atf_config-to-flag1-in-target_resource.patch similarity index 91% rename from package/kernel/mac80211/patches/ath11k/0004-ath11k-Rename-atf_config-to-flag1-in-target_resource.patch rename to package/kernel/mac80211/patches/ath11k/0003-ath11k-Rename-atf_config-to-flag1-in-target_resource.patch index 429324183..30ea23cb6 100644 --- a/package/kernel/mac80211/patches/ath11k/0004-ath11k-Rename-atf_config-to-flag1-in-target_resource.patch +++ b/package/kernel/mac80211/patches/ath11k/0003-ath11k-Rename-atf_config-to-flag1-in-target_resource.patch @@ -1,8 +1,7 @@ From 7e9fb2418a4c092a363d23e97973c9624150e5b2 Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Wed, 21 Jul 2021 00:49:20 +0300 -Subject: [PATCH 004/120] ath11k: Rename atf_config to flag1 in - target_resource_config +Subject: [PATCH] ath11k: Rename atf_config to flag1 in target_resource_config The flag's purpose is not only meant for ATF configs. Rename atf_config to flag1, so it can be used for future purposes. @@ -20,7 +19,7 @@ Link: https://lore.kernel.org/r/20210720214922.118078-1-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -3496,7 +3496,7 @@ ath11k_wmi_copy_resource_config(struct w +@@ -3497,7 +3497,7 @@ ath11k_wmi_copy_resource_config(struct w wmi_cfg->bpf_instruction_size = tg_cfg->bpf_instruction_size; wmi_cfg->max_bssid_rx_filters = tg_cfg->max_bssid_rx_filters; wmi_cfg->use_pdev_id = tg_cfg->use_pdev_id; diff --git a/package/kernel/mac80211/patches/ath11k/0005-ath11k-add-support-in-survey-dump-with-bss_chan_info.patch b/package/kernel/mac80211/patches/ath11k/0004-ath11k-add-support-in-survey-dump-with-bss_chan_info.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0005-ath11k-add-support-in-survey-dump-with-bss_chan_info.patch rename to package/kernel/mac80211/patches/ath11k/0004-ath11k-add-support-in-survey-dump-with-bss_chan_info.patch index 17e80cc79..e2a824558 100644 --- a/package/kernel/mac80211/patches/ath11k/0005-ath11k-add-support-in-survey-dump-with-bss_chan_info.patch +++ b/package/kernel/mac80211/patches/ath11k/0004-ath11k-add-support-in-survey-dump-with-bss_chan_info.patch @@ -1,7 +1,7 @@ From 9b4dd38b46cf24d8cb3ab433661cdc23a35160d0 Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Wed, 21 Jul 2021 00:49:21 +0300 -Subject: [PATCH 005/120] ath11k: add support in survey dump with bss_chan_info +Subject: [PATCH] ath11k: add support in survey dump with bss_chan_info Survey dump statistics is not displaying channel rx and tx time because the service flag is not enabled. Enable the service flag "bss_chan_info" diff --git a/package/kernel/mac80211/patches/ath11k/0007-ath11k-move-static-function-ath11k_mac_vdev_setup_sy.patch b/package/kernel/mac80211/patches/ath11k/0006-ath11k-move-static-function-ath11k_mac_vdev_setup_sy.patch similarity index 90% rename from package/kernel/mac80211/patches/ath11k/0007-ath11k-move-static-function-ath11k_mac_vdev_setup_sy.patch rename to package/kernel/mac80211/patches/ath11k/0006-ath11k-move-static-function-ath11k_mac_vdev_setup_sy.patch index 8d319efcd..56c221ab3 100644 --- a/package/kernel/mac80211/patches/ath11k/0007-ath11k-move-static-function-ath11k_mac_vdev_setup_sy.patch +++ b/package/kernel/mac80211/patches/ath11k/0006-ath11k-move-static-function-ath11k_mac_vdev_setup_sy.patch @@ -1,8 +1,8 @@ From d37b4862312c980d1f6843d11a14ad4eda242c8d Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Tue, 21 Sep 2021 16:39:29 +0300 -Subject: [PATCH 007/120] ath11k: move static function - ath11k_mac_vdev_setup_sync to top +Subject: [PATCH] ath11k: move static function ath11k_mac_vdev_setup_sync to + top This is to prepare for monitor mode clean up. No functional changes are done. @@ -21,7 +21,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-2-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -731,6 +731,20 @@ static int ath11k_monitor_vdev_up(struct +@@ -732,6 +732,20 @@ static int ath11k_monitor_vdev_up(struct return 0; } @@ -42,7 +42,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-2-jouni@codeaurora.org static int ath11k_mac_op_config(struct ieee80211_hw *hw, u32 changed) { /* mac80211 requires this op to be present and that's why -@@ -5165,20 +5179,6 @@ static void ath11k_mac_op_remove_chanctx +@@ -5175,20 +5189,6 @@ static void ath11k_mac_op_remove_chanctx mutex_unlock(&ar->conf_mutex); } diff --git a/package/kernel/mac80211/patches/ath11k/0008-ath11k-add-separate-APIs-for-monitor-mode.patch b/package/kernel/mac80211/patches/ath11k/0007-ath11k-add-separate-APIs-for-monitor-mode.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0008-ath11k-add-separate-APIs-for-monitor-mode.patch rename to package/kernel/mac80211/patches/ath11k/0007-ath11k-add-separate-APIs-for-monitor-mode.patch index 21aca94e8..51944e6e6 100644 --- a/package/kernel/mac80211/patches/ath11k/0008-ath11k-add-separate-APIs-for-monitor-mode.patch +++ b/package/kernel/mac80211/patches/ath11k/0007-ath11k-add-separate-APIs-for-monitor-mode.patch @@ -1,7 +1,7 @@ From 64e06b78a92744d43d3993ba623d2686d8f937e7 Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Tue, 21 Sep 2021 16:39:29 +0300 -Subject: [PATCH 008/120] ath11k: add separate APIs for monitor mode +Subject: [PATCH] ath11k: add separate APIs for monitor mode Add separate APIs for monitor_vdev_create/monitor_vdev_delete and monitor_vdev_start/monitor_vdev_stop. @@ -23,7 +23,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-3-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -194,6 +194,9 @@ enum ath11k_dev_flags { +@@ -200,6 +200,9 @@ enum ath11k_dev_flags { enum ath11k_monitor_flags { ATH11K_FLAG_MONITOR_ENABLED, @@ -33,7 +33,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-3-jouni@codeaurora.org }; struct ath11k_vif { -@@ -488,7 +491,6 @@ struct ath11k { +@@ -494,7 +497,6 @@ struct ath11k { u32 chan_tx_pwr; u32 num_stations; u32 max_num_stations; @@ -41,7 +41,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-3-jouni@codeaurora.org /* To synchronize concurrent synchronous mac80211 callback operations, * concurrent debugfs configuration and concurrent FW statistics events. */ -@@ -563,6 +565,7 @@ struct ath11k { +@@ -569,6 +571,7 @@ struct ath11k { struct ath11k_per_peer_tx_stats cached_stats; u32 last_ppdu_id; u32 cached_ppdu_id; @@ -51,7 +51,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-3-jouni@codeaurora.org #endif --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -745,14 +745,370 @@ static inline int ath11k_mac_vdev_setup_ +@@ -746,14 +746,370 @@ static inline int ath11k_mac_vdev_setup_ return ar->last_wmi_vdev_start_status ? -EINVAL : 0; } @@ -427,7 +427,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-3-jouni@codeaurora.org } static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) -@@ -6771,7 +7127,12 @@ int ath11k_mac_allocate(struct ath11k_ba +@@ -6781,7 +7137,12 @@ int ath11k_mac_allocate(struct ath11k_ba INIT_WORK(&ar->wmi_mgmt_tx_work, ath11k_mgmt_over_wmi_tx_work); skb_queue_head_init(&ar->wmi_mgmt_tx_queue); diff --git a/package/kernel/mac80211/patches/ath11k/0009-ath11k-monitor-mode-clean-up-to-use-separate-APIs.patch b/package/kernel/mac80211/patches/ath11k/0008-ath11k-monitor-mode-clean-up-to-use-separate-APIs.patch similarity index 88% rename from package/kernel/mac80211/patches/ath11k/0009-ath11k-monitor-mode-clean-up-to-use-separate-APIs.patch rename to package/kernel/mac80211/patches/ath11k/0008-ath11k-monitor-mode-clean-up-to-use-separate-APIs.patch index c7f15a506..b241aacc0 100644 --- a/package/kernel/mac80211/patches/ath11k/0009-ath11k-monitor-mode-clean-up-to-use-separate-APIs.patch +++ b/package/kernel/mac80211/patches/ath11k/0008-ath11k-monitor-mode-clean-up-to-use-separate-APIs.patch @@ -1,7 +1,7 @@ From 689a5e6fff75229ac7c2af7a9c51dc2d3ca1882b Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Tue, 21 Sep 2021 16:39:30 +0300 -Subject: [PATCH 009/120] ath11k: monitor mode clean up to use separate APIs +Subject: [PATCH] ath11k: monitor mode clean up to use separate APIs If monitor interface is enabled in co-exist mode, only local traffic are captured. It's caused by missing monitor vdev in co-exist mode. So, @@ -27,7 +27,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -193,7 +193,6 @@ enum ath11k_dev_flags { +@@ -199,7 +199,6 @@ enum ath11k_dev_flags { }; enum ath11k_monitor_flags { @@ -69,7 +69,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org HAL_RXDMA_MONITOR_STATUS, --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -715,22 +715,6 @@ void ath11k_mac_peer_cleanup_all(struct +@@ -716,22 +716,6 @@ void ath11k_mac_peer_cleanup_all(struct ar->num_stations = 0; } @@ -92,7 +92,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org static inline int ath11k_mac_vdev_setup_sync(struct ath11k *ar) { lockdep_assert_held(&ar->conf_mutex); -@@ -2326,7 +2310,7 @@ static int ath11k_mac_config_obss_pd(str +@@ -2331,7 +2315,7 @@ static int ath11k_mac_config_obss_pd(str /* Set and enable SRG/non-SRG OBSS PD Threshold */ param_id = WMI_PDEV_PARAM_SET_CMD_OBSS_PD_THRESHOLD; @@ -101,7 +101,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org ret = ath11k_wmi_pdev_set_param(ar, param_id, 0, pdev_id); if (ret) ath11k_warn(ar->ab, -@@ -5100,8 +5084,8 @@ static int ath11k_mac_op_add_interface(s +@@ -5110,8 +5094,8 @@ static int ath11k_mac_op_add_interface(s } if (ar->num_created_vdevs > (TARGET_NUM_VDEVS - 1)) { @@ -112,7 +112,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org ret = -EBUSY; goto err; } -@@ -5141,6 +5125,7 @@ static int ath11k_mac_op_add_interface(s +@@ -5151,6 +5135,7 @@ static int ath11k_mac_op_add_interface(s break; case NL80211_IFTYPE_MONITOR: arvif->vdev_type = WMI_VDEV_TYPE_MONITOR; @@ -120,7 +120,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org break; default: WARN_ON(1); -@@ -5242,6 +5227,9 @@ static int ath11k_mac_op_add_interface(s +@@ -5252,6 +5237,9 @@ static int ath11k_mac_op_add_interface(s goto err_peer_del; } break; @@ -130,7 +130,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org default: break; } -@@ -5262,6 +5250,16 @@ static int ath11k_mac_op_add_interface(s +@@ -5272,6 +5260,16 @@ static int ath11k_mac_op_add_interface(s ath11k_dp_vdev_tx_attach(ar, arvif); @@ -147,7 +147,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org mutex_unlock(&ar->conf_mutex); return 0; -@@ -5359,6 +5357,18 @@ static void ath11k_mac_op_remove_interfa +@@ -5369,6 +5367,18 @@ static void ath11k_mac_op_remove_interfa ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM deleted, vdev_id %d\n", vif->addr, arvif->vdev_id); @@ -166,7 +166,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org err_vdev_del: spin_lock_bh(&ar->data_lock); list_del(&arvif->list); -@@ -5378,7 +5388,6 @@ err_vdev_del: +@@ -5388,7 +5398,6 @@ err_vdev_del: /* Recalc txpower for remaining vdev */ ath11k_mac_txpower_recalc(ar); @@ -174,7 +174,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org /* TODO: recal traffic pause state based on the available vdevs */ -@@ -5401,8 +5410,6 @@ static void ath11k_mac_op_configure_filt +@@ -5411,8 +5420,6 @@ static void ath11k_mac_op_configure_filt u64 multicast) { struct ath11k *ar = hw->priv; @@ -183,7 +183,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org mutex_lock(&ar->conf_mutex); -@@ -5410,23 +5417,6 @@ static void ath11k_mac_op_configure_filt +@@ -5420,23 +5427,6 @@ static void ath11k_mac_op_configure_filt *total_flags &= SUPPORTED_FILTERS; ar->filter_flags = *total_flags; @@ -207,7 +207,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org mutex_unlock(&ar->conf_mutex); } -@@ -5617,7 +5607,9 @@ ath11k_mac_vdev_start_restart(struct ath +@@ -5627,7 +5617,9 @@ ath11k_mac_vdev_start_restart(struct ath return ret; } @@ -218,7 +218,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org ath11k_dbg(ab, ATH11K_DBG_MAC, "vdev %pM started, vdev_id %d\n", arvif->vif->addr, arvif->vdev_id); -@@ -5745,12 +5737,16 @@ ath11k_mac_update_vif_chan(struct ath11k +@@ -5755,12 +5747,16 @@ ath11k_mac_update_vif_chan(struct ath11k struct ath11k_vif *arvif; int ret; int i; @@ -235,7 +235,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org ath11k_dbg(ab, ATH11K_DBG_MAC, "mac chanctx switch vdev_id %i freq %u->%u width %d->%d\n", arvif->vdev_id, -@@ -5771,6 +5767,8 @@ ath11k_mac_update_vif_chan(struct ath11k +@@ -5781,6 +5777,8 @@ ath11k_mac_update_vif_chan(struct ath11k arvif->vdev_id, ret); continue; } @@ -244,7 +244,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org } /* All relevant vdevs are downed and associated channel resources -@@ -5808,6 +5806,24 @@ ath11k_mac_update_vif_chan(struct ath11k +@@ -5818,6 +5816,24 @@ ath11k_mac_update_vif_chan(struct ath11k continue; } } @@ -269,7 +269,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org } static void -@@ -5887,7 +5903,7 @@ static int ath11k_start_vdev_delay(struc +@@ -5897,7 +5913,7 @@ static int ath11k_start_vdev_delay(struc } if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { @@ -278,7 +278,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org if (ret) { ath11k_warn(ab, "failed put monitor up: %d\n", ret); return ret; -@@ -5947,6 +5963,18 @@ ath11k_mac_op_assign_vif_chanctx(struct +@@ -5957,6 +5973,18 @@ ath11k_mac_op_assign_vif_chanctx(struct } } @@ -297,7 +297,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org ret = ath11k_mac_vdev_start(arvif, &ctx->def); if (ret) { ath11k_warn(ab, "failed to start vdev %i addr %pM on freq %d: %d\n", -@@ -5954,14 +5982,19 @@ ath11k_mac_op_assign_vif_chanctx(struct +@@ -5964,14 +5992,19 @@ ath11k_mac_op_assign_vif_chanctx(struct ctx->def.chan->center_freq, ret); goto out; } @@ -322,7 +322,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org /* TODO: Setup ps and cts/rts protection */ ret = 0; -@@ -5995,6 +6028,20 @@ ath11k_mac_op_unassign_vif_chanctx(struc +@@ -6005,6 +6038,20 @@ ath11k_mac_op_unassign_vif_chanctx(struc ath11k_peer_find_by_addr(ab, ar->mac_addr)) ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); @@ -343,7 +343,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org ret = ath11k_mac_vdev_stop(arvif); if (ret) ath11k_warn(ab, "failed to stop vdev %i: %d\n", -@@ -6006,6 +6053,16 @@ ath11k_mac_op_unassign_vif_chanctx(struc +@@ -6016,6 +6063,16 @@ ath11k_mac_op_unassign_vif_chanctx(struc arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) ath11k_wmi_vdev_down(ar, arvif->vdev_id); @@ -360,7 +360,7 @@ Link: https://lore.kernel.org/r/20210721162053.46290-4-jouni@codeaurora.org mutex_unlock(&ar->conf_mutex); } -@@ -7128,7 +7185,6 @@ int ath11k_mac_allocate(struct ath11k_ba +@@ -7138,7 +7195,6 @@ int ath11k_mac_allocate(struct ath11k_ba INIT_WORK(&ar->wmi_mgmt_tx_work, ath11k_mgmt_over_wmi_tx_work); skb_queue_head_init(&ar->wmi_mgmt_tx_queue); diff --git a/package/kernel/mac80211/patches/ath11k/0010-ath11k-add-support-for-setting-fixed-HE-rate-gi-ltf.patch b/package/kernel/mac80211/patches/ath11k/0009-ath11k-add-support-for-setting-fixed-HE-rate-gi-ltf.patch similarity index 92% rename from package/kernel/mac80211/patches/ath11k/0010-ath11k-add-support-for-setting-fixed-HE-rate-gi-ltf.patch rename to package/kernel/mac80211/patches/ath11k/0009-ath11k-add-support-for-setting-fixed-HE-rate-gi-ltf.patch index d14ef5e2e..78c06b92b 100644 --- a/package/kernel/mac80211/patches/ath11k/0010-ath11k-add-support-for-setting-fixed-HE-rate-gi-ltf.patch +++ b/package/kernel/mac80211/patches/ath11k/0009-ath11k-add-support-for-setting-fixed-HE-rate-gi-ltf.patch @@ -1,7 +1,7 @@ From 61fe43e7216df6e9a912d831aafc7142fa20f280 Mon Sep 17 00:00:00 2001 From: Miles Hu Date: Fri, 24 Sep 2021 16:52:45 +0300 -Subject: [PATCH 010/120] ath11k: add support for setting fixed HE rate/gi/ltf +Subject: [PATCH] ath11k: add support for setting fixed HE rate/gi/ltf Support setting fixed HE rate/gi/ltf values that we are now able to send to the kernel using nl80211. The added code is reusing parts of the @@ -29,7 +29,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -354,6 +354,18 @@ ath11k_mac_max_vht_nss(const u16 vht_mcs +@@ -355,6 +355,18 @@ ath11k_mac_max_vht_nss(const u16 vht_mcs return 1; } @@ -48,7 +48,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org static u8 ath11k_parse_mpdudensity(u8 mpdudensity) { /* 802.11n D2.0 defined values for "Minimum MPDU Start Spacing": -@@ -1447,6 +1459,14 @@ static void ath11k_peer_assoc_h_ht(struc +@@ -1452,6 +1464,14 @@ static void ath11k_peer_assoc_h_ht(struc arg->peer_rate_caps |= WMI_HOST_RC_CW40_FLAG; } @@ -63,7 +63,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) { if (ht_cap->cap & (IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40)) -@@ -1570,10 +1590,11 @@ static void ath11k_peer_assoc_h_vht(stru +@@ -1575,10 +1595,11 @@ static void ath11k_peer_assoc_h_vht(stru struct ath11k_vif *arvif = (void *)vif->drv_priv; struct cfg80211_chan_def def; enum nl80211_band band; @@ -77,7 +77,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org if (WARN_ON(ath11k_mac_vif_chan(vif, &def))) return; -@@ -1616,6 +1637,24 @@ static void ath11k_peer_assoc_h_vht(stru +@@ -1621,6 +1642,24 @@ static void ath11k_peer_assoc_h_vht(stru if (sta->bandwidth == IEEE80211_STA_RX_BW_160) arg->bw_160 = true; @@ -102,7 +102,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org /* Calculate peer NSS capability from VHT capabilities if STA * supports VHT. */ -@@ -1654,18 +1693,100 @@ static void ath11k_peer_assoc_h_vht(stru +@@ -1659,18 +1698,100 @@ static void ath11k_peer_assoc_h_vht(stru /* TODO: rxnss_override */ } @@ -204,7 +204,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org arg->he_flag = true; memcpy_and_pad(&arg->peer_he_cap_macinfo, -@@ -1742,25 +1863,48 @@ static void ath11k_peer_assoc_h_he(struc +@@ -1747,25 +1868,48 @@ static void ath11k_peer_assoc_h_he(struc if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_REQ) arg->twt_requester = true; @@ -253,7 +253,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org fallthrough; default: -@@ -1768,11 +1912,34 @@ static void ath11k_peer_assoc_h_he(struc +@@ -1773,11 +1917,34 @@ static void ath11k_peer_assoc_h_he(struc arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v; v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80); @@ -288,7 +288,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org } static void ath11k_peer_assoc_h_smps(struct ieee80211_sta *sta, -@@ -1975,6 +2142,7 @@ static void ath11k_peer_assoc_h_phymode( +@@ -1980,6 +2147,7 @@ static void ath11k_peer_assoc_h_phymode( enum nl80211_band band; const u8 *ht_mcs_mask; const u16 *vht_mcs_mask; @@ -296,7 +296,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org enum wmi_phy_mode phymode = MODE_UNKNOWN; if (WARN_ON(ath11k_mac_vif_chan(vif, &def))) -@@ -1983,10 +2151,12 @@ static void ath11k_peer_assoc_h_phymode( +@@ -1988,10 +2156,12 @@ static void ath11k_peer_assoc_h_phymode( band = def.chan->band; ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; @@ -310,7 +310,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org if (sta->bandwidth == IEEE80211_STA_RX_BW_80) phymode = MODE_11AX_HE80_2G; else if (sta->bandwidth == IEEE80211_STA_RX_BW_40) -@@ -2014,7 +2184,8 @@ static void ath11k_peer_assoc_h_phymode( +@@ -2019,7 +2189,8 @@ static void ath11k_peer_assoc_h_phymode( case NL80211_BAND_5GHZ: case NL80211_BAND_6GHZ: /* Check HE first */ @@ -320,7 +320,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org phymode = ath11k_mac_get_phymode_he(ar, sta); } else if (sta->vht_cap.vht_supported && !ath11k_peer_assoc_h_vht_masked(vht_mcs_mask)) { -@@ -3241,6 +3412,20 @@ ath11k_mac_bitrate_mask_num_vht_rates(st +@@ -3247,6 +3418,20 @@ ath11k_mac_bitrate_mask_num_vht_rates(st } static int @@ -341,7 +341,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org ath11k_mac_set_peer_vht_fixed_rate(struct ath11k_vif *arvif, struct ieee80211_sta *sta, const struct cfg80211_bitrate_mask *mask, -@@ -3268,6 +3453,10 @@ ath11k_mac_set_peer_vht_fixed_rate(struc +@@ -3274,6 +3459,10 @@ ath11k_mac_set_peer_vht_fixed_rate(struc return -EINVAL; } @@ -352,7 +352,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "Setting Fixed VHT Rate for peer %pM. Device will not switch to any other selected rates", sta->addr); -@@ -3286,6 +3475,57 @@ ath11k_mac_set_peer_vht_fixed_rate(struc +@@ -3292,6 +3481,57 @@ ath11k_mac_set_peer_vht_fixed_rate(struc return ret; } @@ -410,7 +410,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org static int ath11k_station_assoc(struct ath11k *ar, struct ieee80211_vif *vif, struct ieee80211_sta *sta, -@@ -3297,7 +3537,7 @@ static int ath11k_station_assoc(struct a +@@ -3303,7 +3543,7 @@ static int ath11k_station_assoc(struct a struct cfg80211_chan_def def; enum nl80211_band band; struct cfg80211_bitrate_mask *mask; @@ -419,7 +419,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org lockdep_assert_held(&ar->conf_mutex); -@@ -3323,9 +3563,10 @@ static int ath11k_station_assoc(struct a +@@ -3329,9 +3569,10 @@ static int ath11k_station_assoc(struct a } num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask); @@ -432,7 +432,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org * fixed param. * Note that all other rates and NSS will be disabled for this peer. */ -@@ -3334,6 +3575,11 @@ static int ath11k_station_assoc(struct a +@@ -3340,6 +3581,11 @@ static int ath11k_station_assoc(struct a band); if (ret) return ret; @@ -444,7 +444,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org } /* Re-assoc is run only to update supported rates for given station. It -@@ -3404,8 +3650,9 @@ static void ath11k_sta_rc_update_wk(stru +@@ -3410,8 +3656,9 @@ static void ath11k_sta_rc_update_wk(stru enum nl80211_band band; const u8 *ht_mcs_mask; const u16 *vht_mcs_mask; @@ -455,7 +455,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org const struct cfg80211_bitrate_mask *mask; struct peer_assoc_params peer_arg; -@@ -3420,6 +3667,7 @@ static void ath11k_sta_rc_update_wk(stru +@@ -3426,6 +3673,7 @@ static void ath11k_sta_rc_update_wk(stru band = def.chan->band; ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs; vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs; @@ -463,7 +463,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org spin_lock_bh(&ar->data_lock); -@@ -3435,8 +3683,9 @@ static void ath11k_sta_rc_update_wk(stru +@@ -3441,8 +3689,9 @@ static void ath11k_sta_rc_update_wk(stru mutex_lock(&ar->conf_mutex); nss = max_t(u32, 1, nss); @@ -475,7 +475,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org if (changed & IEEE80211_RC_BW_CHANGED) { err = ath11k_wmi_set_peer_param(ar, sta->addr, arvif->vdev_id, -@@ -3472,6 +3721,8 @@ static void ath11k_sta_rc_update_wk(stru +@@ -3478,6 +3727,8 @@ static void ath11k_sta_rc_update_wk(stru mask = &arvif->bitrate_mask; num_vht_rates = ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask); @@ -484,7 +484,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org /* Peer_assoc_prepare will reject vht rates in * bitrate_mask if its not available in range format and -@@ -3487,11 +3738,25 @@ static void ath11k_sta_rc_update_wk(stru +@@ -3493,11 +3744,25 @@ static void ath11k_sta_rc_update_wk(stru if (sta->vht_cap.vht_supported && num_vht_rates == 1) { ath11k_mac_set_peer_vht_fixed_rate(arvif, sta, mask, band); @@ -512,7 +512,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org ath11k_peer_assoc_prepare(ar, arvif->vif, sta, &peer_arg, true); -@@ -5101,10 +5366,13 @@ static int ath11k_mac_op_add_interface(s +@@ -5111,10 +5376,13 @@ static int ath11k_mac_op_add_interface(s for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) { arvif->bitrate_mask.control[i].legacy = 0xffffffff; @@ -526,7 +526,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org } bit = __ffs64(ab->free_vdev_map); -@@ -6180,9 +6448,26 @@ ath11k_mac_has_single_legacy_rate(struct +@@ -6190,9 +6458,26 @@ ath11k_mac_has_single_legacy_rate(struct if (ath11k_mac_bitrate_mask_num_vht_rates(ar, band, mask)) return false; @@ -553,7 +553,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org static bool ath11k_mac_bitrate_mask_get_single_nss(struct ath11k *ar, enum nl80211_band band, -@@ -6191,8 +6476,10 @@ ath11k_mac_bitrate_mask_get_single_nss(s +@@ -6201,8 +6486,10 @@ ath11k_mac_bitrate_mask_get_single_nss(s { struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); @@ -564,7 +564,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org int i; /* No need to consider legacy here. Basic rates are always present -@@ -6219,7 +6506,20 @@ ath11k_mac_bitrate_mask_get_single_nss(s +@@ -6229,7 +6516,20 @@ ath11k_mac_bitrate_mask_get_single_nss(s return false; } @@ -586,7 +586,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org return false; if (ht_nss_mask == 0) -@@ -6266,42 +6566,125 @@ ath11k_mac_get_single_legacy_rate(struct +@@ -6276,42 +6576,125 @@ ath11k_mac_get_single_legacy_rate(struct return 0; } @@ -730,7 +730,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org return ret; } -@@ -6314,6 +6697,35 @@ static int ath11k_mac_set_fixed_rate_par +@@ -6324,6 +6707,35 @@ static int ath11k_mac_set_fixed_rate_par return ret; } @@ -766,7 +766,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org return 0; } -@@ -6342,6 +6754,31 @@ ath11k_mac_vht_mcs_range_present(struct +@@ -6352,6 +6764,31 @@ ath11k_mac_vht_mcs_range_present(struct return true; } @@ -798,7 +798,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org static void ath11k_mac_set_bitrate_mask_iter(void *data, struct ieee80211_sta *sta) { -@@ -6373,6 +6810,54 @@ static void ath11k_mac_disable_peer_fixe +@@ -6383,6 +6820,54 @@ static void ath11k_mac_disable_peer_fixe sta->addr, ret); } @@ -853,7 +853,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org static int ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw, struct ieee80211_vif *vif, -@@ -6384,6 +6869,9 @@ ath11k_mac_op_set_bitrate_mask(struct ie +@@ -6394,6 +6879,9 @@ ath11k_mac_op_set_bitrate_mask(struct ie enum nl80211_band band; const u8 *ht_mcs_mask; const u16 *vht_mcs_mask; @@ -863,7 +863,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org u32 rate; u8 nss; u8 sgi; -@@ -6391,6 +6879,7 @@ ath11k_mac_op_set_bitrate_mask(struct ie +@@ -6401,6 +6889,7 @@ ath11k_mac_op_set_bitrate_mask(struct ie int single_nss; int ret; int num_rates; @@ -871,7 +871,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org if (ath11k_mac_vif_chan(vif, &def)) return -EPERM; -@@ -6398,12 +6887,16 @@ ath11k_mac_op_set_bitrate_mask(struct ie +@@ -6408,12 +6897,16 @@ ath11k_mac_op_set_bitrate_mask(struct ie band = def.chan->band; ht_mcs_mask = mask->control[band].ht_mcs; vht_mcs_mask = mask->control[band].vht_mcs; @@ -888,7 +888,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org /* mac80211 doesn't support sending a fixed HT/VHT MCS alone, rather it * requires passing atleast one of used basic rates along with them. * Fixed rate setting across different preambles(legacy, HT, VHT) is -@@ -6427,11 +6920,22 @@ ath11k_mac_op_set_bitrate_mask(struct ie +@@ -6437,11 +6930,22 @@ ath11k_mac_op_set_bitrate_mask(struct ie &single_nss)) { rate = WMI_FIXED_RATE_NONE; nss = single_nss; @@ -913,7 +913,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org /* If multiple rates across different preambles are given * we can reconfigure this info with all peers using PEER_ASSOC -@@ -6462,16 +6966,28 @@ ath11k_mac_op_set_bitrate_mask(struct ie +@@ -6472,16 +6976,28 @@ ath11k_mac_op_set_bitrate_mask(struct ie * RATEMASK CMD */ ath11k_warn(ar->ab, @@ -945,7 +945,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org arvif->bitrate_mask = *mask; ieee80211_iterate_stations_atomic(ar->hw, ath11k_mac_set_bitrate_mask_iter, -@@ -6482,9 +6998,10 @@ ath11k_mac_op_set_bitrate_mask(struct ie +@@ -6492,9 +7008,10 @@ ath11k_mac_op_set_bitrate_mask(struct ie mutex_lock(&ar->conf_mutex); @@ -960,7 +960,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-1-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1904,8 +1904,8 @@ int ath11k_wmi_send_peer_assoc_cmd(struc +@@ -1905,8 +1905,8 @@ int ath11k_wmi_send_peer_assoc_cmd(struc FIELD_PREP(WMI_TLV_LEN, sizeof(*he_mcs) - TLV_HDR_SIZE); diff --git a/package/kernel/mac80211/patches/ath11k/0011-ath11k-add-support-for-80P80-and-160-MHz-bandwidth.patch b/package/kernel/mac80211/patches/ath11k/0010-ath11k-add-support-for-80P80-and-160-MHz-bandwidth.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0011-ath11k-add-support-for-80P80-and-160-MHz-bandwidth.patch rename to package/kernel/mac80211/patches/ath11k/0010-ath11k-add-support-for-80P80-and-160-MHz-bandwidth.patch index 6eaf32a4c..1b3dddb30 100644 --- a/package/kernel/mac80211/patches/ath11k/0011-ath11k-add-support-for-80P80-and-160-MHz-bandwidth.patch +++ b/package/kernel/mac80211/patches/ath11k/0010-ath11k-add-support-for-80P80-and-160-MHz-bandwidth.patch @@ -1,7 +1,7 @@ From f552d6fd2f27ce9430c74482c46272838e2de688 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 24 Sep 2021 16:52:46 +0300 -Subject: [PATCH 011/120] ath11k: add support for 80P80 and 160 MHz bandwidth +Subject: [PATCH] ath11k: add support for 80P80 and 160 MHz bandwidth For 160 MHz, nss_ratio_enabled flag is added to indicate firmware supports sending NSS ratio information from firmware as a part of @@ -38,7 +38,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -597,6 +597,8 @@ struct ath11k_pdev_cap { +@@ -603,6 +603,8 @@ struct ath11k_pdev_cap { u32 tx_chain_mask_shift; u32 rx_chain_mask_shift; struct ath11k_band_cap band[NUM_NL80211_BANDS]; @@ -49,7 +49,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org struct ath11k_pdev { --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1581,6 +1581,34 @@ ath11k_peer_assoc_h_vht_limit(u16 tx_mcs +@@ -1586,6 +1586,34 @@ ath11k_peer_assoc_h_vht_limit(u16 tx_mcs return tx_mcs_set; } @@ -84,7 +84,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org static void ath11k_peer_assoc_h_vht(struct ath11k *ar, struct ieee80211_vif *vif, struct ieee80211_sta *sta, -@@ -1595,6 +1623,7 @@ static void ath11k_peer_assoc_h_vht(stru +@@ -1600,6 +1628,7 @@ static void ath11k_peer_assoc_h_vht(stru u8 max_nss, vht_mcs; int i, vht_nss, nss_idx; bool user_rate_valid = true; @@ -92,7 +92,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org if (WARN_ON(ath11k_mac_vif_chan(vif, &def))) return; -@@ -1687,10 +1716,29 @@ static void ath11k_peer_assoc_h_vht(stru +@@ -1692,10 +1721,29 @@ static void ath11k_peer_assoc_h_vht(stru /* TODO: Check */ arg->tx_max_mcs_nss = 0xFF; @@ -125,7 +125,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org } static int ath11k_mac_get_max_he_mcs_map(u16 mcs_map, int nss) -@@ -1774,6 +1822,7 @@ static void ath11k_peer_assoc_h_he(struc +@@ -1779,6 +1827,7 @@ static void ath11k_peer_assoc_h_he(struc u16 he_tx_mcs = 0, v = 0; int i, he_nss, nss_idx; bool user_rate_valid = true; @@ -133,7 +133,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org if (WARN_ON(ath11k_mac_vif_chan(vif, &def))) return; -@@ -1937,9 +1986,30 @@ static void ath11k_peer_assoc_h_he(struc +@@ -1942,9 +1991,30 @@ static void ath11k_peer_assoc_h_he(struc } arg->peer_nss = min(sta->rx_nss, max_nss); @@ -166,7 +166,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org } static void ath11k_peer_assoc_h_smps(struct ieee80211_sta *sta, -@@ -2227,11 +2297,11 @@ static void ath11k_peer_assoc_prepare(st +@@ -2232,11 +2302,11 @@ static void ath11k_peer_assoc_prepare(st ath11k_peer_assoc_h_basic(ar, vif, sta, arg); ath11k_peer_assoc_h_crypto(ar, vif, sta, arg); ath11k_peer_assoc_h_rates(ar, vif, sta, arg); @@ -179,7 +179,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org ath11k_peer_assoc_h_smps(sta, arg); /* TODO: amsdu_disable req? */ -@@ -4427,11 +4497,6 @@ ath11k_create_vht_cap(struct ath11k *ar, +@@ -4433,11 +4503,6 @@ ath11k_create_vht_cap(struct ath11k *ar, ath11k_set_vht_txbf_cap(ar, &vht_cap.cap); @@ -191,7 +191,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org rxmcs_map = 0; txmcs_map = 0; for (i = 0; i < 8; i++) { -@@ -7345,7 +7410,9 @@ static int ath11k_mac_setup_iface_combin +@@ -7355,7 +7420,9 @@ static int ath11k_mac_setup_iface_combin combinations[0].radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | BIT(NL80211_CHAN_WIDTH_20) | BIT(NL80211_CHAN_WIDTH_40) | @@ -202,7 +202,7 @@ Link: https://lore.kernel.org/r/20210721173615.75637-2-jouni@codeaurora.org ar->hw->wiphy->iface_combinations = combinations; ar->hw->wiphy->n_iface_combinations = 1; -@@ -7484,6 +7551,10 @@ static int __ath11k_mac_register(struct +@@ -7494,6 +7561,10 @@ static int __ath11k_mac_register(struct ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); ieee80211_hw_set(ar->hw, SUPPORTS_TX_ENCAP_OFFLOAD); diff --git a/package/kernel/mac80211/patches/ath11k/0012-ath11k-Refactor-spectral-FFT-bin-size.patch b/package/kernel/mac80211/patches/ath11k/0011-ath11k-Refactor-spectral-FFT-bin-size.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0012-ath11k-Refactor-spectral-FFT-bin-size.patch rename to package/kernel/mac80211/patches/ath11k/0011-ath11k-Refactor-spectral-FFT-bin-size.patch index 9a74a5796..c7dc058d1 100644 --- a/package/kernel/mac80211/patches/ath11k/0012-ath11k-Refactor-spectral-FFT-bin-size.patch +++ b/package/kernel/mac80211/patches/ath11k/0011-ath11k-Refactor-spectral-FFT-bin-size.patch @@ -1,7 +1,7 @@ From cc2ad7541486f1f755949c1ccd17e14a15bf1f4e Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Fri, 24 Sep 2021 16:52:46 +0300 -Subject: [PATCH 012/120] ath11k: Refactor spectral FFT bin size +Subject: [PATCH] ath11k: Refactor spectral FFT bin size In IPQ8074, actual FFT bin size is two bytes but hardware reports it with extra pad size of two bytes for each FFT bin. So finally each FFT diff --git a/package/kernel/mac80211/patches/ath11k/0013-ath11k-Introduce-spectral-hw-configurable-param.patch b/package/kernel/mac80211/patches/ath11k/0012-ath11k-Introduce-spectral-hw-configurable-param.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0013-ath11k-Introduce-spectral-hw-configurable-param.patch rename to package/kernel/mac80211/patches/ath11k/0012-ath11k-Introduce-spectral-hw-configurable-param.patch index 45660c62f..3f2ea13dd 100644 --- a/package/kernel/mac80211/patches/ath11k/0013-ath11k-Introduce-spectral-hw-configurable-param.patch +++ b/package/kernel/mac80211/patches/ath11k/0012-ath11k-Introduce-spectral-hw-configurable-param.patch @@ -1,7 +1,7 @@ From 1cae9c0009d35cec94ad8e1b06ebcb2d704626bf Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Fri, 24 Sep 2021 16:52:46 +0300 -Subject: [PATCH 013/120] ath11k: Introduce spectral hw configurable param +Subject: [PATCH] ath11k: Introduce spectral hw configurable param Below parameters have been identified as configurable across the platforms. So to scale the spectral across the platforms, move these parameter diff --git a/package/kernel/mac80211/patches/ath11k/0014-ath11k-Fix-the-spectral-minimum-FFT-bin-count.patch b/package/kernel/mac80211/patches/ath11k/0013-ath11k-Fix-the-spectral-minimum-FFT-bin-count.patch similarity index 95% rename from package/kernel/mac80211/patches/ath11k/0014-ath11k-Fix-the-spectral-minimum-FFT-bin-count.patch rename to package/kernel/mac80211/patches/ath11k/0013-ath11k-Fix-the-spectral-minimum-FFT-bin-count.patch index d38b2fd31..50dbdd55c 100644 --- a/package/kernel/mac80211/patches/ath11k/0014-ath11k-Fix-the-spectral-minimum-FFT-bin-count.patch +++ b/package/kernel/mac80211/patches/ath11k/0013-ath11k-Fix-the-spectral-minimum-FFT-bin-count.patch @@ -1,7 +1,7 @@ From 6dfd20c8a6cd1fcf2c68d86c9d678f42535f6ade Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Fri, 24 Sep 2021 16:52:46 +0300 -Subject: [PATCH 014/120] ath11k: Fix the spectral minimum FFT bin count +Subject: [PATCH] ath11k: Fix the spectral minimum FFT bin count User was not able to configure the spectral with the FFT bin count 32. In all supported platforms, the expected minimum FFT bin count is 32 but diff --git a/package/kernel/mac80211/patches/ath11k/0015-ath11k-Add-spectral-scan-support-for-QCN9074.patch b/package/kernel/mac80211/patches/ath11k/0014-ath11k-Add-spectral-scan-support-for-QCN9074.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0015-ath11k-Add-spectral-scan-support-for-QCN9074.patch rename to package/kernel/mac80211/patches/ath11k/0014-ath11k-Add-spectral-scan-support-for-QCN9074.patch index 24de4fc78..f2c2c7c56 100644 --- a/package/kernel/mac80211/patches/ath11k/0015-ath11k-Add-spectral-scan-support-for-QCN9074.patch +++ b/package/kernel/mac80211/patches/ath11k/0014-ath11k-Add-spectral-scan-support-for-QCN9074.patch @@ -1,7 +1,7 @@ From b72e86c07e9881d249fbb7511060692f3fb6b687 Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Fri, 24 Sep 2021 16:52:46 +0300 -Subject: [PATCH 015/120] ath11k: Add spectral scan support for QCN9074 +Subject: [PATCH] ath11k: Add spectral scan support for QCN9074 Populate the below hw parameters as per the QCN9074 support 1. FFT bin size as two bytes diff --git a/package/kernel/mac80211/patches/ath11k/0016-ath11k-Wstringop-overread-warning.patch b/package/kernel/mac80211/patches/ath11k/0015-ath11k-Wstringop-overread-warning.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0016-ath11k-Wstringop-overread-warning.patch rename to package/kernel/mac80211/patches/ath11k/0015-ath11k-Wstringop-overread-warning.patch index e1dbe606d..1188b00fc 100644 --- a/package/kernel/mac80211/patches/ath11k/0016-ath11k-Wstringop-overread-warning.patch +++ b/package/kernel/mac80211/patches/ath11k/0015-ath11k-Wstringop-overread-warning.patch @@ -1,7 +1,7 @@ From eb19efed836a51ee30a602abe2dd21a97c47bbcc Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Fri, 24 Sep 2021 16:52:52 +0300 -Subject: [PATCH 016/120] ath11k: Wstringop-overread warning +Subject: [PATCH] ath11k: Wstringop-overread warning gcc-11 with the kernel address sanitizer prints a warning for this driver: @@ -33,7 +33,7 @@ Link: https://lore.kernel.org/r/20210322160253.4032422-5-arnd@kernel.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1401,7 +1401,7 @@ ath11k_peer_assoc_h_ht_masked(const u8 h +@@ -1406,7 +1406,7 @@ ath11k_peer_assoc_h_ht_masked(const u8 h } static bool diff --git a/package/kernel/mac80211/patches/ath11k/0017-ath11k-use-hw_params-to-access-board_size-and-cal_of.patch b/package/kernel/mac80211/patches/ath11k/0016-ath11k-use-hw_params-to-access-board_size-and-cal_of.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0017-ath11k-use-hw_params-to-access-board_size-and-cal_of.patch rename to package/kernel/mac80211/patches/ath11k/0016-ath11k-use-hw_params-to-access-board_size-and-cal_of.patch index 865450a08..1ff4ae8dd 100644 --- a/package/kernel/mac80211/patches/ath11k/0017-ath11k-use-hw_params-to-access-board_size-and-cal_of.patch +++ b/package/kernel/mac80211/patches/ath11k/0016-ath11k-use-hw_params-to-access-board_size-and-cal_of.patch @@ -1,8 +1,7 @@ From c72aa32d6d1c04fa83d4c0e6849e4e60d9d39ae4 Mon Sep 17 00:00:00 2001 From: Anilkumar Kolli Date: Tue, 28 Sep 2021 12:05:39 +0300 -Subject: [PATCH 017/120] ath11k: use hw_params to access board_size and - cal_offset +Subject: [PATCH] ath11k: use hw_params to access board_size and cal_offset Reuse board_size from hw_params, add cal_offset to hw params. This patch is clean up only, there is no change in functionality. diff --git a/package/kernel/mac80211/patches/ath11k/0018-ath11k-clean-up-BDF-download-functions.patch b/package/kernel/mac80211/patches/ath11k/0017-ath11k-clean-up-BDF-download-functions.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0018-ath11k-clean-up-BDF-download-functions.patch rename to package/kernel/mac80211/patches/ath11k/0017-ath11k-clean-up-BDF-download-functions.patch index 387f4331d..f26c6ce33 100644 --- a/package/kernel/mac80211/patches/ath11k/0018-ath11k-clean-up-BDF-download-functions.patch +++ b/package/kernel/mac80211/patches/ath11k/0017-ath11k-clean-up-BDF-download-functions.patch @@ -1,7 +1,7 @@ From 336e7b53c82fc74d261024773a0fab43623a94fb Mon Sep 17 00:00:00 2001 From: Anilkumar Kolli Date: Tue, 28 Sep 2021 12:05:39 +0300 -Subject: [PATCH 018/120] ath11k: clean up BDF download functions +Subject: [PATCH] ath11k: clean up BDF download functions In current code, AHB/PCI uses two separate functions to download BDF file. Refactor code and make a common function to send QMI BDF diff --git a/package/kernel/mac80211/patches/ath11k/0019-ath11k-add-caldata-file-for-multiple-radios.patch b/package/kernel/mac80211/patches/ath11k/0018-ath11k-add-caldata-file-for-multiple-radios.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0019-ath11k-add-caldata-file-for-multiple-radios.patch rename to package/kernel/mac80211/patches/ath11k/0018-ath11k-add-caldata-file-for-multiple-radios.patch index a545ed4d9..9975cca01 100644 --- a/package/kernel/mac80211/patches/ath11k/0019-ath11k-add-caldata-file-for-multiple-radios.patch +++ b/package/kernel/mac80211/patches/ath11k/0018-ath11k-add-caldata-file-for-multiple-radios.patch @@ -1,7 +1,7 @@ From e82dfe7b5608592c270cc69100cb4322069f949d Mon Sep 17 00:00:00 2001 From: Anilkumar Kolli Date: Tue, 28 Sep 2021 12:05:39 +0300 -Subject: [PATCH 019/120] ath11k: add caldata file for multiple radios +Subject: [PATCH] ath11k: add caldata file for multiple radios If multiple PCI cards are attached, each needs its own caldata file. diff --git a/package/kernel/mac80211/patches/ath11k/0020-ath11k-add-caldata-download-support-from-EEPROM.patch b/package/kernel/mac80211/patches/ath11k/0019-ath11k-add-caldata-download-support-from-EEPROM.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0020-ath11k-add-caldata-download-support-from-EEPROM.patch rename to package/kernel/mac80211/patches/ath11k/0019-ath11k-add-caldata-download-support-from-EEPROM.patch index a925a87e7..22993dac3 100644 --- a/package/kernel/mac80211/patches/ath11k/0020-ath11k-add-caldata-download-support-from-EEPROM.patch +++ b/package/kernel/mac80211/patches/ath11k/0019-ath11k-add-caldata-download-support-from-EEPROM.patch @@ -1,7 +1,7 @@ From 4ba3b05ebd0c3e98c7dd8c7ee03aed9d80299b79 Mon Sep 17 00:00:00 2001 From: Anilkumar Kolli Date: Tue, 28 Sep 2021 12:05:39 +0300 -Subject: [PATCH 020/120] ath11k: add caldata download support from EEPROM +Subject: [PATCH] ath11k: add caldata download support from EEPROM Firmware updates EEPROM support capability in QMI FW caps, send QMI BDF download request message with file type EEPROM, to get caldata download diff --git a/package/kernel/mac80211/patches/ath11k/0021-ath11k-Replace-one-element-array-with-flexible-array.patch b/package/kernel/mac80211/patches/ath11k/0020-ath11k-Replace-one-element-array-with-flexible-array.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0021-ath11k-Replace-one-element-array-with-flexible-array.patch rename to package/kernel/mac80211/patches/ath11k/0020-ath11k-Replace-one-element-array-with-flexible-array.patch index 0c73d1831..ec23c198e 100644 --- a/package/kernel/mac80211/patches/ath11k/0021-ath11k-Replace-one-element-array-with-flexible-array.patch +++ b/package/kernel/mac80211/patches/ath11k/0020-ath11k-Replace-one-element-array-with-flexible-array.patch @@ -1,8 +1,7 @@ From b2549465cdeac3847487ce88b15ca47c37b60b88 Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Tue, 28 Sep 2021 12:05:44 +0300 -Subject: [PATCH 021/120] ath11k: Replace one-element array with flexible-array - member +Subject: [PATCH] ath11k: Replace one-element array with flexible-array member There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code @@ -123,7 +122,7 @@ Link: https://lore.kernel.org/r/20210823172159.GA25800@embeddedor --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -2302,7 +2302,7 @@ int ath11k_wmi_send_scan_chan_list_cmd(s +@@ -2303,7 +2303,7 @@ int ath11k_wmi_send_scan_chan_list_cmd(s u16 num_send_chans, num_sends = 0, max_chan_limit = 0; u32 *reg1, *reg2; diff --git a/package/kernel/mac80211/patches/ath11k/0022-ath11k-qmi-avoid-error-messages-when-dma-allocation-.patch b/package/kernel/mac80211/patches/ath11k/0022-ath11k-qmi-avoid-error-messages-when-dma-allocation-.patch deleted file mode 100644 index c9a7ff61f..000000000 --- a/package/kernel/mac80211/patches/ath11k/0022-ath11k-qmi-avoid-error-messages-when-dma-allocation-.patch +++ /dev/null @@ -1,28 +0,0 @@ -From b9b5948cdd7bc8d9fa31c78cbbb04382c815587f Mon Sep 17 00:00:00 2001 -From: Aaron Ma -Date: Tue, 28 Sep 2021 12:05:43 +0300 -Subject: [PATCH 022/120] ath11k: qmi: avoid error messages when dma allocation - fails - -qmi tries to allocate a large contiguous dma memory at first, -on the AMD Ryzen platform it fails, then retries with small slices. -So set flag GFP_NOWARN to avoid flooding dmesg. - -Signed-off-by: Aaron Ma -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20210823063258.37747-1-aaron.ma@canonical.com ---- - drivers/net/wireless/ath/ath11k/qmi.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -1842,7 +1842,7 @@ static int ath11k_qmi_alloc_target_mem_c - chunk->vaddr = dma_alloc_coherent(ab->dev, - chunk->size, - &chunk->paddr, -- GFP_KERNEL); -+ GFP_KERNEL | __GFP_NOWARN); - if (!chunk->vaddr) { - if (ab->qmi.mem_seg_count <= ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT) { - ath11k_dbg(ab, ATH11K_DBG_QMI, diff --git a/package/kernel/mac80211/patches/ath11k/0024-ath11k-Add-support-for-RX-decapsulation-offload.patch b/package/kernel/mac80211/patches/ath11k/0023-ath11k-Add-support-for-RX-decapsulation-offload.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0024-ath11k-Add-support-for-RX-decapsulation-offload.patch rename to package/kernel/mac80211/patches/ath11k/0023-ath11k-Add-support-for-RX-decapsulation-offload.patch index e17fe4d38..06ffef929 100644 --- a/package/kernel/mac80211/patches/ath11k/0024-ath11k-Add-support-for-RX-decapsulation-offload.patch +++ b/package/kernel/mac80211/patches/ath11k/0023-ath11k-Add-support-for-RX-decapsulation-offload.patch @@ -1,7 +1,7 @@ From 2167fa606c0f0e64b95a04f9bc42d9fd5360838a Mon Sep 17 00:00:00 2001 From: Sriram R Date: Tue, 28 Sep 2021 12:05:40 +0300 -Subject: [PATCH 024/120] ath11k: Add support for RX decapsulation offload +Subject: [PATCH] ath11k: Add support for RX decapsulation offload Add support for rx decapsulation offload by advertising the support to mac80211 during registration. Also ensure @@ -42,7 +42,7 @@ Link: https://lore.kernel.org/r/20210721204217.120572-1-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -93,6 +93,8 @@ struct ath11k_skb_rxcb { +@@ -98,6 +98,8 @@ struct ath11k_skb_rxcb { bool is_first_msdu; bool is_last_msdu; bool is_continuation; @@ -51,7 +51,7 @@ Link: https://lore.kernel.org/r/20210721204217.120572-1-jouni@codeaurora.org struct hal_rx_desc *rx_desc; u8 err_rel_src; u8 err_code; -@@ -100,6 +102,8 @@ struct ath11k_skb_rxcb { +@@ -105,6 +107,8 @@ struct ath11k_skb_rxcb { u8 unmapped; u8 is_frag; u8 tid; @@ -548,7 +548,7 @@ Link: https://lore.kernel.org/r/20210721204217.120572-1-jouni@codeaurora.org extern const struct ath11k_hw_ops ipq8074_ops; --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5370,7 +5370,8 @@ static void ath11k_mac_op_update_vif_off +@@ -5380,7 +5380,8 @@ static void ath11k_mac_op_update_vif_off if (ath11k_frame_mode != ATH11K_HW_TXRX_ETHERNET || (vif->type != NL80211_IFTYPE_STATION && vif->type != NL80211_IFTYPE_AP)) @@ -558,7 +558,7 @@ Link: https://lore.kernel.org/r/20210721204217.120572-1-jouni@codeaurora.org if (vif->offload_flags & IEEE80211_OFFLOAD_ENCAP_ENABLED) param_value = ATH11K_HW_TXRX_ETHERNET; -@@ -5386,6 +5387,22 @@ static void ath11k_mac_op_update_vif_off +@@ -5396,6 +5397,22 @@ static void ath11k_mac_op_update_vif_off arvif->vdev_id, ret); vif->offload_flags &= ~IEEE80211_OFFLOAD_ENCAP_ENABLED; } @@ -581,7 +581,7 @@ Link: https://lore.kernel.org/r/20210721204217.120572-1-jouni@codeaurora.org } static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw, -@@ -7550,7 +7567,11 @@ static int __ath11k_mac_register(struct +@@ -7560,7 +7577,11 @@ static int __ath11k_mac_register(struct ieee80211_hw_set(ar->hw, QUEUE_CONTROL); ieee80211_hw_set(ar->hw, SUPPORTS_TX_FRAG); ieee80211_hw_set(ar->hw, REPORTS_LOW_ACK); diff --git a/package/kernel/mac80211/patches/ath11k/0025-ath11k-Fix-pktlog-lite-rx-events.patch b/package/kernel/mac80211/patches/ath11k/0024-ath11k-Fix-pktlog-lite-rx-events.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0025-ath11k-Fix-pktlog-lite-rx-events.patch rename to package/kernel/mac80211/patches/ath11k/0024-ath11k-Fix-pktlog-lite-rx-events.patch index bf419f03a..01c1e8a26 100644 --- a/package/kernel/mac80211/patches/ath11k/0025-ath11k-Fix-pktlog-lite-rx-events.patch +++ b/package/kernel/mac80211/patches/ath11k/0024-ath11k-Fix-pktlog-lite-rx-events.patch @@ -1,7 +1,7 @@ From ab18e3bc1c138f2b4358c6905a45afb7289d5086 Mon Sep 17 00:00:00 2001 From: Anilkumar Kolli Date: Tue, 28 Sep 2021 12:05:40 +0300 -Subject: [PATCH 025/120] ath11k: Fix pktlog lite rx events +Subject: [PATCH] ath11k: Fix pktlog lite rx events Fix sending rx_buf_sz to ath11k_dp_tx_htt_rx_filter_setup() to enable pktlog full or lite mode. Depending on mode update the diff --git a/package/kernel/mac80211/patches/ath11k/0026-ath11k-Update-pdev-tx-and-rx-firmware-stats.patch b/package/kernel/mac80211/patches/ath11k/0025-ath11k-Update-pdev-tx-and-rx-firmware-stats.patch similarity index 92% rename from package/kernel/mac80211/patches/ath11k/0026-ath11k-Update-pdev-tx-and-rx-firmware-stats.patch rename to package/kernel/mac80211/patches/ath11k/0025-ath11k-Update-pdev-tx-and-rx-firmware-stats.patch index 0c1d8833e..cd654eca4 100644 --- a/package/kernel/mac80211/patches/ath11k/0026-ath11k-Update-pdev-tx-and-rx-firmware-stats.patch +++ b/package/kernel/mac80211/patches/ath11k/0025-ath11k-Update-pdev-tx-and-rx-firmware-stats.patch @@ -1,7 +1,7 @@ From f394e4eae8e2c0579063e5473f1e321d22d3fe43 Mon Sep 17 00:00:00 2001 From: Sriram R Date: Tue, 28 Sep 2021 12:05:40 +0300 -Subject: [PATCH 026/120] ath11k: Update pdev tx and rx firmware stats +Subject: [PATCH] ath11k: Update pdev tx and rx firmware stats Update the fields of pdev tx and tx firmware stats structure. Missing fields resulted in wrong fw stats to be displayed as below. @@ -28,7 +28,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-2-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -806,12 +806,15 @@ struct ath11k_fw_stats_pdev { +@@ -819,12 +819,15 @@ struct ath11k_fw_stats_pdev { s32 hw_reaped; /* Num underruns */ s32 underrun; @@ -44,7 +44,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-2-jouni@codeaurora.org /* data hw rate code */ u32 data_rc; /* Scheduler self triggers */ -@@ -832,6 +835,30 @@ struct ath11k_fw_stats_pdev { +@@ -845,6 +848,30 @@ struct ath11k_fw_stats_pdev { u32 phy_underrun; /* MPDU is more than txop limit */ u32 txop_ovf; @@ -75,7 +75,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-2-jouni@codeaurora.org /* PDEV RX stats */ /* Cnts any change in ring routing mid-ppdu */ -@@ -857,6 +884,8 @@ struct ath11k_fw_stats_pdev { +@@ -870,6 +897,8 @@ struct ath11k_fw_stats_pdev { s32 phy_err_drop; /* Number of mpdu errors - FCS, MIC, ENC etc. */ s32 mpdu_errs; @@ -86,7 +86,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-2-jouni@codeaurora.org struct ath11k_fw_stats_vdev { --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -5251,9 +5251,11 @@ ath11k_wmi_pull_pdev_stats_tx(const stru +@@ -5252,9 +5252,11 @@ ath11k_wmi_pull_pdev_stats_tx(const stru dst->hw_queued = src->hw_queued; dst->hw_reaped = src->hw_reaped; dst->underrun = src->underrun; @@ -98,7 +98,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-2-jouni@codeaurora.org dst->data_rc = src->data_rc; dst->self_triggers = src->self_triggers; dst->sw_retry_failure = src->sw_retry_failure; -@@ -5264,6 +5266,16 @@ ath11k_wmi_pull_pdev_stats_tx(const stru +@@ -5265,6 +5267,16 @@ ath11k_wmi_pull_pdev_stats_tx(const stru dst->stateless_tid_alloc_failure = src->stateless_tid_alloc_failure; dst->phy_underrun = src->phy_underrun; dst->txop_ovf = src->txop_ovf; @@ -115,7 +115,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-2-jouni@codeaurora.org } static void ath11k_wmi_pull_pdev_stats_rx(const struct wmi_pdev_stats_rx *src, -@@ -5283,6 +5295,7 @@ static void ath11k_wmi_pull_pdev_stats_r +@@ -5284,6 +5296,7 @@ static void ath11k_wmi_pull_pdev_stats_r dst->phy_errs = src->phy_errs; dst->phy_err_drop = src->phy_err_drop; dst->mpdu_errs = src->mpdu_errs; @@ -123,7 +123,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-2-jouni@codeaurora.org } static void -@@ -5520,11 +5533,15 @@ ath11k_wmi_fw_pdev_tx_stats_fill(const s +@@ -5521,11 +5534,15 @@ ath11k_wmi_fw_pdev_tx_stats_fill(const s len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", "Num underruns", pdev->underrun); len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", @@ -140,7 +140,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-2-jouni@codeaurora.org len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", "HW rate", pdev->data_rc); len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", -@@ -5548,6 +5565,26 @@ ath11k_wmi_fw_pdev_tx_stats_fill(const s +@@ -5549,6 +5566,26 @@ ath11k_wmi_fw_pdev_tx_stats_fill(const s "PHY underrun", pdev->phy_underrun); len += scnprintf(buf + len, buf_len - len, "%30s %10u\n", "MPDU is more than txop limit", pdev->txop_ovf); @@ -167,7 +167,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-2-jouni@codeaurora.org *length = len; } -@@ -5592,6 +5629,8 @@ ath11k_wmi_fw_pdev_rx_stats_fill(const s +@@ -5593,6 +5630,8 @@ ath11k_wmi_fw_pdev_rx_stats_fill(const s "PHY errors drops", pdev->phy_err_drop); len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", "MPDU errors (FCS, MIC, ENC)", pdev->mpdu_errs); diff --git a/package/kernel/mac80211/patches/ath11k/0029-ath11k-Add-vdev-start-flag-to-disable-hardware-encry.patch b/package/kernel/mac80211/patches/ath11k/0028-ath11k-Add-vdev-start-flag-to-disable-hardware-encry.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0029-ath11k-Add-vdev-start-flag-to-disable-hardware-encry.patch rename to package/kernel/mac80211/patches/ath11k/0028-ath11k-Add-vdev-start-flag-to-disable-hardware-encry.patch index de68ef97c..740f5de62 100644 --- a/package/kernel/mac80211/patches/ath11k/0029-ath11k-Add-vdev-start-flag-to-disable-hardware-encry.patch +++ b/package/kernel/mac80211/patches/ath11k/0028-ath11k-Add-vdev-start-flag-to-disable-hardware-encry.patch @@ -1,8 +1,7 @@ From 8717db7ee802b71fa3f2a79b265b1325bc61210c Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Tue, 28 Sep 2021 12:05:40 +0300 -Subject: [PATCH 029/120] ath11k: Add vdev start flag to disable hardware - encryption +Subject: [PATCH] ath11k: Add vdev start flag to disable hardware encryption Firmware blocks all data traffic until the key is plumbed. But, with software encryption mode, key is never plumbed to firmware. Due to this, diff --git a/package/kernel/mac80211/patches/ath11k/0030-ath11k-Assign-free_vdev_map-value-before-ieee80211_r.patch b/package/kernel/mac80211/patches/ath11k/0029-ath11k-Assign-free_vdev_map-value-before-ieee80211_r.patch similarity index 91% rename from package/kernel/mac80211/patches/ath11k/0030-ath11k-Assign-free_vdev_map-value-before-ieee80211_r.patch rename to package/kernel/mac80211/patches/ath11k/0029-ath11k-Assign-free_vdev_map-value-before-ieee80211_r.patch index d4e1fefca..a2e2cbb8f 100644 --- a/package/kernel/mac80211/patches/ath11k/0030-ath11k-Assign-free_vdev_map-value-before-ieee80211_r.patch +++ b/package/kernel/mac80211/patches/ath11k/0029-ath11k-Assign-free_vdev_map-value-before-ieee80211_r.patch @@ -1,7 +1,7 @@ From 3c79cb4d63c0d58462d439efa0db328008354deb Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Tue, 28 Sep 2021 12:05:40 +0300 -Subject: [PATCH 030/120] ath11k: Assign free_vdev_map value before +Subject: [PATCH] ath11k: Assign free_vdev_map value before ieee80211_register_hw Firmware crash is seen randomly, because of sending wrong vdev_id @@ -27,7 +27,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-6-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -7701,6 +7701,10 @@ int ath11k_mac_register(struct ath11k_ba +@@ -7711,6 +7711,10 @@ int ath11k_mac_register(struct ath11k_ba if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) return 0; @@ -38,7 +38,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-6-jouni@codeaurora.org for (i = 0; i < ab->num_radios; i++) { pdev = &ab->pdevs[i]; ar = pdev->ar; -@@ -7711,18 +7715,14 @@ int ath11k_mac_register(struct ath11k_ba +@@ -7721,18 +7725,14 @@ int ath11k_mac_register(struct ath11k_ba ar->mac_addr[4] += i; } diff --git a/package/kernel/mac80211/patches/ath11k/0031-ath11k-Fix-crash-during-firmware-recovery-on-reo-cmd.patch b/package/kernel/mac80211/patches/ath11k/0030-ath11k-Fix-crash-during-firmware-recovery-on-reo-cmd.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0031-ath11k-Fix-crash-during-firmware-recovery-on-reo-cmd.patch rename to package/kernel/mac80211/patches/ath11k/0030-ath11k-Fix-crash-during-firmware-recovery-on-reo-cmd.patch index 482534626..38f3064fc 100644 --- a/package/kernel/mac80211/patches/ath11k/0031-ath11k-Fix-crash-during-firmware-recovery-on-reo-cmd.patch +++ b/package/kernel/mac80211/patches/ath11k/0030-ath11k-Fix-crash-during-firmware-recovery-on-reo-cmd.patch @@ -1,8 +1,8 @@ From 8ee8d38ca4727667e05a1dedf546162207bde9fa Mon Sep 17 00:00:00 2001 From: Sriram R Date: Tue, 28 Sep 2021 12:05:40 +0300 -Subject: [PATCH 031/120] ath11k: Fix crash during firmware recovery on reo cmd - ring access +Subject: [PATCH] ath11k: Fix crash during firmware recovery on reo cmd ring + access In scenario when a peer is disassociating, there could be multiple places where a reo cmd ring is accessed, such as diff --git a/package/kernel/mac80211/patches/ath11k/0032-ath11k-Avoid-No-VIF-found-warning-message.patch b/package/kernel/mac80211/patches/ath11k/0031-ath11k-Avoid-No-VIF-found-warning-message.patch similarity index 92% rename from package/kernel/mac80211/patches/ath11k/0032-ath11k-Avoid-No-VIF-found-warning-message.patch rename to package/kernel/mac80211/patches/ath11k/0031-ath11k-Avoid-No-VIF-found-warning-message.patch index 8fa03018e..0798c0d43 100644 --- a/package/kernel/mac80211/patches/ath11k/0032-ath11k-Avoid-No-VIF-found-warning-message.patch +++ b/package/kernel/mac80211/patches/ath11k/0031-ath11k-Avoid-No-VIF-found-warning-message.patch @@ -1,7 +1,7 @@ From 79feedfea7793d91293ab72fac5fc66aae0c6a85 Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Tue, 28 Sep 2021 12:05:41 +0300 -Subject: [PATCH 032/120] ath11k: Avoid "No VIF found" warning message +Subject: [PATCH] ath11k: Avoid "No VIF found" warning message Facing below warning prints when we do wifi down in multiple VAPs scenario. @@ -32,7 +32,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-8-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -500,7 +500,8 @@ struct ath11k_vif *ath11k_mac_get_arvif_ +@@ -501,7 +501,8 @@ struct ath11k_vif *ath11k_mac_get_arvif_ for (i = 0; i < ab->num_radios; i++) { pdev = rcu_dereference(ab->pdevs_active[i]); diff --git a/package/kernel/mac80211/patches/ath11k/0033-ath11k-Add-wmi-peer-create-conf-event-in-wmi_tlv_eve.patch b/package/kernel/mac80211/patches/ath11k/0032-ath11k-Add-wmi-peer-create-conf-event-in-wmi_tlv_eve.patch similarity index 92% rename from package/kernel/mac80211/patches/ath11k/0033-ath11k-Add-wmi-peer-create-conf-event-in-wmi_tlv_eve.patch rename to package/kernel/mac80211/patches/ath11k/0032-ath11k-Add-wmi-peer-create-conf-event-in-wmi_tlv_eve.patch index ad9c3d67d..89b68fd22 100644 --- a/package/kernel/mac80211/patches/ath11k/0033-ath11k-Add-wmi-peer-create-conf-event-in-wmi_tlv_eve.patch +++ b/package/kernel/mac80211/patches/ath11k/0032-ath11k-Add-wmi-peer-create-conf-event-in-wmi_tlv_eve.patch @@ -1,8 +1,7 @@ From 94a6df31dcf042f74db8209680d04546ce964ad5 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Tue, 28 Sep 2021 12:05:41 +0300 -Subject: [PATCH 033/120] ath11k: Add wmi peer create conf event in - wmi_tlv_event_id +Subject: [PATCH] ath11k: Add wmi peer create conf event in wmi_tlv_event_id When the driver sends a peer create cmd, the firmware responds with WMI_PEER_CREATE_CONF_EVENTID to confirm the firmware received @@ -29,7 +28,7 @@ Link: https://lore.kernel.org/r/20210721212029.142388-9-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -7136,6 +7136,7 @@ static void ath11k_wmi_tlv_op_rx(struct +@@ -7137,6 +7137,7 @@ static void ath11k_wmi_tlv_op_rx(struct case WMI_TWT_ENABLE_EVENTID: case WMI_TWT_DISABLE_EVENTID: case WMI_PDEV_DMA_RING_CFG_RSP_EVENTID: diff --git a/package/kernel/mac80211/patches/ath11k/0034-ath11k-add-channel-2-into-6-GHz-channel-list.patch b/package/kernel/mac80211/patches/ath11k/0033-ath11k-add-channel-2-into-6-GHz-channel-list.patch similarity index 88% rename from package/kernel/mac80211/patches/ath11k/0034-ath11k-add-channel-2-into-6-GHz-channel-list.patch rename to package/kernel/mac80211/patches/ath11k/0033-ath11k-add-channel-2-into-6-GHz-channel-list.patch index 353296a9a..4e3d5d4fe 100644 --- a/package/kernel/mac80211/patches/ath11k/0034-ath11k-add-channel-2-into-6-GHz-channel-list.patch +++ b/package/kernel/mac80211/patches/ath11k/0033-ath11k-add-channel-2-into-6-GHz-channel-list.patch @@ -1,7 +1,7 @@ From 4a9550f536cc9c62210f77d875f000e560fc64b1 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Chitrapu Date: Tue, 28 Sep 2021 14:00:43 +0300 -Subject: [PATCH 034/120] ath11k: add channel 2 into 6 GHz channel list +Subject: [PATCH] ath11k: add channel 2 into 6 GHz channel list Add support for the 6 GHz channel 2 with center frequency 5935 MHz and operating class 136 per IEEE Std 802.11ax-2021, Table E-4. @@ -17,7 +17,7 @@ Link: https://lore.kernel.org/r/20210722102054.43419-1-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -387,9 +387,9 @@ struct ath11k_sta { +@@ -393,9 +393,9 @@ struct ath11k_sta { }; #define ATH11K_MIN_5G_FREQ 4150 @@ -31,7 +31,7 @@ Link: https://lore.kernel.org/r/20210722102054.43419-1-jouni@codeaurora.org enum ath11k_state { --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -150,6 +150,9 @@ static const struct ieee80211_channel at +@@ -151,6 +151,9 @@ static const struct ieee80211_channel at CHAN6G(225, 7075, 0), CHAN6G(229, 7095, 0), CHAN6G(233, 7115, 0), diff --git a/package/kernel/mac80211/patches/ath11k/0036-ath11k-fix-survey-dump-collection-in-6-GHz.patch b/package/kernel/mac80211/patches/ath11k/0035-ath11k-fix-survey-dump-collection-in-6-GHz.patch similarity index 89% rename from package/kernel/mac80211/patches/ath11k/0036-ath11k-fix-survey-dump-collection-in-6-GHz.patch rename to package/kernel/mac80211/patches/ath11k/0035-ath11k-fix-survey-dump-collection-in-6-GHz.patch index 4198732aa..8d612b3af 100644 --- a/package/kernel/mac80211/patches/ath11k/0036-ath11k-fix-survey-dump-collection-in-6-GHz.patch +++ b/package/kernel/mac80211/patches/ath11k/0035-ath11k-fix-survey-dump-collection-in-6-GHz.patch @@ -1,7 +1,7 @@ From b6b142f644d2d88e2ceabe0aa4479e0a09ba1ea9 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Chitrapu Date: Tue, 28 Sep 2021 14:00:43 +0300 -Subject: [PATCH 036/120] ath11k: fix survey dump collection in 6 GHz +Subject: [PATCH] ath11k: fix survey dump collection in 6 GHz When ath11k receives survey request, choose the 6 GHz band when enabled. Without this, survey request does not include any 6 GHz band results, @@ -19,7 +19,7 @@ Link: https://lore.kernel.org/r/20210722102054.43419-3-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -7172,7 +7172,13 @@ static int ath11k_mac_op_get_survey(stru +@@ -7182,7 +7182,13 @@ static int ath11k_mac_op_get_survey(stru if (!sband) sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; diff --git a/package/kernel/mac80211/patches/ath11k/0037-ath11k-re-enable-ht_cap-vht_cap-for-5G-band-for-WCN6.patch b/package/kernel/mac80211/patches/ath11k/0036-ath11k-re-enable-ht_cap-vht_cap-for-5G-band-for-WCN6.patch similarity index 90% rename from package/kernel/mac80211/patches/ath11k/0037-ath11k-re-enable-ht_cap-vht_cap-for-5G-band-for-WCN6.patch rename to package/kernel/mac80211/patches/ath11k/0036-ath11k-re-enable-ht_cap-vht_cap-for-5G-band-for-WCN6.patch index a21d07a93..a0c1288a8 100644 --- a/package/kernel/mac80211/patches/ath11k/0037-ath11k-re-enable-ht_cap-vht_cap-for-5G-band-for-WCN6.patch +++ b/package/kernel/mac80211/patches/ath11k/0036-ath11k-re-enable-ht_cap-vht_cap-for-5G-band-for-WCN6.patch @@ -1,8 +1,7 @@ From 54f40f552afd5a07e635a52221ec4b0ce765c374 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Tue, 28 Sep 2021 14:00:43 +0300 -Subject: [PATCH 037/120] ath11k: re-enable ht_cap/vht_cap for 5G band for - WCN6855 +Subject: [PATCH] ath11k: re-enable ht_cap/vht_cap for 5G band for WCN6855 WCN6855 uses single_pdev_only, so it supports both the 5G and 6G bands in the same ath11k/pdev and it needs to enable ht_cap/vht_cap for the 5G @@ -22,7 +21,7 @@ Link: https://lore.kernel.org/r/20210804181217.88751-2-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -4545,7 +4545,9 @@ static void ath11k_mac_setup_ht_vht_cap( +@@ -4551,7 +4551,9 @@ static void ath11k_mac_setup_ht_vht_cap( rate_cap_rx_chainmask); } diff --git a/package/kernel/mac80211/patches/ath11k/0038-ath11k-enable-6G-channels-for-WCN6855.patch b/package/kernel/mac80211/patches/ath11k/0037-ath11k-enable-6G-channels-for-WCN6855.patch similarity index 89% rename from package/kernel/mac80211/patches/ath11k/0038-ath11k-enable-6G-channels-for-WCN6855.patch rename to package/kernel/mac80211/patches/ath11k/0037-ath11k-enable-6G-channels-for-WCN6855.patch index 0e6f52553..550f9d3c3 100644 --- a/package/kernel/mac80211/patches/ath11k/0038-ath11k-enable-6G-channels-for-WCN6855.patch +++ b/package/kernel/mac80211/patches/ath11k/0037-ath11k-enable-6G-channels-for-WCN6855.patch @@ -1,7 +1,7 @@ From 74bba5e5ba45d511a944082d76b64cc1849e4c2e Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Tue, 28 Sep 2021 14:00:43 +0300 -Subject: [PATCH 038/120] ath11k: enable 6G channels for WCN6855 +Subject: [PATCH] ath11k: enable 6G channels for WCN6855 For some chips such as WCN6855, single_pdev_only is set in struct ath11k_hw_params which means ath11k calls ieee80211_register_hw() only @@ -30,7 +30,7 @@ Link: https://lore.kernel.org/r/20210804181217.88751-3-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -7312,7 +7312,7 @@ static int ath11k_mac_setup_channels_rat +@@ -7322,7 +7322,7 @@ static int ath11k_mac_setup_channels_rat u32 supported_bands) { struct ieee80211_supported_band *band; @@ -39,7 +39,7 @@ Link: https://lore.kernel.org/r/20210804181217.88751-3-jouni@codeaurora.org void *channels; u32 phy_id; -@@ -7322,6 +7322,7 @@ static int ath11k_mac_setup_channels_rat +@@ -7332,6 +7332,7 @@ static int ath11k_mac_setup_channels_rat ATH11K_NUM_CHANS); reg_cap = &ar->ab->hal_reg_cap[ar->pdev_idx]; @@ -47,7 +47,7 @@ Link: https://lore.kernel.org/r/20210804181217.88751-3-jouni@codeaurora.org if (supported_bands & WMI_HOST_WLAN_2G_CAP) { channels = kmemdup(ath11k_2ghz_channels, -@@ -7340,11 +7341,11 @@ static int ath11k_mac_setup_channels_rat +@@ -7350,11 +7351,11 @@ static int ath11k_mac_setup_channels_rat if (ar->ab->hw_params.single_pdev_only) { phy_id = ath11k_get_phy_id(ar, WMI_HOST_WLAN_2G_CAP); @@ -62,7 +62,7 @@ Link: https://lore.kernel.org/r/20210804181217.88751-3-jouni@codeaurora.org } if (supported_bands & WMI_HOST_WLAN_5G_CAP) { -@@ -7364,9 +7365,15 @@ static int ath11k_mac_setup_channels_rat +@@ -7374,9 +7375,15 @@ static int ath11k_mac_setup_channels_rat band->n_bitrates = ath11k_a_rates_size; band->bitrates = ath11k_a_rates; ar->hw->wiphy->bands[NL80211_BAND_6GHZ] = band; @@ -80,7 +80,7 @@ Link: https://lore.kernel.org/r/20210804181217.88751-3-jouni@codeaurora.org } if (reg_cap->low_5ghz_chan < ATH11K_MIN_6G_FREQ) { -@@ -7389,12 +7396,12 @@ static int ath11k_mac_setup_channels_rat +@@ -7399,12 +7406,12 @@ static int ath11k_mac_setup_channels_rat if (ar->ab->hw_params.single_pdev_only) { phy_id = ath11k_get_phy_id(ar, WMI_HOST_WLAN_5G_CAP); diff --git a/package/kernel/mac80211/patches/ath11k/0039-ath11k-copy-cap-info-of-6G-band-under-WMI_HOST_WLAN_.patch b/package/kernel/mac80211/patches/ath11k/0038-ath11k-copy-cap-info-of-6G-band-under-WMI_HOST_WLAN_.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0039-ath11k-copy-cap-info-of-6G-band-under-WMI_HOST_WLAN_.patch rename to package/kernel/mac80211/patches/ath11k/0038-ath11k-copy-cap-info-of-6G-band-under-WMI_HOST_WLAN_.patch index 135a5e8f0..71bc68062 100644 --- a/package/kernel/mac80211/patches/ath11k/0039-ath11k-copy-cap-info-of-6G-band-under-WMI_HOST_WLAN_.patch +++ b/package/kernel/mac80211/patches/ath11k/0038-ath11k-copy-cap-info-of-6G-band-under-WMI_HOST_WLAN_.patch @@ -1,8 +1,8 @@ From 0f17ae43823b237c73ff138bc067229f7c57e3a2 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Tue, 28 Sep 2021 14:00:43 +0300 -Subject: [PATCH 039/120] ath11k: copy cap info of 6G band under - WMI_HOST_WLAN_5G_CAP for WCN6855 +Subject: [PATCH] ath11k: copy cap info of 6G band under WMI_HOST_WLAN_5G_CAP + for WCN6855 WCN6855 has 2 phys, one is 2G, another is 5G/6G, so it should copy the cap info of 6G band under the check of WMI_HOST_WLAN_5G_CAP as well as diff --git a/package/kernel/mac80211/patches/ath11k/0040-ath11k-Drop-MSDU-with-length-error-in-DP-rx-path.patch b/package/kernel/mac80211/patches/ath11k/0039-ath11k-Drop-MSDU-with-length-error-in-DP-rx-path.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0040-ath11k-Drop-MSDU-with-length-error-in-DP-rx-path.patch rename to package/kernel/mac80211/patches/ath11k/0039-ath11k-Drop-MSDU-with-length-error-in-DP-rx-path.patch index 85901c3ce..ac19edd81 100644 --- a/package/kernel/mac80211/patches/ath11k/0040-ath11k-Drop-MSDU-with-length-error-in-DP-rx-path.patch +++ b/package/kernel/mac80211/patches/ath11k/0039-ath11k-Drop-MSDU-with-length-error-in-DP-rx-path.patch @@ -1,7 +1,7 @@ From cd18ed4cf8051ceb8590263f5914cb9bb58b0f25 Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Tue, 28 Sep 2021 14:00:43 +0300 -Subject: [PATCH 040/120] ath11k: Drop MSDU with length error in DP rx path +Subject: [PATCH] ath11k: Drop MSDU with length error in DP rx path There are MSDUs whose length are invalid. For example, attackers may inject on purpose truncated A-MSDUs with diff --git a/package/kernel/mac80211/patches/ath11k/0041-ath11k-Fix-inaccessible-debug-registers.patch b/package/kernel/mac80211/patches/ath11k/0040-ath11k-Fix-inaccessible-debug-registers.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0041-ath11k-Fix-inaccessible-debug-registers.patch rename to package/kernel/mac80211/patches/ath11k/0040-ath11k-Fix-inaccessible-debug-registers.patch index f05438662..3563d0028 100644 --- a/package/kernel/mac80211/patches/ath11k/0041-ath11k-Fix-inaccessible-debug-registers.patch +++ b/package/kernel/mac80211/patches/ath11k/0040-ath11k-Fix-inaccessible-debug-registers.patch @@ -1,7 +1,7 @@ From 8a0b899f169d6b6102918327d026922140194fff Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Tue, 28 Sep 2021 14:00:44 +0300 -Subject: [PATCH 041/120] ath11k: Fix inaccessible debug registers +Subject: [PATCH] ath11k: Fix inaccessible debug registers Current code clears debug registers after SOC global reset performed in ath11k_pci_sw_reset. However at that time those registers are diff --git a/package/kernel/mac80211/patches/ath11k/0043-ath11k-Rename-macro-ARRAY_TO_STRING-to-PRINT_ARRAY_T.patch b/package/kernel/mac80211/patches/ath11k/0042-ath11k-Rename-macro-ARRAY_TO_STRING-to-PRINT_ARRAY_T.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0043-ath11k-Rename-macro-ARRAY_TO_STRING-to-PRINT_ARRAY_T.patch rename to package/kernel/mac80211/patches/ath11k/0042-ath11k-Rename-macro-ARRAY_TO_STRING-to-PRINT_ARRAY_T.patch index e5c7ea4a0..3a6dd985f 100644 --- a/package/kernel/mac80211/patches/ath11k/0043-ath11k-Rename-macro-ARRAY_TO_STRING-to-PRINT_ARRAY_T.patch +++ b/package/kernel/mac80211/patches/ath11k/0042-ath11k-Rename-macro-ARRAY_TO_STRING-to-PRINT_ARRAY_T.patch @@ -1,8 +1,7 @@ From 9e2e2d7a4dd490ff6e95e37611070d3b3a9cf58b Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Tue, 28 Sep 2021 14:00:44 +0300 -Subject: [PATCH 043/120] ath11k: Rename macro ARRAY_TO_STRING to - PRINT_ARRAY_TO_BUF +Subject: [PATCH] ath11k: Rename macro ARRAY_TO_STRING to PRINT_ARRAY_TO_BUF Renaming of macro is done to describe the macro functionality better as the macro functionality is modified in next patch-sets. diff --git a/package/kernel/mac80211/patches/ath11k/0044-ath11k-Replace-HTT_DBG_OUT-with-scnprintf.patch b/package/kernel/mac80211/patches/ath11k/0043-ath11k-Replace-HTT_DBG_OUT-with-scnprintf.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0044-ath11k-Replace-HTT_DBG_OUT-with-scnprintf.patch rename to package/kernel/mac80211/patches/ath11k/0043-ath11k-Replace-HTT_DBG_OUT-with-scnprintf.patch index 9d6dd3e23..cb2495a00 100644 --- a/package/kernel/mac80211/patches/ath11k/0044-ath11k-Replace-HTT_DBG_OUT-with-scnprintf.patch +++ b/package/kernel/mac80211/patches/ath11k/0043-ath11k-Replace-HTT_DBG_OUT-with-scnprintf.patch @@ -1,7 +1,7 @@ From 6f442799bcfd62931ca100c7c5916bb5fc034302 Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Tue, 28 Sep 2021 14:00:44 +0300 -Subject: [PATCH 044/120] ath11k: Replace HTT_DBG_OUT with scnprintf +Subject: [PATCH] ath11k: Replace HTT_DBG_OUT with scnprintf Get rid of macro HTT_DBG_OUT and replace it with scnprintf(). The macro does not do anything else. Added required new line diff --git a/package/kernel/mac80211/patches/ath11k/0045-ath11k-Remove-htt-stats-fixed-size-array-usage.patch b/package/kernel/mac80211/patches/ath11k/0044-ath11k-Remove-htt-stats-fixed-size-array-usage.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0045-ath11k-Remove-htt-stats-fixed-size-array-usage.patch rename to package/kernel/mac80211/patches/ath11k/0044-ath11k-Remove-htt-stats-fixed-size-array-usage.patch index 40a197022..70e5ea6ae 100644 --- a/package/kernel/mac80211/patches/ath11k/0045-ath11k-Remove-htt-stats-fixed-size-array-usage.patch +++ b/package/kernel/mac80211/patches/ath11k/0044-ath11k-Remove-htt-stats-fixed-size-array-usage.patch @@ -1,7 +1,7 @@ From 74327bab6781a34d96ff4c0a7c59bb032fab1650 Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Tue, 28 Sep 2021 14:00:45 +0300 -Subject: [PATCH 045/120] ath11k: Remove htt stats fixed size array usage +Subject: [PATCH] ath11k: Remove htt stats fixed size array usage To support the HTT Stats DebugFS interface a single large buffer that contains the stats must be provided to the DebugFS infrastructure. diff --git a/package/kernel/mac80211/patches/ath11k/0046-ath11k-Change-masking-and-shifting-in-htt-stats.patch b/package/kernel/mac80211/patches/ath11k/0045-ath11k-Change-masking-and-shifting-in-htt-stats.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0046-ath11k-Change-masking-and-shifting-in-htt-stats.patch rename to package/kernel/mac80211/patches/ath11k/0045-ath11k-Change-masking-and-shifting-in-htt-stats.patch index 4ebb1021f..6cd198849 100644 --- a/package/kernel/mac80211/patches/ath11k/0046-ath11k-Change-masking-and-shifting-in-htt-stats.patch +++ b/package/kernel/mac80211/patches/ath11k/0045-ath11k-Change-masking-and-shifting-in-htt-stats.patch @@ -1,7 +1,7 @@ From 6ed731829cf862dc1f73bbd063662d8a6c78a5b7 Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Tue, 28 Sep 2021 14:00:45 +0300 -Subject: [PATCH 046/120] ath11k: Change masking and shifting in htt stats +Subject: [PATCH] ath11k: Change masking and shifting in htt stats In debugfs_htt_stats.c, masking and shifting is done to get stats values. Instead use GENMASK and FIELD_GET to improve @@ -667,7 +667,7 @@ Link: https://lore.kernel.org/r/20210913223148.208026-5-jouni@codeaurora.org u32 base_addr_lsb; /* DWORD aligned base memory address of the ring */ --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h -@@ -1593,6 +1593,13 @@ struct ath11k_htt_extd_stats_msg { +@@ -1594,6 +1594,13 @@ struct ath11k_htt_extd_stats_msg { u8 data[0]; } __packed; diff --git a/package/kernel/mac80211/patches/ath11k/0047-ath11k-add-HTT-stats-support-for-new-stats.patch b/package/kernel/mac80211/patches/ath11k/0046-ath11k-add-HTT-stats-support-for-new-stats.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0047-ath11k-add-HTT-stats-support-for-new-stats.patch rename to package/kernel/mac80211/patches/ath11k/0046-ath11k-add-HTT-stats-support-for-new-stats.patch index 3b7310d37..b5d2d829f 100644 --- a/package/kernel/mac80211/patches/ath11k/0047-ath11k-add-HTT-stats-support-for-new-stats.patch +++ b/package/kernel/mac80211/patches/ath11k/0046-ath11k-add-HTT-stats-support-for-new-stats.patch @@ -1,7 +1,7 @@ From ac83b6034cfa3bec010c1e01d6e6b44673135afe Mon Sep 17 00:00:00 2001 From: Venkateswara Naralasetty Date: Tue, 28 Sep 2021 14:00:45 +0300 -Subject: [PATCH 047/120] ath11k: add HTT stats support for new stats +Subject: [PATCH] ath11k: add HTT stats support for new stats Add HTT stats support for, diff --git a/package/kernel/mac80211/patches/ath11k/0049-ath11k-indicate-scan-complete-for-scan-canceled-when.patch b/package/kernel/mac80211/patches/ath11k/0048-ath11k-indicate-scan-complete-for-scan-canceled-when.patch similarity index 91% rename from package/kernel/mac80211/patches/ath11k/0049-ath11k-indicate-scan-complete-for-scan-canceled-when.patch rename to package/kernel/mac80211/patches/ath11k/0048-ath11k-indicate-scan-complete-for-scan-canceled-when.patch index b93b6b4ef..b68a200bc 100644 --- a/package/kernel/mac80211/patches/ath11k/0049-ath11k-indicate-scan-complete-for-scan-canceled-when.patch +++ b/package/kernel/mac80211/patches/ath11k/0048-ath11k-indicate-scan-complete-for-scan-canceled-when.patch @@ -1,8 +1,8 @@ From c677d4b1bcc4f7330043d8f039f494557d720ed4 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Tue, 28 Sep 2021 14:00:45 +0300 -Subject: [PATCH 049/120] ath11k: indicate scan complete for scan canceled when - scan running +Subject: [PATCH] ath11k: indicate scan complete for scan canceled when scan + running ath11k prints "Received scan event for unknown vdev" when doing the following test: @@ -34,7 +34,7 @@ Link: https://lore.kernel.org/r/20210914164226.38843-2-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -6289,8 +6289,9 @@ exit: +@@ -6290,8 +6290,9 @@ exit: rcu_read_unlock(); } @@ -46,7 +46,7 @@ Link: https://lore.kernel.org/r/20210914164226.38843-2-jouni@codeaurora.org { int i; struct ath11k_pdev *pdev; -@@ -6302,7 +6303,7 @@ static struct ath11k *ath11k_get_ar_on_s +@@ -6303,7 +6304,7 @@ static struct ath11k *ath11k_get_ar_on_s ar = pdev->ar; spin_lock_bh(&ar->data_lock); @@ -55,7 +55,7 @@ Link: https://lore.kernel.org/r/20210914164226.38843-2-jouni@codeaurora.org ar->scan.vdev_id == vdev_id) { spin_unlock_bh(&ar->data_lock); return ar; -@@ -6332,10 +6333,15 @@ static void ath11k_scan_event(struct ath +@@ -6333,10 +6334,15 @@ static void ath11k_scan_event(struct ath * aborting scan's vdev id matches this event info. */ if (scan_ev.event_type == WMI_SCAN_EVENT_COMPLETED && diff --git a/package/kernel/mac80211/patches/ath11k/0050-ath11k-indicate-to-mac80211-scan-complete-with-abort.patch b/package/kernel/mac80211/patches/ath11k/0049-ath11k-indicate-to-mac80211-scan-complete-with-abort.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0050-ath11k-indicate-to-mac80211-scan-complete-with-abort.patch rename to package/kernel/mac80211/patches/ath11k/0049-ath11k-indicate-to-mac80211-scan-complete-with-abort.patch index a4865bccb..6b0ad11e9 100644 --- a/package/kernel/mac80211/patches/ath11k/0050-ath11k-indicate-to-mac80211-scan-complete-with-abort.patch +++ b/package/kernel/mac80211/patches/ath11k/0049-ath11k-indicate-to-mac80211-scan-complete-with-abort.patch @@ -1,8 +1,8 @@ From 62db14ea95b1017c53ebb8f724119ea4d90ecc07 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Tue, 28 Sep 2021 14:00:45 +0300 -Subject: [PATCH 050/120] ath11k: indicate to mac80211 scan complete with - aborted flag for ATH11K_SCAN_STARTING state +Subject: [PATCH] ath11k: indicate to mac80211 scan complete with aborted flag + for ATH11K_SCAN_STARTING state Scan failure can not be recovered from when running a loop of the following steps: @@ -41,7 +41,7 @@ Link: https://lore.kernel.org/r/20210914164226.38843-3-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -2982,18 +2982,21 @@ void __ath11k_mac_scan_finish(struct ath +@@ -2987,18 +2987,21 @@ void __ath11k_mac_scan_finish(struct ath break; case ATH11K_SCAN_RUNNING: case ATH11K_SCAN_ABORTING: diff --git a/package/kernel/mac80211/patches/ath11k/0051-ath11k-add-6-GHz-params-in-peer-assoc-command.patch b/package/kernel/mac80211/patches/ath11k/0050-ath11k-add-6-GHz-params-in-peer-assoc-command.patch similarity index 92% rename from package/kernel/mac80211/patches/ath11k/0051-ath11k-add-6-GHz-params-in-peer-assoc-command.patch rename to package/kernel/mac80211/patches/ath11k/0050-ath11k-add-6-GHz-params-in-peer-assoc-command.patch index 7239b38a2..4339ffb70 100644 --- a/package/kernel/mac80211/patches/ath11k/0051-ath11k-add-6-GHz-params-in-peer-assoc-command.patch +++ b/package/kernel/mac80211/patches/ath11k/0050-ath11k-add-6-GHz-params-in-peer-assoc-command.patch @@ -1,7 +1,7 @@ From c3a7d7eb4c9853bb457b792cef42ddd4a029a914 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Chitrapu Date: Tue, 28 Sep 2021 14:00:46 +0300 -Subject: [PATCH 051/120] ath11k: add 6 GHz params in peer assoc command +Subject: [PATCH] ath11k: add 6 GHz params in peer assoc command Currently A-MPDU aggregation parameters are not being configured during peer association for 6 GHz band. Hence, extract these @@ -21,7 +21,7 @@ Link: https://lore.kernel.org/r/20210913175510.193005-2-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -2016,6 +2016,53 @@ static void ath11k_peer_assoc_h_he(struc +@@ -2021,6 +2021,53 @@ static void ath11k_peer_assoc_h_he(struc arg->peer_bw_rxnss_override); } @@ -75,7 +75,7 @@ Link: https://lore.kernel.org/r/20210913175510.193005-2-jouni@codeaurora.org static void ath11k_peer_assoc_h_smps(struct ieee80211_sta *sta, struct peer_assoc_params *arg) { -@@ -2305,6 +2352,7 @@ static void ath11k_peer_assoc_prepare(st +@@ -2310,6 +2357,7 @@ static void ath11k_peer_assoc_prepare(st ath11k_peer_assoc_h_ht(ar, vif, sta, arg); ath11k_peer_assoc_h_vht(ar, vif, sta, arg); ath11k_peer_assoc_h_he(ar, vif, sta, arg); @@ -83,7 +83,7 @@ Link: https://lore.kernel.org/r/20210913175510.193005-2-jouni@codeaurora.org ath11k_peer_assoc_h_qos(ar, vif, sta, arg); ath11k_peer_assoc_h_smps(sta, arg); -@@ -7598,7 +7646,7 @@ static int __ath11k_mac_register(struct +@@ -7608,7 +7656,7 @@ static int __ath11k_mac_register(struct if (cap->nss_ratio_enabled) ieee80211_hw_set(ar->hw, SUPPORTS_VHT_EXT_NSS_BW); diff --git a/package/kernel/mac80211/patches/ath11k/0052-ath11k-support-SMPS-configuration-for-6-GHz.patch b/package/kernel/mac80211/patches/ath11k/0051-ath11k-support-SMPS-configuration-for-6-GHz.patch similarity index 88% rename from package/kernel/mac80211/patches/ath11k/0052-ath11k-support-SMPS-configuration-for-6-GHz.patch rename to package/kernel/mac80211/patches/ath11k/0051-ath11k-support-SMPS-configuration-for-6-GHz.patch index 127eaa551..518277876 100644 --- a/package/kernel/mac80211/patches/ath11k/0052-ath11k-support-SMPS-configuration-for-6-GHz.patch +++ b/package/kernel/mac80211/patches/ath11k/0051-ath11k-support-SMPS-configuration-for-6-GHz.patch @@ -1,7 +1,7 @@ From 6f4d70308e5eb63c99702e93f7c0d8e55f360da2 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Chitrapu Date: Tue, 28 Sep 2021 14:00:46 +0300 -Subject: [PATCH 052/120] ath11k: support SMPS configuration for 6 GHz +Subject: [PATCH] ath11k: support SMPS configuration for 6 GHz Parse SMPS configuration from IEs and configure. Without this, SMPS is not enabled for 6 GHz band. @@ -18,7 +18,7 @@ Link: https://lore.kernel.org/r/20210913175510.193005-3-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -2069,11 +2069,16 @@ static void ath11k_peer_assoc_h_smps(str +@@ -2074,11 +2074,16 @@ static void ath11k_peer_assoc_h_smps(str const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; int smps; @@ -38,7 +38,7 @@ Link: https://lore.kernel.org/r/20210913175510.193005-3-jouni@codeaurora.org switch (smps) { case WLAN_HT_CAP_SM_PS_STATIC: -@@ -2361,15 +2366,20 @@ static void ath11k_peer_assoc_prepare(st +@@ -2366,15 +2371,20 @@ static void ath11k_peer_assoc_prepare(st static int ath11k_setup_peer_smps(struct ath11k *ar, struct ath11k_vif *arvif, const u8 *addr, @@ -63,7 +63,7 @@ Link: https://lore.kernel.org/r/20210913175510.193005-3-jouni@codeaurora.org if (smps >= ARRAY_SIZE(ath11k_smps_map)) return -EINVAL; -@@ -2422,7 +2432,8 @@ static void ath11k_bss_assoc(struct ieee +@@ -2427,7 +2437,8 @@ static void ath11k_bss_assoc(struct ieee } ret = ath11k_setup_peer_smps(ar, arvif, bss_conf->bssid, @@ -73,7 +73,7 @@ Link: https://lore.kernel.org/r/20210913175510.193005-3-jouni@codeaurora.org if (ret) { ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", arvif->vdev_id, ret); -@@ -3714,7 +3725,7 @@ static int ath11k_station_assoc(struct a +@@ -3720,7 +3731,7 @@ static int ath11k_station_assoc(struct a return 0; ret = ath11k_setup_peer_smps(ar, arvif, sta->addr, @@ -82,7 +82,7 @@ Link: https://lore.kernel.org/r/20210913175510.193005-3-jouni@codeaurora.org if (ret) { ath11k_warn(ar->ab, "failed to setup peer SMPS for vdev %d: %d\n", arvif->vdev_id, ret); -@@ -7661,7 +7672,7 @@ static int __ath11k_mac_register(struct +@@ -7671,7 +7682,7 @@ static int __ath11k_mac_register(struct * for each band for a dual band capable radio. It will be tricky to * handle it when the ht capability different for each band. */ diff --git a/package/kernel/mac80211/patches/ath11k/0054-ath11k-Remove-unused-variable-in-ath11k_dp_rx_mon_me.patch b/package/kernel/mac80211/patches/ath11k/0053-ath11k-Remove-unused-variable-in-ath11k_dp_rx_mon_me.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0054-ath11k-Remove-unused-variable-in-ath11k_dp_rx_mon_me.patch rename to package/kernel/mac80211/patches/ath11k/0053-ath11k-Remove-unused-variable-in-ath11k_dp_rx_mon_me.patch index 5962d02e5..d6a2632e3 100644 --- a/package/kernel/mac80211/patches/ath11k/0054-ath11k-Remove-unused-variable-in-ath11k_dp_rx_mon_me.patch +++ b/package/kernel/mac80211/patches/ath11k/0053-ath11k-Remove-unused-variable-in-ath11k_dp_rx_mon_me.patch @@ -1,7 +1,7 @@ From 7210b4b77fe47697890d2d3b2ce57ac9f767bffc Mon Sep 17 00:00:00 2001 From: Tim Gardner Date: Tue, 5 Oct 2021 16:55:54 +0300 -Subject: [PATCH 054/120] ath11k: Remove unused variable in +Subject: [PATCH] ath11k: Remove unused variable in ath11k_dp_rx_mon_merg_msdus() Coverity complains that a constant variable guards dead code. In fact, diff --git a/package/kernel/mac80211/patches/ath11k/0055-ath11k-Fix-spelling-mistake-incompaitiblity-incompat.patch b/package/kernel/mac80211/patches/ath11k/0054-ath11k-Fix-spelling-mistake-incompaitiblity-incompat.patch similarity index 88% rename from package/kernel/mac80211/patches/ath11k/0055-ath11k-Fix-spelling-mistake-incompaitiblity-incompat.patch rename to package/kernel/mac80211/patches/ath11k/0054-ath11k-Fix-spelling-mistake-incompaitiblity-incompat.patch index 1eb7c5463..224e92119 100644 --- a/package/kernel/mac80211/patches/ath11k/0055-ath11k-Fix-spelling-mistake-incompaitiblity-incompat.patch +++ b/package/kernel/mac80211/patches/ath11k/0054-ath11k-Fix-spelling-mistake-incompaitiblity-incompat.patch @@ -1,7 +1,7 @@ From 567ec33a76c7d8e7fbd7a73c81dd16b9efc7ae6d Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Wed, 6 Oct 2021 09:32:17 +0100 -Subject: [PATCH 055/120] ath11k: Fix spelling mistake "incompaitiblity" -> +Subject: [PATCH] ath11k: Fix spelling mistake "incompaitiblity" -> "incompatibility" There is a spelling mistake in an ath11k_warn message. Fix it. @@ -15,7 +15,7 @@ Link: https://lore.kernel.org/r/20211006083217.349596-1-colin.king@canonical.com --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -7081,7 +7081,7 @@ ath11k_mac_op_set_bitrate_mask(struct ie +@@ -7091,7 +7091,7 @@ ath11k_mac_op_set_bitrate_mask(struct ie if (!ath11k_mac_validate_vht_he_fixed_rate_settings(ar, band, mask)) ath11k_warn(ar->ab, diff --git a/package/kernel/mac80211/patches/ath11k/0056-ath11k-fix-m68k-and-xtensa-build-failure-in-ath11k_p.patch b/package/kernel/mac80211/patches/ath11k/0055-ath11k-fix-m68k-and-xtensa-build-failure-in-ath11k_p.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0056-ath11k-fix-m68k-and-xtensa-build-failure-in-ath11k_p.patch rename to package/kernel/mac80211/patches/ath11k/0055-ath11k-fix-m68k-and-xtensa-build-failure-in-ath11k_p.patch index c94498dbc..048c87260 100644 --- a/package/kernel/mac80211/patches/ath11k/0056-ath11k-fix-m68k-and-xtensa-build-failure-in-ath11k_p.patch +++ b/package/kernel/mac80211/patches/ath11k/0055-ath11k-fix-m68k-and-xtensa-build-failure-in-ath11k_p.patch @@ -1,7 +1,7 @@ From 16bdce2ada5a4c3c91b7c4e81780d2de50bd6ab5 Mon Sep 17 00:00:00 2001 From: Kalle Valo Date: Fri, 8 Oct 2021 17:39:32 +0300 -Subject: [PATCH 056/120] ath11k: fix m68k and xtensa build failure in +Subject: [PATCH] ath11k: fix m68k and xtensa build failure in ath11k_peer_assoc_h_smps() Stephen reported that ath11k was failing to build on m68k and xtensa: @@ -43,7 +43,7 @@ Signed-off-by: David S. Miller --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -2076,8 +2076,8 @@ static void ath11k_peer_assoc_h_smps(str +@@ -2081,8 +2081,8 @@ static void ath11k_peer_assoc_h_smps(str smps = ht_cap->cap & IEEE80211_HT_CAP_SM_PS; smps >>= IEEE80211_HT_CAP_SM_PS_SHIFT; } else { diff --git a/package/kernel/mac80211/patches/ath11k/0057-ath11k-Remove-redundant-assignment-to-variable-fw_si.patch b/package/kernel/mac80211/patches/ath11k/0056-ath11k-Remove-redundant-assignment-to-variable-fw_si.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0057-ath11k-Remove-redundant-assignment-to-variable-fw_si.patch rename to package/kernel/mac80211/patches/ath11k/0056-ath11k-Remove-redundant-assignment-to-variable-fw_si.patch index f7b8998ad..0e7054aa7 100644 --- a/package/kernel/mac80211/patches/ath11k/0057-ath11k-Remove-redundant-assignment-to-variable-fw_si.patch +++ b/package/kernel/mac80211/patches/ath11k/0056-ath11k-Remove-redundant-assignment-to-variable-fw_si.patch @@ -1,8 +1,7 @@ From 4f50bdfb4e5fc3d753c8cf94b94b43aaa2c49b95 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 7 Oct 2021 18:16:24 +0300 -Subject: [PATCH 057/120] ath11k: Remove redundant assignment to variable - fw_size +Subject: [PATCH] ath11k: Remove redundant assignment to variable fw_size Variable fw_size is being assigned a value that is never read and being re-assigned a new value in the next statement. The assignment diff --git a/package/kernel/mac80211/patches/ath11k/0058-ath11k-Use-kcalloc-instead-of-kzalloc.patch b/package/kernel/mac80211/patches/ath11k/0057-ath11k-Use-kcalloc-instead-of-kzalloc.patch similarity index 87% rename from package/kernel/mac80211/patches/ath11k/0058-ath11k-Use-kcalloc-instead-of-kzalloc.patch rename to package/kernel/mac80211/patches/ath11k/0057-ath11k-Use-kcalloc-instead-of-kzalloc.patch index fd41386e7..53b1fcc6c 100644 --- a/package/kernel/mac80211/patches/ath11k/0058-ath11k-Use-kcalloc-instead-of-kzalloc.patch +++ b/package/kernel/mac80211/patches/ath11k/0057-ath11k-Use-kcalloc-instead-of-kzalloc.patch @@ -1,7 +1,7 @@ From ec4363384c3f110561dc5ee2e59adee02dbd9f73 Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Thu, 7 Oct 2021 18:16:24 +0300 -Subject: [PATCH 058/120] ath11k: Use kcalloc() instead of kzalloc() +Subject: [PATCH] ath11k: Use kcalloc() instead of kzalloc() Use 2-factor multiplication argument form kcalloc() instead of kzalloc(). @@ -16,7 +16,7 @@ Link: https://lore.kernel.org/r/20211006181204.GA913553@embeddedor --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -4065,8 +4065,8 @@ static int ath11k_wmi_tlv_mac_phy_caps_p +@@ -4066,8 +4066,8 @@ static int ath11k_wmi_tlv_mac_phy_caps_p len = min_t(u16, len, sizeof(struct wmi_mac_phy_capabilities)); if (!svc_rdy_ext->n_mac_phy_caps) { @@ -27,7 +27,7 @@ Link: https://lore.kernel.org/r/20211006181204.GA913553@embeddedor if (!svc_rdy_ext->mac_phy_caps) return -ENOMEM; } -@@ -4466,8 +4466,8 @@ static struct cur_reg_rule +@@ -4467,8 +4467,8 @@ static struct cur_reg_rule struct cur_reg_rule *reg_rule_ptr; u32 count; diff --git a/package/kernel/mac80211/patches/ath11k/0059-ath11k-Handle-MSI-enablement-during-rmmod-and-SSR.patch b/package/kernel/mac80211/patches/ath11k/0058-ath11k-Handle-MSI-enablement-during-rmmod-and-SSR.patch similarity index 88% rename from package/kernel/mac80211/patches/ath11k/0059-ath11k-Handle-MSI-enablement-during-rmmod-and-SSR.patch rename to package/kernel/mac80211/patches/ath11k/0058-ath11k-Handle-MSI-enablement-during-rmmod-and-SSR.patch index 633cc46c6..dcb1c0410 100644 --- a/package/kernel/mac80211/patches/ath11k/0059-ath11k-Handle-MSI-enablement-during-rmmod-and-SSR.patch +++ b/package/kernel/mac80211/patches/ath11k/0058-ath11k-Handle-MSI-enablement-during-rmmod-and-SSR.patch @@ -1,7 +1,7 @@ From 96527d527b271d950367ad13e3de8b0673545622 Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Mon, 11 Oct 2021 09:33:08 +0300 -Subject: [PATCH 059/120] ath11k: Handle MSI enablement during rmmod and SSR +Subject: [PATCH] ath11k: Handle MSI enablement during rmmod and SSR When doing "rmmod ath11k_pci", ath11k performs global SOC reset and MHI reset, where 0 address access is captured by IOMMU. See @@ -40,7 +40,7 @@ Link: https://lore.kernel.org/r/20210913180246.193388-5-jouni@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -855,7 +855,32 @@ static void ath11k_pci_ce_irqs_enable(st +@@ -861,7 +861,32 @@ static void ath11k_pci_ce_irqs_enable(st } } @@ -74,7 +74,7 @@ Link: https://lore.kernel.org/r/20210913180246.193388-5-jouni@codeaurora.org { struct ath11k_base *ab = ab_pci->ab; const struct ath11k_msi_config *msi_config = ab_pci->msi_config; -@@ -876,6 +901,7 @@ static int ath11k_pci_enable_msi(struct +@@ -882,6 +907,7 @@ static int ath11k_pci_enable_msi(struct else return num_vectors; } @@ -82,7 +82,7 @@ Link: https://lore.kernel.org/r/20210913180246.193388-5-jouni@codeaurora.org msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); if (!msi_desc) { -@@ -898,7 +924,7 @@ free_msi_vector: +@@ -904,7 +930,7 @@ free_msi_vector: return ret; } @@ -91,7 +91,7 @@ Link: https://lore.kernel.org/r/20210913180246.193388-5-jouni@codeaurora.org { pci_free_irq_vectors(ab_pci->pdev); } -@@ -1019,6 +1045,8 @@ static int ath11k_pci_power_up(struct at +@@ -1025,6 +1051,8 @@ static int ath11k_pci_power_up(struct at */ ath11k_pci_aspm_disable(ab_pci); @@ -100,7 +100,7 @@ Link: https://lore.kernel.org/r/20210913180246.193388-5-jouni@codeaurora.org ret = ath11k_mhi_start(ab_pci); if (ret) { ath11k_err(ab, "failed to start mhi: %d\n", ret); -@@ -1039,6 +1067,9 @@ static void ath11k_pci_power_down(struct +@@ -1045,6 +1073,9 @@ static void ath11k_pci_power_down(struct ath11k_pci_aspm_restore(ab_pci); ath11k_pci_force_wake(ab_pci->ab); @@ -110,7 +110,7 @@ Link: https://lore.kernel.org/r/20210913180246.193388-5-jouni@codeaurora.org ath11k_mhi_stop(ab_pci); clear_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags); ath11k_pci_sw_reset(ab_pci->ab, false); -@@ -1263,7 +1294,7 @@ static int ath11k_pci_probe(struct pci_d +@@ -1279,7 +1310,7 @@ static int ath11k_pci_probe(struct pci_d goto err_pci_free_region; } @@ -119,7 +119,7 @@ Link: https://lore.kernel.org/r/20210913180246.193388-5-jouni@codeaurora.org if (ret) { ath11k_err(ab, "failed to enable msi: %d\n", ret); goto err_pci_free_region; -@@ -1317,7 +1348,7 @@ err_mhi_unregister: +@@ -1333,7 +1364,7 @@ err_mhi_unregister: ath11k_mhi_unregister(ab_pci); err_pci_disable_msi: @@ -128,7 +128,7 @@ Link: https://lore.kernel.org/r/20210913180246.193388-5-jouni@codeaurora.org err_pci_free_region: ath11k_pci_free_region(ab_pci); -@@ -1348,7 +1379,7 @@ qmi_fail: +@@ -1364,7 +1395,7 @@ qmi_fail: ath11k_mhi_unregister(ab_pci); ath11k_pci_free_irq(ab); diff --git a/package/kernel/mac80211/patches/ath11k/0060-ath11k-Change-number-of-TCL-rings-to-one-for-QCA6390.patch b/package/kernel/mac80211/patches/ath11k/0059-ath11k-Change-number-of-TCL-rings-to-one-for-QCA6390.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0060-ath11k-Change-number-of-TCL-rings-to-one-for-QCA6390.patch rename to package/kernel/mac80211/patches/ath11k/0059-ath11k-Change-number-of-TCL-rings-to-one-for-QCA6390.patch index 806206561..add021679 100644 --- a/package/kernel/mac80211/patches/ath11k/0060-ath11k-Change-number-of-TCL-rings-to-one-for-QCA6390.patch +++ b/package/kernel/mac80211/patches/ath11k/0059-ath11k-Change-number-of-TCL-rings-to-one-for-QCA6390.patch @@ -1,7 +1,7 @@ From 31582373a4a8e888b29ed759d28330a1995f2162 Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Mon, 11 Oct 2021 09:33:09 +0300 -Subject: [PATCH 060/120] ath11k: Change number of TCL rings to one for QCA6390 +Subject: [PATCH] ath11k: Change number of TCL rings to one for QCA6390 Some targets, QCA6390 for example, use only one TCL ring, it is better to initialize only one ring and leave others untouched for such targets. @@ -230,7 +230,7 @@ Link: https://lore.kernel.org/r/20210914163726.38604-1-jouni@codeaurora.org struct ath11k_hw_ops { --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5797,7 +5797,7 @@ err_vdev_del: +@@ -5807,7 +5807,7 @@ err_vdev_del: idr_for_each(&ar->txmgmt_idr, ath11k_mac_vif_txmgmt_idr_remove, vif); diff --git a/package/kernel/mac80211/patches/ath11k/0061-ath11k-Identify-DFS-channel-when-sending-scan-channe.patch b/package/kernel/mac80211/patches/ath11k/0060-ath11k-Identify-DFS-channel-when-sending-scan-channe.patch similarity index 88% rename from package/kernel/mac80211/patches/ath11k/0061-ath11k-Identify-DFS-channel-when-sending-scan-channe.patch rename to package/kernel/mac80211/patches/ath11k/0060-ath11k-Identify-DFS-channel-when-sending-scan-channe.patch index c1a04ecbd..1c762ff25 100644 --- a/package/kernel/mac80211/patches/ath11k/0061-ath11k-Identify-DFS-channel-when-sending-scan-channe.patch +++ b/package/kernel/mac80211/patches/ath11k/0060-ath11k-Identify-DFS-channel-when-sending-scan-channe.patch @@ -1,8 +1,8 @@ From 8cd5c0847160aa9482d7f93ed63c4d72bad70cdf Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Mon, 11 Oct 2021 18:18:00 +0300 -Subject: [PATCH 061/120] ath11k: Identify DFS channel when sending scan - channel list command +Subject: [PATCH] ath11k: Identify DFS channel when sending scan channel list + command WMI_CHAN_INFO_DFS flag should be set when configuring a DFS channel included in scan channel list. Without it, firmware will not send a @@ -22,7 +22,7 @@ Link: https://lore.kernel.org/r/20211011054919.77071-1-bqiang@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -2371,6 +2371,8 @@ int ath11k_wmi_send_scan_chan_list_cmd(s +@@ -2372,6 +2372,8 @@ int ath11k_wmi_send_scan_chan_list_cmd(s chan_info->info |= WMI_CHAN_INFO_QUARTER_RATE; if (tchan_info->psc_channel) chan_info->info |= WMI_CHAN_INFO_PSC; diff --git a/package/kernel/mac80211/patches/ath11k/0062-ath11k-change-return-buffer-manager-for-QCA6390.patch b/package/kernel/mac80211/patches/ath11k/0061-ath11k-change-return-buffer-manager-for-QCA6390.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0062-ath11k-change-return-buffer-manager-for-QCA6390.patch rename to package/kernel/mac80211/patches/ath11k/0061-ath11k-change-return-buffer-manager-for-QCA6390.patch index 99b31191b..2c7153301 100644 --- a/package/kernel/mac80211/patches/ath11k/0062-ath11k-change-return-buffer-manager-for-QCA6390.patch +++ b/package/kernel/mac80211/patches/ath11k/0061-ath11k-change-return-buffer-manager-for-QCA6390.patch @@ -1,7 +1,7 @@ From 734223d78428de3c7c7d7bc04daf258085780d90 Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Wed, 20 Oct 2021 11:59:06 +0300 -Subject: [PATCH 062/120] ath11k: change return buffer manager for QCA6390 +Subject: [PATCH] ath11k: change return buffer manager for QCA6390 QCA6390 firmware uses HAL_RX_BUF_RBM_SW1_BM, not HAL_RX_BUF_RBM_SW3_BM. This is needed to fix a case where an A-MSDU has an unexpected LLC/SNAP header in the @@ -246,7 +246,7 @@ Link: https://lore.kernel.org/r/20210914163726.38604-2-jouni@codeaurora.org /* Map from pdev index to hw mac index */ static u8 ath11k_hw_ipq8074_mac_from_pdev_id(int pdev_idx) -@@ -2124,3 +2125,11 @@ const struct ath11k_hw_regs wcn6855_regs +@@ -2122,3 +2123,11 @@ const struct ath11k_hw_regs wcn6855_regs .pcie_qserdes_sysclk_en_sel = 0x01e0c0ac, .pcie_pcs_osc_dtct_config_base = 0x01e0c628, }; diff --git a/package/kernel/mac80211/patches/ath11k/0063-ath11k-set-correct-NL80211_FEATURE_DYNAMIC_SMPS-for-.patch b/package/kernel/mac80211/patches/ath11k/0062-ath11k-set-correct-NL80211_FEATURE_DYNAMIC_SMPS-for-.patch similarity index 95% rename from package/kernel/mac80211/patches/ath11k/0063-ath11k-set-correct-NL80211_FEATURE_DYNAMIC_SMPS-for-.patch rename to package/kernel/mac80211/patches/ath11k/0062-ath11k-set-correct-NL80211_FEATURE_DYNAMIC_SMPS-for-.patch index 86f5efddc..9c8b84a67 100644 --- a/package/kernel/mac80211/patches/ath11k/0063-ath11k-set-correct-NL80211_FEATURE_DYNAMIC_SMPS-for-.patch +++ b/package/kernel/mac80211/patches/ath11k/0062-ath11k-set-correct-NL80211_FEATURE_DYNAMIC_SMPS-for-.patch @@ -1,8 +1,7 @@ From 82c434c103408842a87404e873992b7698b6df2b Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Thu, 28 Oct 2021 10:46:28 +0300 -Subject: [PATCH 063/120] ath11k: set correct NL80211_FEATURE_DYNAMIC_SMPS for - WCN6855 +Subject: [PATCH] ath11k: set correct NL80211_FEATURE_DYNAMIC_SMPS for WCN6855 Commit 6f4d70308e5e ("ath11k: support SMPS configuration for 6 GHz") changed "if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS)" to "if (ht_cap & @@ -82,7 +81,7 @@ Link: https://lore.kernel.org/r/20210914163726.38604-3-jouni@codeaurora.org struct ath11k_hw_ops { --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -7672,7 +7672,8 @@ static int __ath11k_mac_register(struct +@@ -7682,7 +7682,8 @@ static int __ath11k_mac_register(struct * for each band for a dual band capable radio. It will be tricky to * handle it when the ht capability different for each band. */ diff --git a/package/kernel/mac80211/patches/ath11k/0064-ath11k-convert-ath11k_wmi_pdev_set_ps_mode-to-use-en.patch b/package/kernel/mac80211/patches/ath11k/0063-ath11k-convert-ath11k_wmi_pdev_set_ps_mode-to-use-en.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0064-ath11k-convert-ath11k_wmi_pdev_set_ps_mode-to-use-en.patch rename to package/kernel/mac80211/patches/ath11k/0063-ath11k-convert-ath11k_wmi_pdev_set_ps_mode-to-use-en.patch index faaa96275..7d130b0c4 100644 --- a/package/kernel/mac80211/patches/ath11k/0064-ath11k-convert-ath11k_wmi_pdev_set_ps_mode-to-use-en.patch +++ b/package/kernel/mac80211/patches/ath11k/0063-ath11k-convert-ath11k_wmi_pdev_set_ps_mode-to-use-en.patch @@ -1,8 +1,8 @@ From af3d89649bb69bd5be273cf6c001cd19c2604ca2 Mon Sep 17 00:00:00 2001 From: Kalle Valo Date: Mon, 8 Nov 2021 14:38:25 +0200 -Subject: [PATCH 064/120] ath11k: convert ath11k_wmi_pdev_set_ps_mode() to use - enum wmi_sta_ps_mode +Subject: [PATCH] ath11k: convert ath11k_wmi_pdev_set_ps_mode() to use enum + wmi_sta_ps_mode It's more descriptive to use the actual enum used by the firmware instead of a boolean so change ath11k_wmi_pdev_set_ps_mode() to use a boolean. @@ -19,7 +19,7 @@ Link: https://lore.kernel.org/r/20211108123826.8463-1-kvalo@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5638,7 +5638,8 @@ static int ath11k_mac_op_add_interface(s +@@ -5648,7 +5648,8 @@ static int ath11k_mac_op_add_interface(s goto err_peer_del; } diff --git a/package/kernel/mac80211/patches/ath11k/0065-ath11k-enable-802.11-power-save-mode-in-station-mode.patch b/package/kernel/mac80211/patches/ath11k/0064-ath11k-enable-802.11-power-save-mode-in-station-mode.patch similarity index 95% rename from package/kernel/mac80211/patches/ath11k/0065-ath11k-enable-802.11-power-save-mode-in-station-mode.patch rename to package/kernel/mac80211/patches/ath11k/0064-ath11k-enable-802.11-power-save-mode-in-station-mode.patch index 45ce607d0..e2a6a4f92 100644 --- a/package/kernel/mac80211/patches/ath11k/0065-ath11k-enable-802.11-power-save-mode-in-station-mode.patch +++ b/package/kernel/mac80211/patches/ath11k/0064-ath11k-enable-802.11-power-save-mode-in-station-mode.patch @@ -1,7 +1,7 @@ From b2beffa7d9a67b59b085616a27f1d10b1e80784f Mon Sep 17 00:00:00 2001 From: Carl Huang Date: Mon, 8 Nov 2021 14:38:26 +0200 -Subject: [PATCH 065/120] ath11k: enable 802.11 power save mode in station mode +Subject: [PATCH] ath11k: enable 802.11 power save mode in station mode To reduce power consumption enable 802.11 power save mode in station mode. This allows both radio and CPU to sleep more. @@ -69,7 +69,7 @@ Link: https://lore.kernel.org/r/20211108123826.8463-2-kvalo@codeaurora.org .hal_desc_sz = sizeof(struct hal_rx_desc_wcn6855), --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -240,6 +240,7 @@ struct ath11k_vif { +@@ -246,6 +246,7 @@ struct ath11k_vif { bool is_started; bool is_up; bool spectral_enabled; @@ -89,7 +89,7 @@ Link: https://lore.kernel.org/r/20211108123826.8463-2-kvalo@codeaurora.org u32 hal_desc_sz; --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1049,6 +1049,83 @@ static int ath11k_mac_monitor_stop(struc +@@ -1050,6 +1050,83 @@ static int ath11k_mac_monitor_stop(struc return 0; } @@ -173,7 +173,7 @@ Link: https://lore.kernel.org/r/20211108123826.8463-2-kvalo@codeaurora.org static int ath11k_mac_op_config(struct ieee80211_hw *hw, u32 changed) { struct ath11k *ar = hw->priv; -@@ -2942,6 +3019,16 @@ static void ath11k_mac_op_bss_info_chang +@@ -2947,6 +3024,16 @@ static void ath11k_mac_op_bss_info_chang ath11k_mac_txpower_recalc(ar); } diff --git a/package/kernel/mac80211/patches/ath11k/0067-ath11k-Clear-auth-flag-only-for-actual-association-i.patch b/package/kernel/mac80211/patches/ath11k/0066-ath11k-Clear-auth-flag-only-for-actual-association-i.patch similarity index 87% rename from package/kernel/mac80211/patches/ath11k/0067-ath11k-Clear-auth-flag-only-for-actual-association-i.patch rename to package/kernel/mac80211/patches/ath11k/0066-ath11k-Clear-auth-flag-only-for-actual-association-i.patch index 739d9656f..60e76e53a 100644 --- a/package/kernel/mac80211/patches/ath11k/0067-ath11k-Clear-auth-flag-only-for-actual-association-i.patch +++ b/package/kernel/mac80211/patches/ath11k/0066-ath11k-Clear-auth-flag-only-for-actual-association-i.patch @@ -1,8 +1,8 @@ From c802b6d7815d7c3f556efea28d0b79ef57ebcfd4 Mon Sep 17 00:00:00 2001 From: Rameshkumar Sundaram Date: Mon, 25 Oct 2021 21:33:06 +0530 -Subject: [PATCH 067/120] ath11k: Clear auth flag only for actual association - in security mode +Subject: [PATCH] ath11k: Clear auth flag only for actual association in + security mode AUTH flag is needed when peer assoc command is sent from host in security mode for non-assoc cases. Firmware will handle AUTH flag @@ -25,7 +25,7 @@ Link: https://lore.kernel.org/r/1635177786-20854-1-git-send-email-quic_ramess@qu --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -2495,6 +2495,7 @@ static void ath11k_bss_assoc(struct ieee +@@ -2500,6 +2500,7 @@ static void ath11k_bss_assoc(struct ieee rcu_read_unlock(); @@ -33,7 +33,7 @@ Link: https://lore.kernel.org/r/1635177786-20854-1-git-send-email-quic_ramess@qu ret = ath11k_wmi_send_peer_assoc_cmd(ar, &peer_arg); if (ret) { ath11k_warn(ar->ab, "failed to run peer assoc for %pM vdev %i: %d\n", -@@ -3772,6 +3773,7 @@ static int ath11k_station_assoc(struct a +@@ -3778,6 +3779,7 @@ static int ath11k_station_assoc(struct a ath11k_peer_assoc_prepare(ar, vif, sta, &peer_arg, reassoc); @@ -41,7 +41,7 @@ Link: https://lore.kernel.org/r/1635177786-20854-1-git-send-email-quic_ramess@qu ret = ath11k_wmi_send_peer_assoc_cmd(ar, &peer_arg); if (ret) { ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", -@@ -3983,6 +3985,7 @@ static void ath11k_sta_rc_update_wk(stru +@@ -3989,6 +3991,7 @@ static void ath11k_sta_rc_update_wk(stru ath11k_peer_assoc_prepare(ar, arvif->vif, sta, &peer_arg, true); @@ -51,7 +51,7 @@ Link: https://lore.kernel.org/r/1635177786-20854-1-git-send-email-quic_ramess@qu ath11k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n", --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1763,7 +1763,7 @@ ath11k_wmi_copy_peer_flags(struct wmi_pe +@@ -1764,7 +1764,7 @@ ath11k_wmi_copy_peer_flags(struct wmi_pe cmd->peer_flags |= WMI_PEER_AUTH; if (param->need_ptk_4_way) { cmd->peer_flags |= WMI_PEER_NEED_PTK_4_WAY; diff --git a/package/kernel/mac80211/patches/ath11k/0066-ath11k-Send-PPDU_STATS_CFG-with-proper-pdev-mask-to-.patch b/package/kernel/mac80211/patches/ath11k/0066-ath11k-Send-PPDU_STATS_CFG-with-proper-pdev-mask-to-.patch deleted file mode 100644 index 5e47e5b8b..000000000 --- a/package/kernel/mac80211/patches/ath11k/0066-ath11k-Send-PPDU_STATS_CFG-with-proper-pdev-mask-to-.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 16a2c3d5406f95ef6139de52669c60a39443f5f7 Mon Sep 17 00:00:00 2001 -From: Rameshkumar Sundaram -Date: Wed, 10 Nov 2021 17:10:48 +0200 -Subject: [PATCH 066/120] ath11k: Send PPDU_STATS_CFG with proper pdev mask to - firmware - -HTT_PPDU_STATS_CFG_PDEV_ID bit mask for target FW PPDU stats request message -was set as bit 8 to 15. Bit 8 is reserved for soc stats and pdev id starts from -bit 9. Hence change the bitmask as bit 9 to 15 and fill the proper pdev id in -the request message. - -In commit 701e48a43e15 ("ath11k: add packet log support for QCA6390"), both -HTT_PPDU_STATS_CFG_PDEV_ID and pdev_mask were changed, but this pdev_mask -calculation is not valid for platforms which has multiple pdevs with 1 rxdma -per pdev, as this is writing same value(i.e. 2) for all pdevs. Hence fixed it -to consider pdev_idx as well, to make it compatible for both single and multi -pd cases. - -Tested on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01092-QCAHKSWPL_SILICONZ-1 -Tested on: IPQ6018 hw1.0 WLAN.HK.2.5.0.1-01067-QCAHKSWPL_SILICONZ-1 - -Fixes: 701e48a43e15 ("ath11k: add packet log support for QCA6390") - -Co-developed-by: Sathishkumar Muruganandam -Signed-off-by: Sathishkumar Muruganandam -Signed-off-by: Rameshkumar Sundaram -Signed-off-by: Jouni Malinen -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20210721212029.142388-10-jouni@codeaurora.org ---- - drivers/net/wireless/ath/ath11k/dp.h | 3 ++- - drivers/net/wireless/ath/ath11k/dp_tx.c | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp.h -+++ b/drivers/net/wireless/ath/ath11k/dp.h -@@ -517,7 +517,8 @@ struct htt_ppdu_stats_cfg_cmd { - } __packed; - - #define HTT_PPDU_STATS_CFG_MSG_TYPE GENMASK(7, 0) --#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 8) -+#define HTT_PPDU_STATS_CFG_SOC_STATS BIT(8) -+#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 9) - #define HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK GENMASK(31, 16) - - enum htt_ppdu_stats_tag_type { ---- a/drivers/net/wireless/ath/ath11k/dp_tx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -903,7 +903,7 @@ int ath11k_dp_tx_htt_h2t_ppdu_stats_req( - cmd->msg = FIELD_PREP(HTT_PPDU_STATS_CFG_MSG_TYPE, - HTT_H2T_MSG_TYPE_PPDU_STATS_CFG); - -- pdev_mask = 1 << (i + 1); -+ pdev_mask = 1 << (ar->pdev_idx + i); - cmd->msg |= FIELD_PREP(HTT_PPDU_STATS_CFG_PDEV_ID, pdev_mask); - cmd->msg |= FIELD_PREP(HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK, mask); - diff --git a/package/kernel/mac80211/patches/ath11k/0068-ath11k-fix-fw-crash-due-to-peer-get-authorized-befor.patch b/package/kernel/mac80211/patches/ath11k/0067-ath11k-fix-fw-crash-due-to-peer-get-authorized-befor.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0068-ath11k-fix-fw-crash-due-to-peer-get-authorized-befor.patch rename to package/kernel/mac80211/patches/ath11k/0067-ath11k-fix-fw-crash-due-to-peer-get-authorized-befor.patch index bf769451d..5413ae8e6 100644 --- a/package/kernel/mac80211/patches/ath11k/0068-ath11k-fix-fw-crash-due-to-peer-get-authorized-befor.patch +++ b/package/kernel/mac80211/patches/ath11k/0067-ath11k-fix-fw-crash-due-to-peer-get-authorized-befor.patch @@ -1,8 +1,8 @@ From 85f36923be47b6990215ad444545a6a85133a0c6 Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Fri, 12 Nov 2021 10:03:40 +0200 -Subject: [PATCH 068/120] ath11k: fix fw crash due to peer get authorized - before key install +Subject: [PATCH] ath11k: fix fw crash due to peer get authorized before key + install Firmware expects host to authorize the peer after the successful key install. But host authorize the peer before the key install, this trigger @@ -28,7 +28,7 @@ Link: https://lore.kernel.org/r/1636554200-12345-1-git-send-email-quic_periyasa@ --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -2474,6 +2474,8 @@ static void ath11k_bss_assoc(struct ieee +@@ -2479,6 +2479,8 @@ static void ath11k_bss_assoc(struct ieee struct ath11k_vif *arvif = (void *)vif->drv_priv; struct peer_assoc_params peer_arg; struct ieee80211_sta *ap_sta; @@ -37,7 +37,7 @@ Link: https://lore.kernel.org/r/1636554200-12345-1-git-send-email-quic_periyasa@ int ret; lockdep_assert_held(&ar->conf_mutex); -@@ -2536,13 +2538,22 @@ static void ath11k_bss_assoc(struct ieee +@@ -2541,13 +2543,22 @@ static void ath11k_bss_assoc(struct ieee "mac vdev %d up (associated) bssid %pM aid %d\n", arvif->vdev_id, bss_conf->bssid, bss_conf->aid); @@ -67,7 +67,7 @@ Link: https://lore.kernel.org/r/1636554200-12345-1-git-send-email-quic_periyasa@ ret = ath11k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id, &bss_conf->he_obss_pd); -@@ -4221,6 +4232,34 @@ static int ath11k_mac_op_sta_state(struc +@@ -4227,6 +4238,34 @@ static int ath11k_mac_op_sta_state(struc ath11k_warn(ar->ab, "Failed to associate station: %pM\n", sta->addr); } else if (old_state == IEEE80211_STA_ASSOC && diff --git a/package/kernel/mac80211/patches/ath11k/0069-ath11k-fix-error-routine-when-fallback-of-add-interf.patch b/package/kernel/mac80211/patches/ath11k/0068-ath11k-fix-error-routine-when-fallback-of-add-interf.patch similarity index 91% rename from package/kernel/mac80211/patches/ath11k/0069-ath11k-fix-error-routine-when-fallback-of-add-interf.patch rename to package/kernel/mac80211/patches/ath11k/0068-ath11k-fix-error-routine-when-fallback-of-add-interf.patch index ee9e34f08..b9e95c6d2 100644 --- a/package/kernel/mac80211/patches/ath11k/0069-ath11k-fix-error-routine-when-fallback-of-add-interf.patch +++ b/package/kernel/mac80211/patches/ath11k/0068-ath11k-fix-error-routine-when-fallback-of-add-interf.patch @@ -1,8 +1,8 @@ From 4ea03443ecdac6920eb7aa3a9da2cd0b8cc6dfc8 Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Wed, 10 Nov 2021 21:05:57 +0530 -Subject: [PATCH 069/120] ath11k: fix error routine when fallback of add - interface fails +Subject: [PATCH] ath11k: fix error routine when fallback of add interface + fails When there is an error in add interface process from ath11k_mac_set_kickout(), the code attempts to handle a @@ -25,7 +25,7 @@ Link: https://lore.kernel.org/r/1636558557-2874-1-git-send-email-quic_periyasa@q --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5613,7 +5613,7 @@ static int ath11k_mac_op_add_interface(s +@@ -5623,7 +5623,7 @@ static int ath11k_mac_op_add_interface(s u32 param_id, param_value; u16 nss; int i; @@ -34,7 +34,7 @@ Link: https://lore.kernel.org/r/1636558557-2874-1-git-send-email-quic_periyasa@q int bit; vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD; -@@ -5816,17 +5816,17 @@ err_peer_del: +@@ -5826,17 +5826,17 @@ err_peer_del: if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { reinit_completion(&ar->peer_delete_done); diff --git a/package/kernel/mac80211/patches/ath11k/0070-ath11k-avoid-unnecessary-BH-disable-lock-in-STA-kick.patch b/package/kernel/mac80211/patches/ath11k/0069-ath11k-avoid-unnecessary-BH-disable-lock-in-STA-kick.patch similarity index 86% rename from package/kernel/mac80211/patches/ath11k/0070-ath11k-avoid-unnecessary-BH-disable-lock-in-STA-kick.patch rename to package/kernel/mac80211/patches/ath11k/0069-ath11k-avoid-unnecessary-BH-disable-lock-in-STA-kick.patch index 5b678876b..cf9adcada 100644 --- a/package/kernel/mac80211/patches/ath11k/0070-ath11k-avoid-unnecessary-BH-disable-lock-in-STA-kick.patch +++ b/package/kernel/mac80211/patches/ath11k/0069-ath11k-avoid-unnecessary-BH-disable-lock-in-STA-kick.patch @@ -1,8 +1,8 @@ From 4c375743c5fe1ef84d1dd7269dd12585957f403e Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Wed, 10 Nov 2021 21:36:28 +0530 -Subject: [PATCH 070/120] ath11k: avoid unnecessary BH disable lock in STA - kickout event +Subject: [PATCH] ath11k: avoid unnecessary BH disable lock in STA kickout + event In STA kickout event processing, the peer object is protected under spin lock BH. Release this lock after picking up the vdev_id @@ -22,7 +22,7 @@ Link: https://lore.kernel.org/r/1636560388-24955-1-git-send-email-quic_periyasa@ --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -6399,6 +6399,7 @@ static void ath11k_peer_sta_kickout_even +@@ -6400,6 +6400,7 @@ static void ath11k_peer_sta_kickout_even struct ieee80211_sta *sta; struct ath11k_peer *peer; struct ath11k *ar; @@ -30,7 +30,7 @@ Link: https://lore.kernel.org/r/1636560388-24955-1-git-send-email-quic_periyasa@ if (ath11k_pull_peer_sta_kickout_ev(ab, skb, &arg) != 0) { ath11k_warn(ab, "failed to extract peer sta kickout event"); -@@ -6414,10 +6415,15 @@ static void ath11k_peer_sta_kickout_even +@@ -6415,10 +6416,15 @@ static void ath11k_peer_sta_kickout_even if (!peer) { ath11k_warn(ab, "peer not found %pM\n", arg.mac_addr); @@ -47,7 +47,7 @@ Link: https://lore.kernel.org/r/1636560388-24955-1-git-send-email-quic_periyasa@ if (!ar) { ath11k_warn(ab, "invalid vdev id in peer sta kickout ev %d", peer->vdev_id); -@@ -6438,7 +6444,6 @@ static void ath11k_peer_sta_kickout_even +@@ -6439,7 +6445,6 @@ static void ath11k_peer_sta_kickout_even ieee80211_report_low_ack(sta, 10); exit: diff --git a/package/kernel/mac80211/patches/ath11k/0071-ath11k-fix-DMA-memory-free-in-CE-pipe-cleanup.patch b/package/kernel/mac80211/patches/ath11k/0070-ath11k-fix-DMA-memory-free-in-CE-pipe-cleanup.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0071-ath11k-fix-DMA-memory-free-in-CE-pipe-cleanup.patch rename to package/kernel/mac80211/patches/ath11k/0070-ath11k-fix-DMA-memory-free-in-CE-pipe-cleanup.patch index 6935ca196..8fceae59a 100644 --- a/package/kernel/mac80211/patches/ath11k/0071-ath11k-fix-DMA-memory-free-in-CE-pipe-cleanup.patch +++ b/package/kernel/mac80211/patches/ath11k/0070-ath11k-fix-DMA-memory-free-in-CE-pipe-cleanup.patch @@ -1,7 +1,7 @@ From 31aeaf547d7e3b64ba5d5442dabc530bdb9e216e Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Wed, 10 Nov 2021 21:51:30 +0530 -Subject: [PATCH 071/120] ath11k: fix DMA memory free in CE pipe cleanup +Subject: [PATCH] ath11k: fix DMA memory free in CE pipe cleanup In CE pipe cleanup, DMA memory gets freed by the aligned address (base_addr_owner_space) which is wrong. It needs to be freed diff --git a/package/kernel/mac80211/patches/ath11k/0072-ath11k-Fix-unused-but-set-parameter-error.patch b/package/kernel/mac80211/patches/ath11k/0071-ath11k-Fix-unused-but-set-parameter-error.patch similarity index 88% rename from package/kernel/mac80211/patches/ath11k/0072-ath11k-Fix-unused-but-set-parameter-error.patch rename to package/kernel/mac80211/patches/ath11k/0071-ath11k-Fix-unused-but-set-parameter-error.patch index 64718079d..7fb7011df 100644 --- a/package/kernel/mac80211/patches/ath11k/0072-ath11k-Fix-unused-but-set-parameter-error.patch +++ b/package/kernel/mac80211/patches/ath11k/0071-ath11k-Fix-unused-but-set-parameter-error.patch @@ -1,7 +1,7 @@ From 624e0a3170309eeb5b729f7a43c1ba3234325f02 Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Thu, 11 Nov 2021 11:22:47 +0530 -Subject: [PATCH 072/120] ath11k: Fix 'unused-but-set-parameter' error +Subject: [PATCH] ath11k: Fix 'unused-but-set-parameter' error Below compilation error is reported when built with W=1, @@ -20,7 +20,7 @@ Link: https://lore.kernel.org/r/1636609967-5114-1-git-send-email-quic_seevalam@q --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5961,7 +5961,6 @@ static void ath11k_mac_op_configure_filt +@@ -5971,7 +5971,6 @@ static void ath11k_mac_op_configure_filt mutex_lock(&ar->conf_mutex); diff --git a/package/kernel/mac80211/patches/ath11k/0073-ath11k-fix-firmware-crash-during-channel-switch.patch b/package/kernel/mac80211/patches/ath11k/0072-ath11k-fix-firmware-crash-during-channel-switch.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0073-ath11k-fix-firmware-crash-during-channel-switch.patch rename to package/kernel/mac80211/patches/ath11k/0072-ath11k-fix-firmware-crash-during-channel-switch.patch index 3a13edf46..02c3314b3 100644 --- a/package/kernel/mac80211/patches/ath11k/0073-ath11k-fix-firmware-crash-during-channel-switch.patch +++ b/package/kernel/mac80211/patches/ath11k/0072-ath11k-fix-firmware-crash-during-channel-switch.patch @@ -1,7 +1,7 @@ From f187fe8e3bc65cc4d7b0916947e2d6cd65d9cd3a Mon Sep 17 00:00:00 2001 From: Venkateswara Naralasetty Date: Thu, 11 Nov 2021 20:50:02 +0530 -Subject: [PATCH 073/120] ath11k: fix firmware crash during channel switch +Subject: [PATCH] ath11k: fix firmware crash during channel switch Currently the updated bandwidth for the peer will be configured to the firmware after channel switch from the sta_rc_update_wk. @@ -30,7 +30,7 @@ Link: https://lore.kernel.org/r/1636644002-25446-1-git-send-email-quic_vnaralas@ --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3924,11 +3924,27 @@ static void ath11k_sta_rc_update_wk(stru +@@ -3930,11 +3930,27 @@ static void ath11k_sta_rc_update_wk(stru ath11k_mac_max_he_nss(he_mcs_mask))); if (changed & IEEE80211_RC_BW_CHANGED) { diff --git a/package/kernel/mac80211/patches/ath11k/0074-ath11k-disable-unused-CE8-interrupts-for-ipq8074.patch b/package/kernel/mac80211/patches/ath11k/0073-ath11k-disable-unused-CE8-interrupts-for-ipq8074.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0074-ath11k-disable-unused-CE8-interrupts-for-ipq8074.patch rename to package/kernel/mac80211/patches/ath11k/0073-ath11k-disable-unused-CE8-interrupts-for-ipq8074.patch index 95de36d6a..f05e91cad 100644 --- a/package/kernel/mac80211/patches/ath11k/0074-ath11k-disable-unused-CE8-interrupts-for-ipq8074.patch +++ b/package/kernel/mac80211/patches/ath11k/0073-ath11k-disable-unused-CE8-interrupts-for-ipq8074.patch @@ -1,7 +1,7 @@ From 2c5545bfa29dd5305fa770959890a23ea39b5e69 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:01:18 +0200 -Subject: [PATCH 074/120] ath11k: disable unused CE8 interrupts for ipq8074 +Subject: [PATCH] ath11k: disable unused CE8 interrupts for ipq8074 Host driver doesn't need to process CE8 interrupts (used by target independently) diff --git a/package/kernel/mac80211/patches/ath11k/0075-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch b/package/kernel/mac80211/patches/ath11k/0074-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0075-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch rename to package/kernel/mac80211/patches/ath11k/0074-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch index fa6c6a28e..ea2c35daa 100644 --- a/package/kernel/mac80211/patches/ath11k/0075-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch +++ b/package/kernel/mac80211/patches/ath11k/0074-ath11k-allocate-dst-ring-descriptors-from-cacheable-.patch @@ -1,8 +1,7 @@ From 6452f0a3d5651bb7edfd9c709e78973aaa4d3bfc Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:01:26 +0200 -Subject: [PATCH 075/120] ath11k: allocate dst ring descriptors from cacheable - memory +Subject: [PATCH] ath11k: allocate dst ring descriptors from cacheable memory tcl_data and reo_dst rings are currently being allocated using dma_allocate_coherent() which is non cacheable. diff --git a/package/kernel/mac80211/patches/ath11k/0076-ath11k-modify-dp_rx-desc-access-wrapper-calls-inline.patch b/package/kernel/mac80211/patches/ath11k/0075-ath11k-modify-dp_rx-desc-access-wrapper-calls-inline.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0076-ath11k-modify-dp_rx-desc-access-wrapper-calls-inline.patch rename to package/kernel/mac80211/patches/ath11k/0075-ath11k-modify-dp_rx-desc-access-wrapper-calls-inline.patch index cacf6c6a1..9a610f9b8 100644 --- a/package/kernel/mac80211/patches/ath11k/0076-ath11k-modify-dp_rx-desc-access-wrapper-calls-inline.patch +++ b/package/kernel/mac80211/patches/ath11k/0075-ath11k-modify-dp_rx-desc-access-wrapper-calls-inline.patch @@ -1,7 +1,7 @@ From 5e76fe03dbf9f9dbc4fd454283b02594226c0718 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:02:03 +0200 -Subject: [PATCH 076/120] ath11k: modify dp_rx desc access wrapper calls inline +Subject: [PATCH] ath11k: modify dp_rx desc access wrapper calls inline In data path, to reduce the CPU cycles spending on descriptor access wrapper function, changed those functions as static inline. diff --git a/package/kernel/mac80211/patches/ath11k/0077-ath11k-avoid-additional-access-to-ath11k_hal_srng_ds.patch b/package/kernel/mac80211/patches/ath11k/0076-ath11k-avoid-additional-access-to-ath11k_hal_srng_ds.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0077-ath11k-avoid-additional-access-to-ath11k_hal_srng_ds.patch rename to package/kernel/mac80211/patches/ath11k/0076-ath11k-avoid-additional-access-to-ath11k_hal_srng_ds.patch index 78b3b67e6..d8a5b30eb 100644 --- a/package/kernel/mac80211/patches/ath11k/0077-ath11k-avoid-additional-access-to-ath11k_hal_srng_ds.patch +++ b/package/kernel/mac80211/patches/ath11k/0076-ath11k-avoid-additional-access-to-ath11k_hal_srng_ds.patch @@ -1,7 +1,7 @@ From a1775e732eb90486519de3813b83a11b7fcee2d0 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:02:12 +0200 -Subject: [PATCH 077/120] ath11k: avoid additional access to +Subject: [PATCH] ath11k: avoid additional access to ath11k_hal_srng_dst_num_free In ath11k_dp_process_rx(), after processing rx_desc from diff --git a/package/kernel/mac80211/patches/ath11k/0078-ath11k-avoid-active-pdev-check-for-each-msdu.patch b/package/kernel/mac80211/patches/ath11k/0077-ath11k-avoid-active-pdev-check-for-each-msdu.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0078-ath11k-avoid-active-pdev-check-for-each-msdu.patch rename to package/kernel/mac80211/patches/ath11k/0077-ath11k-avoid-active-pdev-check-for-each-msdu.patch index 91755c095..16ca89400 100644 --- a/package/kernel/mac80211/patches/ath11k/0078-ath11k-avoid-active-pdev-check-for-each-msdu.patch +++ b/package/kernel/mac80211/patches/ath11k/0077-ath11k-avoid-active-pdev-check-for-each-msdu.patch @@ -1,7 +1,7 @@ From c4d12cb37ea2e6c2b70880350d7bf1bbbd825c6c Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:02:18 +0200 -Subject: [PATCH 078/120] ath11k: avoid active pdev check for each msdu +Subject: [PATCH] ath11k: avoid active pdev check for each msdu The Active Pdev and CAC check are done for each msdu in ath11k_dp_rx_process_received_packets which is a overhead. diff --git a/package/kernel/mac80211/patches/ath11k/0079-ath11k-remove-usage-quota-while-processing-rx-packet.patch b/package/kernel/mac80211/patches/ath11k/0078-ath11k-remove-usage-quota-while-processing-rx-packet.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0079-ath11k-remove-usage-quota-while-processing-rx-packet.patch rename to package/kernel/mac80211/patches/ath11k/0078-ath11k-remove-usage-quota-while-processing-rx-packet.patch index d03576068..80a610349 100644 --- a/package/kernel/mac80211/patches/ath11k/0079-ath11k-remove-usage-quota-while-processing-rx-packet.patch +++ b/package/kernel/mac80211/patches/ath11k/0078-ath11k-remove-usage-quota-while-processing-rx-packet.patch @@ -1,8 +1,7 @@ From db2ecf9f0567a8f1a96f23a392cc5a30eaec4369 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:02:24 +0200 -Subject: [PATCH 079/120] ath11k: remove usage quota while processing rx - packets +Subject: [PATCH] ath11k: remove usage quota while processing rx packets The usage of quota variable inside ath11k_dp_rx_process_received_packets() is redundant. Since we would queue only max packets to the list before diff --git a/package/kernel/mac80211/patches/ath11k/0080-ath11k-add-branch-predictors-in-process_rx.patch b/package/kernel/mac80211/patches/ath11k/0079-ath11k-add-branch-predictors-in-process_rx.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0080-ath11k-add-branch-predictors-in-process_rx.patch rename to package/kernel/mac80211/patches/ath11k/0079-ath11k-add-branch-predictors-in-process_rx.patch index 8c9721b8c..ca2c55540 100644 --- a/package/kernel/mac80211/patches/ath11k/0080-ath11k-add-branch-predictors-in-process_rx.patch +++ b/package/kernel/mac80211/patches/ath11k/0079-ath11k-add-branch-predictors-in-process_rx.patch @@ -1,7 +1,7 @@ From 400588039a17a460292eb974ebba5811b8cbdb91 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:02:31 +0200 -Subject: [PATCH 080/120] ath11k: add branch predictors in process_rx +Subject: [PATCH] ath11k: add branch predictors in process_rx In datapath, add branch predictors where required in the process rx(). This protects high value rx path without having performance overhead. diff --git a/package/kernel/mac80211/patches/ath11k/0081-ath11k-allocate-HAL_WBM2SW_RELEASE-ring-from-cacheab.patch b/package/kernel/mac80211/patches/ath11k/0080-ath11k-allocate-HAL_WBM2SW_RELEASE-ring-from-cacheab.patch similarity index 92% rename from package/kernel/mac80211/patches/ath11k/0081-ath11k-allocate-HAL_WBM2SW_RELEASE-ring-from-cacheab.patch rename to package/kernel/mac80211/patches/ath11k/0080-ath11k-allocate-HAL_WBM2SW_RELEASE-ring-from-cacheab.patch index c18ee151b..f1c0513cf 100644 --- a/package/kernel/mac80211/patches/ath11k/0081-ath11k-allocate-HAL_WBM2SW_RELEASE-ring-from-cacheab.patch +++ b/package/kernel/mac80211/patches/ath11k/0080-ath11k-allocate-HAL_WBM2SW_RELEASE-ring-from-cacheab.patch @@ -1,8 +1,8 @@ From d0e2523bfa9cb391fe966b0b6948c7e438981361 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:02:38 +0200 -Subject: [PATCH 081/120] ath11k: allocate HAL_WBM2SW_RELEASE ring from - cacheable memory +Subject: [PATCH] ath11k: allocate HAL_WBM2SW_RELEASE ring from cacheable + memory Similar to REO destination ring, also allocate HAL_WBM2SW_RELEASE from cacheable memory so that descriptors could be prefetched during diff --git a/package/kernel/mac80211/patches/ath11k/0082-ath11k-remove-mod-operator-in-dst-ring-processing.patch b/package/kernel/mac80211/patches/ath11k/0081-ath11k-remove-mod-operator-in-dst-ring-processing.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0082-ath11k-remove-mod-operator-in-dst-ring-processing.patch rename to package/kernel/mac80211/patches/ath11k/0081-ath11k-remove-mod-operator-in-dst-ring-processing.patch index 2ac4f55e9..b00a73a1c 100644 --- a/package/kernel/mac80211/patches/ath11k/0082-ath11k-remove-mod-operator-in-dst-ring-processing.patch +++ b/package/kernel/mac80211/patches/ath11k/0081-ath11k-remove-mod-operator-in-dst-ring-processing.patch @@ -1,7 +1,7 @@ From a8508bf7ced2e43f30b46333f09cbc79a1675616 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:02:45 +0200 -Subject: [PATCH 082/120] ath11k: remove mod operator in dst ring processing +Subject: [PATCH] ath11k: remove mod operator in dst ring processing Replace use of mod operator with a manual wrap around to avoid additional cost of using mod operation. diff --git a/package/kernel/mac80211/patches/ath11k/0083-ath11k-avoid-while-loop-in-ring-selection-of-tx-comp.patch b/package/kernel/mac80211/patches/ath11k/0082-ath11k-avoid-while-loop-in-ring-selection-of-tx-comp.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0083-ath11k-avoid-while-loop-in-ring-selection-of-tx-comp.patch rename to package/kernel/mac80211/patches/ath11k/0082-ath11k-avoid-while-loop-in-ring-selection-of-tx-comp.patch index a7ee498fc..dae9e00c3 100644 --- a/package/kernel/mac80211/patches/ath11k/0083-ath11k-avoid-while-loop-in-ring-selection-of-tx-comp.patch +++ b/package/kernel/mac80211/patches/ath11k/0082-ath11k-avoid-while-loop-in-ring-selection-of-tx-comp.patch @@ -1,8 +1,8 @@ From cbfbed495d3289d5a0bc7c614cea639008086cfe Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:05:58 +0200 -Subject: [PATCH 083/120] ath11k: avoid while loop in ring selection of tx - completion interrupt +Subject: [PATCH] ath11k: avoid while loop in ring selection of tx completion + interrupt Currently while loop is used to find the tx completion ring number and it is not required since the tx ring mask and the group id can be combined diff --git a/package/kernel/mac80211/patches/ath11k/0084-ath11k-add-branch-predictors-in-dp_tx-path.patch b/package/kernel/mac80211/patches/ath11k/0083-ath11k-add-branch-predictors-in-dp_tx-path.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0084-ath11k-add-branch-predictors-in-dp_tx-path.patch rename to package/kernel/mac80211/patches/ath11k/0083-ath11k-add-branch-predictors-in-dp_tx-path.patch index d86d464e2..e09322f8a 100644 --- a/package/kernel/mac80211/patches/ath11k/0084-ath11k-add-branch-predictors-in-dp_tx-path.patch +++ b/package/kernel/mac80211/patches/ath11k/0083-ath11k-add-branch-predictors-in-dp_tx-path.patch @@ -1,7 +1,7 @@ From bcef57ea400cc20a5389fa0e38d61063331558f8 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:06:04 +0200 -Subject: [PATCH 084/120] ath11k: add branch predictors in dp_tx path +Subject: [PATCH] ath11k: add branch predictors in dp_tx path Add branch prediction in dp_tx code path in tx and tx completion handlers. Also in ath11k_dp_tx_complete_msdu , the pointer that is returned by @@ -190,7 +190,7 @@ Link: https://lore.kernel.org/r/1630560820-21905-12-git-send-email-ppranees@code spin_unlock_bh(&tx_ring->tx_idr_lock); --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5283,7 +5283,7 @@ static void ath11k_mac_op_tx(struct ieee +@@ -5293,7 +5293,7 @@ static void ath11k_mac_op_tx(struct ieee arsta = (struct ath11k_sta *)control->sta->drv_priv; ret = ath11k_dp_tx(ar, arvif, arsta, skb); diff --git a/package/kernel/mac80211/patches/ath11k/0085-ath11k-avoid-unnecessary-lock-contention-in-tx_compl.patch b/package/kernel/mac80211/patches/ath11k/0084-ath11k-avoid-unnecessary-lock-contention-in-tx_compl.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0085-ath11k-avoid-unnecessary-lock-contention-in-tx_compl.patch rename to package/kernel/mac80211/patches/ath11k/0084-ath11k-avoid-unnecessary-lock-contention-in-tx_compl.patch index c38c0f563..7eb791212 100644 --- a/package/kernel/mac80211/patches/ath11k/0085-ath11k-avoid-unnecessary-lock-contention-in-tx_compl.patch +++ b/package/kernel/mac80211/patches/ath11k/0084-ath11k-avoid-unnecessary-lock-contention-in-tx_compl.patch @@ -1,8 +1,8 @@ From be8867cb47652418e488170785bd9ffbadae3f1f Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Fri, 12 Nov 2021 11:06:11 +0200 -Subject: [PATCH 085/120] ath11k: avoid unnecessary lock contention in - tx_completion path +Subject: [PATCH] ath11k: avoid unnecessary lock contention in tx_completion + path Avoid unnecessary idr_find calls before the idr_remove calls. Because idr_remove gives the valid ptr if id is valid otherwise return NULL ptr. diff --git a/package/kernel/mac80211/patches/ath11k/0086-ath11k-enable-IEEE80211_VHT_EXT_NSS_BW_CAPABLE-if-NS.patch b/package/kernel/mac80211/patches/ath11k/0085-ath11k-enable-IEEE80211_VHT_EXT_NSS_BW_CAPABLE-if-NS.patch similarity index 91% rename from package/kernel/mac80211/patches/ath11k/0086-ath11k-enable-IEEE80211_VHT_EXT_NSS_BW_CAPABLE-if-NS.patch rename to package/kernel/mac80211/patches/ath11k/0085-ath11k-enable-IEEE80211_VHT_EXT_NSS_BW_CAPABLE-if-NS.patch index 800a8f838..036779d5d 100644 --- a/package/kernel/mac80211/patches/ath11k/0086-ath11k-enable-IEEE80211_VHT_EXT_NSS_BW_CAPABLE-if-NS.patch +++ b/package/kernel/mac80211/patches/ath11k/0085-ath11k-enable-IEEE80211_VHT_EXT_NSS_BW_CAPABLE-if-NS.patch @@ -1,8 +1,8 @@ From 78406044bdd0cc8987bc082b76867c63ab1c6af8 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Wed, 13 Oct 2021 03:37:04 -0400 -Subject: [PATCH 086/120] ath11k: enable IEEE80211_VHT_EXT_NSS_BW_CAPABLE if - NSS ratio enabled +Subject: [PATCH] ath11k: enable IEEE80211_VHT_EXT_NSS_BW_CAPABLE if NSS ratio + enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -35,7 +35,7 @@ Link: https://lore.kernel.org/r/20211013073704.15888-1-wgong@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -4706,6 +4706,10 @@ ath11k_create_vht_cap(struct ath11k *ar, +@@ -4712,6 +4712,10 @@ ath11k_create_vht_cap(struct ath11k *ar, vht_cap.vht_supported = 1; vht_cap.cap = ar->pdev->cap.vht_cap; diff --git a/package/kernel/mac80211/patches/ath11k/0087-ath11k-remove-return-for-empty-tx-bitrate-in-mac_op_.patch b/package/kernel/mac80211/patches/ath11k/0086-ath11k-remove-return-for-empty-tx-bitrate-in-mac_op_.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0087-ath11k-remove-return-for-empty-tx-bitrate-in-mac_op_.patch rename to package/kernel/mac80211/patches/ath11k/0086-ath11k-remove-return-for-empty-tx-bitrate-in-mac_op_.patch index 5a52481f3..69991617f 100644 --- a/package/kernel/mac80211/patches/ath11k/0087-ath11k-remove-return-for-empty-tx-bitrate-in-mac_op_.patch +++ b/package/kernel/mac80211/patches/ath11k/0086-ath11k-remove-return-for-empty-tx-bitrate-in-mac_op_.patch @@ -1,7 +1,7 @@ From 1d795645e1eef97fe5d409e3dd5747a942f00e08 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 11 Oct 2021 04:49:57 -0400 -Subject: [PATCH 087/120] ath11k: remove return for empty tx bitrate in +Subject: [PATCH] ath11k: remove return for empty tx bitrate in mac_op_sta_statistics Currently in ath11k_mac_op_sta_statistics() there is the following @@ -29,7 +29,7 @@ Link: https://lore.kernel.org/r/20211011084957.31024-1-wgong@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -7426,21 +7426,20 @@ static void ath11k_mac_op_sta_statistics +@@ -7436,21 +7436,20 @@ static void ath11k_mac_op_sta_statistics sinfo->tx_duration = arsta->tx_duration; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_DURATION); diff --git a/package/kernel/mac80211/patches/ath11k/0088-ath11k-fix-the-value-of-msecs_to_jiffies-in-ath11k_d.patch b/package/kernel/mac80211/patches/ath11k/0087-ath11k-fix-the-value-of-msecs_to_jiffies-in-ath11k_d.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0088-ath11k-fix-the-value-of-msecs_to_jiffies-in-ath11k_d.patch rename to package/kernel/mac80211/patches/ath11k/0087-ath11k-fix-the-value-of-msecs_to_jiffies-in-ath11k_d.patch index 4c48cd3f6..de1e350a2 100644 --- a/package/kernel/mac80211/patches/ath11k/0088-ath11k-fix-the-value-of-msecs_to_jiffies-in-ath11k_d.patch +++ b/package/kernel/mac80211/patches/ath11k/0087-ath11k-fix-the-value-of-msecs_to_jiffies-in-ath11k_d.patch @@ -1,7 +1,7 @@ From c8f2d41bbff6794329d681d108a817366aed0ba7 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 25 Oct 2021 23:20:14 -0400 -Subject: [PATCH 088/120] ath11k: fix the value of msecs_to_jiffies in +Subject: [PATCH] ath11k: fix the value of msecs_to_jiffies in ath11k_debugfs_fw_stats_request parameter of msecs_to_jiffies should be (3 * 1000) instead of (3 * HZ) diff --git a/package/kernel/mac80211/patches/ath11k/0089-ath11k-move-peer-delete-after-vdev-stop-of-station-f.patch b/package/kernel/mac80211/patches/ath11k/0088-ath11k-move-peer-delete-after-vdev-stop-of-station-f.patch similarity index 91% rename from package/kernel/mac80211/patches/ath11k/0089-ath11k-move-peer-delete-after-vdev-stop-of-station-f.patch rename to package/kernel/mac80211/patches/ath11k/0088-ath11k-move-peer-delete-after-vdev-stop-of-station-f.patch index 3f103c4eb..2cbc69a4a 100644 --- a/package/kernel/mac80211/patches/ath11k/0089-ath11k-move-peer-delete-after-vdev-stop-of-station-f.patch +++ b/package/kernel/mac80211/patches/ath11k/0088-ath11k-move-peer-delete-after-vdev-stop-of-station-f.patch @@ -1,8 +1,8 @@ From b4a0f54156ac7720de1750b6ea06657c91c52163 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Wed, 27 Oct 2021 05:38:25 -0400 -Subject: [PATCH 089/120] ath11k: move peer delete after vdev stop of station - for QCA6390 and WCN6855 +Subject: [PATCH] ath11k: move peer delete after vdev stop of station for + QCA6390 and WCN6855 When station connect to AP, the wmi command sequence is: @@ -48,7 +48,7 @@ Link: https://lore.kernel.org/r/20211027093825.12167-1-quic_wgong@quicinc.com --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -4212,6 +4212,10 @@ static int ath11k_mac_op_sta_state(struc +@@ -4218,6 +4218,10 @@ static int ath11k_mac_op_sta_state(struc new_state == IEEE80211_STA_NOTEXIST)) { ath11k_dp_peer_cleanup(ar, arvif->vdev_id, sta->addr); @@ -59,7 +59,7 @@ Link: https://lore.kernel.org/r/20211027093825.12167-1-quic_wgong@quicinc.com ret = ath11k_peer_delete(ar, arvif->vdev_id, sta->addr); if (ret) ath11k_warn(ar->ab, "Failed to delete peer: %pM for VDEV: %d\n", -@@ -4233,6 +4237,7 @@ static int ath11k_mac_op_sta_state(struc +@@ -4239,6 +4243,7 @@ static int ath11k_mac_op_sta_state(struc } spin_unlock_bh(&ar->ab->base_lock); @@ -67,7 +67,7 @@ Link: https://lore.kernel.org/r/20211027093825.12167-1-quic_wgong@quicinc.com kfree(arsta->tx_stats); arsta->tx_stats = NULL; -@@ -6617,6 +6622,19 @@ ath11k_mac_op_unassign_vif_chanctx(struc +@@ -6627,6 +6632,19 @@ ath11k_mac_op_unassign_vif_chanctx(struc arvif->is_started = false; if (ab->hw_params.vdev_start_delay && diff --git a/package/kernel/mac80211/patches/ath11k/0090-ath11k-fix-FCS_ERR-flag-in-radio-tap-header.patch b/package/kernel/mac80211/patches/ath11k/0089-ath11k-fix-FCS_ERR-flag-in-radio-tap-header.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0090-ath11k-fix-FCS_ERR-flag-in-radio-tap-header.patch rename to package/kernel/mac80211/patches/ath11k/0089-ath11k-fix-FCS_ERR-flag-in-radio-tap-header.patch index f966564e0..6fe0ffdc9 100644 --- a/package/kernel/mac80211/patches/ath11k/0090-ath11k-fix-FCS_ERR-flag-in-radio-tap-header.patch +++ b/package/kernel/mac80211/patches/ath11k/0089-ath11k-fix-FCS_ERR-flag-in-radio-tap-header.patch @@ -1,7 +1,7 @@ From 787264893c69ed091a46335dfd0f50dabb457718 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Mon, 25 Oct 2021 17:44:20 +0530 -Subject: [PATCH 090/120] ath11k: fix FCS_ERR flag in radio tap header +Subject: [PATCH] ath11k: fix FCS_ERR flag in radio tap header In radio tap header, BAD FCS flag is not updated properly because driver failed to update FCS_ERR flag in monitor mode. diff --git a/package/kernel/mac80211/patches/ath11k/0091-ath11k-send-proper-txpower-and-maxregpower-values-to.patch b/package/kernel/mac80211/patches/ath11k/0090-ath11k-send-proper-txpower-and-maxregpower-values-to.patch similarity index 90% rename from package/kernel/mac80211/patches/ath11k/0091-ath11k-send-proper-txpower-and-maxregpower-values-to.patch rename to package/kernel/mac80211/patches/ath11k/0090-ath11k-send-proper-txpower-and-maxregpower-values-to.patch index 2372ec485..ef39902d2 100644 --- a/package/kernel/mac80211/patches/ath11k/0091-ath11k-send-proper-txpower-and-maxregpower-values-to.patch +++ b/package/kernel/mac80211/patches/ath11k/0090-ath11k-send-proper-txpower-and-maxregpower-values-to.patch @@ -1,7 +1,7 @@ From 9212c1b9e80a869e732769a4fe7f82d392b219be Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Mon, 25 Oct 2021 17:47:09 +0530 -Subject: [PATCH 091/120] ath11k: send proper txpower and maxregpower values to +Subject: [PATCH] ath11k: send proper txpower and maxregpower values to firmware Set proper values for max_regpower, max_power, max_antenna_gain as it @@ -25,7 +25,7 @@ Link: https://lore.kernel.org/r/1635164229-22880-1-git-send-email-quic_ppranees@ --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -775,9 +775,9 @@ static int ath11k_mac_monitor_vdev_start +@@ -776,9 +776,9 @@ static int ath11k_mac_monitor_vdev_start arg.channel.chan_radar = !!(channel->flags & IEEE80211_CHAN_RADAR); arg.channel.min_power = 0; @@ -38,7 +38,7 @@ Link: https://lore.kernel.org/r/1635164229-22880-1-git-send-email-quic_ppranees@ arg.pref_tx_streams = ar->num_tx_chains; arg.pref_rx_streams = ar->num_rx_chains; -@@ -6123,9 +6123,9 @@ ath11k_mac_vdev_start_restart(struct ath +@@ -6133,9 +6133,9 @@ ath11k_mac_vdev_start_restart(struct ath ath11k_phymodes[chandef->chan->band][chandef->width]; arg.channel.min_power = 0; @@ -53,7 +53,7 @@ Link: https://lore.kernel.org/r/1635164229-22880-1-git-send-email-quic_ppranees@ arg.pref_rx_streams = ar->num_rx_chains; --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -2387,6 +2387,8 @@ int ath11k_wmi_send_scan_chan_list_cmd(s +@@ -2388,6 +2388,8 @@ int ath11k_wmi_send_scan_chan_list_cmd(s tchan_info->reg_class_id); *reg2 |= FIELD_PREP(WMI_CHAN_REG_INFO2_ANT_MAX, tchan_info->antennamax); diff --git a/package/kernel/mac80211/patches/ath11k/0092-ath11k-Increment-pending_mgmt_tx-count-before-tx-sen.patch b/package/kernel/mac80211/patches/ath11k/0091-ath11k-Increment-pending_mgmt_tx-count-before-tx-sen.patch similarity index 91% rename from package/kernel/mac80211/patches/ath11k/0092-ath11k-Increment-pending_mgmt_tx-count-before-tx-sen.patch rename to package/kernel/mac80211/patches/ath11k/0091-ath11k-Increment-pending_mgmt_tx-count-before-tx-sen.patch index 94fa816d6..0788b5d46 100644 --- a/package/kernel/mac80211/patches/ath11k/0092-ath11k-Increment-pending_mgmt_tx-count-before-tx-sen.patch +++ b/package/kernel/mac80211/patches/ath11k/0091-ath11k-Increment-pending_mgmt_tx-count-before-tx-sen.patch @@ -1,8 +1,7 @@ From c0b0d2e87d91ce283c8766b4b3c2ec9ac90ebf96 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Mon, 25 Oct 2021 18:54:42 +0530 -Subject: [PATCH 092/120] ath11k: Increment pending_mgmt_tx count before tx - send invoke +Subject: [PATCH] ath11k: Increment pending_mgmt_tx count before tx send invoke There is a race condition whereby the tx completion handler can be invoked before the 'num_pending_mgmt_tx" count is incremented. If that occurs, we @@ -24,7 +23,7 @@ Link: https://lore.kernel.org/r/1635168282-8845-1-git-send-email-quic_ppranees@q --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5202,13 +5202,15 @@ static void ath11k_mgmt_over_wmi_tx_work +@@ -5212,13 +5212,15 @@ static void ath11k_mgmt_over_wmi_tx_work arvif = ath11k_vif_to_arvif(skb_cb->vif); if (ar->allocated_vdev_map & (1LL << arvif->vdev_id) && arvif->is_started) { diff --git a/package/kernel/mac80211/patches/ath11k/0094-ath11k-Disabling-credit-flow-for-WMI-path.patch b/package/kernel/mac80211/patches/ath11k/0093-ath11k-Disabling-credit-flow-for-WMI-path.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0094-ath11k-Disabling-credit-flow-for-WMI-path.patch rename to package/kernel/mac80211/patches/ath11k/0093-ath11k-Disabling-credit-flow-for-WMI-path.patch index 7ec7a68b1..cd3dce096 100644 --- a/package/kernel/mac80211/patches/ath11k/0094-ath11k-Disabling-credit-flow-for-WMI-path.patch +++ b/package/kernel/mac80211/patches/ath11k/0093-ath11k-Disabling-credit-flow-for-WMI-path.patch @@ -1,7 +1,7 @@ From f951380a6022440335f668f85296096ba13071ba Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Mon, 15 Nov 2021 11:50:52 +0200 -Subject: [PATCH 094/120] ath11k: Disabling credit flow for WMI path +Subject: [PATCH] ath11k: Disabling credit flow for WMI path Firmware credit flow control is enabled for WMI control services, which expects available tokens should be acquired before sending a @@ -448,7 +448,7 @@ Link: https://lore.kernel.org/r/1635156494-20059-1-git-send-email-quic_ppranees@ return ret; } -@@ -5816,7 +5834,30 @@ static void ath11k_wmi_op_ep_tx_credits( +@@ -5817,7 +5835,30 @@ static void ath11k_wmi_op_ep_tx_credits( static void ath11k_wmi_htc_tx_complete(struct ath11k_base *ab, struct sk_buff *skb) { @@ -479,7 +479,7 @@ Link: https://lore.kernel.org/r/1635156494-20059-1-git-send-email-quic_ppranees@ } static bool ath11k_reg_is_world_alpha(char *alpha) -@@ -7207,6 +7248,7 @@ static int ath11k_connect_pdev_htc_servi +@@ -7208,6 +7249,7 @@ static int ath11k_connect_pdev_htc_servi ab->wmi_ab.wmi_endpoint_id[pdev_idx] = conn_resp.eid; ab->wmi_ab.wmi[pdev_idx].eid = conn_resp.eid; ab->wmi_ab.max_msg_len[pdev_idx] = conn_resp.max_msg_len; diff --git a/package/kernel/mac80211/patches/ath11k/0093-ath11k-Fix-ETSI-regd-with-weather-radar-overlap.patch b/package/kernel/mac80211/patches/ath11k/0093-ath11k-Fix-ETSI-regd-with-weather-radar-overlap.patch deleted file mode 100644 index eb9c73022..000000000 --- a/package/kernel/mac80211/patches/ath11k/0093-ath11k-Fix-ETSI-regd-with-weather-radar-overlap.patch +++ /dev/null @@ -1,236 +0,0 @@ -From 086c921a354089f209318501038d43c98d3f409f Mon Sep 17 00:00:00 2001 -From: Sven Eckelmann -Date: Mon, 15 Nov 2021 11:29:55 +0200 -Subject: [PATCH 093/120] ath11k: Fix ETSI regd with weather radar overlap - -Some ETSI countries have a small overlap in the wireless-regdb with an ETSI -channel (5590-5650). A good example is Australia: - - country AU: DFS-ETSI - (2400 - 2483.5 @ 40), (36) - (5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW - (5250 - 5350 @ 80), (20), NO-OUTDOOR, AUTO-BW, DFS - (5470 - 5600 @ 80), (27), DFS - (5650 - 5730 @ 80), (27), DFS - (5730 - 5850 @ 80), (36) - (57000 - 66000 @ 2160), (43), NO-OUTDOOR - -If the firmware (or the BDF) is shipped with these rules then there is only -a 10 MHz overlap with the weather radar: - -* below: 5470 - 5590 -* weather radar: 5590 - 5600 -* above: (none for the rule "5470 - 5600 @ 80") - -There are several wrong assumption in the ath11k code: - -* there is always a valid range below the weather radar - (actually: there could be no range below the weather radar range OR range - could be smaller than 20 MHz) -* intersected range in the weather radar range is valid - (actually: the range could be smaller than 20 MHz) -* range above weather radar is either empty or valid - (actually: the range could be smaller than 20 MHz) - -These wrong assumption will lead in this example to a rule - - (5590 - 5600 @ 20), (N/A, 27), (600000 ms), DFS, AUTO-BW - -which is invalid according to is_valid_reg_rule() because the freq_diff is -only 10 MHz but the max_bandwidth is set to 20 MHz. Which results in a -rejection like: - - WARNING: at backports-20210222_001-4.4.60-b157d2276/net/wireless/reg.c:3984 - [...] - Call trace: - [] reg_get_max_bandwidth+0x300/0x3a8 [cfg80211] - [] regulatory_set_wiphy_regd_sync+0x3c/0x98 [cfg80211] - [] ath11k_regd_update+0x1a8/0x210 [ath11k] - [] ath11k_regd_update_work+0x18/0x20 [ath11k] - [] process_one_work+0x1f8/0x340 - [] worker_thread+0x25c/0x448 - [] kthread+0xd0/0xd8 - [] ret_from_fork+0x10/0x40 - ath11k c000000.wifi: failed to perform regd update : -22 - Invalid regulatory domain detected - -To avoid this, the algorithm has to be changed slightly. Instead of -splitting a rule which overlaps with the weather radar range into 3 pieces -and accepting the first two parts blindly, it must actually be checked for -each piece whether it is a valid range. And only if it is valid, add it to -the output array. - -When these checks are in place, the processed rules for AU would end up as - - country AU: DFS-ETSI - (2400 - 2483 @ 40), (N/A, 36), (N/A) - (5150 - 5250 @ 80), (6, 23), (N/A), NO-OUTDOOR, AUTO-BW - (5250 - 5350 @ 80), (6, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW - (5470 - 5590 @ 80), (6, 27), (0 ms), DFS, AUTO-BW - (5650 - 5730 @ 80), (6, 27), (0 ms), DFS, AUTO-BW - (5730 - 5850 @ 80), (6, 36), (N/A), AUTO-BW - -and will be accepted by the wireless regulatory code. - -Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") -Signed-off-by: Sven Eckelmann -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211112153116.1214421-1-sven@narfation.org ---- - drivers/net/wireless/ath/ath11k/reg.c | 103 ++++++++++++++------------ - 1 file changed, 56 insertions(+), 47 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/reg.c -+++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -456,6 +456,9 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 - { - u16 bw; - -+ if (end_freq <= start_freq) -+ return 0; -+ - bw = end_freq - start_freq; - bw = min_t(u16, bw, max_bw); - -@@ -463,8 +466,10 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 - bw = 80; - else if (bw >= 40 && bw < 80) - bw = 40; -- else if (bw < 40) -+ else if (bw >= 20 && bw < 40) - bw = 20; -+ else -+ bw = 0; - - return bw; - } -@@ -488,73 +493,77 @@ ath11k_reg_update_weather_radar_band(str - struct cur_reg_rule *reg_rule, - u8 *rule_idx, u32 flags, u16 max_bw) - { -+ u32 start_freq; - u32 end_freq; - u16 bw; - u8 i; - - i = *rule_idx; - -+ /* there might be situations when even the input rule must be dropped */ -+ i--; -+ -+ /* frequencies below weather radar */ - bw = ath11k_reg_adjust_bw(reg_rule->start_freq, - ETSI_WEATHER_RADAR_BAND_LOW, max_bw); -+ if (bw > 0) { -+ i++; - -- ath11k_reg_update_rule(regd->reg_rules + i, reg_rule->start_freq, -- ETSI_WEATHER_RADAR_BAND_LOW, bw, -- reg_rule->ant_gain, reg_rule->reg_power, -- flags); -- -- ath11k_dbg(ab, ATH11K_DBG_REG, -- "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -- i + 1, reg_rule->start_freq, ETSI_WEATHER_RADAR_BAND_LOW, -- bw, reg_rule->ant_gain, reg_rule->reg_power, -- regd->reg_rules[i].dfs_cac_ms, -- flags); -- -- if (reg_rule->end_freq > ETSI_WEATHER_RADAR_BAND_HIGH) -- end_freq = ETSI_WEATHER_RADAR_BAND_HIGH; -- else -- end_freq = reg_rule->end_freq; -- -- bw = ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_LOW, end_freq, -- max_bw); -- -- i++; -+ ath11k_reg_update_rule(regd->reg_rules + i, -+ reg_rule->start_freq, -+ ETSI_WEATHER_RADAR_BAND_LOW, bw, -+ reg_rule->ant_gain, reg_rule->reg_power, -+ flags); -+ -+ ath11k_dbg(ab, ATH11K_DBG_REG, -+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -+ i + 1, reg_rule->start_freq, -+ ETSI_WEATHER_RADAR_BAND_LOW, bw, reg_rule->ant_gain, -+ reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms, -+ flags); -+ } - -- ath11k_reg_update_rule(regd->reg_rules + i, -- ETSI_WEATHER_RADAR_BAND_LOW, end_freq, bw, -- reg_rule->ant_gain, reg_rule->reg_power, -- flags); -- -- regd->reg_rules[i].dfs_cac_ms = ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT; -- -- ath11k_dbg(ab, ATH11K_DBG_REG, -- "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -- i + 1, ETSI_WEATHER_RADAR_BAND_LOW, end_freq, -- bw, reg_rule->ant_gain, reg_rule->reg_power, -- regd->reg_rules[i].dfs_cac_ms, -- flags); -- -- if (end_freq == reg_rule->end_freq) { -- regd->n_reg_rules--; -- *rule_idx = i; -- return; -+ /* weather radar frequencies */ -+ start_freq = max_t(u32, reg_rule->start_freq, -+ ETSI_WEATHER_RADAR_BAND_LOW); -+ end_freq = min_t(u32, reg_rule->end_freq, ETSI_WEATHER_RADAR_BAND_HIGH); -+ -+ bw = ath11k_reg_adjust_bw(start_freq, end_freq, max_bw); -+ if (bw > 0) { -+ i++; -+ -+ ath11k_reg_update_rule(regd->reg_rules + i, start_freq, -+ end_freq, bw, reg_rule->ant_gain, -+ reg_rule->reg_power, flags); -+ -+ regd->reg_rules[i].dfs_cac_ms = ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT; -+ -+ ath11k_dbg(ab, ATH11K_DBG_REG, -+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -+ i + 1, start_freq, end_freq, bw, -+ reg_rule->ant_gain, reg_rule->reg_power, -+ regd->reg_rules[i].dfs_cac_ms, flags); - } - -+ /* frequencies above weather radar */ - bw = ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_HIGH, - reg_rule->end_freq, max_bw); -+ if (bw > 0) { -+ i++; - -- i++; -- -- ath11k_reg_update_rule(regd->reg_rules + i, ETSI_WEATHER_RADAR_BAND_HIGH, -- reg_rule->end_freq, bw, -- reg_rule->ant_gain, reg_rule->reg_power, -- flags); -- -- ath11k_dbg(ab, ATH11K_DBG_REG, -- "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -- i + 1, ETSI_WEATHER_RADAR_BAND_HIGH, reg_rule->end_freq, -- bw, reg_rule->ant_gain, reg_rule->reg_power, -- regd->reg_rules[i].dfs_cac_ms, -- flags); -+ ath11k_reg_update_rule(regd->reg_rules + i, -+ ETSI_WEATHER_RADAR_BAND_HIGH, -+ reg_rule->end_freq, bw, -+ reg_rule->ant_gain, reg_rule->reg_power, -+ flags); -+ -+ ath11k_dbg(ab, ATH11K_DBG_REG, -+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n", -+ i + 1, ETSI_WEATHER_RADAR_BAND_HIGH, -+ reg_rule->end_freq, bw, reg_rule->ant_gain, -+ reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms, -+ flags); -+ } - - *rule_idx = i; - } diff --git a/package/kernel/mac80211/patches/ath11k/0095-ath11k-use-cache-line-aligned-buffers-for-dbring.patch b/package/kernel/mac80211/patches/ath11k/0094-ath11k-use-cache-line-aligned-buffers-for-dbring.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0095-ath11k-use-cache-line-aligned-buffers-for-dbring.patch rename to package/kernel/mac80211/patches/ath11k/0094-ath11k-use-cache-line-aligned-buffers-for-dbring.patch index b1027665a..22a6c0bfe 100644 --- a/package/kernel/mac80211/patches/ath11k/0095-ath11k-use-cache-line-aligned-buffers-for-dbring.patch +++ b/package/kernel/mac80211/patches/ath11k/0094-ath11k-use-cache-line-aligned-buffers-for-dbring.patch @@ -1,7 +1,7 @@ From bd77f6b1d7104cf6451399a7c67d08afecb9a7c7 Mon Sep 17 00:00:00 2001 From: Rameshkumar Sundaram Date: Tue, 2 Nov 2021 11:11:33 +0530 -Subject: [PATCH 095/120] ath11k: use cache line aligned buffers for dbring +Subject: [PATCH] ath11k: use cache line aligned buffers for dbring The DMA buffers of dbring which is used for spectral/cfr starts at certain offset from original kmalloc() returned buffer. diff --git a/package/kernel/mac80211/patches/ath11k/0096-ath11k-Add-missing-qmi_txn_cancel.patch b/package/kernel/mac80211/patches/ath11k/0095-ath11k-Add-missing-qmi_txn_cancel.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0096-ath11k-Add-missing-qmi_txn_cancel.patch rename to package/kernel/mac80211/patches/ath11k/0095-ath11k-Add-missing-qmi_txn_cancel.patch index 98333bf3b..486185d2f 100644 --- a/package/kernel/mac80211/patches/ath11k/0096-ath11k-Add-missing-qmi_txn_cancel.patch +++ b/package/kernel/mac80211/patches/ath11k/0095-ath11k-Add-missing-qmi_txn_cancel.patch @@ -1,7 +1,7 @@ From 1ad6e4b00f29d017b196dda7ab96d1cfcbabd7d2 Mon Sep 17 00:00:00 2001 From: Anilkumar Kolli Date: Tue, 2 Nov 2021 18:22:38 +0530 -Subject: [PATCH 096/120] ath11k: Add missing qmi_txn_cancel() +Subject: [PATCH] ath11k: Add missing qmi_txn_cancel() Currently many functions do not follow this guidance when qmi_send_request() fails, therefore add missing diff --git a/package/kernel/mac80211/patches/ath11k/0097-ath11k-add-trace-log-support.patch b/package/kernel/mac80211/patches/ath11k/0096-ath11k-add-trace-log-support.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0097-ath11k-add-trace-log-support.patch rename to package/kernel/mac80211/patches/ath11k/0096-ath11k-add-trace-log-support.patch index 29f7453f1..49974b060 100644 --- a/package/kernel/mac80211/patches/ath11k/0097-ath11k-add-trace-log-support.patch +++ b/package/kernel/mac80211/patches/ath11k/0096-ath11k-add-trace-log-support.patch @@ -1,7 +1,7 @@ From fb12305aff12e735e599c79514dde5dac40f5a59 Mon Sep 17 00:00:00 2001 From: Venkateswara Naralasetty Date: Tue, 9 Nov 2021 12:05:55 +0530 -Subject: [PATCH 097/120] ath11k: add trace log support +Subject: [PATCH] ath11k: add trace log support This change is to add trace log support for, * WMI events @@ -298,7 +298,7 @@ Link: https://lore.kernel.org/r/1636439755-30419-1-git-send-email-quic_vnaralas@ memset(skb_cb, 0, sizeof(*skb_cb)); ret = ath11k_htc_send(&ab->htc, wmi->eid, skb); -@@ -7103,6 +7105,8 @@ static void ath11k_wmi_tlv_op_rx(struct +@@ -7104,6 +7106,8 @@ static void ath11k_wmi_tlv_op_rx(struct cmd_hdr = (struct wmi_cmd_hdr *)skb->data; id = FIELD_GET(WMI_CMD_HDR_CMD_ID, (cmd_hdr->cmd_id)); diff --git a/package/kernel/mac80211/patches/ath11k/0098-ath11k-Fix-crash-caused-by-uninitialized-TX-ring.patch b/package/kernel/mac80211/patches/ath11k/0098-ath11k-Fix-crash-caused-by-uninitialized-TX-ring.patch deleted file mode 100644 index 86aa0adde..000000000 --- a/package/kernel/mac80211/patches/ath11k/0098-ath11k-Fix-crash-caused-by-uninitialized-TX-ring.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 273703ebdb01b6c5f1aaf4b98fb57b177609055c Mon Sep 17 00:00:00 2001 -From: Baochen Qiang -Date: Tue, 26 Oct 2021 09:16:05 +0800 -Subject: [PATCH 098/120] ath11k: Fix crash caused by uninitialized TX ring - -Commit 31582373a4a8 ("ath11k: Change number of TCL rings to one for -QCA6390") avoids initializing the other entries of dp->tx_ring cause -the corresponding TX rings on QCA6390/WCN6855 are not used, but leaves -those ring masks in ath11k_hw_ring_mask_qca6390.tx unchanged. Normally -this is OK because we will only get interrupts from the first TX ring -on these chips and thus only the first entry of dp->tx_ring is involved. - -In case of one MSI vector, all DP rings share the same IRQ. For each -interrupt, all rings have to be checked, which means the other entries -of dp->tx_ring are involved. However since they are not initialized, -system crashes. - -Fix this issue by simply removing those ring masks. - -crash stack: -[ 102.907438] BUG: kernel NULL pointer dereference, address: 0000000000000028 -[ 102.907447] #PF: supervisor read access in kernel mode -[ 102.907451] #PF: error_code(0x0000) - not-present page -[ 102.907453] PGD 1081f0067 P4D 1081f0067 PUD 1081f1067 PMD 0 -[ 102.907460] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC NOPTI -[ 102.907465] CPU: 0 PID: 3511 Comm: apt-check Kdump: loaded Tainted: G E 5.15.0-rc4-wt-ath+ #20 -[ 102.907470] Hardware name: AMD Celadon-RN/Celadon-RN, BIOS RCD1005E 10/08/2020 -[ 102.907472] RIP: 0010:ath11k_dp_tx_completion_handler+0x201/0x830 [ath11k] -[ 102.907497] Code: 3c 24 4e 8d ac 37 10 04 00 00 4a 8d bc 37 68 04 00 00 48 89 3c 24 48 63 c8 89 83 84 18 00 00 48 c1 e1 05 48 03 8b 78 18 00 00 <8b> 51 08 89 d6 83 e6 07 89 74 24 24 83 fe 03 74 04 85 f6 75 63 41 -[ 102.907501] RSP: 0000:ffff9b7340003e08 EFLAGS: 00010202 -[ 102.907505] RAX: 0000000000000001 RBX: ffff8e21530c0100 RCX: 0000000000000020 -[ 102.907508] RDX: 0000000000000000 RSI: 00000000fffffe00 RDI: ffff8e21530c1938 -[ 102.907511] RBP: ffff8e21530c0000 R08: 0000000000000001 R09: 0000000000000000 -[ 102.907513] R10: ffff8e2145534c10 R11: 0000000000000001 R12: ffff8e21530c2938 -[ 102.907515] R13: ffff8e21530c18e0 R14: 0000000000000100 R15: ffff8e21530c2978 -[ 102.907518] FS: 00007f5d4297e740(0000) GS:ffff8e243d600000(0000) knlGS:0000000000000000 -[ 102.907521] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 -[ 102.907524] CR2: 0000000000000028 CR3: 00000001034ea000 CR4: 0000000000350ef0 -[ 102.907527] Call Trace: -[ 102.907531] -[ 102.907537] ath11k_dp_service_srng+0x5c/0x2f0 [ath11k] -[ 102.907556] ath11k_pci_ext_grp_napi_poll+0x21/0x70 [ath11k_pci] -[ 102.907562] __napi_poll+0x2c/0x160 -[ 102.907570] net_rx_action+0x251/0x310 -[ 102.907576] __do_softirq+0x107/0x2fc -[ 102.907585] irq_exit_rcu+0x74/0x90 -[ 102.907593] common_interrupt+0x83/0xa0 -[ 102.907600] -[ 102.907601] asm_common_interrupt+0x1e/0x40 - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 - -Signed-off-by: Baochen Qiang -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211026011605.58615-1-quic_bqiang@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hw.c | 2 -- - 1 file changed, 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/hw.c -+++ b/drivers/net/wireless/ath/ath11k/hw.c -@@ -1061,8 +1061,6 @@ const struct ath11k_hw_ring_mask ath11k_ - const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390 = { - .tx = { - ATH11K_TX_RING_MASK_0, -- ATH11K_TX_RING_MASK_1, -- ATH11K_TX_RING_MASK_2, - }, - .rx_mon_status = { - 0, 0, 0, 0, diff --git a/package/kernel/mac80211/patches/ath11k/0099-ath11k-add-string-type-to-search-board-data-in-board.patch b/package/kernel/mac80211/patches/ath11k/0099-ath11k-add-string-type-to-search-board-data-in-board.patch deleted file mode 100644 index f8078e472..000000000 --- a/package/kernel/mac80211/patches/ath11k/0099-ath11k-add-string-type-to-search-board-data-in-board.patch +++ /dev/null @@ -1,130 +0,0 @@ -From fc95d10ac41d75c14a81afcc8722333d8b2cf80f Mon Sep 17 00:00:00 2001 -From: Wen Gong -Date: Mon, 15 Nov 2021 11:29:55 +0200 -Subject: [PATCH 099/120] ath11k: add string type to search board data in - board-2.bin for WCN6855 - -Currently ath11k only support string type with bus, chip id and board id -such as "bus=ahb,qmi-chip-id=1,qmi-board-id=4" for ahb bus chip and -"bus=pci,qmi-chip-id=0,qmi-board-id=255" for PCIe bus chip in -board-2.bin. For WCN6855, it is not enough to distinguish all different -chips. - -This is to add a new string type which include bus, chip id, board id, -vendor, device, subsystem-vendor and subsystem-device for WCN6855. - -ath11k will first load board-2.bin and search in it for the board data -with the above parameters, if matched one board data, then download it -to firmware, if not matched any one, then ath11k will download the file -board.bin to firmware. - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 - -Signed-off-by: Wen Gong -Signed-off-by: Jouni Malinen -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211111065340.20187-1-quic_wgong@quicinc.com ---- - drivers/net/wireless/ath/ath11k/core.c | 27 ++++++++++++++++++++------ - drivers/net/wireless/ath/ath11k/core.h | 13 +++++++++++++ - drivers/net/wireless/ath/ath11k/pci.c | 10 ++++++++++ - 3 files changed, 44 insertions(+), 6 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -412,11 +412,26 @@ static int ath11k_core_create_board_name - scnprintf(variant, sizeof(variant), ",variant=%s", - ab->qmi.target.bdf_ext); - -- scnprintf(name, name_len, -- "bus=%s,qmi-chip-id=%d,qmi-board-id=%d%s", -- ath11k_bus_str(ab->hif.bus), -- ab->qmi.target.chip_id, -- ab->qmi.target.board_id, variant); -+ 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); -+ break; -+ default: -+ scnprintf(name, name_len, -+ "bus=%s,qmi-chip-id=%d,qmi-board-id=%d%s", -+ ath11k_bus_str(ab->hif.bus), -+ ab->qmi.target.chip_id, -+ ab->qmi.target.board_id, variant); -+ break; -+ } - - ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot using board name '%s'\n", name); - -@@ -653,7 +668,7 @@ static int ath11k_core_fetch_board_data_ - return 0; - } - --#define BOARD_NAME_SIZE 100 -+#define BOARD_NAME_SIZE 200 - int ath11k_core_fetch_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd) - { - char boardname[BOARD_NAME_SIZE]; ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -47,6 +47,11 @@ enum ath11k_supported_bw { - ATH11K_BW_160 = 3, - }; - -+enum ath11k_bdf_search { -+ ATH11K_BDF_SEARCH_DEFAULT, -+ ATH11K_BDF_SEARCH_BUS_AND_BOARD, -+}; -+ - enum wme_ac { - WME_AC_BE, - WME_AC_BK, -@@ -760,6 +765,14 @@ struct ath11k_base { - - struct completion htc_suspend; - -+ struct { -+ enum ath11k_bdf_search bdf_search; -+ u32 vendor; -+ u32 device; -+ u32 subsystem_vendor; -+ u32 subsystem_device; -+ } id; -+ - /* must be last */ - u8 drv_priv[0] __aligned(sizeof(void *)); - }; ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -1251,6 +1251,15 @@ static int ath11k_pci_probe(struct pci_d - goto err_free_core; - } - -+ ath11k_dbg(ab, ATH11K_DBG_BOOT, "pci probe %04x:%04x %04x:%04x\n", -+ pdev->vendor, pdev->device, -+ pdev->subsystem_vendor, pdev->subsystem_device); -+ -+ ab->id.vendor = pdev->vendor; -+ ab->id.device = pdev->device; -+ ab->id.subsystem_vendor = pdev->subsystem_vendor; -+ ab->id.subsystem_device = pdev->subsystem_device; -+ - switch (pci_dev->device) { - case QCA6390_DEVICE_ID: - ath11k_pci_read_hw_version(ab, &soc_hw_version_major, -@@ -1273,6 +1282,7 @@ static int ath11k_pci_probe(struct pci_d - ab->hw_rev = ATH11K_HW_QCN9074_HW10; - break; - case WCN6855_DEVICE_ID: -+ ab->id.bdf_search = ATH11K_BDF_SEARCH_BUS_AND_BOARD; - ath11k_pci_read_hw_version(ab, &soc_hw_version_major, - &soc_hw_version_minor); - switch (soc_hw_version_major) { diff --git a/package/kernel/mac80211/patches/ath11k/0100-ath11k-add-support-for-BSS-color-change.patch b/package/kernel/mac80211/patches/ath11k/0099-ath11k-add-support-for-BSS-color-change.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0100-ath11k-add-support-for-BSS-color-change.patch rename to package/kernel/mac80211/patches/ath11k/0099-ath11k-add-support-for-BSS-color-change.patch index 7a18a0ac5..7796b85ad 100644 --- a/package/kernel/mac80211/patches/ath11k/0100-ath11k-add-support-for-BSS-color-change.patch +++ b/package/kernel/mac80211/patches/ath11k/0099-ath11k-add-support-for-BSS-color-change.patch @@ -1,7 +1,7 @@ From 886433a984254c6d2c2074688dc8f48c40b1c070 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 25 Oct 2021 21:40:54 +0530 -Subject: [PATCH 100/120] ath11k: add support for BSS color change +Subject: [PATCH] ath11k: add support for BSS color change Whenever the MAC detects a color collision, or any of its associated stations detects one, the firmware will @@ -35,7 +35,7 @@ Link: https://lore.kernel.org/r/1635178254-17732-1-git-send-email-quic_ramess@qu --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -255,6 +255,8 @@ struct ath11k_vif { +@@ -256,6 +256,8 @@ struct ath11k_vif { int txpower; bool rsnie_present; bool wpaie_present; @@ -46,7 +46,7 @@ Link: https://lore.kernel.org/r/1635178254-17732-1-git-send-email-quic_ramess@qu --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1231,6 +1231,26 @@ static int ath11k_mac_setup_bcn_tmpl(str +@@ -1236,6 +1236,26 @@ static int ath11k_mac_setup_bcn_tmpl(str return ret; } @@ -73,7 +73,7 @@ Link: https://lore.kernel.org/r/1635178254-17732-1-git-send-email-quic_ramess@qu static void ath11k_control_beaconing(struct ath11k_vif *arvif, struct ieee80211_bss_conf *info) { -@@ -2894,10 +2914,17 @@ static void ath11k_mac_op_bss_info_chang +@@ -2899,10 +2919,17 @@ static void ath11k_mac_op_bss_info_chang "Set staggered beacon mode for VDEV: %d\n", arvif->vdev_id); @@ -95,7 +95,7 @@ Link: https://lore.kernel.org/r/1635178254-17732-1-git-send-email-quic_ramess@qu } if (changed & (BSS_CHANGED_BEACON_INFO | BSS_CHANGED_BEACON)) { -@@ -3108,6 +3135,25 @@ static void ath11k_mac_op_bss_info_chang +@@ -3113,6 +3140,25 @@ static void ath11k_mac_op_bss_info_chang if (ret) ath11k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", arvif->vdev_id, ret); @@ -121,7 +121,7 @@ Link: https://lore.kernel.org/r/1635178254-17732-1-git-send-email-quic_ramess@qu } else if (vif->type == NL80211_IFTYPE_STATION) { ret = ath11k_wmi_send_bss_color_change_enable_cmd(ar, arvif->vdev_id, -@@ -7872,6 +7918,9 @@ static int __ath11k_mac_register(struct +@@ -7882,6 +7928,9 @@ static int __ath11k_mac_register(struct wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); @@ -181,7 +181,7 @@ Link: https://lore.kernel.org/r/1635178254-17732-1-git-send-email-quic_ramess@qu cmd->buf_len = bcn->len; ptr = skb->data + sizeof(*cmd); -@@ -3451,6 +3466,53 @@ int ath11k_wmi_fils_discovery(struct ath +@@ -3452,6 +3467,53 @@ int ath11k_wmi_fils_discovery(struct ath } static void @@ -235,7 +235,7 @@ Link: https://lore.kernel.org/r/1635178254-17732-1-git-send-email-quic_ramess@qu ath11k_fill_band_to_mac_param(struct ath11k_base *soc, struct wmi_host_pdev_band_to_mac *band_to_mac) { -@@ -6157,6 +6219,7 @@ static void ath11k_vdev_start_resp_event +@@ -6158,6 +6220,7 @@ static void ath11k_vdev_start_resp_event static void ath11k_bcn_tx_status_event(struct ath11k_base *ab, struct sk_buff *skb) { @@ -243,7 +243,7 @@ Link: https://lore.kernel.org/r/1635178254-17732-1-git-send-email-quic_ramess@qu u32 vdev_id, tx_status; if (ath11k_pull_bcn_tx_status_ev(ab, skb->data, skb->len, -@@ -6164,6 +6227,14 @@ static void ath11k_bcn_tx_status_event(s +@@ -6165,6 +6228,14 @@ static void ath11k_bcn_tx_status_event(s ath11k_warn(ab, "failed to extract bcn tx status"); return; } @@ -258,7 +258,7 @@ Link: https://lore.kernel.org/r/1635178254-17732-1-git-send-email-quic_ramess@qu } static void ath11k_vdev_stopped_event(struct ath11k_base *ab, struct sk_buff *skb) -@@ -7191,6 +7262,9 @@ static void ath11k_wmi_tlv_op_rx(struct +@@ -7192,6 +7263,9 @@ static void ath11k_wmi_tlv_op_rx(struct case WMI_OFFLOAD_PROB_RESP_TX_STATUS_EVENTID: ath11k_probe_resp_tx_status_event(ab, skb); break; diff --git a/package/kernel/mac80211/patches/ath11k/0101-ath11k-clear-the-keys-properly-via-DISABLE_KEY.patch b/package/kernel/mac80211/patches/ath11k/0101-ath11k-clear-the-keys-properly-via-DISABLE_KEY.patch deleted file mode 100644 index 659fc68ff..000000000 --- a/package/kernel/mac80211/patches/ath11k/0101-ath11k-clear-the-keys-properly-via-DISABLE_KEY.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 436a4e88659842a7cf634d7cc088c8f2cc94ebf5 Mon Sep 17 00:00:00 2001 -From: Karthikeyan Kathirvel -Date: Mon, 15 Nov 2021 11:04:40 +0100 -Subject: [PATCH 101/120] ath11k: clear the keys properly via DISABLE_KEY - -DISABLE_KEY sets the key_len to 0, firmware will not delete the keys if -key_len is 0. Changing from security mode to open mode will cause mcast -to be still encrypted without vdev restart. - -Set the proper key_len for DISABLE_KEY cmd to clear the keys in -firmware. - -Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") -Reported-by: Sven Eckelmann -Signed-off-by: Karthikeyan Kathirvel -[sven@narfation.org: split into separate patches, clean up commit message] -Signed-off-by: Sven Eckelmann - -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211115100441.33771-1-sven@narfation.org ---- - drivers/net/wireless/ath/ath11k/mac.c | 4 +--- - drivers/net/wireless/ath/ath11k/wmi.c | 3 ++- - 2 files changed, 3 insertions(+), 4 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3461,9 +3461,7 @@ static int ath11k_install_key(struct ath - return 0; - - if (cmd == DISABLE_KEY) { -- /* TODO: Check if FW expects value other than NONE for del */ -- /* arg.key_cipher = WMI_CIPHER_NONE; */ -- arg.key_len = 0; -+ arg.key_cipher = WMI_CIPHER_NONE; - arg.key_data = NULL; - goto install; - } ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -1725,7 +1725,8 @@ int ath11k_wmi_vdev_install_key(struct a - tlv = (struct wmi_tlv *)(skb->data + sizeof(*cmd)); - tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) | - FIELD_PREP(WMI_TLV_LEN, key_len_aligned); -- memcpy(tlv->value, (u8 *)arg->key_data, key_len_aligned); -+ if (arg->key_data) -+ memcpy(tlv->value, (u8 *)arg->key_data, key_len_aligned); - - ret = ath11k_wmi_cmd_send(wmi, skb, WMI_VDEV_INSTALL_KEY_CMDID); - if (ret) { diff --git a/package/kernel/mac80211/patches/ath11k/0103-ath11k-add-hw_param-for-wakeup_mhi.patch b/package/kernel/mac80211/patches/ath11k/0102-ath11k-add-hw_param-for-wakeup_mhi.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0103-ath11k-add-hw_param-for-wakeup_mhi.patch rename to package/kernel/mac80211/patches/ath11k/0102-ath11k-add-hw_param-for-wakeup_mhi.patch index 44248426c..fe000c3ab 100644 --- a/package/kernel/mac80211/patches/ath11k/0103-ath11k-add-hw_param-for-wakeup_mhi.patch +++ b/package/kernel/mac80211/patches/ath11k/0102-ath11k-add-hw_param-for-wakeup_mhi.patch @@ -1,7 +1,7 @@ From 081e2d6476e30399433b509684d5da4d1844e430 Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Wed, 17 Nov 2021 09:39:41 +0200 -Subject: [PATCH 103/120] ath11k: add hw_param for wakeup_mhi +Subject: [PATCH] ath11k: add hw_param for wakeup_mhi Wakeup mhi is needed before pci_read/write only for QCA6390 and WCN6855. Since wakeup & release mhi is enabled for all hardwares, below mhi assert is seen in diff --git a/package/kernel/mac80211/patches/ath11k/0102-ath11k-reset-RSN-WPA-present-state-for-open-BSS.patch b/package/kernel/mac80211/patches/ath11k/0102-ath11k-reset-RSN-WPA-present-state-for-open-BSS.patch deleted file mode 100644 index 92eeb7c5d..000000000 --- a/package/kernel/mac80211/patches/ath11k/0102-ath11k-reset-RSN-WPA-present-state-for-open-BSS.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 64bc3aa02ae78b1fcb1b850e0eb1f0622002bfaa Mon Sep 17 00:00:00 2001 -From: Karthikeyan Kathirvel -Date: Mon, 15 Nov 2021 11:04:41 +0100 -Subject: [PATCH 102/120] ath11k: reset RSN/WPA present state for open BSS - -The ath11k driver is caching the information about RSN/WPA IE in the -configured beacon template. The cached information is used during -associations to figure out whether 4-way PKT/2-way GTK peer flags need to -be set or not. - -But the code never cleared the state when no such IE was found. This can -for example happen when moving from an WPA/RSN to an open setup. The -(seemingly connected) peer was then not able to communicate over the -link because the firmware assumed a different (encryption enabled) state -for the peer. - -Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Fixes: 01e34233c645 ("ath11k: fix wmi peer flags in peer assoc command") -Cc: Venkateswara Naralasetty -Reported-by: Sven Eckelmann -Signed-off-by: Karthikeyan Kathirvel -[sven@narfation.org: split into separate patches, clean up commit message] -Signed-off-by: Sven Eckelmann - -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211115100441.33771-2-sven@narfation.org ---- - drivers/net/wireless/ath/ath11k/mac.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1214,11 +1214,15 @@ static int ath11k_mac_setup_bcn_tmpl(str - - if (cfg80211_find_ie(WLAN_EID_RSN, ies, (skb_tail_pointer(bcn) - ies))) - arvif->rsnie_present = true; -+ else -+ arvif->rsnie_present = false; - - if (cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, - WLAN_OUI_TYPE_MICROSOFT_WPA, - ies, (skb_tail_pointer(bcn) - ies))) - arvif->wpaie_present = true; -+ else -+ arvif->wpaie_present = false; - - ret = ath11k_wmi_bcn_tmpl(ar, arvif->vdev_id, &offs, bcn); - diff --git a/package/kernel/mac80211/patches/ath11k/0104-ath11k-get-msi_data-again-after-request_irq-is-calle.patch b/package/kernel/mac80211/patches/ath11k/0103-ath11k-get-msi_data-again-after-request_irq-is-calle.patch similarity index 92% rename from package/kernel/mac80211/patches/ath11k/0104-ath11k-get-msi_data-again-after-request_irq-is-calle.patch rename to package/kernel/mac80211/patches/ath11k/0103-ath11k-get-msi_data-again-after-request_irq-is-calle.patch index ddbf0ee4d..483ba4973 100644 --- a/package/kernel/mac80211/patches/ath11k/0104-ath11k-get-msi_data-again-after-request_irq-is-calle.patch +++ b/package/kernel/mac80211/patches/ath11k/0103-ath11k-get-msi_data-again-after-request_irq-is-calle.patch @@ -1,8 +1,7 @@ From 87b4072d7ef818e368b0f4162a1af2fb4727f51c Mon Sep 17 00:00:00 2001 From: Carl Huang Date: Fri, 19 Nov 2021 15:36:26 +0200 -Subject: [PATCH 104/120] ath11k: get msi_data again after request_irq is - called +Subject: [PATCH] ath11k: get msi_data again after request_irq is called The reservation mode of interrupts in kernel assigns a dummy vector when the interrupt is allocated and assigns a real vector when the @@ -31,7 +30,7 @@ Link: https://lore.kernel.org/r/20211026041636.5008-1-bqiang@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -933,6 +933,25 @@ static void ath11k_pci_free_msi(struct a +@@ -939,6 +939,25 @@ static void ath11k_pci_free_msi(struct a pci_free_irq_vectors(ab_pci->pdev); } @@ -57,7 +56,7 @@ Link: https://lore.kernel.org/r/20211026041636.5008-1-bqiang@codeaurora.org static int ath11k_pci_claim(struct ath11k_pci *ab_pci, struct pci_dev *pdev) { struct ath11k_base *ab = ab_pci->ab; -@@ -1342,6 +1361,17 @@ static int ath11k_pci_probe(struct pci_d +@@ -1348,6 +1367,17 @@ static int ath11k_pci_probe(struct pci_d goto err_ce_free; } diff --git a/package/kernel/mac80211/patches/ath11k/0105-ath11k-add-CE-and-ext-IRQ-flag-to-indicate-irq_handl.patch b/package/kernel/mac80211/patches/ath11k/0104-ath11k-add-CE-and-ext-IRQ-flag-to-indicate-irq_handl.patch similarity index 89% rename from package/kernel/mac80211/patches/ath11k/0105-ath11k-add-CE-and-ext-IRQ-flag-to-indicate-irq_handl.patch rename to package/kernel/mac80211/patches/ath11k/0104-ath11k-add-CE-and-ext-IRQ-flag-to-indicate-irq_handl.patch index d45c1fb5b..cd6872a74 100644 --- a/package/kernel/mac80211/patches/ath11k/0105-ath11k-add-CE-and-ext-IRQ-flag-to-indicate-irq_handl.patch +++ b/package/kernel/mac80211/patches/ath11k/0104-ath11k-add-CE-and-ext-IRQ-flag-to-indicate-irq_handl.patch @@ -1,8 +1,7 @@ From 01279bcd01d965b6526d575e036841778d8e3c4e Mon Sep 17 00:00:00 2001 From: Carl Huang Date: Fri, 19 Nov 2021 15:36:26 +0200 -Subject: [PATCH 105/120] ath11k: add CE and ext IRQ flag to indicate - irq_handler +Subject: [PATCH] ath11k: add CE and ext IRQ flag to indicate irq_handler This change adds two flags to indicate whether IRQ handler for CE and DP can be called. This is because in one MSI vector case, @@ -22,7 +21,7 @@ Link: https://lore.kernel.org/r/20211026041646.5060-1-bqiang@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -199,6 +199,8 @@ enum ath11k_dev_flags { +@@ -200,6 +200,8 @@ enum ath11k_dev_flags { ATH11K_FLAG_REGISTERED, ATH11K_FLAG_QMI_FAIL, ATH11K_FLAG_HTC_SUSPEND_COMPLETE, @@ -62,7 +61,7 @@ Link: https://lore.kernel.org/r/20211026041646.5060-1-bqiang@codeaurora.org for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { struct ath11k_ext_irq_grp *irq_grp = &sc->ext_irq_grp[i]; -@@ -655,6 +663,8 @@ static void ath11k_pci_ext_irq_enable(st +@@ -658,6 +666,8 @@ static void ath11k_pci_ext_irq_enable(st { int i; @@ -71,7 +70,7 @@ Link: https://lore.kernel.org/r/20211026041646.5060-1-bqiang@codeaurora.org for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; -@@ -706,6 +716,10 @@ static int ath11k_pci_ext_grp_napi_poll( +@@ -712,6 +722,10 @@ static int ath11k_pci_ext_grp_napi_poll( static irqreturn_t ath11k_pci_ext_interrupt_handler(int irq, void *arg) { struct ath11k_ext_irq_grp *irq_grp = arg; @@ -82,7 +81,7 @@ Link: https://lore.kernel.org/r/20211026041646.5060-1-bqiang@codeaurora.org ath11k_dbg(irq_grp->ab, ATH11K_DBG_PCI, "ext irq:%d\n", irq); -@@ -852,6 +866,8 @@ static void ath11k_pci_ce_irqs_enable(st +@@ -858,6 +872,8 @@ static void ath11k_pci_ce_irqs_enable(st { int i; diff --git a/package/kernel/mac80211/patches/ath11k/0106-ath11k-use-ATH11K_PCI_IRQ_DP_OFFSET-for-DP-IRQ.patch b/package/kernel/mac80211/patches/ath11k/0105-ath11k-use-ATH11K_PCI_IRQ_DP_OFFSET-for-DP-IRQ.patch similarity index 89% rename from package/kernel/mac80211/patches/ath11k/0106-ath11k-use-ATH11K_PCI_IRQ_DP_OFFSET-for-DP-IRQ.patch rename to package/kernel/mac80211/patches/ath11k/0105-ath11k-use-ATH11K_PCI_IRQ_DP_OFFSET-for-DP-IRQ.patch index be28b5f59..e08db10ec 100644 --- a/package/kernel/mac80211/patches/ath11k/0106-ath11k-use-ATH11K_PCI_IRQ_DP_OFFSET-for-DP-IRQ.patch +++ b/package/kernel/mac80211/patches/ath11k/0105-ath11k-use-ATH11K_PCI_IRQ_DP_OFFSET-for-DP-IRQ.patch @@ -1,7 +1,7 @@ From 4ab4693f327ad015c4637ae42dc53c8471aed9c8 Mon Sep 17 00:00:00 2001 From: Carl Huang Date: Fri, 19 Nov 2021 15:36:26 +0200 -Subject: [PATCH 106/120] ath11k: use ATH11K_PCI_IRQ_DP_OFFSET for DP IRQ +Subject: [PATCH] ath11k: use ATH11K_PCI_IRQ_DP_OFFSET for DP IRQ Like ATH11K_PCI_IRQ_CE0_OFFSET, define ATH11K_PCI_IRQ_DP_OFFSET for DP to save the IRQ instead of base_vector from MSI config. @@ -28,7 +28,7 @@ Link: https://lore.kernel.org/r/20211026041655.5112-1-bqiang@codeaurora.org #define WINDOW_ENABLE_BIT 0x40000000 #define WINDOW_REG_ADDRESS 0x310c -@@ -736,9 +737,8 @@ static irqreturn_t ath11k_pci_ext_interr +@@ -742,9 +743,8 @@ static irqreturn_t ath11k_pci_ext_interr static int ath11k_pci_ext_irq_config(struct ath11k_base *ab) { int i, j, ret, num_vectors = 0; @@ -39,7 +39,7 @@ Link: https://lore.kernel.org/r/20211026041655.5112-1-bqiang@codeaurora.org ret = ath11k_pci_get_user_msi_assignment(ath11k_pci_priv(ab), "DP", &num_vectors, &user_base_data, -@@ -768,7 +768,7 @@ static int ath11k_pci_ext_irq_config(str +@@ -774,7 +774,7 @@ static int ath11k_pci_ext_irq_config(str } irq_grp->num_irq = num_irq; diff --git a/package/kernel/mac80211/patches/ath11k/0107-ath11k-refactor-multiple-MSI-vector-implementation.patch b/package/kernel/mac80211/patches/ath11k/0106-ath11k-refactor-multiple-MSI-vector-implementation.patch similarity index 92% rename from package/kernel/mac80211/patches/ath11k/0107-ath11k-refactor-multiple-MSI-vector-implementation.patch rename to package/kernel/mac80211/patches/ath11k/0106-ath11k-refactor-multiple-MSI-vector-implementation.patch index 1529089cf..2716195f5 100644 --- a/package/kernel/mac80211/patches/ath11k/0107-ath11k-refactor-multiple-MSI-vector-implementation.patch +++ b/package/kernel/mac80211/patches/ath11k/0106-ath11k-refactor-multiple-MSI-vector-implementation.patch @@ -1,7 +1,7 @@ From c41a6700b276ddf6ef93dcb43baca51ea0c4c7c1 Mon Sep 17 00:00:00 2001 From: Carl Huang Date: Fri, 19 Nov 2021 15:36:26 +0200 -Subject: [PATCH 107/120] ath11k: refactor multiple MSI vector implementation +Subject: [PATCH] ath11k: refactor multiple MSI vector implementation This is to prepare for one MSI vector support. IRQ enable and disable of CE and DP are done only in case of multiple MSI vectors. @@ -82,7 +82,7 @@ Link: https://lore.kernel.org/r/20211026041705.5167-1-bqiang@codeaurora.org for (i = 0; i < irq_grp->num_irq; i++) disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); } -@@ -654,8 +675,15 @@ static void __ath11k_pci_ext_irq_disable +@@ -657,8 +678,15 @@ static void __ath11k_pci_ext_irq_disable static void ath11k_pci_ext_grp_enable(struct ath11k_ext_irq_grp *irq_grp) { @@ -98,7 +98,7 @@ Link: https://lore.kernel.org/r/20211026041705.5167-1-bqiang@codeaurora.org for (i = 0; i < irq_grp->num_irq; i++) enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); } -@@ -736,6 +764,7 @@ static irqreturn_t ath11k_pci_ext_interr +@@ -742,6 +770,7 @@ static irqreturn_t ath11k_pci_ext_interr static int ath11k_pci_ext_irq_config(struct ath11k_base *ab) { @@ -106,7 +106,7 @@ Link: https://lore.kernel.org/r/20211026041705.5167-1-bqiang@codeaurora.org int i, j, ret, num_vectors = 0; u32 user_base_data = 0, base_vector = 0; -@@ -782,16 +811,15 @@ static int ath11k_pci_ext_irq_config(str +@@ -788,16 +817,15 @@ static int ath11k_pci_ext_irq_config(str irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY); ret = request_irq(irq, ath11k_pci_ext_interrupt_handler, @@ -125,7 +125,7 @@ Link: https://lore.kernel.org/r/20211026041705.5167-1-bqiang@codeaurora.org } return 0; -@@ -799,6 +827,7 @@ static int ath11k_pci_ext_irq_config(str +@@ -805,6 +833,7 @@ static int ath11k_pci_ext_irq_config(str static int ath11k_pci_config_irq(struct ath11k_base *ab) { @@ -133,7 +133,7 @@ Link: https://lore.kernel.org/r/20211026041705.5167-1-bqiang@codeaurora.org struct ath11k_ce_pipe *ce_pipe; u32 msi_data_start; u32 msi_data_count, msi_data_idx; -@@ -826,7 +855,7 @@ static int ath11k_pci_config_irq(struct +@@ -832,7 +861,7 @@ static int ath11k_pci_config_irq(struct tasklet_setup(&ce_pipe->intr_tq, ath11k_pci_ce_tasklet); ret = request_irq(irq, ath11k_pci_ce_interrupt_handler, @@ -142,7 +142,7 @@ Link: https://lore.kernel.org/r/20211026041705.5167-1-bqiang@codeaurora.org ce_pipe); if (ret) { ath11k_err(ab, "failed to request irq %d: %d\n", -@@ -920,6 +949,9 @@ static int ath11k_pci_alloc_msi(struct a +@@ -926,6 +955,9 @@ static int ath11k_pci_alloc_msi(struct a return -EINVAL; else return num_vectors; diff --git a/package/kernel/mac80211/patches/ath11k/0108-ath11k-add-support-one-MSI-vector.patch b/package/kernel/mac80211/patches/ath11k/0107-ath11k-add-support-one-MSI-vector.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0108-ath11k-add-support-one-MSI-vector.patch rename to package/kernel/mac80211/patches/ath11k/0107-ath11k-add-support-one-MSI-vector.patch index 230d8d228..cb76177c7 100644 --- a/package/kernel/mac80211/patches/ath11k/0108-ath11k-add-support-one-MSI-vector.patch +++ b/package/kernel/mac80211/patches/ath11k/0107-ath11k-add-support-one-MSI-vector.patch @@ -1,7 +1,7 @@ From ac6e73483f7b4b5bde23b14fc3aaafc8341ae0c7 Mon Sep 17 00:00:00 2001 From: Carl Huang Date: Fri, 19 Nov 2021 15:36:26 +0200 -Subject: [PATCH 108/120] ath11k: add support one MSI vector +Subject: [PATCH] ath11k: add support one MSI vector On some platforms it's not possible to allocate 32 MSI vectors for various reasons, be it kernel configuration, VT-d disabled, buggy BIOS etc. So @@ -117,7 +117,7 @@ Link: https://lore.kernel.org/r/20211026041714.5219-1-bqiang@codeaurora.org tasklet_schedule(&ce_pipe->intr_tq); return IRQ_HANDLED; -@@ -729,11 +743,13 @@ static int ath11k_pci_ext_grp_napi_poll( +@@ -735,11 +749,13 @@ static int ath11k_pci_ext_grp_napi_poll( napi); struct ath11k_base *ab = irq_grp->ab; int work_done; @@ -132,7 +132,7 @@ Link: https://lore.kernel.org/r/20211026041714.5219-1-bqiang@codeaurora.org } if (work_done > budget) -@@ -746,6 +762,7 @@ static irqreturn_t ath11k_pci_ext_interr +@@ -752,6 +768,7 @@ static irqreturn_t ath11k_pci_ext_interr { struct ath11k_ext_irq_grp *irq_grp = arg; struct ath11k_base *ab = irq_grp->ab; @@ -140,7 +140,7 @@ Link: https://lore.kernel.org/r/20211026041714.5219-1-bqiang@codeaurora.org if (!test_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags)) return IRQ_HANDLED; -@@ -755,7 +772,8 @@ static irqreturn_t ath11k_pci_ext_interr +@@ -761,7 +778,8 @@ static irqreturn_t ath11k_pci_ext_interr /* last interrupt received for this group */ irq_grp->timestamp = jiffies; @@ -150,7 +150,7 @@ Link: https://lore.kernel.org/r/20211026041714.5219-1-bqiang@codeaurora.org napi_schedule(&irq_grp->napi); -@@ -941,18 +959,25 @@ static int ath11k_pci_alloc_msi(struct a +@@ -947,18 +965,25 @@ static int ath11k_pci_alloc_msi(struct a msi_config->total_vectors, msi_config->total_vectors, PCI_IRQ_MSI); @@ -185,7 +185,7 @@ Link: https://lore.kernel.org/r/20211026041714.5219-1-bqiang@codeaurora.org ath11k_pci_msi_disable(ab_pci); msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); -@@ -973,6 +998,7 @@ static int ath11k_pci_alloc_msi(struct a +@@ -979,6 +1004,7 @@ static int ath11k_pci_alloc_msi(struct a free_msi_vector: pci_free_irq_vectors(ab_pci->pdev); diff --git a/package/kernel/mac80211/patches/ath11k/0109-ath11k-do-not-restore-ASPM-in-case-of-single-MSI-vec.patch b/package/kernel/mac80211/patches/ath11k/0108-ath11k-do-not-restore-ASPM-in-case-of-single-MSI-vec.patch similarity index 91% rename from package/kernel/mac80211/patches/ath11k/0109-ath11k-do-not-restore-ASPM-in-case-of-single-MSI-vec.patch rename to package/kernel/mac80211/patches/ath11k/0108-ath11k-do-not-restore-ASPM-in-case-of-single-MSI-vec.patch index bdb259cf4..18eec3d3c 100644 --- a/package/kernel/mac80211/patches/ath11k/0109-ath11k-do-not-restore-ASPM-in-case-of-single-MSI-vec.patch +++ b/package/kernel/mac80211/patches/ath11k/0108-ath11k-do-not-restore-ASPM-in-case-of-single-MSI-vec.patch @@ -1,8 +1,7 @@ From 915a081ff307d61d6551d6c16b542e03775353c4 Mon Sep 17 00:00:00 2001 From: Carl Huang Date: Fri, 19 Nov 2021 15:36:26 +0200 -Subject: [PATCH 109/120] ath11k: do not restore ASPM in case of single MSI - vector +Subject: [PATCH] ath11k: do not restore ASPM in case of single MSI vector Current code enables ASPM by default, it allows MHI to enter M2 state. In case of one MSI vector, system hang is observed if ath11k does MHI @@ -25,7 +24,7 @@ Link: https://lore.kernel.org/r/20211026041722.5271-1-bqiang@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -1223,7 +1223,13 @@ static int ath11k_pci_start(struct ath11 +@@ -1229,7 +1229,13 @@ static int ath11k_pci_start(struct ath11 set_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags); diff --git a/package/kernel/mac80211/patches/ath11k/0110-ath11k-Set-IRQ-affinity-to-CPU0-in-case-of-one-MSI-v.patch b/package/kernel/mac80211/patches/ath11k/0109-ath11k-Set-IRQ-affinity-to-CPU0-in-case-of-one-MSI-v.patch similarity index 86% rename from package/kernel/mac80211/patches/ath11k/0110-ath11k-Set-IRQ-affinity-to-CPU0-in-case-of-one-MSI-v.patch rename to package/kernel/mac80211/patches/ath11k/0109-ath11k-Set-IRQ-affinity-to-CPU0-in-case-of-one-MSI-v.patch index f84723669..e86edad03 100644 --- a/package/kernel/mac80211/patches/ath11k/0110-ath11k-Set-IRQ-affinity-to-CPU0-in-case-of-one-MSI-v.patch +++ b/package/kernel/mac80211/patches/ath11k/0109-ath11k-Set-IRQ-affinity-to-CPU0-in-case-of-one-MSI-v.patch @@ -1,8 +1,7 @@ From e94b07493da31705c3fdd0b2854f0cffe1dacb3c Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Fri, 19 Nov 2021 15:36:26 +0200 -Subject: [PATCH 110/120] ath11k: Set IRQ affinity to CPU0 in case of one MSI - vector +Subject: [PATCH] ath11k: Set IRQ affinity to CPU0 in case of one MSI vector With VT-d disabled on Intel platform, ath11k gets only one MSI vector. In that case, ath11k does not free IRQ when doing suspend, @@ -26,7 +25,7 @@ Link: https://lore.kernel.org/r/20211026041732.5323-1-bqiang@codeaurora.org --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -843,6 +843,15 @@ static int ath11k_pci_ext_irq_config(str +@@ -849,6 +849,15 @@ static int ath11k_pci_ext_irq_config(str return 0; } @@ -42,7 +41,7 @@ Link: https://lore.kernel.org/r/20211026041732.5323-1-bqiang@codeaurora.org static int ath11k_pci_config_irq(struct ath11k_base *ab) { struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); -@@ -859,6 +868,12 @@ static int ath11k_pci_config_irq(struct +@@ -865,6 +874,12 @@ static int ath11k_pci_config_irq(struct if (ret) return ret; @@ -55,7 +54,7 @@ Link: https://lore.kernel.org/r/20211026041732.5323-1-bqiang@codeaurora.org /* Configure CE irqs */ for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) -@@ -878,7 +893,7 @@ static int ath11k_pci_config_irq(struct +@@ -884,7 +899,7 @@ static int ath11k_pci_config_irq(struct if (ret) { ath11k_err(ab, "failed to request irq %d: %d\n", irq_idx, ret); @@ -64,7 +63,7 @@ Link: https://lore.kernel.org/r/20211026041732.5323-1-bqiang@codeaurora.org } ab->irq_num[irq_idx] = irq; -@@ -889,9 +904,13 @@ static int ath11k_pci_config_irq(struct +@@ -895,9 +910,13 @@ static int ath11k_pci_config_irq(struct ret = ath11k_pci_ext_irq_config(ab); if (ret) @@ -79,7 +78,7 @@ Link: https://lore.kernel.org/r/20211026041732.5323-1-bqiang@codeaurora.org } static void ath11k_pci_init_qmi_ce_config(struct ath11k_base *ab) -@@ -1488,6 +1507,8 @@ static void ath11k_pci_remove(struct pci +@@ -1494,6 +1513,8 @@ static void ath11k_pci_remove(struct pci struct ath11k_base *ab = pci_get_drvdata(pdev); struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); diff --git a/package/kernel/mac80211/patches/ath11k/0111-ath11k-change-to-treat-alpha-code-na-as-world-wide-r.patch b/package/kernel/mac80211/patches/ath11k/0110-ath11k-change-to-treat-alpha-code-na-as-world-wide-r.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0111-ath11k-change-to-treat-alpha-code-na-as-world-wide-r.patch rename to package/kernel/mac80211/patches/ath11k/0110-ath11k-change-to-treat-alpha-code-na-as-world-wide-r.patch index 6895c5266..a8de4524d 100644 --- a/package/kernel/mac80211/patches/ath11k/0111-ath11k-change-to-treat-alpha-code-na-as-world-wide-r.patch +++ b/package/kernel/mac80211/patches/ath11k/0110-ath11k-change-to-treat-alpha-code-na-as-world-wide-r.patch @@ -1,8 +1,7 @@ From f8108250e331b8f0273c53afb9e2db5068e59b2e Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 22 Nov 2021 13:13:57 +0200 -Subject: [PATCH 111/120] ath11k: change to treat alpha code na as world wide - regdomain +Subject: [PATCH] ath11k: change to treat alpha code na as world wide regdomain Some firmware versions for WCN6855 report the default regdomain with alpha code "na" by default when load as a world wide regdomain, ath11k diff --git a/package/kernel/mac80211/patches/ath11k/0112-ath11k-calculate-the-correct-NSS-of-peer-for-HE-capa.patch b/package/kernel/mac80211/patches/ath11k/0111-ath11k-calculate-the-correct-NSS-of-peer-for-HE-capa.patch similarity index 89% rename from package/kernel/mac80211/patches/ath11k/0112-ath11k-calculate-the-correct-NSS-of-peer-for-HE-capa.patch rename to package/kernel/mac80211/patches/ath11k/0111-ath11k-calculate-the-correct-NSS-of-peer-for-HE-capa.patch index 580417307..f0d3f46a6 100644 --- a/package/kernel/mac80211/patches/ath11k/0112-ath11k-calculate-the-correct-NSS-of-peer-for-HE-capa.patch +++ b/package/kernel/mac80211/patches/ath11k/0111-ath11k-calculate-the-correct-NSS-of-peer-for-HE-capa.patch @@ -1,8 +1,7 @@ From 3db26ecf7114370e451e296e33a0af3303d32819 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 22 Nov 2021 13:13:57 +0200 -Subject: [PATCH 112/120] ath11k: calculate the correct NSS of peer for HE - capabilities +Subject: [PATCH] ath11k: calculate the correct NSS of peer for HE capabilities When connected to 6G mode AP, it does not have VHT/HT capabilities, so the NSS is not set, then it is 1 by default. @@ -21,7 +20,7 @@ Link: https://lore.kernel.org/r/20211118095453.8030-1-quic_wgong@quicinc.com --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1920,7 +1920,6 @@ static void ath11k_peer_assoc_h_he(struc +@@ -1921,7 +1921,6 @@ static void ath11k_peer_assoc_h_he(struc struct ath11k_vif *arvif = (void *)vif->drv_priv; struct cfg80211_chan_def def; const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; @@ -29,7 +28,7 @@ Link: https://lore.kernel.org/r/20211118095453.8030-1-quic_wgong@quicinc.com enum nl80211_band band; u16 *he_mcs_mask; u8 max_nss, he_mcs; -@@ -1928,6 +1927,9 @@ static void ath11k_peer_assoc_h_he(struc +@@ -1929,6 +1928,9 @@ static void ath11k_peer_assoc_h_he(struc int i, he_nss, nss_idx; bool user_rate_valid = true; u32 rx_nss, tx_nss, nss_160; @@ -39,7 +38,7 @@ Link: https://lore.kernel.org/r/20211118095453.8030-1-quic_wgong@quicinc.com if (WARN_ON(ath11k_mac_vif_chan(vif, &def))) return; -@@ -1942,6 +1944,39 @@ static void ath11k_peer_assoc_h_he(struc +@@ -1943,6 +1945,39 @@ static void ath11k_peer_assoc_h_he(struc return; arg->he_flag = true; diff --git a/package/kernel/mac80211/patches/ath11k/0113-ath11k-fix-read-fail-for-htt_stats-and-htt_peer_stat.patch b/package/kernel/mac80211/patches/ath11k/0112-ath11k-fix-read-fail-for-htt_stats-and-htt_peer_stat.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0113-ath11k-fix-read-fail-for-htt_stats-and-htt_peer_stat.patch rename to package/kernel/mac80211/patches/ath11k/0112-ath11k-fix-read-fail-for-htt_stats-and-htt_peer_stat.patch index 53b4f3a6c..f5385af6c 100644 --- a/package/kernel/mac80211/patches/ath11k/0113-ath11k-fix-read-fail-for-htt_stats-and-htt_peer_stat.patch +++ b/package/kernel/mac80211/patches/ath11k/0112-ath11k-fix-read-fail-for-htt_stats-and-htt_peer_stat.patch @@ -1,8 +1,8 @@ From 1370634054d4e1e4794057b06ac651b6366ce97d Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 22 Nov 2021 13:13:58 +0200 -Subject: [PATCH 113/120] ath11k: fix read fail for htt_stats and - htt_peer_stats for single pdev +Subject: [PATCH] ath11k: fix read fail for htt_stats and htt_peer_stats for + single pdev The pdev id is set to 0 for single pdev configured hardware, the real pdev id is not 0 in firmware, for example, its pdev id is 1 for 5G/6G @@ -33,7 +33,7 @@ Link: https://lore.kernel.org/r/20211118095700.8149-1-quic_wgong@quicinc.com --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -713,6 +713,11 @@ struct ath11k_base { +@@ -714,6 +714,11 @@ struct ath11k_base { /* Protects data like peers */ spinlock_t base_lock; struct ath11k_pdev pdevs[MAX_RADIOS]; @@ -79,7 +79,7 @@ Link: https://lore.kernel.org/r/20211118095700.8149-1-quic_wgong@quicinc.com cmd->cfg_param0 = cfg_params->cfg0; --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -553,6 +553,67 @@ struct ath11k *ath11k_mac_get_ar_by_pdev +@@ -554,6 +554,67 @@ struct ath11k *ath11k_mac_get_ar_by_pdev return NULL; } diff --git a/package/kernel/mac80211/patches/ath11k/0114-ath11k-skip-sending-vdev-down-for-channel-switch.patch b/package/kernel/mac80211/patches/ath11k/0113-ath11k-skip-sending-vdev-down-for-channel-switch.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0114-ath11k-skip-sending-vdev-down-for-channel-switch.patch rename to package/kernel/mac80211/patches/ath11k/0113-ath11k-skip-sending-vdev-down-for-channel-switch.patch index 8947552e7..d0ae98c49 100644 --- a/package/kernel/mac80211/patches/ath11k/0114-ath11k-skip-sending-vdev-down-for-channel-switch.patch +++ b/package/kernel/mac80211/patches/ath11k/0113-ath11k-skip-sending-vdev-down-for-channel-switch.patch @@ -1,7 +1,7 @@ From a4146249a33381f41f6d15eaa1797d7ba1820a31 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 22 Nov 2021 13:13:58 +0200 -Subject: [PATCH 114/120] ath11k: skip sending vdev down for channel switch +Subject: [PATCH] ath11k: skip sending vdev down for channel switch The ath11k driver currently sends vdev down to the firmware before updating the channel context, which is followed by a vdev restart @@ -27,7 +27,7 @@ Link: https://lore.kernel.org/r/20211118095901.8271-1-quic_wgong@quicinc.com --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6459,37 +6459,7 @@ ath11k_mac_update_vif_chan(struct ath11k +@@ -6467,37 +6467,7 @@ ath11k_mac_update_vif_chan(struct ath11k lockdep_assert_held(&ar->conf_mutex); diff --git a/package/kernel/mac80211/patches/ath11k/0115-ath11k-add-read-variant-from-SMBIOS-for-download-boa.patch b/package/kernel/mac80211/patches/ath11k/0114-ath11k-add-read-variant-from-SMBIOS-for-download-boa.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0115-ath11k-add-read-variant-from-SMBIOS-for-download-boa.patch rename to package/kernel/mac80211/patches/ath11k/0114-ath11k-add-read-variant-from-SMBIOS-for-download-boa.patch index 7956d1492..9f93f4401 100644 --- a/package/kernel/mac80211/patches/ath11k/0115-ath11k-add-read-variant-from-SMBIOS-for-download-boa.patch +++ b/package/kernel/mac80211/patches/ath11k/0114-ath11k-add-read-variant-from-SMBIOS-for-download-boa.patch @@ -1,8 +1,7 @@ From 46e46db313a2bf3c48cac4eb8bdb613b762f301b Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 22 Nov 2021 13:13:58 +0200 -Subject: [PATCH 115/120] ath11k: add read variant from SMBIOS for download - board data +Subject: [PATCH] ath11k: add read variant from SMBIOS for download board data This is to read variant from SMBIOS such as read from DT, the variant string will be used to one part of string which used to search board diff --git a/package/kernel/mac80211/patches/ath11k/0116-ath11k-Fix-mon-status-ring-rx-tlv-processing.patch b/package/kernel/mac80211/patches/ath11k/0115-ath11k-Fix-mon-status-ring-rx-tlv-processing.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0116-ath11k-Fix-mon-status-ring-rx-tlv-processing.patch rename to package/kernel/mac80211/patches/ath11k/0115-ath11k-Fix-mon-status-ring-rx-tlv-processing.patch index 6c8fb867a..b3e908d55 100644 --- a/package/kernel/mac80211/patches/ath11k/0116-ath11k-Fix-mon-status-ring-rx-tlv-processing.patch +++ b/package/kernel/mac80211/patches/ath11k/0115-ath11k-Fix-mon-status-ring-rx-tlv-processing.patch @@ -1,7 +1,7 @@ From 09f16f7390f302937409738d6cb6ce99b265f455 Mon Sep 17 00:00:00 2001 From: Anilkumar Kolli Date: Mon, 22 Nov 2021 13:13:58 +0200 -Subject: [PATCH 116/120] ath11k: Fix mon status ring rx tlv processing +Subject: [PATCH] ath11k: Fix mon status ring rx tlv processing In HE monitor capture, HAL_TLV_STATUS_PPDU_DONE is received on processing multiple skb. Do not clear the ppdu_info diff --git a/package/kernel/mac80211/patches/ath11k/0117-Revert-ath11k-add-read-variant-from-SMBIOS-for-downl.patch b/package/kernel/mac80211/patches/ath11k/0116-Revert-ath11k-add-read-variant-from-SMBIOS-for-downl.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0117-Revert-ath11k-add-read-variant-from-SMBIOS-for-downl.patch rename to package/kernel/mac80211/patches/ath11k/0116-Revert-ath11k-add-read-variant-from-SMBIOS-for-downl.patch index 40cd1e07d..f4241394d 100644 --- a/package/kernel/mac80211/patches/ath11k/0117-Revert-ath11k-add-read-variant-from-SMBIOS-for-downl.patch +++ b/package/kernel/mac80211/patches/ath11k/0116-Revert-ath11k-add-read-variant-from-SMBIOS-for-downl.patch @@ -1,8 +1,8 @@ From 72f4124347724e3b8aa434f6bc4a2cd69f7bb336 Mon Sep 17 00:00:00 2001 From: Kalle Valo Date: Wed, 24 Nov 2021 11:43:16 +0200 -Subject: [PATCH 117/120] Revert "ath11k: add read variant from SMBIOS for - download board data" +Subject: [PATCH] Revert "ath11k: add read variant from SMBIOS for download + board data" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/package/kernel/mac80211/patches/ath11k/0118-ath11k-Fix-spelling-mistake-detetction-detection.patch b/package/kernel/mac80211/patches/ath11k/0117-ath11k-Fix-spelling-mistake-detetction-detection.patch similarity index 91% rename from package/kernel/mac80211/patches/ath11k/0118-ath11k-Fix-spelling-mistake-detetction-detection.patch rename to package/kernel/mac80211/patches/ath11k/0117-ath11k-Fix-spelling-mistake-detetction-detection.patch index bbfdcf4e0..751c2b1c9 100644 --- a/package/kernel/mac80211/patches/ath11k/0118-ath11k-Fix-spelling-mistake-detetction-detection.patch +++ b/package/kernel/mac80211/patches/ath11k/0117-ath11k-Fix-spelling-mistake-detetction-detection.patch @@ -1,8 +1,7 @@ From c27506cc7733261bafd7a97e7990407eef433d32 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 23 Nov 2021 09:04:31 +0000 -Subject: [PATCH 118/120] ath11k: Fix spelling mistake "detetction" -> - "detection" +Subject: [PATCH] ath11k: Fix spelling mistake "detetction" -> "detection" There is a spelling mistake in an ath11k_warn message. Fix it. diff --git a/package/kernel/mac80211/patches/ath11k/0120-ath11k-Use-host-CE-parameters-for-CE-interrupts-conf.patch b/package/kernel/mac80211/patches/ath11k/0120-ath11k-Use-host-CE-parameters-for-CE-interrupts-conf.patch deleted file mode 100644 index 9eaf1b2cf..000000000 --- a/package/kernel/mac80211/patches/ath11k/0120-ath11k-Use-host-CE-parameters-for-CE-interrupts-conf.patch +++ /dev/null @@ -1,69 +0,0 @@ -From b689f091aafd1a874b2f88137934276ab0fca480 Mon Sep 17 00:00:00 2001 -From: Anilkumar Kolli -Date: Wed, 24 Nov 2021 19:11:31 +0200 -Subject: [PATCH 120/120] ath11k: Use host CE parameters for CE interrupts - configuration - -CE interrupt configuration uses host ce parameters to assign/free -interrupts. Use host ce parameters to enable/disable interrupts. -This patch fixes below BUG, - -BUG: KASAN: global-out-of-bounds in 0xffffffbffdfb035c at addr -ffffffbffde6eeac - Read of size 4 by task kworker/u8:2/132 - Address belongs to variable ath11k_core_qmi_firmware_ready+0x1b0/0x5bc [ath11k] - -OOB is due to ath11k_ahb_ce_irqs_enable() iterates ce_count(which is 12) -times and accessing 12th element in target_ce_config -(which has only 11 elements) from ath11k_ahb_ce_irq_enable(). - -With this change host ce configs are used to enable/disable interrupts. - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00471-QCAHKSWPL_SILICONZ-1 - -Fixes: 967c1d1131fa ("ath11k: move target ce configs to hw_params") -Signed-off-by: Anilkumar Kolli -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1637249558-12793-1-git-send-email-akolli@codeaurora.org ---- - drivers/net/wireless/ath/ath11k/ahb.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -206,13 +206,13 @@ static void ath11k_ahb_clearbit32(struct - - static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) - { -- const struct ce_pipe_config *ce_config; -+ const struct ce_attr *ce_attr; - -- ce_config = &ab->hw_params.target_ce_config[ce_id]; -- if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) -+ 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); - -- if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { -+ if (ce_attr->dest_nentries) { - ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); - ath11k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, - CE_HOST_IE_3_ADDRESS); -@@ -221,13 +221,13 @@ static void ath11k_ahb_ce_irq_enable(str - - static void ath11k_ahb_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) - { -- const struct ce_pipe_config *ce_config; -+ const struct ce_attr *ce_attr; - -- ce_config = &ab->hw_params.target_ce_config[ce_id]; -- if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) -+ 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); - -- if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { -+ if (ce_attr->dest_nentries) { - ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); - ath11k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, - CE_HOST_IE_3_ADDRESS); diff --git a/package/kernel/mac80211/patches/ath11k/0121-ath11k-Avoid-NULL-ptr-access-during-mgmt-tx-cleanup.patch b/package/kernel/mac80211/patches/ath11k/0121-ath11k-Avoid-NULL-ptr-access-during-mgmt-tx-cleanup.patch deleted file mode 100644 index 7267fd034..000000000 --- a/package/kernel/mac80211/patches/ath11k/0121-ath11k-Avoid-NULL-ptr-access-during-mgmt-tx-cleanup.patch +++ /dev/null @@ -1,109 +0,0 @@ -From a93789ae541c7d5c1c2a4942013adb6bcc5e2848 Mon Sep 17 00:00:00 2001 -From: Sriram R -Date: Thu, 25 Nov 2021 15:00:14 +0530 -Subject: [PATCH] ath11k: Avoid NULL ptr access during mgmt tx cleanup - -Currently 'ar' reference is not added in skb_cb during -WMI mgmt tx. Though this is generally not used during tx completion -callbacks, on interface removal the remaining idr cleanup callback -uses the ar ptr from skb_cb from mgmt txmgmt_idr. Hence -fill them during tx call for proper usage. - -Also free the skb which is missing currently in these -callbacks. - -Crash_info: - -[19282.489476] Unable to handle kernel NULL pointer dereference at virtual address 00000000 -[19282.489515] pgd = 91eb8000 -[19282.496702] [00000000] *pgd=00000000 -[19282.502524] Internal error: Oops: 5 [#1] PREEMPT SMP ARM -[19282.783728] PC is at ath11k_mac_vif_txmgmt_idr_remove+0x28/0xd8 [ath11k] -[19282.789170] LR is at idr_for_each+0xa0/0xc8 - -Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00729-QCAHKSWPL_SILICONZ-3 v2 -Signed-off-by: Sriram R -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1637832614-13831-1-git-send-email-quic_srirrama@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 35 +++++++++++++++------------ - 1 file changed, 20 insertions(+), 15 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -1,6 +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. - */ - - #include -@@ -5224,23 +5225,32 @@ static int __ath11k_set_antenna(struct a - return 0; - } - --int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) -+static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id) - { -- struct sk_buff *msdu = skb; -+ struct sk_buff *msdu; - struct ieee80211_tx_info *info; -- struct ath11k *ar = ctx; -- struct ath11k_base *ab = ar->ab; - - spin_lock_bh(&ar->txmgmt_idr_lock); -- idr_remove(&ar->txmgmt_idr, buf_id); -+ msdu = idr_remove(&ar->txmgmt_idr, buf_id); - spin_unlock_bh(&ar->txmgmt_idr_lock); -- dma_unmap_single(ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, -+ -+ if (!msdu) -+ return; -+ -+ dma_unmap_single(ar->ab->dev, ATH11K_SKB_CB(msdu)->paddr, msdu->len, - DMA_TO_DEVICE); - - info = IEEE80211_SKB_CB(msdu); - memset(&info->status, 0, sizeof(info->status)); - - ieee80211_free_txskb(ar->hw, msdu); -+} -+ -+int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) -+{ -+ struct ath11k *ar = ctx; -+ -+ ath11k_mac_tx_mgmt_free(ar, buf_id); - - return 0; - } -@@ -5249,17 +5259,10 @@ static int ath11k_mac_vif_txmgmt_idr_rem - { - struct ieee80211_vif *vif = ctx; - struct ath11k_skb_cb *skb_cb = ATH11K_SKB_CB((struct sk_buff *)skb); -- struct sk_buff *msdu = skb; - struct ath11k *ar = skb_cb->ar; -- struct ath11k_base *ab = ar->ab; - -- if (skb_cb->vif == vif) { -- spin_lock_bh(&ar->txmgmt_idr_lock); -- idr_remove(&ar->txmgmt_idr, buf_id); -- spin_unlock_bh(&ar->txmgmt_idr_lock); -- dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, -- DMA_TO_DEVICE); -- } -+ if (skb_cb->vif == vif) -+ ath11k_mac_tx_mgmt_free(ar, buf_id); - - return 0; - } -@@ -5274,6 +5277,8 @@ static int ath11k_mac_mgmt_tx_wmi(struct - int buf_id; - int ret; - -+ ATH11K_SKB_CB(skb)->ar = ar; -+ - spin_lock_bh(&ar->txmgmt_idr_lock); - buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0, - ATH11K_TX_MGMT_NUM_PENDING_MAX, GFP_ATOMIC); diff --git a/package/kernel/mac80211/patches/ath11k/0122-ath11k-add-support-for-WCN6855-hw2.1.patch b/package/kernel/mac80211/patches/ath11k/0121-ath11k-add-support-for-WCN6855-hw2.1.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0122-ath11k-add-support-for-WCN6855-hw2.1.patch rename to package/kernel/mac80211/patches/ath11k/0121-ath11k-add-support-for-WCN6855-hw2.1.patch index 3aa43ad50..79d8b9140 100644 --- a/package/kernel/mac80211/patches/ath11k/0122-ath11k-add-support-for-WCN6855-hw2.1.patch +++ b/package/kernel/mac80211/patches/ath11k/0121-ath11k-add-support-for-WCN6855-hw2.1.patch @@ -127,7 +127,7 @@ Link: https://lore.kernel.org/r/20211129025613.21594-1-quic_bqiang@quicinc.com #define TCSR_SOC_HW_VERSION_MINOR_MASK GENMASK(7, 0) /* BAR0 + 4k is always accessible, and no -@@ -1409,9 +1409,21 @@ static int ath11k_pci_probe(struct pci_d +@@ -1415,9 +1415,21 @@ static int ath11k_pci_probe(struct pci_d &soc_hw_version_minor); switch (soc_hw_version_major) { case 2: diff --git a/package/kernel/mac80211/patches/ath11k/0123-ath11k-Fix-QMI-file-type-enum-value.patch b/package/kernel/mac80211/patches/ath11k/0122-ath11k-Fix-QMI-file-type-enum-value.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0123-ath11k-Fix-QMI-file-type-enum-value.patch rename to package/kernel/mac80211/patches/ath11k/0122-ath11k-Fix-QMI-file-type-enum-value.patch diff --git a/package/kernel/mac80211/patches/ath11k/0124-ath11k-change-to-use-dynamic-memory-for-channel-list.patch b/package/kernel/mac80211/patches/ath11k/0123-ath11k-change-to-use-dynamic-memory-for-channel-list.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0124-ath11k-change-to-use-dynamic-memory-for-channel-list.patch rename to package/kernel/mac80211/patches/ath11k/0123-ath11k-change-to-use-dynamic-memory-for-channel-list.patch index 11399d333..fa508e8a7 100644 --- a/package/kernel/mac80211/patches/ath11k/0124-ath11k-change-to-use-dynamic-memory-for-channel-list.patch +++ b/package/kernel/mac80211/patches/ath11k/0123-ath11k-change-to-use-dynamic-memory-for-channel-list.patch @@ -21,7 +21,7 @@ Link: https://lore.kernel.org/r/20211129110939.15711-1-quic_wgong@quicinc.com --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3501,6 +3501,14 @@ static int ath11k_mac_op_hw_scan(struct +@@ -3504,6 +3504,14 @@ static int ath11k_mac_op_hw_scan(struct if (req->n_channels) { arg.num_chan = req->n_channels; @@ -36,7 +36,7 @@ Link: https://lore.kernel.org/r/20211129110939.15711-1-quic_wgong@quicinc.com for (i = 0; i < arg.num_chan; i++) arg.chan_list[i] = req->channels[i]->center_freq; } -@@ -3519,6 +3527,8 @@ static int ath11k_mac_op_hw_scan(struct +@@ -3522,6 +3530,8 @@ static int ath11k_mac_op_hw_scan(struct ATH11K_MAC_SCAN_TIMEOUT_MSECS)); exit: diff --git a/package/kernel/mac80211/patches/ath11k/0126-ath11k-add-configure-country-code-for-QCA6390-and-WC.patch b/package/kernel/mac80211/patches/ath11k/0125-ath11k-add-configure-country-code-for-QCA6390-and-WC.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0126-ath11k-add-configure-country-code-for-QCA6390-and-WC.patch rename to package/kernel/mac80211/patches/ath11k/0125-ath11k-add-configure-country-code-for-QCA6390-and-WC.patch diff --git a/package/kernel/mac80211/patches/ath11k/0125-ath11k-avoid-deadlock-by-change-ieee80211_queue_work.patch b/package/kernel/mac80211/patches/ath11k/0125-ath11k-avoid-deadlock-by-change-ieee80211_queue_work.patch deleted file mode 100644 index 28796600a..000000000 --- a/package/kernel/mac80211/patches/ath11k/0125-ath11k-avoid-deadlock-by-change-ieee80211_queue_work.patch +++ /dev/null @@ -1,195 +0,0 @@ -From ed05c7cf1286d7e31e7623bce55ff135723591bf Mon Sep 17 00:00:00 2001 -From: Wen Gong -Date: Tue, 7 Dec 2021 17:23:36 +0200 -Subject: [PATCH] ath11k: avoid deadlock by change ieee80211_queue_work for - regd_update_work - -When enable debug config, it print below warning while shut down wlan -interface shuh as run "ifconfig wlan0 down". - -The reason is because ar->regd_update_work is ran once, and it is will -call wiphy_lock(ar->hw->wiphy) in function ath11k_regd_update() which -is running in workqueue of ieee80211_local queued by ieee80211_queue_work(). -Another thread from "ifconfig wlan0 down" will also accuqire the lock -by wiphy_lock(sdata->local->hw.wiphy) in function ieee80211_stop(), and -then it call ieee80211_stop_device() to flush_workqueue(local->workqueue), -this will wait the workqueue of ieee80211_local finished. Then deadlock -will happen easily if the two thread run meanwhile. - -Below warning disappeared after this change. - -[ 914.088798] ath11k_pci 0000:05:00.0: mac remove interface (vdev 0) -[ 914.088806] ath11k_pci 0000:05:00.0: mac stop 11d scan -[ 914.088810] ath11k_pci 0000:05:00.0: mac stop 11d vdev id 0 -[ 914.088827] ath11k_pci 0000:05:00.0: htc ep 2 consumed 1 credits (total 0) -[ 914.088841] ath11k_pci 0000:05:00.0: send 11d scan stop vdev id 0 -[ 914.088849] ath11k_pci 0000:05:00.0: htc insufficient credits ep 2 required 1 available 0 -[ 914.088856] ath11k_pci 0000:05:00.0: htc insufficient credits ep 2 required 1 available 0 -[ 914.096434] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 16 -[ 914.096442] ath11k_pci 0000:05:00.0: htc ep 2 got 1 credits (total 1) -[ 914.096481] ath11k_pci 0000:05:00.0: htc ep 2 consumed 1 credits (total 0) -[ 914.096491] ath11k_pci 0000:05:00.0: WMI vdev delete id 0 -[ 914.111598] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 16 -[ 914.111628] ath11k_pci 0000:05:00.0: htc ep 2 got 1 credits (total 1) -[ 914.114659] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 20 -[ 914.114742] ath11k_pci 0000:05:00.0: htc rx completion ep 2 skb pK-error -[ 914.115977] ath11k_pci 0000:05:00.0: vdev delete resp for vdev id 0 -[ 914.116685] ath11k_pci 0000:05:00.0: vdev 00:03:7f:29:61:11 deleted, vdev_id 0 - -[ 914.117583] ====================================================== -[ 914.117592] WARNING: possible circular locking dependency detected -[ 914.117600] 5.16.0-rc1-wt-ath+ #1 Tainted: G OE -[ 914.117611] ------------------------------------------------------ -[ 914.117618] ifconfig/2805 is trying to acquire lock: -[ 914.117628] ffff9c00a62bb548 ((wq_completion)phy0){+.+.}-{0:0}, at: flush_workqueue+0x87/0x470 -[ 914.117674] - but task is already holding lock: -[ 914.117682] ffff9c00baea07d0 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: ieee80211_stop+0x38/0x180 [mac80211] -[ 914.117872] - which lock already depends on the new lock. - -[ 914.117880] - the existing dependency chain (in reverse order) is: -[ 914.117888] - -> #3 (&rdev->wiphy.mtx){+.+.}-{4:4}: -[ 914.117910] __mutex_lock+0xa0/0x9c0 -[ 914.117930] mutex_lock_nested+0x1b/0x20 -[ 914.117944] reg_process_self_managed_hints+0x3a/0xb0 [cfg80211] -[ 914.118093] wiphy_regulatory_register+0x47/0x80 [cfg80211] -[ 914.118229] wiphy_register+0x84f/0x9c0 [cfg80211] -[ 914.118353] ieee80211_register_hw+0x6b1/0xd90 [mac80211] -[ 914.118486] ath11k_mac_register+0x6af/0xb60 [ath11k] -[ 914.118550] ath11k_core_qmi_firmware_ready+0x383/0x4a0 [ath11k] -[ 914.118598] ath11k_qmi_driver_event_work+0x347/0x4a0 [ath11k] -[ 914.118656] process_one_work+0x228/0x670 -[ 914.118669] worker_thread+0x4d/0x440 -[ 914.118680] kthread+0x16d/0x1b0 -[ 914.118697] ret_from_fork+0x22/0x30 -[ 914.118714] - -> #2 (rtnl_mutex){+.+.}-{4:4}: -[ 914.118736] __mutex_lock+0xa0/0x9c0 -[ 914.118751] mutex_lock_nested+0x1b/0x20 -[ 914.118767] rtnl_lock+0x17/0x20 -[ 914.118783] ath11k_regd_update+0x15a/0x260 [ath11k] -[ 914.118841] ath11k_regd_update_work+0x15/0x20 [ath11k] -[ 914.118897] process_one_work+0x228/0x670 -[ 914.118909] worker_thread+0x4d/0x440 -[ 914.118920] kthread+0x16d/0x1b0 -[ 914.118934] ret_from_fork+0x22/0x30 -[ 914.118948] - -> #1 ((work_completion)(&ar->regd_update_work)){+.+.}-{0:0}: -[ 914.118972] process_one_work+0x1fa/0x670 -[ 914.118984] worker_thread+0x4d/0x440 -[ 914.118996] kthread+0x16d/0x1b0 -[ 914.119010] ret_from_fork+0x22/0x30 -[ 914.119023] - -> #0 ((wq_completion)phy0){+.+.}-{0:0}: -[ 914.119045] __lock_acquire+0x146d/0x1cf0 -[ 914.119057] lock_acquire+0x19b/0x360 -[ 914.119067] flush_workqueue+0xae/0x470 -[ 914.119084] ieee80211_stop_device+0x3b/0x50 [mac80211] -[ 914.119260] ieee80211_do_stop+0x5d7/0x830 [mac80211] -[ 914.119409] ieee80211_stop+0x45/0x180 [mac80211] -[ 914.119557] __dev_close_many+0xb3/0x120 -[ 914.119573] __dev_change_flags+0xc3/0x1d0 -[ 914.119590] dev_change_flags+0x29/0x70 -[ 914.119605] devinet_ioctl+0x653/0x810 -[ 914.119620] inet_ioctl+0x193/0x1e0 -[ 914.119631] sock_do_ioctl+0x4d/0xf0 -[ 914.119649] sock_ioctl+0x262/0x340 -[ 914.119665] __x64_sys_ioctl+0x96/0xd0 -[ 914.119678] do_syscall_64+0x3d/0xd0 -[ 914.119694] entry_SYSCALL_64_after_hwframe+0x44/0xae -[ 914.119709] - other info that might help us debug this: - -[ 914.119717] Chain exists of: - (wq_completion)phy0 --> rtnl_mutex --> &rdev->wiphy.mtx - -[ 914.119745] Possible unsafe locking scenario: - -[ 914.119752] CPU0 CPU1 -[ 914.119758] ---- ---- -[ 914.119765] lock(&rdev->wiphy.mtx); -[ 914.119778] lock(rtnl_mutex); -[ 914.119792] lock(&rdev->wiphy.mtx); -[ 914.119807] lock((wq_completion)phy0); -[ 914.119819] - *** DEADLOCK *** - -[ 914.119827] 2 locks held by ifconfig/2805: -[ 914.119837] #0: ffffffffba3dc010 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_lock+0x17/0x20 -[ 914.119872] #1: ffff9c00baea07d0 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: ieee80211_stop+0x38/0x180 [mac80211] -[ 914.120039] - stack backtrace: -[ 914.120048] CPU: 0 PID: 2805 Comm: ifconfig Tainted: G OE 5.16.0-rc1-wt-ath+ #1 -[ 914.120064] Hardware name: LENOVO 418065C/418065C, BIOS 83ET63WW (1.33 ) 07/29/2011 -[ 914.120074] Call Trace: -[ 914.120084] -[ 914.120094] dump_stack_lvl+0x73/0xa4 -[ 914.120119] dump_stack+0x10/0x12 -[ 914.120135] print_circular_bug.isra.44+0x221/0x2e0 -[ 914.120165] check_noncircular+0x106/0x150 -[ 914.120203] __lock_acquire+0x146d/0x1cf0 -[ 914.120215] ? __lock_acquire+0x146d/0x1cf0 -[ 914.120245] lock_acquire+0x19b/0x360 -[ 914.120259] ? flush_workqueue+0x87/0x470 -[ 914.120286] ? lockdep_init_map_type+0x6b/0x250 -[ 914.120310] flush_workqueue+0xae/0x470 -[ 914.120327] ? flush_workqueue+0x87/0x470 -[ 914.120344] ? lockdep_hardirqs_on+0xd7/0x150 -[ 914.120391] ieee80211_stop_device+0x3b/0x50 [mac80211] -[ 914.120565] ? ieee80211_stop_device+0x3b/0x50 [mac80211] -[ 914.120736] ieee80211_do_stop+0x5d7/0x830 [mac80211] -[ 914.120906] ieee80211_stop+0x45/0x180 [mac80211] -[ 914.121060] __dev_close_many+0xb3/0x120 -[ 914.121081] __dev_change_flags+0xc3/0x1d0 -[ 914.121109] dev_change_flags+0x29/0x70 -[ 914.121131] devinet_ioctl+0x653/0x810 -[ 914.121149] ? __might_fault+0x77/0x80 -[ 914.121179] inet_ioctl+0x193/0x1e0 -[ 914.121194] ? inet_ioctl+0x193/0x1e0 -[ 914.121218] ? __might_fault+0x77/0x80 -[ 914.121238] ? _copy_to_user+0x68/0x80 -[ 914.121266] sock_do_ioctl+0x4d/0xf0 -[ 914.121283] ? inet_stream_connect+0x60/0x60 -[ 914.121297] ? sock_do_ioctl+0x4d/0xf0 -[ 914.121329] sock_ioctl+0x262/0x340 -[ 914.121347] ? sock_ioctl+0x262/0x340 -[ 914.121362] ? exit_to_user_mode_prepare+0x13b/0x280 -[ 914.121388] ? syscall_enter_from_user_mode+0x20/0x50 -[ 914.121416] __x64_sys_ioctl+0x96/0xd0 -[ 914.121430] ? br_ioctl_call+0x90/0x90 -[ 914.121445] ? __x64_sys_ioctl+0x96/0xd0 -[ 914.121465] do_syscall_64+0x3d/0xd0 -[ 914.121482] entry_SYSCALL_64_after_hwframe+0x44/0xae -[ 914.121497] RIP: 0033:0x7f0ed051737b -[ 914.121513] Code: 0f 1e fa 48 8b 05 15 3b 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e5 3a 0d 00 f7 d8 64 89 01 48 -[ 914.121527] RSP: 002b:00007fff7be38b98 EFLAGS: 00000202 ORIG_RAX: 0000000000000010 -[ 914.121544] RAX: ffffffffffffffda RBX: 00007fff7be38ba0 RCX: 00007f0ed051737b -[ 914.121555] RDX: 00007fff7be38ba0 RSI: 0000000000008914 RDI: 0000000000000004 -[ 914.121566] RBP: 00007fff7be38c60 R08: 000000000000000a R09: 0000000000000001 -[ 914.121576] R10: 0000000000000000 R11: 0000000000000202 R12: 00000000fffffffe -[ 914.121586] R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000 -[ 914.121620] - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 - -Signed-off-by: Wen Gong -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211201071745.17746-2-quic_wgong@quicinc.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 -@@ -6032,7 +6032,7 @@ static int ath11k_reg_chan_list_event(st - ar = ab->pdevs[pdev_idx].ar; - kfree(ab->new_regd[pdev_idx]); - ab->new_regd[pdev_idx] = regd; -- ieee80211_queue_work(ar->hw, &ar->regd_update_work); -+ queue_work(ab->workqueue, &ar->regd_update_work); - } else { - /* This regd would be applied during mac registration and is - * held constant throughout for regd intersection purpose diff --git a/package/kernel/mac80211/patches/ath11k/0127-ath11k-add-11d-scan-offload-support.patch b/package/kernel/mac80211/patches/ath11k/0126-ath11k-add-11d-scan-offload-support.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0127-ath11k-add-11d-scan-offload-support.patch rename to package/kernel/mac80211/patches/ath11k/0126-ath11k-add-11d-scan-offload-support.patch index 8cf2feeea..72b82111d 100644 --- a/package/kernel/mac80211/patches/ath11k/0127-ath11k-add-11d-scan-offload-support.patch +++ b/package/kernel/mac80211/patches/ath11k/0126-ath11k-add-11d-scan-offload-support.patch @@ -88,7 +88,7 @@ Link: https://lore.kernel.org/r/20211201071745.17746-4-quic_wgong@quicinc.com init_completion(&ab->wow.wakeup_completed); --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -588,6 +588,11 @@ struct ath11k { +@@ -589,6 +589,11 @@ struct ath11k { #endif bool dfs_block_radar_events; struct ath11k_thermal thermal; @@ -180,7 +180,7 @@ Link: https://lore.kernel.org/r/20211201071745.17746-4-quic_wgong@quicinc.com memset(&arg, 0, sizeof(arg)); ath11k_wmi_start_scan_init(ar, &arg); arg.vdev_id = arvif->vdev_id; -@@ -5635,6 +5665,7 @@ static void ath11k_mac_op_stop(struct ie +@@ -5638,6 +5668,7 @@ static void ath11k_mac_op_stop(struct ie cancel_delayed_work_sync(&ar->scan.timeout); cancel_work_sync(&ar->regd_update_work); @@ -188,7 +188,7 @@ Link: https://lore.kernel.org/r/20211201071745.17746-4-quic_wgong@quicinc.com spin_lock_bh(&ar->data_lock); list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { -@@ -5788,6 +5819,122 @@ static void ath11k_mac_op_update_vif_off +@@ -5791,6 +5822,122 @@ static void ath11k_mac_op_update_vif_off } } @@ -311,7 +311,7 @@ Link: https://lore.kernel.org/r/20211201071745.17746-4-quic_wgong@quicinc.com static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { -@@ -5921,6 +6068,8 @@ static int ath11k_mac_op_add_interface(s +@@ -5924,6 +6071,8 @@ static int ath11k_mac_op_add_interface(s arvif->vdev_id, ret); goto err_peer_del; } @@ -320,7 +320,7 @@ Link: https://lore.kernel.org/r/20211201071745.17746-4-quic_wgong@quicinc.com break; case WMI_VDEV_TYPE_STA: param_id = WMI_STA_PS_PARAM_RX_WAKE_POLICY; -@@ -5960,6 +6109,9 @@ static int ath11k_mac_op_add_interface(s +@@ -5963,6 +6112,9 @@ static int ath11k_mac_op_add_interface(s arvif->vdev_id, ret); goto err_peer_del; } @@ -330,7 +330,7 @@ Link: https://lore.kernel.org/r/20211201071745.17746-4-quic_wgong@quicinc.com break; case WMI_VDEV_TYPE_MONITOR: set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); -@@ -6061,6 +6213,9 @@ static void ath11k_mac_op_remove_interfa +@@ -6064,6 +6216,9 @@ static void ath11k_mac_op_remove_interfa ath11k_dbg(ab, ATH11K_DBG_MAC, "mac remove interface (vdev %d)\n", arvif->vdev_id); @@ -340,7 +340,7 @@ Link: https://lore.kernel.org/r/20211201071745.17746-4-quic_wgong@quicinc.com if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { ret = ath11k_peer_delete(ar, arvif->vdev_id, vif->addr); if (ret) -@@ -6779,6 +6934,9 @@ ath11k_mac_op_unassign_vif_chanctx(struc +@@ -6782,6 +6937,9 @@ ath11k_mac_op_unassign_vif_chanctx(struc ret); } @@ -350,7 +350,7 @@ Link: https://lore.kernel.org/r/20211201071745.17746-4-quic_wgong@quicinc.com mutex_unlock(&ar->conf_mutex); } -@@ -8180,6 +8338,9 @@ int ath11k_mac_allocate(struct ath11k_ba +@@ -8183,6 +8341,9 @@ int ath11k_mac_allocate(struct ath11k_ba ar->monitor_vdev_id = -1; clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); diff --git a/package/kernel/mac80211/patches/ath11k/0128-ath11k-add-wait-operation-for-tx-management-packets-.patch b/package/kernel/mac80211/patches/ath11k/0127-ath11k-add-wait-operation-for-tx-management-packets-.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0128-ath11k-add-wait-operation-for-tx-management-packets-.patch rename to package/kernel/mac80211/patches/ath11k/0127-ath11k-add-wait-operation-for-tx-management-packets-.patch index 7dad11011..dffa7acba 100644 --- a/package/kernel/mac80211/patches/ath11k/0128-ath11k-add-wait-operation-for-tx-management-packets-.patch +++ b/package/kernel/mac80211/patches/ath11k/0127-ath11k-add-wait-operation-for-tx-management-packets-.patch @@ -64,7 +64,7 @@ Link: https://lore.kernel.org/r/20211202063705.14321-1-quic_wgong@quicinc.com wake_up(&ab->wmi_ab.tx_credits_wq); --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -550,6 +550,7 @@ struct ath11k { +@@ -551,6 +551,7 @@ struct ath11k { /* protects txmgmt_idr data */ spinlock_t txmgmt_idr_lock; atomic_t num_pending_mgmt_tx; @@ -74,7 +74,7 @@ Link: https://lore.kernel.org/r/20211202063705.14321-1-quic_wgong@quicinc.com * access protected by data_lock --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5265,6 +5265,21 @@ static int __ath11k_set_antenna(struct a +@@ -5268,6 +5268,21 @@ static int __ath11k_set_antenna(struct a return 0; } @@ -96,7 +96,7 @@ Link: https://lore.kernel.org/r/20211202063705.14321-1-quic_wgong@quicinc.com static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id) { struct sk_buff *msdu; -@@ -5283,7 +5298,7 @@ static void ath11k_mac_tx_mgmt_free(stru +@@ -5286,7 +5301,7 @@ static void ath11k_mac_tx_mgmt_free(stru info = IEEE80211_SKB_CB(msdu); memset(&info->status, 0, sizeof(info->status)); @@ -105,7 +105,7 @@ Link: https://lore.kernel.org/r/20211202063705.14321-1-quic_wgong@quicinc.com } int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) -@@ -5323,6 +5338,10 @@ static int ath11k_mac_mgmt_tx_wmi(struct +@@ -5326,6 +5341,10 @@ static int ath11k_mac_mgmt_tx_wmi(struct buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0, ATH11K_TX_MGMT_NUM_PENDING_MAX, GFP_ATOMIC); spin_unlock_bh(&ar->txmgmt_idr_lock); @@ -116,7 +116,7 @@ Link: https://lore.kernel.org/r/20211202063705.14321-1-quic_wgong@quicinc.com if (buf_id < 0) return -ENOSPC; -@@ -5369,7 +5388,7 @@ static void ath11k_mgmt_over_wmi_tx_purg +@@ -5372,7 +5391,7 @@ static void ath11k_mgmt_over_wmi_tx_purg struct sk_buff *skb; while ((skb = skb_dequeue(&ar->wmi_mgmt_tx_queue)) != NULL) @@ -125,7 +125,7 @@ Link: https://lore.kernel.org/r/20211202063705.14321-1-quic_wgong@quicinc.com } static void ath11k_mgmt_over_wmi_tx_work(struct work_struct *work) -@@ -5384,29 +5403,29 @@ static void ath11k_mgmt_over_wmi_tx_work +@@ -5387,29 +5406,29 @@ static void ath11k_mgmt_over_wmi_tx_work skb_cb = ATH11K_SKB_CB(skb); if (!skb_cb->vif) { ath11k_warn(ar->ab, "no vif found for mgmt frame\n"); @@ -162,7 +162,7 @@ Link: https://lore.kernel.org/r/20211202063705.14321-1-quic_wgong@quicinc.com } } } -@@ -5437,6 +5456,7 @@ static int ath11k_mac_mgmt_tx(struct ath +@@ -5440,6 +5459,7 @@ static int ath11k_mac_mgmt_tx(struct ath } skb_queue_tail(q, skb); @@ -170,7 +170,7 @@ Link: https://lore.kernel.org/r/20211202063705.14321-1-quic_wgong@quicinc.com ieee80211_queue_work(ar->hw, &ar->wmi_mgmt_tx_work); return 0; -@@ -7023,6 +7043,17 @@ static void ath11k_mac_op_flush(struct i +@@ -7026,6 +7046,17 @@ static void ath11k_mac_op_flush(struct i ATH11K_FLUSH_TIMEOUT); if (time_left == 0) ath11k_warn(ar->ab, "failed to flush transmit queue %ld\n", time_left); @@ -188,7 +188,7 @@ Link: https://lore.kernel.org/r/20211202063705.14321-1-quic_wgong@quicinc.com } static int -@@ -8261,6 +8292,8 @@ int ath11k_mac_register(struct ath11k_ba +@@ -8264,6 +8295,8 @@ int ath11k_mac_register(struct ath11k_ba ret = __ath11k_mac_register(ar); if (ret) goto err_cleanup; diff --git a/package/kernel/mac80211/patches/ath11k/0129-ath11k-Fix-buffer-overflow-when-scanning-with-extrai.patch b/package/kernel/mac80211/patches/ath11k/0129-ath11k-Fix-buffer-overflow-when-scanning-with-extrai.patch deleted file mode 100644 index dbe0f655d..000000000 --- a/package/kernel/mac80211/patches/ath11k/0129-ath11k-Fix-buffer-overflow-when-scanning-with-extrai.patch +++ /dev/null @@ -1,71 +0,0 @@ -From a658c929ded7ea3aee324c8c2a9635a5e5a38e7f Mon Sep 17 00:00:00 2001 -From: Sven Eckelmann -Date: Wed, 8 Dec 2021 10:43:59 +0200 -Subject: [PATCH] ath11k: Fix buffer overflow when scanning with extraie - -If cfg80211 is providing extraie's for a scanning process then ath11k will -copy that over to the firmware. The extraie.len is a 32 bit value in struct -element_info and describes the amount of bytes for the vendor information -elements. - -The WMI_TLV packet is having a special WMI_TAG_ARRAY_BYTE section. This -section can have a (payload) length up to 65535 bytes because the -WMI_TLV_LEN can store up to 16 bits. The code was missing such a check and -could have created a scan request which cannot be parsed correctly by the -firmware. - -But the bigger problem was the allocation of the buffer. It has to align -the TLV sections by 4 bytes. But the code was using an u8 to store the -newly calculated length of this section (with alignment). And the new -calculated length was then used to allocate the skbuff. But the actual code -to copy in the data is using the extraie.len and not the calculated -"aligned" length. - -The length of extraie with IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS enabled -was 264 bytes during tests with a QCA Milan card. But it only allocated 8 -bytes (264 bytes % 256) for it. As consequence, the code to memcpy the -extraie into the skb was then just overwriting data after skb->end. Things -like shinfo were therefore corrupted. This could usually be seen by a crash -in skb_zcopy_clear which tried to call a ubuf_info callback (using a bogus -address). - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-02892.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 - -Cc: stable@vger.kernel.org -Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") -Signed-off-by: Sven Eckelmann -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211207142913.1734635-1-sven@narfation.org ---- - drivers/net/wireless/ath/ath11k/wmi.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/wmi.c -+++ b/drivers/net/wireless/ath/ath11k/wmi.c -@@ -2113,7 +2113,7 @@ int ath11k_wmi_send_scan_start_cmd(struc - void *ptr; - int i, ret, len; - u32 *tmp_ptr; -- u8 extraie_len_with_pad = 0; -+ u16 extraie_len_with_pad = 0; - struct hint_short_ssid *s_ssid = NULL; - struct hint_bssid *hint_bssid = NULL; - -@@ -2132,7 +2132,7 @@ int ath11k_wmi_send_scan_start_cmd(struc - len += sizeof(*bssid) * params->num_bssid; - - len += TLV_HDR_SIZE; -- if (params->extraie.len) -+ if (params->extraie.len && params->extraie.len <= 0xFFFF) - extraie_len_with_pad = - roundup(params->extraie.len, sizeof(u32)); - len += extraie_len_with_pad; -@@ -2239,7 +2239,7 @@ int ath11k_wmi_send_scan_start_cmd(struc - FIELD_PREP(WMI_TLV_LEN, len); - ptr += TLV_HDR_SIZE; - -- if (params->extraie.len) -+ if (extraie_len_with_pad) - memcpy(ptr, params->extraie.ptr, - params->extraie.len); - diff --git a/package/kernel/mac80211/patches/ath11k/0130-ath11k-enable-IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS-.patch b/package/kernel/mac80211/patches/ath11k/0129-ath11k-enable-IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS-.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0130-ath11k-enable-IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS-.patch rename to package/kernel/mac80211/patches/ath11k/0129-ath11k-enable-IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS-.patch index d0dfb12a5..bb1336216 100644 --- a/package/kernel/mac80211/patches/ath11k/0130-ath11k-enable-IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS-.patch +++ b/package/kernel/mac80211/patches/ath11k/0129-ath11k-enable-IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS-.patch @@ -30,7 +30,7 @@ Link: https://lore.kernel.org/r/20211129101309.2931-1-quic_wgong@quicinc.com --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -8119,6 +8119,9 @@ static int __ath11k_mac_register(struct +@@ -8122,6 +8122,9 @@ static int __ath11k_mac_register(struct ar->hw->wiphy->interface_modes = ab->hw_params.interface_modes; diff --git a/package/kernel/mac80211/patches/ath11k/0131-ath11k-Add-htt-cmd-to-enable-full-monitor-mode.patch b/package/kernel/mac80211/patches/ath11k/0130-ath11k-Add-htt-cmd-to-enable-full-monitor-mode.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0131-ath11k-Add-htt-cmd-to-enable-full-monitor-mode.patch rename to package/kernel/mac80211/patches/ath11k/0130-ath11k-Add-htt-cmd-to-enable-full-monitor-mode.patch diff --git a/package/kernel/mac80211/patches/ath11k/0132-ath11k-add-software-monitor-ring-descriptor-for-full.patch b/package/kernel/mac80211/patches/ath11k/0131-ath11k-add-software-monitor-ring-descriptor-for-full.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0132-ath11k-add-software-monitor-ring-descriptor-for-full.patch rename to package/kernel/mac80211/patches/ath11k/0131-ath11k-add-software-monitor-ring-descriptor-for-full.patch diff --git a/package/kernel/mac80211/patches/ath11k/0133-ath11k-Process-full-monitor-mode-rx-support.patch b/package/kernel/mac80211/patches/ath11k/0132-ath11k-Process-full-monitor-mode-rx-support.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0133-ath11k-Process-full-monitor-mode-rx-support.patch rename to package/kernel/mac80211/patches/ath11k/0132-ath11k-Process-full-monitor-mode-rx-support.patch diff --git a/package/kernel/mac80211/patches/ath11k/0134-ath11k-add-spectral-CFR-buffer-validation-support.patch b/package/kernel/mac80211/patches/ath11k/0133-ath11k-add-spectral-CFR-buffer-validation-support.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0134-ath11k-add-spectral-CFR-buffer-validation-support.patch rename to package/kernel/mac80211/patches/ath11k/0133-ath11k-add-spectral-CFR-buffer-validation-support.patch diff --git a/package/kernel/mac80211/patches/ath11k/0135-ath11k-support-MAC-address-randomization-in-scan.patch b/package/kernel/mac80211/patches/ath11k/0136-ath11k-support-MAC-address-randomization-in-scan.patch similarity index 95% rename from package/kernel/mac80211/patches/ath11k/0135-ath11k-support-MAC-address-randomization-in-scan.patch rename to package/kernel/mac80211/patches/ath11k/0136-ath11k-support-MAC-address-randomization-in-scan.patch index 772bb54bb..90b984b0f 100644 --- a/package/kernel/mac80211/patches/ath11k/0135-ath11k-support-MAC-address-randomization-in-scan.patch +++ b/package/kernel/mac80211/patches/ath11k/0136-ath11k-support-MAC-address-randomization-in-scan.patch @@ -21,7 +21,7 @@ Link: https://lore.kernel.org/r/1638948007-9609-1-git-send-email-quic_cjhuang@qu --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3543,6 +3543,12 @@ static int ath11k_mac_op_hw_scan(struct +@@ -3546,6 +3546,12 @@ static int ath11k_mac_op_hw_scan(struct arg.chan_list[i] = req->channels[i]->center_freq; } @@ -34,7 +34,7 @@ Link: https://lore.kernel.org/r/1638948007-9609-1-git-send-email-quic_cjhuang@qu ret = ath11k_start_scan(ar, &arg); if (ret) { ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret); -@@ -5587,6 +5593,14 @@ static int ath11k_mac_op_start(struct ie +@@ -5590,6 +5596,14 @@ static int ath11k_mac_op_start(struct ie goto err; } @@ -49,7 +49,7 @@ Link: https://lore.kernel.org/r/1638948007-9609-1-git-send-email-quic_cjhuang@qu ret = ath11k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_ARP_AC_OVERRIDE, 0, pdev->pdev_id); if (ret) { -@@ -8183,6 +8197,11 @@ static int __ath11k_mac_register(struct +@@ -8186,6 +8200,11 @@ static int __ath11k_mac_register(struct ar->hw->wiphy->max_ap_assoc_sta = ar->max_num_stations; diff --git a/package/kernel/mac80211/patches/ath11k/0137-ath11k-Avoid-false-DEADLOCK-warning-reported-by-lock.patch b/package/kernel/mac80211/patches/ath11k/0137-ath11k-Avoid-false-DEADLOCK-warning-reported-by-lock.patch deleted file mode 100644 index c2f097f29..000000000 --- a/package/kernel/mac80211/patches/ath11k/0137-ath11k-Avoid-false-DEADLOCK-warning-reported-by-lock.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 767c94caf0efad136157110787fe221b74cb5c8a Mon Sep 17 00:00:00 2001 -From: Baochen Qiang -Date: Thu, 9 Dec 2021 09:19:49 +0800 -Subject: [PATCH] ath11k: Avoid false DEADLOCK warning reported by lockdep - -With CONFIG_LOCKDEP=y and CONFIG_DEBUG_SPINLOCK=y, lockdep reports -below warning: - -[ 166.059415] ============================================ -[ 166.059416] WARNING: possible recursive locking detected -[ 166.059418] 5.15.0-wt-ath+ #10 Tainted: G W O -[ 166.059420] -------------------------------------------- -[ 166.059421] kworker/0:2/116 is trying to acquire lock: -[ 166.059423] ffff9905f2083160 (&srng->lock){+.-.}-{2:2}, at: ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k] -[ 166.059440] - but task is already holding lock: -[ 166.059442] ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k] -[ 166.059491] - other info that might help us debug this: -[ 166.059492] Possible unsafe locking scenario: - -[ 166.059493] CPU0 -[ 166.059494] ---- -[ 166.059495] lock(&srng->lock); -[ 166.059498] lock(&srng->lock); -[ 166.059500] - *** DEADLOCK *** - -[ 166.059501] May be due to missing lock nesting notation - -[ 166.059502] 3 locks held by kworker/0:2/116: -[ 166.059504] #0: ffff9905c0081548 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660 -[ 166.059511] #1: ffff9d2400a5fe68 ((debug_obj_work).work){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660 -[ 166.059517] #2: ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k] -[ 166.059532] - stack backtrace: -[ 166.059534] CPU: 0 PID: 116 Comm: kworker/0:2 Kdump: loaded Tainted: G W O 5.15.0-wt-ath+ #10 -[ 166.059537] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0059.2019.1112.1124 11/12/2019 -[ 166.059539] Workqueue: events free_obj_work -[ 166.059543] Call Trace: -[ 166.059545] -[ 166.059547] dump_stack_lvl+0x56/0x7b -[ 166.059552] __lock_acquire+0xb9a/0x1a50 -[ 166.059556] lock_acquire+0x1e2/0x330 -[ 166.059560] ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k] -[ 166.059571] _raw_spin_lock_bh+0x33/0x70 -[ 166.059574] ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k] -[ 166.059584] ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k] -[ 166.059594] ath11k_dp_tx_send_reo_cmd+0x3f/0x130 [ath11k] -[ 166.059605] ath11k_dp_rx_tid_del_func+0x221/0x370 [ath11k] -[ 166.059618] ath11k_dp_process_reo_status+0x22f/0x2d0 [ath11k] -[ 166.059632] ? ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k] -[ 166.059643] ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k] -[ 166.059655] ath11k_pci_ext_grp_napi_poll+0x1c/0x70 [ath11k_pci] -[ 166.059659] __napi_poll+0x28/0x230 -[ 166.059664] net_rx_action+0x285/0x310 -[ 166.059668] __do_softirq+0xe6/0x4d2 -[ 166.059672] irq_exit_rcu+0xd2/0xf0 -[ 166.059675] common_interrupt+0xa5/0xc0 -[ 166.059678] -[ 166.059679] -[ 166.059680] asm_common_interrupt+0x1e/0x40 -[ 166.059683] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70 -[ 166.059686] Code: 83 c7 18 e8 2a 95 43 ff 48 89 ef e8 22 d2 43 ff 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 63 2e 40 ff 65 8b 05 8c 59 97 5c 85 c0 74 0a 5b 5d c3 e8 00 6a -[ 166.059689] RSP: 0018:ffff9d2400a5fca0 EFLAGS: 00000206 -[ 166.059692] RAX: 0000000000000002 RBX: 0000000000000200 RCX: 0000000000000006 -[ 166.059694] RDX: 0000000000000000 RSI: ffffffffa404879b RDI: 0000000000000001 -[ 166.059696] RBP: ffff9905c0053000 R08: 0000000000000001 R09: 0000000000000001 -[ 166.059698] R10: ffff9d2400a5fc50 R11: 0000000000000001 R12: ffffe186c41e2840 -[ 166.059700] R13: 0000000000000001 R14: ffff9905c78a1c68 R15: 0000000000000001 -[ 166.059704] free_debug_processing+0x257/0x3d0 -[ 166.059708] ? free_obj_work+0x1f5/0x250 -[ 166.059712] __slab_free+0x374/0x5a0 -[ 166.059718] ? kmem_cache_free+0x2e1/0x370 -[ 166.059721] ? free_obj_work+0x1f5/0x250 -[ 166.059724] kmem_cache_free+0x2e1/0x370 -[ 166.059727] free_obj_work+0x1f5/0x250 -[ 166.059731] process_one_work+0x28b/0x660 -[ 166.059735] ? process_one_work+0x660/0x660 -[ 166.059738] worker_thread+0x37/0x390 -[ 166.059741] ? process_one_work+0x660/0x660 -[ 166.059743] kthread+0x176/0x1a0 -[ 166.059746] ? set_kthread_struct+0x40/0x40 -[ 166.059749] ret_from_fork+0x22/0x30 -[ 166.059754] - -Since these two lockes are both initialized in ath11k_hal_srng_setup, -they are assigned with the same key. As a result lockdep suspects that -the task is trying to acquire the same lock (due to same key) while -already holding it, and thus reports the DEADLOCK warning. However as -they are different spinlock instances, the warning is false positive. - -On the other hand, even no dead lock indeed, this is a major issue for -upstream regression testing as it disables lockdep functionality. - -Fix it by assigning separate lock class key for each srng->lock. - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 -Signed-off-by: Baochen Qiang -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211209011949.151472-1-quic_bqiang@quicinc.com ---- - drivers/net/wireless/ath/ath11k/hal.c | 22 ++++++++++++++++++++++ - drivers/net/wireless/ath/ath11k/hal.h | 2 ++ - 2 files changed, 24 insertions(+) - ---- a/drivers/net/wireless/ath/ath11k/hal.c -+++ b/drivers/net/wireless/ath/ath11k/hal.c -@@ -974,6 +974,7 @@ int ath11k_hal_srng_setup(struct ath11k_ - srng->msi_data = params->msi_data; - srng->initialized = 1; - spin_lock_init(&srng->lock); -+ lockdep_set_class(&srng->lock, hal->srng_key + ring_id); - - for (i = 0; i < HAL_SRNG_NUM_REG_GRP; i++) { - srng->hwreg_base[i] = srng_config->reg_start[i] + -@@ -1260,6 +1261,24 @@ static int ath11k_hal_srng_create_config - return 0; - } - -+static void ath11k_hal_register_srng_key(struct ath11k_base *ab) -+{ -+ struct ath11k_hal *hal = &ab->hal; -+ u32 ring_id; -+ -+ for (ring_id = 0; ring_id < HAL_SRNG_RING_ID_MAX; ring_id++) -+ lockdep_register_key(hal->srng_key + ring_id); -+} -+ -+static void ath11k_hal_unregister_srng_key(struct ath11k_base *ab) -+{ -+ struct ath11k_hal *hal = &ab->hal; -+ u32 ring_id; -+ -+ for (ring_id = 0; ring_id < HAL_SRNG_RING_ID_MAX; ring_id++) -+ lockdep_unregister_key(hal->srng_key + ring_id); -+} -+ - int ath11k_hal_srng_init(struct ath11k_base *ab) - { - struct ath11k_hal *hal = &ab->hal; -@@ -1279,6 +1298,8 @@ int ath11k_hal_srng_init(struct ath11k_b - if (ret) - goto err_free_cont_rdp; - -+ ath11k_hal_register_srng_key(ab); -+ - return 0; - - err_free_cont_rdp: -@@ -1293,6 +1314,7 @@ void ath11k_hal_srng_deinit(struct ath11 - { - struct ath11k_hal *hal = &ab->hal; - -+ ath11k_hal_unregister_srng_key(ab); - ath11k_hal_free_cont_rdp(ab); - ath11k_hal_free_cont_wrp(ab); - kfree(hal->srng_config); ---- a/drivers/net/wireless/ath/ath11k/hal.h -+++ b/drivers/net/wireless/ath/ath11k/hal.h -@@ -902,6 +902,8 @@ struct ath11k_hal { - /* shadow register configuration */ - u32 shadow_reg_addr[HAL_SHADOW_NUM_REGS]; - int num_shadow_reg_configured; -+ -+ struct lock_class_key srng_key[HAL_SRNG_RING_ID_MAX]; - }; - - u32 ath11k_hal_reo_qdesc_size(u32 ba_window_size, u8 tid); diff --git a/package/kernel/mac80211/patches/ath11k/0136-ath11k-set-DTIM-policy-to-stick-mode-for-station-int.patch b/package/kernel/mac80211/patches/ath11k/0137-ath11k-set-DTIM-policy-to-stick-mode-for-station-int.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0136-ath11k-set-DTIM-policy-to-stick-mode-for-station-int.patch rename to package/kernel/mac80211/patches/ath11k/0137-ath11k-set-DTIM-policy-to-stick-mode-for-station-int.patch diff --git a/package/kernel/mac80211/patches/ath11k/0138-ath11k-Fix-deleting-uninitialized-kernel-timer-durin.patch b/package/kernel/mac80211/patches/ath11k/0138-ath11k-Fix-deleting-uninitialized-kernel-timer-durin.patch deleted file mode 100644 index 96e0483d8..000000000 --- a/package/kernel/mac80211/patches/ath11k/0138-ath11k-Fix-deleting-uninitialized-kernel-timer-durin.patch +++ /dev/null @@ -1,88 +0,0 @@ -From ba53ee7f7f38cf0592b8be1dcdabaf8f7535f8c1 Mon Sep 17 00:00:00 2001 -From: Rameshkumar Sundaram -Date: Thu, 9 Dec 2021 23:07:01 +0530 -Subject: [PATCH] ath11k: Fix deleting uninitialized kernel timer during - fragment cache flush - -frag_timer will be created & initialized for stations when -they associate and will be deleted during every key installation -while flushing old fragments. - -For AP interface self peer will be created and Group keys -will be installed for this peer, but there will be no real -Station entry & hence frag_timer won't be created and -initialized, deleting such uninitialized kernel timers causes below -warnings and backtraces printed with CONFIG_DEBUG_OBJECTS_TIMERS -enabled. - -[ 177.828008] ODEBUG: assert_init not available (active state 0) object type: timer_list hint: 0x0 -[ 177.836833] WARNING: CPU: 3 PID: 188 at lib/debugobjects.c:508 debug_print_object+0xb0/0xf0 -[ 177.845185] Modules linked in: ath11k_pci ath11k qmi_helpers qrtr_mhi qrtr ns mhi -[ 177.852679] CPU: 3 PID: 188 Comm: hostapd Not tainted 5.14.0-rc3-32919-g4034139e1838-dirty #14 -[ 177.865805] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--) -[ 177.871804] pc : debug_print_object+0xb0/0xf0 -[ 177.876155] lr : debug_print_object+0xb0/0xf0 -[ 177.880505] sp : ffffffc01169b5a0 -[ 177.883810] x29: ffffffc01169b5a0 x28: ffffff80081c2320 x27: ffffff80081c4078 -[ 177.890942] x26: ffffff8003fe8f28 x25: ffffff8003de9890 x24: ffffffc01134d738 -[ 177.898075] x23: ffffffc010948f20 x22: ffffffc010b2d2e0 x21: ffffffc01169b628 -[ 177.905206] x20: ffffffc01134d700 x19: ffffffc010c80d98 x18: 00000000000003f6 -[ 177.912339] x17: 203a657079742074 x16: 63656a626f202930 x15: 0000000000000152 -[ 177.919471] x14: 0000000000000152 x13: 00000000ffffffea x12: ffffffc010d732e0 -[ 177.926603] x11: 0000000000000003 x10: ffffffc010d432a0 x9 : ffffffc010d432f8 -[ 177.933735] x8 : 000000000002ffe8 x7 : c0000000ffffdfff x6 : 0000000000000001 -[ 177.940866] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 00000000ffffffff -[ 177.947997] x2 : ffffffc010c93240 x1 : ffffff80023624c0 x0 : 0000000000000054 -[ 177.955130] Call trace: -[ 177.957567] debug_print_object+0xb0/0xf0 -[ 177.961570] debug_object_assert_init+0x124/0x178 -[ 177.966269] try_to_del_timer_sync+0x1c/0x70 -[ 177.970536] del_timer_sync+0x30/0x50 -[ 177.974192] ath11k_peer_frags_flush+0x34/0x68 [ath11k] -[ 177.979439] ath11k_mac_op_set_key+0x1e4/0x338 [ath11k] -[ 177.984673] ieee80211_key_enable_hw_accel+0xc8/0x3d0 -[ 177.989722] ieee80211_key_replace+0x360/0x740 -[ 177.994160] ieee80211_key_link+0x16c/0x210 -[ 177.998337] ieee80211_add_key+0x138/0x338 -[ 178.002426] nl80211_new_key+0xfc/0x258 -[ 178.006257] genl_family_rcv_msg_doit.isra.17+0xd8/0x120 -[ 178.011565] genl_rcv_msg+0xd8/0x1c8 -[ 178.015134] netlink_rcv_skb+0x38/0xf8 -[ 178.018877] genl_rcv+0x34/0x48 -[ 178.022012] netlink_unicast+0x174/0x230 -[ 178.025928] netlink_sendmsg+0x188/0x388 -[ 178.029845] ____sys_sendmsg+0x218/0x250 -[ 178.033763] ___sys_sendmsg+0x68/0x90 -[ 178.037418] __sys_sendmsg+0x44/0x88 -[ 178.040988] __arm64_sys_sendmsg+0x20/0x28 -[ 178.045077] invoke_syscall.constprop.5+0x54/0xe0 -[ 178.049776] do_el0_svc+0x74/0xc0 -[ 178.053084] el0_svc+0x10/0x18 -[ 178.056133] el0t_64_sync_handler+0x88/0xb0 -[ 178.060310] el0t_64_sync+0x148/0x14c -[ 178.063966] ---[ end trace 8a5cf0bf9d34a058 ]--- - -Add changes to not to delete frag timer for peers during -group key installation. - -Tested on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01092-QCAHKSWPL_SILICONZ-1 - -Fixes: c3944a562102 ("ath11k: Clear the fragment cache during key install") -Signed-off-by: Rameshkumar Sundaram -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/1639071421-25078-1-git-send-email-quic_ramess@quicinc.com ---- - 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 -@@ -3747,7 +3747,7 @@ static int ath11k_mac_op_set_key(struct - /* flush the fragments cache during key (re)install to - * ensure all frags in the new frag list belong to the same key. - */ -- if (peer && cmd == SET_KEY) -+ if (peer && sta && cmd == SET_KEY) - ath11k_peer_frags_flush(ar, peer); - spin_unlock_bh(&ab->base_lock); - diff --git a/package/kernel/mac80211/patches/ath11k/0139-ath11k-Fix-a-NULL-pointer-dereference-in-ath11k_mac_.patch b/package/kernel/mac80211/patches/ath11k/0139-ath11k-Fix-a-NULL-pointer-dereference-in-ath11k_mac_.patch deleted file mode 100644 index e3466c05f..000000000 --- a/package/kernel/mac80211/patches/ath11k/0139-ath11k-Fix-a-NULL-pointer-dereference-in-ath11k_mac_.patch +++ /dev/null @@ -1,50 +0,0 @@ -From eccd25136386a04ebf46a64f3a34e8e0fab6d9e1 Mon Sep 17 00:00:00 2001 -From: Zhou Qingyang -Date: Mon, 13 Dec 2021 11:53:07 +0200 -Subject: [PATCH] ath11k: Fix a NULL pointer dereference in - ath11k_mac_op_hw_scan() - -In ath11k_mac_op_hw_scan(), the return value of kzalloc() is directly -used in memcpy(), which may lead to a NULL pointer dereference on -failure of kzalloc(). - -Fix this bug by adding a check of arg.extraie.ptr. - -This bug was found by a static analyzer. The analysis employs -differential checking to identify inconsistent security operations -(e.g., checks or kfrees) between two code paths and confirms that the -inconsistent operations are not recovered in the current function or -the callers, so they constitute bugs. - -Note that, as a bug found by static analysis, it can be a false -positive or hard to trigger. Multiple researchers have cross-reviewed -the bug. - -Builds with CONFIG_ATH11K=m show no new warnings, and our static -analyzer no longer warns about this code. - -Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") -Signed-off-by: Zhou Qingyang -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20211202155348.71315-1-zhou1615@umn.edu ---- - drivers/net/wireless/ath/ath11k/mac.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -3520,9 +3520,12 @@ static int ath11k_mac_op_hw_scan(struct - 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) { -+ ret = -ENOMEM; -+ goto exit; -+ } - arg.extraie.len = req->ie_len; -- arg.extraie.ptr = kzalloc(req->ie_len, GFP_KERNEL); -- memcpy(arg.extraie.ptr, req->ie, req->ie_len); - } - - if (req->n_ssids) { diff --git a/package/kernel/mac80211/patches/ath11k/0140-ath11k-add-ab-to-TARGET_NUM_VDEVS-co.patch b/package/kernel/mac80211/patches/ath11k/0141-ath11k-add-ab-to-TARGET_NUM_VDEVS-co.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0140-ath11k-add-ab-to-TARGET_NUM_VDEVS-co.patch rename to package/kernel/mac80211/patches/ath11k/0141-ath11k-add-ab-to-TARGET_NUM_VDEVS-co.patch diff --git a/package/kernel/mac80211/patches/ath11k/0141-ath11k-Change-qcn9074-fw-to-operate-in-mode-2.patch b/package/kernel/mac80211/patches/ath11k/0142-ath11k-Change-qcn9074-fw-to-operate-in-mode-2.patch similarity index 100% rename from package/kernel/mac80211/patches/ath11k/0141-ath11k-Change-qcn9074-fw-to-operate-in-mode-2.patch rename to package/kernel/mac80211/patches/ath11k/0142-ath11k-Change-qcn9074-fw-to-operate-in-mode-2.patch diff --git a/package/kernel/mac80211/patches/ath11k/0142-ath11k-Use-reserved-host-DDR-addresses-from-DT-for-P.patch b/package/kernel/mac80211/patches/ath11k/0143-ath11k-Use-reserved-host-DDR-addresses-from-DT-for-P.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0142-ath11k-Use-reserved-host-DDR-addresses-from-DT-for-P.patch rename to package/kernel/mac80211/patches/ath11k/0143-ath11k-Use-reserved-host-DDR-addresses-from-DT-for-P.patch index d6559dd73..4842e5261 100644 --- a/package/kernel/mac80211/patches/ath11k/0142-ath11k-Use-reserved-host-DDR-addresses-from-DT-for-P.patch +++ b/package/kernel/mac80211/patches/ath11k/0143-ath11k-Use-reserved-host-DDR-addresses-from-DT-for-P.patch @@ -28,7 +28,7 @@ Link: https://lore.kernel.org/r/1638789319-2950-2-git-send-email-akolli@codeauro --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -202,6 +202,7 @@ enum ath11k_dev_flags { +@@ -203,6 +203,7 @@ enum ath11k_dev_flags { ATH11K_FLAG_HTC_SUSPEND_COMPLETE, ATH11K_FLAG_CE_IRQ_ENABLED, ATH11K_FLAG_EXT_IRQ_ENABLED, @@ -103,7 +103,7 @@ Link: https://lore.kernel.org/r/1638789319-2950-2-git-send-email-akolli@codeauro #include "pci.h" #include "core.h" -@@ -1347,7 +1348,7 @@ static int ath11k_pci_probe(struct pci_d +@@ -1353,7 +1354,7 @@ static int ath11k_pci_probe(struct pci_d { struct ath11k_base *ab; struct ath11k_pci *ab_pci; @@ -112,7 +112,7 @@ Link: https://lore.kernel.org/r/1638789319-2950-2-git-send-email-akolli@codeauro int ret; ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI, -@@ -1367,6 +1368,14 @@ static int ath11k_pci_probe(struct pci_d +@@ -1373,6 +1374,14 @@ static int ath11k_pci_probe(struct pci_d pci_set_drvdata(pdev, ab); spin_lock_init(&ab_pci->window_lock); diff --git a/package/kernel/mac80211/patches/ath11k/0143-ath11k-report-rssi-of-each-chain-to-mac80211-for-QCA.patch b/package/kernel/mac80211/patches/ath11k/0144-ath11k-report-rssi-of-each-chain-to-mac80211-for-QCA.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0143-ath11k-report-rssi-of-each-chain-to-mac80211-for-QCA.patch rename to package/kernel/mac80211/patches/ath11k/0144-ath11k-report-rssi-of-each-chain-to-mac80211-for-QCA.patch index a912c7d72..aff101f5f 100644 --- a/package/kernel/mac80211/patches/ath11k/0143-ath11k-report-rssi-of-each-chain-to-mac80211-for-QCA.patch +++ b/package/kernel/mac80211/patches/ath11k/0144-ath11k-report-rssi-of-each-chain-to-mac80211-for-QCA.patch @@ -1,7 +1,7 @@ From b488c766442f7d9c07ea0708aa2a1a6bff1baef5 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Fri, 17 Dec 2021 20:27:21 +0200 -Subject: [PATCH 143/151] ath11k: report rssi of each chain to mac80211 for +Subject: [PATCH] ath11k: report rssi of each chain to mac80211 for QCA6390/WCN6855 Command "iw wls1 station dump" does not show each chain's rssi currently. @@ -139,7 +139,7 @@ Link: https://lore.kernel.org/r/20211215090944.19729-1-quic_wgong@quicinc.com --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -386,6 +386,7 @@ struct ath11k_sta { +@@ -387,6 +387,7 @@ struct ath11k_sta { u64 rx_duration; u64 tx_duration; u8 rssi_comb; @@ -147,7 +147,7 @@ Link: https://lore.kernel.org/r/20211215090944.19729-1-quic_wgong@quicinc.com struct ath11k_htt_tx_stats *tx_stats; struct ath11k_rx_peer_stats *rx_stats; -@@ -416,6 +417,10 @@ enum ath11k_state { +@@ -417,6 +418,10 @@ enum ath11k_state { /* Antenna noise floor */ #define ATH11K_DEFAULT_NOISE_FLOOR -95 diff --git a/package/kernel/mac80211/patches/ath11k/0144-ath11k-add-signal-report-to-mac80211-for-QCA6390-and.patch b/package/kernel/mac80211/patches/ath11k/0145-ath11k-add-signal-report-to-mac80211-for-QCA6390-and.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0144-ath11k-add-signal-report-to-mac80211-for-QCA6390-and.patch rename to package/kernel/mac80211/patches/ath11k/0145-ath11k-add-signal-report-to-mac80211-for-QCA6390-and.patch index 912872c8d..f06c7313f 100644 --- a/package/kernel/mac80211/patches/ath11k/0144-ath11k-add-signal-report-to-mac80211-for-QCA6390-and.patch +++ b/package/kernel/mac80211/patches/ath11k/0145-ath11k-add-signal-report-to-mac80211-for-QCA6390-and.patch @@ -1,8 +1,7 @@ From c3b39553fc7712a9621a19d9670d6f250943d50e Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Fri, 17 Dec 2021 20:27:21 +0200 -Subject: [PATCH 144/151] ath11k: add signal report to mac80211 for QCA6390 and - WCN6855 +Subject: [PATCH] ath11k: add signal report to mac80211 for QCA6390 and WCN6855 IEEE80211_HW_USES_RSS is set in ath11k, then the device uses RSS and thus requires parallel RX which implies using per-CPU station statistics @@ -29,7 +28,7 @@ Link: https://lore.kernel.org/r/20211216070535.31732-1-quic_wgong@quicinc.com --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -386,6 +386,7 @@ struct ath11k_sta { +@@ -387,6 +387,7 @@ struct ath11k_sta { u64 rx_duration; u64 tx_duration; u8 rssi_comb; diff --git a/package/kernel/mac80211/patches/ath11k/0145-ath11k-fix-warning-of-RCU-usage-for-ath11k_mac_get_a.patch b/package/kernel/mac80211/patches/ath11k/0146-ath11k-fix-warning-of-RCU-usage-for-ath11k_mac_get_a.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0145-ath11k-fix-warning-of-RCU-usage-for-ath11k_mac_get_a.patch rename to package/kernel/mac80211/patches/ath11k/0146-ath11k-fix-warning-of-RCU-usage-for-ath11k_mac_get_a.patch index 12120780d..3e94f2fa7 100644 --- a/package/kernel/mac80211/patches/ath11k/0145-ath11k-fix-warning-of-RCU-usage-for-ath11k_mac_get_a.patch +++ b/package/kernel/mac80211/patches/ath11k/0146-ath11k-fix-warning-of-RCU-usage-for-ath11k_mac_get_a.patch @@ -1,7 +1,7 @@ From 01e782c891083f1847c0b62902bfe3c2812566c6 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Fri, 17 Dec 2021 20:27:21 +0200 -Subject: [PATCH 145/151] ath11k: fix warning of RCU usage for +Subject: [PATCH] ath11k: fix warning of RCU usage for ath11k_mac_get_arvif_by_vdev_id() When enable more debug config, it happen below warning. It is because diff --git a/package/kernel/mac80211/patches/ath11k/0146-ath11k-report-tx-bitrate-for-iw-wlan-station-dump.patch b/package/kernel/mac80211/patches/ath11k/0147-ath11k-report-tx-bitrate-for-iw-wlan-station-dump.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0146-ath11k-report-tx-bitrate-for-iw-wlan-station-dump.patch rename to package/kernel/mac80211/patches/ath11k/0147-ath11k-report-tx-bitrate-for-iw-wlan-station-dump.patch index e7e870445..0b396428b 100644 --- a/package/kernel/mac80211/patches/ath11k/0146-ath11k-report-tx-bitrate-for-iw-wlan-station-dump.patch +++ b/package/kernel/mac80211/patches/ath11k/0147-ath11k-report-tx-bitrate-for-iw-wlan-station-dump.patch @@ -1,7 +1,7 @@ From 1b8bb94c0612cf32e418e90ae93cf37214d84669 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 20 Dec 2021 18:11:09 +0200 -Subject: [PATCH 146/151] ath11k: report tx bitrate for iw wlan station dump +Subject: [PATCH] ath11k: report tx bitrate for iw wlan station dump HTT_T2H_MSG_TYPE_PPDU_STATS_IND is a message which include the ppdu info, currently it is not report from firmware for ath11k, then the @@ -38,7 +38,7 @@ Link: https://lore.kernel.org/r/20211217093722.5739-1-quic_wgong@quicinc.com --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -382,6 +382,7 @@ struct ath11k_sta { +@@ -383,6 +383,7 @@ struct ath11k_sta { struct work_struct update_wk; struct work_struct set_4addr_wk; struct rate_info txrate; diff --git a/package/kernel/mac80211/patches/ath11k/0147-ath11k-add-support-for-hardware-rfkill-for-QCA6390.patch b/package/kernel/mac80211/patches/ath11k/0148-ath11k-add-support-for-hardware-rfkill-for-QCA6390.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0147-ath11k-add-support-for-hardware-rfkill-for-QCA6390.patch rename to package/kernel/mac80211/patches/ath11k/0148-ath11k-add-support-for-hardware-rfkill-for-QCA6390.patch index bde06b9cb..ceb4c6638 100644 --- a/package/kernel/mac80211/patches/ath11k/0147-ath11k-add-support-for-hardware-rfkill-for-QCA6390.patch +++ b/package/kernel/mac80211/patches/ath11k/0148-ath11k-add-support-for-hardware-rfkill-for-QCA6390.patch @@ -1,7 +1,7 @@ From ec038c6127fa772d2c5604e329f22371830d5fa6 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 20 Dec 2021 18:11:09 +0200 -Subject: [PATCH 147/151] ath11k: add support for hardware rfkill for QCA6390 +Subject: [PATCH] ath11k: add support for hardware rfkill for QCA6390 When hardware rfkill is enabled in the firmware it will report the capability via using WMI_SYS_CAP_INFO_RFKILL bit in the WMI_SERVICE_READY diff --git a/package/kernel/mac80211/patches/ath11k/0149-ath11k-Fix-napi-related-hang.patch b/package/kernel/mac80211/patches/ath11k/0149-ath11k-Fix-napi-related-hang.patch deleted file mode 100644 index 32a9c569d..000000000 --- a/package/kernel/mac80211/patches/ath11k/0149-ath11k-Fix-napi-related-hang.patch +++ /dev/null @@ -1,95 +0,0 @@ -From d943fdad7589653065be0e20aadc6dff37725ed4 Mon Sep 17 00:00:00 2001 -From: Ben Greear -Date: Thu, 3 Sep 2020 12:52:54 -0700 -Subject: [PATCH 149/151] ath11k: Fix napi related hang - -Similar to the same bug in ath10k, a napi disable w/out it being enabled -will hang forever. I believe I saw this while trying rmmod after driver -had some failure on startup. Fix it by keeping state on whether napi is -enabled or not. - -And, remove un-used napi pointer in ath11k driver base struct. - -Signed-off-by: Ben Greear -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20200903195254.29379-1-greearb@candelatech.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 12 +++++++++--- - drivers/net/wireless/ath/ath11k/core.h | 2 +- - drivers/net/wireless/ath/ath11k/pci.c | 12 +++++++++--- - 3 files changed, 19 insertions(+), 7 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -175,8 +175,11 @@ static void __ath11k_ahb_ext_irq_disable - - ath11k_ahb_ext_grp_disable(irq_grp); - -- napi_synchronize(&irq_grp->napi); -- napi_disable(&irq_grp->napi); -+ if (irq_grp->napi_enabled) { -+ napi_synchronize(&irq_grp->napi); -+ napi_disable(&irq_grp->napi); -+ irq_grp->napi_enabled = false; -+ } - } - } - -@@ -300,7 +303,10 @@ static void ath11k_ahb_ext_irq_enable(st - for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { - struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; - -- napi_enable(&irq_grp->napi); -+ if (!irq_grp->napi_enabled) { -+ napi_enable(&irq_grp->napi); -+ irq_grp->napi_enabled = true; -+ } - ath11k_ahb_ext_grp_enable(irq_grp); - } - } ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -142,6 +142,7 @@ struct ath11k_ext_irq_grp { - u32 num_irq; - u32 grp_id; - u64 timestamp; -+ bool napi_enabled; - struct napi_struct napi; - struct net_device napi_ndev; - }; -@@ -743,7 +744,6 @@ struct ath11k_base { - u32 wlan_init_status; - int irq_num[ATH11K_IRQ_NUM_MAX]; - struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX]; -- struct napi_struct *napi; - struct ath11k_targ_cap target_caps; - u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE]; - bool pdevs_macaddr_valid; ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -683,8 +683,11 @@ static void __ath11k_pci_ext_irq_disable - - ath11k_pci_ext_grp_disable(irq_grp); - -- napi_synchronize(&irq_grp->napi); -- napi_disable(&irq_grp->napi); -+ if (irq_grp->napi_enabled) { -+ napi_synchronize(&irq_grp->napi); -+ napi_disable(&irq_grp->napi); -+ irq_grp->napi_enabled = false; -+ } - } - } - -@@ -712,7 +715,10 @@ static void ath11k_pci_ext_irq_enable(st - for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { - struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; - -- napi_enable(&irq_grp->napi); -+ if (!irq_grp->napi_enabled) { -+ napi_enable(&irq_grp->napi); -+ irq_grp->napi_enabled = true; -+ } - ath11k_pci_ext_grp_enable(irq_grp); - } - } diff --git a/package/kernel/mac80211/patches/ath11k/0148-ath11k-add-regdb.bin-download-for-regdb-offload.patch b/package/kernel/mac80211/patches/ath11k/0149-ath11k-add-regdb.bin-download-for-regdb-offload.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0148-ath11k-add-regdb.bin-download-for-regdb-offload.patch rename to package/kernel/mac80211/patches/ath11k/0149-ath11k-add-regdb.bin-download-for-regdb-offload.patch index 3ff08d979..a53892aca 100644 --- a/package/kernel/mac80211/patches/ath11k/0148-ath11k-add-regdb.bin-download-for-regdb-offload.patch +++ b/package/kernel/mac80211/patches/ath11k/0149-ath11k-add-regdb.bin-download-for-regdb-offload.patch @@ -1,7 +1,7 @@ From 01417e57939faffebfdeb2aef1f4388e95cf9271 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Mon, 20 Dec 2021 01:23:55 -0500 -Subject: [PATCH 148/151] ath11k: add regdb.bin download for regdb offload +Subject: [PATCH] ath11k: add regdb.bin download for regdb offload The regdomain is self-managed type for ath11k, the regdomain info is reported from firmware, it is not from wireless regdb. Firmware fetch diff --git a/package/kernel/mac80211/patches/ath11k/0150-ath11k-add-support-of-firmware-logging-for-WCN6855.patch b/package/kernel/mac80211/patches/ath11k/0151-ath11k-add-support-of-firmware-logging-for-WCN6855.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0150-ath11k-add-support-of-firmware-logging-for-WCN6855.patch rename to package/kernel/mac80211/patches/ath11k/0151-ath11k-add-support-of-firmware-logging-for-WCN6855.patch index 182ddf131..61378616b 100644 --- a/package/kernel/mac80211/patches/ath11k/0150-ath11k-add-support-of-firmware-logging-for-WCN6855.patch +++ b/package/kernel/mac80211/patches/ath11k/0151-ath11k-add-support-of-firmware-logging-for-WCN6855.patch @@ -1,7 +1,7 @@ From 42da1cc7bd537ea63ddebf88aedcdafcccb00131 Mon Sep 17 00:00:00 2001 From: Cheng Wang Date: Mon, 20 Dec 2021 20:10:53 +0800 -Subject: [PATCH 150/151] ath11k: add support of firmware logging for WCN6855 +Subject: [PATCH] ath11k: add support of firmware logging for WCN6855 Host enables WMI firmware logging feature via QMI message. Host receives firmware logging messages on WMI_DIAG_EVENTID, then diff --git a/package/kernel/mac80211/patches/ath11k/0151-ath11k-Fix-unexpected-return-buffer-manager-error-fo.patch b/package/kernel/mac80211/patches/ath11k/0152-ath11k-Fix-unexpected-return-buffer-manager-error-fo.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0151-ath11k-Fix-unexpected-return-buffer-manager-error-fo.patch rename to package/kernel/mac80211/patches/ath11k/0152-ath11k-Fix-unexpected-return-buffer-manager-error-fo.patch index ca944f891..0e12b0519 100644 --- a/package/kernel/mac80211/patches/ath11k/0151-ath11k-Fix-unexpected-return-buffer-manager-error-fo.patch +++ b/package/kernel/mac80211/patches/ath11k/0152-ath11k-Fix-unexpected-return-buffer-manager-error-fo.patch @@ -1,8 +1,8 @@ From 71c748b5e01e3e28838a8e26a8966fb5adb03df7 Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Wed, 22 Dec 2021 09:35:35 +0800 -Subject: [PATCH 151/151] ath11k: Fix unexpected return buffer manager error - for QCA6390 +Subject: [PATCH] ath11k: Fix unexpected return buffer manager error for + QCA6390 We are seeing below error on QCA6390: ... diff --git a/package/kernel/mac80211/patches/ath11k/0153-codel-remove-unnecessary-sock.h-include.patch b/package/kernel/mac80211/patches/ath11k/0153-codel-remove-unnecessary-sock.h-include.patch new file mode 100644 index 000000000..cbe5476bb --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0153-codel-remove-unnecessary-sock.h-include.patch @@ -0,0 +1,41 @@ +From 15fcb1031178f2a42425c2993b2ec7bb894c04d6 Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Tue, 21 Dec 2021 11:39:40 -0800 +Subject: [PATCH] codel: remove unnecessary sock.h include + +Since sock.h is modified relatively often (60 times in the last +12 months) it seems worthwhile to decrease the incremental build +work. + +CoDel's header includes net/inet_ecn.h which in turn includes net/sock.h. +codel.h is itself included by mac80211 which is included by much of +the WiFi stack and drivers. Removing the net/inet_ecn.h include from +CoDel breaks the dependecy between WiFi and sock.h. + +Commit d068ca2ae2e6 ("codel: split into multiple files") moved all +the code which actually needs ECN helpers out to net/codel_impl.h, +the include can be moved there as well. + +This decreases the incremental build size after touching sock.h +from 4999 objects to 4051 objects. + +Fix unmasked missing includes in WiFi drivers. + +Acked-by: Kalle Valo +Link: https://lore.kernel.org/r/20211221193941.3805147-1-kuba@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/wireless/ath/ath11k/debugfs.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/debugfs.c ++++ b/drivers/net/wireless/ath/ath11k/debugfs.c +@@ -3,6 +3,8 @@ + * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. + */ + ++#include ++ + #include "debugfs.h" + + #include "core.h" diff --git a/package/kernel/mac80211/patches/ath11k/0154-codel-remove-unnecessary-pkt_sched.h-include.patch b/package/kernel/mac80211/patches/ath11k/0154-codel-remove-unnecessary-pkt_sched.h-include.patch new file mode 100644 index 000000000..bb833ba7a --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0154-codel-remove-unnecessary-pkt_sched.h-include.patch @@ -0,0 +1,37 @@ +From e6e5904455815626b711c7d48cacd253f4d72f84 Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Tue, 21 Dec 2021 11:39:41 -0800 +Subject: [PATCH] codel: remove unnecessary pkt_sched.h include + +Commit d068ca2ae2e6 ("codel: split into multiple files") moved all +Qdisc-related code to codel_qdisc.h, move the include of pkt_sched.h +as well. + +This is similar to the previous commit, although we don't care as +much about incremental builds after pkt_sched.h was touched itself +it is included by net/sch_generic.h which is modified ~20 times +a year. + +This decreases the incremental build size after touching pkt_sched.h +from 1592 to 617 objects. + +Fix unmasked missing includes in WiFi drivers. + +Acked-by: Kalle Valo +Link: https://lore.kernel.org/r/20211221193941.3805147-2-kuba@kernel.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/wireless/ath/ath11k/reg.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/reg.c ++++ b/drivers/net/wireless/ath/ath11k/reg.c +@@ -2,6 +2,8 @@ + /* + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + */ ++#include ++ + #include "core.h" + #include "debug.h" + diff --git a/package/kernel/mac80211/patches/ath11k/0152-ath11k-add-missing-of_node_put-to-avoid-leak.patch b/package/kernel/mac80211/patches/ath11k/0155-ath11k-add-missing-of_node_put-to-avoid-leak.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0152-ath11k-add-missing-of_node_put-to-avoid-leak.patch rename to package/kernel/mac80211/patches/ath11k/0155-ath11k-add-missing-of_node_put-to-avoid-leak.patch index 8a49bb08c..5e348f23e 100644 --- a/package/kernel/mac80211/patches/ath11k/0152-ath11k-add-missing-of_node_put-to-avoid-leak.patch +++ b/package/kernel/mac80211/patches/ath11k/0155-ath11k-add-missing-of_node_put-to-avoid-leak.patch @@ -1,7 +1,7 @@ From 3d38faef0de1756994b3d95e47b2302842f729e2 Mon Sep 17 00:00:00 2001 From: Yang Yingliang Date: Mon, 10 Jan 2022 16:24:13 +0200 -Subject: [PATCH 152/154] ath11k: add missing of_node_put() to avoid leak +Subject: [PATCH] ath11k: add missing of_node_put() to avoid leak The node pointer is returned by of_find_node_by_type() or of_parse_phandle() with refcount incremented. Calling diff --git a/package/kernel/mac80211/patches/ath11k/0153-ath11k-fix-workqueue-not-getting-destroyed-after-rmm.patch b/package/kernel/mac80211/patches/ath11k/0156-ath11k-fix-workqueue-not-getting-destroyed-after-rmm.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0153-ath11k-fix-workqueue-not-getting-destroyed-after-rmm.patch rename to package/kernel/mac80211/patches/ath11k/0156-ath11k-fix-workqueue-not-getting-destroyed-after-rmm.patch index 443ee1be0..42a871095 100644 --- a/package/kernel/mac80211/patches/ath11k/0153-ath11k-fix-workqueue-not-getting-destroyed-after-rmm.patch +++ b/package/kernel/mac80211/patches/ath11k/0156-ath11k-fix-workqueue-not-getting-destroyed-after-rmm.patch @@ -1,8 +1,7 @@ From 9f4ecacf2fa47b8aadd9bca2e88cde01856de028 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Singh Date: Mon, 10 Jan 2022 16:24:14 +0200 -Subject: [PATCH 153/154] ath11k: fix workqueue not getting destroyed after - rmmod +Subject: [PATCH] ath11k: fix workqueue not getting destroyed after rmmod Currently, ath11k_core_alloc() creates a single thread workqueue. This workqueue is not detroyed during clean up when ath11k modules diff --git a/package/kernel/mac80211/patches/ath11k/0154-ath11k-Refactor-the-fallback-routine-when-peer-creat.patch b/package/kernel/mac80211/patches/ath11k/0157-ath11k-Refactor-the-fallback-routine-when-peer-creat.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0154-ath11k-Refactor-the-fallback-routine-when-peer-creat.patch rename to package/kernel/mac80211/patches/ath11k/0157-ath11k-Refactor-the-fallback-routine-when-peer-creat.patch index a2bafb5dc..16c9cf3f3 100644 --- a/package/kernel/mac80211/patches/ath11k/0154-ath11k-Refactor-the-fallback-routine-when-peer-creat.patch +++ b/package/kernel/mac80211/patches/ath11k/0157-ath11k-Refactor-the-fallback-routine-when-peer-creat.patch @@ -1,8 +1,7 @@ From fbed57d897f6ea065c45806959337a6f28d2a94d Mon Sep 17 00:00:00 2001 From: Karthikeyan Periyasamy Date: Mon, 10 Jan 2022 16:24:14 +0200 -Subject: [PATCH 154/154] ath11k: Refactor the fallback routine when peer - create fails +Subject: [PATCH] ath11k: Refactor the fallback routine when peer create fails When there is an error in peer create process from ath11k_peer_find(), the code attempts to handle a fallback diff --git a/package/kernel/mac80211/patches/ath11k/0155-ath11k-add-LDPC-FEC-type-in-802.11-radiotap-header.patch b/package/kernel/mac80211/patches/ath11k/0158-ath11k-add-LDPC-FEC-type-in-802.11-radiotap-header.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0155-ath11k-add-LDPC-FEC-type-in-802.11-radiotap-header.patch rename to package/kernel/mac80211/patches/ath11k/0158-ath11k-add-LDPC-FEC-type-in-802.11-radiotap-header.patch index cadbd1730..572a9e2c6 100644 --- a/package/kernel/mac80211/patches/ath11k/0155-ath11k-add-LDPC-FEC-type-in-802.11-radiotap-header.patch +++ b/package/kernel/mac80211/patches/ath11k/0158-ath11k-add-LDPC-FEC-type-in-802.11-radiotap-header.patch @@ -1,7 +1,7 @@ From b3febdccde3eb086b892485c923cd6b73b2ce9d7 Mon Sep 17 00:00:00 2001 From: P Praneesh Date: Tue, 11 Jan 2022 16:42:52 +0200 -Subject: [PATCH 155/156] ath11k: add LDPC FEC type in 802.11 radiotap header +Subject: [PATCH] ath11k: add LDPC FEC type in 802.11 radiotap header LDPC is one the FEC type advertised in msdu_start info2 for HT packet type. Hence, add hardware specific callback for fetching LDPC diff --git a/package/kernel/mac80211/patches/ath11k/0156-ath11k-free-peer-for-station-when-disconnect-from-AP.patch b/package/kernel/mac80211/patches/ath11k/0159-ath11k-free-peer-for-station-when-disconnect-from-AP.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0156-ath11k-free-peer-for-station-when-disconnect-from-AP.patch rename to package/kernel/mac80211/patches/ath11k/0159-ath11k-free-peer-for-station-when-disconnect-from-AP.patch index 48172edfc..6bfe0a821 100644 --- a/package/kernel/mac80211/patches/ath11k/0156-ath11k-free-peer-for-station-when-disconnect-from-AP.patch +++ b/package/kernel/mac80211/patches/ath11k/0159-ath11k-free-peer-for-station-when-disconnect-from-AP.patch @@ -1,8 +1,8 @@ From 212ad7cb7d7592669c067125949e0a8e31ce6a0b Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Tue, 11 Jan 2022 16:42:52 +0200 -Subject: [PATCH 156/156] ath11k: free peer for station when disconnect from AP - for QCA6390/WCN6855 +Subject: [PATCH] ath11k: free peer for station when disconnect from AP for + QCA6390/WCN6855 Commit b4a0f54156ac ("ath11k: move peer delete after vdev stop of station for QCA6390 and WCN6855") is to fix firmware crash by changing the WMI diff --git a/package/kernel/mac80211/patches/ath11k/0157-ath11k-enable-RX-PPDU-stats-in-monitor-co-exist-mode.patch b/package/kernel/mac80211/patches/ath11k/0160-ath11k-enable-RX-PPDU-stats-in-monitor-co-exist-mode.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0157-ath11k-enable-RX-PPDU-stats-in-monitor-co-exist-mode.patch rename to package/kernel/mac80211/patches/ath11k/0160-ath11k-enable-RX-PPDU-stats-in-monitor-co-exist-mode.patch index a64a47889..571efbe9b 100644 --- a/package/kernel/mac80211/patches/ath11k/0157-ath11k-enable-RX-PPDU-stats-in-monitor-co-exist-mode.patch +++ b/package/kernel/mac80211/patches/ath11k/0160-ath11k-enable-RX-PPDU-stats-in-monitor-co-exist-mode.patch @@ -1,7 +1,7 @@ From 67a9d399fcb03177152a8797a855cbd4c995c2de Mon Sep 17 00:00:00 2001 From: Miles Hu Date: Wed, 12 Jan 2022 10:15:10 +0200 -Subject: [PATCH 157/160] ath11k: enable RX PPDU stats in monitor co-exist mode +Subject: [PATCH] ath11k: enable RX PPDU stats in monitor co-exist mode RX PPDU statistics collection is missing when monitor mode co-exists with other modes. This commit combines the processing of the destination @@ -20,7 +20,7 @@ Link: https://lore.kernel.org/r/20220111032224.14093-1-quic_alokad@quicinc.com --- a/drivers/net/wireless/ath/ath11k/debugfs.c +++ b/drivers/net/wireless/ath/ath11k/debugfs.c -@@ -664,6 +664,12 @@ static ssize_t ath11k_write_extd_rx_stat +@@ -666,6 +666,12 @@ static ssize_t ath11k_write_extd_rx_stat goto exit; } diff --git a/package/kernel/mac80211/patches/ath11k/0158-ath11k-move-function-ath11k_dp_rx_process_mon_status.patch b/package/kernel/mac80211/patches/ath11k/0161-ath11k-move-function-ath11k_dp_rx_process_mon_status.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0158-ath11k-move-function-ath11k_dp_rx_process_mon_status.patch rename to package/kernel/mac80211/patches/ath11k/0161-ath11k-move-function-ath11k_dp_rx_process_mon_status.patch index 43e5ea02e..c0a14de99 100644 --- a/package/kernel/mac80211/patches/ath11k/0158-ath11k-move-function-ath11k_dp_rx_process_mon_status.patch +++ b/package/kernel/mac80211/patches/ath11k/0161-ath11k-move-function-ath11k_dp_rx_process_mon_status.patch @@ -1,7 +1,7 @@ From 3cd04a438754aaa4297a5561ad9149eda73ce14d Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Wed, 12 Jan 2022 10:15:10 +0200 -Subject: [PATCH 158/160] ath11k: move function ath11k_dp_rx_process_mon_status +Subject: [PATCH] ath11k: move function ath11k_dp_rx_process_mon_status Move the function below ath11k_dp_rx_mon_dest_process() and remove the forward declaration. diff --git a/package/kernel/mac80211/patches/ath11k/0159-ath11k-fix-error-code-in-ath11k_qmi_assign_target_me.patch b/package/kernel/mac80211/patches/ath11k/0162-ath11k-fix-error-code-in-ath11k_qmi_assign_target_me.patch similarity index 95% rename from package/kernel/mac80211/patches/ath11k/0159-ath11k-fix-error-code-in-ath11k_qmi_assign_target_me.patch rename to package/kernel/mac80211/patches/ath11k/0162-ath11k-fix-error-code-in-ath11k_qmi_assign_target_me.patch index 87756b313..4ed157d67 100644 --- a/package/kernel/mac80211/patches/ath11k/0159-ath11k-fix-error-code-in-ath11k_qmi_assign_target_me.patch +++ b/package/kernel/mac80211/patches/ath11k/0162-ath11k-fix-error-code-in-ath11k_qmi_assign_target_me.patch @@ -1,7 +1,7 @@ From c9b41832dc080fa59bad597de94865b3ea2d5bab Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 12 Jan 2022 10:15:11 +0200 -Subject: [PATCH 159/160] ath11k: fix error code in +Subject: [PATCH] ath11k: fix error code in ath11k_qmi_assign_target_mem_chunk() The "ret" vairable is not set at this point. It could be uninitialized diff --git a/package/kernel/mac80211/patches/ath11k/0160-ath11k-Reconfigure-hardware-rate-for-WCN6855-after-v.patch b/package/kernel/mac80211/patches/ath11k/0163-ath11k-Reconfigure-hardware-rate-for-WCN6855-after-v.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0160-ath11k-Reconfigure-hardware-rate-for-WCN6855-after-v.patch rename to package/kernel/mac80211/patches/ath11k/0163-ath11k-Reconfigure-hardware-rate-for-WCN6855-after-v.patch index 11cfc4b80..f935a2610 100644 --- a/package/kernel/mac80211/patches/ath11k/0160-ath11k-Reconfigure-hardware-rate-for-WCN6855-after-v.patch +++ b/package/kernel/mac80211/patches/ath11k/0163-ath11k-Reconfigure-hardware-rate-for-WCN6855-after-v.patch @@ -1,8 +1,8 @@ From dc7ff75690ea7e1920be08b2b9cc89647667bb90 Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Wed, 12 Jan 2022 10:54:00 +0800 -Subject: [PATCH 160/160] ath11k: Reconfigure hardware rate for WCN6855 after - vdev is started +Subject: [PATCH] ath11k: Reconfigure hardware rate for WCN6855 after vdev is + started There is an issue that WCN6855 tries to connect to an AP using a hardware rate of 1Mb/s , even though the AP has announced diff --git a/package/kernel/mac80211/patches/ath11k/0161-ath11k-set-WMI_PEER_40MHZ-while-peer-assoc-for-6-GHz.patch b/package/kernel/mac80211/patches/ath11k/0164-ath11k-set-WMI_PEER_40MHZ-while-peer-assoc-for-6-GHz.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0161-ath11k-set-WMI_PEER_40MHZ-while-peer-assoc-for-6-GHz.patch rename to package/kernel/mac80211/patches/ath11k/0164-ath11k-set-WMI_PEER_40MHZ-while-peer-assoc-for-6-GHz.patch index 408e0dbb3..b488ef5fb 100644 --- a/package/kernel/mac80211/patches/ath11k/0161-ath11k-set-WMI_PEER_40MHZ-while-peer-assoc-for-6-GHz.patch +++ b/package/kernel/mac80211/patches/ath11k/0164-ath11k-set-WMI_PEER_40MHZ-while-peer-assoc-for-6-GHz.patch @@ -1,7 +1,7 @@ From 1cb747192de2edb7e55920af8c458e4792908486 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Tue, 18 Jan 2022 22:42:11 -0500 -Subject: [PATCH 161/162] ath11k: set WMI_PEER_40MHZ while peer assoc for 6 GHz +Subject: [PATCH] ath11k: set WMI_PEER_40MHZ while peer assoc for 6 GHz When station connect to AP of 6 GHz with 40 MHz bandwidth, the TX is always stay 20 MHz, it is because the flag WMI_PEER_40MHZ is not set diff --git a/package/kernel/mac80211/patches/ath11k/0162-ath11k-avoid-firmware-crash-when-reg-set-for-QCA6390.patch b/package/kernel/mac80211/patches/ath11k/0165-ath11k-avoid-firmware-crash-when-reg-set-for-QCA6390.patch similarity index 95% rename from package/kernel/mac80211/patches/ath11k/0162-ath11k-avoid-firmware-crash-when-reg-set-for-QCA6390.patch rename to package/kernel/mac80211/patches/ath11k/0165-ath11k-avoid-firmware-crash-when-reg-set-for-QCA6390.patch index eb4f5495c..cb83d0c3d 100644 --- a/package/kernel/mac80211/patches/ath11k/0162-ath11k-avoid-firmware-crash-when-reg-set-for-QCA6390.patch +++ b/package/kernel/mac80211/patches/ath11k/0165-ath11k-avoid-firmware-crash-when-reg-set-for-QCA6390.patch @@ -1,8 +1,7 @@ From 0d6e997b76216ca104167a2a0fb79823a7fa9e97 Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Tue, 18 Jan 2022 23:13:55 -0500 -Subject: [PATCH 162/162] ath11k: avoid firmware crash when reg set for - QCA6390/WCN6855 +Subject: [PATCH] ath11k: avoid firmware crash when reg set for QCA6390/WCN6855 For the NL80211_REGDOM_SET_BY_USER hint from cfg80211, it set the new alpha2 code to ath11k, then ath11k send WMI_SET_INIT_COUNTRY_CMDID to @@ -91,7 +90,7 @@ Link: https://lore.kernel.org/r/20220119041355.32014-1-quic_wgong@quicinc.com struct ath11k_hw_ops { --- a/drivers/net/wireless/ath/ath11k/reg.c +++ b/drivers/net/wireless/ath/ath11k/reg.c -@@ -46,6 +46,7 @@ ath11k_reg_notifier(struct wiphy *wiphy, +@@ -48,6 +48,7 @@ ath11k_reg_notifier(struct wiphy *wiphy, { struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct wmi_init_country_params init_country_param; @@ -99,7 +98,7 @@ Link: https://lore.kernel.org/r/20220119041355.32014-1-quic_wgong@quicinc.com struct ath11k *ar = hw->priv; int ret; -@@ -74,18 +75,26 @@ ath11k_reg_notifier(struct wiphy *wiphy, +@@ -76,18 +77,26 @@ ath11k_reg_notifier(struct wiphy *wiphy, return; } diff --git a/package/kernel/mac80211/patches/ath11k/0163-ath11k-Rename-ath11k_ahb_ext_irq_config.patch b/package/kernel/mac80211/patches/ath11k/0166-ath11k-Rename-ath11k_ahb_ext_irq_config.patch similarity index 94% rename from package/kernel/mac80211/patches/ath11k/0163-ath11k-Rename-ath11k_ahb_ext_irq_config.patch rename to package/kernel/mac80211/patches/ath11k/0166-ath11k-Rename-ath11k_ahb_ext_irq_config.patch index 2c1bdc768..c1d4de513 100644 --- a/package/kernel/mac80211/patches/ath11k/0163-ath11k-Rename-ath11k_ahb_ext_irq_config.patch +++ b/package/kernel/mac80211/patches/ath11k/0166-ath11k-Rename-ath11k_ahb_ext_irq_config.patch @@ -1,7 +1,7 @@ From a76ed59163ba82462ccb262b4c3590a3c1a115dd Mon Sep 17 00:00:00 2001 From: Venkateswara Naralasetty Date: Wed, 19 Jan 2022 14:48:13 +0530 -Subject: [PATCH 163/171] ath11k: Rename ath11k_ahb_ext_irq_config +Subject: [PATCH] ath11k: Rename ath11k_ahb_ext_irq_config Rename ath11k_ahb_ext_irq_config() to ath11k_ahb_config_ext_irq() for just symmetry with ath11k_ahb_free_ext_irq(). diff --git a/package/kernel/mac80211/patches/ath11k/0164-ath11k-fix-kernel-panic-during-unload-load-ath11k-mo.patch b/package/kernel/mac80211/patches/ath11k/0167-ath11k-fix-kernel-panic-during-unload-load-ath11k-mo.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0164-ath11k-fix-kernel-panic-during-unload-load-ath11k-mo.patch rename to package/kernel/mac80211/patches/ath11k/0167-ath11k-fix-kernel-panic-during-unload-load-ath11k-mo.patch index 1b54c2a8b..c81c650f8 100644 --- a/package/kernel/mac80211/patches/ath11k/0164-ath11k-fix-kernel-panic-during-unload-load-ath11k-mo.patch +++ b/package/kernel/mac80211/patches/ath11k/0167-ath11k-fix-kernel-panic-during-unload-load-ath11k-mo.patch @@ -1,8 +1,7 @@ From 22b59cb965f79ee1accf83172441c9ca0ecb632a Mon Sep 17 00:00:00 2001 From: Venkateswara Naralasetty Date: Wed, 19 Jan 2022 14:49:33 +0530 -Subject: [PATCH 164/171] ath11k: fix kernel panic during unload/load ath11k - modules +Subject: [PATCH] ath11k: fix kernel panic during unload/load ath11k modules Call netif_napi_del() from ath11k_ahb_free_ext_irq() to fix the following kernel panic when unload/load ath11k modules diff --git a/package/kernel/mac80211/patches/ath11k/0165-ath11k-Fix-uninitialized-symbol-rx_buf_sz.patch b/package/kernel/mac80211/patches/ath11k/0168-ath11k-Fix-uninitialized-symbol-rx_buf_sz.patch similarity index 96% rename from package/kernel/mac80211/patches/ath11k/0165-ath11k-Fix-uninitialized-symbol-rx_buf_sz.patch rename to package/kernel/mac80211/patches/ath11k/0168-ath11k-Fix-uninitialized-symbol-rx_buf_sz.patch index 4dd4ed68e..ccc13290b 100644 --- a/package/kernel/mac80211/patches/ath11k/0165-ath11k-Fix-uninitialized-symbol-rx_buf_sz.patch +++ b/package/kernel/mac80211/patches/ath11k/0168-ath11k-Fix-uninitialized-symbol-rx_buf_sz.patch @@ -1,7 +1,7 @@ From dca857f07dc14c923a3c47965e771f435807b39c Mon Sep 17 00:00:00 2001 From: Anilkumar Kolli Date: Wed, 19 Jan 2022 20:53:13 +0530 -Subject: [PATCH 165/171] ath11k: Fix uninitialized symbol 'rx_buf_sz' +Subject: [PATCH] ath11k: Fix uninitialized symbol 'rx_buf_sz' Add missing else statement in ath11k_dp_rx_process_mon_status() to fix below smatch warnings, diff --git a/package/kernel/mac80211/patches/ath11k/0166-ath11k-Fix-missing-rx_desc_get_ldpc_support-in-wcn68.patch b/package/kernel/mac80211/patches/ath11k/0169-ath11k-Fix-missing-rx_desc_get_ldpc_support-in-wcn68.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0166-ath11k-Fix-missing-rx_desc_get_ldpc_support-in-wcn68.patch rename to package/kernel/mac80211/patches/ath11k/0169-ath11k-Fix-missing-rx_desc_get_ldpc_support-in-wcn68.patch index 38cb34bdc..1249b4639 100644 --- a/package/kernel/mac80211/patches/ath11k/0166-ath11k-Fix-missing-rx_desc_get_ldpc_support-in-wcn68.patch +++ b/package/kernel/mac80211/patches/ath11k/0169-ath11k-Fix-missing-rx_desc_get_ldpc_support-in-wcn68.patch @@ -1,8 +1,7 @@ From 648ab4720cb76d0b5b1e49d3c0f0bdf28e22e52a Mon Sep 17 00:00:00 2001 From: Baochen Qiang Date: Wed, 26 Jan 2022 09:01:44 +0800 -Subject: [PATCH 166/171] ath11k: Fix missing rx_desc_get_ldpc_support in - wcn6855_ops +Subject: [PATCH] ath11k: Fix missing rx_desc_get_ldpc_support in wcn6855_ops rx_desc_get_ldpc_support is missing in wcn6855_ops, resulting on WCN6855 a kernel crash after connecting to an AP and waiting for few minutes. Fix it by diff --git a/package/kernel/mac80211/patches/ath11k/0167-ath11k-pci-fix-crash-on-suspend-if-board-file-is-not.patch b/package/kernel/mac80211/patches/ath11k/0170-ath11k-pci-fix-crash-on-suspend-if-board-file-is-not.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0167-ath11k-pci-fix-crash-on-suspend-if-board-file-is-not.patch rename to package/kernel/mac80211/patches/ath11k/0170-ath11k-pci-fix-crash-on-suspend-if-board-file-is-not.patch index 3257d2c6e..436f7e47b 100644 --- a/package/kernel/mac80211/patches/ath11k/0167-ath11k-pci-fix-crash-on-suspend-if-board-file-is-not.patch +++ b/package/kernel/mac80211/patches/ath11k/0170-ath11k-pci-fix-crash-on-suspend-if-board-file-is-not.patch @@ -1,8 +1,7 @@ From b4f4c56459a5c744f7f066b9fc2b54ea995030c5 Mon Sep 17 00:00:00 2001 From: Kalle Valo Date: Thu, 27 Jan 2022 11:01:16 +0200 -Subject: [PATCH 167/171] ath11k: pci: fix crash on suspend if board file is - not found +Subject: [PATCH] ath11k: pci: fix crash on suspend if board file is not found Mario reported that the kernel was crashing on suspend if ath11k was not able to find a board file: diff --git a/package/kernel/mac80211/patches/ath11k/0168-ath11k-mhi-use-mhi_sync_power_up.patch b/package/kernel/mac80211/patches/ath11k/0171-ath11k-mhi-use-mhi_sync_power_up.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0168-ath11k-mhi-use-mhi_sync_power_up.patch rename to package/kernel/mac80211/patches/ath11k/0171-ath11k-mhi-use-mhi_sync_power_up.patch index 990d69850..6e23d989c 100644 --- a/package/kernel/mac80211/patches/ath11k/0168-ath11k-mhi-use-mhi_sync_power_up.patch +++ b/package/kernel/mac80211/patches/ath11k/0171-ath11k-mhi-use-mhi_sync_power_up.patch @@ -1,7 +1,7 @@ From 3df6d74aedfdca919cca475d15dfdbc8b05c9e5d Mon Sep 17 00:00:00 2001 From: Kalle Valo Date: Thu, 27 Jan 2022 11:01:17 +0200 -Subject: [PATCH 168/171] ath11k: mhi: use mhi_sync_power_up() +Subject: [PATCH] ath11k: mhi: use mhi_sync_power_up() If amss.bin was missing ath11k would crash during 'rmmod ath11k_pci'. The reason for that was that we were using mhi_async_power_up() which does not diff --git a/package/kernel/mac80211/patches/ath11k/0169-ath11k-Add-debugfs-interface-to-configure-firmware-d.patch b/package/kernel/mac80211/patches/ath11k/0172-ath11k-Add-debugfs-interface-to-configure-firmware-d.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0169-ath11k-Add-debugfs-interface-to-configure-firmware-d.patch rename to package/kernel/mac80211/patches/ath11k/0172-ath11k-Add-debugfs-interface-to-configure-firmware-d.patch index 5748341c4..3c4c3bed6 100644 --- a/package/kernel/mac80211/patches/ath11k/0169-ath11k-Add-debugfs-interface-to-configure-firmware-d.patch +++ b/package/kernel/mac80211/patches/ath11k/0172-ath11k-Add-debugfs-interface-to-configure-firmware-d.patch @@ -1,8 +1,8 @@ From f295ad912910e08d9b887a0c952f82d9612459d4 Mon Sep 17 00:00:00 2001 From: Seevalamuthu Mariappan Date: Mon, 31 Jan 2022 16:16:44 +0200 -Subject: [PATCH 169/171] ath11k: Add debugfs interface to configure firmware - debug log level +Subject: [PATCH] ath11k: Add debugfs interface to configure firmware debug log + level Add debugfs interface "fw_dbglog_config" to configure firmware log level. Configuration is done via WMI command WMI_DBGLOG_CFG_CMDID. @@ -88,7 +88,7 @@ Link: https://lore.kernel.org/r/1642405103-32302-1-git-send-email-quic_seevalam@ struct ath11k_per_peer_tx_stats { --- a/drivers/net/wireless/ath/ath11k/debugfs.c +++ b/drivers/net/wireless/ath/ath11k/debugfs.c -@@ -874,6 +874,69 @@ static const struct file_operations fops +@@ -876,6 +876,69 @@ static const struct file_operations fops .llseek = default_llseek, }; @@ -158,7 +158,7 @@ Link: https://lore.kernel.org/r/1642405103-32302-1-git-send-email-quic_seevalam@ int ath11k_debugfs_pdev_create(struct ath11k_base *ab) { if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) -@@ -1140,6 +1203,9 @@ int ath11k_debugfs_register(struct ath11 +@@ -1142,6 +1205,9 @@ int ath11k_debugfs_register(struct ath11 debugfs_create_file("pktlog_filter", 0644, ar->debug.debugfs_pdev, ar, &fops_pktlog_filter); diff --git a/package/kernel/mac80211/patches/ath11k/0170-ath11k-add-WMI-calls-to-manually-add-del-pause-resum.patch b/package/kernel/mac80211/patches/ath11k/0173-ath11k-add-WMI-calls-to-manually-add-del-pause-resum.patch similarity index 99% rename from package/kernel/mac80211/patches/ath11k/0170-ath11k-add-WMI-calls-to-manually-add-del-pause-resum.patch rename to package/kernel/mac80211/patches/ath11k/0173-ath11k-add-WMI-calls-to-manually-add-del-pause-resum.patch index c49b2975e..596edee35 100644 --- a/package/kernel/mac80211/patches/ath11k/0170-ath11k-add-WMI-calls-to-manually-add-del-pause-resum.patch +++ b/package/kernel/mac80211/patches/ath11k/0173-ath11k-add-WMI-calls-to-manually-add-del-pause-resum.patch @@ -1,8 +1,8 @@ From 3d00e8b5b818266f43d1fabdb961e215cab45dfb Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 31 Jan 2022 16:16:44 +0200 -Subject: [PATCH 170/171] ath11k: add WMI calls to manually - add/del/pause/resume TWT dialogs +Subject: [PATCH] ath11k: add WMI calls to manually add/del/pause/resume TWT + dialogs These calls are used for debugging and will be required for WFA certification tests. diff --git a/package/kernel/mac80211/patches/ath11k/0171-ath11k-add-debugfs-for-TWT-debug-calls.patch b/package/kernel/mac80211/patches/ath11k/0174-ath11k-add-debugfs-for-TWT-debug-calls.patch similarity index 98% rename from package/kernel/mac80211/patches/ath11k/0171-ath11k-add-debugfs-for-TWT-debug-calls.patch rename to package/kernel/mac80211/patches/ath11k/0174-ath11k-add-debugfs-for-TWT-debug-calls.patch index df5312448..1cc77a650 100644 --- a/package/kernel/mac80211/patches/ath11k/0171-ath11k-add-debugfs-for-TWT-debug-calls.patch +++ b/package/kernel/mac80211/patches/ath11k/0174-ath11k-add-debugfs-for-TWT-debug-calls.patch @@ -1,7 +1,7 @@ From fe98a6137d03a9e51db2197674c355d64eb3b709 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 31 Jan 2022 16:16:44 +0200 -Subject: [PATCH 171/171] ath11k: add debugfs for TWT debug calls +Subject: [PATCH] ath11k: add debugfs for TWT debug calls New debugfs files to manually add/delete/pause/resume TWT dialogs for test/debug purposes. @@ -60,7 +60,7 @@ Link: https://lore.kernel.org/r/20220131031043.1295-2-alokad@codeaurora.org struct ath11k_vif_iter { --- a/drivers/net/wireless/ath/ath11k/debugfs.c +++ b/drivers/net/wireless/ath/ath11k/debugfs.c -@@ -1222,3 +1222,225 @@ int ath11k_debugfs_register(struct ath11 +@@ -1224,3 +1224,225 @@ int ath11k_debugfs_register(struct ath11 void ath11k_debugfs_unregister(struct ath11k *ar) { } diff --git a/package/kernel/mac80211/patches/ath11k/0172-ath11k-fix-uninitialized-rate_idx-in-ath11k_dp_tx_up.patch b/package/kernel/mac80211/patches/ath11k/0176-ath11k-fix-uninitialized-rate_idx-in-ath11k_dp_tx_up.patch similarity index 81% rename from package/kernel/mac80211/patches/ath11k/0172-ath11k-fix-uninitialized-rate_idx-in-ath11k_dp_tx_up.patch rename to package/kernel/mac80211/patches/ath11k/0176-ath11k-fix-uninitialized-rate_idx-in-ath11k_dp_tx_up.patch index c42c99243..138f24f59 100644 --- a/package/kernel/mac80211/patches/ath11k/0172-ath11k-fix-uninitialized-rate_idx-in-ath11k_dp_tx_up.patch +++ b/package/kernel/mac80211/patches/ath11k/0176-ath11k-fix-uninitialized-rate_idx-in-ath11k_dp_tx_up.patch @@ -18,11 +18,9 @@ Link: https://lore.kernel.org/r/20220209060816.423-1-quic_wgong@quicinc.com drivers/net/wireless/ath/ath11k/dp_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c -index 91d6244b6543..8402961c6688 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -426,7 +426,7 @@ void ath11k_dp_tx_update_txcompl(struct ath11k *ar, struct hal_tx_status *ts) +@@ -426,7 +426,7 @@ void ath11k_dp_tx_update_txcompl(struct struct ath11k_sta *arsta; struct ieee80211_sta *sta; u16 rate, ru_tones; @@ -31,6 +29,3 @@ index 91d6244b6543..8402961c6688 100644 int ret; spin_lock_bh(&ab->base_lock); --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0173-ath11k-fix-WARN_ON-during-ath11k_mac_update_vif_chan.patch b/package/kernel/mac80211/patches/ath11k/0177-ath11k-fix-WARN_ON-during-ath11k_mac_update_vif_chan.patch similarity index 93% rename from package/kernel/mac80211/patches/ath11k/0173-ath11k-fix-WARN_ON-during-ath11k_mac_update_vif_chan.patch rename to package/kernel/mac80211/patches/ath11k/0177-ath11k-fix-WARN_ON-during-ath11k_mac_update_vif_chan.patch index 46269aed4..d41724a1f 100644 --- a/package/kernel/mac80211/patches/ath11k/0173-ath11k-fix-WARN_ON-during-ath11k_mac_update_vif_chan.patch +++ b/package/kernel/mac80211/patches/ath11k/0177-ath11k-fix-WARN_ON-during-ath11k_mac_update_vif_chan.patch @@ -19,11 +19,9 @@ Link: https://lore.kernel.org/r/1644416019-820-1-git-send-email-quic_vnaralas@qu drivers/net/wireless/ath/ath11k/mac.c | 32 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) -diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c -index ed899055944e..d5922a0a35f9 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6856,13 +6856,33 @@ ath11k_mac_update_vif_chan(struct ath11k *ar, +@@ -6856,13 +6856,33 @@ ath11k_mac_update_vif_chan(struct ath11k if (WARN_ON(!arvif->is_started)) continue; @@ -63,6 +61,3 @@ index ed899055944e..d5922a0a35f9 100644 continue; } --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0174-ath11k-fix-radar-detection-in-160-Mhz.patch b/package/kernel/mac80211/patches/ath11k/0178-ath11k-fix-radar-detection-in-160-Mhz.patch similarity index 84% rename from package/kernel/mac80211/patches/ath11k/0174-ath11k-fix-radar-detection-in-160-Mhz.patch rename to package/kernel/mac80211/patches/ath11k/0178-ath11k-fix-radar-detection-in-160-Mhz.patch index 269bee5cf..64f34d3c1 100644 --- a/package/kernel/mac80211/patches/ath11k/0174-ath11k-fix-radar-detection-in-160-Mhz.patch +++ b/package/kernel/mac80211/patches/ath11k/0178-ath11k-fix-radar-detection-in-160-Mhz.patch @@ -23,11 +23,9 @@ Link: https://lore.kernel.org/r/1644416019-820-2-git-send-email-quic_vnaralas@qu drivers/net/wireless/ath/ath11k/mac.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c -index d5922a0a35f9..68754e9914b3 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -6630,12 +6630,13 @@ static void ath11k_mac_op_remove_chanctx(struct ieee80211_hw *hw, +@@ -6630,12 +6630,13 @@ static void ath11k_mac_op_remove_chanctx static int ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, @@ -42,7 +40,7 @@ index d5922a0a35f9..68754e9914b3 100644 int he_support = arvif->vif->bss_conf.he_support; int ret = 0; -@@ -6670,8 +6671,7 @@ ath11k_mac_vdev_start_restart(struct ath11k_vif *arvif, +@@ -6670,8 +6671,7 @@ ath11k_mac_vdev_start_restart(struct ath arg.channel.chan_radar = !!(chandef->chan->flags & IEEE80211_CHAN_RADAR); @@ -52,7 +50,7 @@ index d5922a0a35f9..68754e9914b3 100644 arg.channel.passive = arg.channel.chan_radar; -@@ -6781,15 +6781,15 @@ static int ath11k_mac_vdev_stop(struct ath11k_vif *arvif) +@@ -6781,15 +6781,15 @@ err: } static int ath11k_mac_vdev_start(struct ath11k_vif *arvif, @@ -72,7 +70,7 @@ index d5922a0a35f9..68754e9914b3 100644 } struct ath11k_mac_change_chanctx_arg { -@@ -6864,7 +6864,7 @@ ath11k_mac_update_vif_chan(struct ath11k *ar, +@@ -6864,7 +6864,7 @@ ath11k_mac_update_vif_chan(struct ath11k * If vdev is down then it expect vdev_stop->vdev_start. */ if (arvif->is_up) { @@ -81,7 +79,7 @@ index d5922a0a35f9..68754e9914b3 100644 if (ret) { ath11k_warn(ab, "failed to restart vdev %d: %d\n", arvif->vdev_id, ret); -@@ -6878,7 +6878,7 @@ ath11k_mac_update_vif_chan(struct ath11k *ar, +@@ -6878,7 +6878,7 @@ ath11k_mac_update_vif_chan(struct ath11k continue; } @@ -90,7 +88,7 @@ index d5922a0a35f9..68754e9914b3 100644 if (ret) ath11k_warn(ab, "failed to start vdev %d: %d\n", arvif->vdev_id, ret); -@@ -6967,7 +6967,8 @@ static void ath11k_mac_op_change_chanctx(struct ieee80211_hw *hw, +@@ -6967,7 +6967,8 @@ static void ath11k_mac_op_change_chanctx if (WARN_ON(changed & IEEE80211_CHANCTX_CHANGE_CHANNEL)) goto unlock; @@ -100,7 +98,7 @@ index d5922a0a35f9..68754e9914b3 100644 ath11k_mac_update_active_vif_chan(ar, ctx); /* TODO: Recalc radar detection */ -@@ -6987,7 +6988,7 @@ static int ath11k_start_vdev_delay(struct ieee80211_hw *hw, +@@ -6987,7 +6988,7 @@ static int ath11k_start_vdev_delay(struc if (WARN_ON(arvif->is_started)) return -EBUSY; @@ -109,7 +107,7 @@ index d5922a0a35f9..68754e9914b3 100644 if (ret) { ath11k_warn(ab, "failed to start vdev %i addr %pM on freq %d: %d\n", arvif->vdev_id, vif->addr, -@@ -7081,7 +7082,7 @@ ath11k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, +@@ -7081,7 +7082,7 @@ ath11k_mac_op_assign_vif_chanctx(struct goto out; } @@ -118,6 +116,3 @@ index d5922a0a35f9..68754e9914b3 100644 if (ret) { ath11k_warn(ab, "failed to start vdev %i addr %pM on freq %d: %d\n", arvif->vdev_id, vif->addr, --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0175-ath11k-fix-destination-monitor-ring-out-of-sync.patch b/package/kernel/mac80211/patches/ath11k/0179-ath11k-fix-destination-monitor-ring-out-of-sync.patch similarity index 88% rename from package/kernel/mac80211/patches/ath11k/0175-ath11k-fix-destination-monitor-ring-out-of-sync.patch rename to package/kernel/mac80211/patches/ath11k/0179-ath11k-fix-destination-monitor-ring-out-of-sync.patch index a24118943..5352ae89a 100644 --- a/package/kernel/mac80211/patches/ath11k/0175-ath11k-fix-destination-monitor-ring-out-of-sync.patch +++ b/package/kernel/mac80211/patches/ath11k/0179-ath11k-fix-destination-monitor-ring-out-of-sync.patch @@ -21,8 +21,6 @@ Link: https://lore.kernel.org/r/20220210064706.6171-1-quic_kathirve@quicinc.com drivers/net/wireless/ath/ath11k/dp_rx.c | 42 +++++++++++++++++++++---- 2 files changed, 39 insertions(+), 6 deletions(-) -diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/ath/ath11k/dp.h -index 409d6cc5a1d5..b6ec2d6a2bb6 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -115,6 +115,8 @@ struct ath11k_pdev_mon_stats { @@ -42,11 +40,9 @@ index 409d6cc5a1d5..b6ec2d6a2bb6 100644 atomic_t num_tx_pending; wait_queue_head_t tx_empty_waitq; struct dp_rxdma_ring rx_refill_buf_ring; -diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c -index 99dc9b5bbf4b..20c9e7904261 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -4959,6 +4959,12 @@ static int ath11k_dp_rx_mon_deliver(struct ath11k *ar, u32 mac_id, +@@ -4959,6 +4959,12 @@ mon_deliver_fail: return -EINVAL; } @@ -59,7 +55,7 @@ index 99dc9b5bbf4b..20c9e7904261 100644 static void ath11k_dp_rx_mon_dest_process(struct ath11k *ar, int mac_id, u32 quota, struct napi_struct *napi) { -@@ -4972,6 +4978,7 @@ static void ath11k_dp_rx_mon_dest_process(struct ath11k *ar, int mac_id, +@@ -4972,6 +4978,7 @@ static void ath11k_dp_rx_mon_dest_proces u32 ring_id; struct ath11k_pdev_mon_stats *rx_mon_stats; u32 npackets = 0; @@ -67,7 +63,7 @@ index 99dc9b5bbf4b..20c9e7904261 100644 if (ar->ab->hw_params.rxdma1_enable) ring_id = dp->rxdma_mon_dst_ring.ring_id; -@@ -5001,16 +5008,39 @@ static void ath11k_dp_rx_mon_dest_process(struct ath11k *ar, int mac_id, +@@ -5001,16 +5008,39 @@ static void ath11k_dp_rx_mon_dest_proces head_msdu = NULL; tail_msdu = NULL; @@ -113,6 +109,3 @@ index 99dc9b5bbf4b..20c9e7904261 100644 break; } if (head_msdu && tail_msdu) { --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0182-ath11k-add-ath11k_qmi_free_resource-for-recovery.patch b/package/kernel/mac80211/patches/ath11k/0181-ath11k-add-ath11k_qmi_free_resource-for-recovery.patch similarity index 75% rename from package/kernel/mac80211/patches/ath11k/0182-ath11k-add-ath11k_qmi_free_resource-for-recovery.patch rename to package/kernel/mac80211/patches/ath11k/0181-ath11k-add-ath11k_qmi_free_resource-for-recovery.patch index 51671ea1d..831cfb2bb 100644 --- a/package/kernel/mac80211/patches/ath11k/0182-ath11k-add-ath11k_qmi_free_resource-for-recovery.patch +++ b/package/kernel/mac80211/patches/ath11k/0181-ath11k-add-ath11k_qmi_free_resource-for-recovery.patch @@ -16,11 +16,9 @@ Link: https://lore.kernel.org/r/20220209060012.32478-2-quic_wgong@quicinc.com drivers/net/wireless/ath/ath11k/qmi.h | 1 + 2 files changed, 6 insertions(+) -diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c -index d0701e8eca9c0..1144e828cf5cc 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -3025,3 +3025,8 @@ void ath11k_qmi_deinit_service(struct ath11k_base *ab) +@@ -3025,3 +3025,8 @@ void ath11k_qmi_deinit_service(struct at } EXPORT_SYMBOL(ath11k_qmi_deinit_service); @@ -29,17 +27,12 @@ index d0701e8eca9c0..1144e828cf5cc 100644 + ath11k_qmi_free_target_mem_chunk(ab); + ath11k_qmi_m3_free(ab); +} -diff --git a/drivers/net/wireless/ath/ath11k/qmi.h b/drivers/net/wireless/ath/ath11k/qmi.h -index ba2eff4d59cb5..61678de56ac7e 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.h +++ b/drivers/net/wireless/ath/ath11k/qmi.h -@@ -492,5 +492,6 @@ void ath11k_qmi_event_work(struct work_struct *work); +@@ -492,5 +492,6 @@ void ath11k_qmi_event_work(struct work_s void ath11k_qmi_msg_recv_work(struct work_struct *work); void ath11k_qmi_deinit_service(struct ath11k_base *ab); int ath11k_qmi_init_service(struct ath11k_base *ab); +void ath11k_qmi_free_resource(struct ath11k_base *ab); #endif --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0181-ath11k-fix-invalid-m3-buffer-address.patch b/package/kernel/mac80211/patches/ath11k/0182-ath11k-fix-invalid-m3-buffer-address.patch similarity index 82% rename from package/kernel/mac80211/patches/ath11k/0181-ath11k-fix-invalid-m3-buffer-address.patch rename to package/kernel/mac80211/patches/ath11k/0182-ath11k-fix-invalid-m3-buffer-address.patch index 85daf86b9..1c8ceb97e 100644 --- a/package/kernel/mac80211/patches/ath11k/0181-ath11k-fix-invalid-m3-buffer-address.patch +++ b/package/kernel/mac80211/patches/ath11k/0182-ath11k-fix-invalid-m3-buffer-address.patch @@ -17,11 +17,9 @@ Link: https://lore.kernel.org/r/20220209060012.32478-3-quic_wgong@quicinc.com drivers/net/wireless/ath/ath11k/qmi.c | 1 + 1 file changed, 1 insertion(+) -diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c -index 1144e828cf5cc..d4d831566a894 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -2342,6 +2342,7 @@ static void ath11k_qmi_m3_free(struct ath11k_base *ab) +@@ -2342,6 +2342,7 @@ static void ath11k_qmi_m3_free(struct at dma_free_coherent(ab->dev, m3_mem->size, m3_mem->vaddr, m3_mem->paddr); m3_mem->vaddr = NULL; @@ -29,6 +27,3 @@ index 1144e828cf5cc..d4d831566a894 100644 } static int ath11k_qmi_wlanfw_m3_info_send(struct ath11k_base *ab) --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0180-ath11k-configure-RDDM-size-to-mhi-for-recovery-by-fi.patch b/package/kernel/mac80211/patches/ath11k/0183-ath11k-configure-RDDM-size-to-mhi-for-recovery-by-fi.patch similarity index 84% rename from package/kernel/mac80211/patches/ath11k/0180-ath11k-configure-RDDM-size-to-mhi-for-recovery-by-fi.patch rename to package/kernel/mac80211/patches/ath11k/0183-ath11k-configure-RDDM-size-to-mhi-for-recovery-by-fi.patch index e516d82e4..865aa9836 100644 --- a/package/kernel/mac80211/patches/ath11k/0180-ath11k-configure-RDDM-size-to-mhi-for-recovery-by-fi.patch +++ b/package/kernel/mac80211/patches/ath11k/0183-ath11k-configure-RDDM-size-to-mhi-for-recovery-by-fi.patch @@ -15,8 +15,6 @@ Link: https://lore.kernel.org/r/20220209060012.32478-4-quic_wgong@quicinc.com drivers/net/wireless/ath/ath11k/mhi.c | 2 ++ 1 file changed, 2 insertions(+) -diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c -index 8b21438028169..fc3524e83e52c 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.c +++ b/drivers/net/wireless/ath/ath11k/mhi.c @@ -13,6 +13,7 @@ @@ -27,7 +25,7 @@ index 8b21438028169..fc3524e83e52c 100644 static struct mhi_channel_config ath11k_mhi_channels_qca6390[] = { { -@@ -382,6 +383,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) +@@ -384,6 +385,7 @@ int ath11k_mhi_register(struct ath11k_pc mhi_ctrl->iova_stop = 0xFFFFFFFF; } @@ -35,6 +33,3 @@ index 8b21438028169..fc3524e83e52c 100644 mhi_ctrl->sbl_size = SZ_512K; mhi_ctrl->seg_len = SZ_512K; mhi_ctrl->fbc_download = true; --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0179-ath11k-Replace-zero-length-arrays-with-flexible-arra.patch b/package/kernel/mac80211/patches/ath11k/0184-ath11k-Replace-zero-length-arrays-with-flexible-arra.patch similarity index 85% rename from package/kernel/mac80211/patches/ath11k/0179-ath11k-Replace-zero-length-arrays-with-flexible-arra.patch rename to package/kernel/mac80211/patches/ath11k/0184-ath11k-Replace-zero-length-arrays-with-flexible-arra.patch index 28d46cdcf..3099cccf8 100644 --- a/package/kernel/mac80211/patches/ath11k/0179-ath11k-Replace-zero-length-arrays-with-flexible-arra.patch +++ b/package/kernel/mac80211/patches/ath11k/0184-ath11k-Replace-zero-length-arrays-with-flexible-arra.patch @@ -29,8 +29,6 @@ Link: https://lore.kernel.org/r/20220216194836.GA904035@embeddedor drivers/net/wireless/ath/ath11k/spectral.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) -diff --git a/drivers/net/wireless/ath/ath11k/ce.h b/drivers/net/wireless/ath/ath11k/ce.h -index 8255b6cfab0c7..9644ff909502e 100644 --- a/drivers/net/wireless/ath/ath11k/ce.h +++ b/drivers/net/wireless/ath/ath11k/ce.h @@ -145,7 +145,7 @@ struct ath11k_ce_ring { @@ -42,8 +40,6 @@ index 8255b6cfab0c7..9644ff909502e 100644 }; struct ath11k_ce_pipe { -diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h -index 10846e9e871a9..d2fc7a7a98f4c 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -815,7 +815,7 @@ struct ath11k_base { @@ -55,8 +51,6 @@ index 10846e9e871a9..d2fc7a7a98f4c 100644 }; struct ath11k_fw_stats_pdev { -diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/ath/ath11k/dp.h -index b6ec2d6a2bb61..e9dfa209098b1 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -1173,12 +1173,12 @@ struct ath11k_htt_ppdu_stats_msg { @@ -101,8 +95,6 @@ index b6ec2d6a2bb61..e9dfa209098b1 100644 } __packed; #define HTT_MAC_ADDR_L32_0 GENMASK(7, 0) -diff --git a/drivers/net/wireless/ath/ath11k/rx_desc.h b/drivers/net/wireless/ath/ath11k/rx_desc.h -index 79c50804d7dcd..26ecc1bcd9d57 100644 --- a/drivers/net/wireless/ath/ath11k/rx_desc.h +++ b/drivers/net/wireless/ath/ath11k/rx_desc.h @@ -1445,7 +1445,7 @@ struct hal_rx_desc_ipq8074 { @@ -132,8 +124,6 @@ index 79c50804d7dcd..26ecc1bcd9d57 100644 } __packed; struct hal_rx_desc { -diff --git a/drivers/net/wireless/ath/ath11k/spectral.c b/drivers/net/wireless/ath/ath11k/spectral.c -index 4100cc1449a2b..2b18871d5f7cb 100644 --- a/drivers/net/wireless/ath/ath11k/spectral.c +++ b/drivers/net/wireless/ath/ath11k/spectral.c @@ -107,7 +107,7 @@ struct spectral_search_fft_report { @@ -145,6 +135,3 @@ index 4100cc1449a2b..2b18871d5f7cb 100644 } __packed; struct ath11k_spectral_search_report { --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0178-ath11k-Invalidate-cached-reo-ring-entry-before-acces.patch b/package/kernel/mac80211/patches/ath11k/0185-ath11k-Invalidate-cached-reo-ring-entry-before-acces.patch similarity index 88% rename from package/kernel/mac80211/patches/ath11k/0178-ath11k-Invalidate-cached-reo-ring-entry-before-acces.patch rename to package/kernel/mac80211/patches/ath11k/0185-ath11k-Invalidate-cached-reo-ring-entry-before-acces.patch index 049b79a24..f491abc74 100644 --- a/package/kernel/mac80211/patches/ath11k/0178-ath11k-Invalidate-cached-reo-ring-entry-before-acces.patch +++ b/package/kernel/mac80211/patches/ath11k/0185-ath11k-Invalidate-cached-reo-ring-entry-before-acces.patch @@ -29,11 +29,9 @@ Link: https://lore.kernel.org/r/1645000354-32558-1-git-send-email-quic_ramess@qu drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c -index 20c9e79042613..9183d6f2e5efc 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -2652,9 +2652,9 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id, +@@ -2652,9 +2652,9 @@ int ath11k_dp_process_rx(struct ath11k_b spin_lock_bh(&srng->lock); @@ -44,6 +42,3 @@ index 20c9e79042613..9183d6f2e5efc 100644 while (likely(desc = (struct hal_reo_dest_ring *)ath11k_hal_srng_dst_get_next_entry(ab, srng))) { --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0177-ath11k-Handle-failure-in-qmi-firmware-ready.patch b/package/kernel/mac80211/patches/ath11k/0186-ath11k-Handle-failure-in-qmi-firmware-ready.patch similarity index 87% rename from package/kernel/mac80211/patches/ath11k/0177-ath11k-Handle-failure-in-qmi-firmware-ready.patch rename to package/kernel/mac80211/patches/ath11k/0186-ath11k-Handle-failure-in-qmi-firmware-ready.patch index a59096eb0..2cd2a463c 100644 --- a/package/kernel/mac80211/patches/ath11k/0177-ath11k-Handle-failure-in-qmi-firmware-ready.patch +++ b/package/kernel/mac80211/patches/ath11k/0186-ath11k-Handle-failure-in-qmi-firmware-ready.patch @@ -24,11 +24,9 @@ Link: https://lore.kernel.org/r/1645079195-13564-1-git-send-email-quic_seevalam@ drivers/net/wireless/ath/ath11k/qmi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c -index d4d831566a894..04e966830c188 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -2960,7 +2960,11 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work) +@@ -2960,7 +2960,11 @@ static void ath11k_qmi_driver_event_work clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); @@ -41,6 +39,3 @@ index d4d831566a894..04e966830c188 100644 set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags); } --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0176-ath11k-Fix-frames-flush-failure-caused-by-deadlock.patch b/package/kernel/mac80211/patches/ath11k/0187-ath11k-Fix-frames-flush-failure-caused-by-deadlock.patch similarity index 97% rename from package/kernel/mac80211/patches/ath11k/0176-ath11k-Fix-frames-flush-failure-caused-by-deadlock.patch rename to package/kernel/mac80211/patches/ath11k/0187-ath11k-Fix-frames-flush-failure-caused-by-deadlock.patch index 85b01b2ad..003b62406 100644 --- a/package/kernel/mac80211/patches/ath11k/0176-ath11k-Fix-frames-flush-failure-caused-by-deadlock.patch +++ b/package/kernel/mac80211/patches/ath11k/0187-ath11k-Fix-frames-flush-failure-caused-by-deadlock.patch @@ -113,11 +113,9 @@ Link: https://lore.kernel.org/r/20220217084545.18844-1-quic_bqiang@quicinc.com drivers/net/wireless/ath/ath11k/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c -index 68754e9914b3a..0b3b6f3ae4aac 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -5579,7 +5579,7 @@ static int ath11k_mac_mgmt_tx(struct ath11k *ar, struct sk_buff *skb, +@@ -5579,7 +5579,7 @@ static int ath11k_mac_mgmt_tx(struct ath skb_queue_tail(q, skb); atomic_inc(&ar->num_pending_mgmt_tx); @@ -126,6 +124,3 @@ index 68754e9914b3a..0b3b6f3ae4aac 100644 return 0; } --- -2.35.1 - diff --git a/package/kernel/mac80211/patches/ath11k/0188-ath11k-switch-to-using-ieee80211_tx_status_ext.patch b/package/kernel/mac80211/patches/ath11k/0188-ath11k-switch-to-using-ieee80211_tx_status_ext.patch new file mode 100644 index 000000000..c97d62553 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0188-ath11k-switch-to-using-ieee80211_tx_status_ext.patch @@ -0,0 +1,65 @@ +From 94739d45c388c5c5be49bb0a5d911f672122d378 Mon Sep 17 00:00:00 2001 +From: Pradeep Kumar Chitrapu +Date: Wed, 16 Feb 2022 17:21:10 -0800 +Subject: [PATCH] ath11k: switch to using ieee80211_tx_status_ext() + +This allows us to pass HE rates down into the stack. + +Co-developed-by: Miles Hu +Signed-off-by: Miles Hu +Signed-off-by: John Crispin +Signed-off-by: Pradeep Kumar Chitrapu +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220217012112.31211-2-pradeepc@codeaurora.org +--- + drivers/net/wireless/ath/ath11k/dp_tx.c | 28 ++++++++++++++++++++----- + 1 file changed, 23 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/dp_tx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_tx.c +@@ -518,9 +518,13 @@ static void ath11k_dp_tx_complete_msdu(s + struct sk_buff *msdu, + struct hal_tx_status *ts) + { ++ struct ieee80211_tx_status status = { 0 }; + struct ath11k_base *ab = ar->ab; + struct ieee80211_tx_info *info; + struct ath11k_skb_cb *skb_cb; ++ struct ath11k_peer *peer; ++ struct ath11k_sta *arsta; ++ struct rate_info rate; + + if (WARN_ON_ONCE(ts->buf_rel_source != HAL_WBM_REL_SRC_MODULE_TQM)) { + /* Must not happen */ +@@ -583,12 +587,26 @@ static void ath11k_dp_tx_complete_msdu(s + ath11k_dp_tx_cache_peer_stats(ar, msdu, ts); + } + +- /* NOTE: Tx rate status reporting. Tx completion status does not have +- * necessary information (for example nss) to build the tx rate. +- * Might end up reporting it out-of-band from HTT stats. +- */ ++ 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; ++ } ++ arsta = (struct ath11k_sta *)peer->sta->drv_priv; ++ status.sta = peer->sta; ++ status.skb = msdu; ++ status.info = info; ++ rate = arsta->last_txrate; ++ status.rate = &rate; ++ ++ spin_unlock_bh(&ab->base_lock); + +- ieee80211_tx_status(ar->hw, msdu); ++ ieee80211_tx_status_ext(ar->hw, &status); + } + + static inline void ath11k_dp_tx_status_parse(struct ath11k_base *ab, diff --git a/package/kernel/mac80211/patches/ath11k/0189-ath11k-decode-HE-status-tlv.patch b/package/kernel/mac80211/patches/ath11k/0189-ath11k-decode-HE-status-tlv.patch new file mode 100644 index 000000000..ae811bb52 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0189-ath11k-decode-HE-status-tlv.patch @@ -0,0 +1,424 @@ +From 01d2f285e3e5b629df9c61514e7ee07a54d0eed9 Mon Sep 17 00:00:00 2001 +From: Pradeep Kumar Chitrapu +Date: Wed, 16 Feb 2022 17:21:11 -0800 +Subject: [PATCH] ath11k: decode HE status tlv + +Add new bitmasks and macro definitions required for parsing HE +status tlvs. Decode HE status tlvs, which will used in dumping +ppdu stats as well as updating radiotap headers. + +Co-developed-by: Miles Hu +Signed-off-by: Miles Hu +Signed-off-by: Pradeep Kumar Chitrapu +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220217012112.31211-3-pradeepc@codeaurora.org +--- + drivers/net/wireless/ath/ath11k/dp_rx.c | 100 ++++++++++++--- + drivers/net/wireless/ath/ath11k/hal_desc.h | 1 + + drivers/net/wireless/ath/ath11k/hal_rx.h | 135 ++++++++++++++++++++- + 3 files changed, 215 insertions(+), 21 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -4807,7 +4807,6 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11 + { + struct ath11k_base *ab = ar->ab; + struct sk_buff *msdu, *prev_buf; +- u32 wifi_hdr_len; + struct hal_rx_desc *rx_desc; + char *hdr_desc; + u8 *dest, decap_format; +@@ -4849,38 +4848,27 @@ ath11k_dp_rx_mon_merg_msdus(struct ath11 + + skb_trim(prev_buf, prev_buf->len - HAL_RX_FCS_LEN); + } else if (decap_format == DP_RX_DECAP_TYPE_NATIVE_WIFI) { +- __le16 qos_field; + u8 qos_pkt = 0; + + rx_desc = (struct hal_rx_desc *)head_msdu->data; + hdr_desc = ath11k_dp_rxdesc_get_80211hdr(ab, rx_desc); + + /* Base size */ +- wifi_hdr_len = sizeof(struct ieee80211_hdr_3addr); + wh = (struct ieee80211_hdr_3addr *)hdr_desc; + +- if (ieee80211_is_data_qos(wh->frame_control)) { +- struct ieee80211_qos_hdr *qwh = +- (struct ieee80211_qos_hdr *)hdr_desc; +- +- qos_field = qwh->qos_ctrl; ++ if (ieee80211_is_data_qos(wh->frame_control)) + qos_pkt = 1; +- } ++ + msdu = head_msdu; + + while (msdu) { +- rx_desc = (struct hal_rx_desc *)msdu->data; +- hdr_desc = ath11k_dp_rxdesc_get_80211hdr(ab, rx_desc); +- ++ ath11k_dp_rx_msdus_set_payload(ar, msdu); + if (qos_pkt) { + dest = skb_push(msdu, sizeof(__le16)); + if (!dest) + goto err_merge_fail; +- memcpy(dest, hdr_desc, wifi_hdr_len); +- memcpy(dest + wifi_hdr_len, +- (u8 *)&qos_field, sizeof(__le16)); ++ memcpy(dest, hdr_desc, sizeof(struct ieee80211_qos_hdr)); + } +- ath11k_dp_rx_msdus_set_payload(ar, msdu); + prev_buf = msdu; + msdu = msdu->next; + } +@@ -4904,8 +4892,83 @@ err_merge_fail: + return NULL; + } + ++static void ++ath11k_dp_rx_update_radiotap_he(struct hal_rx_mon_ppdu_info *rx_status, ++ u8 *rtap_buf) ++{ ++ u32 rtap_len = 0; ++ ++ put_unaligned_le16(rx_status->he_data1, &rtap_buf[rtap_len]); ++ rtap_len += 2; ++ ++ put_unaligned_le16(rx_status->he_data2, &rtap_buf[rtap_len]); ++ rtap_len += 2; ++ ++ put_unaligned_le16(rx_status->he_data3, &rtap_buf[rtap_len]); ++ rtap_len += 2; ++ ++ put_unaligned_le16(rx_status->he_data4, &rtap_buf[rtap_len]); ++ rtap_len += 2; ++ ++ put_unaligned_le16(rx_status->he_data5, &rtap_buf[rtap_len]); ++ rtap_len += 2; ++ ++ put_unaligned_le16(rx_status->he_data6, &rtap_buf[rtap_len]); ++} ++ ++static void ++ath11k_dp_rx_update_radiotap_he_mu(struct hal_rx_mon_ppdu_info *rx_status, ++ u8 *rtap_buf) ++{ ++ u32 rtap_len = 0; ++ ++ put_unaligned_le16(rx_status->he_flags1, &rtap_buf[rtap_len]); ++ rtap_len += 2; ++ ++ put_unaligned_le16(rx_status->he_flags2, &rtap_buf[rtap_len]); ++ rtap_len += 2; ++ ++ rtap_buf[rtap_len] = rx_status->he_RU[0]; ++ rtap_len += 1; ++ ++ rtap_buf[rtap_len] = rx_status->he_RU[1]; ++ rtap_len += 1; ++ ++ rtap_buf[rtap_len] = rx_status->he_RU[2]; ++ rtap_len += 1; ++ ++ rtap_buf[rtap_len] = rx_status->he_RU[3]; ++} ++ ++static void ath11k_update_radiotap(struct hal_rx_mon_ppdu_info *ppduinfo, ++ struct sk_buff *mon_skb, ++ struct ieee80211_rx_status *rxs) ++{ ++ u8 *ptr = NULL; ++ ++ if (ppduinfo->he_mu_flags) { ++ rxs->flag |= RX_FLAG_RADIOTAP_HE_MU; ++ rxs->encoding = RX_ENC_HE; ++ ptr = skb_push(mon_skb, sizeof(struct ieee80211_radiotap_he_mu)); ++ ath11k_dp_rx_update_radiotap_he_mu(ppduinfo, ptr); ++ } ++ if (ppduinfo->he_flags) { ++ rxs->flag |= RX_FLAG_RADIOTAP_HE; ++ rxs->encoding = RX_ENC_HE; ++ ptr = skb_push(mon_skb, sizeof(struct ieee80211_radiotap_he)); ++ ath11k_dp_rx_update_radiotap_he(ppduinfo, ptr); ++ } ++ ++ rxs->flag |= RX_FLAG_MACTIME_START; ++ rxs->signal = ppduinfo->rssi_comb + ATH11K_DEFAULT_NOISE_FLOOR; ++ rxs->nss = ppduinfo->nss; ++ ++ rxs->mactime = ppduinfo->tsft; ++} ++ + static int ath11k_dp_rx_mon_deliver(struct ath11k *ar, u32 mac_id, + struct sk_buff *head_msdu, ++ struct hal_rx_mon_ppdu_info *ppduinfo, + struct sk_buff *tail_msdu, + struct napi_struct *napi) + { +@@ -4940,7 +5003,7 @@ static int ath11k_dp_rx_mon_deliver(stru + } else { + rxs->flag |= RX_FLAG_ALLOW_SAME_PN; + } +- rxs->flag |= RX_FLAG_ONLY_MONITOR; ++ ath11k_update_radiotap(ppduinfo, mon_skb, rxs); + + ath11k_dp_rx_deliver_msdu(ar, napi, mon_skb, rxs); + mon_skb = skb_next; +@@ -5045,6 +5108,7 @@ static void ath11k_dp_rx_mon_dest_proces + } + if (head_msdu && tail_msdu) { + ath11k_dp_rx_mon_deliver(ar, dp->mac_id, head_msdu, ++ &pmon->mon_ppdu_info, + tail_msdu, napi); + rx_mon_stats->dest_mpdu_done++; + } +@@ -5114,6 +5178,7 @@ int ath11k_dp_rx_process_mon_status(stru + if (log_type != ATH11K_PKTLOG_TYPE_INVALID) + trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); + ++ memset(ppdu_info, 0, sizeof(struct hal_rx_mon_ppdu_info)); + hal_status = ath11k_hal_rx_parse_mon_status(ab, ppdu_info, skb); + + if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags) && +@@ -5374,6 +5439,7 @@ static int ath11k_dp_rx_full_mon_deliver + tail_msdu = mon_mpdu->tail; + if (head_msdu && tail_msdu) { + ret = ath11k_dp_rx_mon_deliver(ar, mac_id, head_msdu, ++ &pmon->mon_ppdu_info, + tail_msdu, napi); + rx_mon_stats->dest_mpdu_done++; + ath11k_dbg(ar->ab, ATH11K_DBG_DATA, "full mon: deliver ppdu\n"); +--- a/drivers/net/wireless/ath/ath11k/hal_desc.h ++++ b/drivers/net/wireless/ath/ath11k/hal_desc.h +@@ -474,6 +474,7 @@ enum hal_tlv_tag { + + #define HAL_TLV_HDR_TAG GENMASK(9, 1) + #define HAL_TLV_HDR_LEN GENMASK(25, 10) ++#define HAL_TLV_USR_ID GENMASK(31, 26) + + #define HAL_TLV_ALIGN 4 + +--- a/drivers/net/wireless/ath/ath11k/hal_rx.h ++++ b/drivers/net/wireless/ath/ath11k/hal_rx.h +@@ -73,6 +73,36 @@ enum hal_rx_mon_status { + HAL_RX_MON_STATUS_BUF_DONE, + }; + ++struct hal_rx_user_status { ++ u32 mcs:4, ++ nss:3, ++ ofdma_info_valid:1, ++ dl_ofdma_ru_start_index:7, ++ dl_ofdma_ru_width:7, ++ dl_ofdma_ru_size:8; ++ u32 ul_ofdma_user_v0_word0; ++ u32 ul_ofdma_user_v0_word1; ++ u32 ast_index; ++ u32 tid; ++ u16 tcp_msdu_count; ++ u16 udp_msdu_count; ++ u16 other_msdu_count; ++ u16 frame_control; ++ u8 frame_control_info_valid; ++ u8 data_sequence_control_info_valid; ++ u16 first_data_seq_ctrl; ++ u32 preamble_type; ++ u16 ht_flags; ++ u16 vht_flags; ++ u16 he_flags; ++ u8 rs_flags; ++ u32 mpdu_cnt_fcs_ok; ++ u32 mpdu_cnt_fcs_err; ++ u32 mpdu_fcs_ok_bitmap[8]; ++ u32 mpdu_ok_byte_count; ++ u32 mpdu_err_byte_count; ++}; ++ + #define HAL_TLV_STATUS_PPDU_NOT_DONE HAL_RX_MON_STATUS_PPDU_NOT_DONE + #define HAL_TLV_STATUS_PPDU_DONE HAL_RX_MON_STATUS_PPDU_DONE + #define HAL_TLV_STATUS_BUF_DONE HAL_RX_MON_STATUS_BUF_DONE +@@ -107,6 +137,12 @@ struct hal_rx_mon_ppdu_info { + u8 mcs; + u8 nss; + u8 bw; ++ u8 vht_flag_values1; ++ u8 vht_flag_values2; ++ u8 vht_flag_values3[4]; ++ u8 vht_flag_values4; ++ u8 vht_flag_values5; ++ u16 vht_flag_values6; + u8 is_stbc; + u8 gi; + u8 ldpc; +@@ -114,10 +150,46 @@ struct hal_rx_mon_ppdu_info { + u8 rssi_comb; + u8 rssi_chain_pri20[HAL_RX_MAX_NSS]; + u8 tid; ++ u16 ht_flags; ++ u16 vht_flags; ++ u16 he_flags; ++ u16 he_mu_flags; + u8 dcm; + u8 ru_alloc; + u8 reception_type; ++ u64 tsft; + u64 rx_duration; ++ u16 frame_control; ++ u32 ast_index; ++ u8 rs_fcs_err; ++ u8 rs_flags; ++ u8 cck_flag; ++ u8 ofdm_flag; ++ u8 ulofdma_flag; ++ u8 frame_control_info_valid; ++ u16 he_per_user_1; ++ u16 he_per_user_2; ++ u8 he_per_user_position; ++ u8 he_per_user_known; ++ u16 he_flags1; ++ u16 he_flags2; ++ u8 he_RU[4]; ++ u16 he_data1; ++ u16 he_data2; ++ u16 he_data3; ++ u16 he_data4; ++ u16 he_data5; ++ u16 he_data6; ++ u32 ppdu_len; ++ u32 prev_ppdu_id; ++ u32 device_id; ++ u16 first_data_seq_ctrl; ++ u8 monitor_direct_used; ++ u8 data_sequence_control_info_valid; ++ u8 ltf_size; ++ u8 rxpcu_filter_pass; ++ char rssi_chain[8][8]; ++ struct hal_rx_user_status userstats; + }; + + #define HAL_RX_PPDU_START_INFO0_PPDU_ID GENMASK(15, 0) +@@ -150,6 +222,9 @@ struct hal_rx_ppdu_start { + #define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_BITMAP GENMASK(15, 0) + #define HAL_RX_PPDU_END_USER_STATS_INFO6_TID_EOSP_BITMAP GENMASK(31, 16) + ++#define HAL_RX_PPDU_END_USER_STATS_RSVD2_6_MPDU_OK_BYTE_COUNT GENMASK(24, 0) ++#define HAL_RX_PPDU_END_USER_STATS_RSVD2_8_MPDU_ERR_BYTE_COUNT GENMASK(24, 0) ++ + struct hal_rx_ppdu_end_user_stats { + __le32 rsvd0[2]; + __le32 info0; +@@ -164,6 +239,16 @@ struct hal_rx_ppdu_end_user_stats { + __le32 rsvd2[11]; + } __packed; + ++struct hal_rx_ppdu_end_user_stats_ext { ++ u32 info0; ++ u32 info1; ++ u32 info2; ++ u32 info3; ++ u32 info4; ++ u32 info5; ++ u32 info6; ++} __packed; ++ + #define HAL_RX_HT_SIG_INFO_INFO0_MCS GENMASK(6, 0) + #define HAL_RX_HT_SIG_INFO_INFO0_BW BIT(7) + +@@ -212,25 +297,62 @@ enum hal_rx_vht_sig_a_gi_setting { + HAL_RX_VHT_SIG_A_SHORT_GI_AMBIGUITY = 3, + }; + ++#define HAL_RX_SU_MU_CODING_LDPC 0x01 ++ ++#define HE_GI_0_8 0 ++#define HE_GI_0_4 1 ++#define HE_GI_1_6 2 ++#define HE_GI_3_2 3 ++ ++#define HE_LTF_1_X 0 ++#define HE_LTF_2_X 1 ++#define HE_LTF_4_X 2 ++#define HE_LTF_UNKNOWN 3 ++ + #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_MCS GENMASK(6, 3) + #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_DCM BIT(7) + #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_BW GENMASK(20, 19) + #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_CP_LTF_SIZE GENMASK(22, 21) + #define HAL_RX_HE_SIG_A_SU_INFO_INFO0_NSTS GENMASK(25, 23) ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_BSS_COLOR GENMASK(13, 8) ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_SPATIAL_REUSE GENMASK(18, 15) ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_FORMAT_IND BIT(0) ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_BEAM_CHANGE BIT(1) ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO0_DL_UL_FLAG BIT(2) + ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXOP_DURATION GENMASK(6, 0) + #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_CODING BIT(7) ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_LDPC_EXTRA BIT(8) + #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_STBC BIT(9) + #define HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXBF BIT(10) ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_PKT_EXT_FACTOR GENMASK(12, 11) ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_PKT_EXT_PE_DISAM BIT(13) ++#define HAL_RX_HE_SIG_A_SU_INFO_INFO1_DOPPLER_IND BIT(15) + + struct hal_rx_he_sig_a_su_info { + __le32 info0; + __le32 info1; + } __packed; + +-#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_TRANSMIT_BW GENMASK(17, 15) +-#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_CP_LTF_SIZE GENMASK(24, 23) +- ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_UL_FLAG BIT(1) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_MCS_OF_SIGB GENMASK(3, 1) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_DCM_OF_SIGB BIT(4) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_BSS_COLOR GENMASK(10, 5) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_SPATIAL_REUSE GENMASK(14, 11) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_TRANSMIT_BW GENMASK(17, 15) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_NUM_SIGB_SYMB GENMASK(21, 18) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_COMP_MODE_SIGB BIT(22) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_CP_LTF_SIZE GENMASK(24, 23) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_DOPPLER_INDICATION BIT(25) ++ ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_TXOP_DURATION GENMASK(6, 0) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_CODING BIT(7) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_NUM_LTF_SYMB GENMASK(10, 8) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_LDPC_EXTRA BIT(11) + #define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_STBC BIT(12) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_TXBF BIT(10) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_PKT_EXT_FACTOR GENMASK(14, 13) ++#define HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_PKT_EXT_PE_DISAM BIT(15) + + struct hal_rx_he_sig_a_mu_dl_info { + __le32 info0; +@@ -243,6 +365,7 @@ struct hal_rx_he_sig_b1_mu_info { + __le32 info0; + } __packed; + ++#define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_ID GENMASK(10, 0) + #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_MCS GENMASK(18, 15) + #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_CODING BIT(20) + #define HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_NSTS GENMASK(31, 29) +@@ -251,6 +374,7 @@ struct hal_rx_he_sig_b2_mu_info { + __le32 info0; + } __packed; + ++#define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_ID GENMASK(10, 0) + #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_NSTS GENMASK(13, 11) + #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_TXBF BIT(19) + #define HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_MCS GENMASK(18, 15) +@@ -279,11 +403,14 @@ struct hal_rx_phyrx_rssi_legacy_info { + + #define HAL_RX_MPDU_INFO_INFO0_PEERID GENMASK(31, 16) + #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 { + __le32 rsvd0; + __le32 info0; +- __le32 rsvd1[21]; ++ __le32 rsvd1[11]; ++ __le32 info1; ++ __le32 rsvd2[9]; + } __packed; + + struct hal_rx_mpdu_info_wcn6855 { diff --git a/package/kernel/mac80211/patches/ath11k/0190-ath11k-translate-HE-status-to-radiotap-format.patch b/package/kernel/mac80211/patches/ath11k/0190-ath11k-translate-HE-status-to-radiotap-format.patch new file mode 100644 index 000000000..5212e1315 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0190-ath11k-translate-HE-status-to-radiotap-format.patch @@ -0,0 +1,686 @@ +From ab0a9ef605cf527c9754c2e7b055a391a9f0233c Mon Sep 17 00:00:00 2001 +From: Pradeep Kumar Chitrapu +Date: Wed, 16 Feb 2022 17:21:12 -0800 +Subject: [PATCH] ath11k: translate HE status to radiotap format + +Translate HE status to radiotap format. This uses HE radiotap +definitions from include/net/ieee80211_radiotap.h. + +Co-developed-by: Miles Hu +Signed-off-by: Miles Hu +Signed-off-by: Anilkumar Kolli +Signed-off-by: Pradeep Kumar Chitrapu +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220217012112.31211-4-pradeepc@codeaurora.org +--- + drivers/net/wireless/ath/ath11k/dp_rx.c | 31 +- + drivers/net/wireless/ath/ath11k/hal_rx.c | 471 ++++++++++++++++++++--- + 2 files changed, 438 insertions(+), 64 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -4940,29 +4940,44 @@ ath11k_dp_rx_update_radiotap_he_mu(struc + rtap_buf[rtap_len] = rx_status->he_RU[3]; + } + +-static void ath11k_update_radiotap(struct hal_rx_mon_ppdu_info *ppduinfo, ++static void ath11k_update_radiotap(struct ath11k *ar, ++ struct hal_rx_mon_ppdu_info *ppduinfo, + struct sk_buff *mon_skb, + struct ieee80211_rx_status *rxs) + { ++ struct ieee80211_supported_band *sband; + u8 *ptr = NULL; + ++ rxs->flag |= RX_FLAG_MACTIME_START; ++ rxs->signal = ppduinfo->rssi_comb + ATH11K_DEFAULT_NOISE_FLOOR; ++ ++ if (ppduinfo->nss) ++ rxs->nss = ppduinfo->nss; ++ + if (ppduinfo->he_mu_flags) { + rxs->flag |= RX_FLAG_RADIOTAP_HE_MU; + rxs->encoding = RX_ENC_HE; + ptr = skb_push(mon_skb, sizeof(struct ieee80211_radiotap_he_mu)); + ath11k_dp_rx_update_radiotap_he_mu(ppduinfo, ptr); +- } +- if (ppduinfo->he_flags) { ++ } else if (ppduinfo->he_flags) { + rxs->flag |= RX_FLAG_RADIOTAP_HE; + rxs->encoding = RX_ENC_HE; + ptr = skb_push(mon_skb, sizeof(struct ieee80211_radiotap_he)); + ath11k_dp_rx_update_radiotap_he(ppduinfo, ptr); ++ rxs->rate_idx = ppduinfo->rate; ++ } else if (ppduinfo->vht_flags) { ++ rxs->encoding = RX_ENC_VHT; ++ rxs->rate_idx = ppduinfo->rate; ++ } else if (ppduinfo->ht_flags) { ++ rxs->encoding = RX_ENC_HT; ++ rxs->rate_idx = ppduinfo->rate; ++ } else { ++ rxs->encoding = RX_ENC_LEGACY; ++ sband = &ar->mac.sbands[rxs->band]; ++ rxs->rate_idx = ath11k_mac_hw_rate_to_idx(sband, ppduinfo->rate, ++ ppduinfo->cck_flag); + } + +- rxs->flag |= RX_FLAG_MACTIME_START; +- rxs->signal = ppduinfo->rssi_comb + ATH11K_DEFAULT_NOISE_FLOOR; +- rxs->nss = ppduinfo->nss; +- + rxs->mactime = ppduinfo->tsft; + } + +@@ -5003,7 +5018,7 @@ static int ath11k_dp_rx_mon_deliver(stru + } else { + rxs->flag |= RX_FLAG_ALLOW_SAME_PN; + } +- ath11k_update_radiotap(ppduinfo, mon_skb, rxs); ++ ath11k_update_radiotap(ar, ppduinfo, mon_skb, rxs); + + ath11k_dp_rx_deliver_msdu(ar, napi, mon_skb, rxs); + mon_skb = skb_next; +--- a/drivers/net/wireless/ath/ath11k/hal_rx.c ++++ b/drivers/net/wireless/ath/ath11k/hal_rx.c +@@ -456,10 +456,12 @@ void ath11k_hal_reo_status_queue_stats(s + desc->info0)); + ath11k_dbg(ab, ATH11k_DBG_HAL, "pn = [%08x, %08x, %08x, %08x]\n", + desc->pn[0], desc->pn[1], desc->pn[2], desc->pn[3]); +- ath11k_dbg(ab, ATH11k_DBG_HAL, "last_rx: enqueue_tstamp %08x dequeue_tstamp %08x\n", ++ ath11k_dbg(ab, ATH11k_DBG_HAL, ++ "last_rx: enqueue_tstamp %08x dequeue_tstamp %08x\n", + desc->last_rx_enqueue_timestamp, + desc->last_rx_dequeue_timestamp); +- ath11k_dbg(ab, ATH11k_DBG_HAL, "rx_bitmap [%08x %08x %08x %08x %08x %08x %08x %08x]\n", ++ ath11k_dbg(ab, ATH11k_DBG_HAL, ++ "rx_bitmap [%08x %08x %08x %08x %08x %08x %08x %08x]\n", + desc->rx_bitmap[0], desc->rx_bitmap[1], desc->rx_bitmap[2], + desc->rx_bitmap[3], desc->rx_bitmap[4], desc->rx_bitmap[5], + desc->rx_bitmap[6], desc->rx_bitmap[7]); +@@ -803,12 +805,75 @@ void ath11k_hal_reo_init_cmd_ring(struct + } + } + ++#define HAL_MAX_UL_MU_USERS 37 ++static inline void ++ath11k_hal_rx_handle_ofdma_info(void *rx_tlv, ++ struct hal_rx_user_status *rx_user_status) ++{ ++ struct hal_rx_ppdu_end_user_stats *ppdu_end_user = ++ (struct hal_rx_ppdu_end_user_stats *)rx_tlv; ++ ++ rx_user_status->ul_ofdma_user_v0_word0 = __le32_to_cpu(ppdu_end_user->info6); ++ ++ rx_user_status->ul_ofdma_user_v0_word1 = __le32_to_cpu(ppdu_end_user->rsvd2[10]); ++} ++ ++static inline void ++ath11k_hal_rx_populate_byte_count(void *rx_tlv, void *ppduinfo, ++ struct hal_rx_user_status *rx_user_status) ++{ ++ struct hal_rx_ppdu_end_user_stats *ppdu_end_user = ++ (struct hal_rx_ppdu_end_user_stats *)rx_tlv; ++ ++ rx_user_status->mpdu_ok_byte_count = ++ FIELD_GET(HAL_RX_PPDU_END_USER_STATS_RSVD2_6_MPDU_OK_BYTE_COUNT, ++ __le32_to_cpu(ppdu_end_user->rsvd2[6])); ++ rx_user_status->mpdu_err_byte_count = ++ FIELD_GET(HAL_RX_PPDU_END_USER_STATS_RSVD2_8_MPDU_ERR_BYTE_COUNT, ++ __le32_to_cpu(ppdu_end_user->rsvd2[8])); ++} ++ ++static inline void ++ath11k_hal_rx_populate_mu_user_info(void *rx_tlv, struct hal_rx_mon_ppdu_info *ppdu_info, ++ struct hal_rx_user_status *rx_user_status) ++{ ++ rx_user_status->ast_index = ppdu_info->ast_index; ++ rx_user_status->tid = ppdu_info->tid; ++ rx_user_status->tcp_msdu_count = ++ ppdu_info->tcp_msdu_count; ++ rx_user_status->udp_msdu_count = ++ ppdu_info->udp_msdu_count; ++ rx_user_status->other_msdu_count = ++ ppdu_info->other_msdu_count; ++ rx_user_status->frame_control = ppdu_info->frame_control; ++ rx_user_status->frame_control_info_valid = ++ ppdu_info->frame_control_info_valid; ++ rx_user_status->data_sequence_control_info_valid = ++ ppdu_info->data_sequence_control_info_valid; ++ rx_user_status->first_data_seq_ctrl = ++ ppdu_info->first_data_seq_ctrl; ++ rx_user_status->preamble_type = ppdu_info->preamble_type; ++ rx_user_status->ht_flags = ppdu_info->ht_flags; ++ rx_user_status->vht_flags = ppdu_info->vht_flags; ++ rx_user_status->he_flags = ppdu_info->he_flags; ++ rx_user_status->rs_flags = ppdu_info->rs_flags; ++ ++ rx_user_status->mpdu_cnt_fcs_ok = ++ ppdu_info->num_mpdu_fcs_ok; ++ rx_user_status->mpdu_cnt_fcs_err = ++ ppdu_info->num_mpdu_fcs_err; ++ ++ ath11k_hal_rx_populate_byte_count(rx_tlv, ppdu_info, rx_user_status); ++} ++ + 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, +- u32 tlv_tag, u8 *tlv_data) ++ u32 tlv_tag, u8 *tlv_data, u32 userid) + { +- u32 info0, info1; ++ u32 info0, info1, value; ++ u8 he_dcm = 0, he_stbc = 0; ++ u16 he_gi = 0, he_ltf = 0; + + switch (tlv_tag) { + case HAL_RX_PPDU_START: { +@@ -829,6 +894,9 @@ ath11k_hal_rx_parse_mon_status_tlv(struc + info0 = __le32_to_cpu(eu_stats->info0); + info1 = __le32_to_cpu(eu_stats->info1); + ++ ppdu_info->ast_index = ++ FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO2_AST_INDEX, ++ __le32_to_cpu(eu_stats->info2)); + ppdu_info->tid = + ffs(FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO6_TID_BITMAP, + __le32_to_cpu(eu_stats->info6))) - 1; +@@ -852,6 +920,44 @@ ath11k_hal_rx_parse_mon_status_tlv(struc + ppdu_info->num_mpdu_fcs_err = + FIELD_GET(HAL_RX_PPDU_END_USER_STATS_INFO0_MPDU_CNT_FCS_ERR, + info0); ++ switch (ppdu_info->preamble_type) { ++ case HAL_RX_PREAMBLE_11N: ++ ppdu_info->ht_flags = 1; ++ break; ++ case HAL_RX_PREAMBLE_11AC: ++ ppdu_info->vht_flags = 1; ++ break; ++ case HAL_RX_PREAMBLE_11AX: ++ ppdu_info->he_flags = 1; ++ break; ++ default: ++ break; ++ } ++ ++ if (userid < HAL_MAX_UL_MU_USERS) { ++ struct hal_rx_user_status *rxuser_stats = ++ &ppdu_info->userstats; ++ ++ ath11k_hal_rx_handle_ofdma_info(tlv_data, rxuser_stats); ++ ath11k_hal_rx_populate_mu_user_info(tlv_data, ppdu_info, ++ rxuser_stats); ++ } ++ ppdu_info->userstats.mpdu_fcs_ok_bitmap[0] = ++ __le32_to_cpu(eu_stats->rsvd1[0]); ++ ppdu_info->userstats.mpdu_fcs_ok_bitmap[1] = ++ __le32_to_cpu(eu_stats->rsvd1[1]); ++ ++ break; ++ } ++ case HAL_RX_PPDU_END_USER_STATS_EXT: { ++ struct hal_rx_ppdu_end_user_stats_ext *eu_stats = ++ (struct hal_rx_ppdu_end_user_stats_ext *)tlv_data; ++ ppdu_info->userstats.mpdu_fcs_ok_bitmap[2] = eu_stats->info1; ++ ppdu_info->userstats.mpdu_fcs_ok_bitmap[3] = eu_stats->info2; ++ ppdu_info->userstats.mpdu_fcs_ok_bitmap[4] = eu_stats->info3; ++ ppdu_info->userstats.mpdu_fcs_ok_bitmap[5] = eu_stats->info4; ++ ppdu_info->userstats.mpdu_fcs_ok_bitmap[6] = eu_stats->info5; ++ ppdu_info->userstats.mpdu_fcs_ok_bitmap[7] = eu_stats->info6; + break; + } + case HAL_PHYRX_HT_SIG: { +@@ -950,50 +1056,151 @@ ath11k_hal_rx_parse_mon_status_tlv(struc + else + ppdu_info->reception_type = + HAL_RX_RECEPTION_TYPE_MU_MIMO; ++ ppdu_info->vht_flag_values5 = group_id; ++ ppdu_info->vht_flag_values3[0] = (((ppdu_info->mcs) << 4) | ++ ppdu_info->nss); ++ ppdu_info->vht_flag_values2 = ppdu_info->bw; ++ ppdu_info->vht_flag_values4 = ++ FIELD_GET(HAL_RX_VHT_SIG_A_INFO_INFO1_SU_MU_CODING, info1); + break; + } + case HAL_PHYRX_HE_SIG_A_SU: { + struct hal_rx_he_sig_a_su_info *he_sig_a = + (struct hal_rx_he_sig_a_su_info *)tlv_data; +- u32 nsts, cp_ltf, dcm; + ++ ppdu_info->he_flags = 1; + info0 = __le32_to_cpu(he_sig_a->info0); + info1 = __le32_to_cpu(he_sig_a->info1); + +- ppdu_info->mcs = +- FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_MCS, +- info0); +- ppdu_info->bw = +- FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_BW, +- info0); +- ppdu_info->ldpc = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_CODING, info0); +- ppdu_info->is_stbc = info1 & +- HAL_RX_HE_SIG_A_SU_INFO_INFO1_STBC; +- ppdu_info->beamformed = info1 & +- HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXBF; +- dcm = info0 & HAL_RX_HE_SIG_A_SU_INFO_INFO0_DCM; +- cp_ltf = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_CP_LTF_SIZE, +- info0); +- nsts = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_NSTS, info0); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_FORMAT_IND, info0); + +- switch (cp_ltf) { ++ if (value == 0) ++ ppdu_info->he_data1 = IEEE80211_RADIOTAP_HE_DATA1_FORMAT_TRIG; ++ else ++ ppdu_info->he_data1 = IEEE80211_RADIOTAP_HE_DATA1_FORMAT_SU; ++ ++ ppdu_info->he_data1 |= ++ IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_BEAM_CHANGE_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_UL_DL_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_DATA_DCM_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_CODING_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_STBC_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN; ++ ++ ppdu_info->he_data2 |= ++ IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_TXBF_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_PE_DISAMBIG_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_TXOP_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_MIDAMBLE_KNOWN; ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_BSS_COLOR, info0); ++ ppdu_info->he_data3 = ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_BSS_COLOR, value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_BEAM_CHANGE, info0); ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_BEAM_CHANGE, value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_DL_UL_FLAG, info0); ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_UL_DL, value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_MCS, info0); ++ ppdu_info->mcs = value; ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_DATA_MCS, value); ++ ++ he_dcm = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_DCM, info0); ++ ppdu_info->dcm = he_dcm; ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_DATA_DCM, he_dcm); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_CODING, info1); ++ ppdu_info->ldpc = (value == HAL_RX_SU_MU_CODING_LDPC) ? 1 : 0; ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_CODING, value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_LDPC_EXTRA, info1); ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG, value); ++ he_stbc = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_STBC, info1); ++ ppdu_info->is_stbc = he_stbc; ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_STBC, he_stbc); ++ ++ /* data4 */ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_SPATIAL_REUSE, info0); ++ ppdu_info->he_data4 = ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE, value); ++ ++ /* data5 */ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_TRANSMIT_BW, info0); ++ ppdu_info->bw = value; ++ ppdu_info->he_data5 = ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC, value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_CP_LTF_SIZE, info0); ++ switch (value) { + case 0: ++ he_gi = HE_GI_0_8; ++ he_ltf = HE_LTF_1_X; ++ break; + case 1: +- ppdu_info->gi = HAL_RX_GI_0_8_US; +- break; ++ he_gi = HE_GI_0_8; ++ he_ltf = HE_LTF_2_X; ++ break; + case 2: +- ppdu_info->gi = HAL_RX_GI_1_6_US; +- break; ++ he_gi = HE_GI_1_6; ++ he_ltf = HE_LTF_2_X; ++ break; + case 3: +- if (dcm && ppdu_info->is_stbc) +- ppdu_info->gi = HAL_RX_GI_0_8_US; +- else +- ppdu_info->gi = HAL_RX_GI_3_2_US; +- break; ++ if (he_dcm && he_stbc) { ++ he_gi = HE_GI_0_8; ++ he_ltf = HE_LTF_4_X; ++ } else { ++ he_gi = HE_GI_3_2; ++ he_ltf = HE_LTF_4_X; ++ } ++ break; + } ++ ppdu_info->gi = he_gi; ++ he_gi = (he_gi != 0) ? he_gi - 1 : 0; ++ ppdu_info->he_data5 |= FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_GI, he_gi); ++ ppdu_info->ltf_size = he_ltf; ++ ppdu_info->he_data5 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE, ++ (he_ltf == HE_LTF_4_X) ? he_ltf - 1 : he_ltf); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_NSTS, info0); ++ ppdu_info->he_data5 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_PKT_EXT_FACTOR, info1); ++ ppdu_info->he_data5 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXBF, info1); ++ ppdu_info->beamformed = value; ++ ppdu_info->he_data5 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_TXBF, value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_PKT_EXT_PE_DISAM, info1); ++ ppdu_info->he_data5 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_PE_DISAMBIG, value); ++ ++ /* data6 */ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO0_NSTS, info0); ++ value++; ++ ppdu_info->nss = value; ++ ppdu_info->he_data6 = ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA6_NSTS, value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_DOPPLER_IND, info1); ++ ppdu_info->he_data6 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA6_DOPPLER, value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_SU_INFO_INFO1_TXOP_DURATION, info1); ++ ppdu_info->he_data6 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA6_TXOP, value); + +- ppdu_info->nss = nsts + 1; +- ppdu_info->dcm = dcm; + ppdu_info->reception_type = HAL_RX_RECEPTION_TYPE_SU; + break; + } +@@ -1001,29 +1208,142 @@ ath11k_hal_rx_parse_mon_status_tlv(struc + struct hal_rx_he_sig_a_mu_dl_info *he_sig_a_mu_dl = + (struct hal_rx_he_sig_a_mu_dl_info *)tlv_data; + +- u32 cp_ltf; +- + info0 = __le32_to_cpu(he_sig_a_mu_dl->info0); + info1 = __le32_to_cpu(he_sig_a_mu_dl->info1); + +- ppdu_info->bw = +- FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_TRANSMIT_BW, +- info0); +- cp_ltf = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_CP_LTF_SIZE, +- info0); ++ ppdu_info->he_mu_flags = 1; + +- switch (cp_ltf) { ++ ppdu_info->he_data1 = IEEE80211_RADIOTAP_HE_DATA1_FORMAT_MU; ++ ppdu_info->he_data1 |= ++ IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_UL_DL_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_STBC_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN; ++ ++ ppdu_info->he_data2 = ++ IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_PE_DISAMBIG_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_TXOP_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA2_MIDAMBLE_KNOWN; ++ ++ /*data3*/ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_BSS_COLOR, info0); ++ ppdu_info->he_data3 = ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_BSS_COLOR, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_UL_FLAG, info0); ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_UL_DL, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_LDPC_EXTRA, info1); ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_STBC, info1); ++ he_stbc = value; ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_STBC, value); ++ ++ /*data4*/ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_SPATIAL_REUSE, info0); ++ ppdu_info->he_data4 = ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE, value); ++ ++ /*data5*/ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_TRANSMIT_BW, info0); ++ ppdu_info->bw = value; ++ ppdu_info->he_data5 = ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_CP_LTF_SIZE, info0); ++ switch (value) { + case 0: ++ he_gi = HE_GI_0_8; ++ he_ltf = HE_LTF_4_X; ++ break; + case 1: +- ppdu_info->gi = HAL_RX_GI_0_8_US; ++ he_gi = HE_GI_0_8; ++ he_ltf = HE_LTF_2_X; + break; + case 2: +- ppdu_info->gi = HAL_RX_GI_1_6_US; ++ he_gi = HE_GI_1_6; ++ he_ltf = HE_LTF_2_X; + break; + case 3: +- ppdu_info->gi = HAL_RX_GI_3_2_US; ++ he_gi = HE_GI_3_2; ++ he_ltf = HE_LTF_4_X; + break; + } ++ ppdu_info->gi = he_gi; ++ he_gi = (he_gi != 0) ? he_gi - 1 : 0; ++ ppdu_info->he_data5 |= FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_GI, he_gi); ++ ppdu_info->ltf_size = he_ltf; ++ ppdu_info->he_data5 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE, ++ (he_ltf == HE_LTF_4_X) ? he_ltf - 1 : he_ltf); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_NUM_LTF_SYMB, info1); ++ ppdu_info->he_data5 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_PKT_EXT_FACTOR, ++ info1); ++ ppdu_info->he_data5 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_PKT_EXT_PE_DISAM, ++ info1); ++ ppdu_info->he_data5 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA5_PE_DISAMBIG, value); ++ ++ /*data6*/ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_DOPPLER_INDICATION, ++ info0); ++ ppdu_info->he_data6 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA6_DOPPLER, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_TXOP_DURATION, info1); ++ ppdu_info->he_data6 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA6_TXOP, value); ++ ++ /* HE-MU Flags */ ++ /* HE-MU-flags1 */ ++ ppdu_info->he_flags1 = ++ IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS_KNOWN | ++ IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM_KNOWN | ++ IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_COMP_KNOWN | ++ IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_SYMS_USERS_KNOWN | ++ IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_RU_KNOWN; ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_MCS_OF_SIGB, info0); ++ ppdu_info->he_flags1 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS_KNOWN, ++ value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_DCM_OF_SIGB, info0); ++ ppdu_info->he_flags1 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM_KNOWN, ++ value); ++ ++ /* HE-MU-flags2 */ ++ ppdu_info->he_flags2 = ++ IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN; ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_TRANSMIT_BW, info0); ++ ppdu_info->he_flags2 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW, ++ value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_COMP_MODE_SIGB, info0); ++ ppdu_info->he_flags2 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_COMP, value); ++ value = FIELD_GET(HAL_RX_HE_SIG_A_MU_DL_INFO_INFO0_NUM_SIGB_SYMB, info0); ++ value = value - 1; ++ ppdu_info->he_flags2 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_SYMS_USERS, ++ value); + + ppdu_info->is_stbc = info1 & + HAL_RX_HE_SIG_A_MU_DL_INFO_INFO1_STBC; +@@ -1041,7 +1361,7 @@ ath11k_hal_rx_parse_mon_status_tlv(struc + info0); + ppdu_info->ru_alloc = + ath11k_mac_phy_he_ru_to_nl80211_he_ru_alloc(ru_tones); +- ++ ppdu_info->he_RU[0] = ru_tones; + ppdu_info->reception_type = HAL_RX_RECEPTION_TYPE_MU_MIMO; + break; + } +@@ -1051,14 +1371,25 @@ ath11k_hal_rx_parse_mon_status_tlv(struc + + info0 = __le32_to_cpu(he_sig_b2_mu->info0); + ++ ppdu_info->he_data1 |= IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_CODING_KNOWN; ++ + ppdu_info->mcs = +- FIELD_GET(HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_MCS, +- info0); ++ FIELD_GET(HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_MCS, info0); ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_DATA_MCS, ppdu_info->mcs); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_CODING, info0); ++ ppdu_info->ldpc = value; ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_CODING, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_ID, info0); ++ ppdu_info->he_data4 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA4_MU_STA_ID, value); ++ + ppdu_info->nss = +- FIELD_GET(HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_NSTS, +- info0) + 1; +- ppdu_info->ldpc = FIELD_GET(HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_CODING, +- info0); ++ FIELD_GET(HAL_RX_HE_SIG_B2_MU_INFO_INFO0_STA_NSTS, info0) + 1; + break; + } + case HAL_PHYRX_HE_SIG_B2_OFDMA: { +@@ -1067,17 +1398,40 @@ ath11k_hal_rx_parse_mon_status_tlv(struc + + info0 = __le32_to_cpu(he_sig_b2_ofdma->info0); + ++ ppdu_info->he_data1 |= ++ IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_DATA_DCM_KNOWN | ++ IEEE80211_RADIOTAP_HE_DATA1_CODING_KNOWN; ++ ++ /* HE-data2 */ ++ ppdu_info->he_data2 |= IEEE80211_RADIOTAP_HE_DATA2_TXBF_KNOWN; ++ + ppdu_info->mcs = + FIELD_GET(HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_MCS, + info0); ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_DATA_MCS, ppdu_info->mcs); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_DCM, info0); ++ he_dcm = value; ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_DATA_DCM, value); ++ ++ value = FIELD_GET(HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_CODING, info0); ++ ppdu_info->ldpc = value; ++ ppdu_info->he_data3 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA3_CODING, value); ++ ++ /* HE-data4 */ ++ value = FIELD_GET(HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_ID, info0); ++ ppdu_info->he_data4 |= ++ FIELD_PREP(IEEE80211_RADIOTAP_HE_DATA4_MU_STA_ID, value); ++ + ppdu_info->nss = + FIELD_GET(HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_NSTS, + info0) + 1; + ppdu_info->beamformed = +- info0 & +- HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_TXBF; +- ppdu_info->ldpc = FIELD_GET(HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_CODING, +- info0); ++ info0 & HAL_RX_HE_SIG_B2_OFDMA_INFO_INFO0_STA_TXBF; + ppdu_info->reception_type = HAL_RX_RECEPTION_TYPE_MU_OFDMA; + break; + } +@@ -1119,6 +1473,9 @@ ath11k_hal_rx_parse_mon_status_tlv(struc + ppdu_info->rx_duration = + FIELD_GET(HAL_RX_PPDU_END_DURATION, + __le32_to_cpu(ppdu_rx_duration->info0)); ++ ppdu_info->tsft = __le32_to_cpu(ppdu_rx_duration->rsvd0[1]); ++ ppdu_info->tsft = (ppdu_info->tsft << 32) | ++ __le32_to_cpu(ppdu_rx_duration->rsvd0[0]); + break; + } + case HAL_DUMMY: +@@ -1142,12 +1499,14 @@ ath11k_hal_rx_parse_mon_status(struct at + enum hal_rx_mon_status hal_status = HAL_RX_MON_STATUS_BUF_DONE; + u16 tlv_tag; + u16 tlv_len; ++ u32 tlv_userid = 0; + u8 *ptr = skb->data; + + do { + tlv = (struct hal_tlv_hdr *)ptr; + tlv_tag = FIELD_GET(HAL_TLV_HDR_TAG, tlv->tl); + tlv_len = FIELD_GET(HAL_TLV_HDR_LEN, tlv->tl); ++ tlv_userid = FIELD_GET(HAL_TLV_USR_ID, tlv->tl); + ptr += sizeof(*tlv); + + /* The actual length of PPDU_END is the combined length of many PHY +@@ -1159,7 +1518,7 @@ ath11k_hal_rx_parse_mon_status(struct at + tlv_len = sizeof(struct hal_rx_rxpcu_classification_overview); + + hal_status = ath11k_hal_rx_parse_mon_status_tlv(ab, ppdu_info, +- tlv_tag, ptr); ++ tlv_tag, ptr, tlv_userid); + ptr += tlv_len; + ptr = PTR_ALIGN(ptr, HAL_TLV_ALIGN); + diff --git a/package/kernel/mac80211/patches/ath11k/0191-ath11k-add-dbring-debug-support.patch b/package/kernel/mac80211/patches/ath11k/0191-ath11k-add-dbring-debug-support.patch new file mode 100644 index 000000000..bcece4c98 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0191-ath11k-add-dbring-debug-support.patch @@ -0,0 +1,509 @@ +From 691425b4a41fe5843ea424a93ee373f29b1040a5 Mon Sep 17 00:00:00 2001 +From: Venkateswara Naralasetty +Date: Sun, 20 Feb 2022 19:37:39 +0530 +Subject: [PATCH] ath11k: add dbring debug support + +Target copies spectral report and CFR report through dbring to +host for further processing. This mechanism involves ring and +buffer management in the Host, FW, and uCode, where improper +tail pointer update issues are seen. + +This dbring debug support help to debug such issues by tracking +head and tail pointer movement along with the timestamp at which +each buffer is received and replenished. + +Provide a debugfs interface to enalbe/disable dbring debug +support and dump the dbring debug entries. + +Also introduced a new hardware param to add dbring debugfs support +for few hardwares which are using dbings. + +Usage: + +echo > /sys/kernel/debug/ath11k/ipq8074_2/ +mac0/enable_dbr_debug + +dbr_id: 0 for spectral and 1 for CFR +val: 0 - disable, 1 - enable. + +Tested-on: IPQ8074 WLAN.HK.2.4.0.1-01467-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Venkateswara Naralasetty +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1645366059-11798-1-git-send-email-quic_vnaralas@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 6 + + drivers/net/wireless/ath/ath11k/core.h | 1 + + drivers/net/wireless/ath/ath11k/dbring.c | 19 +- + drivers/net/wireless/ath/ath11k/debugfs.c | 221 ++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/debugfs.h | 41 ++++ + drivers/net/wireless/ath/ath11k/hw.h | 1 + + 6 files changed, 283 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -99,6 +99,7 @@ static const struct ath11k_hw_params ath + .supports_rssi_stats = false, + .fw_wmi_diag_event = false, + .current_cc_support = false, ++ .dbr_debug_support = true, + }, + { + .hw_rev = ATH11K_HW_IPQ6018_HW10, +@@ -164,6 +165,7 @@ static const struct ath11k_hw_params ath + .supports_rssi_stats = false, + .fw_wmi_diag_event = false, + .current_cc_support = false, ++ .dbr_debug_support = true, + }, + { + .name = "qca6390 hw2.0", +@@ -228,6 +230,7 @@ static const struct ath11k_hw_params ath + .supports_rssi_stats = true, + .fw_wmi_diag_event = true, + .current_cc_support = true, ++ .dbr_debug_support = false, + }, + { + .name = "qcn9074 hw1.0", +@@ -292,6 +295,7 @@ static const struct ath11k_hw_params ath + .supports_rssi_stats = false, + .fw_wmi_diag_event = false, + .current_cc_support = false, ++ .dbr_debug_support = true, + }, + { + .name = "wcn6855 hw2.0", +@@ -356,6 +360,7 @@ static const struct ath11k_hw_params ath + .supports_rssi_stats = true, + .fw_wmi_diag_event = true, + .current_cc_support = true, ++ .dbr_debug_support = false, + }, + { + .name = "wcn6855 hw2.1", +@@ -419,6 +424,7 @@ static const struct ath11k_hw_params ath + .supports_rssi_stats = true, + .fw_wmi_diag_event = true, + .current_cc_support = true, ++ .dbr_debug_support = false, + }, + }; + +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -461,6 +461,7 @@ struct ath11k_debug { + u32 rx_filter; + u32 mem_offset; + u32 module_id_bitmap[MAX_MODULE_ID_BITMAP_WORDS]; ++ struct ath11k_debug_dbr *dbr_debug[WMI_DIRECT_BUF_MAX]; + }; + + struct ath11k_per_peer_tx_stats { +--- a/drivers/net/wireless/ath/ath11k/dbring.c ++++ b/drivers/net/wireless/ath/ath11k/dbring.c +@@ -37,7 +37,8 @@ static void ath11k_dbring_fill_magic_val + + static int ath11k_dbring_bufs_replenish(struct ath11k *ar, + struct ath11k_dbring *ring, +- struct ath11k_dbring_element *buff) ++ struct ath11k_dbring_element *buff, ++ enum wmi_direct_buffer_module id) + { + struct ath11k_base *ab = ar->ab; + struct hal_srng *srng; +@@ -84,6 +85,7 @@ static int ath11k_dbring_bufs_replenish( + + ath11k_hal_rx_buf_addr_info_set(desc, paddr, cookie, 0); + ++ ath11k_debugfs_add_dbring_entry(ar, id, ATH11K_DBG_DBR_EVENT_REPLENISH, srng); + ath11k_hal_srng_access_end(ab, srng); + + return 0; +@@ -101,7 +103,8 @@ err: + } + + static int ath11k_dbring_fill_bufs(struct ath11k *ar, +- struct ath11k_dbring *ring) ++ struct ath11k_dbring *ring, ++ enum wmi_direct_buffer_module id) + { + struct ath11k_dbring_element *buff; + struct hal_srng *srng; +@@ -129,7 +132,7 @@ static int ath11k_dbring_fill_bufs(struc + kfree(buff); + break; + } +- ret = ath11k_dbring_bufs_replenish(ar, ring, buff); ++ ret = ath11k_dbring_bufs_replenish(ar, ring, buff, id); + if (ret) { + ath11k_warn(ar->ab, "failed to replenish db ring num_remain %d req_ent %d\n", + num_remain, req_entries); +@@ -210,7 +213,7 @@ int ath11k_dbring_buf_setup(struct ath11 + ring->hp_addr = ath11k_hal_srng_get_hp_addr(ar->ab, srng); + ring->tp_addr = ath11k_hal_srng_get_tp_addr(ar->ab, srng); + +- ret = ath11k_dbring_fill_bufs(ar, ring); ++ ret = ath11k_dbring_fill_bufs(ar, ring, db_cap->id); + + return ret; + } +@@ -270,7 +273,7 @@ int ath11k_dbring_buffer_release_event(s + struct ath11k_buffer_addr desc; + u8 *vaddr_unalign; + u32 num_entry, num_buff_reaped; +- u8 pdev_idx, rbm; ++ u8 pdev_idx, rbm, module_id; + u32 cookie; + int buf_id; + int size; +@@ -278,6 +281,7 @@ int ath11k_dbring_buffer_release_event(s + int ret = 0; + + pdev_idx = ev->fixed.pdev_id; ++ module_id = ev->fixed.module_id; + + if (pdev_idx >= ab->num_radios) { + ath11k_warn(ab, "Invalid pdev id %d\n", pdev_idx); +@@ -346,6 +350,9 @@ int ath11k_dbring_buffer_release_event(s + dma_unmap_single(ab->dev, buff->paddr, ring->buf_sz, + DMA_FROM_DEVICE); + ++ ath11k_debugfs_add_dbring_entry(ar, module_id, ++ ATH11K_DBG_DBR_EVENT_RX, srng); ++ + if (ring->handler) { + vaddr_unalign = buff->payload; + handler_data.data = PTR_ALIGN(vaddr_unalign, +@@ -357,7 +364,7 @@ int ath11k_dbring_buffer_release_event(s + + buff->paddr = 0; + memset(buff->payload, 0, size); +- ath11k_dbring_bufs_replenish(ar, ring, buff); ++ ath11k_dbring_bufs_replenish(ar, ring, buff, module_id); + } + + spin_unlock_bh(&srng->lock); +--- a/drivers/net/wireless/ath/ath11k/debugfs.c ++++ b/drivers/net/wireless/ath/ath11k/debugfs.c +@@ -52,6 +52,45 @@ static const char *htt_bp_lmac_ring[HTT_ + "MONITOR_DEST_RING", + }; + ++void ath11k_debugfs_add_dbring_entry(struct ath11k *ar, ++ enum wmi_direct_buffer_module id, ++ enum ath11k_dbg_dbr_event event, ++ struct hal_srng *srng) ++{ ++ struct ath11k_debug_dbr *dbr_debug; ++ struct ath11k_dbg_dbr_data *dbr_data; ++ struct ath11k_dbg_dbr_entry *entry; ++ ++ if (id >= WMI_DIRECT_BUF_MAX || event >= ATH11K_DBG_DBR_EVENT_MAX) ++ return; ++ ++ dbr_debug = ar->debug.dbr_debug[id]; ++ if (!dbr_debug) ++ return; ++ ++ if (!dbr_debug->dbr_debug_enabled) ++ return; ++ ++ dbr_data = &dbr_debug->dbr_dbg_data; ++ ++ spin_lock_bh(&dbr_data->lock); ++ ++ if (dbr_data->entries) { ++ entry = &dbr_data->entries[dbr_data->dbr_debug_idx]; ++ entry->hp = srng->u.src_ring.hp; ++ entry->tp = *srng->u.src_ring.tp_addr; ++ entry->timestamp = jiffies; ++ entry->event = event; ++ ++ dbr_data->dbr_debug_idx++; ++ if (dbr_data->dbr_debug_idx == ++ dbr_data->num_ring_debug_entries) ++ dbr_data->dbr_debug_idx = 0; ++ } ++ ++ spin_unlock_bh(&dbr_data->lock); ++} ++ + static void ath11k_fw_stats_pdevs_free(struct list_head *head) + { + struct ath11k_fw_stats_pdev *i, *tmp; +@@ -1176,6 +1215,169 @@ static const struct file_operations fops + .open = simple_open + }; + ++static ssize_t ath11k_debug_dump_dbr_entries(struct file *file, ++ char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath11k_dbg_dbr_data *dbr_dbg_data = file->private_data; ++ static const char * const event_id_to_string[] = {"empty", "Rx", "Replenish"}; ++ int size = ATH11K_DEBUG_DBR_ENTRIES_MAX * 100; ++ char *buf; ++ int i, ret; ++ int len = 0; ++ ++ buf = kzalloc(size, GFP_KERNEL); ++ if (!buf) ++ return -ENOMEM; ++ ++ len += scnprintf(buf + len, size - len, ++ "-----------------------------------------\n"); ++ len += scnprintf(buf + len, size - len, ++ "| idx | hp | tp | timestamp | event |\n"); ++ len += scnprintf(buf + len, size - len, ++ "-----------------------------------------\n"); ++ ++ spin_lock_bh(&dbr_dbg_data->lock); ++ ++ for (i = 0; i < dbr_dbg_data->num_ring_debug_entries; i++) { ++ len += scnprintf(buf + len, size - len, ++ "|%4u|%8u|%8u|%11llu|%8s|\n", i, ++ dbr_dbg_data->entries[i].hp, ++ dbr_dbg_data->entries[i].tp, ++ dbr_dbg_data->entries[i].timestamp, ++ event_id_to_string[dbr_dbg_data->entries[i].event]); ++ } ++ ++ spin_unlock_bh(&dbr_dbg_data->lock); ++ ++ ret = simple_read_from_buffer(user_buf, count, ppos, buf, len); ++ kfree(buf); ++ ++ return ret; ++} ++ ++static const struct file_operations fops_debug_dump_dbr_entries = { ++ .read = ath11k_debug_dump_dbr_entries, ++ .open = simple_open, ++ .owner = THIS_MODULE, ++ .llseek = default_llseek, ++}; ++ ++static void ath11k_debugfs_dbr_dbg_destroy(struct ath11k *ar, int dbr_id) ++{ ++ struct ath11k_debug_dbr *dbr_debug; ++ struct ath11k_dbg_dbr_data *dbr_dbg_data; ++ ++ if (!ar->debug.dbr_debug[dbr_id]) ++ return; ++ ++ dbr_debug = ar->debug.dbr_debug[dbr_id]; ++ dbr_dbg_data = &dbr_debug->dbr_dbg_data; ++ ++ debugfs_remove_recursive(dbr_debug->dbr_debugfs); ++ kfree(dbr_dbg_data->entries); ++ kfree(dbr_debug); ++ ar->debug.dbr_debug[dbr_id] = NULL; ++} ++ ++static int ath11k_debugfs_dbr_dbg_init(struct ath11k *ar, int dbr_id) ++{ ++ struct ath11k_debug_dbr *dbr_debug; ++ struct ath11k_dbg_dbr_data *dbr_dbg_data; ++ static const char * const dbr_id_to_str[] = {"spectral", "CFR"}; ++ ++ if (ar->debug.dbr_debug[dbr_id]) ++ return 0; ++ ++ ar->debug.dbr_debug[dbr_id] = kzalloc(sizeof(*dbr_debug), ++ GFP_KERNEL); ++ ++ if (!ar->debug.dbr_debug[dbr_id]) ++ return -ENOMEM; ++ ++ dbr_debug = ar->debug.dbr_debug[dbr_id]; ++ dbr_dbg_data = &dbr_debug->dbr_dbg_data; ++ ++ if (dbr_debug->dbr_debugfs) ++ return 0; ++ ++ dbr_debug->dbr_debugfs = debugfs_create_dir(dbr_id_to_str[dbr_id], ++ ar->debug.debugfs_pdev); ++ if (IS_ERR_OR_NULL(dbr_debug->dbr_debugfs)) { ++ if (IS_ERR(dbr_debug->dbr_debugfs)) ++ return PTR_ERR(dbr_debug->dbr_debugfs); ++ return -ENOMEM; ++ } ++ ++ dbr_debug->dbr_debug_enabled = true; ++ dbr_dbg_data->num_ring_debug_entries = ATH11K_DEBUG_DBR_ENTRIES_MAX; ++ dbr_dbg_data->dbr_debug_idx = 0; ++ dbr_dbg_data->entries = kcalloc(ATH11K_DEBUG_DBR_ENTRIES_MAX, ++ sizeof(struct ath11k_dbg_dbr_entry), ++ GFP_KERNEL); ++ if (!dbr_dbg_data->entries) ++ return -ENOMEM; ++ ++ spin_lock_init(&dbr_dbg_data->lock); ++ ++ debugfs_create_file("dump_dbr_debug", 0444, dbr_debug->dbr_debugfs, ++ dbr_dbg_data, &fops_debug_dump_dbr_entries); ++ ++ return 0; ++} ++ ++static ssize_t ath11k_debugfs_write_enable_dbr_dbg(struct file *file, ++ const char __user *ubuf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath11k *ar = file->private_data; ++ char buf[32] = {0}; ++ u32 dbr_id, enable; ++ int ret; ++ ++ mutex_lock(&ar->conf_mutex); ++ ++ if (ar->state != ATH11K_STATE_ON) { ++ ret = -ENETDOWN; ++ goto out; ++ } ++ ++ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count); ++ if (ret < 0) ++ goto out; ++ ++ buf[ret] = '\0'; ++ ret = sscanf(buf, "%u %u", &dbr_id, &enable); ++ if (ret != 2 || dbr_id > 1 || enable > 1) { ++ ret = -EINVAL; ++ ath11k_warn(ar->ab, "usage: echo dbr_id:0-Spectral 1-CFR val:0-disable 1-enable\n"); ++ goto out; ++ } ++ ++ if (enable) { ++ ret = ath11k_debugfs_dbr_dbg_init(ar, dbr_id); ++ if (ret) { ++ ath11k_warn(ar->ab, "db ring module debugfs init failed: %d\n", ++ ret); ++ goto out; ++ } ++ } else { ++ ath11k_debugfs_dbr_dbg_destroy(ar, dbr_id); ++ } ++ ++ ret = count; ++out: ++ mutex_unlock(&ar->conf_mutex); ++ return ret; ++} ++ ++static const struct file_operations fops_dbr_debug = { ++ .write = ath11k_debugfs_write_enable_dbr_dbg, ++ .open = simple_open, ++ .owner = THIS_MODULE, ++ .llseek = default_llseek, ++}; ++ + int ath11k_debugfs_register(struct ath11k *ar) + { + struct ath11k_base *ab = ar->ab; +@@ -1218,11 +1420,30 @@ int ath11k_debugfs_register(struct ath11 + &ar->dfs_block_radar_events); + } + ++ if (ab->hw_params.dbr_debug_support) ++ debugfs_create_file("enable_dbr_debug", 0200, ar->debug.debugfs_pdev, ++ ar, &fops_dbr_debug); ++ + return 0; + } + + void ath11k_debugfs_unregister(struct ath11k *ar) + { ++ struct ath11k_debug_dbr *dbr_debug; ++ struct ath11k_dbg_dbr_data *dbr_dbg_data; ++ int i; ++ ++ for (i = 0; i < WMI_DIRECT_BUF_MAX; i++) { ++ dbr_debug = ar->debug.dbr_debug[i]; ++ if (!dbr_debug) ++ continue; ++ ++ dbr_dbg_data = &dbr_debug->dbr_dbg_data; ++ kfree(dbr_dbg_data->entries); ++ debugfs_remove_recursive(dbr_debug->dbr_debugfs); ++ kfree(dbr_debug); ++ ar->debug.dbr_debug[i] = NULL; ++ } + } + + static ssize_t ath11k_write_twt_add_dialog(struct file *file, +--- a/drivers/net/wireless/ath/ath11k/debugfs.h ++++ b/drivers/net/wireless/ath/ath11k/debugfs.h +@@ -47,6 +47,36 @@ enum ath11k_dbg_htt_ext_stats_type { + ATH11K_DBG_HTT_NUM_EXT_STATS, + }; + ++#define ATH11K_DEBUG_DBR_ENTRIES_MAX 512 ++ ++enum ath11k_dbg_dbr_event { ++ ATH11K_DBG_DBR_EVENT_INVALID, ++ ATH11K_DBG_DBR_EVENT_RX, ++ ATH11K_DBG_DBR_EVENT_REPLENISH, ++ ATH11K_DBG_DBR_EVENT_MAX, ++}; ++ ++struct ath11k_dbg_dbr_entry { ++ u32 hp; ++ u32 tp; ++ u64 timestamp; ++ enum ath11k_dbg_dbr_event event; ++}; ++ ++struct ath11k_dbg_dbr_data { ++ /* protects ath11k_db_ring_debug data */ ++ spinlock_t lock; ++ struct ath11k_dbg_dbr_entry *entries; ++ u32 dbr_debug_idx; ++ u32 num_ring_debug_entries; ++}; ++ ++struct ath11k_debug_dbr { ++ struct ath11k_dbg_dbr_data dbr_dbg_data; ++ struct dentry *dbr_debugfs; ++ bool dbr_debug_enabled; ++}; ++ + struct debug_htt_stats_req { + bool done; + u8 pdev_id; +@@ -278,6 +308,10 @@ static inline int ath11k_debugfs_rx_filt + + int ath11k_debugfs_add_interface(struct ath11k_vif *arvif); + void ath11k_debugfs_remove_interface(struct ath11k_vif *arvif); ++void ath11k_debugfs_add_dbring_entry(struct ath11k *ar, ++ enum wmi_direct_buffer_module id, ++ enum ath11k_dbg_dbr_event event, ++ struct hal_srng *srng); + + #else + static inline int ath11k_debugfs_soc_create(struct ath11k_base *ab) +@@ -361,6 +395,13 @@ static inline void ath11k_debugfs_remove + { + } + ++static inline void ++ath11k_debugfs_add_dbring_entry(struct ath11k *ar, ++ enum wmi_direct_buffer_module id, ++ enum ath11k_dbg_dbr_event event, ++ struct hal_srng *srng) ++{ ++} + #endif /* CPTCFG_ATH11K_DEBUGFS*/ + + #endif /* _ATH11K_DEBUGFS_H_ */ +--- a/drivers/net/wireless/ath/ath11k/hw.h ++++ b/drivers/net/wireless/ath/ath11k/hw.h +@@ -193,6 +193,7 @@ struct ath11k_hw_params { + bool supports_rssi_stats; + bool fw_wmi_diag_event; + bool current_cc_support; ++ bool dbr_debug_support; + }; + + struct ath11k_hw_ops { diff --git a/package/kernel/mac80211/patches/ath11k/0192-ath11k-remove-unneeded-flush_workqueue.patch b/package/kernel/mac80211/patches/ath11k/0192-ath11k-remove-unneeded-flush_workqueue.patch new file mode 100644 index 000000000..d5623f722 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0192-ath11k-remove-unneeded-flush_workqueue.patch @@ -0,0 +1,26 @@ +From 57fe207f752a95e1929e242dfdb21c6dac741e0d Mon Sep 17 00:00:00 2001 +From: "Lv Ruyi (CGEL ZTE)" +Date: Tue, 1 Mar 2022 01:32:46 +0000 +Subject: [PATCH] ath11k: remove unneeded flush_workqueue + +All work currently pending will be done first by calling destroy_workqueue, +so there is no need to flush it explicitly. + +Reported-by: Zeal Robot +Signed-off-by: Lv Ruyi (CGEL ZTE) +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220301013246.2052570-1-lv.ruyi@zte.com.cn +--- + drivers/net/wireless/ath/ath11k/core.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -1417,7 +1417,6 @@ EXPORT_SYMBOL(ath11k_core_deinit); + + void ath11k_core_free(struct ath11k_base *ab) + { +- flush_workqueue(ab->workqueue); + destroy_workqueue(ab->workqueue); + + kfree(ab); diff --git a/package/kernel/mac80211/patches/ath11k/0193-ath11k-Add-basic-WoW-functionalities.patch b/package/kernel/mac80211/patches/ath11k/0193-ath11k-Add-basic-WoW-functionalities.patch new file mode 100644 index 000000000..7185b0cf7 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0193-ath11k-Add-basic-WoW-functionalities.patch @@ -0,0 +1,1021 @@ +From ba9177fcef21fa98406e73c472b5ac2eb4ec5f31 Mon Sep 17 00:00:00 2001 +From: Carl Huang +Date: Mon, 14 Mar 2022 07:18:15 +0200 +Subject: [PATCH] ath11k: Add basic WoW functionalities + +Implement basic WoW functionalities such as magic-packet, disconnect +and pattern. The logic is very similar to ath10k. + +When WoW is configured, ath11k_core_suspend and ath11k_core_resume +are skipped as WoW configuration and hif suspend/resume are done in +ath11k_wow_op_suspend() and ath11k_wow_op_resume(). + +Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 + +Signed-off-by: Carl Huang +Signed-off-by: Baochen Qiang +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1644308006-22784-2-git-send-email-quic_cjhuang@quicinc.com +--- + drivers/net/wireless/ath/ath11k/Makefile | 4 +- + drivers/net/wireless/ath/ath11k/core.c | 33 ++ + drivers/net/wireless/ath/ath11k/core.h | 4 + + drivers/net/wireless/ath/ath11k/htc.c | 6 + + drivers/net/wireless/ath/ath11k/mac.c | 59 +++- + drivers/net/wireless/ath/ath11k/mac.h | 1 + + drivers/net/wireless/ath/ath11k/wmi.c | 158 +++++++++ + drivers/net/wireless/ath/ath11k/wmi.h | 76 ++++- + drivers/net/wireless/ath/ath11k/wow.c | 414 +++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/wow.h | 45 +++ + 10 files changed, 781 insertions(+), 19 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/Makefile ++++ b/drivers/net/wireless/ath/ath11k/Makefile +@@ -16,14 +16,14 @@ ath11k-y += core.o \ + ce.o \ + peer.o \ + dbring.o \ +- hw.o \ +- wow.o ++ hw.o + + ath11k-$(CPTCFG_ATH11K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o + ath11k-$(CPTCFG_NL80211_TESTMODE) += testmode.o + ath11k-$(CPTCFG_ATH11K_TRACING) += trace.o + ath11k-$(CONFIG_THERMAL) += thermal.o + ath11k-$(CPTCFG_ATH11K_SPECTRAL) += spectral.o ++ath11k-$(CONFIG_PM) += wow.o + + obj-$(CPTCFG_ATH11K_AHB) += ath11k_ahb.o + ath11k_ahb-y += ahb.o +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -428,13 +428,30 @@ static const struct ath11k_hw_params ath + }, + }; + ++static inline struct ath11k_pdev *ath11k_core_get_single_pdev(struct ath11k_base *ab) ++{ ++ WARN_ON(!ab->hw_params.single_pdev_only); ++ ++ return &ab->pdevs[0]; ++} ++ + int ath11k_core_suspend(struct ath11k_base *ab) + { + int ret; ++ struct ath11k_pdev *pdev; ++ struct ath11k *ar; + + if (!ab->hw_params.supports_suspend) + return -EOPNOTSUPP; + ++ /* so far single_pdev_only chips have supports_suspend as true ++ * and only the first pdev is valid. ++ */ ++ pdev = ath11k_core_get_single_pdev(ab); ++ ar = pdev->ar; ++ if (!ar || ar->state != ATH11K_STATE_OFF) ++ return 0; ++ + /* TODO: there can frames in queues so for now add delay as a hack. + * Need to implement to handle and remove this delay. + */ +@@ -447,6 +464,12 @@ int ath11k_core_suspend(struct ath11k_ba + return ret; + } + ++ ret = ath11k_mac_wait_tx_complete(ar); ++ if (ret) { ++ ath11k_warn(ab, "failed to wait tx complete: %d\n", ret); ++ return ret; ++ } ++ + ret = ath11k_wow_enable(ab); + if (ret) { + ath11k_warn(ab, "failed to enable wow during suspend: %d\n", ret); +@@ -479,10 +502,20 @@ EXPORT_SYMBOL(ath11k_core_suspend); + int ath11k_core_resume(struct ath11k_base *ab) + { + int ret; ++ struct ath11k_pdev *pdev; ++ struct ath11k *ar; + + if (!ab->hw_params.supports_suspend) + return -EOPNOTSUPP; + ++ /* so far signle_pdev_only chips have supports_suspend as true ++ * and only the first pdev is valid. ++ */ ++ pdev = ath11k_core_get_single_pdev(ab); ++ ar = pdev->ar; ++ if (!ar || ar->state != ATH11K_STATE_OFF) ++ return 0; ++ + ret = ath11k_hif_resume(ab); + if (ret) { + ath11k_warn(ab, "failed to resume hif during resume: %d\n", ret); +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -23,6 +23,7 @@ + #include "thermal.h" + #include "dbring.h" + #include "spectral.h" ++#include "wow.h" + + #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK) + +@@ -590,6 +591,9 @@ struct ath11k { + struct work_struct wmi_mgmt_tx_work; + struct sk_buff_head wmi_mgmt_tx_queue; + ++ struct ath11k_wow wow; ++ struct completion target_suspend; ++ bool target_suspend_ack; + struct ath11k_per_peer_tx_stats peer_tx_stats; + struct list_head ppdu_stats_info; + u32 ppdu_stat_list_depth; +--- a/drivers/net/wireless/ath/ath11k/htc.c ++++ b/drivers/net/wireless/ath/ath11k/htc.c +@@ -272,6 +272,11 @@ void ath11k_htc_tx_completion_handler(st + ep_tx_complete(htc->ab, skb); + } + ++static void ath11k_htc_wakeup_from_suspend(struct ath11k_base *ab) ++{ ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot wakeup from suspend is received\n"); ++} ++ + void ath11k_htc_rx_completion_handler(struct ath11k_base *ab, + struct sk_buff *skb) + { +@@ -376,6 +381,7 @@ void ath11k_htc_rx_completion_handler(st + ath11k_htc_suspend_complete(ab, false); + break; + case ATH11K_HTC_MSG_WAKEUP_FROM_SUSPEND_ID: ++ ath11k_htc_wakeup_from_suspend(ab); + break; + default: + ath11k_warn(ab, "ignoring unsolicited htc ep0 event %ld\n", +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -16,6 +16,8 @@ + #include "testmode.h" + #include "peer.h" + #include "debugfs_sta.h" ++#include "hif.h" ++#include "wow.h" + + #define CHAN2G(_channel, _freq, _flags) { \ + .band = NL80211_BAND_2GHZ, \ +@@ -7258,31 +7260,47 @@ static int ath11k_mac_op_set_frag_thresh + return -EOPNOTSUPP; + } + +-static void ath11k_mac_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, +- u32 queues, bool drop) ++static int ath11k_mac_flush_tx_complete(struct ath11k *ar) + { +- struct ath11k *ar = hw->priv; + long time_left; +- +- if (drop) +- return; ++ int ret = 0; + + time_left = wait_event_timeout(ar->dp.tx_empty_waitq, + (atomic_read(&ar->dp.num_tx_pending) == 0), + ATH11K_FLUSH_TIMEOUT); +- if (time_left == 0) +- ath11k_warn(ar->ab, "failed to flush transmit queue %ld\n", time_left); ++ if (time_left == 0) { ++ ath11k_warn(ar->ab, "failed to flush transmit queue, data pkts pending %d\n", ++ atomic_read(&ar->dp.num_tx_pending)); ++ ret = -ETIMEDOUT; ++ } + + time_left = wait_event_timeout(ar->txmgmt_empty_waitq, + (atomic_read(&ar->num_pending_mgmt_tx) == 0), + ATH11K_FLUSH_TIMEOUT); +- if (time_left == 0) +- ath11k_warn(ar->ab, "failed to flush mgmt transmit queue %ld\n", +- time_left); ++ if (time_left == 0) { ++ ath11k_warn(ar->ab, "failed to flush mgmt transmit queue, mgmt pkts pending %d\n", ++ atomic_read(&ar->num_pending_mgmt_tx)); ++ ret = -ETIMEDOUT; ++ } + +- ath11k_dbg(ar->ab, ATH11K_DBG_MAC, +- "mac mgmt tx flush mgmt pending %d\n", +- atomic_read(&ar->num_pending_mgmt_tx)); ++ return ret; ++} ++ ++int ath11k_mac_wait_tx_complete(struct ath11k *ar) ++{ ++ ath11k_mac_drain_tx(ar); ++ return ath11k_mac_flush_tx_complete(ar); ++} ++ ++static void ath11k_mac_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ++ u32 queues, bool drop) ++{ ++ struct ath11k *ar = hw->priv; ++ ++ if (drop) ++ return; ++ ++ ath11k_mac_flush_tx_complete(ar); + } + + static int +@@ -8104,6 +8122,13 @@ static const struct ieee80211_ops ath11k + .flush = ath11k_mac_op_flush, + .sta_statistics = ath11k_mac_op_sta_statistics, + CFG80211_TESTMODE_CMD(ath11k_tm_cmd) ++ ++#ifdef CONFIG_PM ++ .suspend = ath11k_wow_op_suspend, ++ .resume = ath11k_wow_op_resume, ++ .set_wakeup = ath11k_wow_op_set_wakeup, ++#endif ++ + #ifdef CPTCFG_ATH11K_DEBUGFS + .sta_add_debugfs = ath11k_debugfs_sta_op_add, + #endif +@@ -8473,6 +8498,12 @@ static int __ath11k_mac_register(struct + NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; + } + ++ ret = ath11k_wow_init(ar); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to init wow: %d\n", ret); ++ goto err_free_if_combs; ++ } ++ + 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/mac.h ++++ b/drivers/net/wireless/ath/ath11k/mac.h +@@ -172,4 +172,5 @@ enum hal_encrypt_type ath11k_dp_tx_get_e + void ath11k_mac_handle_beacon(struct ath11k *ar, struct sk_buff *skb); + void ath11k_mac_handle_beacon_miss(struct ath11k *ar, u32 vdev_id); + void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif); ++int ath11k_mac_wait_tx_complete(struct ath11k *ar); + #endif +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -8235,3 +8235,161 @@ int ath11k_wmi_scan_prob_req_oui(struct + + return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_SCAN_PROB_REQ_OUI_CMDID); + } ++ ++int ath11k_wmi_wow_add_wakeup_event(struct ath11k *ar, u32 vdev_id, ++ enum wmi_wow_wakeup_event event, ++ u32 enable) ++{ ++ struct wmi_wow_add_del_event_cmd *cmd; ++ struct sk_buff *skb; ++ size_t len; ++ ++ len = sizeof(*cmd); ++ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, len); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_wow_add_del_event_cmd *)skb->data; ++ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_WOW_ADD_DEL_EVT_CMD) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); ++ ++ cmd->vdev_id = vdev_id; ++ cmd->is_add = enable; ++ cmd->event_bitmap = (1 << event); ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "wmi tlv wow add wakeup event %s enable %d vdev_id %d\n", ++ wow_wakeup_event(event), enable, vdev_id); ++ ++ return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_WOW_ENABLE_DISABLE_WAKE_EVENT_CMDID); ++} ++ ++int ath11k_wmi_wow_add_pattern(struct ath11k *ar, u32 vdev_id, u32 pattern_id, ++ const u8 *pattern, const u8 *mask, ++ int pattern_len, int pattern_offset) ++{ ++ struct wmi_wow_add_pattern_cmd *cmd; ++ struct wmi_wow_bitmap_pattern *bitmap; ++ struct wmi_tlv *tlv; ++ struct sk_buff *skb; ++ u8 *ptr; ++ size_t len; ++ ++ len = sizeof(*cmd) + ++ sizeof(*tlv) + /* array struct */ ++ sizeof(*bitmap) + /* bitmap */ ++ sizeof(*tlv) + /* empty ipv4 sync */ ++ sizeof(*tlv) + /* empty ipv6 sync */ ++ sizeof(*tlv) + /* empty magic */ ++ sizeof(*tlv) + /* empty info timeout */ ++ sizeof(*tlv) + sizeof(u32); /* ratelimit interval */ ++ ++ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, len); ++ if (!skb) ++ return -ENOMEM; ++ ++ /* cmd */ ++ ptr = (u8 *)skb->data; ++ cmd = (struct wmi_wow_add_pattern_cmd *)ptr; ++ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_WOW_ADD_PATTERN_CMD) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); ++ ++ cmd->vdev_id = vdev_id; ++ cmd->pattern_id = pattern_id; ++ cmd->pattern_type = WOW_BITMAP_PATTERN; ++ ++ ptr += sizeof(*cmd); ++ ++ /* bitmap */ ++ tlv = (struct wmi_tlv *)ptr; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_ARRAY_STRUCT) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*bitmap)); ++ ++ ptr += sizeof(*tlv); ++ ++ bitmap = (struct wmi_wow_bitmap_pattern *)ptr; ++ bitmap->tlv_header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_WOW_BITMAP_PATTERN_T) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*bitmap) - TLV_HDR_SIZE); ++ ++ memcpy(bitmap->patternbuf, pattern, pattern_len); ++ ath11k_ce_byte_swap(bitmap->patternbuf, roundup(pattern_len, 4)); ++ memcpy(bitmap->bitmaskbuf, mask, pattern_len); ++ ath11k_ce_byte_swap(bitmap->bitmaskbuf, roundup(pattern_len, 4)); ++ bitmap->pattern_offset = pattern_offset; ++ bitmap->pattern_len = pattern_len; ++ bitmap->bitmask_len = pattern_len; ++ bitmap->pattern_id = pattern_id; ++ ++ ptr += sizeof(*bitmap); ++ ++ /* ipv4 sync */ ++ tlv = (struct wmi_tlv *)ptr; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_ARRAY_STRUCT) | ++ FIELD_PREP(WMI_TLV_LEN, 0); ++ ++ ptr += sizeof(*tlv); ++ ++ /* ipv6 sync */ ++ tlv = (struct wmi_tlv *)ptr; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_ARRAY_STRUCT) | ++ FIELD_PREP(WMI_TLV_LEN, 0); ++ ++ ptr += sizeof(*tlv); ++ ++ /* magic */ ++ tlv = (struct wmi_tlv *)ptr; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_ARRAY_STRUCT) | ++ FIELD_PREP(WMI_TLV_LEN, 0); ++ ++ ptr += sizeof(*tlv); ++ ++ /* pattern info timeout */ ++ tlv = (struct wmi_tlv *)ptr; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_ARRAY_UINT32) | ++ FIELD_PREP(WMI_TLV_LEN, 0); ++ ++ ptr += sizeof(*tlv); ++ ++ /* ratelimit interval */ ++ tlv = (struct wmi_tlv *)ptr; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_ARRAY_UINT32) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(u32)); ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "wmi tlv wow add pattern vdev_id %d pattern_id %d pattern_offset %d\n", ++ vdev_id, pattern_id, pattern_offset); ++ ++ return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_WOW_ADD_WAKE_PATTERN_CMDID); ++} ++ ++int ath11k_wmi_wow_del_pattern(struct ath11k *ar, u32 vdev_id, u32 pattern_id) ++{ ++ struct wmi_wow_del_pattern_cmd *cmd; ++ struct sk_buff *skb; ++ size_t len; ++ ++ len = sizeof(*cmd); ++ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, len); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_wow_del_pattern_cmd *)skb->data; ++ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_WOW_DEL_PATTERN_CMD) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); ++ ++ cmd->vdev_id = vdev_id; ++ cmd->pattern_id = pattern_id; ++ cmd->pattern_type = WOW_BITMAP_PATTERN; ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "wmi tlv wow del pattern vdev_id %d pattern_id %d\n", ++ vdev_id, pattern_id); ++ ++ return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_WOW_DEL_WAKE_PATTERN_CMDID); ++} +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -5534,6 +5534,45 @@ static inline const char *wow_reason(enu + + #undef C2S + ++struct wmi_wow_ev_arg { ++ u32 vdev_id; ++ u32 flag; ++ enum wmi_wow_wake_reason wake_reason; ++ u32 data_len; ++}; ++ ++enum wmi_tlv_pattern_type { ++ WOW_PATTERN_MIN = 0, ++ WOW_BITMAP_PATTERN = WOW_PATTERN_MIN, ++ WOW_IPV4_SYNC_PATTERN, ++ WOW_IPV6_SYNC_PATTERN, ++ WOW_WILD_CARD_PATTERN, ++ WOW_TIMER_PATTERN, ++ WOW_MAGIC_PATTERN, ++ WOW_IPV6_RA_PATTERN, ++ WOW_IOAC_PKT_PATTERN, ++ WOW_IOAC_TMR_PATTERN, ++ WOW_PATTERN_MAX ++}; ++ ++#define WOW_DEFAULT_BITMAP_PATTERN_SIZE 148 ++#define WOW_DEFAULT_BITMASK_SIZE 148 ++ ++#define WOW_MIN_PATTERN_SIZE 1 ++#define WOW_MAX_PATTERN_SIZE 148 ++#define WOW_MAX_PKT_OFFSET 128 ++#define WOW_HDR_LEN (sizeof(struct ieee80211_hdr_3addr) + \ ++ sizeof(struct rfc1042_hdr)) ++#define WOW_MAX_REDUCE (WOW_HDR_LEN - sizeof(struct ethhdr) - \ ++ offsetof(struct ieee80211_hdr_3addr, addr1)) ++ ++struct wmi_wow_add_del_event_cmd { ++ u32 tlv_header; ++ u32 vdev_id; ++ u32 is_add; ++ u32 event_bitmap; ++} __packed; ++ + struct wmi_wow_enable_cmd { + u32 tlv_header; + u32 enable; +@@ -5546,12 +5585,36 @@ struct wmi_wow_host_wakeup_ind { + u32 reserved; + } __packed; + +-struct wmi_wow_ev_arg { ++struct wmi_tlv_wow_event_info { + u32 vdev_id; + u32 flag; +- enum wmi_wow_wake_reason wake_reason; ++ u32 wake_reason; + u32 data_len; +-}; ++} __packed; ++ ++struct wmi_wow_bitmap_pattern { ++ u32 tlv_header; ++ u8 patternbuf[WOW_DEFAULT_BITMAP_PATTERN_SIZE]; ++ u8 bitmaskbuf[WOW_DEFAULT_BITMASK_SIZE]; ++ u32 pattern_offset; ++ u32 pattern_len; ++ u32 bitmask_len; ++ u32 pattern_id; ++} __packed; ++ ++struct wmi_wow_add_pattern_cmd { ++ u32 tlv_header; ++ u32 vdev_id; ++ u32 pattern_id; ++ u32 pattern_type; ++} __packed; ++ ++struct wmi_wow_del_pattern_cmd { ++ u32 tlv_header; ++ u32 vdev_id; ++ u32 pattern_id; ++ u32 pattern_type; ++} __packed; + + int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb, + u32 cmd_id); +@@ -5714,4 +5777,11 @@ int ath11k_wmi_scan_prob_req_oui(struct + const u8 mac_addr[ETH_ALEN]); + int ath11k_wmi_fw_dbglog_cfg(struct ath11k *ar, u32 *module_id_bitmap, + struct ath11k_fw_dbglog *dbglog); ++int ath11k_wmi_wow_del_pattern(struct ath11k *ar, u32 vdev_id, u32 pattern_id); ++int ath11k_wmi_wow_add_pattern(struct ath11k *ar, u32 vdev_id, u32 pattern_id, ++ const u8 *pattern, const u8 *mask, ++ int pattern_len, int pattern_offset); ++int ath11k_wmi_wow_add_wakeup_event(struct ath11k *ar, u32 vdev_id, ++ enum wmi_wow_wakeup_event event, ++ u32 enable); + #endif +--- a/drivers/net/wireless/ath/ath11k/wow.c ++++ b/drivers/net/wireless/ath/ath11k/wow.c +@@ -6,12 +6,22 @@ + #include + + #include "mac.h" ++ ++#include + #include "core.h" + #include "hif.h" + #include "debug.h" + #include "wmi.h" + #include "wow.h" + ++static const struct wiphy_wowlan_support ath11k_wowlan_support = { ++ .flags = WIPHY_WOWLAN_DISCONNECT | ++ WIPHY_WOWLAN_MAGIC_PKT, ++ .pattern_min_len = WOW_MIN_PATTERN_SIZE, ++ .pattern_max_len = WOW_MAX_PATTERN_SIZE, ++ .max_pkt_offset = WOW_MAX_PKT_OFFSET, ++}; ++ + int ath11k_wow_enable(struct ath11k_base *ab) + { + struct ath11k *ar = ath11k_ab_to_ar(ab, 0); +@@ -71,3 +81,407 @@ int ath11k_wow_wakeup(struct ath11k_base + + return 0; + } ++ ++static int ath11k_wow_vif_cleanup(struct ath11k_vif *arvif) ++{ ++ struct ath11k *ar = arvif->ar; ++ int i, ret; ++ ++ for (i = 0; i < WOW_EVENT_MAX; i++) { ++ ret = ath11k_wmi_wow_add_wakeup_event(ar, arvif->vdev_id, i, 0); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to issue wow wakeup for event %s on vdev %i: %d\n", ++ wow_wakeup_event(i), arvif->vdev_id, ret); ++ return ret; ++ } ++ } ++ ++ for (i = 0; i < ar->wow.max_num_patterns; i++) { ++ ret = ath11k_wmi_wow_del_pattern(ar, arvif->vdev_id, i); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to delete wow pattern %d for vdev %i: %d\n", ++ i, arvif->vdev_id, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static int ath11k_wow_cleanup(struct ath11k *ar) ++{ ++ struct ath11k_vif *arvif; ++ int ret; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ list_for_each_entry(arvif, &ar->arvifs, list) { ++ ret = ath11k_wow_vif_cleanup(arvif); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to clean wow wakeups on vdev %i: %d\n", ++ arvif->vdev_id, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++/* Convert a 802.3 format to a 802.11 format. ++ * +------------+-----------+--------+----------------+ ++ * 802.3: |dest mac(6B)|src mac(6B)|type(2B)| body... | ++ * +------------+-----------+--------+----------------+ ++ * |__ |_______ |____________ |________ ++ * | | | | ++ * +--+------------+----+-----------+---------------+-----------+ ++ * 802.11: |4B|dest mac(6B)| 6B |src mac(6B)| 8B |type(2B)| body... | ++ * +--+------------+----+-----------+---------------+-----------+ ++ */ ++static void ath11k_wow_convert_8023_to_80211(struct cfg80211_pkt_pattern *new, ++ const struct cfg80211_pkt_pattern *old) ++{ ++ u8 hdr_8023_pattern[ETH_HLEN] = {}; ++ u8 hdr_8023_bit_mask[ETH_HLEN] = {}; ++ u8 hdr_80211_pattern[WOW_HDR_LEN] = {}; ++ u8 hdr_80211_bit_mask[WOW_HDR_LEN] = {}; ++ ++ int total_len = old->pkt_offset + old->pattern_len; ++ int hdr_80211_end_offset; ++ ++ struct ieee80211_hdr_3addr *new_hdr_pattern = ++ (struct ieee80211_hdr_3addr *)hdr_80211_pattern; ++ struct ieee80211_hdr_3addr *new_hdr_mask = ++ (struct ieee80211_hdr_3addr *)hdr_80211_bit_mask; ++ struct ethhdr *old_hdr_pattern = (struct ethhdr *)hdr_8023_pattern; ++ struct ethhdr *old_hdr_mask = (struct ethhdr *)hdr_8023_bit_mask; ++ int hdr_len = sizeof(*new_hdr_pattern); ++ ++ struct rfc1042_hdr *new_rfc_pattern = ++ (struct rfc1042_hdr *)(hdr_80211_pattern + hdr_len); ++ struct rfc1042_hdr *new_rfc_mask = ++ (struct rfc1042_hdr *)(hdr_80211_bit_mask + hdr_len); ++ int rfc_len = sizeof(*new_rfc_pattern); ++ ++ memcpy(hdr_8023_pattern + old->pkt_offset, ++ old->pattern, ETH_HLEN - old->pkt_offset); ++ memcpy(hdr_8023_bit_mask + old->pkt_offset, ++ old->mask, ETH_HLEN - old->pkt_offset); ++ ++ /* Copy destination address */ ++ memcpy(new_hdr_pattern->addr1, old_hdr_pattern->h_dest, ETH_ALEN); ++ memcpy(new_hdr_mask->addr1, old_hdr_mask->h_dest, ETH_ALEN); ++ ++ /* Copy source address */ ++ memcpy(new_hdr_pattern->addr3, old_hdr_pattern->h_source, ETH_ALEN); ++ memcpy(new_hdr_mask->addr3, old_hdr_mask->h_source, ETH_ALEN); ++ ++ /* Copy logic link type */ ++ memcpy(&new_rfc_pattern->snap_type, ++ &old_hdr_pattern->h_proto, ++ sizeof(old_hdr_pattern->h_proto)); ++ memcpy(&new_rfc_mask->snap_type, ++ &old_hdr_mask->h_proto, ++ sizeof(old_hdr_mask->h_proto)); ++ ++ /* Compute new pkt_offset */ ++ if (old->pkt_offset < ETH_ALEN) ++ new->pkt_offset = old->pkt_offset + ++ offsetof(struct ieee80211_hdr_3addr, addr1); ++ else if (old->pkt_offset < offsetof(struct ethhdr, h_proto)) ++ new->pkt_offset = old->pkt_offset + ++ offsetof(struct ieee80211_hdr_3addr, addr3) - ++ offsetof(struct ethhdr, h_source); ++ else ++ new->pkt_offset = old->pkt_offset + hdr_len + rfc_len - ETH_HLEN; ++ ++ /* Compute new hdr end offset */ ++ if (total_len > ETH_HLEN) ++ hdr_80211_end_offset = hdr_len + rfc_len; ++ else if (total_len > offsetof(struct ethhdr, h_proto)) ++ hdr_80211_end_offset = hdr_len + rfc_len + total_len - ETH_HLEN; ++ else if (total_len > ETH_ALEN) ++ hdr_80211_end_offset = total_len - ETH_ALEN + ++ offsetof(struct ieee80211_hdr_3addr, addr3); ++ else ++ hdr_80211_end_offset = total_len + ++ offsetof(struct ieee80211_hdr_3addr, addr1); ++ ++ new->pattern_len = hdr_80211_end_offset - new->pkt_offset; ++ ++ memcpy((u8 *)new->pattern, ++ hdr_80211_pattern + new->pkt_offset, ++ new->pattern_len); ++ memcpy((u8 *)new->mask, ++ hdr_80211_bit_mask + new->pkt_offset, ++ new->pattern_len); ++ ++ if (total_len > ETH_HLEN) { ++ /* Copy frame body */ ++ memcpy((u8 *)new->pattern + new->pattern_len, ++ (void *)old->pattern + ETH_HLEN - old->pkt_offset, ++ total_len - ETH_HLEN); ++ memcpy((u8 *)new->mask + new->pattern_len, ++ (void *)old->mask + ETH_HLEN - old->pkt_offset, ++ total_len - ETH_HLEN); ++ ++ new->pattern_len += total_len - ETH_HLEN; ++ } ++} ++ ++static int ath11k_vif_wow_set_wakeups(struct ath11k_vif *arvif, ++ struct cfg80211_wowlan *wowlan) ++{ ++ int ret, i; ++ unsigned long wow_mask = 0; ++ struct ath11k *ar = arvif->ar; ++ const struct cfg80211_pkt_pattern *patterns = wowlan->patterns; ++ int pattern_id = 0; ++ ++ /* Setup requested WOW features */ ++ switch (arvif->vdev_type) { ++ case WMI_VDEV_TYPE_IBSS: ++ __set_bit(WOW_BEACON_EVENT, &wow_mask); ++ fallthrough; ++ case WMI_VDEV_TYPE_AP: ++ __set_bit(WOW_DEAUTH_RECVD_EVENT, &wow_mask); ++ __set_bit(WOW_DISASSOC_RECVD_EVENT, &wow_mask); ++ __set_bit(WOW_PROBE_REQ_WPS_IE_EVENT, &wow_mask); ++ __set_bit(WOW_AUTH_REQ_EVENT, &wow_mask); ++ __set_bit(WOW_ASSOC_REQ_EVENT, &wow_mask); ++ __set_bit(WOW_HTT_EVENT, &wow_mask); ++ __set_bit(WOW_RA_MATCH_EVENT, &wow_mask); ++ break; ++ case WMI_VDEV_TYPE_STA: ++ if (wowlan->disconnect) { ++ __set_bit(WOW_DEAUTH_RECVD_EVENT, &wow_mask); ++ __set_bit(WOW_DISASSOC_RECVD_EVENT, &wow_mask); ++ __set_bit(WOW_BMISS_EVENT, &wow_mask); ++ __set_bit(WOW_CSA_IE_EVENT, &wow_mask); ++ } ++ ++ if (wowlan->magic_pkt) ++ __set_bit(WOW_MAGIC_PKT_RECVD_EVENT, &wow_mask); ++ break; ++ default: ++ break; ++ } ++ ++ for (i = 0; i < wowlan->n_patterns; i++) { ++ u8 bitmask[WOW_MAX_PATTERN_SIZE] = {}; ++ u8 ath_pattern[WOW_MAX_PATTERN_SIZE] = {}; ++ u8 ath_bitmask[WOW_MAX_PATTERN_SIZE] = {}; ++ struct cfg80211_pkt_pattern new_pattern = {}; ++ struct cfg80211_pkt_pattern old_pattern = patterns[i]; ++ int j; ++ ++ new_pattern.pattern = ath_pattern; ++ new_pattern.mask = ath_bitmask; ++ if (patterns[i].pattern_len > WOW_MAX_PATTERN_SIZE) ++ continue; ++ /* convert bytemask to bitmask */ ++ for (j = 0; j < patterns[i].pattern_len; j++) ++ if (patterns[i].mask[j / 8] & BIT(j % 8)) ++ bitmask[j] = 0xff; ++ old_pattern.mask = bitmask; ++ ++ if (ar->wmi->wmi_ab->wlan_resource_config.rx_decap_mode == ++ ATH11K_HW_TXRX_NATIVE_WIFI) { ++ if (patterns[i].pkt_offset < ETH_HLEN) { ++ u8 pattern_ext[WOW_MAX_PATTERN_SIZE] = {}; ++ ++ memcpy(pattern_ext, old_pattern.pattern, ++ old_pattern.pattern_len); ++ old_pattern.pattern = pattern_ext; ++ ath11k_wow_convert_8023_to_80211(&new_pattern, ++ &old_pattern); ++ } else { ++ new_pattern = old_pattern; ++ new_pattern.pkt_offset += WOW_HDR_LEN - ETH_HLEN; ++ } ++ } ++ ++ if (WARN_ON(new_pattern.pattern_len > WOW_MAX_PATTERN_SIZE)) ++ return -EINVAL; ++ ++ ret = ath11k_wmi_wow_add_pattern(ar, arvif->vdev_id, ++ pattern_id, ++ new_pattern.pattern, ++ new_pattern.mask, ++ new_pattern.pattern_len, ++ new_pattern.pkt_offset); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to add pattern %i to vdev %i: %d\n", ++ pattern_id, ++ arvif->vdev_id, ret); ++ return ret; ++ } ++ ++ pattern_id++; ++ __set_bit(WOW_PATTERN_MATCH_EVENT, &wow_mask); ++ } ++ ++ for (i = 0; i < WOW_EVENT_MAX; i++) { ++ if (!test_bit(i, &wow_mask)) ++ continue; ++ ret = ath11k_wmi_wow_add_wakeup_event(ar, arvif->vdev_id, i, 1); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to enable wakeup event %s on vdev %i: %d\n", ++ wow_wakeup_event(i), arvif->vdev_id, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static int ath11k_wow_set_wakeups(struct ath11k *ar, ++ struct cfg80211_wowlan *wowlan) ++{ ++ struct ath11k_vif *arvif; ++ int ret; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ list_for_each_entry(arvif, &ar->arvifs, list) { ++ ret = ath11k_vif_wow_set_wakeups(arvif, wowlan); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to set wow wakeups on vdev %i: %d\n", ++ arvif->vdev_id, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++int ath11k_wow_op_suspend(struct ieee80211_hw *hw, ++ struct cfg80211_wowlan *wowlan) ++{ ++ struct ath11k *ar = hw->priv; ++ int ret; ++ ++ mutex_lock(&ar->conf_mutex); ++ ++ ret = ath11k_wow_cleanup(ar); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to clear wow wakeup events: %d\n", ++ ret); ++ goto exit; ++ } ++ ++ ret = ath11k_wow_set_wakeups(ar, wowlan); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to set wow wakeup events: %d\n", ++ ret); ++ goto cleanup; ++ } ++ ++ ret = ath11k_mac_wait_tx_complete(ar); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to wait tx complete: %d\n", ret); ++ goto cleanup; ++ } ++ ++ ret = ath11k_wow_enable(ar->ab); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to start wow: %d\n", ret); ++ goto cleanup; ++ } ++ ++ ath11k_ce_stop_shadow_timers(ar->ab); ++ ath11k_dp_stop_shadow_timers(ar->ab); ++ ++ ath11k_hif_irq_disable(ar->ab); ++ ath11k_hif_ce_irq_disable(ar->ab); ++ ++ ret = ath11k_hif_suspend(ar->ab); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to suspend hif: %d\n", ret); ++ goto wakeup; ++ } ++ ++ goto exit; ++ ++wakeup: ++ ath11k_wow_wakeup(ar->ab); ++ ++cleanup: ++ ath11k_wow_cleanup(ar); ++ ++exit: ++ mutex_unlock(&ar->conf_mutex); ++ return ret ? 1 : 0; ++} ++ ++void ath11k_wow_op_set_wakeup(struct ieee80211_hw *hw, bool enabled) ++{ ++ struct ath11k *ar = hw->priv; ++ ++ mutex_lock(&ar->conf_mutex); ++ device_set_wakeup_enable(ar->ab->dev, enabled); ++ mutex_unlock(&ar->conf_mutex); ++} ++ ++int ath11k_wow_op_resume(struct ieee80211_hw *hw) ++{ ++ struct ath11k *ar = hw->priv; ++ int ret; ++ ++ mutex_lock(&ar->conf_mutex); ++ ++ ret = ath11k_hif_resume(ar->ab); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to resume hif: %d\n", ret); ++ goto exit; ++ } ++ ++ ath11k_hif_ce_irq_enable(ar->ab); ++ ath11k_hif_irq_enable(ar->ab); ++ ++ ret = ath11k_wow_wakeup(ar->ab); ++ if (ret) ++ ath11k_warn(ar->ab, "failed to wakeup from wow: %d\n", ret); ++ ++exit: ++ if (ret) { ++ switch (ar->state) { ++ case ATH11K_STATE_ON: ++ ar->state = ATH11K_STATE_RESTARTING; ++ ret = 1; ++ break; ++ case ATH11K_STATE_OFF: ++ case ATH11K_STATE_RESTARTING: ++ case ATH11K_STATE_RESTARTED: ++ case ATH11K_STATE_WEDGED: ++ ath11k_warn(ar->ab, "encountered unexpected device state %d on resume, cannot recover\n", ++ ar->state); ++ ret = -EIO; ++ break; ++ } ++ } ++ ++ mutex_unlock(&ar->conf_mutex); ++ return ret; ++} ++ ++int ath11k_wow_init(struct ath11k *ar) ++{ ++ if (WARN_ON(!test_bit(WMI_TLV_SERVICE_WOW, ar->wmi->wmi_ab->svc_map))) ++ return -EINVAL; ++ ++ ar->wow.wowlan_support = ath11k_wowlan_support; ++ ++ if (ar->wmi->wmi_ab->wlan_resource_config.rx_decap_mode == ++ ATH11K_HW_TXRX_NATIVE_WIFI) { ++ ar->wow.wowlan_support.pattern_max_len -= WOW_MAX_REDUCE; ++ ar->wow.wowlan_support.max_pkt_offset -= WOW_MAX_REDUCE; ++ } ++ ++ ar->wow.max_num_patterns = ATH11K_WOW_PATTERNS; ++ ar->wow.wowlan_support.n_patterns = ar->wow.max_num_patterns; ++ ar->hw->wiphy->wowlan = &ar->wow.wowlan_support; ++ ++ device_set_wakeup_capable(ar->ab->dev, true); ++ ++ return 0; ++} +--- a/drivers/net/wireless/ath/ath11k/wow.h ++++ b/drivers/net/wireless/ath/ath11k/wow.h +@@ -3,8 +3,53 @@ + * Copyright (c) 2020 The Linux Foundation. All rights reserved. + */ + ++#ifndef _WOW_H_ ++#define _WOW_H_ ++ ++struct ath11k_wow { ++ u32 max_num_patterns; ++ struct completion wakeup_completed; ++ struct wiphy_wowlan_support wowlan_support; ++}; ++ ++struct rfc1042_hdr { ++ u8 llc_dsap; ++ u8 llc_ssap; ++ u8 llc_ctrl; ++ u8 snap_oui[3]; ++ __be16 snap_type; ++} __packed; ++ + #define ATH11K_WOW_RETRY_NUM 3 + #define ATH11K_WOW_RETRY_WAIT_MS 200 ++#define ATH11K_WOW_PATTERNS 22 + ++#ifdef CONFIG_PM ++ ++int ath11k_wow_init(struct ath11k *ar); ++int ath11k_wow_op_suspend(struct ieee80211_hw *hw, ++ struct cfg80211_wowlan *wowlan); ++int ath11k_wow_op_resume(struct ieee80211_hw *hw); ++void ath11k_wow_op_set_wakeup(struct ieee80211_hw *hw, bool enabled); + int ath11k_wow_enable(struct ath11k_base *ab); + int ath11k_wow_wakeup(struct ath11k_base *ab); ++ ++#else ++ ++static inline int ath11k_wow_init(struct ath11k *ar) ++{ ++ return 0; ++} ++ ++static inline int ath11k_wow_enable(struct ath11k_base *ab) ++{ ++ return 0; ++} ++ ++static inline int ath11k_wow_wakeup(struct ath11k_base *ab) ++{ ++ return 0; ++} ++ ++#endif /* CONFIG_PM */ ++#endif /* _WOW_H_ */ diff --git a/package/kernel/mac80211/patches/ath11k/0194-ath11k-Add-WoW-net-detect-functionality.patch b/package/kernel/mac80211/patches/ath11k/0194-ath11k-Add-WoW-net-detect-functionality.patch new file mode 100644 index 000000000..8ba83227e --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0194-ath11k-Add-WoW-net-detect-functionality.patch @@ -0,0 +1,614 @@ +From fec4b898f369a9b9d516f7bfc459eb4a8c5ceb2c Mon Sep 17 00:00:00 2001 +From: Carl Huang +Date: Mon, 14 Mar 2022 07:18:16 +0200 +Subject: [PATCH] ath11k: Add WoW net-detect functionality + +Implement net-detect feature by setting flag +WIPHY_WOWLAN_NET_DETECT if firmware supports this +feature. Driver sets the related PNO configuration +to firmware before entering WoW and firmware then +scans periodically and wakes up host if a specific +SSID is found. + +Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 + +Signed-off-by: Carl Huang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1644308006-22784-3-git-send-email-quic_cjhuang@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.h | 1 + + drivers/net/wireless/ath/ath11k/mac.c | 12 ++ + drivers/net/wireless/ath/ath11k/wmi.c | 154 ++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/wmi.h | 169 ++++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/wow.c | 175 ++++++++++++++++++++++++- + 5 files changed, 510 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -617,6 +617,7 @@ struct ath11k { + bool regdom_set_by_user; + int hw_rate_code; + u8 twt_enabled; ++ bool nlo_enabled; + }; + + struct ath11k_band_cap { +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -8498,6 +8498,18 @@ static int __ath11k_mac_register(struct + NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; + } + ++ if (test_bit(WMI_TLV_SERVICE_NLO, ar->wmi->wmi_ab->svc_map)) { ++ ar->hw->wiphy->max_sched_scan_ssids = WMI_PNO_MAX_SUPP_NETWORKS; ++ ar->hw->wiphy->max_match_sets = WMI_PNO_MAX_SUPP_NETWORKS; ++ ar->hw->wiphy->max_sched_scan_ie_len = WMI_PNO_MAX_IE_LENGTH; ++ ar->hw->wiphy->max_sched_scan_plans = WMI_PNO_MAX_SCHED_SCAN_PLANS; ++ ar->hw->wiphy->max_sched_scan_plan_interval = ++ WMI_PNO_MAX_SCHED_SCAN_PLAN_INT; ++ ar->hw->wiphy->max_sched_scan_plan_iterations = ++ WMI_PNO_MAX_SCHED_SCAN_PLAN_ITRNS; ++ ar->hw->wiphy->features |= NL80211_FEATURE_ND_RANDOM_MAC_ADDR; ++ } ++ + ret = ath11k_wow_init(ar); + if (ret) { + ath11k_warn(ar->ab, "failed to init wow: %d\n", ret); +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -8393,3 +8393,157 @@ int ath11k_wmi_wow_del_pattern(struct at + + return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_WOW_DEL_WAKE_PATTERN_CMDID); + } ++ ++static struct sk_buff * ++ath11k_wmi_op_gen_config_pno_start(struct ath11k *ar, ++ u32 vdev_id, ++ struct wmi_pno_scan_req *pno) ++{ ++ struct nlo_configured_parameters *nlo_list; ++ struct wmi_wow_nlo_config_cmd *cmd; ++ struct wmi_tlv *tlv; ++ struct sk_buff *skb; ++ u32 *channel_list; ++ size_t len, nlo_list_len, channel_list_len; ++ u8 *ptr; ++ u32 i; ++ ++ len = sizeof(*cmd) + ++ sizeof(*tlv) + ++ /* TLV place holder for array of structures ++ * nlo_configured_parameters(nlo_list) ++ */ ++ sizeof(*tlv); ++ /* TLV place holder for array of uint32 channel_list */ ++ ++ channel_list_len = sizeof(u32) * pno->a_networks[0].channel_count; ++ len += channel_list_len; ++ ++ nlo_list_len = sizeof(*nlo_list) * pno->uc_networks_count; ++ len += nlo_list_len; ++ ++ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, len); ++ if (!skb) ++ return ERR_PTR(-ENOMEM); ++ ++ ptr = (u8 *)skb->data; ++ cmd = (struct wmi_wow_nlo_config_cmd *)ptr; ++ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_NLO_CONFIG_CMD) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); ++ ++ cmd->vdev_id = pno->vdev_id; ++ cmd->flags = WMI_NLO_CONFIG_START | WMI_NLO_CONFIG_SSID_HIDE_EN; ++ ++ /* current FW does not support min-max range for dwell time */ ++ cmd->active_dwell_time = pno->active_max_time; ++ cmd->passive_dwell_time = pno->passive_max_time; ++ ++ if (pno->do_passive_scan) ++ cmd->flags |= WMI_NLO_CONFIG_SCAN_PASSIVE; ++ ++ cmd->fast_scan_period = pno->fast_scan_period; ++ cmd->slow_scan_period = pno->slow_scan_period; ++ cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; ++ cmd->delay_start_time = pno->delay_start_time; ++ ++ if (pno->enable_pno_scan_randomization) { ++ cmd->flags |= WMI_NLO_CONFIG_SPOOFED_MAC_IN_PROBE_REQ | ++ WMI_NLO_CONFIG_RANDOM_SEQ_NO_IN_PROBE_REQ; ++ ether_addr_copy(cmd->mac_addr.addr, pno->mac_addr); ++ ether_addr_copy(cmd->mac_mask.addr, pno->mac_addr_mask); ++ ath11k_ce_byte_swap(cmd->mac_addr.addr, 8); ++ ath11k_ce_byte_swap(cmd->mac_mask.addr, 8); ++ } ++ ++ ptr += sizeof(*cmd); ++ ++ /* nlo_configured_parameters(nlo_list) */ ++ cmd->no_of_ssids = pno->uc_networks_count; ++ tlv = (struct wmi_tlv *)ptr; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_ARRAY_STRUCT) | ++ FIELD_PREP(WMI_TLV_LEN, nlo_list_len); ++ ++ ptr += sizeof(*tlv); ++ nlo_list = (struct nlo_configured_parameters *)ptr; ++ for (i = 0; i < cmd->no_of_ssids; i++) { ++ tlv = (struct wmi_tlv *)(&nlo_list[i].tlv_header); ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*nlo_list) - sizeof(*tlv)); ++ ++ nlo_list[i].ssid.valid = true; ++ nlo_list[i].ssid.ssid.ssid_len = pno->a_networks[i].ssid.ssid_len; ++ memcpy(nlo_list[i].ssid.ssid.ssid, ++ pno->a_networks[i].ssid.ssid, ++ nlo_list[i].ssid.ssid.ssid_len); ++ ath11k_ce_byte_swap(nlo_list[i].ssid.ssid.ssid, ++ roundup(nlo_list[i].ssid.ssid.ssid_len, 4)); ++ ++ if (pno->a_networks[i].rssi_threshold && ++ pno->a_networks[i].rssi_threshold > -300) { ++ nlo_list[i].rssi_cond.valid = true; ++ nlo_list[i].rssi_cond.rssi = ++ pno->a_networks[i].rssi_threshold; ++ } ++ ++ nlo_list[i].bcast_nw_type.valid = true; ++ nlo_list[i].bcast_nw_type.bcast_nw_type = ++ pno->a_networks[i].bcast_nw_type; ++ } ++ ++ ptr += nlo_list_len; ++ cmd->num_of_channels = pno->a_networks[0].channel_count; ++ tlv = (struct wmi_tlv *)ptr; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_UINT32) | ++ FIELD_PREP(WMI_TLV_LEN, channel_list_len); ++ ptr += sizeof(*tlv); ++ channel_list = (u32 *)ptr; ++ for (i = 0; i < cmd->num_of_channels; i++) ++ channel_list[i] = pno->a_networks[0].channels[i]; ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "wmi tlv start pno config vdev_id %d\n", ++ vdev_id); ++ ++ return skb; ++} ++ ++static struct sk_buff *ath11k_wmi_op_gen_config_pno_stop(struct ath11k *ar, ++ u32 vdev_id) ++{ ++ struct wmi_wow_nlo_config_cmd *cmd; ++ struct sk_buff *skb; ++ size_t len; ++ ++ len = sizeof(*cmd); ++ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, len); ++ if (!skb) ++ return ERR_PTR(-ENOMEM); ++ ++ cmd = (struct wmi_wow_nlo_config_cmd *)skb->data; ++ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_NLO_CONFIG_CMD) | ++ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE); ++ ++ cmd->vdev_id = vdev_id; ++ cmd->flags = WMI_NLO_CONFIG_STOP; ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, ++ "wmi tlv stop pno config vdev_id %d\n", vdev_id); ++ return skb; ++} ++ ++int ath11k_wmi_wow_config_pno(struct ath11k *ar, u32 vdev_id, ++ struct wmi_pno_scan_req *pno_scan) ++{ ++ struct sk_buff *skb; ++ ++ if (pno_scan->enable) ++ skb = ath11k_wmi_op_gen_config_pno_start(ar, vdev_id, pno_scan); ++ else ++ skb = ath11k_wmi_op_gen_config_pno_stop(ar, vdev_id); ++ ++ if (IS_ERR_OR_NULL(skb)) ++ return -ENOMEM; ++ ++ return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); ++} ++ +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -5616,6 +5616,173 @@ struct wmi_wow_del_pattern_cmd { + u32 pattern_type; + } __packed; + ++#define WMI_PNO_MAX_SCHED_SCAN_PLANS 2 ++#define WMI_PNO_MAX_SCHED_SCAN_PLAN_INT 7200 ++#define WMI_PNO_MAX_SCHED_SCAN_PLAN_ITRNS 100 ++#define WMI_PNO_MAX_NETW_CHANNELS 26 ++#define WMI_PNO_MAX_NETW_CHANNELS_EX 60 ++#define WMI_PNO_MAX_SUPP_NETWORKS WLAN_SCAN_PARAMS_MAX_SSID ++#define WMI_PNO_MAX_IE_LENGTH WLAN_SCAN_PARAMS_MAX_IE_LEN ++ ++/* size based of dot11 declaration without extra IEs as we will not carry those for PNO */ ++#define WMI_PNO_MAX_PB_REQ_SIZE 450 ++ ++#define WMI_PNO_24G_DEFAULT_CH 1 ++#define WMI_PNO_5G_DEFAULT_CH 36 ++ ++#define WMI_ACTIVE_MAX_CHANNEL_TIME 40 ++#define WMI_PASSIVE_MAX_CHANNEL_TIME 110 ++ ++/* SSID broadcast type */ ++enum wmi_ssid_bcast_type { ++ BCAST_UNKNOWN = 0, ++ BCAST_NORMAL = 1, ++ BCAST_HIDDEN = 2, ++}; ++ ++#define WMI_NLO_MAX_SSIDS 16 ++#define WMI_NLO_MAX_CHAN 48 ++ ++#define WMI_NLO_CONFIG_STOP BIT(0) ++#define WMI_NLO_CONFIG_START BIT(1) ++#define WMI_NLO_CONFIG_RESET BIT(2) ++#define WMI_NLO_CONFIG_SLOW_SCAN BIT(4) ++#define WMI_NLO_CONFIG_FAST_SCAN BIT(5) ++#define WMI_NLO_CONFIG_SSID_HIDE_EN BIT(6) ++ ++/* This bit is used to indicate if EPNO or supplicant PNO is enabled. ++ * Only one of them can be enabled at a given time ++ */ ++#define WMI_NLO_CONFIG_ENLO BIT(7) ++#define WMI_NLO_CONFIG_SCAN_PASSIVE BIT(8) ++#define WMI_NLO_CONFIG_ENLO_RESET BIT(9) ++#define WMI_NLO_CONFIG_SPOOFED_MAC_IN_PROBE_REQ BIT(10) ++#define WMI_NLO_CONFIG_RANDOM_SEQ_NO_IN_PROBE_REQ BIT(11) ++#define WMI_NLO_CONFIG_ENABLE_IE_WHITELIST_IN_PROBE_REQ BIT(12) ++#define WMI_NLO_CONFIG_ENABLE_CNLO_RSSI_CONFIG BIT(13) ++ ++struct wmi_nlo_ssid_param { ++ u32 valid; ++ struct wmi_ssid ssid; ++} __packed; ++ ++struct wmi_nlo_enc_param { ++ u32 valid; ++ u32 enc_type; ++} __packed; ++ ++struct wmi_nlo_auth_param { ++ u32 valid; ++ u32 auth_type; ++} __packed; ++ ++struct wmi_nlo_bcast_nw_param { ++ u32 valid; ++ u32 bcast_nw_type; ++} __packed; ++ ++struct wmi_nlo_rssi_param { ++ u32 valid; ++ s32 rssi; ++} __packed; ++ ++struct nlo_configured_parameters { ++ /* TLV tag and len;*/ ++ u32 tlv_header; ++ struct wmi_nlo_ssid_param ssid; ++ struct wmi_nlo_enc_param enc_type; ++ struct wmi_nlo_auth_param auth_type; ++ struct wmi_nlo_rssi_param rssi_cond; ++ ++ /* indicates if the SSID is hidden or not */ ++ struct wmi_nlo_bcast_nw_param bcast_nw_type; ++} __packed; ++ ++struct wmi_network_type { ++ struct wmi_ssid ssid; ++ u32 authentication; ++ u32 encryption; ++ u32 bcast_nw_type; ++ u8 channel_count; ++ u16 channels[WMI_PNO_MAX_NETW_CHANNELS_EX]; ++ s32 rssi_threshold; ++}; ++ ++struct wmi_pno_scan_req { ++ u8 enable; ++ u8 vdev_id; ++ u8 uc_networks_count; ++ struct wmi_network_type a_networks[WMI_PNO_MAX_SUPP_NETWORKS]; ++ u32 fast_scan_period; ++ u32 slow_scan_period; ++ u8 fast_scan_max_cycles; ++ ++ bool do_passive_scan; ++ ++ u32 delay_start_time; ++ u32 active_min_time; ++ u32 active_max_time; ++ u32 passive_min_time; ++ u32 passive_max_time; ++ ++ /* mac address randomization attributes */ ++ u32 enable_pno_scan_randomization; ++ u8 mac_addr[ETH_ALEN]; ++ u8 mac_addr_mask[ETH_ALEN]; ++}; ++ ++struct wmi_wow_nlo_config_cmd { ++ u32 tlv_header; ++ u32 flags; ++ u32 vdev_id; ++ u32 fast_scan_max_cycles; ++ u32 active_dwell_time; ++ u32 passive_dwell_time; ++ u32 probe_bundle_size; ++ ++ /* ART = IRT */ ++ u32 rest_time; ++ ++ /* Max value that can be reached after SBM */ ++ u32 max_rest_time; ++ ++ /* SBM */ ++ u32 scan_backoff_multiplier; ++ ++ /* SCBM */ ++ u32 fast_scan_period; ++ ++ /* specific to windows */ ++ u32 slow_scan_period; ++ ++ u32 no_of_ssids; ++ ++ u32 num_of_channels; ++ ++ /* NLO scan start delay time in milliseconds */ ++ u32 delay_start_time; ++ ++ /* MAC Address to use in Probe Req as SA */ ++ struct wmi_mac_addr mac_addr; ++ ++ /* Mask on which MAC has to be randomized */ ++ struct wmi_mac_addr mac_mask; ++ ++ /* IE bitmap to use in Probe Req */ ++ u32 ie_bitmap[8]; ++ ++ /* Number of vendor OUIs. In the TLV vendor_oui[] */ ++ u32 num_vendor_oui; ++ ++ /* Number of connected NLO band preferences */ ++ u32 num_cnlo_band_pref; ++ ++ /* The TLVs will follow. ++ * nlo_configured_parameters nlo_list[]; ++ * u32 channel_list[num_of_channels]; ++ */ ++} __packed; ++ + 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); +@@ -5777,6 +5944,8 @@ int ath11k_wmi_scan_prob_req_oui(struct + const u8 mac_addr[ETH_ALEN]); + int ath11k_wmi_fw_dbglog_cfg(struct ath11k *ar, u32 *module_id_bitmap, + struct ath11k_fw_dbglog *dbglog); ++int ath11k_wmi_wow_config_pno(struct ath11k *ar, u32 vdev_id, ++ struct wmi_pno_scan_req *pno_scan); + int ath11k_wmi_wow_del_pattern(struct ath11k *ar, u32 vdev_id, u32 pattern_id); + int ath11k_wmi_wow_add_pattern(struct ath11k *ar, u32 vdev_id, u32 pattern_id, + const u8 *pattern, const u8 *mask, +--- a/drivers/net/wireless/ath/ath11k/wow.c ++++ b/drivers/net/wireless/ath/ath11k/wow.c +@@ -228,6 +228,101 @@ static void ath11k_wow_convert_8023_to_8 + } + } + ++static int ath11k_wmi_pno_check_and_convert(struct ath11k *ar, u32 vdev_id, ++ struct cfg80211_sched_scan_request *nd_config, ++ struct wmi_pno_scan_req *pno) ++{ ++ int i, j; ++ u8 ssid_len; ++ ++ pno->enable = 1; ++ pno->vdev_id = vdev_id; ++ pno->uc_networks_count = nd_config->n_match_sets; ++ ++ if (!pno->uc_networks_count || ++ pno->uc_networks_count > WMI_PNO_MAX_SUPP_NETWORKS) ++ return -EINVAL; ++ ++ if (nd_config->n_channels > WMI_PNO_MAX_NETW_CHANNELS_EX) ++ return -EINVAL; ++ ++ /* Filling per profile params */ ++ for (i = 0; i < pno->uc_networks_count; i++) { ++ ssid_len = nd_config->match_sets[i].ssid.ssid_len; ++ ++ if (ssid_len == 0 || ssid_len > 32) ++ return -EINVAL; ++ ++ pno->a_networks[i].ssid.ssid_len = ssid_len; ++ ++ memcpy(pno->a_networks[i].ssid.ssid, ++ nd_config->match_sets[i].ssid.ssid, ++ nd_config->match_sets[i].ssid.ssid_len); ++ pno->a_networks[i].authentication = 0; ++ pno->a_networks[i].encryption = 0; ++ pno->a_networks[i].bcast_nw_type = 0; ++ ++ /* Copying list of valid channel into request */ ++ pno->a_networks[i].channel_count = nd_config->n_channels; ++ pno->a_networks[i].rssi_threshold = nd_config->match_sets[i].rssi_thold; ++ ++ for (j = 0; j < nd_config->n_channels; j++) { ++ pno->a_networks[i].channels[j] = ++ nd_config->channels[j]->center_freq; ++ } ++ } ++ ++ /* set scan to passive if no SSIDs are specified in the request */ ++ if (nd_config->n_ssids == 0) ++ pno->do_passive_scan = true; ++ else ++ pno->do_passive_scan = false; ++ ++ for (i = 0; i < nd_config->n_ssids; i++) { ++ j = 0; ++ while (j < pno->uc_networks_count) { ++ if (pno->a_networks[j].ssid.ssid_len == ++ nd_config->ssids[i].ssid_len && ++ (memcmp(pno->a_networks[j].ssid.ssid, ++ nd_config->ssids[i].ssid, ++ pno->a_networks[j].ssid.ssid_len) == 0)) { ++ pno->a_networks[j].bcast_nw_type = BCAST_HIDDEN; ++ break; ++ } ++ j++; ++ } ++ } ++ ++ if (nd_config->n_scan_plans == 2) { ++ pno->fast_scan_period = nd_config->scan_plans[0].interval * MSEC_PER_SEC; ++ pno->fast_scan_max_cycles = nd_config->scan_plans[0].iterations; ++ pno->slow_scan_period = ++ nd_config->scan_plans[1].interval * MSEC_PER_SEC; ++ } else if (nd_config->n_scan_plans == 1) { ++ pno->fast_scan_period = nd_config->scan_plans[0].interval * MSEC_PER_SEC; ++ pno->fast_scan_max_cycles = 1; ++ pno->slow_scan_period = nd_config->scan_plans[0].interval * MSEC_PER_SEC; ++ } else { ++ ath11k_warn(ar->ab, "Invalid number of scan plans %d !!", ++ nd_config->n_scan_plans); ++ } ++ ++ if (nd_config->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { ++ /* enable mac randomization */ ++ pno->enable_pno_scan_randomization = 1; ++ memcpy(pno->mac_addr, nd_config->mac_addr, ETH_ALEN); ++ memcpy(pno->mac_addr_mask, nd_config->mac_addr_mask, ETH_ALEN); ++ } ++ ++ pno->delay_start_time = nd_config->delay; ++ ++ /* Current FW does not support min-max range for dwell time */ ++ pno->active_max_time = WMI_ACTIVE_MAX_CHANNEL_TIME; ++ pno->passive_max_time = WMI_PASSIVE_MAX_CHANNEL_TIME; ++ ++ return 0; ++} ++ + static int ath11k_vif_wow_set_wakeups(struct ath11k_vif *arvif, + struct cfg80211_wowlan *wowlan) + { +@@ -261,6 +356,26 @@ static int ath11k_vif_wow_set_wakeups(st + + if (wowlan->magic_pkt) + __set_bit(WOW_MAGIC_PKT_RECVD_EVENT, &wow_mask); ++ ++ if (wowlan->nd_config) { ++ struct wmi_pno_scan_req *pno; ++ int ret; ++ ++ pno = kzalloc(sizeof(*pno), GFP_KERNEL); ++ if (!pno) ++ return -ENOMEM; ++ ++ ar->nlo_enabled = true; ++ ++ ret = ath11k_wmi_pno_check_and_convert(ar, arvif->vdev_id, ++ wowlan->nd_config, pno); ++ if (!ret) { ++ ath11k_wmi_wow_config_pno(ar, arvif->vdev_id, pno); ++ __set_bit(WOW_NLO_DETECTED_EVENT, &wow_mask); ++ } ++ ++ kfree(pno); ++ } + break; + default: + break; +@@ -354,6 +469,51 @@ static int ath11k_wow_set_wakeups(struct + return 0; + } + ++static int ath11k_vif_wow_clean_nlo(struct ath11k_vif *arvif) ++{ ++ int ret = 0; ++ struct ath11k *ar = arvif->ar; ++ ++ switch (arvif->vdev_type) { ++ case WMI_VDEV_TYPE_STA: ++ if (ar->nlo_enabled) { ++ struct wmi_pno_scan_req *pno; ++ ++ pno = kzalloc(sizeof(*pno), GFP_KERNEL); ++ if (!pno) ++ return -ENOMEM; ++ ++ pno->enable = 0; ++ ar->nlo_enabled = false; ++ ret = ath11k_wmi_wow_config_pno(ar, arvif->vdev_id, pno); ++ kfree(pno); ++ } ++ break; ++ default: ++ break; ++ } ++ return ret; ++} ++ ++static int ath11k_wow_nlo_cleanup(struct ath11k *ar) ++{ ++ struct ath11k_vif *arvif; ++ int ret; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ list_for_each_entry(arvif, &ar->arvifs, list) { ++ ret = ath11k_vif_wow_clean_nlo(arvif); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to clean nlo settings on vdev %i: %d\n", ++ arvif->vdev_id, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ + int ath11k_wow_op_suspend(struct ieee80211_hw *hw, + struct cfg80211_wowlan *wowlan) + { +@@ -439,8 +599,16 @@ int ath11k_wow_op_resume(struct ieee8021 + ath11k_hif_irq_enable(ar->ab); + + ret = ath11k_wow_wakeup(ar->ab); +- if (ret) ++ if (ret) { + ath11k_warn(ar->ab, "failed to wakeup from wow: %d\n", ret); ++ goto exit; ++ } ++ ++ ret = ath11k_wow_nlo_cleanup(ar); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to cleanup nlo: %d\n", ret); ++ goto exit; ++ } + + exit: + if (ret) { +@@ -477,6 +645,11 @@ int ath11k_wow_init(struct ath11k *ar) + ar->wow.wowlan_support.max_pkt_offset -= WOW_MAX_REDUCE; + } + ++ if (test_bit(WMI_TLV_SERVICE_NLO, ar->wmi->wmi_ab->svc_map)) { ++ ar->wow.wowlan_support.flags |= WIPHY_WOWLAN_NET_DETECT; ++ ar->wow.wowlan_support.max_nd_match_sets = WMI_PNO_MAX_SUPP_NETWORKS; ++ } ++ + ar->wow.max_num_patterns = ATH11K_WOW_PATTERNS; + ar->wow.wowlan_support.n_patterns = ar->wow.max_num_patterns; + ar->hw->wiphy->wowlan = &ar->wow.wowlan_support; diff --git a/package/kernel/mac80211/patches/ath11k/0195-ath11k-implement-hardware-data-filter.patch b/package/kernel/mac80211/patches/ath11k/0195-ath11k-implement-hardware-data-filter.patch new file mode 100644 index 000000000..1d0ea5641 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0195-ath11k-implement-hardware-data-filter.patch @@ -0,0 +1,171 @@ +From c417b247ba042161ddfb34f26a42ec67edc5c378 Mon Sep 17 00:00:00 2001 +From: Carl Huang +Date: Mon, 14 Mar 2022 07:18:16 +0200 +Subject: [PATCH] ath11k: implement hardware data filter + +Host needs to set hardware data filter before entering WoW to +let firmware drop needless broadcast/mulitcast frames to avoid +frequent wakeup. Host clears hardware data filter when leaving WoW. + +Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 + +Signed-off-by: Carl Huang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1644308006-22784-4-git-send-email-quic_cjhuang@quicinc.com +--- + drivers/net/wireless/ath/ath11k/wmi.c | 33 ++++++++++++++++ + drivers/net/wireless/ath/ath11k/wmi.h | 15 +++++++ + drivers/net/wireless/ath/ath11k/wow.c | 57 +++++++++++++++++++++++++++ + 3 files changed, 105 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -8165,6 +8165,39 @@ void ath11k_wmi_detach(struct ath11k_bas + ath11k_wmi_free_dbring_caps(ab); + } + ++int ath11k_wmi_hw_data_filter_cmd(struct ath11k *ar, u32 vdev_id, ++ u32 filter_bitmap, bool enable) ++{ ++ struct wmi_hw_data_filter_cmd *cmd; ++ struct sk_buff *skb; ++ int len; ++ ++ len = sizeof(*cmd); ++ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, len); ++ ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_hw_data_filter_cmd *)skb->data; ++ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_HW_DATA_FILTER_CMD) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); ++ ++ cmd->vdev_id = vdev_id; ++ cmd->enable = enable; ++ ++ /* Set all modes in case of disable */ ++ if (cmd->enable) ++ cmd->hw_filter_bitmap = filter_bitmap; ++ else ++ cmd->hw_filter_bitmap = ((u32)~0U); ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, ++ "wmi hw data filter enable %d filter_bitmap 0x%x\n", ++ enable, filter_bitmap); ++ ++ return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_HW_DATA_FILTER_CMDID); ++} ++ + int ath11k_wmi_wow_host_wakeup_ind(struct ath11k *ar) + { + struct wmi_wow_host_wakeup_ind *cmd; +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -5390,6 +5390,19 @@ struct ath11k_wmi_base { + struct ath11k_targ_cap *targ_cap; + }; + ++/* Definition of HW data filtering */ ++enum hw_data_filter_type { ++ WMI_HW_DATA_FILTER_DROP_NON_ARP_BC = BIT(0), ++ WMI_HW_DATA_FILTER_DROP_NON_ICMPV6_MC = BIT(1), ++}; ++ ++struct wmi_hw_data_filter_cmd { ++ u32 tlv_header; ++ u32 vdev_id; ++ u32 enable; ++ u32 hw_filter_bitmap; ++} __packed; ++ + /* WOW structures */ + enum wmi_wow_wakeup_event { + WOW_BMISS_EVENT = 0, +@@ -5953,4 +5966,6 @@ int ath11k_wmi_wow_add_pattern(struct at + int ath11k_wmi_wow_add_wakeup_event(struct ath11k *ar, u32 vdev_id, + enum wmi_wow_wakeup_event event, + u32 enable); ++int ath11k_wmi_hw_data_filter_cmd(struct ath11k *ar, u32 vdev_id, ++ u32 filter_bitmap, bool enable); + #endif +--- a/drivers/net/wireless/ath/ath11k/wow.c ++++ b/drivers/net/wireless/ath/ath11k/wow.c +@@ -514,6 +514,50 @@ static int ath11k_wow_nlo_cleanup(struct + return 0; + } + ++static int ath11k_wow_set_hw_filter(struct ath11k *ar) ++{ ++ struct ath11k_vif *arvif; ++ u32 bitmap; ++ int ret; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ list_for_each_entry(arvif, &ar->arvifs, list) { ++ bitmap = WMI_HW_DATA_FILTER_DROP_NON_ICMPV6_MC | ++ WMI_HW_DATA_FILTER_DROP_NON_ARP_BC; ++ ret = ath11k_wmi_hw_data_filter_cmd(ar, arvif->vdev_id, ++ bitmap, ++ true); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to set hw data filter on vdev %i: %d\n", ++ arvif->vdev_id, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static int ath11k_wow_clear_hw_filter(struct ath11k *ar) ++{ ++ struct ath11k_vif *arvif; ++ int ret; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ list_for_each_entry(arvif, &ar->arvifs, list) { ++ ret = ath11k_wmi_hw_data_filter_cmd(ar, arvif->vdev_id, 0, false); ++ ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to clear hw data filter on vdev %i: %d\n", ++ arvif->vdev_id, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ + int ath11k_wow_op_suspend(struct ieee80211_hw *hw, + struct cfg80211_wowlan *wowlan) + { +@@ -542,6 +586,13 @@ int ath11k_wow_op_suspend(struct ieee802 + goto cleanup; + } + ++ ret = ath11k_wow_set_hw_filter(ar); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to set hw filter: %d\n", ++ ret); ++ goto cleanup; ++ } ++ + ret = ath11k_wow_enable(ar->ab); + if (ret) { + ath11k_warn(ar->ab, "failed to start wow: %d\n", ret); +@@ -610,6 +661,12 @@ int ath11k_wow_op_resume(struct ieee8021 + goto exit; + } + ++ ret = ath11k_wow_clear_hw_filter(ar); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to clear hw filter: %d\n", ret); ++ goto exit; ++ } ++ + exit: + if (ret) { + switch (ar->state) { diff --git a/package/kernel/mac80211/patches/ath11k/0196-ath11k-purge-rx-pktlog-when-entering-WoW.patch b/package/kernel/mac80211/patches/ath11k/0196-ath11k-purge-rx-pktlog-when-entering-WoW.patch new file mode 100644 index 000000000..f76533cac --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0196-ath11k-purge-rx-pktlog-when-entering-WoW.patch @@ -0,0 +1,72 @@ +From 90bf5c8d0f7ecddf96fc1cd9434af4e157b51970 Mon Sep 17 00:00:00 2001 +From: Carl Huang +Date: Mon, 14 Mar 2022 07:18:16 +0200 +Subject: [PATCH] ath11k: purge rx pktlog when entering WoW + +This change is to purge rx pktlog when entering WoW and reap +the mon_status buffer to keep it empty. When leaving WoW, host +restarts the reap timer. In WoW state, it's not allowed to feed +into mon_status rings per firmware team's recommendation. + +Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 + +Signed-off-by: Carl Huang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1644308006-22784-5-git-send-email-quic_cjhuang@quicinc.com +--- + drivers/net/wireless/ath/ath11k/wow.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/wow.c ++++ b/drivers/net/wireless/ath/ath11k/wow.c +@@ -13,6 +13,7 @@ + #include "debug.h" + #include "wmi.h" + #include "wow.h" ++#include "dp_rx.h" + + static const struct wiphy_wowlan_support ath11k_wowlan_support = { + .flags = WIPHY_WOWLAN_DISCONNECT | +@@ -566,6 +567,14 @@ int ath11k_wow_op_suspend(struct ieee802 + + mutex_lock(&ar->conf_mutex); + ++ ret = ath11k_dp_rx_pktlog_stop(ar->ab, true); ++ if (ret) { ++ ath11k_warn(ar->ab, ++ "failed to stop dp rx (and timer) pktlog during wow suspend: %d\n", ++ ret); ++ goto exit; ++ } ++ + ret = ath11k_wow_cleanup(ar); + if (ret) { + ath11k_warn(ar->ab, "failed to clear wow wakeup events: %d\n", +@@ -599,6 +608,14 @@ int ath11k_wow_op_suspend(struct ieee802 + goto cleanup; + } + ++ ret = ath11k_dp_rx_pktlog_stop(ar->ab, false); ++ if (ret) { ++ ath11k_warn(ar->ab, ++ "failed to stop dp rx pktlog during wow suspend: %d\n", ++ ret); ++ goto cleanup; ++ } ++ + ath11k_ce_stop_shadow_timers(ar->ab); + ath11k_dp_stop_shadow_timers(ar->ab); + +@@ -649,6 +666,12 @@ int ath11k_wow_op_resume(struct ieee8021 + ath11k_hif_ce_irq_enable(ar->ab); + ath11k_hif_irq_enable(ar->ab); + ++ ret = ath11k_dp_rx_pktlog_start(ar->ab); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to start rx pktlog from wow: %d\n", ret); ++ return ret; ++ } ++ + ret = ath11k_wow_wakeup(ar->ab); + if (ret) { + ath11k_warn(ar->ab, "failed to wakeup from wow: %d\n", ret); diff --git a/package/kernel/mac80211/patches/ath11k/0197-ath11k-support-ARP-and-NS-offload.patch b/package/kernel/mac80211/patches/ath11k/0197-ath11k-support-ARP-and-NS-offload.patch new file mode 100644 index 000000000..f5fe9a4dd --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0197-ath11k-support-ARP-and-NS-offload.patch @@ -0,0 +1,519 @@ +From c3c36bfe998b3ad14aa87a57037a05d861889ac8 Mon Sep 17 00:00:00 2001 +From: Carl Huang +Date: Mon, 14 Mar 2022 07:18:16 +0200 +Subject: [PATCH] ath11k: support ARP and NS offload + +Support ARP and NS offload in WoW state. + +Tested this way: put machine A with QCA6390 to WoW state, +ping/ping6 machine A from another machine B, check sniffer to see +any ARP response and Neighbour advertisement from machine A. + +Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 + +Signed-off-by: Carl Huang +Signed-off-by: Baochen Qiang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1644308006-22784-6-git-send-email-quic_cjhuang@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.h | 19 +++ + drivers/net/wireless/ath/ath11k/mac.c | 118 +++++++++++++++++++ + drivers/net/wireless/ath/ath11k/wmi.c | 155 +++++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/wmi.h | 47 ++++++++ + drivers/net/wireless/ath/ath11k/wow.c | 52 +++++++++ + 5 files changed, 391 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -213,6 +213,23 @@ enum ath11k_monitor_flags { + ATH11K_FLAG_MONITOR_VDEV_CREATED, + }; + ++#define ATH11K_IPV6_UC_TYPE 0 ++#define ATH11K_IPV6_AC_TYPE 1 ++ ++#define ATH11K_IPV6_MAX_COUNT 16 ++#define ATH11K_IPV4_MAX_COUNT 2 ++ ++struct ath11k_arp_ns_offload { ++ u8 ipv4_addr[ATH11K_IPV4_MAX_COUNT][4]; ++ u32 ipv4_count; ++ u32 ipv6_count; ++ u8 ipv6_addr[ATH11K_IPV6_MAX_COUNT][16]; ++ u8 self_ipv6_addr[ATH11K_IPV6_MAX_COUNT][16]; ++ u8 ipv6_type[ATH11K_IPV6_MAX_COUNT]; ++ bool ipv6_valid[ATH11K_IPV6_MAX_COUNT]; ++ u8 mac_addr[ETH_ALEN]; ++}; ++ + struct ath11k_vif { + u32 vdev_id; + enum wmi_vdev_type vdev_type; +@@ -264,6 +281,8 @@ struct ath11k_vif { + bool bcca_zero_sent; + bool do_not_send_tmpl; + struct ieee80211_chanctx_conf chanctx; ++ struct ath11k_arp_ns_offload arp_ns_offload; ++ + #ifdef CPTCFG_ATH11K_DEBUGFS + struct dentry *debugfs_twt; + #endif /* CPTCFG_ATH11K_DEBUGFS */ +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -6,6 +6,11 @@ + + #include + #include ++#include ++#include ++#include ++#include ++ + #include "mac.h" + #include "core.h" + #include "debug.h" +@@ -3095,6 +3100,7 @@ static void ath11k_mac_op_bss_info_chang + int ret = 0; + u8 rateidx; + u32 rate; ++ u32 ipv4_cnt; + + mutex_lock(&ar->conf_mutex); + +@@ -3387,6 +3393,18 @@ static void ath11k_mac_op_bss_info_chang + changed & BSS_CHANGED_UNSOL_BCAST_PROBE_RESP) + ath11k_mac_fils_discovery(arvif, info); + ++ if (changed & BSS_CHANGED_ARP_FILTER) { ++ ipv4_cnt = min(info->arp_addr_cnt, ATH11K_IPV4_MAX_COUNT); ++ memcpy(arvif->arp_ns_offload.ipv4_addr, info->arp_addr_list, ++ ipv4_cnt * sizeof(u32)); ++ memcpy(arvif->arp_ns_offload.mac_addr, vif->addr, ETH_ALEN); ++ arvif->arp_ns_offload.ipv4_count = ipv4_cnt; ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac arp_addr_cnt %d vif->addr %pM, offload_addr %pI4\n", ++ info->arp_addr_cnt, ++ vif->addr, arvif->arp_ns_offload.ipv4_addr); ++ } ++ + mutex_unlock(&ar->conf_mutex); + } + +@@ -8087,6 +8105,101 @@ static void ath11k_mac_op_sta_statistics + } + } + ++static void ath11k_generate_ns_mc_addr(struct ath11k *ar, ++ struct ath11k_arp_ns_offload *offload) ++{ ++ int i; ++ ++ for (i = 0; i < offload->ipv6_count; i++) { ++ offload->self_ipv6_addr[i][0] = 0xff; ++ offload->self_ipv6_addr[i][1] = 0x02; ++ offload->self_ipv6_addr[i][11] = 0x01; ++ offload->self_ipv6_addr[i][12] = 0xff; ++ offload->self_ipv6_addr[i][13] = ++ offload->ipv6_addr[i][13]; ++ offload->self_ipv6_addr[i][14] = ++ offload->ipv6_addr[i][14]; ++ offload->self_ipv6_addr[i][15] = ++ offload->ipv6_addr[i][15]; ++ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "NS solicited addr %pI6\n", ++ offload->self_ipv6_addr[i]); ++ } ++} ++ ++static void ath11k_mac_op_ipv6_changed(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct inet6_dev *idev) ++{ ++ struct ath11k *ar = hw->priv; ++ struct ath11k_arp_ns_offload *offload; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); ++ struct inet6_ifaddr *ifa6; ++ struct ifacaddr6 *ifaca6; ++ struct list_head *p; ++ u32 count, scope; ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac op ipv6 changed\n"); ++ ++ offload = &arvif->arp_ns_offload; ++ count = 0; ++ ++ read_lock_bh(&idev->lock); ++ ++ memset(offload->ipv6_addr, 0, sizeof(offload->ipv6_addr)); ++ memset(offload->self_ipv6_addr, 0, sizeof(offload->self_ipv6_addr)); ++ memcpy(offload->mac_addr, vif->addr, ETH_ALEN); ++ ++ /* get unicast address */ ++ list_for_each(p, &idev->addr_list) { ++ if (count >= ATH11K_IPV6_MAX_COUNT) ++ goto generate; ++ ++ ifa6 = list_entry(p, struct inet6_ifaddr, if_list); ++ if (ifa6->flags & IFA_F_DADFAILED) ++ continue; ++ scope = ipv6_addr_src_scope(&ifa6->addr); ++ if (scope == IPV6_ADDR_SCOPE_LINKLOCAL || ++ scope == IPV6_ADDR_SCOPE_GLOBAL) { ++ memcpy(offload->ipv6_addr[count], &ifa6->addr.s6_addr, ++ sizeof(ifa6->addr.s6_addr)); ++ offload->ipv6_type[count] = ATH11K_IPV6_UC_TYPE; ++ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac count %d ipv6 uc %pI6 scope %d\n", ++ count, offload->ipv6_addr[count], ++ scope); ++ count++; ++ } else { ++ ath11k_warn(ar->ab, "Unsupported ipv6 scope: %d\n", scope); ++ } ++ } ++ ++ /* get anycast address */ ++ for (ifaca6 = idev->ac_list; ifaca6; ifaca6 = ifaca6->aca_next) { ++ if (count >= ATH11K_IPV6_MAX_COUNT) ++ goto generate; ++ ++ scope = ipv6_addr_src_scope(&ifaca6->aca_addr); ++ if (scope == IPV6_ADDR_SCOPE_LINKLOCAL || ++ scope == IPV6_ADDR_SCOPE_GLOBAL) { ++ memcpy(offload->ipv6_addr[count], &ifaca6->aca_addr, ++ sizeof(ifaca6->aca_addr)); ++ offload->ipv6_type[count] = ATH11K_IPV6_AC_TYPE; ++ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac count %d ipv6 ac %pI6 scope %d\n", ++ count, offload->ipv6_addr[count], ++ scope); ++ count++; ++ } else { ++ ath11k_warn(ar->ab, "Unsupported ipv scope: %d\n", scope); ++ } ++ } ++ ++generate: ++ offload->ipv6_count = count; ++ read_unlock_bh(&idev->lock); ++ ++ /* generate ns multicast address */ ++ ath11k_generate_ns_mc_addr(ar, offload); ++} ++ + static const struct ieee80211_ops ath11k_ops = { + .tx = ath11k_mac_op_tx, + .start = ath11k_mac_op_start, +@@ -8132,6 +8245,11 @@ static const struct ieee80211_ops ath11k + #ifdef CPTCFG_ATH11K_DEBUGFS + .sta_add_debugfs = ath11k_debugfs_sta_op_add, + #endif ++ ++#if IS_ENABLED(CONFIG_IPV6) ++ .ipv6_addr_change = ath11k_mac_op_ipv6_changed, ++#endif ++ + }; + + static void ath11k_mac_update_ch_list(struct ath11k *ar, +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -8580,3 +8580,158 @@ int ath11k_wmi_wow_config_pno(struct ath + return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID); + } + ++static void ath11k_wmi_fill_ns_offload(struct ath11k *ar, ++ struct ath11k_arp_ns_offload *offload, ++ u8 **ptr, ++ bool enable, ++ bool ext) ++{ ++ struct wmi_ns_offload_tuple *ns; ++ struct wmi_tlv *tlv; ++ u8 *buf_ptr = *ptr; ++ u32 ns_cnt, ns_ext_tuples; ++ int i, max_offloads; ++ ++ ns_cnt = offload->ipv6_count; ++ ++ tlv = (struct wmi_tlv *)buf_ptr; ++ ++ if (ext) { ++ ns_ext_tuples = offload->ipv6_count - WMI_MAX_NS_OFFLOADS; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_STRUCT) | ++ FIELD_PREP(WMI_TLV_LEN, ns_ext_tuples * sizeof(*ns)); ++ i = WMI_MAX_NS_OFFLOADS; ++ max_offloads = offload->ipv6_count; ++ } else { ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_STRUCT) | ++ FIELD_PREP(WMI_TLV_LEN, WMI_MAX_NS_OFFLOADS * sizeof(*ns)); ++ i = 0; ++ max_offloads = WMI_MAX_NS_OFFLOADS; ++ } ++ ++ buf_ptr += sizeof(*tlv); ++ ++ for (; i < max_offloads; i++) { ++ ns = (struct wmi_ns_offload_tuple *)buf_ptr; ++ ns->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_NS_OFFLOAD_TUPLE) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*ns) - TLV_HDR_SIZE); ++ ++ if (enable) { ++ if (i < ns_cnt) ++ ns->flags |= WMI_NSOL_FLAGS_VALID; ++ ++ memcpy(ns->target_ipaddr[0], offload->ipv6_addr[i], 16); ++ memcpy(ns->solicitation_ipaddr, offload->self_ipv6_addr[i], 16); ++ ath11k_ce_byte_swap(ns->target_ipaddr[0], 16); ++ ath11k_ce_byte_swap(ns->solicitation_ipaddr, 16); ++ ++ if (offload->ipv6_type[i]) ++ ns->flags |= WMI_NSOL_FLAGS_IS_IPV6_ANYCAST; ++ ++ memcpy(ns->target_mac.addr, offload->mac_addr, ETH_ALEN); ++ ath11k_ce_byte_swap(ns->target_mac.addr, 8); ++ ++ if (ns->target_mac.word0 != 0 || ++ ns->target_mac.word1 != 0) { ++ ns->flags |= WMI_NSOL_FLAGS_MAC_VALID; ++ } ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, ++ "wmi index %d ns_solicited %pI6 target %pI6", ++ i, ns->solicitation_ipaddr, ++ ns->target_ipaddr[0]); ++ } ++ ++ buf_ptr += sizeof(*ns); ++ } ++ ++ *ptr = buf_ptr; ++} ++ ++static void ath11k_wmi_fill_arp_offload(struct ath11k *ar, ++ struct ath11k_arp_ns_offload *offload, ++ u8 **ptr, ++ bool enable) ++{ ++ struct wmi_arp_offload_tuple *arp; ++ struct wmi_tlv *tlv; ++ u8 *buf_ptr = *ptr; ++ int i; ++ ++ /* fill arp tuple */ ++ tlv = (struct wmi_tlv *)buf_ptr; ++ tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_STRUCT) | ++ FIELD_PREP(WMI_TLV_LEN, WMI_MAX_ARP_OFFLOADS * sizeof(*arp)); ++ buf_ptr += sizeof(*tlv); ++ ++ for (i = 0; i < WMI_MAX_ARP_OFFLOADS; i++) { ++ arp = (struct wmi_arp_offload_tuple *)buf_ptr; ++ arp->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARP_OFFLOAD_TUPLE) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*arp) - TLV_HDR_SIZE); ++ ++ if (enable && i < offload->ipv4_count) { ++ /* Copy the target ip addr and flags */ ++ arp->flags = WMI_ARPOL_FLAGS_VALID; ++ memcpy(arp->target_ipaddr, offload->ipv4_addr[i], 4); ++ ath11k_ce_byte_swap(arp->target_ipaddr, 4); ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "wmi arp offload address %pI4", ++ arp->target_ipaddr); ++ } ++ ++ buf_ptr += sizeof(*arp); ++ } ++ ++ *ptr = buf_ptr; ++} ++ ++int ath11k_wmi_arp_ns_offload(struct ath11k *ar, ++ struct ath11k_vif *arvif, bool enable) ++{ ++ struct ath11k_arp_ns_offload *offload; ++ struct wmi_set_arp_ns_offload_cmd *cmd; ++ struct wmi_tlv *tlv; ++ struct sk_buff *skb; ++ u8 *buf_ptr; ++ size_t len; ++ u8 ns_cnt, ns_ext_tuples = 0; ++ ++ offload = &arvif->arp_ns_offload; ++ ns_cnt = offload->ipv6_count; ++ ++ len = sizeof(*cmd) + ++ sizeof(*tlv) + ++ WMI_MAX_NS_OFFLOADS * sizeof(struct wmi_ns_offload_tuple) + ++ sizeof(*tlv) + ++ WMI_MAX_ARP_OFFLOADS * sizeof(struct wmi_arp_offload_tuple); ++ ++ if (ns_cnt > WMI_MAX_NS_OFFLOADS) { ++ ns_ext_tuples = ns_cnt - WMI_MAX_NS_OFFLOADS; ++ len += sizeof(*tlv) + ++ ns_ext_tuples * sizeof(struct wmi_ns_offload_tuple); ++ } ++ ++ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, len); ++ if (!skb) ++ return -ENOMEM; ++ ++ buf_ptr = skb->data; ++ cmd = (struct wmi_set_arp_ns_offload_cmd *)buf_ptr; ++ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, ++ WMI_TAG_SET_ARP_NS_OFFLOAD_CMD) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); ++ ++ cmd->flags = 0; ++ cmd->vdev_id = arvif->vdev_id; ++ cmd->num_ns_ext_tuples = ns_ext_tuples; ++ ++ buf_ptr += sizeof(*cmd); ++ ++ ath11k_wmi_fill_ns_offload(ar, offload, &buf_ptr, enable, 0); ++ ath11k_wmi_fill_arp_offload(ar, offload, &buf_ptr, enable); ++ ++ if (ns_ext_tuples) ++ ath11k_wmi_fill_ns_offload(ar, offload, &buf_ptr, enable, 1); ++ ++ return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_SET_ARP_NS_OFFLOAD_CMDID); ++} +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -13,6 +13,7 @@ struct ath11k_base; + struct ath11k; + struct ath11k_fw_stats; + struct ath11k_fw_dbglog; ++struct ath11k_vif; + + #define PSOC_HOST_MAX_NUM_SS (8) + +@@ -5796,6 +5797,49 @@ struct wmi_wow_nlo_config_cmd { + */ + } __packed; + ++#define WMI_MAX_NS_OFFLOADS 2 ++#define WMI_MAX_ARP_OFFLOADS 2 ++ ++#define WMI_ARPOL_FLAGS_VALID BIT(0) ++#define WMI_ARPOL_FLAGS_MAC_VALID BIT(1) ++#define WMI_ARPOL_FLAGS_REMOTE_IP_VALID BIT(2) ++ ++struct wmi_arp_offload_tuple { ++ u32 tlv_header; ++ u32 flags; ++ u8 target_ipaddr[4]; ++ u8 remote_ipaddr[4]; ++ struct wmi_mac_addr target_mac; ++} __packed; ++ ++#define WMI_NSOL_FLAGS_VALID BIT(0) ++#define WMI_NSOL_FLAGS_MAC_VALID BIT(1) ++#define WMI_NSOL_FLAGS_REMOTE_IP_VALID BIT(2) ++#define WMI_NSOL_FLAGS_IS_IPV6_ANYCAST BIT(3) ++ ++#define WMI_NSOL_MAX_TARGET_IPS 2 ++ ++struct wmi_ns_offload_tuple { ++ u32 tlv_header; ++ u32 flags; ++ u8 target_ipaddr[WMI_NSOL_MAX_TARGET_IPS][16]; ++ u8 solicitation_ipaddr[16]; ++ u8 remote_ipaddr[16]; ++ struct wmi_mac_addr target_mac; ++} __packed; ++ ++struct wmi_set_arp_ns_offload_cmd { ++ u32 tlv_header; ++ u32 flags; ++ u32 vdev_id; ++ u32 num_ns_ext_tuples; ++ /* The TLVs follow: ++ * wmi_ns_offload_tuple ns_tuples[WMI_MAX_NS_OFFLOADS]; ++ * wmi_arp_offload_tuple arp_tuples[WMI_MAX_ARP_OFFLOADS]; ++ * wmi_ns_offload_tuple ns_ext_tuples[num_ns_ext_tuples]; ++ */ ++} __packed; ++ + 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); +@@ -5968,4 +6012,7 @@ int ath11k_wmi_wow_add_wakeup_event(stru + u32 enable); + int ath11k_wmi_hw_data_filter_cmd(struct ath11k *ar, u32 vdev_id, + u32 filter_bitmap, bool enable); ++int ath11k_wmi_arp_ns_offload(struct ath11k *ar, ++ struct ath11k_vif *arvif, bool enable); ++ + #endif +--- a/drivers/net/wireless/ath/ath11k/wow.c ++++ b/drivers/net/wireless/ath/ath11k/wow.c +@@ -559,6 +559,43 @@ static int ath11k_wow_clear_hw_filter(st + return 0; + } + ++static int ath11k_wow_arp_ns_offload(struct ath11k *ar, bool enable) ++{ ++ struct ath11k_vif *arvif; ++ int ret; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ list_for_each_entry(arvif, &ar->arvifs, list) { ++ if (arvif->vdev_type != WMI_VDEV_TYPE_STA) ++ continue; ++ ++ ret = ath11k_wmi_arp_ns_offload(ar, arvif, enable); ++ ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to set arp ns offload vdev %i: enable %d, ret %d\n", ++ arvif->vdev_id, enable, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ ++static int ath11k_wow_protocol_offload(struct ath11k *ar, bool enable) ++{ ++ int ret; ++ ++ ret = ath11k_wow_arp_ns_offload(ar, enable); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to offload ARP and NS %d %d\n", ++ enable, ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ + int ath11k_wow_op_suspend(struct ieee80211_hw *hw, + struct cfg80211_wowlan *wowlan) + { +@@ -589,6 +626,14 @@ int ath11k_wow_op_suspend(struct ieee802 + goto cleanup; + } + ++ ret = ath11k_wow_protocol_offload(ar, true); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to set wow protocol offload events: %d\n", ++ ret); ++ goto cleanup; ++ } ++ ++ ath11k_mac_drain_tx(ar); + ret = ath11k_mac_wait_tx_complete(ar); + if (ret) { + ath11k_warn(ar->ab, "failed to wait tx complete: %d\n", ret); +@@ -690,6 +735,13 @@ int ath11k_wow_op_resume(struct ieee8021 + goto exit; + } + ++ ret = ath11k_wow_protocol_offload(ar, false); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to clear wow protocol offload events: %d\n", ++ ret); ++ goto exit; ++ } ++ + exit: + if (ret) { + switch (ar->state) { diff --git a/package/kernel/mac80211/patches/ath11k/0198-ath11k-support-GTK-rekey-offload.patch b/package/kernel/mac80211/patches/ath11k/0198-ath11k-support-GTK-rekey-offload.patch new file mode 100644 index 000000000..7cc33abaf --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0198-ath11k-support-GTK-rekey-offload.patch @@ -0,0 +1,384 @@ +From a16d9b50cfbaf112401b8e5ccfa852709f498cd4 Mon Sep 17 00:00:00 2001 +From: Carl Huang +Date: Mon, 14 Mar 2022 07:18:16 +0200 +Subject: [PATCH] ath11k: support GTK rekey offload + +Host sets GTK related info to firmware before WoW is enabled, and +gets rekey replay_count and then disables GTK rekey when WoW quits. + +Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 + +Signed-off-by: Carl Huang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1644308006-22784-7-git-send-email-quic_cjhuang@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.h | 8 ++ + drivers/net/wireless/ath/ath11k/mac.c | 37 ++++++++ + drivers/net/wireless/ath/ath11k/wmi.c | 119 +++++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/wmi.h | 49 ++++++++++ + drivers/net/wireless/ath/ath11k/wow.c | 46 +++++++++- + 5 files changed, 258 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -230,6 +230,13 @@ struct ath11k_arp_ns_offload { + u8 mac_addr[ETH_ALEN]; + }; + ++struct ath11k_rekey_data { ++ u8 kck[NL80211_KCK_LEN]; ++ u8 kek[NL80211_KCK_LEN]; ++ u64 replay_ctr; ++ bool enable_offload; ++}; ++ + struct ath11k_vif { + u32 vdev_id; + enum wmi_vdev_type vdev_type; +@@ -282,6 +289,7 @@ struct ath11k_vif { + bool do_not_send_tmpl; + struct ieee80211_chanctx_conf chanctx; + struct ath11k_arp_ns_offload arp_ns_offload; ++ struct ath11k_rekey_data rekey_data; + + #ifdef CPTCFG_ATH11K_DEBUGFS + struct dentry *debugfs_twt; +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -2757,6 +2757,7 @@ static void ath11k_bss_assoc(struct ieee + } + + arvif->is_up = true; ++ arvif->rekey_data.enable_offload = false; + + ath11k_dbg(ar->ab, ATH11K_DBG_MAC, + "mac vdev %d up (associated) bssid %pM aid %d\n", +@@ -2814,6 +2815,8 @@ static void ath11k_bss_disassoc(struct i + + arvif->is_up = false; + ++ memset(&arvif->rekey_data, 0, sizeof(arvif->rekey_data)); ++ + cancel_delayed_work_sync(&arvif->connection_loss_work); + } + +@@ -8200,6 +8203,39 @@ generate: + ath11k_generate_ns_mc_addr(ar, offload); + } + ++static void ath11k_mac_op_set_rekey_data(struct ieee80211_hw *hw, ++ struct ieee80211_vif *vif, ++ struct cfg80211_gtk_rekey_data *data) ++{ ++ struct ath11k *ar = hw->priv; ++ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); ++ struct ath11k_rekey_data *rekey_data = &arvif->rekey_data; ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac set rekey data vdev %d\n", ++ arvif->vdev_id); ++ ++ mutex_lock(&ar->conf_mutex); ++ ++ memcpy(rekey_data->kck, data->kck, NL80211_KCK_LEN); ++ memcpy(rekey_data->kek, data->kek, NL80211_KEK_LEN); ++ ++ /* The supplicant works on big-endian, the firmware expects it on ++ * little endian. ++ */ ++ rekey_data->replay_ctr = get_unaligned_be64(data->replay_ctr); ++ ++ arvif->rekey_data.enable_offload = true; ++ ++ ath11k_dbg_dump(ar->ab, ATH11K_DBG_MAC, "kck", NULL, ++ rekey_data->kck, NL80211_KCK_LEN); ++ ath11k_dbg_dump(ar->ab, ATH11K_DBG_MAC, "kek", NULL, ++ rekey_data->kck, NL80211_KEK_LEN); ++ ath11k_dbg_dump(ar->ab, ATH11K_DBG_MAC, "replay ctr", NULL, ++ &rekey_data->replay_ctr, sizeof(rekey_data->replay_ctr)); ++ ++ mutex_unlock(&ar->conf_mutex); ++} ++ + static const struct ieee80211_ops ath11k_ops = { + .tx = ath11k_mac_op_tx, + .start = ath11k_mac_op_start, +@@ -8214,6 +8250,7 @@ static const struct ieee80211_ops ath11k + .hw_scan = ath11k_mac_op_hw_scan, + .cancel_hw_scan = ath11k_mac_op_cancel_hw_scan, + .set_key = ath11k_mac_op_set_key, ++ .set_rekey_data = ath11k_mac_op_set_rekey_data, + .sta_state = ath11k_mac_op_sta_state, + .sta_set_4addr = ath11k_mac_op_sta_set_4addr, + .sta_set_txpwr = ath11k_mac_op_sta_set_txpwr, +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -7765,6 +7765,56 @@ exit: + kfree(tb); + } + ++static void ath11k_wmi_gtk_offload_status_event(struct ath11k_base *ab, ++ struct sk_buff *skb) ++{ ++ const void **tb; ++ const struct wmi_gtk_offload_status_event *ev; ++ struct ath11k_vif *arvif; ++ __be64 replay_ctr_be; ++ u64 replay_ctr; ++ 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); ++ return; ++ } ++ ++ ev = tb[WMI_TAG_GTK_OFFLOAD_STATUS_EVENT]; ++ if (!ev) { ++ ath11k_warn(ab, "failed to fetch gtk offload status ev"); ++ kfree(tb); ++ return; ++ } ++ ++ arvif = ath11k_mac_get_arvif_by_vdev_id(ab, ev->vdev_id); ++ if (!arvif) { ++ ath11k_warn(ab, "failed to get arvif for vdev_id:%d\n", ++ ev->vdev_id); ++ kfree(tb); ++ return; ++ } ++ ++ ath11k_dbg(ab, ATH11K_DBG_WMI, "wmi gtk offload event refresh_cnt %d\n", ++ ev->refresh_cnt); ++ ath11k_dbg_dump(ab, ATH11K_DBG_WMI, "replay_cnt", ++ NULL, ev->replay_ctr.counter, GTK_REPLAY_COUNTER_BYTES); ++ ++ replay_ctr = ev->replay_ctr.word1; ++ replay_ctr = (replay_ctr << 32) | ev->replay_ctr.word0; ++ arvif->rekey_data.replay_ctr = replay_ctr; ++ ++ /* supplicant expects big-endian replay counter */ ++ replay_ctr_be = cpu_to_be64(replay_ctr); ++ ++ ieee80211_gtk_rekey_notify(arvif->vif, arvif->bssid, ++ (void *)&replay_ctr_be, GFP_KERNEL); ++ ++ kfree(tb); ++} ++ + static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb) + { + struct wmi_cmd_hdr *cmd_hdr; +@@ -7896,6 +7946,9 @@ static void ath11k_wmi_tlv_op_rx(struct + case WMI_DIAG_EVENTID: + ath11k_wmi_diag_event(ab, skb); + break; ++ case WMI_GTK_OFFLOAD_STATUS_EVENTID: ++ ath11k_wmi_gtk_offload_status_event(ab, skb); ++ break; + /* TODO: Add remaining events */ + default: + ath11k_dbg(ab, ATH11K_DBG_WMI, "Unknown eventid: 0x%x\n", id); +@@ -8735,3 +8788,69 @@ int ath11k_wmi_arp_ns_offload(struct ath + + return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_SET_ARP_NS_OFFLOAD_CMDID); + } ++ ++int ath11k_wmi_gtk_rekey_offload(struct ath11k *ar, ++ struct ath11k_vif *arvif, bool enable) ++{ ++ struct wmi_gtk_rekey_offload_cmd *cmd; ++ struct ath11k_rekey_data *rekey_data = &arvif->rekey_data; ++ int len; ++ struct sk_buff *skb; ++ __le64 replay_ctr; ++ ++ len = sizeof(*cmd); ++ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, len); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_gtk_rekey_offload_cmd *)skb->data; ++ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_GTK_OFFLOAD_CMD) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); ++ ++ cmd->vdev_id = arvif->vdev_id; ++ ++ if (enable) { ++ cmd->flags = GTK_OFFLOAD_ENABLE_OPCODE; ++ ++ /* the length in rekey_data and cmd is equal */ ++ memcpy(cmd->kck, rekey_data->kck, sizeof(cmd->kck)); ++ ath11k_ce_byte_swap(cmd->kck, GTK_OFFLOAD_KEK_BYTES); ++ memcpy(cmd->kek, rekey_data->kek, sizeof(cmd->kek)); ++ ath11k_ce_byte_swap(cmd->kek, GTK_OFFLOAD_KEK_BYTES); ++ ++ replay_ctr = cpu_to_le64(rekey_data->replay_ctr); ++ memcpy(cmd->replay_ctr, &replay_ctr, ++ sizeof(replay_ctr)); ++ ath11k_ce_byte_swap(cmd->replay_ctr, GTK_REPLAY_COUNTER_BYTES); ++ } else { ++ cmd->flags = GTK_OFFLOAD_DISABLE_OPCODE; ++ } ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "offload gtk rekey vdev: %d %d\n", ++ arvif->vdev_id, enable); ++ return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_GTK_OFFLOAD_CMDID); ++} ++ ++int ath11k_wmi_gtk_rekey_getinfo(struct ath11k *ar, ++ struct ath11k_vif *arvif) ++{ ++ struct wmi_gtk_rekey_offload_cmd *cmd; ++ int len; ++ struct sk_buff *skb; ++ ++ len = sizeof(*cmd); ++ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, len); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_gtk_rekey_offload_cmd *)skb->data; ++ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_GTK_OFFLOAD_CMD) | ++ FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); ++ ++ cmd->vdev_id = arvif->vdev_id; ++ cmd->flags = GTK_OFFLOAD_REQUEST_STATUS_OPCODE; ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_WMI, "get gtk rekey vdev_id: %d\n", ++ arvif->vdev_id); ++ return ath11k_wmi_cmd_send(ar->wmi, skb, WMI_GTK_OFFLOAD_CMDID); ++} +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -5840,6 +5840,51 @@ struct wmi_set_arp_ns_offload_cmd { + */ + } __packed; + ++#define GTK_OFFLOAD_OPCODE_MASK 0xFF000000 ++#define GTK_OFFLOAD_ENABLE_OPCODE 0x01000000 ++#define GTK_OFFLOAD_DISABLE_OPCODE 0x02000000 ++#define GTK_OFFLOAD_REQUEST_STATUS_OPCODE 0x04000000 ++ ++#define GTK_OFFLOAD_KEK_BYTES 16 ++#define GTK_OFFLOAD_KCK_BYTES 16 ++#define GTK_REPLAY_COUNTER_BYTES 8 ++#define WMI_MAX_KEY_LEN 32 ++#define IGTK_PN_SIZE 6 ++ ++struct wmi_replayc_cnt { ++ union { ++ u8 counter[GTK_REPLAY_COUNTER_BYTES]; ++ struct { ++ u32 word0; ++ u32 word1; ++ } __packed; ++ } __packed; ++} __packed; ++ ++struct wmi_gtk_offload_status_event { ++ u32 vdev_id; ++ u32 flags; ++ u32 refresh_cnt; ++ struct wmi_replayc_cnt replay_ctr; ++ u8 igtk_key_index; ++ u8 igtk_key_length; ++ u8 igtk_key_rsc[IGTK_PN_SIZE]; ++ u8 igtk_key[WMI_MAX_KEY_LEN]; ++ u8 gtk_key_index; ++ u8 gtk_key_length; ++ u8 gtk_key_rsc[GTK_REPLAY_COUNTER_BYTES]; ++ u8 gtk_key[WMI_MAX_KEY_LEN]; ++} __packed; ++ ++struct wmi_gtk_rekey_offload_cmd { ++ u32 tlv_header; ++ u32 vdev_id; ++ u32 flags; ++ u8 kek[GTK_OFFLOAD_KEK_BYTES]; ++ u8 kck[GTK_OFFLOAD_KCK_BYTES]; ++ u8 replay_ctr[GTK_REPLAY_COUNTER_BYTES]; ++} __packed; ++ + 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); +@@ -6014,5 +6059,9 @@ int ath11k_wmi_hw_data_filter_cmd(struct + u32 filter_bitmap, bool enable); + int ath11k_wmi_arp_ns_offload(struct ath11k *ar, + struct ath11k_vif *arvif, bool enable); ++int ath11k_wmi_gtk_rekey_offload(struct ath11k *ar, ++ struct ath11k_vif *arvif, bool enable); ++int ath11k_wmi_gtk_rekey_getinfo(struct ath11k *ar, ++ struct ath11k_vif *arvif); + + #endif +--- a/drivers/net/wireless/ath/ath11k/wow.c ++++ b/drivers/net/wireless/ath/ath11k/wow.c +@@ -17,7 +17,9 @@ + + static const struct wiphy_wowlan_support ath11k_wowlan_support = { + .flags = WIPHY_WOWLAN_DISCONNECT | +- WIPHY_WOWLAN_MAGIC_PKT, ++ WIPHY_WOWLAN_MAGIC_PKT | ++ WIPHY_WOWLAN_SUPPORTS_GTK_REKEY | ++ WIPHY_WOWLAN_GTK_REKEY_FAILURE, + .pattern_min_len = WOW_MIN_PATTERN_SIZE, + .pattern_max_len = WOW_MAX_PATTERN_SIZE, + .max_pkt_offset = WOW_MAX_PKT_OFFSET, +@@ -582,6 +584,41 @@ static int ath11k_wow_arp_ns_offload(str + return 0; + } + ++static int ath11k_gtk_rekey_offload(struct ath11k *ar, bool enable) ++{ ++ struct ath11k_vif *arvif; ++ int ret; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ list_for_each_entry(arvif, &ar->arvifs, list) { ++ if (arvif->vdev_type != WMI_VDEV_TYPE_STA || ++ !arvif->is_up || ++ !arvif->rekey_data.enable_offload) ++ continue; ++ ++ /* get rekey info before disable rekey offload */ ++ if (!enable) { ++ ret = ath11k_wmi_gtk_rekey_getinfo(ar, arvif); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to request rekey info vdev %i, ret %d\n", ++ arvif->vdev_id, ret); ++ return ret; ++ } ++ } ++ ++ ret = ath11k_wmi_gtk_rekey_offload(ar, arvif, enable); ++ ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to offload gtk reky vdev %i: enable %d, ret %d\n", ++ arvif->vdev_id, enable, ret); ++ return ret; ++ } ++ } ++ ++ return 0; ++} ++ + static int ath11k_wow_protocol_offload(struct ath11k *ar, bool enable) + { + int ret; +@@ -592,6 +629,13 @@ static int ath11k_wow_protocol_offload(s + enable, ret); + return ret; + } ++ ++ ret = ath11k_gtk_rekey_offload(ar, enable); ++ if (ret) { ++ ath11k_warn(ar->ab, "failed to offload gtk rekey %d %d\n", ++ enable, ret); ++ return ret; ++ } + + return 0; + } diff --git a/package/kernel/mac80211/patches/ath11k/0199-ath11k-Refactor-the-peer-delete.patch b/package/kernel/mac80211/patches/ath11k/0199-ath11k-Refactor-the-peer-delete.patch new file mode 100644 index 000000000..c86839b09 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0199-ath11k-Refactor-the-peer-delete.patch @@ -0,0 +1,103 @@ +From 997dc60f0855b39aec0400511b37d65781da9255 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Periyasamy +Date: Mon, 28 Feb 2022 10:24:39 +0530 +Subject: [PATCH] ath11k: Refactor the peer delete + +Introduce new helper function for peer delete to reuse this logic +in all peer cleanup procedures. Found this in code review. +Also this change is applicable for all the platform. + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01067-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Karthikeyan Periyasamy +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1646024079-26391-1-git-send-email-quic_periyasa@quicinc.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 16 +++---------- + drivers/net/wireless/ath/ath11k/peer.c | 31 +++++++++++++------------- + 2 files changed, 19 insertions(+), 28 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -6387,22 +6387,12 @@ static int ath11k_mac_op_add_interface(s + + err_peer_del: + if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { +- reinit_completion(&ar->peer_delete_done); +- +- fbret = ath11k_wmi_send_peer_delete_cmd(ar, vif->addr, +- arvif->vdev_id); ++ fbret = ath11k_peer_delete(ar, arvif->vdev_id, vif->addr); + if (fbret) { +- ath11k_warn(ar->ab, "failed to delete peer vdev_id %d addr %pM\n", +- arvif->vdev_id, vif->addr); ++ ath11k_warn(ar->ab, "fallback fail to delete peer addr %pM vdev_id %d ret %d\n", ++ vif->addr, arvif->vdev_id, fbret); + goto err; + } +- +- fbret = ath11k_wait_for_peer_delete_done(ar, arvif->vdev_id, +- vif->addr); +- if (fbret) +- goto err; +- +- ar->num_peers--; + } + + err_vdev_del: +--- a/drivers/net/wireless/ath/ath11k/peer.c ++++ b/drivers/net/wireless/ath/ath11k/peer.c +@@ -217,7 +217,7 @@ int ath11k_wait_for_peer_delete_done(str + return 0; + } + +-int ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, u8 *addr) ++static int __ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, const u8 *addr) + { + int ret; + +@@ -237,6 +237,19 @@ int ath11k_peer_delete(struct ath11k *ar + if (ret) + return ret; + ++ return 0; ++} ++ ++int ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, u8 *addr) ++{ ++ int ret; ++ ++ lockdep_assert_held(&ar->conf_mutex); ++ ++ ret = __ath11k_peer_delete(ar, vdev_id, addr); ++ if (ret) ++ return ret; ++ + ar->num_peers--; + + return 0; +@@ -323,22 +336,10 @@ int ath11k_peer_create(struct ath11k *ar + return 0; + + cleanup: +- reinit_completion(&ar->peer_delete_done); +- +- fbret = ath11k_wmi_send_peer_delete_cmd(ar, param->peer_addr, +- param->vdev_id); +- if (fbret) { +- ath11k_warn(ar->ab, "failed to delete peer vdev_id %d addr %pM\n", +- param->vdev_id, param->peer_addr); +- goto exit; +- } +- +- fbret = ath11k_wait_for_peer_delete_done(ar, param->vdev_id, +- param->peer_addr); ++ fbret = __ath11k_peer_delete(ar, param->vdev_id, param->peer_addr); + if (fbret) +- ath11k_warn(ar->ab, "failed wait for peer %pM delete done id %d fallback ret %d\n", ++ ath11k_warn(ar->ab, "failed peer %pM delete vdev_id %d fallback ret %d\n", + param->peer_addr, param->vdev_id, fbret); + +-exit: + return ret; + } diff --git a/package/kernel/mac80211/patches/ath11k/0200-ath11k-change-fw-build-id-format-in-driver-init-log.patch b/package/kernel/mac80211/patches/ath11k/0200-ath11k-change-fw-build-id-format-in-driver-init-log.patch new file mode 100644 index 000000000..85c138049 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0200-ath11k-change-fw-build-id-format-in-driver-init-log.patch @@ -0,0 +1,65 @@ +From 72a9bff386545d3f8e9c432cb8e036272ad4e1fa Mon Sep 17 00:00:00 2001 +From: Hari Chandrakanthan +Date: Wed, 9 Mar 2022 16:54:25 +0530 +Subject: [PATCH] ath11k: change fw build id format in driver init log + +Currently fw build id is printed during init as follows. + +fw_version 0x250684a5 fw_build_timestamp 2021-07-13 10:57 +fw_build_id QC_IMAGE_VERSION_STRING=WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 + +The string "QC_IMAGE_VERSION_STRING=" is removed from the log +to improve readability. + +With this patch the fw build id is printed during init as follows. +fw_version 0x250684a5 fw_build_timestamp 2021-07-13 10:57 +fw_build_id WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Hari Chandrakanthan +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1646825065-7736-1-git-send-email-quic_haric@quicinc.com +--- + drivers/net/wireless/ath/ath11k/qmi.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -16,6 +16,8 @@ + #define SLEEP_CLOCK_SELECT_INTERNAL_BIT 0x02 + #define HOST_CSTATE_BIT 0x04 + ++#define FW_BUILD_ID_MASK "QC_IMAGE_VERSION_STRING=" ++ + bool ath11k_cold_boot_cal = 1; + EXPORT_SYMBOL(ath11k_cold_boot_cal); + module_param_named(cold_boot_cal, ath11k_cold_boot_cal, bool, 0644); +@@ -2008,6 +2010,8 @@ static int ath11k_qmi_request_target_cap + struct qmi_txn txn; + int ret = 0; + int r; ++ char *fw_build_id; ++ int fw_build_id_mask_len; + + memset(&req, 0, sizeof(req)); + memset(&resp, 0, sizeof(resp)); +@@ -2073,6 +2077,11 @@ static int ath11k_qmi_request_target_cap + ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi cal data supported from eeprom\n"); + } + ++ fw_build_id = ab->qmi.target.fw_build_id; ++ fw_build_id_mask_len = strlen(FW_BUILD_ID_MASK); ++ if (!strncmp(fw_build_id, FW_BUILD_ID_MASK, fw_build_id_mask_len)) ++ fw_build_id = fw_build_id + fw_build_id_mask_len; ++ + ath11k_info(ab, "chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 0x%x\n", + ab->qmi.target.chip_id, ab->qmi.target.chip_family, + ab->qmi.target.board_id, ab->qmi.target.soc_id); +@@ -2080,7 +2089,7 @@ static int ath11k_qmi_request_target_cap + ath11k_info(ab, "fw_version 0x%x fw_build_timestamp %s fw_build_id %s", + ab->qmi.target.fw_version, + ab->qmi.target.fw_build_timestamp, +- ab->qmi.target.fw_build_id); ++ fw_build_id); + + r = ath11k_core_check_dt(ab); + if (r) diff --git a/package/kernel/mac80211/patches/ath11k/0201-ath11k-acquire-ab-base_lock-in-unassign-when-finding.patch b/package/kernel/mac80211/patches/ath11k/0201-ath11k-acquire-ab-base_lock-in-unassign-when-finding.patch new file mode 100644 index 000000000..98d06d6d6 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0201-ath11k-acquire-ab-base_lock-in-unassign-when-finding.patch @@ -0,0 +1,54 @@ +From 2db80f93869d491be57cbc2b36f30d0d3a0e5bde Mon Sep 17 00:00:00 2001 +From: Niels Dossche +Date: Mon, 21 Mar 2022 12:58:23 +0200 +Subject: [PATCH] ath11k: acquire ab->base_lock in unassign when finding the + peer by addr + +ath11k_peer_find_by_addr states via lockdep that ab->base_lock must be +held when calling that function in order to protect the list. All +callers except ath11k_mac_op_unassign_vif_chanctx have that lock +acquired when calling ath11k_peer_find_by_addr. That lock is also not +transitively held by a path towards ath11k_mac_op_unassign_vif_chanctx. +The solution is to acquire the lock when calling +ath11k_peer_find_by_addr inside ath11k_mac_op_unassign_vif_chanctx. + +I am currently working on a static analyser to detect missing locks and +this was a reported case. I manually verified the report by looking at +the code, but I do not have real hardware so this is compile tested +only. + +Fixes: 701e48a43e15 ("ath11k: add packet log support for QCA6390") +Signed-off-by: Niels Dossche +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220314215253.92658-1-dossche.niels@gmail.com +--- + drivers/net/wireless/ath/ath11k/mac.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -7133,6 +7133,7 @@ ath11k_mac_op_unassign_vif_chanctx(struc + struct ath11k *ar = hw->priv; + struct ath11k_base *ab = ar->ab; + struct ath11k_vif *arvif = (void *)vif->drv_priv; ++ struct ath11k_peer *peer; + int ret; + + mutex_lock(&ar->conf_mutex); +@@ -7144,9 +7145,13 @@ ath11k_mac_op_unassign_vif_chanctx(struc + WARN_ON(!arvif->is_started); + + if (ab->hw_params.vdev_start_delay && +- arvif->vdev_type == WMI_VDEV_TYPE_MONITOR && +- ath11k_peer_find_by_addr(ab, ar->mac_addr)) +- ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); ++ arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { ++ spin_lock_bh(&ab->base_lock); ++ peer = ath11k_peer_find_by_addr(ab, ar->mac_addr); ++ spin_unlock_bh(&ab->base_lock); ++ if (peer) ++ ath11k_peer_delete(ar, arvif->vdev_id, ar->mac_addr); ++ } + + if (arvif->vdev_type == WMI_VDEV_TYPE_MONITOR) { + ret = ath11k_mac_monitor_stop(ar); diff --git a/package/kernel/mac80211/patches/ath11k/0202-ath11k-remove-unused-ATH11K_BD_IE_BOARD_EXT.patch b/package/kernel/mac80211/patches/ath11k/0202-ath11k-remove-unused-ATH11K_BD_IE_BOARD_EXT.patch new file mode 100644 index 000000000..5a8927002 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0202-ath11k-remove-unused-ATH11K_BD_IE_BOARD_EXT.patch @@ -0,0 +1,26 @@ +From 7fb376ad7d3f200575b9f9374e21b39d30b57267 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Mon, 21 Mar 2022 13:03:23 +0200 +Subject: [PATCH] ath11k: remove unused ATH11K_BD_IE_BOARD_EXT + +Currently ATH11K_BD_IE_BOARD_EXT is not used, so remove it. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220319023543.14288-2-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/hw.h | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/hw.h ++++ b/drivers/net/wireless/ath/ath11k/hw.h +@@ -293,7 +293,6 @@ enum ath11k_bd_ie_board_type { + enum ath11k_bd_ie_type { + /* contains sub IEs of enum ath11k_bd_ie_board_type */ + ATH11K_BD_IE_BOARD = 0, +- ATH11K_BD_IE_BOARD_EXT = 1, + }; + + struct ath11k_hw_regs { diff --git a/package/kernel/mac80211/patches/ath11k/0203-ath11k-disable-regdb-support-for-QCA6390.patch b/package/kernel/mac80211/patches/ath11k/0203-ath11k-disable-regdb-support-for-QCA6390.patch new file mode 100644 index 000000000..174e99284 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0203-ath11k-disable-regdb-support-for-QCA6390.patch @@ -0,0 +1,28 @@ +From 0c104b6163e344e972dbbd255ca2441c171a8a87 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Mon, 21 Mar 2022 13:03:29 +0200 +Subject: [PATCH] ath11k: disable regdb support for QCA6390 + +Currently it does not have regdb files for QCA6390, so disable its regdb +support feature now. + +Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-05266-QCAHSTSWPLZ_V2_TO_X86-1 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220319023543.14288-3-quic_wgong@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 +@@ -219,7 +219,7 @@ static const struct ath11k_hw_params ath + .num_peers = 512, + .supports_suspend = true, + .hal_desc_sz = sizeof(struct hal_rx_desc_ipq8074), +- .supports_regdb = true, ++ .supports_regdb = false, + .fix_l1ss = true, + .credit_flow = true, + .max_tx_ring = DP_TCL_NUM_RING_MAX_QCA6390, diff --git a/package/kernel/mac80211/patches/ath11k/0204-ath11k-add-support-for-device-recovery-for-QCA6390-W.patch b/package/kernel/mac80211/patches/ath11k/0204-ath11k-add-support-for-device-recovery-for-QCA6390-W.patch new file mode 100644 index 000000000..ddca64a1c --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0204-ath11k-add-support-for-device-recovery-for-QCA6390-W.patch @@ -0,0 +1,280 @@ +From 13da397f884d9c9a3fb6616206eeb6c6ab097287 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Mon, 28 Feb 2022 01:46:03 -0500 +Subject: [PATCH] ath11k: add support for device recovery for QCA6390/WCN6855 + +Currently ath11k has device recovery logic, it is introduced by this +patch "ath11k: Add support for subsystem recovery" which is upstream +by https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=ath11k-bringup&id=3a7b4838b6f6f234239f263ef3dc02e612a083ad. + +The patch is for AHB devices such as IPQ8074, it has remote proc module +which is used to download the firmware and boots the processor which +firmware is running on. If firmware crashed, remote proc module will +detect it and download and boot firmware again. Below command will +trigger a firmware crash, and then user can test feature of device +recovery. + +Test command: +echo assert > /sys/kernel/debug/ath11k/qca6390\ hw2.0/simulate_fw_crash +echo assert > /sys/kernel/debug/ath11k/wcn6855\ hw2.0/simulate_fw_crash + +Unfortunately, QCA6390 is PCIe bus, it does not have the remote proc +module, it use mhi module to communicate between firmware and ath11k. +So ath11k does not support device recovery for QCA6390 currently. + +This patch is to add the extra logic which is different for QCA6390. +When firmware crashed, MHI_CB_EE_RDDM event will be indicate by +firmware and then ath11k_mhi_op_status_cb which is the callback of +mhi_controller will receive the MHI_CB_EE_RDDM event, then ath11k +will start to do recovery process, ath11k_core_reset() calls +ath11k_hif_power_down()/ath11k_hif_power_up(), then the mhi/ath11k +will start to download and boot firmware. There are some logic to +avoid deadloop recovery and two simultaneous recovery operations. +And because it has muti-radios for the soc, so it add some logic +in ath11k_mac_op_reconfig_complete() to make sure all radios has +reconfig complete and then complete the device recovery. + +Also it add workqueue_aux, because ab->workqueue is used when receive +ATH11K_QMI_EVENT_FW_READY in recovery process(queue_work(ab->workqueue, +&ab->restart_work)), and ath11k_core_reset will wait for max +ATH11K_RESET_TIMEOUT_HZ for the previous restart_work finished, if +ath11k_core_reset also queued in ab->workqueue, then it will delay +restart_work of previous recovery and lead previous recovery fail. + +ath11k recovery success for QCA6390/WCN6855 after apply this patch. + +Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220228064606.8981-2-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 68 ++++++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/core.h | 13 +++++ + drivers/net/wireless/ath/ath11k/mac.c | 18 +++++++ + drivers/net/wireless/ath/ath11k/mhi.c | 33 +++++++++++++ + 4 files changed, 132 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -1381,6 +1381,65 @@ static void ath11k_core_restart(struct w + complete(&ab->driver_recovery); + } + ++static void ath11k_core_reset(struct work_struct *work) ++{ ++ struct ath11k_base *ab = container_of(work, struct ath11k_base, reset_work); ++ int reset_count, fail_cont_count; ++ long time_left; ++ ++ if (!(test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))) { ++ ath11k_warn(ab, "ignore reset dev flags 0x%lx\n", ab->dev_flags); ++ return; ++ } ++ ++ /* Sometimes the recovery will fail and then the next all recovery fail, ++ * this is to avoid infinite recovery since it can not recovery success. ++ */ ++ fail_cont_count = atomic_read(&ab->fail_cont_count); ++ ++ if (fail_cont_count >= ATH11K_RESET_MAX_FAIL_COUNT_FINAL) ++ return; ++ ++ if (fail_cont_count >= ATH11K_RESET_MAX_FAIL_COUNT_FIRST && ++ time_before(jiffies, ab->reset_fail_timeout)) ++ return; ++ ++ reset_count = atomic_inc_return(&ab->reset_count); ++ ++ if (reset_count > 1) { ++ /* Sometimes it happened another reset worker before the previous one ++ * completed, then the second reset worker will destroy the previous one, ++ * thus below is to avoid that. ++ */ ++ ath11k_warn(ab, "already reseting count %d\n", reset_count); ++ ++ reinit_completion(&ab->reset_complete); ++ time_left = wait_for_completion_timeout(&ab->reset_complete, ++ ATH11K_RESET_TIMEOUT_HZ); ++ ++ if (time_left) { ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "to skip reset\n"); ++ atomic_dec(&ab->reset_count); ++ return; ++ } ++ ++ ab->reset_fail_timeout = jiffies + ATH11K_RESET_FAIL_TIMEOUT_HZ; ++ /* Record the continuous recovery fail count when recovery failed*/ ++ atomic_inc(&ab->fail_cont_count); ++ } ++ ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset starting\n"); ++ ++ ab->is_reset = true; ++ atomic_set(&ab->recovery_count, 0); ++ ++ ath11k_hif_power_down(ab); ++ ath11k_qmi_free_resource(ab); ++ ath11k_hif_power_up(ab); ++ ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset started\n"); ++} ++ + static int ath11k_init_hw_params(struct ath11k_base *ab) + { + const struct ath11k_hw_params *hw_params = NULL; +@@ -1450,6 +1509,7 @@ EXPORT_SYMBOL(ath11k_core_deinit); + + void ath11k_core_free(struct ath11k_base *ab) + { ++ destroy_workqueue(ab->workqueue_aux); + destroy_workqueue(ab->workqueue); + + kfree(ab); +@@ -1472,9 +1532,14 @@ struct ath11k_base *ath11k_core_alloc(st + if (!ab->workqueue) + goto err_sc_free; + ++ ab->workqueue_aux = create_singlethread_workqueue("ath11k_aux_wq"); ++ if (!ab->workqueue_aux) ++ goto err_free_wq; ++ + mutex_init(&ab->core_lock); + spin_lock_init(&ab->base_lock); + mutex_init(&ab->vdev_id_11d_lock); ++ init_completion(&ab->reset_complete); + + INIT_LIST_HEAD(&ab->peers); + init_waitqueue_head(&ab->peer_mapping_wq); +@@ -1483,6 +1548,7 @@ struct ath11k_base *ath11k_core_alloc(st + INIT_WORK(&ab->restart_work, ath11k_core_restart); + INIT_WORK(&ab->update_11d_work, ath11k_update_11d); + INIT_WORK(&ab->rfkill_work, ath11k_rfkill_work); ++ INIT_WORK(&ab->reset_work, ath11k_core_reset); + timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0); + init_completion(&ab->htc_suspend); + init_completion(&ab->wow.wakeup_completed); +@@ -1493,6 +1559,8 @@ struct ath11k_base *ath11k_core_alloc(st + + return ab; + ++err_free_wq: ++ destroy_workqueue(ab->workqueue); + err_sc_free: + kfree(ab); + return NULL; +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -40,6 +40,10 @@ + extern unsigned int ath11k_frame_mode; + + #define ATH11K_MON_TIMER_INTERVAL 10 ++#define ATH11K_RESET_TIMEOUT_HZ (20 * HZ) ++#define ATH11K_RESET_MAX_FAIL_COUNT_FIRST 3 ++#define ATH11K_RESET_MAX_FAIL_COUNT_FINAL 5 ++#define ATH11K_RESET_FAIL_TIMEOUT_HZ (20 * HZ) + + enum ath11k_supported_bw { + ATH11K_BW_20 = 0, +@@ -820,6 +824,15 @@ struct ath11k_base { + struct work_struct restart_work; + struct work_struct update_11d_work; + u8 new_alpha2[3]; ++ struct workqueue_struct *workqueue_aux; ++ struct work_struct reset_work; ++ atomic_t reset_count; ++ atomic_t recovery_count; ++ bool is_reset; ++ struct completion reset_complete; ++ /* continuous recovery fail count */ ++ atomic_t fail_cont_count; ++ unsigned long reset_fail_timeout; + struct { + /* protected by data_lock */ + u32 fw_crash_counter; +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -7915,6 +7915,8 @@ ath11k_mac_op_reconfig_complete(struct i + enum ieee80211_reconfig_type reconfig_type) + { + struct ath11k *ar = hw->priv; ++ struct ath11k_base *ab = ar->ab; ++ int recovery_count; + + if (reconfig_type != IEEE80211_RECONFIG_TYPE_RESTART) + return; +@@ -7926,6 +7928,22 @@ ath11k_mac_op_reconfig_complete(struct i + ar->pdev->pdev_id); + ar->state = ATH11K_STATE_ON; + ieee80211_wake_queues(ar->hw); ++ ++ if (ab->is_reset) { ++ recovery_count = atomic_inc_return(&ab->recovery_count); ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, ++ "recovery count %d\n", recovery_count); ++ /* When there are multiple radios in an SOC, ++ * the recovery has to be done for each radio ++ */ ++ if (recovery_count == ab->num_radios) { ++ atomic_dec(&ab->reset_count); ++ complete(&ab->reset_complete); ++ ab->is_reset = false; ++ atomic_set(&ab->fail_cont_count, 0); ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "reset success\n"); ++ } ++ } + } + + mutex_unlock(&ar->conf_mutex); +--- a/drivers/net/wireless/ath/ath11k/mhi.c ++++ b/drivers/net/wireless/ath/ath11k/mhi.c +@@ -292,15 +292,48 @@ static void ath11k_mhi_op_runtime_put(st + { + } + ++static char *ath11k_mhi_op_callback_to_str(enum mhi_callback reason) ++{ ++ switch (reason) { ++ case MHI_CB_IDLE: ++ return "MHI_CB_IDLE"; ++ case MHI_CB_PENDING_DATA: ++ return "MHI_CB_PENDING_DATA"; ++ case MHI_CB_LPM_ENTER: ++ return "MHI_CB_LPM_ENTER"; ++ case MHI_CB_LPM_EXIT: ++ return "MHI_CB_LPM_EXIT"; ++ case MHI_CB_EE_RDDM: ++ return "MHI_CB_EE_RDDM"; ++ case MHI_CB_EE_MISSION_MODE: ++ return "MHI_CB_EE_MISSION_MODE"; ++ case MHI_CB_SYS_ERROR: ++ return "MHI_CB_SYS_ERROR"; ++ case MHI_CB_FATAL_ERROR: ++ return "MHI_CB_FATAL_ERROR"; ++ case MHI_CB_BW_REQ: ++ return "MHI_CB_BW_REQ"; ++ default: ++ return "UNKNOWN"; ++ } ++}; ++ + static void ath11k_mhi_op_status_cb(struct mhi_controller *mhi_cntrl, + enum mhi_callback cb) + { + struct ath11k_base *ab = dev_get_drvdata(mhi_cntrl->cntrl_dev); + ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "mhi notify status reason %s\n", ++ ath11k_mhi_op_callback_to_str(cb)); ++ + switch (cb) { + case MHI_CB_SYS_ERROR: + ath11k_warn(ab, "firmware crashed: MHI_CB_SYS_ERROR\n"); + break; ++ case MHI_CB_EE_RDDM: ++ if (!(test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags))) ++ queue_work(ab->workqueue_aux, &ab->reset_work); ++ break; + default: + break; + } diff --git a/package/kernel/mac80211/patches/ath11k/0205-ath11k-add-synchronization-operation-between-reconfi.patch b/package/kernel/mac80211/patches/ath11k/0205-ath11k-add-synchronization-operation-between-reconfi.patch new file mode 100644 index 000000000..17e417339 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0205-ath11k-add-synchronization-operation-between-reconfi.patch @@ -0,0 +1,182 @@ +From 38194f3a605e4a961f28bc38a73a4f4d43123968 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Mon, 21 Mar 2022 13:16:57 +0200 +Subject: [PATCH] ath11k: add synchronization operation between reconfigure of + mac80211 and ath11k_base + +ieee80211_reconfig() of mac80211 is the main function for recovery of +each ieee80211_hw and ath11k, and ath11k_core_reconfigure_on_crash() +is the main function for recovery of ath11k_base, it has more than +one ieee80211_hw and ath11k for each ath11k_base, so it need to add +synchronization between them, otherwise it has many issue. + +For example, when ath11k_core_reconfigure_on_crash() is not complete, +mac80211 send a hw scan request to ath11k, it leads firmware crash, +because firmware has not been initialized at that moment, firmware +is only finished downloaded and loaded, it can not receive scan +command. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220228064606.8981-3-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 51 ++++++++++++++++++++++---- + drivers/net/wireless/ath/ath11k/core.h | 5 +++ + drivers/net/wireless/ath/ath11k/mac.c | 22 +++++++++++ + 3 files changed, 70 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -1302,12 +1302,11 @@ static void ath11k_update_11d(struct wor + } + } + +-static void ath11k_core_restart(struct work_struct *work) ++static void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab) + { +- struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work); + struct ath11k *ar; + struct ath11k_pdev *pdev; +- int i, ret = 0; ++ int i; + + spin_lock_bh(&ab->base_lock); + ab->stats.fw_crash_counter++; +@@ -1340,12 +1339,13 @@ static void ath11k_core_restart(struct w + + wake_up(&ab->wmi_ab.tx_credits_wq); + wake_up(&ab->peer_mapping_wq); ++} + +- ret = ath11k_core_reconfigure_on_crash(ab); +- if (ret) { +- ath11k_err(ab, "failed to reconfigure driver on crash recovery\n"); +- return; +- } ++static void ath11k_core_post_reconfigure_recovery(struct ath11k_base *ab) ++{ ++ struct ath11k *ar; ++ struct ath11k_pdev *pdev; ++ int i; + + for (i = 0; i < ab->num_radios; i++) { + pdev = &ab->pdevs[i]; +@@ -1381,6 +1381,27 @@ static void ath11k_core_restart(struct w + complete(&ab->driver_recovery); + } + ++static void ath11k_core_restart(struct work_struct *work) ++{ ++ 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"); ++ return; ++ } ++ ++ if (ab->is_reset) ++ complete_all(&ab->reconfigure_complete); ++ ++ if (!ab->is_reset) ++ ath11k_core_post_reconfigure_recovery(ab); ++} ++ + static void ath11k_core_reset(struct work_struct *work) + { + struct ath11k_base *ab = container_of(work, struct ath11k_base, reset_work); +@@ -1432,6 +1453,18 @@ static void ath11k_core_reset(struct wor + + ab->is_reset = true; + atomic_set(&ab->recovery_count, 0); ++ reinit_completion(&ab->recovery_start); ++ atomic_set(&ab->recovery_start_count, 0); ++ ++ ath11k_core_pre_reconfigure_recovery(ab); ++ ++ reinit_completion(&ab->reconfigure_complete); ++ ath11k_core_post_reconfigure_recovery(ab); ++ ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "waiting recovery start...\n"); ++ ++ time_left = wait_for_completion_timeout(&ab->recovery_start, ++ ATH11K_RECOVER_START_TIMEOUT_HZ); + + ath11k_hif_power_down(ab); + ath11k_qmi_free_resource(ab); +@@ -1540,6 +1573,8 @@ struct ath11k_base *ath11k_core_alloc(st + spin_lock_init(&ab->base_lock); + mutex_init(&ab->vdev_id_11d_lock); + init_completion(&ab->reset_complete); ++ init_completion(&ab->reconfigure_complete); ++ init_completion(&ab->recovery_start); + + INIT_LIST_HEAD(&ab->peers); + init_waitqueue_head(&ab->peer_mapping_wq); +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -44,6 +44,8 @@ extern unsigned int ath11k_frame_mode; + #define ATH11K_RESET_MAX_FAIL_COUNT_FIRST 3 + #define ATH11K_RESET_MAX_FAIL_COUNT_FINAL 5 + #define ATH11K_RESET_FAIL_TIMEOUT_HZ (20 * HZ) ++#define ATH11K_RECONFIGURE_TIMEOUT_HZ (10 * HZ) ++#define ATH11K_RECOVER_START_TIMEOUT_HZ (20 * HZ) + + enum ath11k_supported_bw { + ATH11K_BW_20 = 0, +@@ -828,8 +830,11 @@ struct ath11k_base { + struct work_struct reset_work; + atomic_t reset_count; + atomic_t recovery_count; ++ atomic_t recovery_start_count; + bool is_reset; + struct completion reset_complete; ++ struct completion reconfigure_complete; ++ struct completion recovery_start; + /* continuous recovery fail count */ + atomic_t fail_cont_count; + unsigned long reset_fail_timeout; +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -5749,6 +5749,27 @@ static int ath11k_mac_config_mon_status_ + return ret; + } + ++static void ath11k_mac_wait_reconfigure(struct ath11k_base *ab) ++{ ++ int recovery_start_count; ++ ++ if (!ab->is_reset) ++ return; ++ ++ recovery_start_count = atomic_inc_return(&ab->recovery_start_count); ++ ath11k_dbg(ab, ATH11K_DBG_MAC, "recovery start count %d\n", recovery_start_count); ++ ++ if (recovery_start_count == ab->num_radios) { ++ complete(&ab->recovery_start); ++ ath11k_dbg(ab, ATH11K_DBG_MAC, "recovery started success\n"); ++ } ++ ++ ath11k_dbg(ab, ATH11K_DBG_MAC, "waiting reconfigure...\n"); ++ ++ wait_for_completion_timeout(&ab->reconfigure_complete, ++ ATH11K_RECONFIGURE_TIMEOUT_HZ); ++} ++ + static int ath11k_mac_op_start(struct ieee80211_hw *hw) + { + struct ath11k *ar = hw->priv; +@@ -5765,6 +5786,7 @@ static int ath11k_mac_op_start(struct ie + break; + case ATH11K_STATE_RESTARTING: + ar->state = ATH11K_STATE_RESTARTED; ++ ath11k_mac_wait_reconfigure(ab); + break; + case ATH11K_STATE_RESTARTED: + case ATH11K_STATE_WEDGED: diff --git a/package/kernel/mac80211/patches/ath11k/0206-ath11k-Add-hw-restart-option-to-simulate_fw_crash.patch b/package/kernel/mac80211/patches/ath11k/0206-ath11k-Add-hw-restart-option-to-simulate_fw_crash.patch new file mode 100644 index 000000000..886261d1d --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0206-ath11k-Add-hw-restart-option-to-simulate_fw_crash.patch @@ -0,0 +1,36 @@ +From 78e3e6094220a71504e7136c42b49fc8ed3a72b4 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Mon, 21 Mar 2022 13:17:03 +0200 +Subject: [PATCH] ath11k: Add hw-restart option to simulate_fw_crash + +Add hw-restart to directly restart wlan. Like UTF mode start it will +restart hardware and download firmware again. + +Usage: +1. Run command: + echo hw-restart > /sys/kernel/debug/ath11k/qca6390\ hw2.0/simulate_fw_crash + echo hw-restart > /sys/kernel/debug/ath11k/wcn6855\ hw2.0/simulate_fw_crash +2. wlan will be restart and do recovery process and success. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220228064606.8981-4-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/debugfs.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/debugfs.c ++++ b/drivers/net/wireless/ath/ath11k/debugfs.c +@@ -596,6 +596,10 @@ static ssize_t ath11k_write_simulate_fw_ + ret = ath11k_wmi_force_fw_hang_cmd(ar, + ATH11K_WMI_FW_HANG_ASSERT_TYPE, + ATH11K_WMI_FW_HANG_DELAY); ++ } else if (!strcmp(buf, "hw-restart")) { ++ ath11k_info(ab, "user requested hw restart\n"); ++ queue_work(ab->workqueue_aux, &ab->reset_work); ++ ret = 0; + } else { + ret = -EINVAL; + goto exit; diff --git a/package/kernel/mac80211/patches/ath11k/0207-ath11k-fix-the-warning-of-dev_wake-in-mhi_pm_disable.patch b/package/kernel/mac80211/patches/ath11k/0207-ath11k-fix-the-warning-of-dev_wake-in-mhi_pm_disable.patch new file mode 100644 index 000000000..b583cf74d --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0207-ath11k-fix-the-warning-of-dev_wake-in-mhi_pm_disable.patch @@ -0,0 +1,124 @@ +From 0d7a8a6204ea9271f1d0a8c66a9fd2f54d2e3cbc Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Mon, 21 Mar 2022 13:17:08 +0200 +Subject: [PATCH] ath11k: fix the warning of dev_wake in + mhi_pm_disable_transition() + +When test device recovery with below command, it has warning in message +as below. +echo assert > /sys/kernel/debug/ath11k/wcn6855\ hw2.0/simulate_fw_crash +echo assert > /sys/kernel/debug/ath11k/qca6390\ hw2.0/simulate_fw_crash + +warning message: +[ 1965.642121] ath11k_pci 0000:06:00.0: simulating firmware assert crash +[ 1968.471364] ieee80211 phy0: Hardware restart was requested +[ 1968.511305] ------------[ cut here ]------------ +[ 1968.511368] WARNING: CPU: 3 PID: 1546 at drivers/bus/mhi/core/pm.c:505 mhi_pm_disable_transition+0xb37/0xda0 [mhi] +[ 1968.511443] Modules linked in: ath11k_pci ath11k mac80211 libarc4 cfg80211 qmi_helpers qrtr_mhi mhi qrtr nvme nvme_core +[ 1968.511563] CPU: 3 PID: 1546 Comm: kworker/u17:0 Kdump: loaded Tainted: G W 5.17.0-rc3-wt-ath+ #579 +[ 1968.511629] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021 +[ 1968.511704] Workqueue: mhi_hiprio_wq mhi_pm_st_worker [mhi] +[ 1968.511787] RIP: 0010:mhi_pm_disable_transition+0xb37/0xda0 [mhi] +[ 1968.511870] Code: a9 fe ff ff 4c 89 ff 44 89 04 24 e8 03 46 f6 e5 44 8b 04 24 41 83 f8 01 0f 84 21 fe ff ff e9 4c fd ff ff 0f 0b e9 af f8 ff ff <0f> 0b e9 5c f8 ff ff 48 89 df e8 da 9e ee e3 e9 12 fd ff ff 4c 89 +[ 1968.511923] RSP: 0018:ffffc900024efbf0 EFLAGS: 00010286 +[ 1968.511969] RAX: 00000000ffffffff RBX: ffff88811d241250 RCX: ffffffffc0176922 +[ 1968.512014] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff888118a90a24 +[ 1968.512059] RBP: ffff888118a90800 R08: 0000000000000000 R09: ffff888118a90a27 +[ 1968.512102] R10: ffffed1023152144 R11: 0000000000000001 R12: ffff888118a908ac +[ 1968.512229] R13: ffff888118a90928 R14: dffffc0000000000 R15: ffff888118a90a24 +[ 1968.512310] FS: 0000000000000000(0000) GS:ffff888234200000(0000) knlGS:0000000000000000 +[ 1968.512405] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +[ 1968.512493] CR2: 00007f5538f443a8 CR3: 000000016dc28001 CR4: 00000000003706e0 +[ 1968.512587] Call Trace: +[ 1968.512672] +[ 1968.512751] ? _raw_spin_unlock_irq+0x1f/0x40 +[ 1968.512859] mhi_pm_st_worker+0x3ac/0x790 [mhi] +[ 1968.512959] ? mhi_pm_mission_mode_transition.isra.0+0x7d0/0x7d0 [mhi] +[ 1968.513063] process_one_work+0x86a/0x1400 +[ 1968.513184] ? pwq_dec_nr_in_flight+0x230/0x230 +[ 1968.513312] ? move_linked_works+0x125/0x290 +[ 1968.513416] worker_thread+0x6db/0xf60 +[ 1968.513536] ? process_one_work+0x1400/0x1400 +[ 1968.513627] kthread+0x241/0x2d0 +[ 1968.513733] ? kthread_complete_and_exit+0x20/0x20 +[ 1968.513821] ret_from_fork+0x22/0x30 +[ 1968.513924] + +Reason is mhi_deassert_dev_wake() from mhi_device_put() is called +but mhi_assert_dev_wake() from __mhi_device_get_sync() is not called +in progress of recovery. Commit 8e0559921f9a ("bus: mhi: core: +Skip device wake in error or shutdown state") add check for the +pm_state of mhi in __mhi_device_get_sync(), and the pm_state is not +the normal state untill recovery is completed, so it leads the +dev_wake is not 0 and above warning print in mhi_pm_disable_transition() +while checking mhi_cntrl->dev_wake. + +Add check in ath11k_pci_write32()/ath11k_pci_read32() to skip call +mhi_device_put() if mhi_device_get_sync() does not really do wake, +then the warning gone. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220228064606.8981-5-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/pci.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -191,6 +191,7 @@ void ath11k_pci_write32(struct ath11k_ba + { + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + u32 window_start; ++ int ret = 0; + + /* for offset beyond BAR + 4K - 32, may + * need to wakeup MHI to access. +@@ -198,7 +199,7 @@ void ath11k_pci_write32(struct ath11k_ba + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && + offset >= ACCESS_ALWAYS_OFF) +- mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); ++ ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); + + if (offset < WINDOW_START) { + iowrite32(value, ab->mem + offset); +@@ -222,7 +223,8 @@ void ath11k_pci_write32(struct ath11k_ba + + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ACCESS_ALWAYS_OFF) ++ offset >= ACCESS_ALWAYS_OFF && ++ !ret) + mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); + } + +@@ -230,6 +232,7 @@ u32 ath11k_pci_read32(struct ath11k_base + { + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + u32 val, window_start; ++ int ret = 0; + + /* for offset beyond BAR + 4K - 32, may + * need to wakeup MHI to access. +@@ -237,7 +240,7 @@ u32 ath11k_pci_read32(struct ath11k_base + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && + offset >= ACCESS_ALWAYS_OFF) +- mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); ++ ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); + + if (offset < WINDOW_START) { + val = ioread32(ab->mem + offset); +@@ -261,7 +264,8 @@ u32 ath11k_pci_read32(struct ath11k_base + + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ACCESS_ALWAYS_OFF) ++ offset >= ACCESS_ALWAYS_OFF && ++ !ret) + mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); + + return val; diff --git a/package/kernel/mac80211/patches/ath11k/0208-ath11k-enable-PLATFORM_CAP_PCIE_GLOBAL_RESET-QMI-hos.patch b/package/kernel/mac80211/patches/ath11k/0208-ath11k-enable-PLATFORM_CAP_PCIE_GLOBAL_RESET-QMI-hos.patch new file mode 100644 index 000000000..a48141722 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0208-ath11k-enable-PLATFORM_CAP_PCIE_GLOBAL_RESET-QMI-hos.patch @@ -0,0 +1,115 @@ +From 1e4ac7173c9394de7f54a4a861377ac3f030c614 Mon Sep 17 00:00:00 2001 +From: Baochen Qiang +Date: Mon, 11 Oct 2021 13:56:02 +0800 +Subject: [PATCH] ath11k: enable PLATFORM_CAP_PCIE_GLOBAL_RESET QMI host + capability + +In Qualcomm ARM platforms there is WL_EN pin and other power regulators +which can be controlled at platform side to completely reset the chip. +For most of x86 and other platforms, the chip is connected via PCIe M.2 +interface, and there is no way to control WL_EN pin. Instead the host +driver needs to reset the chip via PCIE_SOC_GLOBAL_RESET hardware +register, just like ath11k does currently. + +But when using PCIE_SOC_GLOBAL_RESET there are some hardware registers +which are not cleared/restored. To handle those cases we can enable +PLATFORM_CAP_PCIE_GLOBAL_RESET QMI host capability to tell the firmware +to do some platform specific operations after firmware download. + +This does not fix any known issues, but is recommended by the firmware +team, so enable the capability on QCA6390 and WCN6855 PCI devices. It is +currently unclear if this should be enabled also on QCN9074, so leave it +disabled for now. On AHB devices this is not needed as they don't use +PCIE_SOC_GLOBAL_RESET. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 + +Signed-off-by: Baochen Qiang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20211011055602.77342-1-bqiang@codeaurora.org +--- + drivers/net/wireless/ath/ath11k/core.c | 6 ++++++ + drivers/net/wireless/ath/ath11k/hw.h | 1 + + drivers/net/wireless/ath/ath11k/qmi.c | 4 ++++ + 3 files changed, 11 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -100,6 +100,7 @@ static const struct ath11k_hw_params ath + .fw_wmi_diag_event = false, + .current_cc_support = false, + .dbr_debug_support = true, ++ .global_reset = false, + }, + { + .hw_rev = ATH11K_HW_IPQ6018_HW10, +@@ -166,6 +167,7 @@ static const struct ath11k_hw_params ath + .fw_wmi_diag_event = false, + .current_cc_support = false, + .dbr_debug_support = true, ++ .global_reset = false, + }, + { + .name = "qca6390 hw2.0", +@@ -231,6 +233,7 @@ static const struct ath11k_hw_params ath + .fw_wmi_diag_event = true, + .current_cc_support = true, + .dbr_debug_support = false, ++ .global_reset = true, + }, + { + .name = "qcn9074 hw1.0", +@@ -296,6 +299,7 @@ static const struct ath11k_hw_params ath + .fw_wmi_diag_event = false, + .current_cc_support = false, + .dbr_debug_support = true, ++ .global_reset = false, + }, + { + .name = "wcn6855 hw2.0", +@@ -361,6 +365,7 @@ static const struct ath11k_hw_params ath + .fw_wmi_diag_event = true, + .current_cc_support = true, + .dbr_debug_support = false, ++ .global_reset = true, + }, + { + .name = "wcn6855 hw2.1", +@@ -425,6 +430,7 @@ static const struct ath11k_hw_params ath + .fw_wmi_diag_event = true, + .current_cc_support = true, + .dbr_debug_support = false, ++ .global_reset = true, + }, + }; + +--- a/drivers/net/wireless/ath/ath11k/hw.h ++++ b/drivers/net/wireless/ath/ath11k/hw.h +@@ -194,6 +194,7 @@ struct ath11k_hw_params { + bool fw_wmi_diag_event; + bool current_cc_support; + bool dbr_debug_support; ++ bool global_reset; + }; + + struct ath11k_hw_ops { +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -15,6 +15,7 @@ + + #define SLEEP_CLOCK_SELECT_INTERNAL_BIT 0x02 + #define HOST_CSTATE_BIT 0x04 ++#define PLATFORM_CAP_PCIE_GLOBAL_RESET 0x08 + + #define FW_BUILD_ID_MASK "QC_IMAGE_VERSION_STRING=" + +@@ -1676,6 +1677,9 @@ static int ath11k_qmi_host_cap_send(stru + req.nm_modem |= SLEEP_CLOCK_SELECT_INTERNAL_BIT; + } + ++ if (ab->hw_params.global_reset) ++ req.nm_modem |= PLATFORM_CAP_PCIE_GLOBAL_RESET; ++ + ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi host cap request\n"); + + ret = qmi_txn_init(&ab->qmi.handle, &txn, diff --git a/package/kernel/mac80211/patches/ath11k/0209-ath11k-add-fallback-board-name-without-variant-while.patch b/package/kernel/mac80211/patches/ath11k/0209-ath11k-add-fallback-board-name-without-variant-while.patch new file mode 100644 index 000000000..67377e793 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0209-ath11k-add-fallback-board-name-without-variant-while.patch @@ -0,0 +1,159 @@ +From 62abdc06c50eb18e3fa62f7136e66842a96f6b58 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Wed, 23 Mar 2022 11:14:16 +0200 +Subject: [PATCH] ath11k: add fallback board name without variant while + searching board-2.bin + +Sometimes it has a variant value which read from DT or SMBIOS by +ath11k, and meanwhile it does not have the matched board name in +board-2.bin, then it will failed at boot up phase. + +Add fallback board name which removed variant value and search again +in board-2.bin when failed with variant and try to load the board +data again to increase boot up success rate. + +dmesg log after this patch: +[169547.248472] ath11k_pci 0000:05: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,variant=test' +[169547.248565] ath11k_pci 0000:05:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 180324 +[169547.248568] ath11k_pci 0000:05:00.0: board name +[169547.248570] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 76 65 6e 64 6f 72 3d 31 bus=pci,vendor=1 +[169547.248571] ath11k_pci 0000:05:00.0: 00000010: 37 63 62 2c 64 65 76 69 63 65 3d 31 31 30 33 2c 7cb,device=1103, +[169547.248572] ath11k_pci 0000:05:00.0: 00000020: 73 75 62 73 79 73 74 65 6d 2d 76 65 6e 64 6f 72 subsystem-vendor +[169547.248574] ath11k_pci 0000:05:00.0: 00000030: 3d 31 37 63 62 2c 73 75 62 73 79 73 74 65 6d 2d =17cb,subsystem- +[169547.248575] ath11k_pci 0000:05:00.0: 00000040: 64 65 76 69 63 65 3d 33 33 37 34 2c 71 6d 69 2d device=3374,qmi- +[169547.248576] ath11k_pci 0000:05:00.0: 00000050: 63 68 69 70 2d 69 64 3d 32 2c 71 6d 69 2d 62 6f chip-id=2,qmi-bo +[169547.248577] ath11k_pci 0000:05:00.0: 00000060: 61 72 64 2d 69 64 3d 32 36 32 ard-id=262 +[169547.248578] ath11k_pci 0000:05:00.0: board name +[169547.248579] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 76 65 6e 64 6f 72 3d 31 bus=pci,vendor=1 +[169547.248581] ath11k_pci 0000:05:00.0: 00000010: 37 63 62 2c 64 65 76 69 63 65 3d 31 31 30 33 2c 7cb,device=1103, +[169547.248582] ath11k_pci 0000:05:00.0: 00000020: 73 75 62 73 79 73 74 65 6d 2d 76 65 6e 64 6f 72 subsystem-vendor +[169547.248583] ath11k_pci 0000:05:00.0: 00000030: 3d 31 37 63 62 2c 73 75 62 73 79 73 74 65 6d 2d =17cb,subsystem- +[169547.248584] ath11k_pci 0000:05:00.0: 00000040: 64 65 76 69 63 65 3d 33 33 37 34 2c 71 6d 69 2d device=3374,qmi- +[169547.248585] ath11k_pci 0000:05:00.0: 00000050: 63 68 69 70 2d 69 64 3d 32 2c 71 6d 69 2d 62 6f chip-id=2,qmi-bo +[169547.248587] ath11k_pci 0000:05:00.0: 00000060: 61 72 64 2d 69 64 3d 32 36 36 ard-id=266 +[169547.248588] ath11k_pci 0000:05:00.0: board name +[169547.248589] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 76 65 6e 64 6f 72 3d 31 bus=pci,vendor=1 +[169547.248590] ath11k_pci 0000:05:00.0: 00000010: 37 63 62 2c 64 65 76 69 63 65 3d 31 31 30 33 2c 7cb,device=1103, +[169547.248591] ath11k_pci 0000:05:00.0: 00000020: 73 75 62 73 79 73 74 65 6d 2d 76 65 6e 64 6f 72 subsystem-vendor +[169547.248592] ath11k_pci 0000:05:00.0: 00000030: 3d 31 37 63 62 2c 73 75 62 73 79 73 74 65 6d 2d =17cb,subsystem- +[169547.248594] ath11k_pci 0000:05:00.0: 00000040: 64 65 76 69 63 65 3d 33 33 37 34 2c 71 6d 69 2d device=3374,qmi- +[169547.248595] ath11k_pci 0000:05:00.0: 00000050: 63 68 69 70 2d 69 64 3d 31 38 2c 71 6d 69 2d 62 chip-id=18,qmi-b +[169547.248596] ath11k_pci 0000:05:00.0: 00000060: 6f 61 72 64 2d 69 64 3d 32 36 36 oard-id=266 +[169547.248597] ath11k_pci 0000:05:00.0: failed to fetch board data for bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262,variant=test from ath11k/WCN6855/hw2.0/board-2.bin +[169547.248476] ath11k_pci 0000:05: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' +[169547.248634] ath11k_pci 0000:05:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 180324 +[169547.248636] ath11k_pci 0000:05:00.0: board name +[169547.248637] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 76 65 6e 64 6f 72 3d 31 bus=pci,vendor=1 +[169547.248638] ath11k_pci 0000:05:00.0: 00000010: 37 63 62 2c 64 65 76 69 63 65 3d 31 31 30 33 2c 7cb,device=1103, +[169547.248639] ath11k_pci 0000:05:00.0: 00000020: 73 75 62 73 79 73 74 65 6d 2d 76 65 6e 64 6f 72 subsystem-vendor +[169547.248641] ath11k_pci 0000:05:00.0: 00000030: 3d 31 37 63 62 2c 73 75 62 73 79 73 74 65 6d 2d =17cb,subsystem- +[169547.248642] ath11k_pci 0000:05:00.0: 00000040: 64 65 76 69 63 65 3d 33 33 37 34 2c 71 6d 69 2d device=3374,qmi- +[169547.248643] ath11k_pci 0000:05:00.0: 00000050: 63 68 69 70 2d 69 64 3d 32 2c 71 6d 69 2d 62 6f chip-id=2,qmi-bo +[169547.248645] ath11k_pci 0000:05:00.0: 00000060: 61 72 64 2d 69 64 3d 32 36 32 ard-id=262 +[169547.248646] ath11k_pci 0000:05:00.0: boot found match for name 'bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262' +[169547.248647] ath11k_pci 0000:05:00.0: boot found board data for 'bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262' +[169547.248649] ath11k_pci 0000:05:00.0: using board api 2 + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220315104721.26649-2-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 48 ++++++++++++++++++++++---- + 1 file changed, 41 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -571,13 +571,13 @@ int ath11k_core_check_dt(struct ath11k_b + return 0; + } + +-static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name, +- size_t name_len) ++static int __ath11k_core_create_board_name(struct ath11k_base *ab, char *name, ++ size_t name_len, bool with_variant) + { + /* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */ + char variant[9 + ATH11K_QMI_BDF_EXT_STR_LENGTH] = { 0 }; + +- if (ab->qmi.target.bdf_ext[0] != '\0') ++ if (with_variant && ab->qmi.target.bdf_ext[0] != '\0') + scnprintf(variant, sizeof(variant), ",variant=%s", + ab->qmi.target.bdf_ext); + +@@ -607,6 +607,18 @@ static int ath11k_core_create_board_name + return 0; + } + ++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); ++} ++ ++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); ++} ++ + const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, + const char *file) + { +@@ -810,7 +822,7 @@ static int ath11k_core_fetch_board_data_ + + out: + if (!bd->data || !bd->len) { +- ath11k_err(ab, ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, + "failed to fetch board data for %s from %s\n", + boardname, filepath); + ret = -ENODATA; +@@ -842,10 +854,13 @@ int ath11k_core_fetch_board_data_api_1(s + #define BOARD_NAME_SIZE 200 + int ath11k_core_fetch_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd) + { +- char boardname[BOARD_NAME_SIZE]; ++ char boardname[BOARD_NAME_SIZE], fallback_boardname[BOARD_NAME_SIZE]; ++ char *filename, filepath[100]; + int ret; + +- ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE); ++ filename = ATH11K_BOARD_API2_FILE; ++ ++ ret = ath11k_core_create_board_name(ab, boardname, sizeof(boardname)); + if (ret) { + ath11k_err(ab, "failed to create board name: %d", ret); + return ret; +@@ -856,10 +871,29 @@ int ath11k_core_fetch_bdf(struct ath11k_ + if (!ret) + goto success; + ++ ret = ath11k_core_create_fallback_board_name(ab, fallback_boardname, ++ sizeof(fallback_boardname)); ++ if (ret) { ++ ath11k_err(ab, "failed to create fallback board name: %d", ret); ++ return ret; ++ } ++ ++ ret = ath11k_core_fetch_board_data_api_n(ab, bd, fallback_boardname); ++ if (!ret) ++ goto success; ++ + ab->bd_api = 1; + ret = ath11k_core_fetch_board_data_api_1(ab, bd, ATH11K_DEFAULT_BOARD_FILE); + if (ret) { +- ath11k_err(ab, "failed to fetch board-2.bin or board.bin from %s\n", ++ ath11k_core_create_firmware_path(ab, filename, ++ filepath, sizeof(filepath)); ++ ath11k_err(ab, "failed to fetch board data for %s from %s\n", ++ boardname, filepath); ++ if (memcmp(boardname, fallback_boardname, strlen(boardname))) ++ ath11k_err(ab, "failed to fetch board data for %s from %s\n", ++ fallback_boardname, filepath); ++ ++ ath11k_err(ab, "failed to fetch board.bin from %s\n", + ab->hw_params.fw.dir); + return ret; + } diff --git a/package/kernel/mac80211/patches/ath11k/0210-ath11k-add-read-variant-from-SMBIOS-for-download-boa.patch b/package/kernel/mac80211/patches/ath11k/0210-ath11k-add-read-variant-from-SMBIOS-for-download-boa.patch new file mode 100644 index 000000000..86e52113e --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0210-ath11k-add-read-variant-from-SMBIOS-for-download-boa.patch @@ -0,0 +1,169 @@ +From 9d97114d222047c0699bbdbf8f128907f423bbe6 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Wed, 23 Mar 2022 11:14:17 +0200 +Subject: [PATCH] ath11k: add read variant from SMBIOS for download board data + +This is to read variant from SMBIOS such as read from DT, the variant +string will be used to one part of string which used to search board +data from board-2.bin. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220315104721.26649-3-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 70 ++++++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/core.h | 20 +++++++- + drivers/net/wireless/ath/ath11k/qmi.c | 4 ++ + 3 files changed, 93 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -9,6 +9,7 @@ + #include + #include + #include ++ + #include "core.h" + #include "dp_tx.h" + #include "dp_rx.h" +@@ -548,6 +549,75 @@ int ath11k_core_resume(struct ath11k_bas + } + EXPORT_SYMBOL(ath11k_core_resume); + ++static void ath11k_core_check_bdfext(const struct dmi_header *hdr, void *data) ++{ ++ struct ath11k_base *ab = data; ++ const char *magic = ATH11K_SMBIOS_BDF_EXT_MAGIC; ++ struct ath11k_smbios_bdf *smbios = (struct ath11k_smbios_bdf *)hdr; ++ ssize_t copied; ++ size_t len; ++ int i; ++ ++ if (ab->qmi.target.bdf_ext[0] != '\0') ++ return; ++ ++ if (hdr->type != ATH11K_SMBIOS_BDF_EXT_TYPE) ++ return; ++ ++ if (hdr->length != ATH11K_SMBIOS_BDF_EXT_LENGTH) { ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, ++ "wrong smbios bdf ext type length (%d).\n", ++ hdr->length); ++ return; ++ } ++ ++ if (!smbios->bdf_enabled) { ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "bdf variant name not found.\n"); ++ return; ++ } ++ ++ /* Only one string exists (per spec) */ ++ if (memcmp(smbios->bdf_ext, magic, strlen(magic)) != 0) { ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, ++ "bdf variant magic does not match.\n"); ++ return; ++ } ++ ++ len = min_t(size_t, ++ strlen(smbios->bdf_ext), sizeof(ab->qmi.target.bdf_ext)); ++ for (i = 0; i < len; i++) { ++ if (!isascii(smbios->bdf_ext[i]) || !isprint(smbios->bdf_ext[i])) { ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, ++ "bdf variant name contains non ascii chars.\n"); ++ return; ++ } ++ } ++ ++ /* Copy extension name without magic prefix */ ++ copied = strscpy(ab->qmi.target.bdf_ext, smbios->bdf_ext + strlen(magic), ++ sizeof(ab->qmi.target.bdf_ext)); ++ if (copied < 0) { ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, ++ "bdf variant string is longer than the buffer can accommodate\n"); ++ return; ++ } ++ ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, ++ "found and validated bdf variant smbios_type 0x%x bdf %s\n", ++ ATH11K_SMBIOS_BDF_EXT_TYPE, ab->qmi.target.bdf_ext); ++} ++ ++int ath11k_core_check_smbios(struct ath11k_base *ab) ++{ ++ ab->qmi.target.bdf_ext[0] = '\0'; ++ dmi_walk(ath11k_core_check_bdfext, ab); ++ ++ if (ab->qmi.target.bdf_ext[0] == '\0') ++ return -ENODATA; ++ ++ return 0; ++} ++ + int ath11k_core_check_dt(struct ath11k_base *ab) + { + size_t max_len = sizeof(ab->qmi.target.bdf_ext); +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -10,6 +10,8 @@ + #include + #include + #include ++#include ++#include + #include "qmi.h" + #include "htc.h" + #include "wmi.h" +@@ -37,6 +39,15 @@ + #define ATH11K_INVALID_HW_MAC_ID 0xFF + #define ATH11K_CONNECTION_LOSS_HZ (3 * HZ) + ++/* SMBIOS type containing Board Data File Name Extension */ ++#define ATH11K_SMBIOS_BDF_EXT_TYPE 0xF8 ++ ++/* SMBIOS type structure length (excluding strings-set) */ ++#define ATH11K_SMBIOS_BDF_EXT_LENGTH 0x9 ++ ++/* The magic used by QCA spec */ ++#define ATH11K_SMBIOS_BDF_EXT_MAGIC "BDF_" ++ + extern unsigned int ath11k_frame_mode; + + #define ATH11K_MON_TIMER_INTERVAL 10 +@@ -154,6 +165,13 @@ struct ath11k_ext_irq_grp { + struct net_device napi_ndev; + }; + ++struct ath11k_smbios_bdf { ++ struct dmi_header hdr; ++ u32 padding; ++ u8 bdf_enabled; ++ u8 bdf_ext[]; ++}; ++ + #define HEHANDLE_CAP_PHYINFO_SIZE 3 + #define HECAP_PHYINFO_SIZE 9 + #define HECAP_MACINFO_SIZE 5 +@@ -1046,7 +1064,7 @@ int ath11k_core_fetch_board_data_api_1(s + const char *name); + void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd); + int ath11k_core_check_dt(struct ath11k_base *ath11k); +- ++int ath11k_core_check_smbios(struct ath11k_base *ab); + void ath11k_core_halt(struct ath11k *ar); + int ath11k_core_resume(struct ath11k_base *ab); + int ath11k_core_suspend(struct ath11k_base *ab); +--- a/drivers/net/wireless/ath/ath11k/qmi.c ++++ b/drivers/net/wireless/ath/ath11k/qmi.c +@@ -2095,6 +2095,10 @@ static int ath11k_qmi_request_target_cap + ab->qmi.target.fw_build_timestamp, + fw_build_id); + ++ r = ath11k_core_check_smbios(ab); ++ if (r) ++ ath11k_dbg(ab, ATH11K_DBG_QMI, "SMBIOS bdf variant name not set.\n"); ++ + r = ath11k_core_check_dt(ab); + if (r) + ath11k_dbg(ab, ATH11K_DBG_QMI, "DT bdf variant name not set.\n"); diff --git a/package/kernel/mac80211/patches/ath11k/0211-ath11k-Add-peer-rhash-table-support.patch b/package/kernel/mac80211/patches/ath11k/0211-ath11k-Add-peer-rhash-table-support.patch new file mode 100644 index 000000000..ffaecc1ae --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0211-ath11k-Add-peer-rhash-table-support.patch @@ -0,0 +1,678 @@ +From 7b0c70d92a435913f6e11d6a248b935697e8a3eb Mon Sep 17 00:00:00 2001 +From: Karthikeyan Periyasamy +Date: Wed, 23 Mar 2022 11:14:17 +0200 +Subject: [PATCH] ath11k: Add peer rhash table support + +When more clients (128) are connected, the UL data traffic +KPI measurement is low compared to single client. This issue +is due to more CPU cycles spent on the peer lookup operation +with more clients. So reduce the peer lookup operation by +modifying the linear based lookup operation into the rhash +based lookup operation. This improve the peak throughput +measurement. Since this is a software algorithm change, it is +applicable for all the platforms. + +TCP UL 128 Clients test case Observation (64bit system): +Previous: ~550 Mbps +Now : ~860 Mbps + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01067-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Karthikeyan Periyasamy +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/1644036628-5334-1-git-send-email-quic_periyasa@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 3 +- + drivers/net/wireless/ath/ath11k/core.h | 14 + + drivers/net/wireless/ath/ath11k/mac.c | 16 +- + drivers/net/wireless/ath/ath11k/peer.c | 344 +++++++++++++++++++++++-- + drivers/net/wireless/ath/ath11k/peer.h | 10 +- + 5 files changed, 363 insertions(+), 24 deletions(-) + +--- 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 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -1680,6 +1680,7 @@ struct ath11k_base *ath11k_core_alloc(st + goto err_free_wq; + + mutex_init(&ab->core_lock); ++ mutex_init(&ab->tbl_mtx_lock); + spin_lock_init(&ab->base_lock); + mutex_init(&ab->vdev_id_11d_lock); + init_completion(&ab->reset_complete); +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -1,6 +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. + */ + + #ifndef ATH11K_CORE_H +@@ -12,6 +13,7 @@ + #include + #include + #include ++#include + #include "qmi.h" + #include "htc.h" + #include "wmi.h" +@@ -803,6 +805,18 @@ struct ath11k_base { + struct ath11k_pdev __rcu *pdevs_active[MAX_RADIOS]; + struct ath11k_hal_reg_capabilities_ext hal_reg_cap[MAX_RADIOS]; + unsigned long long free_vdev_map; ++ ++ /* To synchronize rhash tbl write operation */ ++ struct mutex tbl_mtx_lock; ++ ++ /* The rhashtable containing struct ath11k_peer keyed by mac addr */ ++ struct rhashtable *rhead_peer_addr; ++ struct rhashtable_params rhash_peer_addr_param; ++ ++ /* The rhashtable containing struct ath11k_peer keyed by id */ ++ struct rhashtable *rhead_peer_id; ++ struct rhashtable_params rhash_peer_id_param; ++ + struct list_head peers; + wait_queue_head_t peer_mapping_wq; + u8 mac_addr[ETH_ALEN]; +--- 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 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #include +@@ -875,13 +875,16 @@ void ath11k_mac_peer_cleanup_all(struct + + lockdep_assert_held(&ar->conf_mutex); + ++ mutex_lock(&ab->tbl_mtx_lock); + spin_lock_bh(&ab->base_lock); + list_for_each_entry_safe(peer, tmp, &ab->peers, list) { + ath11k_peer_rx_tid_cleanup(ar, peer); ++ ath11k_peer_rhash_delete(ab, peer); + list_del(&peer->list); + kfree(peer); + } + spin_unlock_bh(&ab->base_lock); ++ mutex_unlock(&ab->tbl_mtx_lock); + + ar->num_peers = 0; + ar->num_stations = 0; +@@ -4554,6 +4557,7 @@ static int ath11k_mac_op_sta_state(struc + } + + ath11k_mac_dec_num_stations(arvif, sta); ++ mutex_lock(&ar->ab->tbl_mtx_lock); + spin_lock_bh(&ar->ab->base_lock); + peer = ath11k_peer_find(ar->ab, arvif->vdev_id, sta->addr); + if (skip_peer_delete && peer) { +@@ -4561,12 +4565,14 @@ static int ath11k_mac_op_sta_state(struc + } else if (peer && peer->sta == sta) { + ath11k_warn(ar->ab, "Found peer entry %pM n vdev %i after it was supposedly removed\n", + vif->addr, arvif->vdev_id); ++ ath11k_peer_rhash_delete(ar->ab, peer); + peer->sta = NULL; + list_del(&peer->list); + kfree(peer); + ar->num_peers--; + } + spin_unlock_bh(&ar->ab->base_lock); ++ mutex_unlock(&ar->ab->tbl_mtx_lock); + + kfree(arsta->tx_stats); + arsta->tx_stats = NULL; +@@ -8574,6 +8580,8 @@ void ath11k_mac_unregister(struct ath11k + + __ath11k_mac_unregister(ar); + } ++ ++ ath11k_peer_rhash_tbl_destroy(ab); + } + + static int __ath11k_mac_register(struct ath11k *ar) +@@ -8802,6 +8810,10 @@ int ath11k_mac_register(struct ath11k_ba + ab->cc_freq_hz = IPQ8074_CC_FREQ_HERTZ; + ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS(ab))) - 1; + ++ ret = ath11k_peer_rhash_tbl_init(ab); ++ if (ret) ++ return ret; ++ + for (i = 0; i < ab->num_radios; i++) { + pdev = &ab->pdevs[i]; + ar = pdev->ar; +@@ -8831,6 +8843,8 @@ err_cleanup: + __ath11k_mac_unregister(ar); + } + ++ ath11k_peer_rhash_tbl_destroy(ab); ++ + return ret; + } + +--- a/drivers/net/wireless/ath/ath11k/peer.c ++++ b/drivers/net/wireless/ath/ath11k/peer.c +@@ -1,23 +1,22 @@ + // 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. + */ + + #include "core.h" + #include "peer.h" + #include "debug.h" + +-struct ath11k_peer *ath11k_peer_find(struct ath11k_base *ab, int vdev_id, +- const u8 *addr) ++static struct ath11k_peer *ath11k_peer_find_list_by_id(struct ath11k_base *ab, ++ int peer_id) + { + struct ath11k_peer *peer; + + lockdep_assert_held(&ab->base_lock); + + list_for_each_entry(peer, &ab->peers, list) { +- if (peer->vdev_id != vdev_id) +- continue; +- if (!ether_addr_equal(peer->addr, addr)) ++ if (peer->peer_id != peer_id) + continue; + + return peer; +@@ -26,15 +25,15 @@ struct ath11k_peer *ath11k_peer_find(str + return NULL; + } + +-static struct ath11k_peer *ath11k_peer_find_by_pdev_idx(struct ath11k_base *ab, +- u8 pdev_idx, const u8 *addr) ++struct ath11k_peer *ath11k_peer_find(struct ath11k_base *ab, int vdev_id, ++ const u8 *addr) + { + struct ath11k_peer *peer; + + lockdep_assert_held(&ab->base_lock); + + list_for_each_entry(peer, &ab->peers, list) { +- if (peer->pdev_idx != pdev_idx) ++ if (peer->vdev_id != vdev_id) + continue; + if (!ether_addr_equal(peer->addr, addr)) + continue; +@@ -52,14 +51,13 @@ struct ath11k_peer *ath11k_peer_find_by_ + + lockdep_assert_held(&ab->base_lock); + +- list_for_each_entry(peer, &ab->peers, list) { +- if (!ether_addr_equal(peer->addr, addr)) +- continue; ++ if (!ab->rhead_peer_addr) ++ return NULL; + +- return peer; +- } ++ peer = rhashtable_lookup_fast(ab->rhead_peer_addr, addr, ++ ab->rhash_peer_addr_param); + +- return NULL; ++ return peer; + } + + struct ath11k_peer *ath11k_peer_find_by_id(struct ath11k_base *ab, +@@ -69,11 +67,13 @@ struct ath11k_peer *ath11k_peer_find_by_ + + lockdep_assert_held(&ab->base_lock); + +- list_for_each_entry(peer, &ab->peers, list) +- if (peer_id == peer->peer_id) +- return peer; ++ if (!ab->rhead_peer_id) ++ return NULL; + +- return NULL; ++ peer = rhashtable_lookup_fast(ab->rhead_peer_id, &peer_id, ++ ab->rhash_peer_id_param); ++ ++ return peer; + } + + struct ath11k_peer *ath11k_peer_find_by_vdev_id(struct ath11k_base *ab, +@@ -99,7 +99,7 @@ void ath11k_peer_unmap_event(struct ath1 + + spin_lock_bh(&ab->base_lock); + +- peer = ath11k_peer_find_by_id(ab, peer_id); ++ peer = ath11k_peer_find_list_by_id(ab, peer_id); + if (!peer) { + ath11k_warn(ab, "peer-unmap-event: unknown peer id %d\n", + peer_id); +@@ -167,6 +167,76 @@ static int ath11k_wait_for_peer_common(s + return 0; + } + ++static inline int ath11k_peer_rhash_insert(struct ath11k_base *ab, ++ struct rhashtable *rtbl, ++ struct rhash_head *rhead, ++ struct rhashtable_params *params, ++ void *key) ++{ ++ struct ath11k_peer *tmp; ++ ++ lockdep_assert_held(&ab->tbl_mtx_lock); ++ ++ tmp = rhashtable_lookup_get_insert_fast(rtbl, rhead, *params); ++ ++ if (!tmp) ++ return 0; ++ else if (IS_ERR(tmp)) ++ return PTR_ERR(tmp); ++ else ++ return -EEXIST; ++} ++ ++static inline int ath11k_peer_rhash_remove(struct ath11k_base *ab, ++ struct rhashtable *rtbl, ++ struct rhash_head *rhead, ++ struct rhashtable_params *params) ++{ ++ int ret; ++ ++ lockdep_assert_held(&ab->tbl_mtx_lock); ++ ++ ret = rhashtable_remove_fast(rtbl, rhead, *params); ++ if (ret && ret != -ENOENT) ++ return ret; ++ ++ return 0; ++} ++ ++static int ath11k_peer_rhash_add(struct ath11k_base *ab, struct ath11k_peer *peer) ++{ ++ int ret; ++ ++ lockdep_assert_held(&ab->base_lock); ++ lockdep_assert_held(&ab->tbl_mtx_lock); ++ ++ if (!ab->rhead_peer_id || !ab->rhead_peer_addr) ++ return -EPERM; ++ ++ ret = ath11k_peer_rhash_insert(ab, ab->rhead_peer_id, &peer->rhash_id, ++ &ab->rhash_peer_id_param, &peer->peer_id); ++ if (ret) { ++ ath11k_warn(ab, "failed to add peer %pM with id %d in rhash_id ret %d\n", ++ peer->addr, peer->peer_id, ret); ++ return ret; ++ } ++ ++ ret = ath11k_peer_rhash_insert(ab, ab->rhead_peer_addr, &peer->rhash_addr, ++ &ab->rhash_peer_addr_param, &peer->addr); ++ if (ret) { ++ ath11k_warn(ab, "failed to add peer %pM with id %d in rhash_addr ret %d\n", ++ peer->addr, peer->peer_id, ret); ++ goto err_clean; ++ } ++ ++ return 0; ++ ++err_clean: ++ ath11k_peer_rhash_remove(ab, ab->rhead_peer_id, &peer->rhash_id, ++ &ab->rhash_peer_id_param); ++ return ret; ++} ++ + void ath11k_peer_cleanup(struct ath11k *ar, u32 vdev_id) + { + struct ath11k_peer *peer, *tmp; +@@ -174,6 +244,7 @@ void ath11k_peer_cleanup(struct ath11k * + + lockdep_assert_held(&ar->conf_mutex); + ++ mutex_lock(&ab->tbl_mtx_lock); + spin_lock_bh(&ab->base_lock); + list_for_each_entry_safe(peer, tmp, &ab->peers, list) { + if (peer->vdev_id != vdev_id) +@@ -182,12 +253,14 @@ void ath11k_peer_cleanup(struct ath11k * + ath11k_warn(ab, "removing stale peer %pM from vdev_id %d\n", + peer->addr, vdev_id); + ++ ath11k_peer_rhash_delete(ab, peer); + list_del(&peer->list); + kfree(peer); + ar->num_peers--; + } + + spin_unlock_bh(&ab->base_lock); ++ mutex_unlock(&ab->tbl_mtx_lock); + } + + static int ath11k_wait_for_peer_deleted(struct ath11k *ar, int vdev_id, const u8 *addr) +@@ -220,14 +293,35 @@ int ath11k_wait_for_peer_delete_done(str + static int __ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, const u8 *addr) + { + int ret; ++ struct ath11k_peer *peer; ++ struct ath11k_base *ab = ar->ab; + + lockdep_assert_held(&ar->conf_mutex); + ++ mutex_lock(&ab->tbl_mtx_lock); ++ spin_lock_bh(&ab->base_lock); ++ ++ peer = ath11k_peer_find_by_addr(ab, addr); ++ if (!peer) { ++ spin_unlock_bh(&ab->base_lock); ++ mutex_unlock(&ab->tbl_mtx_lock); ++ ++ ath11k_warn(ab, ++ "failed to find peer vdev_id %d addr %pM in delete\n", ++ vdev_id, addr); ++ return -EINVAL; ++ } ++ ++ ath11k_peer_rhash_delete(ab, peer); ++ ++ spin_unlock_bh(&ab->base_lock); ++ mutex_unlock(&ab->tbl_mtx_lock); ++ + reinit_completion(&ar->peer_delete_done); + + ret = ath11k_wmi_send_peer_delete_cmd(ar, addr, vdev_id); + if (ret) { +- ath11k_warn(ar->ab, ++ ath11k_warn(ab, + "failed to delete peer vdev_id %d addr %pM ret %d\n", + vdev_id, addr, ret); + return ret; +@@ -276,7 +370,7 @@ int ath11k_peer_create(struct ath11k *ar + } + + spin_lock_bh(&ar->ab->base_lock); +- peer = ath11k_peer_find_by_pdev_idx(ar->ab, ar->pdev_idx, param->peer_addr); ++ peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr); + if (peer) { + spin_unlock_bh(&ar->ab->base_lock); + return -EINVAL; +@@ -296,11 +390,13 @@ int ath11k_peer_create(struct ath11k *ar + if (ret) + return ret; + ++ mutex_lock(&ar->ab->tbl_mtx_lock); + spin_lock_bh(&ar->ab->base_lock); + + peer = ath11k_peer_find(ar->ab, param->vdev_id, param->peer_addr); + if (!peer) { + spin_unlock_bh(&ar->ab->base_lock); ++ mutex_unlock(&ar->ab->tbl_mtx_lock); + ath11k_warn(ar->ab, "failed to find peer %pM on vdev %i after creation\n", + param->peer_addr, param->vdev_id); + +@@ -308,6 +404,13 @@ int ath11k_peer_create(struct ath11k *ar + goto cleanup; + } + ++ ret = ath11k_peer_rhash_add(ar->ab, peer); ++ if (ret) { ++ spin_unlock_bh(&ar->ab->base_lock); ++ mutex_unlock(&ar->ab->tbl_mtx_lock); ++ goto cleanup; ++ } ++ + peer->pdev_idx = ar->pdev_idx; + peer->sta = sta; + +@@ -332,6 +435,7 @@ int ath11k_peer_create(struct ath11k *ar + ar->num_peers++; + + spin_unlock_bh(&ar->ab->base_lock); ++ mutex_unlock(&ar->ab->tbl_mtx_lock); + + return 0; + +@@ -343,3 +447,201 @@ cleanup: + + return ret; + } ++ ++int ath11k_peer_rhash_delete(struct ath11k_base *ab, struct ath11k_peer *peer) ++{ ++ int ret; ++ ++ lockdep_assert_held(&ab->base_lock); ++ lockdep_assert_held(&ab->tbl_mtx_lock); ++ ++ if (!ab->rhead_peer_id || !ab->rhead_peer_addr) ++ return -EPERM; ++ ++ ret = ath11k_peer_rhash_remove(ab, ab->rhead_peer_addr, &peer->rhash_addr, ++ &ab->rhash_peer_addr_param); ++ if (ret) { ++ ath11k_warn(ab, "failed to remove peer %pM id %d in rhash_addr ret %d\n", ++ peer->addr, peer->peer_id, ret); ++ return ret; ++ } ++ ++ ret = ath11k_peer_rhash_remove(ab, ab->rhead_peer_id, &peer->rhash_id, ++ &ab->rhash_peer_id_param); ++ if (ret) { ++ ath11k_warn(ab, "failed to remove peer %pM id %d in rhash_id ret %d\n", ++ peer->addr, peer->peer_id, ret); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static int ath11k_peer_rhash_id_tbl_init(struct ath11k_base *ab) ++{ ++ struct rhashtable_params *param; ++ struct rhashtable *rhash_id_tbl; ++ int ret; ++ size_t size; ++ ++ lockdep_assert_held(&ab->tbl_mtx_lock); ++ ++ if (ab->rhead_peer_id) ++ return 0; ++ ++ size = sizeof(*ab->rhead_peer_id); ++ rhash_id_tbl = kzalloc(size, GFP_KERNEL); ++ if (!rhash_id_tbl) { ++ ath11k_warn(ab, "failed to init rhash id table due to no mem (size %zu)\n", ++ size); ++ return -ENOMEM; ++ } ++ ++ param = &ab->rhash_peer_id_param; ++ ++ param->key_offset = offsetof(struct ath11k_peer, peer_id); ++ param->head_offset = offsetof(struct ath11k_peer, rhash_id); ++ param->key_len = sizeof_field(struct ath11k_peer, peer_id); ++ param->automatic_shrinking = true; ++ param->nelem_hint = ab->num_radios * TARGET_NUM_PEERS_PDEV(ab); ++ ++ ret = rhashtable_init(rhash_id_tbl, param); ++ if (ret) { ++ ath11k_warn(ab, "failed to init peer id rhash table %d\n", ret); ++ goto err_free; ++ } ++ ++ spin_lock_bh(&ab->base_lock); ++ ++ if (!ab->rhead_peer_id) { ++ ab->rhead_peer_id = rhash_id_tbl; ++ } else { ++ spin_unlock_bh(&ab->base_lock); ++ goto cleanup_tbl; ++ } ++ ++ spin_unlock_bh(&ab->base_lock); ++ ++ return 0; ++ ++cleanup_tbl: ++ rhashtable_destroy(rhash_id_tbl); ++err_free: ++ kfree(rhash_id_tbl); ++ ++ return ret; ++} ++ ++static int ath11k_peer_rhash_addr_tbl_init(struct ath11k_base *ab) ++{ ++ struct rhashtable_params *param; ++ struct rhashtable *rhash_addr_tbl; ++ int ret; ++ size_t size; ++ ++ lockdep_assert_held(&ab->tbl_mtx_lock); ++ ++ if (ab->rhead_peer_addr) ++ return 0; ++ ++ size = sizeof(*ab->rhead_peer_addr); ++ rhash_addr_tbl = kzalloc(size, GFP_KERNEL); ++ if (!rhash_addr_tbl) { ++ ath11k_warn(ab, "failed to init rhash addr table due to no mem (size %zu)\n", ++ size); ++ return -ENOMEM; ++ } ++ ++ param = &ab->rhash_peer_addr_param; ++ ++ param->key_offset = offsetof(struct ath11k_peer, addr); ++ param->head_offset = offsetof(struct ath11k_peer, rhash_addr); ++ param->key_len = sizeof_field(struct ath11k_peer, addr); ++ param->automatic_shrinking = true; ++ param->nelem_hint = ab->num_radios * TARGET_NUM_PEERS_PDEV(ab); ++ ++ ret = rhashtable_init(rhash_addr_tbl, param); ++ if (ret) { ++ ath11k_warn(ab, "failed to init peer addr rhash table %d\n", ret); ++ goto err_free; ++ } ++ ++ spin_lock_bh(&ab->base_lock); ++ ++ if (!ab->rhead_peer_addr) { ++ ab->rhead_peer_addr = rhash_addr_tbl; ++ } else { ++ spin_unlock_bh(&ab->base_lock); ++ goto cleanup_tbl; ++ } ++ ++ spin_unlock_bh(&ab->base_lock); ++ ++ return 0; ++ ++cleanup_tbl: ++ rhashtable_destroy(rhash_addr_tbl); ++err_free: ++ kfree(rhash_addr_tbl); ++ ++ return ret; ++} ++ ++static inline void ath11k_peer_rhash_id_tbl_destroy(struct ath11k_base *ab) ++{ ++ lockdep_assert_held(&ab->tbl_mtx_lock); ++ ++ if (!ab->rhead_peer_id) ++ return; ++ ++ rhashtable_destroy(ab->rhead_peer_id); ++ kfree(ab->rhead_peer_id); ++ ab->rhead_peer_id = NULL; ++} ++ ++static inline void ath11k_peer_rhash_addr_tbl_destroy(struct ath11k_base *ab) ++{ ++ lockdep_assert_held(&ab->tbl_mtx_lock); ++ ++ if (!ab->rhead_peer_addr) ++ return; ++ ++ rhashtable_destroy(ab->rhead_peer_addr); ++ kfree(ab->rhead_peer_addr); ++ ab->rhead_peer_addr = NULL; ++} ++ ++int ath11k_peer_rhash_tbl_init(struct ath11k_base *ab) ++{ ++ int ret; ++ ++ mutex_lock(&ab->tbl_mtx_lock); ++ ++ ret = ath11k_peer_rhash_id_tbl_init(ab); ++ if (ret) ++ goto out; ++ ++ ret = ath11k_peer_rhash_addr_tbl_init(ab); ++ if (ret) ++ goto cleanup_tbl; ++ ++ mutex_unlock(&ab->tbl_mtx_lock); ++ ++ return 0; ++ ++cleanup_tbl: ++ ath11k_peer_rhash_id_tbl_destroy(ab); ++out: ++ mutex_unlock(&ab->tbl_mtx_lock); ++ return ret; ++} ++ ++void ath11k_peer_rhash_tbl_destroy(struct ath11k_base *ab) ++{ ++ mutex_lock(&ab->tbl_mtx_lock); ++ ++ ath11k_peer_rhash_addr_tbl_destroy(ab); ++ ath11k_peer_rhash_id_tbl_destroy(ab); ++ ++ mutex_unlock(&ab->tbl_mtx_lock); ++} +--- a/drivers/net/wireless/ath/ath11k/peer.h ++++ b/drivers/net/wireless/ath/ath11k/peer.h +@@ -1,6 +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. + */ + + #ifndef ATH11K_PEER_H +@@ -20,6 +21,11 @@ struct ath11k_peer { + struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1]; + struct dp_rx_tid rx_tid[IEEE80211_NUM_TIDS + 1]; + ++ /* peer id based rhashtable list pointer */ ++ struct rhash_head rhash_id; ++ /* peer addr based rhashtable list pointer */ ++ struct rhash_head rhash_addr; ++ + /* Info used in MMIC verification of + * RX fragments + */ +@@ -47,5 +53,7 @@ int ath11k_wait_for_peer_delete_done(str + const u8 *addr); + struct ath11k_peer *ath11k_peer_find_by_vdev_id(struct ath11k_base *ab, + int vdev_id); +- ++int ath11k_peer_rhash_tbl_init(struct ath11k_base *ab); ++void ath11k_peer_rhash_tbl_destroy(struct ath11k_base *ab); ++int ath11k_peer_rhash_delete(struct ath11k_base *ab, struct ath11k_peer *peer); + #endif /* _PEER_H_ */ diff --git a/package/kernel/mac80211/patches/ath11k/0212-ath11k-store-and-send-country-code-to-firmware-after.patch b/package/kernel/mac80211/patches/ath11k/0212-ath11k-store-and-send-country-code-to-firmware-after.patch new file mode 100644 index 000000000..3d7f8909b --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0212-ath11k-store-and-send-country-code-to-firmware-after.patch @@ -0,0 +1,70 @@ +From b2beae327e039736299f3c6559f3467323fe68c5 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Wed, 23 Mar 2022 21:18:56 -0400 +Subject: [PATCH] ath11k: store and send country code to firmware after + recovery + +Currently ath11k does not send the country code to firmware after device +recovery, as a result the regdomain info is reported from firmware by +default. Regdomain info is important, so ath11k also need to restore +it to the value which was used before recovery. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 + +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220324011856.11014-1-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 1 + + drivers/net/wireless/ath/ath11k/core.h | 1 + + drivers/net/wireless/ath/ath11k/mac.c | 8 ++++++++ + drivers/net/wireless/ath/ath11k/reg.c | 1 + + 4 files changed, 11 insertions(+) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -1404,6 +1404,7 @@ static void ath11k_update_11d(struct wor + pdev = &ab->pdevs[i]; + ar = pdev->ar; + ++ memcpy(&ar->alpha2, &set_current_param.alpha2, 2); + ret = ath11k_wmi_send_set_current_country_cmd(ar, &set_current_param); + if (ret) + ath11k_warn(ar->ab, +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -671,6 +671,7 @@ struct ath11k { + int hw_rate_code; + u8 twt_enabled; + bool nlo_enabled; ++ u8 alpha2[REG_ALPHA2_LEN + 1]; + }; + + struct ath11k_band_cap { +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -7957,6 +7957,14 @@ ath11k_mac_op_reconfig_complete(struct i + ar->state = ATH11K_STATE_ON; + ieee80211_wake_queues(ar->hw); + ++ if (ar->ab->hw_params.current_cc_support && ++ ar->alpha2[0] != 0 && ar->alpha2[1] != 0) { ++ struct wmi_set_current_country_params set_current_param = {}; ++ ++ memcpy(&set_current_param.alpha2, ar->alpha2, 2); ++ ath11k_wmi_send_set_current_country_cmd(ar, &set_current_param); ++ } ++ + if (ab->is_reset) { + recovery_count = atomic_inc_return(&ab->recovery_count); + ath11k_dbg(ab, ATH11K_DBG_BOOT, +--- a/drivers/net/wireless/ath/ath11k/reg.c ++++ b/drivers/net/wireless/ath/ath11k/reg.c +@@ -83,6 +83,7 @@ ath11k_reg_notifier(struct wiphy *wiphy, + */ + if (ar->ab->hw_params.current_cc_support) { + memcpy(&set_current_param.alpha2, request->alpha2, 2); ++ memcpy(&ar->alpha2, &set_current_param.alpha2, 2); + ret = ath11k_wmi_send_set_current_country_cmd(ar, &set_current_param); + if (ret) + ath11k_warn(ar->ab, diff --git a/package/kernel/mac80211/patches/ath11k/0213-ath11k-add-support-to-search-regdb-data-in-board-2.b.patch b/package/kernel/mac80211/patches/ath11k/0213-ath11k-add-support-to-search-regdb-data-in-board-2.b.patch new file mode 100644 index 000000000..720a6f2b7 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0213-ath11k-add-support-to-search-regdb-data-in-board-2.b.patch @@ -0,0 +1,316 @@ +From 801cb1d234288d9bc2afeaa98c7e98f8038b7a6c Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Mon, 28 Mar 2022 14:57:19 +0300 +Subject: [PATCH] ath11k: add support to search regdb data in board-2.bin for + WCN6855 + +Currently ath11k only download the same regdb.bin file for all WCN6855 +chips, actually ath11k needs to distinguish all different WCN6855 chips. + +This is to re-use the string type which include bus, chip id, board id, +vendor, device, subsystem-vendor, subsystem-device and variant for +WCN6855 to distinguish different regdb in board-2.bin. + +ath11k will first load board-2.bin and search in it for the regdb data +with the above parameters, if matched one regdb data, then download it +to firmware, if not matched any one, then ath11k will download the file +regdb.bin to firmware. + +Add enum value ATH11K_BD_IE_REGDB and enum type ath11k_bd_ie_regdb_type +to distinguish regdb data and board data since they are in the same file +board-2.bin. + +This only take effect for WCN6855 which supports regdb in hardware parameters. + +Test log: +[ 3833.091948] ath11k_pci 0000:05: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' +[ 3833.092072] ath11k_pci 0000:05:00.0: boot firmware request ath11k/WCN6855/hw2.0/board-2.bin size 205316 +[ 3833.092079] ath11k_pci 0000:05:00.0: board name +[ 3833.092083] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 71 6d 69 2d 63 68 69 70 bus=pci,qmi-chip +[ 3833.092088] ath11k_pci 0000:05:00.0: 00000010: 2d 69 64 3d 31 -id=1 +[ 3833.092091] ath11k_pci 0000:05:00.0: board name +[ 3833.092095] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 71 6d 69 2d 63 68 69 70 bus=pci,qmi-chip +[ 3833.092099] ath11k_pci 0000:05:00.0: 00000010: 2d 69 64 3d 32 -id=2 +[ 3833.092102] ath11k_pci 0000:05:00.0: board name +[ 3833.092105] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 71 6d 69 2d 63 68 69 70 bus=pci,qmi-chip +[ 3833.092109] ath11k_pci 0000:05:00.0: 00000010: 2d 69 64 3d 33 -id=3 +[ 3833.092112] ath11k_pci 0000:05:00.0: board name +[ 3833.092116] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 76 65 6e 64 6f 72 3d 31 bus=pci,vendor=1 +[ 3833.092119] ath11k_pci 0000:05:00.0: 00000010: 37 63 62 2c 64 65 76 69 63 65 3d 31 31 30 33 2c 7cb,device=1103, +[ 3833.092123] ath11k_pci 0000:05:00.0: 00000020: 73 75 62 73 79 73 74 65 6d 2d 76 65 6e 64 6f 72 subsystem-vendor +[ 3833.092126] ath11k_pci 0000:05:00.0: 00000030: 3d 31 37 63 62 2c 73 75 62 73 79 73 74 65 6d 2d =17cb,subsystem- +[ 3833.092130] ath11k_pci 0000:05:00.0: 00000040: 64 65 76 69 63 65 3d 33 33 37 34 2c 71 6d 69 2d device=3374,qmi- +[ 3833.092133] ath11k_pci 0000:05:00.0: 00000050: 63 68 69 70 2d 69 64 3d 32 2c 71 6d 69 2d 62 6f chip-id=2,qmi-bo +[ 3833.092137] ath11k_pci 0000:05:00.0: 00000060: 61 72 64 2d 69 64 3d 32 36 36 2c 76 61 72 69 61 ard-id=266,varia +[ 3833.092140] ath11k_pci 0000:05:00.0: 00000070: 6e 74 3d 48 50 5f 47 38 5f 4c 61 6e 63 69 61 31 nt=HP_G8_Lancia1 +[ 3833.092144] ath11k_pci 0000:05:00.0: 00000080: 35 5 +[ 3833.092147] ath11k_pci 0000:05:00.0: board name +[ 3833.092150] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 76 65 6e 64 6f 72 3d 31 bus=pci,vendor=1 +[ 3833.092154] ath11k_pci 0000:05:00.0: 00000010: 37 63 62 2c 64 65 76 69 63 65 3d 31 31 30 33 2c 7cb,device=1103, +[ 3833.092157] ath11k_pci 0000:05:00.0: 00000020: 73 75 62 73 79 73 74 65 6d 2d 76 65 6e 64 6f 72 subsystem-vendor +[ 3833.092161] ath11k_pci 0000:05:00.0: 00000030: 3d 31 37 63 62 2c 73 75 62 73 79 73 74 65 6d 2d =17cb,subsystem- +[ 3833.092165] ath11k_pci 0000:05:00.0: 00000040: 64 65 76 69 63 65 3d 33 33 37 34 2c 71 6d 69 2d device=3374,qmi- +[ 3833.092168] ath11k_pci 0000:05:00.0: 00000050: 63 68 69 70 2d 69 64 3d 32 2c 71 6d 69 2d 62 6f chip-id=2,qmi-bo +[ 3833.092172] ath11k_pci 0000:05:00.0: 00000060: 61 72 64 2d 69 64 3d 32 36 36 ard-id=266 +[ 3833.092206] ath11k_pci 0000:05:00.0: board name +[ 3833.092209] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 76 65 6e 64 6f 72 3d 31 bus=pci,vendor=1 +[ 3833.092213] ath11k_pci 0000:05:00.0: 00000010: 37 63 62 2c 64 65 76 69 63 65 3d 31 31 30 33 2c 7cb,device=1103, +[ 3833.092216] ath11k_pci 0000:05:00.0: 00000020: 73 75 62 73 79 73 74 65 6d 2d 76 65 6e 64 6f 72 subsystem-vendor +[ 3833.092220] ath11k_pci 0000:05:00.0: 00000030: 3d 31 37 63 62 2c 73 75 62 73 79 73 74 65 6d 2d =17cb,subsystem- +[ 3833.092223] ath11k_pci 0000:05:00.0: 00000040: 64 65 76 69 63 65 3d 33 33 37 34 2c 71 6d 69 2d device=3374,qmi- +[ 3833.092227] ath11k_pci 0000:05:00.0: 00000050: 63 68 69 70 2d 69 64 3d 32 2c 71 6d 69 2d 62 6f chip-id=2,qmi-bo +[ 3833.092230] ath11k_pci 0000:05:00.0: 00000060: 61 72 64 2d 69 64 3d 32 36 32 ard-id=262 +[ 3833.092234] ath11k_pci 0000:05:00.0: boot found match regdb data for name 'bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262' +[ 3833.092238] ath11k_pci 0000:05:00.0: board name +[ 3833.092241] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 71 6d 69 2d 63 68 69 70 bus=pci,qmi-chip +[ 3833.092245] ath11k_pci 0000:05:00.0: 00000010: 2d 69 64 3d 31 31 -id=11 +[ 3833.092248] ath11k_pci 0000:05:00.0: board name +[ 3833.092251] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 71 6d 69 2d 63 68 69 70 bus=pci,qmi-chip +[ 3833.092255] ath11k_pci 0000:05:00.0: 00000010: 2d 69 64 3d 32 32 -id=22 +[ 3833.092258] ath11k_pci 0000:05:00.0: board name +[ 3833.092261] ath11k_pci 0000:05:00.0: 00000000: 62 75 73 3d 70 63 69 2c 71 6d 69 2d 63 68 69 70 bus=pci,qmi-chip +[ 3833.092265] ath11k_pci 0000:05:00.0: 00000010: 2d 69 64 3d 33 33 -id=33 +[ 3833.092268] ath11k_pci 0000:05:00.0: boot found regdb data for 'bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=3374,qmi-chip-id=2,qmi-board-id=262' +[ 3833.092272] ath11k_pci 0000:05: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 +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220319023543.14288-4-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 84 ++++++++++++++++++-------- + drivers/net/wireless/ath/ath11k/hw.h | 19 ++++++ + 2 files changed, 78 insertions(+), 25 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -723,7 +723,9 @@ static int ath11k_core_parse_bd_ie_board + struct ath11k_board_data *bd, + const void *buf, size_t buf_len, + const char *boardname, +- int bd_ie_type) ++ int ie_id, ++ int name_id, ++ int data_id) + { + const struct ath11k_fw_ie *hdr; + bool name_match_found; +@@ -733,7 +735,7 @@ static int ath11k_core_parse_bd_ie_board + + name_match_found = false; + +- /* go through ATH11K_BD_IE_BOARD_ elements */ ++ /* go through ATH11K_BD_IE_BOARD_/ATH11K_BD_IE_REGDB_ elements */ + while (buf_len > sizeof(struct ath11k_fw_ie)) { + hdr = buf; + board_ie_id = le32_to_cpu(hdr->id); +@@ -744,48 +746,50 @@ static int ath11k_core_parse_bd_ie_board + buf += sizeof(*hdr); + + if (buf_len < ALIGN(board_ie_len, 4)) { +- ath11k_err(ab, "invalid ATH11K_BD_IE_BOARD length: %zu < %zu\n", ++ ath11k_err(ab, "invalid %s length: %zu < %zu\n", ++ ath11k_bd_ie_type_str(ie_id), + buf_len, ALIGN(board_ie_len, 4)); + ret = -EINVAL; + goto out; + } + +- switch (board_ie_id) { +- case ATH11K_BD_IE_BOARD_NAME: ++ if (board_ie_id == name_id) { + ath11k_dbg_dump(ab, ATH11K_DBG_BOOT, "board name", "", + board_ie_data, board_ie_len); + + if (board_ie_len != strlen(boardname)) +- break; ++ goto next; + + ret = memcmp(board_ie_data, boardname, strlen(boardname)); + if (ret) +- break; ++ goto next; + + name_match_found = true; + ath11k_dbg(ab, ATH11K_DBG_BOOT, +- "boot found match for name '%s'", ++ "boot found match %s for name '%s'", ++ ath11k_bd_ie_type_str(ie_id), + boardname); +- break; +- case ATH11K_BD_IE_BOARD_DATA: ++ } else if (board_ie_id == data_id) { + if (!name_match_found) + /* no match found */ +- break; ++ goto next; + + ath11k_dbg(ab, ATH11K_DBG_BOOT, +- "boot found board data for '%s'", boardname); ++ "boot found %s for '%s'", ++ ath11k_bd_ie_type_str(ie_id), ++ boardname); + + bd->data = board_ie_data; + bd->len = board_ie_len; + + ret = 0; + goto out; +- default: +- ath11k_warn(ab, "unknown ATH11K_BD_IE_BOARD found: %d\n", ++ } else { ++ ath11k_warn(ab, "unknown %s id found: %d\n", ++ ath11k_bd_ie_type_str(ie_id), + board_ie_id); +- break; + } +- ++next: + /* jump over the padding */ + board_ie_len = ALIGN(board_ie_len, 4); + +@@ -802,7 +806,10 @@ out: + + static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab, + struct ath11k_board_data *bd, +- const char *boardname) ++ const char *boardname, ++ int ie_id_match, ++ int name_id, ++ int data_id) + { + size_t len, magic_len; + const u8 *data; +@@ -867,22 +874,23 @@ static int ath11k_core_fetch_board_data_ + goto err; + } + +- switch (ie_id) { +- case ATH11K_BD_IE_BOARD: ++ if (ie_id == ie_id_match) { + ret = ath11k_core_parse_bd_ie_board(ab, bd, data, + ie_len, + boardname, +- ATH11K_BD_IE_BOARD); ++ ie_id_match, ++ name_id, ++ data_id); + if (ret == -ENOENT) + /* no match found, continue */ +- break; ++ goto next; + else if (ret) + /* there was an error, bail out */ + goto err; + /* either found or error, so stop searching */ + goto out; + } +- ++next: + /* jump over the padding */ + ie_len = ALIGN(ie_len, 4); + +@@ -893,7 +901,8 @@ static int ath11k_core_fetch_board_data_ + out: + if (!bd->data || !bd->len) { + ath11k_dbg(ab, ATH11K_DBG_BOOT, +- "failed to fetch board data for %s from %s\n", ++ "failed to fetch %s for %s from %s\n", ++ ath11k_bd_ie_type_str(ie_id_match), + boardname, filepath); + ret = -ENODATA; + goto err; +@@ -937,7 +946,10 @@ int ath11k_core_fetch_bdf(struct ath11k_ + } + + ab->bd_api = 2; +- ret = ath11k_core_fetch_board_data_api_n(ab, bd, boardname); ++ ret = ath11k_core_fetch_board_data_api_n(ab, bd, boardname, ++ ATH11K_BD_IE_BOARD, ++ ATH11K_BD_IE_BOARD_NAME, ++ ATH11K_BD_IE_BOARD_DATA); + if (!ret) + goto success; + +@@ -948,7 +960,10 @@ int ath11k_core_fetch_bdf(struct ath11k_ + return ret; + } + +- ret = ath11k_core_fetch_board_data_api_n(ab, bd, fallback_boardname); ++ ret = ath11k_core_fetch_board_data_api_n(ab, bd, fallback_boardname, ++ ATH11K_BD_IE_BOARD, ++ ATH11K_BD_IE_BOARD_NAME, ++ ATH11K_BD_IE_BOARD_DATA); + if (!ret) + goto success; + +@@ -975,13 +990,32 @@ success: + + int ath11k_core_fetch_regdb(struct ath11k_base *ab, struct ath11k_board_data *bd) + { ++ char boardname[BOARD_NAME_SIZE]; + int ret; + ++ ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE); ++ if (ret) { ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, ++ "failed to create board name for regdb: %d", ret); ++ goto exit; ++ } ++ ++ ret = ath11k_core_fetch_board_data_api_n(ab, bd, boardname, ++ ATH11K_BD_IE_REGDB, ++ ATH11K_BD_IE_REGDB_NAME, ++ ATH11K_BD_IE_REGDB_DATA); ++ if (!ret) ++ goto exit; ++ + ret = ath11k_core_fetch_board_data_api_1(ab, bd, ATH11K_REGDB_FILE_NAME); + if (ret) + ath11k_dbg(ab, ATH11K_DBG_BOOT, "failed to fetch %s from %s\n", + ATH11K_REGDB_FILE_NAME, ab->hw_params.fw.dir); + ++exit: ++ if (!ret) ++ ath11k_dbg(ab, ATH11K_DBG_BOOT, "fetched regdb\n"); ++ + return ret; + } + +--- a/drivers/net/wireless/ath/ath11k/hw.h ++++ b/drivers/net/wireless/ath/ath11k/hw.h +@@ -291,9 +291,16 @@ enum ath11k_bd_ie_board_type { + ATH11K_BD_IE_BOARD_DATA = 1, + }; + ++enum ath11k_bd_ie_regdb_type { ++ ATH11K_BD_IE_REGDB_NAME = 0, ++ ATH11K_BD_IE_REGDB_DATA = 1, ++}; ++ + enum ath11k_bd_ie_type { + /* contains sub IEs of enum ath11k_bd_ie_board_type */ + ATH11K_BD_IE_BOARD = 0, ++ /* contains sub IEs of enum ath11k_bd_ie_regdb_type */ ++ ATH11K_BD_IE_REGDB = 1, + }; + + struct ath11k_hw_regs { +@@ -361,4 +368,16 @@ extern const struct ath11k_hw_regs qca63 + extern const struct ath11k_hw_regs qcn9074_regs; + extern const struct ath11k_hw_regs wcn6855_regs; + ++static inline const char *ath11k_bd_ie_type_str(enum ath11k_bd_ie_type type) ++{ ++ switch (type) { ++ case ATH11K_BD_IE_BOARD: ++ return "board data"; ++ case ATH11K_BD_IE_REGDB: ++ return "regdb data"; ++ } ++ ++ return "unknown"; ++} ++ + #endif diff --git a/package/kernel/mac80211/patches/ath11k/0214-ath11k-reduce-the-wait-time-of-11d-scan-and-hw-scan-.patch b/package/kernel/mac80211/patches/ath11k/0214-ath11k-reduce-the-wait-time-of-11d-scan-and-hw-scan-.patch new file mode 100644 index 000000000..5baf0c021 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0214-ath11k-reduce-the-wait-time-of-11d-scan-and-hw-scan-.patch @@ -0,0 +1,400 @@ +From 1f682dc9fb3790aa7ec27d3d122ff32b1eda1365 Mon Sep 17 00:00:00 2001 +From: Wen Gong +Date: Sun, 27 Mar 2022 23:58:32 -0400 +Subject: [PATCH] ath11k: reduce the wait time of 11d scan and hw scan while + add interface + +Currently ath11k will wait 11d scan complete while add interface in +ath11k_mac_op_add_interface(), when system resume without enable +wowlan, ath11k_mac_op_add_interface() is called for each resume, thus +it increase the resume time of system. And ath11k_mac_op_hw_scan() +after ath11k_mac_op_add_interface() also needs some time cost because +the previous 11d scan need more than 5 seconds when 6 GHz is enabled, +then the scan started event will indicated to ath11k after the 11d +scan completed. + +While 11d scan/hw scan is running in firmware, if ath11k update channel +list to firmware by WMI_SCAN_CHAN_LIST_CMDID, then firmware will cancel +the current scan which is running, it lead the scan failed. The patch +commit 9dcf6808b253 ("ath11k: add 11d scan offload support") used +finish_11d_scan/finish_11d_ch_list/pending_11d to synchronize the 11d +scan/hw scan/channel list between ath11k/firmware/mac80211 and to avoid +the scan fail. + +Add wait operation before ath11k update channel list, function +ath11k_reg_update_chan_list() will wait until the current 11d scan/hw +scan completed. And remove the wait operation of start 11d scan and +waiting channel list complete in hw scan. After these changes, resume +time cost reduce about 5 seconds and also hw scan time cost reduced +obviously, and scan failed not seen. + +The 11d scan is sent to firmware only one time for each interface added +in mac.c, and it is moved after the 1st hw scan because 11d scan will +cost some time and thus leads the AP scan result update to UI delay. +Currently priority of ath11k's hw scan is WMI_SCAN_PRIORITY_LOW, and +priority of 11d scan in firmware is WMI_SCAN_PRIORITY_MEDIUM, then the +11d scan which sent after hw scan will cancel the hw scan in firmware, +so change the priority to WMI_SCAN_PRIORITY_MEDIUM for the hw scan which +is in front of the 11d scan, thus it will not happen scan cancel in +firmware. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 + +Fixes: 9dcf6808b253 ("ath11k: add 11d scan offload support") +Signed-off-by: Wen Gong +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220328035832.14122-1-quic_wgong@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 1 + + drivers/net/wireless/ath/ath11k/core.h | 13 +++-- + drivers/net/wireless/ath/ath11k/mac.c | 71 +++++++++++--------------- + drivers/net/wireless/ath/ath11k/mac.h | 2 +- + drivers/net/wireless/ath/ath11k/reg.c | 43 ++++++++++------ + drivers/net/wireless/ath/ath11k/reg.h | 2 +- + drivers/net/wireless/ath/ath11k/wmi.c | 16 +++++- + 7 files changed, 84 insertions(+), 64 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -1465,6 +1465,7 @@ static void ath11k_core_pre_reconfigure_ + + ieee80211_stop_queues(ar->hw); + ath11k_mac_drain_tx(ar); ++ complete(&ar->completed_11d_scan); + complete(&ar->scan.started); + complete(&ar->scan.completed); + complete(&ar->peer_assoc_done); +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -52,6 +52,8 @@ + + extern unsigned int ath11k_frame_mode; + ++#define ATH11K_SCAN_TIMEOUT_HZ (20 * HZ) ++ + #define ATH11K_MON_TIMER_INTERVAL 10 + #define ATH11K_RESET_TIMEOUT_HZ (20 * HZ) + #define ATH11K_RESET_MAX_FAIL_COUNT_FIRST 3 +@@ -216,6 +218,12 @@ enum ath11k_scan_state { + ATH11K_SCAN_ABORTING, + }; + ++enum ath11k_11d_state { ++ ATH11K_11D_IDLE, ++ ATH11K_11D_PREPARING, ++ ATH11K_11D_RUNNING, ++}; ++ + enum ath11k_dev_flags { + ATH11K_CAC_RUNNING, + ATH11K_FLAG_CORE_REGISTERED, +@@ -664,9 +672,8 @@ struct ath11k { + bool dfs_block_radar_events; + struct ath11k_thermal thermal; + u32 vdev_id_11d_scan; +- struct completion finish_11d_scan; +- struct completion finish_11d_ch_list; +- bool pending_11d; ++ struct completion completed_11d_scan; ++ enum ath11k_11d_state state_11d; + bool regdom_set_by_user; + int hw_rate_code; + u8 twt_enabled; +--- a/drivers/net/wireless/ath/ath11k/mac.c ++++ b/drivers/net/wireless/ath/ath11k/mac.c +@@ -3621,26 +3621,6 @@ static int ath11k_mac_op_hw_scan(struct + if (ret) + goto exit; + +- /* Currently the pending_11d=true only happened 1 time while +- * wlan interface up in ath11k_mac_11d_scan_start(), it is called by +- * ath11k_mac_op_add_interface(), after wlan interface up, +- * pending_11d=false always. +- * If remove below wait, it always happened scan fail and lead connect +- * fail while wlan interface up, because it has a 11d scan which is running +- * in firmware, and lead this scan failed. +- */ +- if (ar->pending_11d) { +- long time_left; +- unsigned long timeout = 5 * HZ; +- +- if (ar->supports_6ghz) +- timeout += 5 * HZ; +- +- time_left = wait_for_completion_timeout(&ar->finish_11d_ch_list, timeout); +- ath11k_dbg(ar->ab, ATH11K_DBG_MAC, +- "mac wait 11d channel list time left %ld\n", time_left); +- } +- + memset(&arg, 0, sizeof(arg)); + ath11k_wmi_start_scan_init(ar, &arg); + arg.vdev_id = arvif->vdev_id; +@@ -3706,6 +3686,10 @@ exit: + kfree(arg.extraie.ptr); + + mutex_unlock(&ar->conf_mutex); ++ ++ if (ar->state_11d == ATH11K_11D_PREPARING) ++ ath11k_mac_11d_scan_start(ar, arvif->vdev_id); ++ + return ret; + } + +@@ -5859,7 +5843,7 @@ static int ath11k_mac_op_start(struct ie + + /* TODO: Do we need to enable ANI? */ + +- ath11k_reg_update_chan_list(ar); ++ ath11k_reg_update_chan_list(ar, false); + + ar->num_started_vdevs = 0; + ar->num_created_vdevs = 0; +@@ -5926,6 +5910,11 @@ static void ath11k_mac_op_stop(struct ie + cancel_work_sync(&ar->ab->update_11d_work); + cancel_work_sync(&ar->ab->rfkill_work); + ++ if (ar->state_11d == ATH11K_11D_PREPARING) { ++ ar->state_11d = ATH11K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++ + spin_lock_bh(&ar->data_lock); + list_for_each_entry_safe(ppdu_stats, tmp, &ar->ppdu_stats_info, list) { + list_del(&ppdu_stats->list); +@@ -6096,7 +6085,7 @@ static bool ath11k_mac_vif_ap_active_any + return false; + } + +-void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait) ++void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id) + { + struct wmi_11d_scan_start_params param; + int ret; +@@ -6124,28 +6113,22 @@ void ath11k_mac_11d_scan_start(struct at + + ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac start 11d scan\n"); + +- if (wait) +- reinit_completion(&ar->finish_11d_scan); +- + ret = ath11k_wmi_send_11d_scan_start_cmd(ar, ¶m); + if (ret) { + ath11k_warn(ar->ab, "failed to start 11d scan vdev %d ret: %d\n", + vdev_id, ret); + } else { + ar->vdev_id_11d_scan = vdev_id; +- if (wait) { +- ar->pending_11d = true; +- ret = wait_for_completion_timeout(&ar->finish_11d_scan, +- 5 * HZ); +- ath11k_dbg(ar->ab, ATH11K_DBG_MAC, +- "mac 11d scan left time %d\n", ret); +- +- if (!ret) +- ar->pending_11d = false; +- } ++ if (ar->state_11d == ATH11K_11D_PREPARING) ++ ar->state_11d = ATH11K_11D_RUNNING; + } + + fin: ++ if (ar->state_11d == ATH11K_11D_PREPARING) { ++ ar->state_11d = ATH11K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++ + mutex_unlock(&ar->ab->vdev_id_11d_lock); + } + +@@ -6168,12 +6151,15 @@ void ath11k_mac_11d_scan_stop(struct ath + vdev_id = ar->vdev_id_11d_scan; + + ret = ath11k_wmi_send_11d_scan_stop_cmd(ar, vdev_id); +- if (ret) ++ if (ret) { + ath11k_warn(ar->ab, + "failed to stopt 11d scan vdev %d ret: %d\n", + vdev_id, ret); +- else ++ } else { + ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; ++ ar->state_11d = ATH11K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } + } + mutex_unlock(&ar->ab->vdev_id_11d_lock); + } +@@ -6369,8 +6355,10 @@ static int ath11k_mac_op_add_interface(s + goto err_peer_del; + } + +- ath11k_mac_11d_scan_start(ar, arvif->vdev_id, true); +- ++ if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map)) { ++ reinit_completion(&ar->completed_11d_scan); ++ ar->state_11d = ATH11K_11D_PREPARING; ++ } + break; + case WMI_VDEV_TYPE_MONITOR: + set_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); +@@ -7230,7 +7218,7 @@ ath11k_mac_op_unassign_vif_chanctx(struc + } + + if (arvif->vdev_type == WMI_VDEV_TYPE_STA) +- ath11k_mac_11d_scan_start(ar, arvif->vdev_id, false); ++ ath11k_mac_11d_scan_start(ar, arvif->vdev_id); + + mutex_unlock(&ar->conf_mutex); + } +@@ -8920,8 +8908,7 @@ int ath11k_mac_allocate(struct ath11k_ba + ar->monitor_vdev_id = -1; + clear_bit(ATH11K_FLAG_MONITOR_VDEV_CREATED, &ar->monitor_flags); + ar->vdev_id_11d_scan = ATH11K_11D_INVALID_VDEV_ID; +- init_completion(&ar->finish_11d_scan); +- init_completion(&ar->finish_11d_ch_list); ++ init_completion(&ar->completed_11d_scan); + } + + return 0; +--- a/drivers/net/wireless/ath/ath11k/mac.h ++++ b/drivers/net/wireless/ath/ath11k/mac.h +@@ -130,7 +130,7 @@ extern const struct htt_rx_ring_tlv_filt + #define ATH11K_SCAN_11D_INTERVAL 600000 + #define ATH11K_11D_INVALID_VDEV_ID 0xFFFF + +-void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id, bool wait); ++void ath11k_mac_11d_scan_start(struct ath11k *ar, u32 vdev_id); + void ath11k_mac_11d_scan_stop(struct ath11k *ar); + void ath11k_mac_11d_scan_stop_all(struct ath11k_base *ab); + +--- a/drivers/net/wireless/ath/ath11k/reg.c ++++ b/drivers/net/wireless/ath/ath11k/reg.c +@@ -103,7 +103,7 @@ ath11k_reg_notifier(struct wiphy *wiphy, + ar->regdom_set_by_user = true; + } + +-int ath11k_reg_update_chan_list(struct ath11k *ar) ++int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait) + { + struct ieee80211_supported_band **bands; + struct scan_chan_list_params *params; +@@ -112,7 +112,32 @@ int ath11k_reg_update_chan_list(struct a + struct channel_param *ch; + enum nl80211_band band; + int num_channels = 0; +- int i, ret; ++ int i, ret, left; ++ ++ if (wait && ar->state_11d != ATH11K_11D_IDLE) { ++ left = wait_for_completion_timeout(&ar->completed_11d_scan, ++ ATH11K_SCAN_TIMEOUT_HZ); ++ if (!left) { ++ ath11k_dbg(ar->ab, ATH11K_DBG_REG, ++ "failed to receive 11d scan complete: timed out\n"); ++ ar->state_11d = ATH11K_11D_IDLE; ++ } ++ ath11k_dbg(ar->ab, ATH11K_DBG_REG, ++ "reg 11d scan wait left time %d\n", left); ++ } ++ ++ if (wait && ++ (ar->scan.state == ATH11K_SCAN_STARTING || ++ ar->scan.state == ATH11K_SCAN_RUNNING)) { ++ left = wait_for_completion_timeout(&ar->scan.completed, ++ ATH11K_SCAN_TIMEOUT_HZ); ++ if (!left) ++ ath11k_dbg(ar->ab, ATH11K_DBG_REG, ++ "failed to receive hw scan complete: timed out\n"); ++ ++ ath11k_dbg(ar->ab, ATH11K_DBG_REG, ++ "reg hw scan wait left time %d\n", left); ++ } + + bands = hw->wiphy->bands; + for (band = 0; band < NUM_NL80211_BANDS; band++) { +@@ -194,11 +219,6 @@ int ath11k_reg_update_chan_list(struct a + ret = ath11k_wmi_send_scan_chan_list_cmd(ar, params); + kfree(params); + +- if (ar->pending_11d) { +- complete(&ar->finish_11d_ch_list); +- ar->pending_11d = false; +- } +- + return ret; + } + +@@ -264,15 +284,8 @@ int ath11k_regd_update(struct ath11k *ar + goto err; + } + +- if (ar->pending_11d) +- complete(&ar->finish_11d_scan); +- + rtnl_lock(); + wiphy_lock(ar->hw->wiphy); +- +- if (ar->pending_11d) +- reinit_completion(&ar->finish_11d_ch_list); +- + ret = regulatory_set_wiphy_regd_sync(ar->hw->wiphy, regd_copy); + wiphy_unlock(ar->hw->wiphy); + rtnl_unlock(); +@@ -283,7 +296,7 @@ int ath11k_regd_update(struct ath11k *ar + goto err; + + if (ar->state == ATH11K_STATE_ON) { +- ret = ath11k_reg_update_chan_list(ar); ++ ret = ath11k_reg_update_chan_list(ar, true); + if (ret) + goto err; + } +--- a/drivers/net/wireless/ath/ath11k/reg.h ++++ b/drivers/net/wireless/ath/ath11k/reg.h +@@ -32,5 +32,5 @@ struct ieee80211_regdomain * + ath11k_reg_build_regd(struct ath11k_base *ab, + struct cur_regulatory_info *reg_info, bool intersect); + int ath11k_regd_update(struct ath11k *ar); +-int ath11k_reg_update_chan_list(struct ath11k *ar); ++int ath11k_reg_update_chan_list(struct ath11k *ar, bool wait); + #endif +--- a/drivers/net/wireless/ath/ath11k/wmi.c ++++ b/drivers/net/wireless/ath/ath11k/wmi.c +@@ -2015,7 +2015,10 @@ void ath11k_wmi_start_scan_init(struct a + { + /* setup commonly used values */ + arg->scan_req_id = 1; +- arg->scan_priority = WMI_SCAN_PRIORITY_LOW; ++ if (ar->state_11d == ATH11K_11D_PREPARING) ++ arg->scan_priority = WMI_SCAN_PRIORITY_MEDIUM; ++ else ++ arg->scan_priority = WMI_SCAN_PRIORITY_LOW; + arg->dwell_time_active = 50; + arg->dwell_time_active_2g = 0; + arg->dwell_time_passive = 150; +@@ -6350,8 +6353,10 @@ static void ath11k_wmi_op_ep_tx_credits( + static int ath11k_reg_11d_new_cc_event(struct ath11k_base *ab, struct sk_buff *skb) + { + const struct wmi_11d_new_cc_ev *ev; ++ struct ath11k *ar; ++ struct ath11k_pdev *pdev; + const void **tb; +- int ret; ++ int ret, i; + + tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC); + if (IS_ERR(tb)) { +@@ -6377,6 +6382,13 @@ static int ath11k_reg_11d_new_cc_event(s + + kfree(tb); + ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ ar->state_11d = ATH11K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++ + queue_work(ab->workqueue, &ab->update_11d_work); + + return 0; diff --git a/package/kernel/mac80211/patches/ath11k/0215-ath11k-PCI-changes-to-support-WCN6750.patch b/package/kernel/mac80211/patches/ath11k/0215-ath11k-PCI-changes-to-support-WCN6750.patch new file mode 100644 index 000000000..3792748ab --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0215-ath11k-PCI-changes-to-support-WCN6750.patch @@ -0,0 +1,388 @@ +From 948171b5f6fcf11253355bd836e6e8b613bea12f Mon Sep 17 00:00:00 2001 +From: Manikanta Pubbisetty +Date: Fri, 1 Apr 2022 14:53:08 +0300 +Subject: [PATCH] ath11k: PCI changes to support WCN6750 + +In order to add the support for WCN6750 in ATH11K , it is +required to move certain PCI definitions to the header file. +As a result, add ATH11K_PCI_* prefix to these definitions. + +Also, change the scope of certain PCI APIs that are required +to enable WCN6750 from static to global. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00192-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Manikanta Pubbisetty +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220328055714.6449-2-quic_mpubbise@quicinc.com +--- + drivers/net/wireless/ath/ath11k/pci.c | 110 ++++++++++++-------------- + drivers/net/wireless/ath/ath11k/pci.h | 35 ++++++++ + 2 files changed, 84 insertions(+), 61 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -1,6 +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. + */ + + #include +@@ -17,25 +18,10 @@ + #define ATH11K_PCI_BAR_NUM 0 + #define ATH11K_PCI_DMA_MASK 32 + +-#define ATH11K_PCI_IRQ_CE0_OFFSET 3 +-#define ATH11K_PCI_IRQ_DP_OFFSET 14 +- +-#define WINDOW_ENABLE_BIT 0x40000000 +-#define WINDOW_REG_ADDRESS 0x310c +-#define WINDOW_VALUE_MASK GENMASK(24, 19) +-#define WINDOW_START 0x80000 +-#define WINDOW_RANGE_MASK GENMASK(18, 0) +- + #define TCSR_SOC_HW_VERSION 0x0224 + #define TCSR_SOC_HW_VERSION_MAJOR_MASK GENMASK(11, 8) + #define TCSR_SOC_HW_VERSION_MINOR_MASK GENMASK(7, 0) + +-/* BAR0 + 4k is always accessible, and no +- * need to force wakeup. +- * 4K - 32 = 0xFE0 +- */ +-#define ACCESS_ALWAYS_OFF 0xFE0 +- + #define QCA6390_DEVICE_ID 0x1101 + #define QCN9074_DEVICE_ID 0x1104 + #define WCN6855_DEVICE_ID 0x1103 +@@ -147,27 +133,30 @@ static inline void ath11k_pci_select_win + { + struct ath11k_base *ab = ab_pci->ab; + +- u32 window = FIELD_GET(WINDOW_VALUE_MASK, offset); ++ u32 window = FIELD_GET(ATH11K_PCI_WINDOW_VALUE_MASK, offset); + + lockdep_assert_held(&ab_pci->window_lock); + + if (window != ab_pci->register_window) { +- iowrite32(WINDOW_ENABLE_BIT | window, +- ab->mem + WINDOW_REG_ADDRESS); +- ioread32(ab->mem + WINDOW_REG_ADDRESS); ++ iowrite32(ATH11K_PCI_WINDOW_ENABLE_BIT | window, ++ ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); ++ ioread32(ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); + ab_pci->register_window = window; + } + } + + static inline void ath11k_pci_select_static_window(struct ath11k_pci *ab_pci) + { +- u32 umac_window = FIELD_GET(WINDOW_VALUE_MASK, HAL_SEQ_WCSS_UMAC_OFFSET); +- u32 ce_window = FIELD_GET(WINDOW_VALUE_MASK, HAL_CE_WFSS_CE_REG_BASE); ++ u32 umac_window; ++ u32 ce_window; + u32 window; + ++ umac_window = FIELD_GET(ATH11K_PCI_WINDOW_VALUE_MASK, HAL_SEQ_WCSS_UMAC_OFFSET); ++ ce_window = FIELD_GET(ATH11K_PCI_WINDOW_VALUE_MASK, HAL_CE_WFSS_CE_REG_BASE); + window = (umac_window << 12) | (ce_window << 6); + +- iowrite32(WINDOW_ENABLE_BIT | window, ab_pci->ab->mem + WINDOW_REG_ADDRESS); ++ iowrite32(ATH11K_PCI_WINDOW_ENABLE_BIT | window, ++ ab_pci->ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); + } + + static inline u32 ath11k_pci_get_window_start(struct ath11k_base *ab, +@@ -176,13 +165,13 @@ static inline u32 ath11k_pci_get_window_ + u32 window_start; + + /* If offset lies within DP register range, use 3rd window */ +- if ((offset ^ HAL_SEQ_WCSS_UMAC_OFFSET) < WINDOW_RANGE_MASK) +- window_start = 3 * WINDOW_START; ++ if ((offset ^ HAL_SEQ_WCSS_UMAC_OFFSET) < ATH11K_PCI_WINDOW_RANGE_MASK) ++ window_start = 3 * ATH11K_PCI_WINDOW_START; + /* If offset lies within CE register range, use 2nd window */ +- else if ((offset ^ HAL_CE_WFSS_CE_REG_BASE) < WINDOW_RANGE_MASK) +- window_start = 2 * WINDOW_START; ++ else if ((offset ^ HAL_CE_WFSS_CE_REG_BASE) < ATH11K_PCI_WINDOW_RANGE_MASK) ++ window_start = 2 * ATH11K_PCI_WINDOW_START; + else +- window_start = WINDOW_START; ++ window_start = ATH11K_PCI_WINDOW_START; + + return window_start; + } +@@ -198,32 +187,32 @@ void ath11k_pci_write32(struct ath11k_ba + */ + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ACCESS_ALWAYS_OFF) ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF) + ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); + +- if (offset < WINDOW_START) { ++ if (offset < ATH11K_PCI_WINDOW_START) { + iowrite32(value, ab->mem + offset); + } else { + if (ab->bus_params.static_window_map) + window_start = ath11k_pci_get_window_start(ab, offset); + else +- window_start = WINDOW_START; ++ window_start = ATH11K_PCI_WINDOW_START; + +- if (window_start == WINDOW_START) { ++ if (window_start == ATH11K_PCI_WINDOW_START) { + spin_lock_bh(&ab_pci->window_lock); + ath11k_pci_select_window(ab_pci, offset); + iowrite32(value, ab->mem + window_start + +- (offset & WINDOW_RANGE_MASK)); ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + spin_unlock_bh(&ab_pci->window_lock); + } else { + iowrite32(value, ab->mem + window_start + +- (offset & WINDOW_RANGE_MASK)); ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + } + } + + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ACCESS_ALWAYS_OFF && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && + !ret) + mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); + } +@@ -239,32 +228,32 @@ u32 ath11k_pci_read32(struct ath11k_base + */ + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ACCESS_ALWAYS_OFF) ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF) + ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); + +- if (offset < WINDOW_START) { ++ if (offset < ATH11K_PCI_WINDOW_START) { + val = ioread32(ab->mem + offset); + } else { + if (ab->bus_params.static_window_map) + window_start = ath11k_pci_get_window_start(ab, offset); + else +- window_start = WINDOW_START; ++ window_start = ATH11K_PCI_WINDOW_START; + +- if (window_start == WINDOW_START) { ++ if (window_start == ATH11K_PCI_WINDOW_START) { + spin_lock_bh(&ab_pci->window_lock); + ath11k_pci_select_window(ab_pci, offset); + val = ioread32(ab->mem + window_start + +- (offset & WINDOW_RANGE_MASK)); ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + spin_unlock_bh(&ab_pci->window_lock); + } else { + val = ioread32(ab->mem + window_start + +- (offset & WINDOW_RANGE_MASK)); ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + } + } + + if (ab->hw_params.wakeup_mhi && + test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ACCESS_ALWAYS_OFF && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && + !ret) + mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); + +@@ -474,8 +463,8 @@ int ath11k_pci_get_msi_irq(struct device + return pci_irq_vector(pci_dev, vector); + } + +-static void ath11k_pci_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, +- u32 *msi_addr_hi) ++void ath11k_pci_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, ++ u32 *msi_addr_hi) + { + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + struct pci_dev *pci_dev = to_pci_dev(ab->dev); +@@ -519,8 +508,7 @@ int ath11k_pci_get_user_msi_assignment(s + return -EINVAL; + } + +-static void ath11k_pci_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id, +- u32 *msi_idx) ++void ath11k_pci_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx) + { + u32 i, msi_data_idx; + +@@ -536,9 +524,9 @@ static void ath11k_pci_get_ce_msi_idx(st + *msi_idx = msi_data_idx; + } + +-static int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, +- int *num_vectors, u32 *user_base_data, +- u32 *base_vector) ++int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, ++ int *num_vectors, u32 *user_base_data, ++ u32 *base_vector) + { + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + +@@ -561,7 +549,7 @@ static void ath11k_pci_free_ext_irq(stru + } + } + +-static void ath11k_pci_free_irq(struct ath11k_base *ab) ++void ath11k_pci_free_irq(struct ath11k_base *ab) + { + int i, irq_idx; + +@@ -710,7 +698,7 @@ static void ath11k_pci_ext_grp_enable(st + enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); + } + +-static void ath11k_pci_ext_irq_enable(struct ath11k_base *ab) ++void ath11k_pci_ext_irq_enable(struct ath11k_base *ab) + { + int i; + +@@ -741,7 +729,7 @@ static void ath11k_pci_sync_ext_irqs(str + } + } + +-static void ath11k_pci_ext_irq_disable(struct ath11k_base *ab) ++void ath11k_pci_ext_irq_disable(struct ath11k_base *ab) + { + __ath11k_pci_ext_irq_disable(ab); + ath11k_pci_sync_ext_irqs(ab); +@@ -854,8 +842,8 @@ static int ath11k_pci_ext_irq_config(str + return 0; + } + +-static int ath11k_pci_set_irq_affinity_hint(struct ath11k_pci *ab_pci, +- const struct cpumask *m) ++int ath11k_pci_set_irq_affinity_hint(struct ath11k_pci *ab_pci, ++ const struct cpumask *m) + { + if (test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + return 0; +@@ -863,7 +851,7 @@ static int ath11k_pci_set_irq_affinity_h + return irq_set_affinity_hint(ab_pci->pdev->irq, m); + } + +-static int ath11k_pci_config_irq(struct ath11k_base *ab) ++int ath11k_pci_config_irq(struct ath11k_base *ab) + { + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + struct ath11k_ce_pipe *ce_pipe; +@@ -939,7 +927,7 @@ static void ath11k_pci_init_qmi_ce_confi + &cfg->shadow_reg_v2_len); + } + +-static void ath11k_pci_ce_irqs_enable(struct ath11k_base *ab) ++void ath11k_pci_ce_irqs_enable(struct ath11k_base *ab) + { + int i; + +@@ -1151,7 +1139,7 @@ static void ath11k_pci_aspm_disable(stru + set_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags); + } + +-static void ath11k_pci_aspm_restore(struct ath11k_pci *ab_pci) ++void ath11k_pci_aspm_restore(struct ath11k_pci *ab_pci) + { + if (test_and_clear_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags)) + pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL, +@@ -1234,20 +1222,20 @@ static void ath11k_pci_kill_tasklets(str + } + } + +-static void ath11k_pci_ce_irq_disable_sync(struct ath11k_base *ab) ++void ath11k_pci_ce_irq_disable_sync(struct ath11k_base *ab) + { + ath11k_pci_ce_irqs_disable(ab); + ath11k_pci_sync_ce_irqs(ab); + ath11k_pci_kill_tasklets(ab); + } + +-static void ath11k_pci_stop(struct ath11k_base *ab) ++void ath11k_pci_stop(struct ath11k_base *ab) + { + ath11k_pci_ce_irq_disable_sync(ab); + ath11k_ce_cleanup_pipes(ab); + } + +-static int ath11k_pci_start(struct ath11k_base *ab) ++int ath11k_pci_start(struct ath11k_base *ab) + { + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + +@@ -1277,8 +1265,8 @@ static void ath11k_pci_hif_ce_irq_disabl + ath11k_pci_ce_irq_disable_sync(ab); + } + +-static int ath11k_pci_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, +- u8 *ul_pipe, u8 *dl_pipe) ++int ath11k_pci_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, ++ u8 *ul_pipe, u8 *dl_pipe) + { + const struct service_to_pipe *entry; + bool ul_set = false, dl_set = false; +--- a/drivers/net/wireless/ath/ath11k/pci.h ++++ b/drivers/net/wireless/ath/ath11k/pci.h +@@ -1,6 +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. + */ + #ifndef _ATH11K_PCI_H + #define _ATH11K_PCI_H +@@ -52,6 +53,21 @@ + #define WLAON_QFPROM_PWR_CTRL_REG 0x01f8031c + #define QFPROM_PWR_CTRL_VDD4BLOW_MASK 0x4 + ++#define ATH11K_PCI_IRQ_CE0_OFFSET 3 ++#define ATH11K_PCI_IRQ_DP_OFFSET 14 ++ ++#define ATH11K_PCI_WINDOW_ENABLE_BIT 0x40000000 ++#define ATH11K_PCI_WINDOW_REG_ADDRESS 0x310c ++#define ATH11K_PCI_WINDOW_VALUE_MASK GENMASK(24, 19) ++#define ATH11K_PCI_WINDOW_START 0x80000 ++#define ATH11K_PCI_WINDOW_RANGE_MASK GENMASK(18, 0) ++ ++/* BAR0 + 4k is always accessible, and no ++ * need to force wakeup. ++ * 4K - 32 = 0xFE0 ++ */ ++#define ATH11K_PCI_ACCESS_ALWAYS_OFF 0xFE0 ++ + struct ath11k_msi_user { + char *name; + int num_vectors; +@@ -103,5 +119,24 @@ int ath11k_pci_get_user_msi_assignment(s + int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector); + void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value); + u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset); ++void ath11k_pci_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, ++ u32 *msi_addr_hi); ++void ath11k_pci_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx); ++void ath11k_pci_free_irq(struct ath11k_base *ab); ++int ath11k_pci_config_irq(struct ath11k_base *ab); ++void ath11k_pci_ext_irq_enable(struct ath11k_base *ab); ++void ath11k_pci_ext_irq_disable(struct ath11k_base *ab); ++void ath11k_pci_stop(struct ath11k_base *ab); ++int ath11k_pci_start(struct ath11k_base *ab); ++int ath11k_pci_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, ++ u8 *ul_pipe, u8 *dl_pipe); ++void ath11k_pci_ce_irqs_enable(struct ath11k_base *ab); ++void ath11k_pci_ce_irq_disable_sync(struct ath11k_base *ab); ++int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, ++ int *num_vectors, u32 *user_base_data, ++ u32 *base_vector); ++void ath11k_pci_aspm_restore(struct ath11k_pci *ab_pci); ++int ath11k_pci_set_irq_affinity_hint(struct ath11k_pci *ab_pci, ++ const struct cpumask *m); + + #endif diff --git a/package/kernel/mac80211/patches/ath11k/0216-ath11k-Refactor-PCI-code-to-support-WCN6750.patch b/package/kernel/mac80211/patches/ath11k/0216-ath11k-Refactor-PCI-code-to-support-WCN6750.patch new file mode 100644 index 000000000..bc3b16731 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0216-ath11k-Refactor-PCI-code-to-support-WCN6750.patch @@ -0,0 +1,2010 @@ +From bbfdc5a751a634fcdaae669cc98b3d0e1dc0eedf Mon Sep 17 00:00:00 2001 +From: Manikanta Pubbisetty +Date: Fri, 1 Apr 2022 14:53:08 +0300 +Subject: [PATCH] ath11k: Refactor PCI code to support WCN6750 + +Unlike other ATH11K PCIe devices which are enumerated by APSS +processor (Application Processor SubSystem), WCN6750 gets +enumerated by the WPSS Q6 processor (Wireless Processor SubSystem); +In simple terms, though WCN6750 is PCIe device, it is not attached +to the APSS processor, APSS will not know of such a device being +present in the system and therefore WCN6750 will be registered as +a platform device to the kernel core like other supported AHB +devices. + +WCN6750 needs both AHB and PCI APIs for it's operation, it uses +AHB APIs for device probe/boot and PCI APIs for device setup and +register accesses. Because of this nature, it is referred as a +hybrid bus device. + +Refactor PCI code to support hybrid bus devices like WCN6750. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00192-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Manikanta Pubbisetty +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220328055714.6449-3-quic_mpubbise@quicinc.com +--- + drivers/net/wireless/ath/ath11k/Makefile | 2 +- + drivers/net/wireless/ath/ath11k/mhi.c | 27 +- + drivers/net/wireless/ath/ath11k/pci.c | 816 ++--------------------- + drivers/net/wireless/ath/ath11k/pci.h | 41 -- + drivers/net/wireless/ath/ath11k/pcic.c | 747 +++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/pcic.h | 53 ++ + 6 files changed, 856 insertions(+), 830 deletions(-) + create mode 100644 drivers/net/wireless/ath/ath11k/pcic.c + create mode 100644 drivers/net/wireless/ath/ath11k/pcic.h + +--- a/drivers/net/wireless/ath/ath11k/Makefile ++++ b/drivers/net/wireless/ath/ath11k/Makefile +@@ -29,7 +29,7 @@ obj-$(CPTCFG_ATH11K_AHB) += ath11k_ahb.o + ath11k_ahb-y += ahb.o + + obj-$(CPTCFG_ATH11K_PCI) += ath11k_pci.o +-ath11k_pci-y += mhi.o pci.o ++ath11k_pci-y += mhi.o pci.o pcic.o + + # for tracing framework to find trace.h + CFLAGS_trace.o := -I$(src) +--- a/drivers/net/wireless/ath/ath11k/mhi.c ++++ b/drivers/net/wireless/ath/ath11k/mhi.c +@@ -1,5 +1,8 @@ + // SPDX-License-Identifier: BSD-3-Clause-Clear +-/* Copyright (c) 2020 The Linux Foundation. All rights reserved. */ ++/* ++ * Copyright (c) 2020 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved. ++ */ + + #include + #include +@@ -11,6 +14,7 @@ + #include "debug.h" + #include "mhi.h" + #include "pci.h" ++#include "pcic.h" + + #define MHI_TIMEOUT_DEFAULT_MS 90000 + #define RDDM_DUMP_SIZE 0x420000 +@@ -205,7 +209,7 @@ void ath11k_mhi_set_mhictrl_reset(struct + { + u32 val; + +- val = ath11k_pci_read32(ab, MHISTATUS); ++ val = ath11k_pcic_read32(ab, MHISTATUS); + + ath11k_dbg(ab, ATH11K_DBG_PCI, "MHISTATUS 0x%x\n", val); + +@@ -213,29 +217,29 @@ void ath11k_mhi_set_mhictrl_reset(struct + * has SYSERR bit set and thus need to set MHICTRL_RESET + * to clear SYSERR. + */ +- ath11k_pci_write32(ab, MHICTRL, MHICTRL_RESET_MASK); ++ ath11k_pcic_write32(ab, MHICTRL, MHICTRL_RESET_MASK); + + mdelay(10); + } + + static void ath11k_mhi_reset_txvecdb(struct ath11k_base *ab) + { +- ath11k_pci_write32(ab, PCIE_TXVECDB, 0); ++ ath11k_pcic_write32(ab, PCIE_TXVECDB, 0); + } + + static void ath11k_mhi_reset_txvecstatus(struct ath11k_base *ab) + { +- ath11k_pci_write32(ab, PCIE_TXVECSTATUS, 0); ++ ath11k_pcic_write32(ab, PCIE_TXVECSTATUS, 0); + } + + static void ath11k_mhi_reset_rxvecdb(struct ath11k_base *ab) + { +- ath11k_pci_write32(ab, PCIE_RXVECDB, 0); ++ ath11k_pcic_write32(ab, PCIE_RXVECDB, 0); + } + + static void ath11k_mhi_reset_rxvecstatus(struct ath11k_base *ab) + { +- ath11k_pci_write32(ab, PCIE_RXVECSTATUS, 0); ++ ath11k_pcic_write32(ab, PCIE_RXVECSTATUS, 0); + } + + void ath11k_mhi_clear_vector(struct ath11k_base *ab) +@@ -254,9 +258,9 @@ static int ath11k_mhi_get_msi(struct ath + int *irq; + unsigned int msi_data; + +- ret = ath11k_pci_get_user_msi_assignment(ab_pci, +- "MHI", &num_vectors, +- &user_base_data, &base_vector); ++ ret = ath11k_pcic_get_user_msi_assignment(ab_pci, ++ "MHI", &num_vectors, ++ &user_base_data, &base_vector); + if (ret) + return ret; + +@@ -273,8 +277,7 @@ static int ath11k_mhi_get_msi(struct ath + if (test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) + msi_data += i; + +- irq[i] = ath11k_pci_get_msi_irq(ab->dev, +- msi_data); ++ irq[i] = ath11k_pcic_get_msi_irq(ab->dev, msi_data); + } + + ab_pci->mhi_ctrl->irq = irq; +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -14,6 +14,7 @@ + #include "hif.h" + #include "mhi.h" + #include "debug.h" ++#include "pcic.h" + + #define ATH11K_PCI_BAR_NUM 0 + #define ATH11K_PCI_DMA_MASK 32 +@@ -75,76 +76,6 @@ static const struct ath11k_msi_config ms + }, + }; + +-static const char *irq_name[ATH11K_IRQ_NUM_MAX] = { +- "bhi", +- "mhi-er0", +- "mhi-er1", +- "ce0", +- "ce1", +- "ce2", +- "ce3", +- "ce4", +- "ce5", +- "ce6", +- "ce7", +- "ce8", +- "ce9", +- "ce10", +- "ce11", +- "host2wbm-desc-feed", +- "host2reo-re-injection", +- "host2reo-command", +- "host2rxdma-monitor-ring3", +- "host2rxdma-monitor-ring2", +- "host2rxdma-monitor-ring1", +- "reo2ost-exception", +- "wbm2host-rx-release", +- "reo2host-status", +- "reo2host-destination-ring4", +- "reo2host-destination-ring3", +- "reo2host-destination-ring2", +- "reo2host-destination-ring1", +- "rxdma2host-monitor-destination-mac3", +- "rxdma2host-monitor-destination-mac2", +- "rxdma2host-monitor-destination-mac1", +- "ppdu-end-interrupts-mac3", +- "ppdu-end-interrupts-mac2", +- "ppdu-end-interrupts-mac1", +- "rxdma2host-monitor-status-ring-mac3", +- "rxdma2host-monitor-status-ring-mac2", +- "rxdma2host-monitor-status-ring-mac1", +- "host2rxdma-host-buf-ring-mac3", +- "host2rxdma-host-buf-ring-mac2", +- "host2rxdma-host-buf-ring-mac1", +- "rxdma2host-destination-ring-mac3", +- "rxdma2host-destination-ring-mac2", +- "rxdma2host-destination-ring-mac1", +- "host2tcl-input-ring4", +- "host2tcl-input-ring3", +- "host2tcl-input-ring2", +- "host2tcl-input-ring1", +- "wbm2host-tx-completions-ring3", +- "wbm2host-tx-completions-ring2", +- "wbm2host-tx-completions-ring1", +- "tcl2host-status-ring", +-}; +- +-static inline void ath11k_pci_select_window(struct ath11k_pci *ab_pci, u32 offset) +-{ +- struct ath11k_base *ab = ab_pci->ab; +- +- u32 window = FIELD_GET(ATH11K_PCI_WINDOW_VALUE_MASK, offset); +- +- lockdep_assert_held(&ab_pci->window_lock); +- +- if (window != ab_pci->register_window) { +- iowrite32(ATH11K_PCI_WINDOW_ENABLE_BIT | window, +- ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); +- ioread32(ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); +- ab_pci->register_window = window; +- } +-} +- + static inline void ath11k_pci_select_static_window(struct ath11k_pci *ab_pci) + { + u32 umac_window; +@@ -159,116 +90,15 @@ static inline void ath11k_pci_select_sta + ab_pci->ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); + } + +-static inline u32 ath11k_pci_get_window_start(struct ath11k_base *ab, +- u32 offset) +-{ +- u32 window_start; +- +- /* If offset lies within DP register range, use 3rd window */ +- if ((offset ^ HAL_SEQ_WCSS_UMAC_OFFSET) < ATH11K_PCI_WINDOW_RANGE_MASK) +- window_start = 3 * ATH11K_PCI_WINDOW_START; +- /* If offset lies within CE register range, use 2nd window */ +- else if ((offset ^ HAL_CE_WFSS_CE_REG_BASE) < ATH11K_PCI_WINDOW_RANGE_MASK) +- window_start = 2 * ATH11K_PCI_WINDOW_START; +- else +- window_start = ATH11K_PCI_WINDOW_START; +- +- return window_start; +-} +- +-void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- u32 window_start; +- int ret = 0; +- +- /* for offset beyond BAR + 4K - 32, may +- * need to wakeup MHI to access. +- */ +- if (ab->hw_params.wakeup_mhi && +- test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF) +- ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); +- +- if (offset < ATH11K_PCI_WINDOW_START) { +- iowrite32(value, ab->mem + offset); +- } else { +- if (ab->bus_params.static_window_map) +- window_start = ath11k_pci_get_window_start(ab, offset); +- else +- window_start = ATH11K_PCI_WINDOW_START; +- +- if (window_start == ATH11K_PCI_WINDOW_START) { +- spin_lock_bh(&ab_pci->window_lock); +- ath11k_pci_select_window(ab_pci, offset); +- iowrite32(value, ab->mem + window_start + +- (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); +- spin_unlock_bh(&ab_pci->window_lock); +- } else { +- iowrite32(value, ab->mem + window_start + +- (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); +- } +- } +- +- if (ab->hw_params.wakeup_mhi && +- test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && +- !ret) +- mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); +-} +- +-u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- u32 val, window_start; +- int ret = 0; +- +- /* for offset beyond BAR + 4K - 32, may +- * need to wakeup MHI to access. +- */ +- if (ab->hw_params.wakeup_mhi && +- test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF) +- ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); +- +- if (offset < ATH11K_PCI_WINDOW_START) { +- val = ioread32(ab->mem + offset); +- } else { +- if (ab->bus_params.static_window_map) +- window_start = ath11k_pci_get_window_start(ab, offset); +- else +- window_start = ATH11K_PCI_WINDOW_START; +- +- if (window_start == ATH11K_PCI_WINDOW_START) { +- spin_lock_bh(&ab_pci->window_lock); +- ath11k_pci_select_window(ab_pci, offset); +- val = ioread32(ab->mem + window_start + +- (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); +- spin_unlock_bh(&ab_pci->window_lock); +- } else { +- val = ioread32(ab->mem + window_start + +- (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); +- } +- } +- +- if (ab->hw_params.wakeup_mhi && +- test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && +- !ret) +- mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); +- +- return val; +-} +- + static void ath11k_pci_soc_global_reset(struct ath11k_base *ab) + { + u32 val, delay; + +- val = ath11k_pci_read32(ab, PCIE_SOC_GLOBAL_RESET); ++ val = ath11k_pcic_read32(ab, PCIE_SOC_GLOBAL_RESET); + + val |= PCIE_SOC_GLOBAL_RESET_V; + +- ath11k_pci_write32(ab, PCIE_SOC_GLOBAL_RESET, val); ++ ath11k_pcic_write32(ab, PCIE_SOC_GLOBAL_RESET, val); + + /* TODO: exact time to sleep is uncertain */ + delay = 10; +@@ -277,11 +107,11 @@ static void ath11k_pci_soc_global_reset( + /* Need to toggle V bit back otherwise stuck in reset status */ + val &= ~PCIE_SOC_GLOBAL_RESET_V; + +- ath11k_pci_write32(ab, PCIE_SOC_GLOBAL_RESET, val); ++ ath11k_pcic_write32(ab, PCIE_SOC_GLOBAL_RESET, val); + + mdelay(delay); + +- val = ath11k_pci_read32(ab, PCIE_SOC_GLOBAL_RESET); ++ val = ath11k_pcic_read32(ab, PCIE_SOC_GLOBAL_RESET); + if (val == 0xffffffff) + ath11k_warn(ab, "link down error during global reset\n"); + } +@@ -291,10 +121,10 @@ static void ath11k_pci_clear_dbg_registe + u32 val; + + /* read cookie */ +- val = ath11k_pci_read32(ab, PCIE_Q6_COOKIE_ADDR); ++ val = ath11k_pcic_read32(ab, PCIE_Q6_COOKIE_ADDR); + ath11k_dbg(ab, ATH11K_DBG_PCI, "cookie:0x%x\n", val); + +- val = ath11k_pci_read32(ab, WLAON_WARM_SW_ENTRY); ++ val = ath11k_pcic_read32(ab, WLAON_WARM_SW_ENTRY); + ath11k_dbg(ab, ATH11K_DBG_PCI, "WLAON_WARM_SW_ENTRY 0x%x\n", val); + + /* TODO: exact time to sleep is uncertain */ +@@ -303,16 +133,16 @@ static void ath11k_pci_clear_dbg_registe + /* write 0 to WLAON_WARM_SW_ENTRY to prevent Q6 from + * continuing warm path and entering dead loop. + */ +- ath11k_pci_write32(ab, WLAON_WARM_SW_ENTRY, 0); ++ ath11k_pcic_write32(ab, WLAON_WARM_SW_ENTRY, 0); + mdelay(10); + +- val = ath11k_pci_read32(ab, WLAON_WARM_SW_ENTRY); ++ val = ath11k_pcic_read32(ab, WLAON_WARM_SW_ENTRY); + ath11k_dbg(ab, ATH11K_DBG_PCI, "WLAON_WARM_SW_ENTRY 0x%x\n", val); + + /* A read clear register. clear the register to prevent + * Q6 from entering wrong code path. + */ +- val = ath11k_pci_read32(ab, WLAON_SOC_RESET_CAUSE_REG); ++ val = ath11k_pcic_read32(ab, WLAON_SOC_RESET_CAUSE_REG); + ath11k_dbg(ab, ATH11K_DBG_PCI, "soc reset cause:%d\n", val); + } + +@@ -322,14 +152,14 @@ static int ath11k_pci_set_link_reg(struc + u32 v; + int i; + +- v = ath11k_pci_read32(ab, offset); ++ v = ath11k_pcic_read32(ab, offset); + if ((v & mask) == value) + return 0; + + for (i = 0; i < 10; i++) { +- ath11k_pci_write32(ab, offset, (v & ~mask) | value); ++ ath11k_pcic_write32(ab, offset, (v & ~mask) | value); + +- v = ath11k_pci_read32(ab, offset); ++ v = ath11k_pcic_read32(ab, offset); + if ((v & mask) == value) + return 0; + +@@ -390,23 +220,23 @@ static void ath11k_pci_enable_ltssm(stru + u32 val; + int i; + +- val = ath11k_pci_read32(ab, PCIE_PCIE_PARF_LTSSM); ++ val = ath11k_pcic_read32(ab, PCIE_PCIE_PARF_LTSSM); + + /* PCIE link seems very unstable after the Hot Reset*/ + for (i = 0; val != PARM_LTSSM_VALUE && i < 5; i++) { + if (val == 0xffffffff) + mdelay(5); + +- ath11k_pci_write32(ab, PCIE_PCIE_PARF_LTSSM, PARM_LTSSM_VALUE); +- val = ath11k_pci_read32(ab, PCIE_PCIE_PARF_LTSSM); ++ ath11k_pcic_write32(ab, PCIE_PCIE_PARF_LTSSM, PARM_LTSSM_VALUE); ++ val = ath11k_pcic_read32(ab, PCIE_PCIE_PARF_LTSSM); + } + + ath11k_dbg(ab, ATH11K_DBG_PCI, "pci ltssm 0x%x\n", val); + +- val = ath11k_pci_read32(ab, GCC_GCC_PCIE_HOT_RST); ++ val = ath11k_pcic_read32(ab, GCC_GCC_PCIE_HOT_RST); + val |= GCC_GCC_PCIE_HOT_RST_VAL; +- ath11k_pci_write32(ab, GCC_GCC_PCIE_HOT_RST, val); +- val = ath11k_pci_read32(ab, GCC_GCC_PCIE_HOT_RST); ++ ath11k_pcic_write32(ab, GCC_GCC_PCIE_HOT_RST, val); ++ val = ath11k_pcic_read32(ab, GCC_GCC_PCIE_HOT_RST); + + ath11k_dbg(ab, ATH11K_DBG_PCI, "pci pcie_hot_rst 0x%x\n", val); + +@@ -420,21 +250,21 @@ static void ath11k_pci_clear_all_intrs(s + * So when download SBL again, SBL will open Interrupt and + * receive it, and crash immediately. + */ +- ath11k_pci_write32(ab, PCIE_PCIE_INT_ALL_CLEAR, PCIE_INT_CLEAR_ALL); ++ ath11k_pcic_write32(ab, PCIE_PCIE_INT_ALL_CLEAR, PCIE_INT_CLEAR_ALL); + } + + static void ath11k_pci_set_wlaon_pwr_ctrl(struct ath11k_base *ab) + { + u32 val; + +- val = ath11k_pci_read32(ab, WLAON_QFPROM_PWR_CTRL_REG); ++ val = ath11k_pcic_read32(ab, WLAON_QFPROM_PWR_CTRL_REG); + val &= ~QFPROM_PWR_CTRL_VDD4BLOW_MASK; +- ath11k_pci_write32(ab, WLAON_QFPROM_PWR_CTRL_REG, val); ++ ath11k_pcic_write32(ab, WLAON_QFPROM_PWR_CTRL_REG, val); + } + + static void ath11k_pci_force_wake(struct ath11k_base *ab) + { +- ath11k_pci_write32(ab, PCIE_SOC_WAKE_PCIE_LOCAL_REG, 1); ++ ath11k_pcic_write32(ab, PCIE_SOC_WAKE_PCIE_LOCAL_REG, 1); + mdelay(5); + } + +@@ -456,462 +286,6 @@ static void ath11k_pci_sw_reset(struct a + ath11k_mhi_set_mhictrl_reset(ab); + } + +-int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector) +-{ +- struct pci_dev *pci_dev = to_pci_dev(dev); +- +- return pci_irq_vector(pci_dev, vector); +-} +- +-void ath11k_pci_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, +- u32 *msi_addr_hi) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- struct pci_dev *pci_dev = to_pci_dev(ab->dev); +- +- pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, +- msi_addr_lo); +- +- if (test_bit(ATH11K_PCI_FLAG_IS_MSI_64, &ab_pci->flags)) { +- pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_HI, +- msi_addr_hi); +- } else { +- *msi_addr_hi = 0; +- } +-} +- +-int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ab_pci, char *user_name, +- int *num_vectors, u32 *user_base_data, +- u32 *base_vector) +-{ +- struct ath11k_base *ab = ab_pci->ab; +- const struct ath11k_msi_config *msi_config = ab_pci->msi_config; +- int idx; +- +- for (idx = 0; idx < msi_config->total_users; idx++) { +- if (strcmp(user_name, msi_config->users[idx].name) == 0) { +- *num_vectors = msi_config->users[idx].num_vectors; +- *base_vector = msi_config->users[idx].base_vector; +- *user_base_data = *base_vector + ab_pci->msi_ep_base_data; +- +- ath11k_dbg(ab, ATH11K_DBG_PCI, +- "Assign MSI to user: %s, num_vectors: %d, user_base_data: %u, base_vector: %u\n", +- user_name, *num_vectors, *user_base_data, +- *base_vector); +- +- return 0; +- } +- } +- +- ath11k_err(ab, "Failed to find MSI assignment for %s!\n", user_name); +- +- return -EINVAL; +-} +- +-void ath11k_pci_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx) +-{ +- u32 i, msi_data_idx; +- +- for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { +- if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) +- continue; +- +- if (ce_id == i) +- break; +- +- msi_data_idx++; +- } +- *msi_idx = msi_data_idx; +-} +- +-int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, +- int *num_vectors, u32 *user_base_data, +- u32 *base_vector) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- +- return ath11k_pci_get_user_msi_assignment(ab_pci, user_name, +- num_vectors, user_base_data, +- base_vector); +-} +- +-static void ath11k_pci_free_ext_irq(struct ath11k_base *ab) +-{ +- int i, j; +- +- for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { +- struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; +- +- for (j = 0; j < irq_grp->num_irq; j++) +- free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); +- +- netif_napi_del(&irq_grp->napi); +- } +-} +- +-void ath11k_pci_free_irq(struct ath11k_base *ab) +-{ +- int i, irq_idx; +- +- for (i = 0; i < ab->hw_params.ce_count; i++) { +- if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) +- continue; +- irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + i; +- free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); +- } +- +- ath11k_pci_free_ext_irq(ab); +-} +- +-static void ath11k_pci_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- u32 irq_idx; +- +- /* In case of one MSI vector, we handle irq enable/disable in a +- * uniform way since we only have one irq +- */ +- if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) +- return; +- +- irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_id; +- enable_irq(ab->irq_num[irq_idx]); +-} +- +-static void ath11k_pci_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- u32 irq_idx; +- +- /* In case of one MSI vector, we handle irq enable/disable in a +- * uniform way since we only have one irq +- */ +- if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) +- return; +- +- irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_id; +- disable_irq_nosync(ab->irq_num[irq_idx]); +-} +- +-static void ath11k_pci_ce_irqs_disable(struct ath11k_base *ab) +-{ +- int i; +- +- clear_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); +- +- for (i = 0; i < ab->hw_params.ce_count; i++) { +- if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) +- continue; +- ath11k_pci_ce_irq_disable(ab, i); +- } +-} +- +-static void ath11k_pci_sync_ce_irqs(struct ath11k_base *ab) +-{ +- int i; +- int irq_idx; +- +- for (i = 0; i < ab->hw_params.ce_count; i++) { +- if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) +- continue; +- +- irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + i; +- synchronize_irq(ab->irq_num[irq_idx]); +- } +-} +- +-static void ath11k_pci_ce_tasklet(struct tasklet_struct *t) +-{ +- struct ath11k_ce_pipe *ce_pipe = from_tasklet(ce_pipe, t, intr_tq); +- int irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_pipe->pipe_num; +- +- ath11k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); +- +- enable_irq(ce_pipe->ab->irq_num[irq_idx]); +-} +- +-static irqreturn_t ath11k_pci_ce_interrupt_handler(int irq, void *arg) +-{ +- struct ath11k_ce_pipe *ce_pipe = arg; +- struct ath11k_base *ab = ce_pipe->ab; +- int irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_pipe->pipe_num; +- +- if (!test_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags)) +- return IRQ_HANDLED; +- +- /* last interrupt received for this CE */ +- ce_pipe->timestamp = jiffies; +- +- disable_irq_nosync(ab->irq_num[irq_idx]); +- +- tasklet_schedule(&ce_pipe->intr_tq); +- +- return IRQ_HANDLED; +-} +- +-static void ath11k_pci_ext_grp_disable(struct ath11k_ext_irq_grp *irq_grp) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(irq_grp->ab); +- int i; +- +- /* In case of one MSI vector, we handle irq enable/disable +- * in a uniform way since we only have one irq +- */ +- if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) +- return; +- +- for (i = 0; i < irq_grp->num_irq; i++) +- disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); +-} +- +-static void __ath11k_pci_ext_irq_disable(struct ath11k_base *sc) +-{ +- int i; +- +- clear_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &sc->dev_flags); +- +- for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { +- struct ath11k_ext_irq_grp *irq_grp = &sc->ext_irq_grp[i]; +- +- ath11k_pci_ext_grp_disable(irq_grp); +- +- if (irq_grp->napi_enabled) { +- napi_synchronize(&irq_grp->napi); +- napi_disable(&irq_grp->napi); +- irq_grp->napi_enabled = false; +- } +- } +-} +- +-static void ath11k_pci_ext_grp_enable(struct ath11k_ext_irq_grp *irq_grp) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(irq_grp->ab); +- int i; +- +- /* In case of one MSI vector, we handle irq enable/disable in a +- * uniform way since we only have one irq +- */ +- if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) +- return; +- +- for (i = 0; i < irq_grp->num_irq; i++) +- enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); +-} +- +-void ath11k_pci_ext_irq_enable(struct ath11k_base *ab) +-{ +- int i; +- +- set_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); +- +- for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { +- struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; +- +- if (!irq_grp->napi_enabled) { +- napi_enable(&irq_grp->napi); +- irq_grp->napi_enabled = true; +- } +- ath11k_pci_ext_grp_enable(irq_grp); +- } +-} +- +-static void ath11k_pci_sync_ext_irqs(struct ath11k_base *ab) +-{ +- int i, j, irq_idx; +- +- for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { +- struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; +- +- for (j = 0; j < irq_grp->num_irq; j++) { +- irq_idx = irq_grp->irqs[j]; +- synchronize_irq(ab->irq_num[irq_idx]); +- } +- } +-} +- +-void ath11k_pci_ext_irq_disable(struct ath11k_base *ab) +-{ +- __ath11k_pci_ext_irq_disable(ab); +- ath11k_pci_sync_ext_irqs(ab); +-} +- +-static int ath11k_pci_ext_grp_napi_poll(struct napi_struct *napi, int budget) +-{ +- struct ath11k_ext_irq_grp *irq_grp = container_of(napi, +- struct ath11k_ext_irq_grp, +- napi); +- struct ath11k_base *ab = irq_grp->ab; +- int work_done; +- int i; +- +- work_done = ath11k_dp_service_srng(ab, irq_grp, budget); +- if (work_done < budget) { +- napi_complete_done(napi, work_done); +- for (i = 0; i < irq_grp->num_irq; i++) +- enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); +- } +- +- if (work_done > budget) +- work_done = budget; +- +- return work_done; +-} +- +-static irqreturn_t ath11k_pci_ext_interrupt_handler(int irq, void *arg) +-{ +- struct ath11k_ext_irq_grp *irq_grp = arg; +- struct ath11k_base *ab = irq_grp->ab; +- int i; +- +- if (!test_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags)) +- return IRQ_HANDLED; +- +- ath11k_dbg(irq_grp->ab, ATH11K_DBG_PCI, "ext irq:%d\n", irq); +- +- /* last interrupt received for this group */ +- irq_grp->timestamp = jiffies; +- +- for (i = 0; i < irq_grp->num_irq; i++) +- disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); +- +- napi_schedule(&irq_grp->napi); +- +- return IRQ_HANDLED; +-} +- +-static int ath11k_pci_ext_irq_config(struct ath11k_base *ab) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- int i, j, ret, num_vectors = 0; +- u32 user_base_data = 0, base_vector = 0; +- +- ret = ath11k_pci_get_user_msi_assignment(ath11k_pci_priv(ab), "DP", +- &num_vectors, +- &user_base_data, +- &base_vector); +- if (ret < 0) +- return ret; +- +- for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { +- struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; +- u32 num_irq = 0; +- +- irq_grp->ab = ab; +- irq_grp->grp_id = i; +- init_dummy_netdev(&irq_grp->napi_ndev); +- netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi, +- ath11k_pci_ext_grp_napi_poll, NAPI_POLL_WEIGHT); +- +- if (ab->hw_params.ring_mask->tx[i] || +- ab->hw_params.ring_mask->rx[i] || +- ab->hw_params.ring_mask->rx_err[i] || +- ab->hw_params.ring_mask->rx_wbm_rel[i] || +- ab->hw_params.ring_mask->reo_status[i] || +- ab->hw_params.ring_mask->rxdma2host[i] || +- ab->hw_params.ring_mask->host2rxdma[i] || +- ab->hw_params.ring_mask->rx_mon_status[i]) { +- num_irq = 1; +- } +- +- irq_grp->num_irq = num_irq; +- irq_grp->irqs[0] = ATH11K_PCI_IRQ_DP_OFFSET + i; +- +- for (j = 0; j < irq_grp->num_irq; j++) { +- int irq_idx = irq_grp->irqs[j]; +- int vector = (i % num_vectors) + base_vector; +- int irq = ath11k_pci_get_msi_irq(ab->dev, vector); +- +- ab->irq_num[irq_idx] = irq; +- +- ath11k_dbg(ab, ATH11K_DBG_PCI, +- "irq:%d group:%d\n", irq, i); +- +- irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY); +- ret = request_irq(irq, ath11k_pci_ext_interrupt_handler, +- ab_pci->irq_flags, +- "DP_EXT_IRQ", irq_grp); +- if (ret) { +- ath11k_err(ab, "failed request irq %d: %d\n", +- vector, ret); +- return ret; +- } +- } +- ath11k_pci_ext_grp_disable(irq_grp); +- } +- +- return 0; +-} +- +-int ath11k_pci_set_irq_affinity_hint(struct ath11k_pci *ab_pci, +- const struct cpumask *m) +-{ +- if (test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) +- return 0; +- +- return irq_set_affinity_hint(ab_pci->pdev->irq, m); +-} +- +-int ath11k_pci_config_irq(struct ath11k_base *ab) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- struct ath11k_ce_pipe *ce_pipe; +- u32 msi_data_start; +- u32 msi_data_count, msi_data_idx; +- u32 msi_irq_start; +- unsigned int msi_data; +- int irq, i, ret, irq_idx; +- +- ret = ath11k_pci_get_user_msi_assignment(ath11k_pci_priv(ab), +- "CE", &msi_data_count, +- &msi_data_start, &msi_irq_start); +- if (ret) +- return ret; +- +- ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0)); +- if (ret) { +- ath11k_err(ab, "failed to set irq affinity %d\n", ret); +- return ret; +- } +- +- /* Configure CE irqs */ +- for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { +- if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) +- continue; +- +- msi_data = (msi_data_idx % msi_data_count) + msi_irq_start; +- irq = ath11k_pci_get_msi_irq(ab->dev, msi_data); +- ce_pipe = &ab->ce.ce_pipe[i]; +- +- irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + i; +- +- tasklet_setup(&ce_pipe->intr_tq, ath11k_pci_ce_tasklet); +- +- ret = request_irq(irq, ath11k_pci_ce_interrupt_handler, +- ab_pci->irq_flags, irq_name[irq_idx], +- ce_pipe); +- if (ret) { +- ath11k_err(ab, "failed to request irq %d: %d\n", +- irq_idx, ret); +- goto err_irq_affinity_cleanup; +- } +- +- ab->irq_num[irq_idx] = irq; +- msi_data_idx++; +- +- ath11k_pci_ce_irq_disable(ab, i); +- } +- +- ret = ath11k_pci_ext_irq_config(ab); +- if (ret) +- goto err_irq_affinity_cleanup; +- +- return 0; +- +-err_irq_affinity_cleanup: +- ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); +- return ret; +-} +- + static void ath11k_pci_init_qmi_ce_config(struct ath11k_base *ab) + { + struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; +@@ -927,19 +301,6 @@ static void ath11k_pci_init_qmi_ce_confi + &cfg->shadow_reg_v2_len); + } + +-void ath11k_pci_ce_irqs_enable(struct ath11k_base *ab) +-{ +- int i; +- +- set_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); +- +- for (i = 0; i < ab->hw_params.ce_count; i++) { +- if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) +- continue; +- ath11k_pci_ce_irq_enable(ab, i); +- } +-} +- + static void ath11k_pci_msi_config(struct ath11k_pci *ab_pci, bool enable) + { + struct pci_dev *dev = ab_pci->pdev; +@@ -1139,13 +500,6 @@ static void ath11k_pci_aspm_disable(stru + set_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags); + } + +-void ath11k_pci_aspm_restore(struct ath11k_pci *ab_pci) +-{ +- if (test_and_clear_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags)) +- pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL, +- ab_pci->link_ctl); +-} +- + static int ath11k_pci_power_up(struct ath11k_base *ab) + { + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +@@ -1179,7 +533,7 @@ static void ath11k_pci_power_down(struct + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + + /* restore aspm in case firmware bootup fails */ +- ath11k_pci_aspm_restore(ab_pci); ++ ath11k_pcic_aspm_restore(ab_pci); + + ath11k_pci_force_wake(ab_pci->ab); + +@@ -1208,130 +562,40 @@ static int ath11k_pci_hif_resume(struct + return 0; + } + +-static void ath11k_pci_kill_tasklets(struct ath11k_base *ab) +-{ +- int i; +- +- for (i = 0; i < ab->hw_params.ce_count; i++) { +- struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; +- +- if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) +- continue; +- +- tasklet_kill(&ce_pipe->intr_tq); +- } +-} +- +-void ath11k_pci_ce_irq_disable_sync(struct ath11k_base *ab) +-{ +- ath11k_pci_ce_irqs_disable(ab); +- ath11k_pci_sync_ce_irqs(ab); +- ath11k_pci_kill_tasklets(ab); +-} +- +-void ath11k_pci_stop(struct ath11k_base *ab) +-{ +- ath11k_pci_ce_irq_disable_sync(ab); +- ath11k_ce_cleanup_pipes(ab); +-} +- +-int ath11k_pci_start(struct ath11k_base *ab) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- +- set_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags); +- +- /* TODO: for now don't restore ASPM in case of single MSI +- * vector as MHI register reading in M2 causes system hang. +- */ +- if (test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) +- ath11k_pci_aspm_restore(ab_pci); +- else +- ath11k_info(ab, "leaving PCI ASPM disabled to avoid MHI M2 problems\n"); +- +- ath11k_pci_ce_irqs_enable(ab); +- ath11k_ce_rx_post_buf(ab); +- +- return 0; +-} +- + static void ath11k_pci_hif_ce_irq_enable(struct ath11k_base *ab) + { +- ath11k_pci_ce_irqs_enable(ab); ++ ath11k_pcic_ce_irqs_enable(ab); + } + + static void ath11k_pci_hif_ce_irq_disable(struct ath11k_base *ab) + { +- ath11k_pci_ce_irq_disable_sync(ab); +-} +- +-int ath11k_pci_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, +- u8 *ul_pipe, u8 *dl_pipe) +-{ +- const struct service_to_pipe *entry; +- bool ul_set = false, dl_set = false; +- int i; +- +- for (i = 0; i < ab->hw_params.svc_to_ce_map_len; i++) { +- entry = &ab->hw_params.svc_to_ce_map[i]; +- +- if (__le32_to_cpu(entry->service_id) != service_id) +- continue; +- +- switch (__le32_to_cpu(entry->pipedir)) { +- case PIPEDIR_NONE: +- break; +- case PIPEDIR_IN: +- WARN_ON(dl_set); +- *dl_pipe = __le32_to_cpu(entry->pipenum); +- dl_set = true; +- break; +- case PIPEDIR_OUT: +- WARN_ON(ul_set); +- *ul_pipe = __le32_to_cpu(entry->pipenum); +- ul_set = true; +- break; +- case PIPEDIR_INOUT: +- WARN_ON(dl_set); +- WARN_ON(ul_set); +- *dl_pipe = __le32_to_cpu(entry->pipenum); +- *ul_pipe = __le32_to_cpu(entry->pipenum); +- dl_set = true; +- ul_set = true; +- break; +- } +- } +- +- if (WARN_ON(!ul_set || !dl_set)) +- return -ENOENT; +- +- return 0; ++ ath11k_pcic_ce_irq_disable_sync(ab); + } + + static const struct ath11k_hif_ops ath11k_pci_hif_ops = { +- .start = ath11k_pci_start, +- .stop = ath11k_pci_stop, +- .read32 = ath11k_pci_read32, +- .write32 = ath11k_pci_write32, ++ .start = ath11k_pcic_start, ++ .stop = ath11k_pcic_stop, ++ .read32 = ath11k_pcic_read32, ++ .write32 = ath11k_pcic_write32, + .power_down = ath11k_pci_power_down, + .power_up = ath11k_pci_power_up, + .suspend = ath11k_pci_hif_suspend, + .resume = ath11k_pci_hif_resume, +- .irq_enable = ath11k_pci_ext_irq_enable, +- .irq_disable = ath11k_pci_ext_irq_disable, +- .get_msi_address = ath11k_pci_get_msi_address, ++ .irq_enable = ath11k_pcic_ext_irq_enable, ++ .irq_disable = ath11k_pcic_ext_irq_disable, ++ .get_msi_address = ath11k_pcic_get_msi_address, + .get_user_msi_vector = ath11k_get_user_msi_assignment, +- .map_service_to_pipe = ath11k_pci_map_service_to_pipe, ++ .map_service_to_pipe = ath11k_pcic_map_service_to_pipe, + .ce_irq_enable = ath11k_pci_hif_ce_irq_enable, + .ce_irq_disable = ath11k_pci_hif_ce_irq_disable, +- .get_ce_msi_idx = ath11k_pci_get_ce_msi_idx, ++ .get_ce_msi_idx = ath11k_pcic_get_ce_msi_idx, + }; + + static void ath11k_pci_read_hw_version(struct ath11k_base *ab, u32 *major, u32 *minor) + { + u32 soc_hw_version; + +- soc_hw_version = ath11k_pci_read32(ab, TCSR_SOC_HW_VERSION); ++ soc_hw_version = ath11k_pcic_read32(ab, TCSR_SOC_HW_VERSION); + *major = FIELD_GET(TCSR_SOC_HW_VERSION_MAJOR_MASK, + soc_hw_version); + *minor = FIELD_GET(TCSR_SOC_HW_VERSION_MINOR_MASK, +@@ -1473,7 +737,7 @@ unsupported_wcn6855_soc: + + ath11k_pci_init_qmi_ce_config(ab); + +- ret = ath11k_pci_config_irq(ab); ++ ret = ath11k_pcic_config_irq(ab); + if (ret) { + ath11k_err(ab, "failed to config irq: %d\n", ret); + goto err_ce_free; +@@ -1498,7 +762,7 @@ unsupported_wcn6855_soc: + return 0; + + err_free_irq: +- ath11k_pci_free_irq(ab); ++ ath11k_pcic_free_irq(ab); + + err_ce_free: + ath11k_ce_free_pipes(ab); +@@ -1526,7 +790,7 @@ static void ath11k_pci_remove(struct pci + struct ath11k_base *ab = pci_get_drvdata(pdev); + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + +- ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); ++ ath11k_pcic_set_irq_affinity_hint(ab_pci, NULL); + + if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { + ath11k_pci_power_down(ab); +@@ -1542,7 +806,7 @@ static void ath11k_pci_remove(struct pci + qmi_fail: + ath11k_mhi_unregister(ab_pci); + +- ath11k_pci_free_irq(ab); ++ ath11k_pcic_free_irq(ab); + ath11k_pci_free_msi(ab_pci); + ath11k_pci_free_region(ab_pci); + +--- a/drivers/net/wireless/ath/ath11k/pci.h ++++ b/drivers/net/wireless/ath/ath11k/pci.h +@@ -53,21 +53,6 @@ + #define WLAON_QFPROM_PWR_CTRL_REG 0x01f8031c + #define QFPROM_PWR_CTRL_VDD4BLOW_MASK 0x4 + +-#define ATH11K_PCI_IRQ_CE0_OFFSET 3 +-#define ATH11K_PCI_IRQ_DP_OFFSET 14 +- +-#define ATH11K_PCI_WINDOW_ENABLE_BIT 0x40000000 +-#define ATH11K_PCI_WINDOW_REG_ADDRESS 0x310c +-#define ATH11K_PCI_WINDOW_VALUE_MASK GENMASK(24, 19) +-#define ATH11K_PCI_WINDOW_START 0x80000 +-#define ATH11K_PCI_WINDOW_RANGE_MASK GENMASK(18, 0) +- +-/* BAR0 + 4k is always accessible, and no +- * need to force wakeup. +- * 4K - 32 = 0xFE0 +- */ +-#define ATH11K_PCI_ACCESS_ALWAYS_OFF 0xFE0 +- + struct ath11k_msi_user { + char *name; + int num_vectors; +@@ -113,30 +98,4 @@ static inline struct ath11k_pci *ath11k_ + return (struct ath11k_pci *)ab->drv_priv; + } + +-int ath11k_pci_get_user_msi_assignment(struct ath11k_pci *ar_pci, char *user_name, +- int *num_vectors, u32 *user_base_data, +- u32 *base_vector); +-int ath11k_pci_get_msi_irq(struct device *dev, unsigned int vector); +-void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value); +-u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset); +-void ath11k_pci_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, +- u32 *msi_addr_hi); +-void ath11k_pci_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx); +-void ath11k_pci_free_irq(struct ath11k_base *ab); +-int ath11k_pci_config_irq(struct ath11k_base *ab); +-void ath11k_pci_ext_irq_enable(struct ath11k_base *ab); +-void ath11k_pci_ext_irq_disable(struct ath11k_base *ab); +-void ath11k_pci_stop(struct ath11k_base *ab); +-int ath11k_pci_start(struct ath11k_base *ab); +-int ath11k_pci_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, +- u8 *ul_pipe, u8 *dl_pipe); +-void ath11k_pci_ce_irqs_enable(struct ath11k_base *ab); +-void ath11k_pci_ce_irq_disable_sync(struct ath11k_base *ab); +-int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, +- int *num_vectors, u32 *user_base_data, +- u32 *base_vector); +-void ath11k_pci_aspm_restore(struct ath11k_pci *ab_pci); +-int ath11k_pci_set_irq_affinity_hint(struct ath11k_pci *ab_pci, +- const struct cpumask *m); +- + #endif +--- /dev/null ++++ b/drivers/net/wireless/ath/ath11k/pcic.c +@@ -0,0 +1,747 @@ ++// SPDX-License-Identifier: BSD-3-Clause-Clear ++/* ++ * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved. ++ */ ++ ++#include ++#include "core.h" ++#include "pcic.h" ++#include "debug.h" ++ ++static const char *irq_name[ATH11K_IRQ_NUM_MAX] = { ++ "bhi", ++ "mhi-er0", ++ "mhi-er1", ++ "ce0", ++ "ce1", ++ "ce2", ++ "ce3", ++ "ce4", ++ "ce5", ++ "ce6", ++ "ce7", ++ "ce8", ++ "ce9", ++ "ce10", ++ "ce11", ++ "host2wbm-desc-feed", ++ "host2reo-re-injection", ++ "host2reo-command", ++ "host2rxdma-monitor-ring3", ++ "host2rxdma-monitor-ring2", ++ "host2rxdma-monitor-ring1", ++ "reo2ost-exception", ++ "wbm2host-rx-release", ++ "reo2host-status", ++ "reo2host-destination-ring4", ++ "reo2host-destination-ring3", ++ "reo2host-destination-ring2", ++ "reo2host-destination-ring1", ++ "rxdma2host-monitor-destination-mac3", ++ "rxdma2host-monitor-destination-mac2", ++ "rxdma2host-monitor-destination-mac1", ++ "ppdu-end-interrupts-mac3", ++ "ppdu-end-interrupts-mac2", ++ "ppdu-end-interrupts-mac1", ++ "rxdma2host-monitor-status-ring-mac3", ++ "rxdma2host-monitor-status-ring-mac2", ++ "rxdma2host-monitor-status-ring-mac1", ++ "host2rxdma-host-buf-ring-mac3", ++ "host2rxdma-host-buf-ring-mac2", ++ "host2rxdma-host-buf-ring-mac1", ++ "rxdma2host-destination-ring-mac3", ++ "rxdma2host-destination-ring-mac2", ++ "rxdma2host-destination-ring-mac1", ++ "host2tcl-input-ring4", ++ "host2tcl-input-ring3", ++ "host2tcl-input-ring2", ++ "host2tcl-input-ring1", ++ "wbm2host-tx-completions-ring3", ++ "wbm2host-tx-completions-ring2", ++ "wbm2host-tx-completions-ring1", ++ "tcl2host-status-ring", ++}; ++ ++void ath11k_pcic_aspm_restore(struct ath11k_pci *ab_pci) ++{ ++ if (test_and_clear_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags)) ++ pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL, ++ ab_pci->link_ctl); ++} ++ ++static inline void ath11k_pcic_select_window(struct ath11k_pci *ab_pci, u32 offset) ++{ ++ struct ath11k_base *ab = ab_pci->ab; ++ ++ u32 window = FIELD_GET(ATH11K_PCI_WINDOW_VALUE_MASK, offset); ++ ++ lockdep_assert_held(&ab_pci->window_lock); ++ ++ if (window != ab_pci->register_window) { ++ iowrite32(ATH11K_PCI_WINDOW_ENABLE_BIT | window, ++ ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); ++ ioread32(ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); ++ ab_pci->register_window = window; ++ } ++} ++ ++static inline u32 ath11k_pcic_get_window_start(struct ath11k_base *ab, ++ u32 offset) ++{ ++ u32 window_start; ++ ++ /* If offset lies within DP register range, use 3rd window */ ++ if ((offset ^ HAL_SEQ_WCSS_UMAC_OFFSET) < ATH11K_PCI_WINDOW_RANGE_MASK) ++ window_start = 3 * ATH11K_PCI_WINDOW_START; ++ /* If offset lies within CE register range, use 2nd window */ ++ else if ((offset ^ HAL_CE_WFSS_CE_REG_BASE) < ATH11K_PCI_WINDOW_RANGE_MASK) ++ window_start = 2 * ATH11K_PCI_WINDOW_START; ++ else ++ window_start = ATH11K_PCI_WINDOW_START; ++ ++ return window_start; ++} ++ ++void ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ u32 window_start; ++ int ret = 0; ++ ++ /* for offset beyond BAR + 4K - 32, may ++ * need to wakeup MHI to access. ++ */ ++ if (ab->hw_params.wakeup_mhi && ++ test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF) ++ ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); ++ ++ if (offset < ATH11K_PCI_WINDOW_START) { ++ iowrite32(value, ab->mem + offset); ++ } else { ++ if (ab->bus_params.static_window_map) ++ window_start = ath11k_pcic_get_window_start(ab, offset); ++ else ++ window_start = ATH11K_PCI_WINDOW_START; ++ ++ if (window_start == ATH11K_PCI_WINDOW_START) { ++ spin_lock_bh(&ab_pci->window_lock); ++ ath11k_pcic_select_window(ab_pci, offset); ++ iowrite32(value, ab->mem + window_start + ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); ++ spin_unlock_bh(&ab_pci->window_lock); ++ } else { ++ iowrite32(value, ab->mem + window_start + ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); ++ } ++ } ++ ++ if (ab->hw_params.wakeup_mhi && ++ test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ++ !ret) ++ mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); ++} ++ ++u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ u32 val, window_start; ++ int ret = 0; ++ ++ /* for offset beyond BAR + 4K - 32, may ++ * need to wakeup MHI to access. ++ */ ++ if (ab->hw_params.wakeup_mhi && ++ test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF) ++ ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); ++ ++ if (offset < ATH11K_PCI_WINDOW_START) { ++ val = ioread32(ab->mem + offset); ++ } else { ++ if (ab->bus_params.static_window_map) ++ window_start = ath11k_pcic_get_window_start(ab, offset); ++ else ++ window_start = ATH11K_PCI_WINDOW_START; ++ ++ if (window_start == ATH11K_PCI_WINDOW_START) { ++ spin_lock_bh(&ab_pci->window_lock); ++ ath11k_pcic_select_window(ab_pci, offset); ++ val = ioread32(ab->mem + window_start + ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); ++ spin_unlock_bh(&ab_pci->window_lock); ++ } else { ++ val = ioread32(ab->mem + window_start + ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); ++ } ++ } ++ ++ if (ab->hw_params.wakeup_mhi && ++ test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ++ !ret) ++ mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); ++ ++ return val; ++} ++ ++int ath11k_pcic_get_msi_irq(struct device *dev, unsigned int vector) ++{ ++ struct pci_dev *pci_dev = to_pci_dev(dev); ++ ++ return pci_irq_vector(pci_dev, vector); ++} ++ ++void ath11k_pcic_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, ++ u32 *msi_addr_hi) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ struct pci_dev *pci_dev = to_pci_dev(ab->dev); ++ ++ pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, ++ msi_addr_lo); ++ ++ if (test_bit(ATH11K_PCI_FLAG_IS_MSI_64, &ab_pci->flags)) { ++ pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_HI, ++ msi_addr_hi); ++ } else { ++ *msi_addr_hi = 0; ++ } ++} ++ ++int ath11k_pcic_get_user_msi_assignment(struct ath11k_pci *ab_pci, char *user_name, ++ int *num_vectors, u32 *user_base_data, ++ u32 *base_vector) ++{ ++ struct ath11k_base *ab = ab_pci->ab; ++ const struct ath11k_msi_config *msi_config = ab_pci->msi_config; ++ int idx; ++ ++ for (idx = 0; idx < msi_config->total_users; idx++) { ++ if (strcmp(user_name, msi_config->users[idx].name) == 0) { ++ *num_vectors = msi_config->users[idx].num_vectors; ++ *base_vector = msi_config->users[idx].base_vector; ++ *user_base_data = *base_vector + ab_pci->msi_ep_base_data; ++ ++ ath11k_dbg(ab, ATH11K_DBG_PCI, ++ "Assign MSI to user: %s, num_vectors: %d, user_base_data: %u, base_vector: %u\n", ++ user_name, *num_vectors, *user_base_data, ++ *base_vector); ++ ++ return 0; ++ } ++ } ++ ++ ath11k_err(ab, "Failed to find MSI assignment for %s!\n", user_name); ++ ++ return -EINVAL; ++} ++ ++void ath11k_pcic_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx) ++{ ++ u32 i, msi_data_idx; ++ ++ for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { ++ if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) ++ continue; ++ ++ if (ce_id == i) ++ break; ++ ++ msi_data_idx++; ++ } ++ *msi_idx = msi_data_idx; ++} ++ ++int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, ++ int *num_vectors, u32 *user_base_data, ++ u32 *base_vector) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ ++ return ath11k_pcic_get_user_msi_assignment(ab_pci, user_name, ++ num_vectors, user_base_data, ++ base_vector); ++} ++ ++static void ath11k_pcic_free_ext_irq(struct ath11k_base *ab) ++{ ++ int i, j; ++ ++ for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { ++ struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; ++ ++ for (j = 0; j < irq_grp->num_irq; j++) ++ free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); ++ ++ netif_napi_del(&irq_grp->napi); ++ } ++} ++ ++void ath11k_pcic_free_irq(struct ath11k_base *ab) ++{ ++ int i, irq_idx; ++ ++ for (i = 0; i < ab->hw_params.ce_count; i++) { ++ if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) ++ continue; ++ irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + i; ++ free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); ++ } ++ ++ ath11k_pcic_free_ext_irq(ab); ++} ++ ++static void ath11k_pcic_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ u32 irq_idx; ++ ++ /* In case of one MSI vector, we handle irq enable/disable in a ++ * uniform way since we only have one irq ++ */ ++ if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ return; ++ ++ irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_id; ++ enable_irq(ab->irq_num[irq_idx]); ++} ++ ++static void ath11k_pcic_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ u32 irq_idx; ++ ++ /* In case of one MSI vector, we handle irq enable/disable in a ++ * uniform way since we only have one irq ++ */ ++ if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ return; ++ ++ irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_id; ++ disable_irq_nosync(ab->irq_num[irq_idx]); ++} ++ ++static void ath11k_pcic_ce_irqs_disable(struct ath11k_base *ab) ++{ ++ int i; ++ ++ clear_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); ++ ++ for (i = 0; i < ab->hw_params.ce_count; i++) { ++ if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) ++ continue; ++ ath11k_pcic_ce_irq_disable(ab, i); ++ } ++} ++ ++static void ath11k_pcic_sync_ce_irqs(struct ath11k_base *ab) ++{ ++ int i; ++ int irq_idx; ++ ++ for (i = 0; i < ab->hw_params.ce_count; i++) { ++ if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) ++ continue; ++ ++ irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + i; ++ synchronize_irq(ab->irq_num[irq_idx]); ++ } ++} ++ ++static void ath11k_pcic_ce_tasklet(struct tasklet_struct *t) ++{ ++ struct ath11k_ce_pipe *ce_pipe = from_tasklet(ce_pipe, t, intr_tq); ++ int irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_pipe->pipe_num; ++ ++ ath11k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); ++ ++ enable_irq(ce_pipe->ab->irq_num[irq_idx]); ++} ++ ++static irqreturn_t ath11k_pcic_ce_interrupt_handler(int irq, void *arg) ++{ ++ struct ath11k_ce_pipe *ce_pipe = arg; ++ struct ath11k_base *ab = ce_pipe->ab; ++ int irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_pipe->pipe_num; ++ ++ if (!test_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags)) ++ return IRQ_HANDLED; ++ ++ /* last interrupt received for this CE */ ++ ce_pipe->timestamp = jiffies; ++ ++ disable_irq_nosync(ab->irq_num[irq_idx]); ++ ++ tasklet_schedule(&ce_pipe->intr_tq); ++ ++ return IRQ_HANDLED; ++} ++ ++static void ath11k_pcic_ext_grp_disable(struct ath11k_ext_irq_grp *irq_grp) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(irq_grp->ab); ++ int i; ++ ++ /* In case of one MSI vector, we handle irq enable/disable ++ * in a uniform way since we only have one irq ++ */ ++ if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ return; ++ ++ for (i = 0; i < irq_grp->num_irq; i++) ++ disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); ++} ++ ++static void __ath11k_pcic_ext_irq_disable(struct ath11k_base *sc) ++{ ++ int i; ++ ++ clear_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &sc->dev_flags); ++ ++ for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { ++ struct ath11k_ext_irq_grp *irq_grp = &sc->ext_irq_grp[i]; ++ ++ ath11k_pcic_ext_grp_disable(irq_grp); ++ ++ if (irq_grp->napi_enabled) { ++ napi_synchronize(&irq_grp->napi); ++ napi_disable(&irq_grp->napi); ++ irq_grp->napi_enabled = false; ++ } ++ } ++} ++ ++static void ath11k_pcic_ext_grp_enable(struct ath11k_ext_irq_grp *irq_grp) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(irq_grp->ab); ++ int i; ++ ++ /* In case of one MSI vector, we handle irq enable/disable in a ++ * uniform way since we only have one irq ++ */ ++ if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ return; ++ ++ for (i = 0; i < irq_grp->num_irq; i++) ++ enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); ++} ++ ++void ath11k_pcic_ext_irq_enable(struct ath11k_base *ab) ++{ ++ int i; ++ ++ set_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); ++ ++ for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { ++ struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; ++ ++ if (!irq_grp->napi_enabled) { ++ napi_enable(&irq_grp->napi); ++ irq_grp->napi_enabled = true; ++ } ++ ath11k_pcic_ext_grp_enable(irq_grp); ++ } ++} ++ ++static void ath11k_pcic_sync_ext_irqs(struct ath11k_base *ab) ++{ ++ int i, j, irq_idx; ++ ++ for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { ++ struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; ++ ++ for (j = 0; j < irq_grp->num_irq; j++) { ++ irq_idx = irq_grp->irqs[j]; ++ synchronize_irq(ab->irq_num[irq_idx]); ++ } ++ } ++} ++ ++void ath11k_pcic_ext_irq_disable(struct ath11k_base *ab) ++{ ++ __ath11k_pcic_ext_irq_disable(ab); ++ ath11k_pcic_sync_ext_irqs(ab); ++} ++ ++static int ath11k_pcic_ext_grp_napi_poll(struct napi_struct *napi, int budget) ++{ ++ struct ath11k_ext_irq_grp *irq_grp = container_of(napi, ++ struct ath11k_ext_irq_grp, ++ napi); ++ struct ath11k_base *ab = irq_grp->ab; ++ int work_done; ++ int i; ++ ++ work_done = ath11k_dp_service_srng(ab, irq_grp, budget); ++ if (work_done < budget) { ++ napi_complete_done(napi, work_done); ++ for (i = 0; i < irq_grp->num_irq; i++) ++ enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); ++ } ++ ++ if (work_done > budget) ++ work_done = budget; ++ ++ return work_done; ++} ++ ++static irqreturn_t ath11k_pcic_ext_interrupt_handler(int irq, void *arg) ++{ ++ struct ath11k_ext_irq_grp *irq_grp = arg; ++ struct ath11k_base *ab = irq_grp->ab; ++ int i; ++ ++ if (!test_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags)) ++ return IRQ_HANDLED; ++ ++ ath11k_dbg(irq_grp->ab, ATH11K_DBG_PCI, "ext irq:%d\n", irq); ++ ++ /* last interrupt received for this group */ ++ irq_grp->timestamp = jiffies; ++ ++ for (i = 0; i < irq_grp->num_irq; i++) ++ disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); ++ ++ napi_schedule(&irq_grp->napi); ++ ++ return IRQ_HANDLED; ++} ++ ++static int ath11k_pcic_ext_irq_config(struct ath11k_base *ab) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ int i, j, ret, num_vectors = 0; ++ u32 user_base_data = 0, base_vector = 0; ++ ++ ret = ath11k_pcic_get_user_msi_assignment(ath11k_pci_priv(ab), "DP", ++ &num_vectors, ++ &user_base_data, ++ &base_vector); ++ if (ret < 0) ++ return ret; ++ ++ for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { ++ struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; ++ u32 num_irq = 0; ++ ++ irq_grp->ab = ab; ++ irq_grp->grp_id = i; ++ init_dummy_netdev(&irq_grp->napi_ndev); ++ netif_napi_add(&irq_grp->napi_ndev, &irq_grp->napi, ++ ath11k_pcic_ext_grp_napi_poll, NAPI_POLL_WEIGHT); ++ ++ if (ab->hw_params.ring_mask->tx[i] || ++ ab->hw_params.ring_mask->rx[i] || ++ ab->hw_params.ring_mask->rx_err[i] || ++ ab->hw_params.ring_mask->rx_wbm_rel[i] || ++ ab->hw_params.ring_mask->reo_status[i] || ++ ab->hw_params.ring_mask->rxdma2host[i] || ++ ab->hw_params.ring_mask->host2rxdma[i] || ++ ab->hw_params.ring_mask->rx_mon_status[i]) { ++ num_irq = 1; ++ } ++ ++ irq_grp->num_irq = num_irq; ++ irq_grp->irqs[0] = ATH11K_PCI_IRQ_DP_OFFSET + i; ++ ++ for (j = 0; j < irq_grp->num_irq; j++) { ++ int irq_idx = irq_grp->irqs[j]; ++ int vector = (i % num_vectors) + base_vector; ++ int irq = ath11k_pcic_get_msi_irq(ab->dev, vector); ++ ++ ab->irq_num[irq_idx] = irq; ++ ++ ath11k_dbg(ab, ATH11K_DBG_PCI, ++ "irq:%d group:%d\n", irq, i); ++ ++ irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY); ++ ret = request_irq(irq, ath11k_pcic_ext_interrupt_handler, ++ ab_pci->irq_flags, ++ "DP_EXT_IRQ", irq_grp); ++ if (ret) { ++ ath11k_err(ab, "failed request irq %d: %d\n", ++ vector, ret); ++ return ret; ++ } ++ } ++ ath11k_pcic_ext_grp_disable(irq_grp); ++ } ++ ++ return 0; ++} ++ ++int ath11k_pcic_set_irq_affinity_hint(struct ath11k_pci *ab_pci, ++ const struct cpumask *m) ++{ ++ if (test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ return 0; ++ ++ return irq_set_affinity_hint(ab_pci->pdev->irq, m); ++} ++ ++int ath11k_pcic_config_irq(struct ath11k_base *ab) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ struct ath11k_ce_pipe *ce_pipe; ++ u32 msi_data_start; ++ u32 msi_data_count, msi_data_idx; ++ u32 msi_irq_start; ++ unsigned int msi_data; ++ int irq, i, ret, irq_idx; ++ ++ ret = ath11k_pcic_get_user_msi_assignment(ath11k_pci_priv(ab), ++ "CE", &msi_data_count, ++ &msi_data_start, &msi_irq_start); ++ if (ret) ++ return ret; ++ ++ ret = ath11k_pcic_set_irq_affinity_hint(ab_pci, cpumask_of(0)); ++ if (ret) { ++ ath11k_err(ab, "failed to set irq affinity %d\n", ret); ++ return ret; ++ } ++ ++ /* Configure CE irqs */ ++ for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { ++ if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) ++ continue; ++ ++ msi_data = (msi_data_idx % msi_data_count) + msi_irq_start; ++ irq = ath11k_pcic_get_msi_irq(ab->dev, msi_data); ++ ce_pipe = &ab->ce.ce_pipe[i]; ++ ++ irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + i; ++ ++ tasklet_setup(&ce_pipe->intr_tq, ath11k_pcic_ce_tasklet); ++ ++ ret = request_irq(irq, ath11k_pcic_ce_interrupt_handler, ++ ab_pci->irq_flags, irq_name[irq_idx], ++ ce_pipe); ++ if (ret) { ++ ath11k_err(ab, "failed to request irq %d: %d\n", ++ irq_idx, ret); ++ goto err_irq_affinity_cleanup; ++ } ++ ++ ab->irq_num[irq_idx] = irq; ++ msi_data_idx++; ++ ++ ath11k_pcic_ce_irq_disable(ab, i); ++ } ++ ++ ret = ath11k_pcic_ext_irq_config(ab); ++ if (ret) ++ goto err_irq_affinity_cleanup; ++ ++ return 0; ++ ++err_irq_affinity_cleanup: ++ ath11k_pcic_set_irq_affinity_hint(ab_pci, NULL); ++ return ret; ++} ++ ++void ath11k_pcic_ce_irqs_enable(struct ath11k_base *ab) ++{ ++ int i; ++ ++ set_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); ++ ++ for (i = 0; i < ab->hw_params.ce_count; i++) { ++ if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) ++ continue; ++ ath11k_pcic_ce_irq_enable(ab, i); ++ } ++} ++ ++static void ath11k_pcic_kill_tasklets(struct ath11k_base *ab) ++{ ++ int i; ++ ++ for (i = 0; i < ab->hw_params.ce_count; i++) { ++ struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; ++ ++ if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) ++ continue; ++ ++ tasklet_kill(&ce_pipe->intr_tq); ++ } ++} ++ ++void ath11k_pcic_ce_irq_disable_sync(struct ath11k_base *ab) ++{ ++ ath11k_pcic_ce_irqs_disable(ab); ++ ath11k_pcic_sync_ce_irqs(ab); ++ ath11k_pcic_kill_tasklets(ab); ++} ++ ++void ath11k_pcic_stop(struct ath11k_base *ab) ++{ ++ ath11k_pcic_ce_irq_disable_sync(ab); ++ ath11k_ce_cleanup_pipes(ab); ++} ++ ++int ath11k_pcic_start(struct ath11k_base *ab) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ ++ set_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags); ++ ++ /* TODO: for now don't restore ASPM in case of single MSI ++ * vector as MHI register reading in M2 causes system hang. ++ */ ++ if (test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ ath11k_pcic_aspm_restore(ab_pci); ++ else ++ ath11k_info(ab, "leaving PCI ASPM disabled to avoid MHI M2 problems\n"); ++ ++ ath11k_pcic_ce_irqs_enable(ab); ++ ath11k_ce_rx_post_buf(ab); ++ ++ return 0; ++} ++ ++int ath11k_pcic_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, ++ u8 *ul_pipe, u8 *dl_pipe) ++{ ++ const struct service_to_pipe *entry; ++ bool ul_set = false, dl_set = false; ++ int i; ++ ++ for (i = 0; i < ab->hw_params.svc_to_ce_map_len; i++) { ++ entry = &ab->hw_params.svc_to_ce_map[i]; ++ ++ if (__le32_to_cpu(entry->service_id) != service_id) ++ continue; ++ ++ switch (__le32_to_cpu(entry->pipedir)) { ++ case PIPEDIR_NONE: ++ break; ++ case PIPEDIR_IN: ++ WARN_ON(dl_set); ++ *dl_pipe = __le32_to_cpu(entry->pipenum); ++ dl_set = true; ++ break; ++ case PIPEDIR_OUT: ++ WARN_ON(ul_set); ++ *ul_pipe = __le32_to_cpu(entry->pipenum); ++ ul_set = true; ++ break; ++ case PIPEDIR_INOUT: ++ WARN_ON(dl_set); ++ WARN_ON(ul_set); ++ *dl_pipe = __le32_to_cpu(entry->pipenum); ++ *ul_pipe = __le32_to_cpu(entry->pipenum); ++ dl_set = true; ++ ul_set = true; ++ break; ++ } ++ } ++ ++ if (WARN_ON(!ul_set || !dl_set)) ++ return -ENOENT; ++ ++ return 0; ++} +--- /dev/null ++++ b/drivers/net/wireless/ath/ath11k/pcic.h +@@ -0,0 +1,53 @@ ++/* SPDX-License-Identifier: BSD-3-Clause-Clear */ ++/* ++ * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. ++ * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved. ++ */ ++ ++#ifndef _ATH11K_PCI_CMN_H ++#define _ATH11K_PCI_CMN_H ++ ++#include "core.h" ++#include "pci.h" ++ ++#define ATH11K_PCI_IRQ_CE0_OFFSET 3 ++#define ATH11K_PCI_IRQ_DP_OFFSET 14 ++ ++#define ATH11K_PCI_WINDOW_ENABLE_BIT 0x40000000 ++#define ATH11K_PCI_WINDOW_REG_ADDRESS 0x310c ++#define ATH11K_PCI_WINDOW_VALUE_MASK GENMASK(24, 19) ++#define ATH11K_PCI_WINDOW_START 0x80000 ++#define ATH11K_PCI_WINDOW_RANGE_MASK GENMASK(18, 0) ++ ++/* BAR0 + 4k is always accessible, and no ++ * need to force wakeup. ++ * 4K - 32 = 0xFE0 ++ */ ++#define ATH11K_PCI_ACCESS_ALWAYS_OFF 0xFE0 ++ ++int ath11k_pcic_get_user_msi_assignment(struct ath11k_pci *ar_pci, char *user_name, ++ int *num_vectors, u32 *user_base_data, ++ u32 *base_vector); ++int ath11k_pcic_get_msi_irq(struct device *dev, unsigned int vector); ++void ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value); ++u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset); ++void ath11k_pcic_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, ++ u32 *msi_addr_hi); ++void ath11k_pcic_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx); ++void ath11k_pcic_free_irq(struct ath11k_base *ab); ++int ath11k_pcic_config_irq(struct ath11k_base *ab); ++void ath11k_pcic_ext_irq_enable(struct ath11k_base *ab); ++void ath11k_pcic_ext_irq_disable(struct ath11k_base *ab); ++void ath11k_pcic_stop(struct ath11k_base *ab); ++int ath11k_pcic_start(struct ath11k_base *ab); ++int ath11k_pcic_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, ++ u8 *ul_pipe, u8 *dl_pipe); ++void ath11k_pcic_ce_irqs_enable(struct ath11k_base *ab); ++void ath11k_pcic_ce_irq_disable_sync(struct ath11k_base *ab); ++int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, ++ int *num_vectors, u32 *user_base_data, ++ u32 *base_vector); ++void ath11k_pcic_aspm_restore(struct ath11k_pci *ab_pci); ++int ath11k_pcic_set_irq_affinity_hint(struct ath11k_pci *ab_pci, ++ const struct cpumask *m); ++#endif diff --git a/package/kernel/mac80211/patches/ath11k/0217-ath11k-Choose-MSI-config-based-on-HW-revision.patch b/package/kernel/mac80211/patches/ath11k/0217-ath11k-Choose-MSI-config-based-on-HW-revision.patch new file mode 100644 index 000000000..03fdd7eb4 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0217-ath11k-Choose-MSI-config-based-on-HW-revision.patch @@ -0,0 +1,184 @@ +From 8d06b8023ace027dc31a9cb3c85c3c8fe83289c5 Mon Sep 17 00:00:00 2001 +From: Manikanta Pubbisetty +Date: Fri, 1 Apr 2022 14:53:08 +0300 +Subject: [PATCH] ath11k: Choose MSI config based on HW revision + +Instead of selecting MSI config based on magic numbers, make +the assignment based on HW revision. The logic is similar to +the selection of HW params. This improves readability of the +code and also simplifies new additions. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00192-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Manikanta Pubbisetty +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220328055714.6449-4-quic_mpubbise@quicinc.com +--- + drivers/net/wireless/ath/ath11k/pci.c | 31 +++--------- + drivers/net/wireless/ath/ath11k/pci.h | 1 + + drivers/net/wireless/ath/ath11k/pcic.c | 70 ++++++++++++++++++++++++++ + drivers/net/wireless/ath/ath11k/pcic.h | 1 + + 4 files changed, 78 insertions(+), 25 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -43,28 +43,6 @@ static const struct ath11k_bus_params at + .fixed_mem_region = false, + }; + +-static const struct ath11k_msi_config ath11k_msi_config[] = { +- { +- .total_vectors = 32, +- .total_users = 4, +- .users = (struct ath11k_msi_user[]) { +- { .name = "MHI", .num_vectors = 3, .base_vector = 0 }, +- { .name = "CE", .num_vectors = 10, .base_vector = 3 }, +- { .name = "WAKE", .num_vectors = 1, .base_vector = 13 }, +- { .name = "DP", .num_vectors = 18, .base_vector = 14 }, +- }, +- }, +- { +- .total_vectors = 16, +- .total_users = 3, +- .users = (struct ath11k_msi_user[]) { +- { .name = "MHI", .num_vectors = 3, .base_vector = 0 }, +- { .name = "CE", .num_vectors = 5, .base_vector = 3 }, +- { .name = "DP", .num_vectors = 8, .base_vector = 8 }, +- }, +- }, +-}; +- + static const struct ath11k_msi_config msi_config_one_msi = { + .total_vectors = 1, + .total_users = 4, +@@ -667,10 +645,8 @@ static int ath11k_pci_probe(struct pci_d + ret = -EOPNOTSUPP; + goto err_pci_free_region; + } +- ab_pci->msi_config = &ath11k_msi_config[0]; + break; + case QCN9074_DEVICE_ID: +- ab_pci->msi_config = &ath11k_msi_config[1]; + ab->bus_params.static_window_map = true; + ab->hw_rev = ATH11K_HW_QCN9074_HW10; + break; +@@ -700,7 +676,6 @@ unsupported_wcn6855_soc: + ret = -EOPNOTSUPP; + goto err_pci_free_region; + } +- ab_pci->msi_config = &ath11k_msi_config[0]; + break; + default: + dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n", +@@ -709,6 +684,12 @@ unsupported_wcn6855_soc: + goto err_pci_free_region; + } + ++ ret = ath11k_pcic_init_msi_config(ab); ++ if (ret) { ++ ath11k_err(ab, "failed to init msi config: %d\n", ret); ++ goto err_pci_free_region; ++ } ++ + ret = ath11k_pci_alloc_msi(ab_pci); + if (ret) { + ath11k_err(ab, "failed to enable msi: %d\n", ret); +--- a/drivers/net/wireless/ath/ath11k/pci.h ++++ b/drivers/net/wireless/ath/ath11k/pci.h +@@ -63,6 +63,7 @@ struct ath11k_msi_config { + int total_vectors; + int total_users; + struct ath11k_msi_user *users; ++ u16 hw_rev; + }; + + enum ath11k_pci_flags { +--- a/drivers/net/wireless/ath/ath11k/pcic.c ++++ b/drivers/net/wireless/ath/ath11k/pcic.c +@@ -63,6 +63,76 @@ static const char *irq_name[ATH11K_IRQ_N + "tcl2host-status-ring", + }; + ++static const struct ath11k_msi_config ath11k_msi_config[] = { ++ { ++ .total_vectors = 32, ++ .total_users = 4, ++ .users = (struct ath11k_msi_user[]) { ++ { .name = "MHI", .num_vectors = 3, .base_vector = 0 }, ++ { .name = "CE", .num_vectors = 10, .base_vector = 3 }, ++ { .name = "WAKE", .num_vectors = 1, .base_vector = 13 }, ++ { .name = "DP", .num_vectors = 18, .base_vector = 14 }, ++ }, ++ .hw_rev = ATH11K_HW_QCA6390_HW20, ++ }, ++ { ++ .total_vectors = 16, ++ .total_users = 3, ++ .users = (struct ath11k_msi_user[]) { ++ { .name = "MHI", .num_vectors = 3, .base_vector = 0 }, ++ { .name = "CE", .num_vectors = 5, .base_vector = 3 }, ++ { .name = "DP", .num_vectors = 8, .base_vector = 8 }, ++ }, ++ .hw_rev = ATH11K_HW_QCN9074_HW10, ++ }, ++ { ++ .total_vectors = 32, ++ .total_users = 4, ++ .users = (struct ath11k_msi_user[]) { ++ { .name = "MHI", .num_vectors = 3, .base_vector = 0 }, ++ { .name = "CE", .num_vectors = 10, .base_vector = 3 }, ++ { .name = "WAKE", .num_vectors = 1, .base_vector = 13 }, ++ { .name = "DP", .num_vectors = 18, .base_vector = 14 }, ++ }, ++ .hw_rev = ATH11K_HW_WCN6855_HW20, ++ }, ++ { ++ .total_vectors = 32, ++ .total_users = 4, ++ .users = (struct ath11k_msi_user[]) { ++ { .name = "MHI", .num_vectors = 3, .base_vector = 0 }, ++ { .name = "CE", .num_vectors = 10, .base_vector = 3 }, ++ { .name = "WAKE", .num_vectors = 1, .base_vector = 13 }, ++ { .name = "DP", .num_vectors = 18, .base_vector = 14 }, ++ }, ++ .hw_rev = ATH11K_HW_WCN6855_HW21, ++ }, ++}; ++ ++int ath11k_pcic_init_msi_config(struct ath11k_base *ab) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ const struct ath11k_msi_config *msi_config; ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(ath11k_msi_config); i++) { ++ msi_config = &ath11k_msi_config[i]; ++ ++ if (msi_config->hw_rev == ab->hw_rev) ++ break; ++ } ++ ++ if (i == ARRAY_SIZE(ath11k_msi_config)) { ++ ath11k_err(ab, "failed to fetch msi config, unsupported hw version: 0x%x\n", ++ ab->hw_rev); ++ return -EINVAL; ++ } ++ ++ ab_pci->msi_config = msi_config; ++ return 0; ++} ++EXPORT_SYMBOL(ath11k_pcic_init_msi_config); ++ + void ath11k_pcic_aspm_restore(struct ath11k_pci *ab_pci) + { + if (test_and_clear_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags)) +--- a/drivers/net/wireless/ath/ath11k/pcic.h ++++ b/drivers/net/wireless/ath/ath11k/pcic.h +@@ -50,4 +50,5 @@ int ath11k_get_user_msi_assignment(struc + void ath11k_pcic_aspm_restore(struct ath11k_pci *ab_pci); + int ath11k_pcic_set_irq_affinity_hint(struct ath11k_pci *ab_pci, + const struct cpumask *m); ++int ath11k_pcic_init_msi_config(struct ath11k_base *ab); + #endif diff --git a/package/kernel/mac80211/patches/ath11k/0218-ath11k-Refactor-MSI-logic-to-support-WCN6750.patch b/package/kernel/mac80211/patches/ath11k/0218-ath11k-Refactor-MSI-logic-to-support-WCN6750.patch new file mode 100644 index 000000000..30e0e6099 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0218-ath11k-Refactor-MSI-logic-to-support-WCN6750.patch @@ -0,0 +1,299 @@ +From 0cfaf2243e9eef8ed32cdde6467a7e123a9f915f Mon Sep 17 00:00:00 2001 +From: Manikanta Pubbisetty +Date: Fri, 1 Apr 2022 14:53:08 +0300 +Subject: [PATCH] ath11k: Refactor MSI logic to support WCN6750 + +Refactor MSI logic in order to support hybrid bus devices +like WCN6750. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00192-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Manikanta Pubbisetty +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220328055714.6449-5-quic_mpubbise@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.h | 22 ++++++++++++++ + drivers/net/wireless/ath/ath11k/mhi.c | 3 +- + drivers/net/wireless/ath/ath11k/pci.c | 29 +++++++++++------- + drivers/net/wireless/ath/ath11k/pci.h | 16 ---------- + drivers/net/wireless/ath/ath11k/pcic.c | 41 +++++--------------------- + drivers/net/wireless/ath/ath11k/pcic.h | 5 +--- + 6 files changed, 51 insertions(+), 65 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -769,6 +769,19 @@ struct ath11k_soc_dp_stats { + struct ath11k_dp_ring_bp_stats bp_stats; + }; + ++struct ath11k_msi_user { ++ char *name; ++ int num_vectors; ++ u32 base_vector; ++}; ++ ++struct ath11k_msi_config { ++ int total_vectors; ++ int total_users; ++ struct ath11k_msi_user *users; ++ u16 hw_rev; ++}; ++ + /* Master structure to hold the hw data which may be used in core module */ + struct ath11k_base { + enum ath11k_hw_rev hw_rev; +@@ -905,6 +918,15 @@ struct ath11k_base { + u32 subsystem_device; + } id; + ++ struct { ++ struct { ++ const struct ath11k_msi_config *config; ++ u32 ep_base_data; ++ u32 addr_lo; ++ u32 addr_hi; ++ } msi; ++ } pci; ++ + /* must be last */ + u8 drv_priv[] __aligned(sizeof(void *)); + }; +--- a/drivers/net/wireless/ath/ath11k/mhi.c ++++ b/drivers/net/wireless/ath/ath11k/mhi.c +@@ -258,8 +258,7 @@ static int ath11k_mhi_get_msi(struct ath + int *irq; + unsigned int msi_data; + +- ret = ath11k_pcic_get_user_msi_assignment(ab_pci, +- "MHI", &num_vectors, ++ ret = ath11k_pcic_get_user_msi_assignment(ab, "MHI", &num_vectors, + &user_base_data, &base_vector); + if (ret) + return ret; +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -307,12 +307,13 @@ static void ath11k_pci_msi_disable(struc + static int ath11k_pci_alloc_msi(struct ath11k_pci *ab_pci) + { + struct ath11k_base *ab = ab_pci->ab; +- const struct ath11k_msi_config *msi_config = ab_pci->msi_config; ++ const struct ath11k_msi_config *msi_config = ab->pci.msi.config; ++ struct pci_dev *pci_dev = ab_pci->pdev; + struct msi_desc *msi_desc; + int num_vectors; + int ret; + +- num_vectors = pci_alloc_irq_vectors(ab_pci->pdev, ++ num_vectors = pci_alloc_irq_vectors(pci_dev, + msi_config->total_vectors, + msi_config->total_vectors, + PCI_IRQ_MSI); +@@ -329,7 +330,7 @@ static int ath11k_pci_alloc_msi(struct a + goto reset_msi_config; + } + clear_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags); +- ab_pci->msi_config = &msi_config_one_msi; ++ ab->pci.msi.config = &msi_config_one_msi; + ab_pci->irq_flags = IRQF_SHARED | IRQF_NOBALANCING; + ath11k_dbg(ab, ATH11K_DBG_PCI, "request MSI one vector\n"); + } +@@ -344,11 +345,19 @@ static int ath11k_pci_alloc_msi(struct a + goto free_msi_vector; + } + +- ab_pci->msi_ep_base_data = msi_desc->msg.data; +- if (msi_desc->msi_attrib.is_64) +- set_bit(ATH11K_PCI_FLAG_IS_MSI_64, &ab_pci->flags); ++ ab->pci.msi.ep_base_data = msi_desc->msg.data; ++ ++ pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, ++ &ab->pci.msi.addr_lo); ++ ++ if (msi_desc->msi_attrib.is_64) { ++ pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_HI, ++ &ab->pci.msi.addr_hi); ++ } else { ++ ab->pci.msi.addr_hi = 0; ++ } + +- ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", ab_pci->msi_ep_base_data); ++ ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", ab->pci.msi.ep_base_data); + + return 0; + +@@ -375,10 +384,10 @@ static int ath11k_pci_config_msi_data(st + return -EINVAL; + } + +- ab_pci->msi_ep_base_data = msi_desc->msg.data; ++ ab_pci->ab->pci.msi.ep_base_data = msi_desc->msg.data; + + ath11k_dbg(ab_pci->ab, ATH11K_DBG_PCI, "pci after request_irq msi_ep_base_data %d\n", +- ab_pci->msi_ep_base_data); ++ ab_pci->ab->pci.msi.ep_base_data); + + return 0; + } +@@ -562,7 +571,7 @@ static const struct ath11k_hif_ops ath11 + .irq_enable = ath11k_pcic_ext_irq_enable, + .irq_disable = ath11k_pcic_ext_irq_disable, + .get_msi_address = ath11k_pcic_get_msi_address, +- .get_user_msi_vector = ath11k_get_user_msi_assignment, ++ .get_user_msi_vector = ath11k_pcic_get_user_msi_assignment, + .map_service_to_pipe = ath11k_pcic_map_service_to_pipe, + .ce_irq_enable = ath11k_pci_hif_ce_irq_enable, + .ce_irq_disable = ath11k_pci_hif_ce_irq_disable, +--- a/drivers/net/wireless/ath/ath11k/pci.h ++++ b/drivers/net/wireless/ath/ath11k/pci.h +@@ -53,22 +53,8 @@ + #define WLAON_QFPROM_PWR_CTRL_REG 0x01f8031c + #define QFPROM_PWR_CTRL_VDD4BLOW_MASK 0x4 + +-struct ath11k_msi_user { +- char *name; +- int num_vectors; +- u32 base_vector; +-}; +- +-struct ath11k_msi_config { +- int total_vectors; +- int total_users; +- struct ath11k_msi_user *users; +- u16 hw_rev; +-}; +- + enum ath11k_pci_flags { + ATH11K_PCI_FLAG_INIT_DONE, +- ATH11K_PCI_FLAG_IS_MSI_64, + ATH11K_PCI_ASPM_RESTORE, + ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, + }; +@@ -78,9 +64,7 @@ struct ath11k_pci { + struct ath11k_base *ab; + u16 dev_id; + char amss_path[100]; +- u32 msi_ep_base_data; + struct mhi_controller *mhi_ctrl; +- const struct ath11k_msi_config *msi_config; + unsigned long mhi_state; + u32 register_window; + +--- a/drivers/net/wireless/ath/ath11k/pcic.c ++++ b/drivers/net/wireless/ath/ath11k/pcic.c +@@ -111,7 +111,6 @@ static const struct ath11k_msi_config at + + int ath11k_pcic_init_msi_config(struct ath11k_base *ab) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + const struct ath11k_msi_config *msi_config; + int i; + +@@ -128,7 +127,7 @@ int ath11k_pcic_init_msi_config(struct a + return -EINVAL; + } + +- ab_pci->msi_config = msi_config; ++ ab->pci.msi.config = msi_config; + return 0; + } + EXPORT_SYMBOL(ath11k_pcic_init_msi_config); +@@ -267,33 +266,22 @@ int ath11k_pcic_get_msi_irq(struct devic + void ath11k_pcic_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, + u32 *msi_addr_hi) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- struct pci_dev *pci_dev = to_pci_dev(ab->dev); +- +- pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, +- msi_addr_lo); +- +- if (test_bit(ATH11K_PCI_FLAG_IS_MSI_64, &ab_pci->flags)) { +- pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_HI, +- msi_addr_hi); +- } else { +- *msi_addr_hi = 0; +- } ++ *msi_addr_lo = ab->pci.msi.addr_lo; ++ *msi_addr_hi = ab->pci.msi.addr_hi; + } + +-int ath11k_pcic_get_user_msi_assignment(struct ath11k_pci *ab_pci, char *user_name, ++int ath11k_pcic_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, + int *num_vectors, u32 *user_base_data, + u32 *base_vector) + { +- struct ath11k_base *ab = ab_pci->ab; +- const struct ath11k_msi_config *msi_config = ab_pci->msi_config; ++ const struct ath11k_msi_config *msi_config = ab->pci.msi.config; + int idx; + + for (idx = 0; idx < msi_config->total_users; idx++) { + if (strcmp(user_name, msi_config->users[idx].name) == 0) { + *num_vectors = msi_config->users[idx].num_vectors; + *base_vector = msi_config->users[idx].base_vector; +- *user_base_data = *base_vector + ab_pci->msi_ep_base_data; ++ *user_base_data = *base_vector + ab->pci.msi.ep_base_data; + + ath11k_dbg(ab, ATH11K_DBG_PCI, + "Assign MSI to user: %s, num_vectors: %d, user_base_data: %u, base_vector: %u\n", +@@ -325,17 +313,6 @@ void ath11k_pcic_get_ce_msi_idx(struct a + *msi_idx = msi_data_idx; + } + +-int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, +- int *num_vectors, u32 *user_base_data, +- u32 *base_vector) +-{ +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- +- return ath11k_pcic_get_user_msi_assignment(ab_pci, user_name, +- num_vectors, user_base_data, +- base_vector); +-} +- + static void ath11k_pcic_free_ext_irq(struct ath11k_base *ab) + { + int i, j; +@@ -586,8 +563,7 @@ static int ath11k_pcic_ext_irq_config(st + int i, j, ret, num_vectors = 0; + u32 user_base_data = 0, base_vector = 0; + +- ret = ath11k_pcic_get_user_msi_assignment(ath11k_pci_priv(ab), "DP", +- &num_vectors, ++ ret = ath11k_pcic_get_user_msi_assignment(ab, "DP", &num_vectors, + &user_base_data, + &base_vector); + if (ret < 0) +@@ -662,8 +638,7 @@ int ath11k_pcic_config_irq(struct ath11k + unsigned int msi_data; + int irq, i, ret, irq_idx; + +- ret = ath11k_pcic_get_user_msi_assignment(ath11k_pci_priv(ab), +- "CE", &msi_data_count, ++ ret = ath11k_pcic_get_user_msi_assignment(ab, "CE", &msi_data_count, + &msi_data_start, &msi_irq_start); + if (ret) + return ret; +--- a/drivers/net/wireless/ath/ath11k/pcic.h ++++ b/drivers/net/wireless/ath/ath11k/pcic.h +@@ -25,7 +25,7 @@ + */ + #define ATH11K_PCI_ACCESS_ALWAYS_OFF 0xFE0 + +-int ath11k_pcic_get_user_msi_assignment(struct ath11k_pci *ar_pci, char *user_name, ++int ath11k_pcic_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, + int *num_vectors, u32 *user_base_data, + u32 *base_vector); + int ath11k_pcic_get_msi_irq(struct device *dev, unsigned int vector); +@@ -44,9 +44,6 @@ int ath11k_pcic_map_service_to_pipe(stru + u8 *ul_pipe, u8 *dl_pipe); + void ath11k_pcic_ce_irqs_enable(struct ath11k_base *ab); + void ath11k_pcic_ce_irq_disable_sync(struct ath11k_base *ab); +-int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, +- int *num_vectors, u32 *user_base_data, +- u32 *base_vector); + void ath11k_pcic_aspm_restore(struct ath11k_pci *ab_pci); + int ath11k_pcic_set_irq_affinity_hint(struct ath11k_pci *ab_pci, + const struct cpumask *m); diff --git a/package/kernel/mac80211/patches/ath11k/0219-ath11k-Remove-core-PCI-references-from-PCI-common-co.patch b/package/kernel/mac80211/patches/ath11k/0219-ath11k-Remove-core-PCI-references-from-PCI-common-co.patch new file mode 100644 index 000000000..ef7cb1ec8 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0219-ath11k-Remove-core-PCI-references-from-PCI-common-co.patch @@ -0,0 +1,845 @@ +From 5b32b6dd966338005671780c1df02327582c4be4 Mon Sep 17 00:00:00 2001 +From: Manikanta Pubbisetty +Date: Fri, 1 Apr 2022 14:53:08 +0300 +Subject: [PATCH] ath11k: Remove core PCI references from PCI common code + +Remove core PCI and ath11k PCI references(struct ath11k_pci) +from PCI common code. Since, PCI common code will be used +by hybrid bus devices, this code should be independent +from ATH11K PCI references and Linux core PCI references +like struct pci_dev. + +Since this change introduces function callbacks for bus wakeup +and bus release operations, wakeup_mhi HW param is no longer +needed and hence it is removed completely. Alternatively, bus +wakeup/release ops for QCA9074 are initialized to NULL as +QCA9704 does not need bus wakeup/release for register accesses. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00192-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Manikanta Pubbisetty +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220328055714.6449-6-quic_mpubbise@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 6 - + drivers/net/wireless/ath/ath11k/core.h | 12 ++ + drivers/net/wireless/ath/ath11k/hw.h | 2 +- + drivers/net/wireless/ath/ath11k/mhi.c | 6 +- + drivers/net/wireless/ath/ath11k/pci.c | 146 +++++++++++++++++++-- + drivers/net/wireless/ath/ath11k/pci.h | 5 +- + drivers/net/wireless/ath/ath11k/pcic.c | 169 +++++++++---------------- + drivers/net/wireless/ath/ath11k/pcic.h | 5 - + 8 files changed, 211 insertions(+), 140 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -96,7 +96,6 @@ static const struct ath11k_hw_params ath + .hal_params = &ath11k_hw_hal_params_ipq8074, + .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = true, +- .wakeup_mhi = false, + .supports_rssi_stats = false, + .fw_wmi_diag_event = false, + .current_cc_support = false, +@@ -163,7 +162,6 @@ static const struct ath11k_hw_params ath + .hal_params = &ath11k_hw_hal_params_ipq8074, + .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = true, +- .wakeup_mhi = false, + .supports_rssi_stats = false, + .fw_wmi_diag_event = false, + .current_cc_support = false, +@@ -229,7 +227,6 @@ static const struct ath11k_hw_params ath + .hal_params = &ath11k_hw_hal_params_qca6390, + .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = false, +- .wakeup_mhi = true, + .supports_rssi_stats = true, + .fw_wmi_diag_event = true, + .current_cc_support = true, +@@ -295,7 +292,6 @@ static const struct ath11k_hw_params ath + .hal_params = &ath11k_hw_hal_params_ipq8074, + .supports_dynamic_smps_6ghz = true, + .alloc_cacheable_memory = true, +- .wakeup_mhi = false, + .supports_rssi_stats = false, + .fw_wmi_diag_event = false, + .current_cc_support = false, +@@ -361,7 +357,6 @@ static const struct ath11k_hw_params ath + .hal_params = &ath11k_hw_hal_params_qca6390, + .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = false, +- .wakeup_mhi = true, + .supports_rssi_stats = true, + .fw_wmi_diag_event = true, + .current_cc_support = true, +@@ -426,7 +421,6 @@ static const struct ath11k_hw_params ath + .hal_params = &ath11k_hw_hal_params_qca6390, + .supports_dynamic_smps_6ghz = false, + .alloc_cacheable_memory = false, +- .wakeup_mhi = true, + .supports_rssi_stats = true, + .fw_wmi_diag_event = true, + .current_cc_support = true, +--- a/drivers/net/wireless/ath/ath11k/core.h ++++ b/drivers/net/wireless/ath/ath11k/core.h +@@ -239,6 +239,8 @@ enum ath11k_dev_flags { + ATH11K_FLAG_CE_IRQ_ENABLED, + ATH11K_FLAG_EXT_IRQ_ENABLED, + ATH11K_FLAG_FIXED_MEM_RGN, ++ ATH11K_FLAG_DEVICE_INIT_DONE, ++ ATH11K_FLAG_MULTI_MSI_VECTORS, + }; + + enum ath11k_monitor_flags { +@@ -728,6 +730,14 @@ struct ath11k_bus_params { + bool static_window_map; + }; + ++struct ath11k_pci_ops { ++ int (*wakeup)(struct ath11k_base *ab); ++ void (*release)(struct ath11k_base *ab); ++ int (*get_msi_irq)(struct ath11k_base *ab, unsigned int vector); ++ void (*window_write32)(struct ath11k_base *ab, u32 offset, u32 value); ++ u32 (*window_read32)(struct ath11k_base *ab, u32 offset); ++}; ++ + /* IPQ8074 HW channel counters frequency value in hertz */ + #define IPQ8074_CC_FREQ_HERTZ 320000 + +@@ -925,6 +935,8 @@ struct ath11k_base { + u32 addr_lo; + u32 addr_hi; + } msi; ++ ++ const struct ath11k_pci_ops *ops; + } pci; + + /* must be last */ +--- a/drivers/net/wireless/ath/ath11k/hw.h ++++ b/drivers/net/wireless/ath/ath11k/hw.h +@@ -1,6 +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. + */ + + #ifndef ATH11K_HW_H +@@ -189,7 +190,6 @@ struct ath11k_hw_params { + const struct ath11k_hw_hal_params *hal_params; + bool supports_dynamic_smps_6ghz; + bool alloc_cacheable_memory; +- bool wakeup_mhi; + bool supports_rssi_stats; + bool fw_wmi_diag_event; + bool current_cc_support; +--- a/drivers/net/wireless/ath/ath11k/mhi.c ++++ b/drivers/net/wireless/ath/ath11k/mhi.c +@@ -273,10 +273,10 @@ static int ath11k_mhi_get_msi(struct ath + for (i = 0; i < num_vectors; i++) { + msi_data = base_vector; + +- if (test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ if (test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) + msi_data += i; + +- irq[i] = ath11k_pcic_get_msi_irq(ab->dev, msi_data); ++ irq[i] = ath11k_pci_get_msi_irq(ab, msi_data); + } + + ab_pci->mhi_ctrl->irq = irq; +@@ -408,7 +408,7 @@ int ath11k_mhi_register(struct ath11k_pc + return ret; + } + +- if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) + mhi_ctrl->irq_flags = IRQF_SHARED | IRQF_NOBALANCING; + + if (test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) { +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -36,6 +36,85 @@ static const struct pci_device_id ath11k + + MODULE_DEVICE_TABLE(pci, ath11k_pci_id_table); + ++static int ath11k_pci_bus_wake_up(struct ath11k_base *ab) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ ++ return mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); ++} ++ ++static void ath11k_pci_bus_release(struct ath11k_base *ab) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ ++ mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); ++} ++ ++static inline void ath11k_pci_select_window(struct ath11k_pci *ab_pci, u32 offset) ++{ ++ struct ath11k_base *ab = ab_pci->ab; ++ ++ u32 window = FIELD_GET(ATH11K_PCI_WINDOW_VALUE_MASK, offset); ++ ++ lockdep_assert_held(&ab_pci->window_lock); ++ ++ if (window != ab_pci->register_window) { ++ iowrite32(ATH11K_PCI_WINDOW_ENABLE_BIT | window, ++ ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); ++ ioread32(ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); ++ ab_pci->register_window = window; ++ } ++} ++ ++static void ++ath11k_pci_window_write32(struct ath11k_base *ab, u32 offset, u32 value) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ u32 window_start = ATH11K_PCI_WINDOW_START; ++ ++ spin_lock_bh(&ab_pci->window_lock); ++ ath11k_pci_select_window(ab_pci, offset); ++ iowrite32(value, ab->mem + window_start + ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); ++ spin_unlock_bh(&ab_pci->window_lock); ++} ++ ++static u32 ath11k_pci_window_read32(struct ath11k_base *ab, u32 offset) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ u32 window_start = ATH11K_PCI_WINDOW_START; ++ u32 val; ++ ++ spin_lock_bh(&ab_pci->window_lock); ++ ath11k_pci_select_window(ab_pci, offset); ++ val = ioread32(ab->mem + window_start + ++ (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); ++ spin_unlock_bh(&ab_pci->window_lock); ++ ++ return val; ++} ++ ++int ath11k_pci_get_msi_irq(struct ath11k_base *ab, unsigned int vector) ++{ ++ struct pci_dev *pci_dev = to_pci_dev(ab->dev); ++ ++ return pci_irq_vector(pci_dev, vector); ++} ++ ++static const struct ath11k_pci_ops ath11k_pci_ops_qca6390 = { ++ .wakeup = ath11k_pci_bus_wake_up, ++ .release = ath11k_pci_bus_release, ++ .get_msi_irq = ath11k_pci_get_msi_irq, ++ .window_write32 = ath11k_pci_window_write32, ++ .window_read32 = ath11k_pci_window_read32, ++}; ++ ++static const struct ath11k_pci_ops ath11k_pci_ops_qcn9074 = { ++ .get_msi_irq = ath11k_pci_get_msi_irq, ++ .window_write32 = ath11k_pci_window_write32, ++ .window_read32 = ath11k_pci_window_read32, ++}; ++ + static const struct ath11k_bus_params ath11k_pci_bus_params = { + .mhi_support = true, + .m3_fw_support = true, +@@ -318,8 +397,7 @@ static int ath11k_pci_alloc_msi(struct a + msi_config->total_vectors, + PCI_IRQ_MSI); + if (num_vectors == msi_config->total_vectors) { +- set_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags); +- ab_pci->irq_flags = IRQF_SHARED; ++ set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); + } else { + num_vectors = pci_alloc_irq_vectors(ab_pci->pdev, + 1, +@@ -329,9 +407,8 @@ static int ath11k_pci_alloc_msi(struct a + ret = -EINVAL; + goto reset_msi_config; + } +- clear_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags); ++ clear_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); + ab->pci.msi.config = &msi_config_one_msi; +- ab_pci->irq_flags = IRQF_SHARED | IRQF_NOBALANCING; + ath11k_dbg(ab, ATH11K_DBG_PCI, "request MSI one vector\n"); + } + ath11k_info(ab, "MSI vectors: %d\n", num_vectors); +@@ -487,13 +564,20 @@ static void ath11k_pci_aspm_disable(stru + set_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags); + } + ++static void ath11k_pci_aspm_restore(struct ath11k_pci *ab_pci) ++{ ++ if (test_and_clear_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags)) ++ pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL, ++ ab_pci->link_ctl); ++} ++ + static int ath11k_pci_power_up(struct ath11k_base *ab) + { + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + int ret; + + ab_pci->register_window = 0; +- clear_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags); ++ clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); + ath11k_pci_sw_reset(ab_pci->ab, true); + + /* Disable ASPM during firmware download due to problems switching +@@ -520,14 +604,14 @@ static void ath11k_pci_power_down(struct + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + + /* restore aspm in case firmware bootup fails */ +- ath11k_pcic_aspm_restore(ab_pci); ++ ath11k_pci_aspm_restore(ab_pci); + + ath11k_pci_force_wake(ab_pci->ab); + + ath11k_pci_msi_disable(ab_pci); + + ath11k_mhi_stop(ab_pci); +- clear_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags); ++ clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); + ath11k_pci_sw_reset(ab_pci->ab, false); + } + +@@ -559,8 +643,25 @@ static void ath11k_pci_hif_ce_irq_disabl + ath11k_pcic_ce_irq_disable_sync(ab); + } + ++static int ath11k_pci_start(struct ath11k_base *ab) ++{ ++ struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); ++ ++ /* TODO: for now don't restore ASPM in case of single MSI ++ * vector as MHI register reading in M2 causes system hang. ++ */ ++ if (test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) ++ ath11k_pci_aspm_restore(ab_pci); ++ else ++ ath11k_info(ab, "leaving PCI ASPM disabled to avoid MHI M2 problems\n"); ++ ++ ath11k_pcic_start(ab); ++ ++ return 0; ++} ++ + static const struct ath11k_hif_ops ath11k_pci_hif_ops = { +- .start = ath11k_pcic_start, ++ .start = ath11k_pci_start, + .stop = ath11k_pcic_stop, + .read32 = ath11k_pcic_read32, + .write32 = ath11k_pcic_write32, +@@ -592,6 +693,15 @@ static void ath11k_pci_read_hw_version(s + *major, *minor); + } + ++static int ath11k_pci_set_irq_affinity_hint(struct ath11k_pci *ab_pci, ++ const struct cpumask *m) ++{ ++ if (test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab_pci->ab->dev_flags)) ++ return 0; ++ ++ return irq_set_affinity_hint(ab_pci->pdev->irq, m); ++} ++ + static int ath11k_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *pci_dev) + { +@@ -654,9 +764,12 @@ static int ath11k_pci_probe(struct pci_d + ret = -EOPNOTSUPP; + goto err_pci_free_region; + } ++ ++ ab->pci.ops = &ath11k_pci_ops_qca6390; + break; + case QCN9074_DEVICE_ID: + ab->bus_params.static_window_map = true; ++ ab->pci.ops = &ath11k_pci_ops_qcn9074; + ab->hw_rev = ATH11K_HW_QCN9074_HW10; + break; + case WCN6855_DEVICE_ID: +@@ -685,6 +798,8 @@ unsupported_wcn6855_soc: + ret = -EOPNOTSUPP; + goto err_pci_free_region; + } ++ ++ ab->pci.ops = &ath11k_pci_ops_qca6390; + break; + default: + dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n", +@@ -733,6 +848,12 @@ unsupported_wcn6855_soc: + goto err_ce_free; + } + ++ ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0)); ++ if (ret) { ++ ath11k_err(ab, "failed to set irq affinity %d\n", ret); ++ goto err_free_irq; ++ } ++ + /* kernel may allocate a dummy vector before request_irq and + * then allocate a real vector when request_irq is called. + * So get msi_data here again to avoid spurious interrupt +@@ -741,16 +862,19 @@ unsupported_wcn6855_soc: + ret = ath11k_pci_config_msi_data(ab_pci); + if (ret) { + ath11k_err(ab, "failed to config msi_data: %d\n", ret); +- goto err_free_irq; ++ goto err_irq_affinity_cleanup; + } + + ret = ath11k_core_init(ab); + if (ret) { + ath11k_err(ab, "failed to init core: %d\n", ret); +- goto err_free_irq; ++ goto err_irq_affinity_cleanup; + } + return 0; + ++err_irq_affinity_cleanup: ++ ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); ++ + err_free_irq: + ath11k_pcic_free_irq(ab); + +@@ -780,7 +904,7 @@ static void ath11k_pci_remove(struct pci + struct ath11k_base *ab = pci_get_drvdata(pdev); + struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + +- ath11k_pcic_set_irq_affinity_hint(ab_pci, NULL); ++ ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); + + if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { + ath11k_pci_power_down(ab); +--- a/drivers/net/wireless/ath/ath11k/pci.h ++++ b/drivers/net/wireless/ath/ath11k/pci.h +@@ -54,9 +54,7 @@ + #define QFPROM_PWR_CTRL_VDD4BLOW_MASK 0x4 + + enum ath11k_pci_flags { +- ATH11K_PCI_FLAG_INIT_DONE, + ATH11K_PCI_ASPM_RESTORE, +- ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, + }; + + struct ath11k_pci { +@@ -74,8 +72,6 @@ struct ath11k_pci { + /* enum ath11k_pci_flags */ + unsigned long flags; + u16 link_ctl; +- +- unsigned long irq_flags; + }; + + static inline struct ath11k_pci *ath11k_pci_priv(struct ath11k_base *ab) +@@ -83,4 +79,5 @@ static inline struct ath11k_pci *ath11k_ + return (struct ath11k_pci *)ab->drv_priv; + } + ++int ath11k_pci_get_msi_irq(struct ath11k_base *ab, unsigned int vector); + #endif +--- a/drivers/net/wireless/ath/ath11k/pcic.c ++++ b/drivers/net/wireless/ath/ath11k/pcic.c +@@ -4,7 +4,6 @@ + * Copyright (c) 2021-2022, Qualcomm Innovation Center, Inc. All rights reserved. + */ + +-#include + #include "core.h" + #include "pcic.h" + #include "debug.h" +@@ -132,29 +131,6 @@ int ath11k_pcic_init_msi_config(struct a + } + EXPORT_SYMBOL(ath11k_pcic_init_msi_config); + +-void ath11k_pcic_aspm_restore(struct ath11k_pci *ab_pci) +-{ +- if (test_and_clear_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags)) +- pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL, +- ab_pci->link_ctl); +-} +- +-static inline void ath11k_pcic_select_window(struct ath11k_pci *ab_pci, u32 offset) +-{ +- struct ath11k_base *ab = ab_pci->ab; +- +- u32 window = FIELD_GET(ATH11K_PCI_WINDOW_VALUE_MASK, offset); +- +- lockdep_assert_held(&ab_pci->window_lock); +- +- if (window != ab_pci->register_window) { +- iowrite32(ATH11K_PCI_WINDOW_ENABLE_BIT | window, +- ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); +- ioread32(ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); +- ab_pci->register_window = window; +- } +-} +- + static inline u32 ath11k_pcic_get_window_start(struct ath11k_base *ab, + u32 offset) + { +@@ -174,17 +150,15 @@ static inline u32 ath11k_pcic_get_window + + void ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + u32 window_start; + int ret = 0; + + /* for offset beyond BAR + 4K - 32, may +- * need to wakeup MHI to access. ++ * need to wakeup the device to access. + */ +- if (ab->hw_params.wakeup_mhi && +- test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF) +- ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); ++ if (test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ab->pci.ops->wakeup) ++ ret = ab->pci.ops->wakeup(ab); + + if (offset < ATH11K_PCI_WINDOW_START) { + iowrite32(value, ab->mem + offset); +@@ -194,38 +168,32 @@ void ath11k_pcic_write32(struct ath11k_b + else + window_start = ATH11K_PCI_WINDOW_START; + +- if (window_start == ATH11K_PCI_WINDOW_START) { +- spin_lock_bh(&ab_pci->window_lock); +- ath11k_pcic_select_window(ab_pci, offset); +- iowrite32(value, ab->mem + window_start + +- (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); +- spin_unlock_bh(&ab_pci->window_lock); ++ if (window_start == ATH11K_PCI_WINDOW_START && ++ ab->pci.ops->window_write32) { ++ ab->pci.ops->window_write32(ab, offset, value); + } else { + iowrite32(value, ab->mem + window_start + + (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + } + } + +- if (ab->hw_params.wakeup_mhi && +- test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ++ if (test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ab->pci.ops->release && + !ret) +- mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); ++ ab->pci.ops->release(ab); + } + + u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + u32 val, window_start; + int ret = 0; + + /* for offset beyond BAR + 4K - 32, may +- * need to wakeup MHI to access. ++ * need to wakeup the device to access. + */ +- if (ab->hw_params.wakeup_mhi && +- test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF) +- ret = mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); ++ if (test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ab->pci.ops->wakeup) ++ ret = ab->pci.ops->wakeup(ab); + + if (offset < ATH11K_PCI_WINDOW_START) { + val = ioread32(ab->mem + offset); +@@ -235,34 +203,23 @@ u32 ath11k_pcic_read32(struct ath11k_bas + else + window_start = ATH11K_PCI_WINDOW_START; + +- if (window_start == ATH11K_PCI_WINDOW_START) { +- spin_lock_bh(&ab_pci->window_lock); +- ath11k_pcic_select_window(ab_pci, offset); +- val = ioread32(ab->mem + window_start + +- (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); +- spin_unlock_bh(&ab_pci->window_lock); ++ if (window_start == ATH11K_PCI_WINDOW_START && ++ ab->pci.ops->window_read32) { ++ val = ab->pci.ops->window_read32(ab, offset); + } else { + val = ioread32(ab->mem + window_start + + (offset & ATH11K_PCI_WINDOW_RANGE_MASK)); + } + } + +- if (ab->hw_params.wakeup_mhi && +- test_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && +- offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ++ if (test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && ++ offset >= ATH11K_PCI_ACCESS_ALWAYS_OFF && ab->pci.ops->release && + !ret) +- mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); ++ ab->pci.ops->release(ab); + + return val; + } + +-int ath11k_pcic_get_msi_irq(struct device *dev, unsigned int vector) +-{ +- struct pci_dev *pci_dev = to_pci_dev(dev); +- +- return pci_irq_vector(pci_dev, vector); +-} +- + void ath11k_pcic_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, + u32 *msi_addr_hi) + { +@@ -343,13 +300,12 @@ void ath11k_pcic_free_irq(struct ath11k_ + + static void ath11k_pcic_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + u32 irq_idx; + + /* In case of one MSI vector, we handle irq enable/disable in a + * uniform way since we only have one irq + */ +- if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) + return; + + irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_id; +@@ -358,13 +314,12 @@ static void ath11k_pcic_ce_irq_enable(st + + static void ath11k_pcic_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + u32 irq_idx; + + /* In case of one MSI vector, we handle irq enable/disable in a + * uniform way since we only have one irq + */ +- if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) + return; + + irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + ce_id; +@@ -429,13 +384,13 @@ static irqreturn_t ath11k_pcic_ce_interr + + static void ath11k_pcic_ext_grp_disable(struct ath11k_ext_irq_grp *irq_grp) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(irq_grp->ab); ++ struct ath11k_base *ab = irq_grp->ab; + int i; + + /* In case of one MSI vector, we handle irq enable/disable + * in a uniform way since we only have one irq + */ +- if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) + return; + + for (i = 0; i < irq_grp->num_irq; i++) +@@ -463,13 +418,13 @@ static void __ath11k_pcic_ext_irq_disabl + + static void ath11k_pcic_ext_grp_enable(struct ath11k_ext_irq_grp *irq_grp) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(irq_grp->ab); ++ struct ath11k_base *ab = irq_grp->ab; + int i; + + /* In case of one MSI vector, we handle irq enable/disable in a + * uniform way since we only have one irq + */ +- if (!test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) ++ if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) + return; + + for (i = 0; i < irq_grp->num_irq; i++) +@@ -557,11 +512,22 @@ static irqreturn_t ath11k_pcic_ext_inter + return IRQ_HANDLED; + } + ++static int ++ath11k_pcic_get_msi_irq(struct ath11k_base *ab, unsigned int vector) ++{ ++ if (!ab->pci.ops->get_msi_irq) { ++ WARN_ONCE(1, "get_msi_irq pci op not defined"); ++ return -EOPNOTSUPP; ++ } ++ ++ return ab->pci.ops->get_msi_irq(ab, vector); ++} ++ + static int ath11k_pcic_ext_irq_config(struct ath11k_base *ab) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + int i, j, ret, num_vectors = 0; + u32 user_base_data = 0, base_vector = 0; ++ unsigned long irq_flags; + + ret = ath11k_pcic_get_user_msi_assignment(ab, "DP", &num_vectors, + &user_base_data, +@@ -569,6 +535,10 @@ static int ath11k_pcic_ext_irq_config(st + if (ret < 0) + return ret; + ++ irq_flags = IRQF_SHARED; ++ if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) ++ irq_flags |= IRQF_NOBALANCING; ++ + for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { + struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; + u32 num_irq = 0; +@@ -596,7 +566,10 @@ static int ath11k_pcic_ext_irq_config(st + for (j = 0; j < irq_grp->num_irq; j++) { + int irq_idx = irq_grp->irqs[j]; + int vector = (i % num_vectors) + base_vector; +- int irq = ath11k_pcic_get_msi_irq(ab->dev, vector); ++ int irq = ath11k_pcic_get_msi_irq(ab, vector); ++ ++ if (irq < 0) ++ return irq; + + ab->irq_num[irq_idx] = irq; + +@@ -605,8 +578,7 @@ static int ath11k_pcic_ext_irq_config(st + + irq_set_status_flags(irq, IRQ_DISABLE_UNLAZY); + ret = request_irq(irq, ath11k_pcic_ext_interrupt_handler, +- ab_pci->irq_flags, +- "DP_EXT_IRQ", irq_grp); ++ irq_flags, "DP_EXT_IRQ", irq_grp); + if (ret) { + ath11k_err(ab, "failed request irq %d: %d\n", + vector, ret); +@@ -619,35 +591,24 @@ static int ath11k_pcic_ext_irq_config(st + return 0; + } + +-int ath11k_pcic_set_irq_affinity_hint(struct ath11k_pci *ab_pci, +- const struct cpumask *m) +-{ +- if (test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) +- return 0; +- +- return irq_set_affinity_hint(ab_pci->pdev->irq, m); +-} +- + int ath11k_pcic_config_irq(struct ath11k_base *ab) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); + struct ath11k_ce_pipe *ce_pipe; + u32 msi_data_start; + u32 msi_data_count, msi_data_idx; + u32 msi_irq_start; + unsigned int msi_data; + int irq, i, ret, irq_idx; ++ unsigned long irq_flags; + + ret = ath11k_pcic_get_user_msi_assignment(ab, "CE", &msi_data_count, + &msi_data_start, &msi_irq_start); + if (ret) + return ret; + +- ret = ath11k_pcic_set_irq_affinity_hint(ab_pci, cpumask_of(0)); +- if (ret) { +- ath11k_err(ab, "failed to set irq affinity %d\n", ret); +- return ret; +- } ++ irq_flags = IRQF_SHARED; ++ if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) ++ irq_flags |= IRQF_NOBALANCING; + + /* Configure CE irqs */ + for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { +@@ -655,7 +616,10 @@ int ath11k_pcic_config_irq(struct ath11k + continue; + + msi_data = (msi_data_idx % msi_data_count) + msi_irq_start; +- irq = ath11k_pcic_get_msi_irq(ab->dev, msi_data); ++ irq = ath11k_pcic_get_msi_irq(ab, msi_data); ++ if (irq < 0) ++ return irq; ++ + ce_pipe = &ab->ce.ce_pipe[i]; + + irq_idx = ATH11K_PCI_IRQ_CE0_OFFSET + i; +@@ -663,12 +627,11 @@ int ath11k_pcic_config_irq(struct ath11k + tasklet_setup(&ce_pipe->intr_tq, ath11k_pcic_ce_tasklet); + + ret = request_irq(irq, ath11k_pcic_ce_interrupt_handler, +- ab_pci->irq_flags, irq_name[irq_idx], +- ce_pipe); ++ irq_flags, irq_name[irq_idx], ce_pipe); + if (ret) { + ath11k_err(ab, "failed to request irq %d: %d\n", + irq_idx, ret); +- goto err_irq_affinity_cleanup; ++ return ret; + } + + ab->irq_num[irq_idx] = irq; +@@ -679,13 +642,9 @@ int ath11k_pcic_config_irq(struct ath11k + + ret = ath11k_pcic_ext_irq_config(ab); + if (ret) +- goto err_irq_affinity_cleanup; ++ return ret; + + return 0; +- +-err_irq_affinity_cleanup: +- ath11k_pcic_set_irq_affinity_hint(ab_pci, NULL); +- return ret; + } + + void ath11k_pcic_ce_irqs_enable(struct ath11k_base *ab) +@@ -730,17 +689,7 @@ void ath11k_pcic_stop(struct ath11k_base + + int ath11k_pcic_start(struct ath11k_base *ab) + { +- struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); +- +- set_bit(ATH11K_PCI_FLAG_INIT_DONE, &ab_pci->flags); +- +- /* TODO: for now don't restore ASPM in case of single MSI +- * vector as MHI register reading in M2 causes system hang. +- */ +- if (test_bit(ATH11K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) +- ath11k_pcic_aspm_restore(ab_pci); +- else +- ath11k_info(ab, "leaving PCI ASPM disabled to avoid MHI M2 problems\n"); ++ set_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); + + ath11k_pcic_ce_irqs_enable(ab); + ath11k_ce_rx_post_buf(ab); +--- a/drivers/net/wireless/ath/ath11k/pcic.h ++++ b/drivers/net/wireless/ath/ath11k/pcic.h +@@ -8,7 +8,6 @@ + #define _ATH11K_PCI_CMN_H + + #include "core.h" +-#include "pci.h" + + #define ATH11K_PCI_IRQ_CE0_OFFSET 3 + #define ATH11K_PCI_IRQ_DP_OFFSET 14 +@@ -28,7 +27,6 @@ + int ath11k_pcic_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, + int *num_vectors, u32 *user_base_data, + u32 *base_vector); +-int ath11k_pcic_get_msi_irq(struct device *dev, unsigned int vector); + void ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value); + u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset); + void ath11k_pcic_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, +@@ -44,8 +42,5 @@ int ath11k_pcic_map_service_to_pipe(stru + u8 *ul_pipe, u8 *dl_pipe); + void ath11k_pcic_ce_irqs_enable(struct ath11k_base *ab); + void ath11k_pcic_ce_irq_disable_sync(struct ath11k_base *ab); +-void ath11k_pcic_aspm_restore(struct ath11k_pci *ab_pci); +-int ath11k_pcic_set_irq_affinity_hint(struct ath11k_pci *ab_pci, +- const struct cpumask *m); + int ath11k_pcic_init_msi_config(struct ath11k_base *ab); + #endif diff --git a/package/kernel/mac80211/patches/ath11k/0220-ath11k-Change-max-no-of-active-probe-SSID-and-BSSID-.patch b/package/kernel/mac80211/patches/ath11k/0220-ath11k-Change-max-no-of-active-probe-SSID-and-BSSID-.patch new file mode 100644 index 000000000..98259dbb1 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0220-ath11k-Change-max-no-of-active-probe-SSID-and-BSSID-.patch @@ -0,0 +1,70 @@ +From 50dc9ce9f80554a88e33b73c30851acf2be36ed3 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Kathirvel +Date: Fri, 1 Apr 2022 14:53:09 +0300 +Subject: [PATCH] ath11k: Change max no of active probe SSID and BSSID to fw + capability + +The maximum number of SSIDs in a for active probe requests is currently +reported as 16 (WLAN_SCAN_PARAMS_MAX_SSID) when registering the driver. +The scan_req_params structure only has the capacity to hold 10 SSIDs. +This leads to a buffer overflow which can be triggered from +wpa_supplicant in userspace. When copying the SSIDs into the +scan_req_params structure in the ath11k_mac_op_hw_scan route, it can +overwrite the extraie pointer. + +Firmware supports 16 ssid * 4 bssid, for each ssid 4 bssid combo probe +request will be sent, so totally 64 probe requests supported. So +set both max ssid and bssid to 16 and 4 respectively. Remove the +redundant macros of ssid and bssid. + +Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01300-QCAHKSWPL_SILICONZ-1 + +Signed-off-by: Karthikeyan Kathirvel +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220329150221.21907-1-quic_kathirve@quicinc.com +--- + drivers/net/wireless/ath/ath11k/wmi.h | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/wmi.h ++++ b/drivers/net/wireless/ath/ath11k/wmi.h +@@ -3089,9 +3089,6 @@ enum scan_dwelltime_adaptive_mode { + SCAN_DWELL_MODE_STATIC = 4 + }; + +-#define WLAN_SCAN_MAX_NUM_SSID 10 +-#define WLAN_SCAN_MAX_NUM_BSSID 10 +- + #define WLAN_SSID_MAX_LEN 32 + + struct element_info { +@@ -3106,7 +3103,6 @@ struct wlan_ssid { + + #define WMI_IE_BITMAP_SIZE 8 + +-#define WMI_SCAN_MAX_NUM_SSID 0x0A + /* prefix used by scan requestor ids on the host */ + #define WMI_HOST_SCAN_REQUESTOR_ID_PREFIX 0xA000 + +@@ -3114,10 +3110,6 @@ struct wlan_ssid { + /* host cycles through the lower 12 bits to generate ids */ + #define WMI_HOST_SCAN_REQ_ID_PREFIX 0xA000 + +-#define WLAN_SCAN_PARAMS_MAX_SSID 16 +-#define WLAN_SCAN_PARAMS_MAX_BSSID 4 +-#define WLAN_SCAN_PARAMS_MAX_IE_LEN 256 +- + /* Values lower than this may be refused by some firmware revisions with a scan + * completion with a timedout reason. + */ +@@ -3313,8 +3305,8 @@ struct scan_req_params { + u32 n_probes; + u32 *chan_list; + u32 notify_scan_events; +- struct wlan_ssid ssid[WLAN_SCAN_MAX_NUM_SSID]; +- struct wmi_mac_addr bssid_list[WLAN_SCAN_MAX_NUM_BSSID]; ++ struct wlan_ssid ssid[WLAN_SCAN_PARAMS_MAX_SSID]; ++ struct wmi_mac_addr bssid_list[WLAN_SCAN_PARAMS_MAX_BSSID]; + struct element_info extraie; + struct element_info htcap; + struct element_info vhtcap; diff --git a/package/kernel/mac80211/patches/ath11k/0221-ath11k-Remove-unnecessary-delay-in-ath11k_core_suspe.patch b/package/kernel/mac80211/patches/ath11k/0221-ath11k-Remove-unnecessary-delay-in-ath11k_core_suspe.patch new file mode 100644 index 000000000..34d1a4875 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0221-ath11k-Remove-unnecessary-delay-in-ath11k_core_suspe.patch @@ -0,0 +1,36 @@ +From 2dd398dee7aa5ec6b296d9915bbb1c1a76199b4a Mon Sep 17 00:00:00 2001 +From: Baochen Qiang +Date: Fri, 1 Apr 2022 14:53:10 +0300 +Subject: [PATCH] ath11k: Remove unnecessary delay in ath11k_core_suspend + +The intended delay in ath11k_core_suspend is introduced in commit +d1b0c33850d2 ("ath11k: implement suspend for QCA6390 PCI devices"), +now with ath11k_mac_wait_tx_complete added in commit ba9177fcef21 +("ath11k: Add basic WoW functionalities"), that delay is not +necessary now, so remove it. + +This is found in code review. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-02431-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 + +Signed-off-by: Baochen Qiang +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220331002105.1162099-1-quic_bqiang@quicinc.com +--- + drivers/net/wireless/ath/ath11k/core.c | 5 ----- + 1 file changed, 5 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -453,11 +453,6 @@ int ath11k_core_suspend(struct ath11k_ba + if (!ar || ar->state != ATH11K_STATE_OFF) + return 0; + +- /* TODO: there can frames in queues so for now add delay as a hack. +- * Need to implement to handle and remove this delay. +- */ +- msleep(500); +- + ret = ath11k_dp_rx_pktlog_stop(ab, true); + if (ret) { + ath11k_warn(ab, "failed to stop dp rx (and timer) pktlog during suspend: %d\n", diff --git a/package/kernel/mac80211/patches/ath11k/0222-ath11k-fix-driver-initialization-failure-with-WoW-un.patch b/package/kernel/mac80211/patches/ath11k/0222-ath11k-fix-driver-initialization-failure-with-WoW-un.patch new file mode 100644 index 000000000..374d3d70b --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0222-ath11k-fix-driver-initialization-failure-with-WoW-un.patch @@ -0,0 +1,72 @@ +From 633469e3bac10650ecff421ba6b9603d67da884b Mon Sep 17 00:00:00 2001 +From: Nagarajan Maran +Date: Fri, 1 Apr 2022 14:53:10 +0300 +Subject: [PATCH] ath11k: fix driver initialization failure with WoW + unsupported hw + +In the "ath11k_wow_init", error value "EINVAL" is returned +when the check for firmware support of WoW feature fails, +which in turn stops the driver initialization. + +Warning message: +[ 31.040144] ------------[ cut here ]------------ +[ 31.040185] WARNING: CPU: 1 PID: 51 at drivers/net/wireless/ath/ath11k/wow.c:813 ath11k_wow_init+0xc8/0x13a8 [ath11k] +[ 31.043846] Modules linked in: ath11k_pci ath11k qmi_helpers +[ 31.054341] CPU: 1 PID: 51 Comm: kworker/u8:1 Tainted: G W 5.17.0-wt-ath-594817-ga7f6aa925cf8-dirty #17 +[ 31.060078] Hardware name: Qualcomm Technologies, Inc. IPQ8074/AP-HK10-C2 (DT) +[ 31.070578] Workqueue: ath11k_qmi_driver_event ath11k_qmi_driver_event_work [ath11k] +[ 31.077782] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) +[ 31.085676] pc : ath11k_wow_init+0xc8/0x13a8 [ath11k] +[ 31.092359] lr : ath11k_mac_register+0x548/0xb98 [ath11k] +[ 31.097567] sp : ffff80000aa13c40 +[ 31.102944] x29: ffff80000aa13c40 x28: ffff800009184390 x27: ffff000002959f20 +[ 31.106251] x26: ffff000002828000 x25: ffff000002830000 x24: ffff000002830000 +[ 31.113369] x23: ffff000002820000 x22: ffff00000282854c x21: 0000000000000000 +[ 31.120487] x20: ffff00000295cf20 x19: ffff000002828540 x18: 0000000000000031 +[ 31.127605] x17: 0000000000000004 x16: ffff0000028285fc x15: ffff00000295b040 +[ 31.134723] x14: 0000000000000067 x13: ffff00000282859c x12: 000000000000000d +[ 31.141840] x11: 0000000000000018 x10: 0000000000000004 x9 : 0000000000000000 +[ 31.148959] x8 : ffff00000289d680 x7 : 0000000000000000 x6 : 000000000000003f +[ 31.156077] x5 : 0000000000000040 x4 : 0000000000000000 x3 : ffff000002820968 +[ 31.163196] x2 : 0000000000000080 x1 : 0080008af9981779 x0 : ffff000002959f20 +[ 31.170314] Call trace: +[ 31.177421] ath11k_wow_init+0xc8/0x13a8 [ath11k] +[ 31.179684] ath11k_core_qmi_firmware_ready+0x430/0x5e0 [ath11k] +[ 31.184548] ath11k_qmi_driver_event_work+0x16c/0x4f8 [ath11k] +[ 31.190623] process_one_work+0x134/0x350 +[ 31.196262] worker_thread+0x12c/0x450 +[ 31.200340] kthread+0xf4/0x110 +[ 31.203986] ret_from_fork+0x10/0x20 +[ 31.207026] ---[ end trace 0000000000000000 ]--- +[ 31.210894] ath11k_pci 0000:01:00.0: failed to init wow: -22 +[ 31.215467] ath11k_pci 0000:01:00.0: failed register the radio with mac80211: -22 +[ 31.221117] ath11k_pci 0000:01:00.0: failed to create pdev core: -22 + +Fix this by returning value "0" when FW doesn't support WoW +to allow driver to proceed with initialize sequence and also +remove the unnecessary "WARN_ON". + + +Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 + +Fixes: ba9177fcef21 ("ath11k: Add basic WoW functionalities") +Signed-off-by: Nagarajan Maran +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220331073110.3846-1-quic_nmaran@quicinc.com +--- + drivers/net/wireless/ath/ath11k/wow.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/wow.c ++++ b/drivers/net/wireless/ath/ath11k/wow.c +@@ -810,8 +810,8 @@ exit: + + int ath11k_wow_init(struct ath11k *ar) + { +- if (WARN_ON(!test_bit(WMI_TLV_SERVICE_WOW, ar->wmi->wmi_ab->svc_map))) +- return -EINVAL; ++ if (!test_bit(WMI_TLV_SERVICE_WOW, ar->wmi->wmi_ab->svc_map)) ++ return 0; + + ar->wow.wowlan_support = ath11k_wowlan_support; + diff --git a/package/kernel/mac80211/patches/ath11k/0223-ath11k-mhi-remove-state-machine.patch b/package/kernel/mac80211/patches/ath11k/0223-ath11k-mhi-remove-state-machine.patch new file mode 100644 index 000000000..0ddec2ffe --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0223-ath11k-mhi-remove-state-machine.patch @@ -0,0 +1,278 @@ +From 121210ec935c47b076709974d95360f5e9c9b869 Mon Sep 17 00:00:00 2001 +From: Kalle Valo +Date: Fri, 1 Apr 2022 20:30:40 +0300 +Subject: [PATCH] ath11k: mhi: remove state machine + +State machines are difficult to understand and in this case it's just useless, +which is shown by the diffstat. So remove it entirely to make the code simpler. + +No functional changes. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2 + +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220401173042.17467-2-kvalo@kernel.org +--- + drivers/net/wireless/ath/ath11k/mhi.c | 194 ++------------------------ + drivers/net/wireless/ath/ath11k/mhi.h | 13 -- + drivers/net/wireless/ath/ath11k/pci.h | 2 +- + 3 files changed, 11 insertions(+), 198 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mhi.c ++++ b/drivers/net/wireless/ath/ath11k/mhi.c +@@ -465,195 +465,17 @@ void ath11k_mhi_unregister(struct ath11k + mhi_free_controller(mhi_ctrl); + } + +-static char *ath11k_mhi_state_to_str(enum ath11k_mhi_state mhi_state) +-{ +- switch (mhi_state) { +- case ATH11K_MHI_INIT: +- return "INIT"; +- case ATH11K_MHI_DEINIT: +- return "DEINIT"; +- case ATH11K_MHI_POWER_ON: +- return "POWER_ON"; +- case ATH11K_MHI_POWER_OFF: +- return "POWER_OFF"; +- case ATH11K_MHI_FORCE_POWER_OFF: +- return "FORCE_POWER_OFF"; +- case ATH11K_MHI_SUSPEND: +- return "SUSPEND"; +- case ATH11K_MHI_RESUME: +- return "RESUME"; +- case ATH11K_MHI_TRIGGER_RDDM: +- return "TRIGGER_RDDM"; +- case ATH11K_MHI_RDDM_DONE: +- return "RDDM_DONE"; +- default: +- return "UNKNOWN"; +- } +-}; +- +-static void ath11k_mhi_set_state_bit(struct ath11k_pci *ab_pci, +- enum ath11k_mhi_state mhi_state) +-{ +- struct ath11k_base *ab = ab_pci->ab; +- +- switch (mhi_state) { +- case ATH11K_MHI_INIT: +- set_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state); +- break; +- case ATH11K_MHI_DEINIT: +- clear_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state); +- break; +- case ATH11K_MHI_POWER_ON: +- set_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state); +- break; +- case ATH11K_MHI_POWER_OFF: +- case ATH11K_MHI_FORCE_POWER_OFF: +- clear_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state); +- clear_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state); +- clear_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state); +- break; +- case ATH11K_MHI_SUSPEND: +- set_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state); +- break; +- case ATH11K_MHI_RESUME: +- clear_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state); +- break; +- case ATH11K_MHI_TRIGGER_RDDM: +- set_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state); +- break; +- case ATH11K_MHI_RDDM_DONE: +- set_bit(ATH11K_MHI_RDDM_DONE, &ab_pci->mhi_state); +- break; +- default: +- ath11k_err(ab, "unhandled mhi state (%d)\n", mhi_state); +- } +-} +- +-static int ath11k_mhi_check_state_bit(struct ath11k_pci *ab_pci, +- enum ath11k_mhi_state mhi_state) +-{ +- struct ath11k_base *ab = ab_pci->ab; +- +- switch (mhi_state) { +- case ATH11K_MHI_INIT: +- if (!test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state)) +- return 0; +- break; +- case ATH11K_MHI_DEINIT: +- case ATH11K_MHI_POWER_ON: +- if (test_bit(ATH11K_MHI_INIT, &ab_pci->mhi_state) && +- !test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state)) +- return 0; +- break; +- case ATH11K_MHI_FORCE_POWER_OFF: +- if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state)) +- return 0; +- break; +- case ATH11K_MHI_POWER_OFF: +- case ATH11K_MHI_SUSPEND: +- if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state) && +- !test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state)) +- return 0; +- break; +- case ATH11K_MHI_RESUME: +- if (test_bit(ATH11K_MHI_SUSPEND, &ab_pci->mhi_state)) +- return 0; +- break; +- case ATH11K_MHI_TRIGGER_RDDM: +- if (test_bit(ATH11K_MHI_POWER_ON, &ab_pci->mhi_state) && +- !test_bit(ATH11K_MHI_TRIGGER_RDDM, &ab_pci->mhi_state)) +- return 0; +- break; +- case ATH11K_MHI_RDDM_DONE: +- return 0; +- default: +- ath11k_err(ab, "unhandled mhi state: %s(%d)\n", +- ath11k_mhi_state_to_str(mhi_state), mhi_state); +- } +- +- ath11k_err(ab, "failed to set mhi state %s(%d) in current mhi state (0x%lx)\n", +- ath11k_mhi_state_to_str(mhi_state), mhi_state, +- ab_pci->mhi_state); +- +- return -EINVAL; +-} +- +-static int ath11k_mhi_set_state(struct ath11k_pci *ab_pci, +- enum ath11k_mhi_state mhi_state) +-{ +- struct ath11k_base *ab = ab_pci->ab; +- int ret; +- +- ret = ath11k_mhi_check_state_bit(ab_pci, mhi_state); +- if (ret) +- goto out; +- +- ath11k_dbg(ab, ATH11K_DBG_PCI, "setting mhi state: %s(%d)\n", +- ath11k_mhi_state_to_str(mhi_state), mhi_state); +- +- switch (mhi_state) { +- case ATH11K_MHI_INIT: +- ret = mhi_prepare_for_power_up(ab_pci->mhi_ctrl); +- break; +- case ATH11K_MHI_DEINIT: +- mhi_unprepare_after_power_down(ab_pci->mhi_ctrl); +- ret = 0; +- break; +- case ATH11K_MHI_POWER_ON: +- ret = mhi_sync_power_up(ab_pci->mhi_ctrl); +- break; +- case ATH11K_MHI_POWER_OFF: +- mhi_power_down(ab_pci->mhi_ctrl, true); +- ret = 0; +- break; +- case ATH11K_MHI_FORCE_POWER_OFF: +- mhi_power_down(ab_pci->mhi_ctrl, false); +- ret = 0; +- break; +- case ATH11K_MHI_SUSPEND: +- ret = mhi_pm_suspend(ab_pci->mhi_ctrl); +- break; +- case ATH11K_MHI_RESUME: +- /* Do force MHI resume as some devices like QCA6390, WCN6855 +- * are not in M3 state but they are functional. So just ignore +- * the MHI state while resuming. +- */ +- ret = mhi_pm_resume_force(ab_pci->mhi_ctrl); +- break; +- case ATH11K_MHI_TRIGGER_RDDM: +- ret = mhi_force_rddm_mode(ab_pci->mhi_ctrl); +- break; +- case ATH11K_MHI_RDDM_DONE: +- break; +- default: +- ath11k_err(ab, "unhandled MHI state (%d)\n", mhi_state); +- ret = -EINVAL; +- } +- +- if (ret) +- goto out; +- +- ath11k_mhi_set_state_bit(ab_pci, mhi_state); +- +- return 0; +- +-out: +- ath11k_err(ab, "failed to set mhi state: %s(%d)\n", +- ath11k_mhi_state_to_str(mhi_state), mhi_state); +- return ret; +-} +- + int ath11k_mhi_start(struct ath11k_pci *ab_pci) + { + int ret; + + ab_pci->mhi_ctrl->timeout_ms = MHI_TIMEOUT_DEFAULT_MS; + +- ret = ath11k_mhi_set_state(ab_pci, ATH11K_MHI_INIT); ++ ret = mhi_prepare_for_power_up(ab_pci->mhi_ctrl); + if (ret) + goto out; + +- ret = ath11k_mhi_set_state(ab_pci, ATH11K_MHI_POWER_ON); ++ ret = mhi_sync_power_up(ab_pci->mhi_ctrl); + if (ret) + goto out; + +@@ -665,16 +487,20 @@ out: + + void ath11k_mhi_stop(struct ath11k_pci *ab_pci) + { +- ath11k_mhi_set_state(ab_pci, ATH11K_MHI_POWER_OFF); +- ath11k_mhi_set_state(ab_pci, ATH11K_MHI_DEINIT); ++ mhi_power_down(ab_pci->mhi_ctrl, true); ++ mhi_unprepare_after_power_down(ab_pci->mhi_ctrl); + } + + void ath11k_mhi_suspend(struct ath11k_pci *ab_pci) + { +- ath11k_mhi_set_state(ab_pci, ATH11K_MHI_SUSPEND); ++ mhi_pm_suspend(ab_pci->mhi_ctrl); + } + + void ath11k_mhi_resume(struct ath11k_pci *ab_pci) + { +- ath11k_mhi_set_state(ab_pci, ATH11K_MHI_RESUME); ++ /* Do force MHI resume as some devices like QCA6390, WCN6855 ++ * are not in M3 state but they are functional. So just ignore ++ * the MHI state while resuming. ++ */ ++ mhi_pm_resume_force(ab_pci->mhi_ctrl); + } +--- a/drivers/net/wireless/ath/ath11k/mhi.h ++++ b/drivers/net/wireless/ath/ath11k/mhi.h +@@ -16,19 +16,6 @@ + #define MHICTRL 0x38 + #define MHICTRL_RESET_MASK 0x2 + +-enum ath11k_mhi_state { +- ATH11K_MHI_INIT, +- ATH11K_MHI_DEINIT, +- ATH11K_MHI_POWER_ON, +- ATH11K_MHI_POWER_OFF, +- ATH11K_MHI_FORCE_POWER_OFF, +- ATH11K_MHI_SUSPEND, +- ATH11K_MHI_RESUME, +- ATH11K_MHI_TRIGGER_RDDM, +- ATH11K_MHI_RDDM, +- ATH11K_MHI_RDDM_DONE, +-}; +- + int ath11k_mhi_start(struct ath11k_pci *ar_pci); + void ath11k_mhi_stop(struct ath11k_pci *ar_pci); + int ath11k_mhi_register(struct ath11k_pci *ar_pci); +--- a/drivers/net/wireless/ath/ath11k/pci.h ++++ b/drivers/net/wireless/ath/ath11k/pci.h +@@ -63,7 +63,7 @@ struct ath11k_pci { + u16 dev_id; + char amss_path[100]; + struct mhi_controller *mhi_ctrl; +- unsigned long mhi_state; ++ const struct ath11k_msi_config *msi_config; + u32 register_window; + + /* protects register_window above */ diff --git a/package/kernel/mac80211/patches/ath11k/0224-ath11k-mhi-add-error-handling-for-suspend-and-resume.patch b/package/kernel/mac80211/patches/ath11k/0224-ath11k-mhi-add-error-handling-for-suspend-and-resume.patch new file mode 100644 index 000000000..ae60753ba --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0224-ath11k-mhi-add-error-handling-for-suspend-and-resume.patch @@ -0,0 +1,95 @@ +From 3e80fcbca37221cd1e5a33eea4b0f215f66a7a00 Mon Sep 17 00:00:00 2001 +From: Kalle Valo +Date: Tue, 5 Apr 2022 11:26:39 +0300 +Subject: [PATCH] ath11k: mhi: add error handling for suspend and resume + +While reviewing the mhi.c I noticed we were just ignoring the errors coming +from MHI subsystem during suspend and resume. Add proper checks and warning +messages. Also pass the error value to callers. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2 + +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220401173042.17467-3-kvalo@kernel.org +--- + drivers/net/wireless/ath/ath11k/mhi.c | 26 ++++++++++++++++++++++---- + drivers/net/wireless/ath/ath11k/mhi.h | 4 ++-- + drivers/net/wireless/ath/ath11k/pci.c | 8 ++------ + 3 files changed, 26 insertions(+), 12 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mhi.c ++++ b/drivers/net/wireless/ath/ath11k/mhi.c +@@ -491,16 +491,34 @@ void ath11k_mhi_stop(struct ath11k_pci * + mhi_unprepare_after_power_down(ab_pci->mhi_ctrl); + } + +-void ath11k_mhi_suspend(struct ath11k_pci *ab_pci) ++int ath11k_mhi_suspend(struct ath11k_pci *ab_pci) + { +- mhi_pm_suspend(ab_pci->mhi_ctrl); ++ struct ath11k_base *ab = ab_pci->ab; ++ int ret; ++ ++ ret = mhi_pm_suspend(ab_pci->mhi_ctrl); ++ if (ret) { ++ ath11k_warn(ab, "failed to suspend mhi: %d", ret); ++ return ret; ++ } ++ ++ return 0; + } + +-void ath11k_mhi_resume(struct ath11k_pci *ab_pci) ++int ath11k_mhi_resume(struct ath11k_pci *ab_pci) + { ++ struct ath11k_base *ab = ab_pci->ab; ++ int ret; ++ + /* Do force MHI resume as some devices like QCA6390, WCN6855 + * are not in M3 state but they are functional. So just ignore + * the MHI state while resuming. + */ +- mhi_pm_resume_force(ab_pci->mhi_ctrl); ++ ret = mhi_pm_resume_force(ab_pci->mhi_ctrl); ++ if (ret) { ++ ath11k_warn(ab, "failed to resume mhi: %d", ret); ++ return ret; ++ } ++ ++ return 0; + } +--- a/drivers/net/wireless/ath/ath11k/mhi.h ++++ b/drivers/net/wireless/ath/ath11k/mhi.h +@@ -23,7 +23,7 @@ void ath11k_mhi_unregister(struct ath11k + void ath11k_mhi_set_mhictrl_reset(struct ath11k_base *ab); + void ath11k_mhi_clear_vector(struct ath11k_base *ab); + +-void ath11k_mhi_suspend(struct ath11k_pci *ar_pci); +-void ath11k_mhi_resume(struct ath11k_pci *ar_pci); ++int ath11k_mhi_suspend(struct ath11k_pci *ar_pci); ++int ath11k_mhi_resume(struct ath11k_pci *ar_pci); + + #endif +--- a/drivers/net/wireless/ath/ath11k/pci.c ++++ b/drivers/net/wireless/ath/ath11k/pci.c +@@ -619,18 +619,14 @@ static int ath11k_pci_hif_suspend(struct + { + struct ath11k_pci *ar_pci = ath11k_pci_priv(ab); + +- ath11k_mhi_suspend(ar_pci); +- +- return 0; ++ return ath11k_mhi_suspend(ar_pci); + } + + static int ath11k_pci_hif_resume(struct ath11k_base *ab) + { + struct ath11k_pci *ar_pci = ath11k_pci_priv(ab); + +- ath11k_mhi_resume(ar_pci); +- +- return 0; ++ return ath11k_mhi_resume(ar_pci); + } + + static void ath11k_pci_hif_ce_irq_enable(struct ath11k_base *ab) diff --git a/package/kernel/mac80211/patches/ath11k/0225-ath11k-mhi-remove-unnecessary-goto-from-ath11k_mhi_s.patch b/package/kernel/mac80211/patches/ath11k/0225-ath11k-mhi-remove-unnecessary-goto-from-ath11k_mhi_s.patch new file mode 100644 index 000000000..362a0fc53 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0225-ath11k-mhi-remove-unnecessary-goto-from-ath11k_mhi_s.patch @@ -0,0 +1,52 @@ +From b9e34ba6b314780a47ac40f450ec04f18be85b5e Mon Sep 17 00:00:00 2001 +From: Kalle Valo +Date: Tue, 5 Apr 2022 11:26:44 +0300 +Subject: [PATCH] ath11k: mhi: remove unnecessary goto from ath11k_mhi_start() + +No need to have goto for a return statement, so simplify the code. While at it, +print warning messages if power up calls fail. + +No functional changes. + +Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2 + +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220401173042.17467-4-kvalo@kernel.org +--- + drivers/net/wireless/ath/ath11k/mhi.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/mhi.c ++++ b/drivers/net/wireless/ath/ath11k/mhi.c +@@ -467,22 +467,24 @@ void ath11k_mhi_unregister(struct ath11k + + int ath11k_mhi_start(struct ath11k_pci *ab_pci) + { ++ struct ath11k_base *ab = ab_pci->ab; + int ret; + + ab_pci->mhi_ctrl->timeout_ms = MHI_TIMEOUT_DEFAULT_MS; + + ret = mhi_prepare_for_power_up(ab_pci->mhi_ctrl); +- if (ret) +- goto out; ++ if (ret) { ++ ath11k_warn(ab, "failed to prepare mhi: %d", ret); ++ return ret; ++ } + + ret = mhi_sync_power_up(ab_pci->mhi_ctrl); +- if (ret) +- goto out; ++ if (ret) { ++ ath11k_warn(ab, "failed to power up mhi: %d", ret); ++ return ret; ++ } + + return 0; +- +-out: +- return ret; + } + + void ath11k_mhi_stop(struct ath11k_pci *ab_pci) diff --git a/package/kernel/mac80211/patches/ath11k/0226-ath11k-Fix-spelling-mistake-reseting-resetting.patch b/package/kernel/mac80211/patches/ath11k/0226-ath11k-Fix-spelling-mistake-reseting-resetting.patch new file mode 100644 index 000000000..057cc9e68 --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0226-ath11k-Fix-spelling-mistake-reseting-resetting.patch @@ -0,0 +1,25 @@ +From 405342ebea2ab776df070ee54c308f1f59723844 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Thu, 7 Apr 2022 11:28:20 +0100 +Subject: [PATCH] ath11k: Fix spelling mistake "reseting" -> "resetting" + +There is a spelling mistake in an ath11k_warn message. Fix it. + +Signed-off-by: Colin Ian King +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220407102820.613881-1-colin.i.king@gmail.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 +@@ -1567,7 +1567,7 @@ static void ath11k_core_reset(struct wor + * completed, then the second reset worker will destroy the previous one, + * thus below is to avoid that. + */ +- ath11k_warn(ab, "already reseting count %d\n", reset_count); ++ ath11k_warn(ab, "already resetting count %d\n", reset_count); + + reinit_completion(&ab->reset_complete); + time_left = wait_for_completion_timeout(&ab->reset_complete, diff --git a/package/kernel/mac80211/patches/ath11k/100-ath11k-load-appropriate-board-data-from-board-id.patch b/package/kernel/mac80211/patches/ath11k/100-ath11k-load-appropriate-board-data-from-board-id.patch index 022607e59..01f67ca97 100644 --- a/package/kernel/mac80211/patches/ath11k/100-ath11k-load-appropriate-board-data-from-board-id.patch +++ b/package/kernel/mac80211/patches/ath11k/100-ath11k-load-appropriate-board-data-from-board-id.patch @@ -17,7 +17,7 @@ Signed-off-by: Lavanya Suresh --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -2003,9 +2003,11 @@ static int ath11k_qmi_assign_target_mem_ +@@ -2009,9 +2009,11 @@ static int ath11k_qmi_assign_target_mem_ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab) { @@ -28,8 +28,8 @@ Signed-off-by: Lavanya Suresh + unsigned int board_id; int ret = 0; int r; - -@@ -2048,10 +2050,13 @@ static int ath11k_qmi_request_target_cap + char *fw_build_id; +@@ -2056,10 +2058,13 @@ static int ath11k_qmi_request_target_cap ab->qmi.target.chip_family = resp.chip_info.chip_family; } diff --git a/package/kernel/mac80211/patches/ath11k/101-ath11k-update-debugfs-support-for-mupltiple-radios-i.patch b/package/kernel/mac80211/patches/ath11k/101-ath11k-update-debugfs-support-for-mupltiple-radios-i.patch index 89f36f39a..83c597ca7 100644 --- a/package/kernel/mac80211/patches/ath11k/101-ath11k-update-debugfs-support-for-mupltiple-radios-i.patch +++ b/package/kernel/mac80211/patches/ath11k/101-ath11k-update-debugfs-support-for-mupltiple-radios-i.patch @@ -1,8 +1,7 @@ -From 62c6c38a1e55a4f0c659dbb16cfa8196c3ac8467 Mon Sep 17 00:00:00 2001 +From a1e16842a097171cc544b45e343effe97eadb493 Mon Sep 17 00:00:00 2001 From: Anilkumar Kolli -Date: Tue, 14 Dec 2021 17:07:29 +0200 -Subject: [PATCH] ath11k: update debugfs support for mupltiple radios in PCI - bus +Date: Wed, 30 Mar 2022 11:28:03 +0300 +Subject: ath11k: update debugfs support for mupltiple radios in PCI bus debugfs_ath11k struct is moved to ath11k_core, since its common for both pci and ahb. @@ -38,45 +37,14 @@ Signed-off-by: Anilkumar Kolli Patchwork-Id: 12101611 Signed-off-by: Kalle Valo --- - drivers/net/wireless/ath/ath11k/core.c | 12 +++++ - drivers/net/wireless/ath/ath11k/core.h | 1 - - drivers/net/wireless/ath/ath11k/debugfs.c | 57 +++++++++++++++++++---- - drivers/net/wireless/ath/ath11k/debugfs.h | 11 +++++ - 4 files changed, 70 insertions(+), 11 deletions(-) + drivers/net/wireless/ath/ath11k/debugfs.c | 58 +++++++++++++++++++++++++------ + 1 file changed, 48 insertions(+), 10 deletions(-) + +(limited to 'drivers/net/wireless/ath/ath11k/debugfs.c') ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -1461,5 +1461,17 @@ err_sc_free: - } - EXPORT_SYMBOL(ath11k_core_alloc); - -+static int ath11k_init(void) -+{ -+ return ath11k_debugfs_create(); -+} -+module_init(ath11k_init); -+ -+static void ath11k_exit(void) -+{ -+ ath11k_debugfs_destroy(); -+} -+module_exit(ath11k_exit); -+ - MODULE_DESCRIPTION("Core module for Qualcomm Atheros 802.11ax wireless LAN cards."); - MODULE_LICENSE("Dual BSD/GPL"); ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -777,7 +777,6 @@ struct ath11k_base { - enum ath11k_dfs_region dfs_region; - #ifdef CPTCFG_ATH11K_DEBUGFS - struct dentry *debugfs_soc; -- struct dentry *debugfs_ath11k; - #endif - struct ath11k_soc_dp_stats soc_stats; - --- a/drivers/net/wireless/ath/ath11k/debugfs.c +++ b/drivers/net/wireless/ath/ath11k/debugfs.c -@@ -13,6 +13,8 @@ +@@ -15,6 +15,8 @@ #include "debugfs_htt_stats.h" #include "peer.h" @@ -85,7 +53,7 @@ Signed-off-by: Kalle Valo static const char *htt_bp_umac_ring[HTT_SW_UMAC_RING_IDX_MAX] = { "REO2SW1_RING", "REO2SW2_RING", -@@ -942,10 +944,6 @@ int ath11k_debugfs_pdev_create(struct at +@@ -987,10 +989,6 @@ int ath11k_debugfs_pdev_create(struct at if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) return 0; @@ -96,7 +64,7 @@ Signed-off-by: Kalle Valo debugfs_create_file("simulate_fw_crash", 0600, ab->debugfs_soc, ab, &fops_simulate_fw_crash); -@@ -957,24 +955,58 @@ int ath11k_debugfs_pdev_create(struct at +@@ -1002,24 +1000,58 @@ int ath11k_debugfs_pdev_create(struct at void ath11k_debugfs_pdev_destroy(struct ath11k_base *ab) { @@ -161,7 +129,7 @@ Signed-off-by: Kalle Valo void ath11k_debugfs_fw_stats_init(struct ath11k *ar) { struct dentry *fwstats_dir = debugfs_create_dir("fw_stats", -@@ -1180,6 +1212,9 @@ int ath11k_debugfs_register(struct ath11 +@@ -1388,6 +1420,9 @@ int ath11k_debugfs_register(struct ath11 char pdev_name[5]; char buf[100] = {0}; @@ -171,39 +139,13 @@ Signed-off-by: Kalle Valo snprintf(pdev_name, sizeof(pdev_name), "%s%d", "mac", ar->pdev_idx); ar->debug.debugfs_pdev = debugfs_create_dir(pdev_name, ab->debugfs_soc); -@@ -1221,6 +1256,8 @@ int ath11k_debugfs_register(struct ath11 - - void ath11k_debugfs_unregister(struct ath11k *ar) - { +@@ -1448,6 +1483,9 @@ void ath11k_debugfs_unregister(struct at + kfree(dbr_debug); + ar->debug.dbr_debug[i] = NULL; + } ++ + debugfs_remove_recursive(ar->debug.debugfs_pdev); + ar->debug.debugfs_pdev = NULL; } static ssize_t ath11k_write_twt_add_dialog(struct file *file, ---- a/drivers/net/wireless/ath/ath11k/debugfs.h -+++ b/drivers/net/wireless/ath/ath11k/debugfs.h -@@ -233,6 +233,8 @@ struct ath11k_fw_dbglog { - }; - - #ifdef CPTCFG_ATH11K_DEBUGFS -+int ath11k_debugfs_create(void); -+void ath11k_debugfs_destroy(void); - int ath11k_debugfs_soc_create(struct ath11k_base *ab); - void ath11k_debugfs_soc_destroy(struct ath11k_base *ab); - int ath11k_debugfs_pdev_create(struct ath11k_base *ab); -@@ -280,6 +282,15 @@ int ath11k_debugfs_add_interface(struct - void ath11k_debugfs_remove_interface(struct ath11k_vif *arvif); - - #else -+static inline int ath11k_debugfs_create(void) -+{ -+ return 0; -+} -+ -+static inline void ath11k_debugfs_destroy(void) -+{ -+} -+ - static inline int ath11k_debugfs_soc_create(struct ath11k_base *ab) - { - return 0; diff --git a/package/kernel/mac80211/patches/ath11k/102-ath11k-Enable-threaded-NAPI-on-some-radios.patch b/package/kernel/mac80211/patches/ath11k/102-ath11k-Enable-threaded-NAPI-on-some-radios.patch index 1a3819f77..c82f74e95 100644 --- a/package/kernel/mac80211/patches/ath11k/102-ath11k-Enable-threaded-NAPI-on-some-radios.patch +++ b/package/kernel/mac80211/patches/ath11k/102-ath11k-Enable-threaded-NAPI-on-some-radios.patch @@ -1,6 +1,6 @@ -From 65252b91331a9be068ebbd53f15ad6fd1113031b Mon Sep 17 00:00:00 2001 +From 9a7f302b187dd845611ef4ee35b305bd078e59d6 Mon Sep 17 00:00:00 2001 From: Manikanta Pubbisetty -Date: Sun, 13 Feb 2022 20:46:07 +0100 +Date: Fri, 15 Apr 2022 11:29:25 +0200 Subject: [PATCH] ath11k: Enable threaded NAPI on some radios Enable threaded NAPI on IPQ8074 and QCN9074. @@ -22,7 +22,7 @@ Signed-off-by: Robert Marko drivers/net/wireless/ath/ath11k/ahb.c | 2 ++ drivers/net/wireless/ath/ath11k/core.c | 6 ++++++ drivers/net/wireless/ath/ath11k/hw.h | 1 + - drivers/net/wireless/ath/ath11k/pci.c | 2 ++ + drivers/net/wireless/ath/ath11k/pcic.c | 2 ++ 4 files changed, 11 insertions(+) --- a/drivers/net/wireless/ath/ath11k/ahb.c @@ -38,67 +38,67 @@ Signed-off-by: Robert Marko } --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -99,6 +99,7 @@ static const struct ath11k_hw_params ath - .supports_rssi_stats = false, - .fw_wmi_diag_event = false, +@@ -101,6 +101,7 @@ static const struct ath11k_hw_params ath .current_cc_support = false, + .dbr_debug_support = true, + .global_reset = false, + .threaded_napi = true, }, { .hw_rev = ATH11K_HW_IPQ6018_HW10, -@@ -164,6 +165,7 @@ static const struct ath11k_hw_params ath - .supports_rssi_stats = false, - .fw_wmi_diag_event = false, +@@ -167,6 +168,7 @@ static const struct ath11k_hw_params ath .current_cc_support = false, + .dbr_debug_support = true, + .global_reset = false, + .threaded_napi = false, }, { .name = "qca6390 hw2.0", -@@ -228,6 +230,7 @@ static const struct ath11k_hw_params ath - .supports_rssi_stats = true, - .fw_wmi_diag_event = true, +@@ -232,6 +234,7 @@ static const struct ath11k_hw_params ath .current_cc_support = true, + .dbr_debug_support = false, + .global_reset = true, + .threaded_napi = false, }, { .name = "qcn9074 hw1.0", -@@ -292,6 +295,7 @@ static const struct ath11k_hw_params ath - .supports_rssi_stats = false, - .fw_wmi_diag_event = false, +@@ -297,6 +300,7 @@ static const struct ath11k_hw_params ath .current_cc_support = false, + .dbr_debug_support = true, + .global_reset = false, + .threaded_napi = true, }, { .name = "wcn6855 hw2.0", -@@ -356,6 +360,7 @@ static const struct ath11k_hw_params ath - .supports_rssi_stats = true, - .fw_wmi_diag_event = true, +@@ -362,6 +366,7 @@ static const struct ath11k_hw_params ath .current_cc_support = true, + .dbr_debug_support = false, + .global_reset = true, + .threaded_napi = false, }, { .name = "wcn6855 hw2.1", -@@ -419,6 +424,7 @@ static const struct ath11k_hw_params ath - .supports_rssi_stats = true, - .fw_wmi_diag_event = true, +@@ -426,6 +431,7 @@ static const struct ath11k_hw_params ath .current_cc_support = true, + .dbr_debug_support = false, + .global_reset = true, + .threaded_napi = false, }, }; --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -193,6 +193,7 @@ struct ath11k_hw_params { - bool supports_rssi_stats; - bool fw_wmi_diag_event; +@@ -195,6 +195,7 @@ struct ath11k_hw_params { bool current_cc_support; + bool dbr_debug_support; + bool global_reset; + bool threaded_napi; }; struct ath11k_hw_ops { ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -716,6 +716,8 @@ static void ath11k_pci_ext_irq_enable(st +--- a/drivers/net/wireless/ath/ath11k/pcic.c ++++ b/drivers/net/wireless/ath/ath11k/pcic.c +@@ -441,6 +441,8 @@ void ath11k_pcic_ext_irq_enable(struct a struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; if (!irq_grp->napi_enabled) { diff --git a/package/kernel/mac80211/patches/ath11k/351-mac80211-fix-mesh-airtime-link-metric-estimating.patch b/package/kernel/mac80211/patches/ath11k/351-mac80211-fix-mesh-airtime-link-metric-estimating.patch new file mode 100644 index 000000000..5b417bfbc --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/351-mac80211-fix-mesh-airtime-link-metric-estimating.patch @@ -0,0 +1,35 @@ +From fc9d9b3f367638505837a5815b1842bba2425993 Mon Sep 17 00:00:00 2001 +From: Aditya Kumar Singh +Date: Fri, 25 Mar 2022 11:04:37 +0530 +Subject: [PATCH] mac80211: fix mesh airtime link metric estimating + +ieee80211s_update_metric api uses sta_set_rate_info_tx api to +get struct rate_info data from struct ieee80211_tx_rate present +in ieee80211_sta->tx_stats. However, drivers can skip tx rate +calculation by setting rate idx as -1. Such drivers can provide +rate_info directly. + +Add fix to use rate_info directly if present instead of +sta_set_rate_info_tx. + +Signed-off-by: Aditya Kumar Singh +--- + net/mac80211/mesh_hwmp.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/net/mac80211/mesh_hwmp.c ++++ b/net/mac80211/mesh_hwmp.c +@@ -310,7 +310,12 @@ void ieee80211s_update_metric(struct iee + LINK_FAIL_THRESH) + mesh_plink_broken(sta); + +- sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo); ++ /* use rate info set by the driver directly if present */ ++ if (st->rate) ++ rinfo = sta->tx_stats.last_rate_info; ++ else ++ sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo); ++ + ewma_mesh_tx_rate_avg_add(&sta->mesh->tx_rate_avg, + cfg80211_calculate_bitrate(&rinfo)); + } diff --git a/package/kernel/mac80211/patches/ath11k/900-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch b/package/kernel/mac80211/patches/ath11k/900-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch index 06d1137ae..5b4d49655 100644 --- a/package/kernel/mac80211/patches/ath11k/900-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch +++ b/package/kernel/mac80211/patches/ath11k/900-ath11k-Disable-coldboot-calibration-for-IPQ8074.patch @@ -13,7 +13,7 @@ Signed-off-by: Robert Marko --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -82,7 +82,7 @@ static const struct ath11k_hw_params ath +@@ -83,7 +83,7 @@ static const struct ath11k_hw_params ath .supports_shadow_regs = false, .idle_ps = false, .supports_sta_ps = false, diff --git a/package/kernel/mac80211/patches/ath11k/901-ath11k-ipq8074-support-512MB-memory-profile.patch b/package/kernel/mac80211/patches/ath11k/901-ath11k-ipq8074-support-512MB-memory-profile.patch index 73b412415..589d5acce 100644 --- a/package/kernel/mac80211/patches/ath11k/901-ath11k-ipq8074-support-512MB-memory-profile.patch +++ b/package/kernel/mac80211/patches/ath11k/901-ath11k-ipq8074-support-512MB-memory-profile.patch @@ -16,7 +16,7 @@ Signed-off-by: Robert Marko 4 files changed, 176 insertions(+) --- a/drivers/net/wireless/ath/ath11k/Kconfig +++ b/drivers/net/wireless/ath/ath11k/Kconfig -@@ -60,3 +60,15 @@ config ATH11K_SPECTRAL +@@ -61,3 +61,15 @@ config ATH11K_SPECTRAL Enable ath11k spectral scan support Say Y to enable access to the FFT/spectral data via debugfs. @@ -34,7 +34,7 @@ Signed-off-by: Robert Marko + Use limits for the 1GB memory size. --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -83,9 +83,15 @@ static const struct ath11k_hw_params ath +@@ -84,9 +84,15 @@ static const struct ath11k_hw_params ath .idle_ps = false, .supports_sta_ps = false, .cold_boot_calib = false, @@ -52,7 +52,7 @@ Signed-off-by: Robert Marko .supports_regdb = false, --- a/local-symbols +++ b/local-symbols -@@ -148,6 +148,8 @@ ATH11K_DEBUG= +@@ -155,6 +155,8 @@ ATH11K_DEBUG= ATH11K_DEBUGFS= ATH11K_TRACING= ATH11K_SPECTRAL= diff --git a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch index cb6374feb..291bc6d1e 100644 --- a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch +++ b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch @@ -371,7 +371,7 @@ --- a/local-symbols +++ b/local-symbols -@@ -103,6 +103,7 @@ ATH9K_WOW= +@@ -110,6 +110,7 @@ ATH9K_WOW= ATH9K_RFKILL= ATH9K_CHANNEL_CONTEXT= ATH9K_PCOEM= diff --git a/package/kernel/mac80211/patches/brcm/001-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch b/package/kernel/mac80211/patches/brcm/001-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch new file mode 100644 index 000000000..03d9f8ecd --- /dev/null +++ b/package/kernel/mac80211/patches/brcm/001-brcmfmac-allow-setting-wlan-MAC-address-using-device.patch @@ -0,0 +1,103 @@ +From 716c220b4d990a4fe7800d0685ca69dee99e4e8f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pavel=20L=C3=B6bl?= +Date: Fri, 6 May 2022 06:42:46 +0200 +Subject: [PATCH] brcmfmac: allow setting wlan MAC address using device tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows firmware to provide MAC address using device tree. Like in +case there is no MAC burned in wlan NVRAM. + +Signed-off-by: Pavel Löbl +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20220506044246.67146-1-pavel@loebl.cz +--- + .../broadcom/brcm80211/brcmfmac/common.c | 23 ++++++++++++++----- + .../broadcom/brcm80211/brcmfmac/common.h | 1 + + .../broadcom/brcm80211/brcmfmac/core.c | 4 +++- + .../wireless/broadcom/brcm80211/brcmfmac/of.c | 3 +++ + 4 files changed, 24 insertions(+), 7 deletions(-) + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -202,13 +202,24 @@ int brcmf_c_preinit_dcmds(struct brcmf_i + char *ptr; + s32 err; + +- /* retreive mac address */ +- err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, +- sizeof(ifp->mac_addr)); +- if (err < 0) { +- bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err); +- goto done; ++ if (is_valid_ether_addr(ifp->mac_addr)) { ++ /* set mac address */ ++ err = brcmf_fil_iovar_data_set(ifp, "cur_etheraddr", ifp->mac_addr, ++ ETH_ALEN); ++ if (err < 0) { ++ bphy_err(ifp->drvr, "Setting cur_etheraddr failed, %d\n", err); ++ goto done; ++ } ++ } else { ++ /* retrieve mac address */ ++ err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, ++ sizeof(ifp->mac_addr)); ++ if (err < 0) { ++ bphy_err(drvr, "Retrieving cur_etheraddr failed, %d\n", err); ++ goto done; ++ } + } ++ + memcpy(ifp->drvr->mac, ifp->mac_addr, sizeof(ifp->drvr->mac)); + memcpy(ifp->drvr->wiphy->perm_addr, ifp->drvr->mac, ETH_ALEN); + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +@@ -50,6 +50,7 @@ struct brcmf_mp_device { + bool ignore_probe_fail; + struct brcmfmac_pd_cc *country_codes; + const char *board_type; ++ unsigned char mac[ETH_ALEN]; + union { + struct brcmfmac_sdio_pd sdio; + } bus; +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -1226,7 +1227,8 @@ static int brcmf_bus_started(struct brcm + brcmf_dbg(TRACE, "\n"); + + /* add primary networking interface */ +- ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", NULL); ++ ifp = brcmf_add_if(drvr, 0, 0, false, "wlan%d", ++ is_valid_ether_addr(drvr->settings->mac) ? drvr->settings->mac : NULL); + if (IS_ERR(ifp)) + return PTR_ERR(ifp); + +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + + #include + #include "debug.h" +@@ -97,6 +98,8 @@ void brcmf_of_probe(struct device *dev, + if (err) + brcmf_err("failed to get OF country code map (err=%d)\n", err); + ++ of_get_mac_address(np, settings->mac); ++ + if (bus_type != BRCMF_BUSTYPE_SDIO) + return; + diff --git a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch index aa890ce0f..7b9512f74 100644 --- a/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch +++ b/package/kernel/mac80211/patches/brcm/860-brcmfmac-register-wiphy-s-during-module_init.patch @@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c -@@ -429,6 +429,7 @@ struct brcmf_fw { +@@ -431,6 +431,7 @@ struct brcmf_fw { struct brcmf_fw_request *req; u32 curpos; void (*done)(struct device *dev, int err, struct brcmf_fw_request *req); @@ -21,7 +21,7 @@ Signed-off-by: Rafał Miłecki }; #ifdef CONFIG_EFI -@@ -653,6 +654,8 @@ static void brcmf_fw_request_done(const +@@ -655,6 +656,8 @@ static void brcmf_fw_request_done(const fwctx->req = NULL; } fwctx->done(fwctx->dev, ret, fwctx->req); @@ -30,16 +30,16 @@ Signed-off-by: Rafał Miłecki kfree(fwctx); } -@@ -693,6 +696,8 @@ int brcmf_fw_get_firmwares(struct device +@@ -695,6 +698,8 @@ int brcmf_fw_get_firmwares(struct device { struct brcmf_fw_item *first = &req->items[0]; struct brcmf_fw *fwctx; + struct completion completion; + unsigned long time_left; - char *alt_path; + char *alt_path = NULL; int ret; -@@ -710,6 +715,9 @@ int brcmf_fw_get_firmwares(struct device +@@ -712,6 +717,9 @@ int brcmf_fw_get_firmwares(struct device fwctx->dev = dev; fwctx->req = req; fwctx->done = fw_cb; @@ -48,8 +48,8 @@ Signed-off-by: Rafał Miłecki + fwctx->completion = &completion; /* First try alternative board-specific path if any */ - alt_path = brcm_alt_fw_path(first->path, fwctx->req->board_type); -@@ -726,6 +734,12 @@ int brcmf_fw_get_firmwares(struct device + if (fwctx->req->board_type) +@@ -730,6 +738,12 @@ int brcmf_fw_get_firmwares(struct device if (ret < 0) brcmf_fw_request_done(NULL, fwctx); diff --git a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch index 835c870a6..1ddc78f7c 100644 --- a/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch +++ b/package/kernel/mac80211/patches/brcm/863-brcmfmac-add-in-driver-tables-with-country-codes.patch @@ -12,7 +12,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -@@ -58,6 +58,36 @@ static int brcmf_of_get_country_codes(st +@@ -59,6 +59,36 @@ static int brcmf_of_get_country_codes(st return 0; } @@ -49,7 +49,7 @@ Signed-off-by: Rafał Miłecki void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, struct brcmf_mp_device *settings) { -@@ -90,6 +120,8 @@ void brcmf_of_probe(struct device *dev, +@@ -91,6 +121,8 @@ void brcmf_of_probe(struct device *dev, of_node_put(root); } diff --git a/package/kernel/mac80211/patches/brcm/998-survey.patch b/package/kernel/mac80211/patches/brcm/998-survey.patch index a5efc0801..d194e2517 100644 --- a/package/kernel/mac80211/patches/brcm/998-survey.patch +++ b/package/kernel/mac80211/patches/brcm/998-survey.patch @@ -100,7 +100,7 @@ .add_key = brcmf_cfg80211_add_key, --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c -@@ -1361,6 +1361,8 @@ int brcmf_attach(struct device *dev) +@@ -1363,6 +1363,8 @@ int brcmf_attach(struct device *dev) /* Link to bus module */ drvr->hdrlen = 0; @@ -109,7 +109,7 @@ /* Attach and link in the protocol */ ret = brcmf_proto_attach(drvr); -@@ -1443,6 +1445,12 @@ void brcmf_detach(struct device *dev) +@@ -1445,6 +1447,12 @@ void brcmf_detach(struct device *dev) if (drvr == NULL) return; diff --git a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch index 3967d73fa..19a60d795 100644 --- a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch +++ b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -421,43 +421,6 @@ USB_VL600= +@@ -428,43 +428,6 @@ USB_VL600= USB_NET_CH9200= USB_NET_AQC111= USB_RTL8153_ECM= @@ -192,7 +192,7 @@ select BRCMUTIL --- a/Kconfig.local +++ b/Kconfig.local -@@ -1267,117 +1267,6 @@ config BACKPORTED_USB_NET_AQC111 +@@ -1288,117 +1288,6 @@ config BACKPORTED_USB_NET_AQC111 config BACKPORTED_USB_RTL8153_ECM tristate default USB_RTL8153_ECM @@ -312,7 +312,7 @@ default USB_ACM --- a/Kconfig.sources +++ b/Kconfig.sources -@@ -7,9 +7,6 @@ source "$BACKPORT_DIR/net/mac80211/Kconf +@@ -9,9 +9,6 @@ source "$BACKPORT_DIR/drivers/bus/mhi/Kc source "$BACKPORT_DIR/drivers/net/wireless/Kconfig" source "$BACKPORT_DIR/drivers/net/usb/Kconfig" @@ -324,9 +324,9 @@ source "$BACKPORT_DIR/drivers/staging/Kconfig" --- a/Makefile.kernel +++ b/Makefile.kernel -@@ -40,8 +40,6 @@ obj-y += compat/ - obj-$(CPTCFG_CFG80211) += net/wireless/ - obj-$(CPTCFG_MAC80211) += net/mac80211/ +@@ -42,8 +42,6 @@ obj-$(CPTCFG_MAC80211) += net/mac80211/ + obj-$(CPTCFG_QRTR) += net/qrtr/ + obj-$(CPTCFG_MHI_BUS) += drivers/bus/mhi/ obj-$(CPTCFG_WLAN) += drivers/net/wireless/ -obj-$(CPTCFG_SSB) += drivers/ssb/ -obj-$(CPTCFG_BCMA) += drivers/bcma/ diff --git a/package/kernel/mac80211/patches/build/070-headers-fix-lockdep_assert_not_held.patch b/package/kernel/mac80211/patches/build/070-headers-fix-lockdep_assert_not_held.patch deleted file mode 100644 index d946efa17..000000000 --- a/package/kernel/mac80211/patches/build/070-headers-fix-lockdep_assert_not_held.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Petr=20=C5=A0tetiar?= -Date: Fri, 11 Mar 2022 18:21:04 +0100 -Subject: [PATCH] headers: fix lockdep_assert_not_held() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -LOCK_STATE_HELD define was omitted during backport of -lockdep_assert_not_held() which leads to build failures of kernels with -CONFIG_LOCKDEP=y: - - backports-5.15.8-1/backport-include/linux/lockdep.h:16:47: error: 'LOCK_STATE_HELD' undeclared (first use in this function) - -Fix it by adding missing LOCK_STATE_HELD define. - -References: https://github.com/openwrt/openwrt/pull/9373 -References: https://lore.kernel.org/backports/20220311194800.452-1-ynezz@true.cz/T/#u -Fixes: af58b27b1b1a ("headers: Add lockdep_assert_not_held()") -Reported-by: Oskari Rauta -Signed-off-by: Petr Štetiar ---- - backport-include/linux/lockdep.h | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/backport-include/linux/lockdep.h b/backport-include/linux/lockdep.h -index ed5ea67894e4..842e24b7ff8f 100644 ---- a/backport-include/linux/lockdep.h -+++ b/backport-include/linux/lockdep.h -@@ -11,6 +11,9 @@ struct lockdep_map { }; - - #ifndef lockdep_assert_not_held - #ifdef CONFIG_LOCKDEP -+#ifndef LOCK_STATE_HELD -+#define LOCK_STATE_HELD 1 -+#endif /* LOCK_STATE_HELD */ - #define lockdep_assert_not_held(l) do { \ - WARN_ON(debug_locks && \ - lockdep_is_held(l) == LOCK_STATE_HELD); \ diff --git a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch index 5bc55cc90..ae329b932 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-rt2x00-introduce-rt2x00eeprom.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -315,6 +315,7 @@ RT2X00_LIB_FIRMWARE= +@@ -324,6 +324,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= diff --git a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch index 638da1434..5307fd355 100644 --- a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch +++ b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch @@ -2,7 +2,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnects --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1316,7 +1316,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1319,7 +1319,6 @@ static int ieee80211_stop_ap(struct wiph sdata->vif.bss_conf.ftmr_params = NULL; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch index e93efa442..2dc6ab360 100644 --- a/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch +++ b/package/kernel/mac80211/patches/subsys/150-disable_addr_notifier.patch @@ -18,7 +18,7 @@ static int ieee80211_ifa6_changed(struct notifier_block *nb, unsigned long data, void *arg) { -@@ -1324,14 +1324,14 @@ int ieee80211_register_hw(struct ieee802 +@@ -1321,14 +1321,14 @@ int ieee80211_register_hw(struct ieee802 wiphy_unlock(hw->wiphy); rtnl_unlock(); @@ -35,7 +35,7 @@ local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; result = register_inet6addr_notifier(&local->ifa6_notifier); if (result) -@@ -1340,13 +1340,13 @@ int ieee80211_register_hw(struct ieee802 +@@ -1337,13 +1337,13 @@ int ieee80211_register_hw(struct ieee802 return 0; @@ -52,7 +52,7 @@ fail_ifa: #endif wiphy_unregister(local->hw.wiphy); -@@ -1374,10 +1374,10 @@ void ieee80211_unregister_hw(struct ieee +@@ -1371,10 +1371,10 @@ void ieee80211_unregister_hw(struct ieee tasklet_kill(&local->tx_pending_tasklet); tasklet_kill(&local->tasklet); diff --git a/package/kernel/mac80211/patches/subsys/300-mac80211-fix-rate-control-for-retransmitted-frames.patch b/package/kernel/mac80211/patches/subsys/300-mac80211-fix-rate-control-for-retransmitted-frames.patch deleted file mode 100644 index 98dfe88cb..000000000 --- a/package/kernel/mac80211/patches/subsys/300-mac80211-fix-rate-control-for-retransmitted-frames.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: Felix Fietkau -Date: Mon, 22 Nov 2021 21:39:38 +0100 -Subject: [PATCH] mac80211: fix rate control for retransmitted frames - -Since retransmission clears info->control, rate control needs to be called -again, otherwise the driver might crash due to invalid rates. - -Cc: stable@vger.kernel.org # 5.14+ -Reported-by: Aaro Koskinen -Reported-by: Robert W -Fixes: 03c3911d2d67 ("mac80211: call ieee80211_tx_h_rate_ctrl() when dequeue") -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1821,15 +1821,15 @@ static int invoke_tx_handlers_late(struc - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - ieee80211_tx_result res = TX_CONTINUE; - -+ if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) -+ CALL_TXH(ieee80211_tx_h_rate_ctrl); -+ - if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) { - __skb_queue_tail(&tx->skbs, tx->skb); - tx->skb = NULL; - goto txh_done; - } - -- if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) -- CALL_TXH(ieee80211_tx_h_rate_ctrl); -- - CALL_TXH(ieee80211_tx_h_michael_mic_add); - CALL_TXH(ieee80211_tx_h_sequence); - CALL_TXH(ieee80211_tx_h_fragment); diff --git a/package/kernel/mac80211/patches/subsys/302-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch b/package/kernel/mac80211/patches/subsys/302-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch deleted file mode 100644 index dc8afb918..000000000 --- a/package/kernel/mac80211/patches/subsys/302-mac80211-fix-regression-in-SSN-handling-of-addba-tx.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: Felix Fietkau -Date: Wed, 24 Nov 2021 10:30:41 +0100 -Subject: [PATCH] mac80211: fix regression in SSN handling of addba tx - -Some drivers that do their own sequence number allocation (e.g. ath9k) rely -on being able to modify params->ssn on starting tx ampdu sessions. -This was broken by a change that modified it to use sta->tid_seq[tid] instead. - -Cc: stable@vger.kernel.org -Fixes: 31d8bb4e07f8 ("mac80211: agg-tx: refactor sending addba") -Reported-by: Eneas U de Queiroz -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/agg-tx.c -+++ b/net/mac80211/agg-tx.c -@@ -480,8 +480,7 @@ static void ieee80211_send_addba_with_ti - - /* send AddBA request */ - ieee80211_send_addba_request(sdata, sta->sta.addr, tid, -- tid_tx->dialog_token, -- sta->tid_seq[tid] >> 4, -+ tid_tx->dialog_token, tid_tx->ssn, - buf_size, tid_tx->timeout); - - WARN_ON(test_and_set_bit(HT_AGG_STATE_SENT_ADDBA, &tid_tx->state)); -@@ -523,6 +522,7 @@ void ieee80211_tx_ba_session_handle_star - - params.ssn = sta->tid_seq[tid] >> 4; - ret = drv_ampdu_action(local, sdata, ¶ms); -+ tid_tx->ssn = params.ssn; - if (ret == IEEE80211_AMPDU_TX_START_DELAY_ADDBA) { - return; - } else if (ret == IEEE80211_AMPDU_TX_START_IMMEDIATE) { ---- a/net/mac80211/sta_info.h -+++ b/net/mac80211/sta_info.h -@@ -199,6 +199,7 @@ struct tid_ampdu_tx { - u8 stop_initiator; - bool tx_stop; - u16 buf_size; -+ u16 ssn; - - u16 failed_bar_ssn; - bool bar_pending; diff --git a/package/kernel/mac80211/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch b/package/kernel/mac80211/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch index 1ceb2be25..777c93cb9 100644 --- a/package/kernel/mac80211/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch +++ b/package/kernel/mac80211/patches/subsys/303-mac80211-set-up-the-fwd_skb-dev-for-mesh-forwarding.patch @@ -52,7 +52,7 @@ Signed-off-by: Xing Song --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -2948,6 +2948,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 +@@ -2949,6 +2949,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 if (!fwd_skb) goto out; diff --git a/package/kernel/mac80211/patches/subsys/304-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch b/package/kernel/mac80211/patches/subsys/304-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch deleted file mode 100644 index 1c213289c..000000000 --- a/package/kernel/mac80211/patches/subsys/304-mac80211-send-ADDBA-requests-using-the-tid-queue-of-.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Felix Fietkau -Date: Thu, 2 Dec 2021 13:30:05 +0100 -Subject: [PATCH] mac80211: send ADDBA requests using the tid/queue of the - aggregation session - -Sending them out on a different queue can cause a race condition where a -number of packets in the queue may be discarded by the receiver, because -the ADDBA request is sent too early. -This affects any driver with software A-MPDU setup which does not allocate -packet seqno in hardware on tx, regardless of whether iTXQ is used or not. -The only driver I've seen that explicitly deals with this issue internally -is mwl8k. - -Cc: stable@vger.kernel.org -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/agg-tx.c -+++ b/net/mac80211/agg-tx.c -@@ -106,7 +106,7 @@ static void ieee80211_send_addba_request - mgmt->u.action.u.addba_req.start_seq_num = - cpu_to_le16(start_seq_num << 4); - -- ieee80211_tx_skb(sdata, skb); -+ ieee80211_tx_skb_tid(sdata, skb, tid); - } - - void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn) diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch deleted file mode 100644 index 008ee49cf..000000000 --- a/package/kernel/mac80211/patches/subsys/305-mac80211-agg-tx-don-t-schedule_and_wake_txq-under-st.patch +++ /dev/null @@ -1,79 +0,0 @@ -From: Johannes Berg -Date: Mon, 29 Nov 2021 15:32:47 +0200 -Subject: [PATCH] mac80211: agg-tx: don't schedule_and_wake_txq() under - sta->lock - -When we call ieee80211_agg_start_txq(), that will in turn call -schedule_and_wake_txq(). Called from ieee80211_stop_tx_ba_cb() -this is done under sta->lock, which leads to certain circular -lock dependencies, as reported by Chris Murphy: -https://lore.kernel.org/r/CAJCQCtSXJ5qA4bqSPY=oLRMbv-irihVvP7A2uGutEbXQVkoNaw@mail.gmail.com - -In general, ieee80211_agg_start_txq() is usually not called -with sta->lock held, only in this one place. But it's always -called with sta->ampdu_mlme.mtx held, and that's therefore -clearly sufficient. - -Change ieee80211_stop_tx_ba_cb() to also call it without the -sta->lock held, by factoring it out of ieee80211_remove_tid_tx() -(which is only called in this one place). - -This breaks the locking chain and makes it less likely that -we'll have similar locking chain problems in the future. - -Reported-by: Chris Murphy -Signed-off-by: Johannes Berg -Signed-off-by: Luca Coelho ---- - ---- a/net/mac80211/agg-tx.c -+++ b/net/mac80211/agg-tx.c -@@ -9,7 +9,7 @@ - * Copyright 2007, Michael Wu - * Copyright 2007-2010, Intel Corporation - * Copyright(c) 2015-2017 Intel Deutschland GmbH -- * Copyright (C) 2018 - 2020 Intel Corporation -+ * Copyright (C) 2018 - 2021 Intel Corporation - */ - - #include -@@ -213,6 +213,8 @@ ieee80211_agg_start_txq(struct sta_info - struct ieee80211_txq *txq = sta->sta.txq[tid]; - struct txq_info *txqi; - -+ lockdep_assert_held(&sta->ampdu_mlme.mtx); -+ - if (!txq) - return; - -@@ -290,7 +292,6 @@ static void ieee80211_remove_tid_tx(stru - ieee80211_assign_tid_tx(sta, tid, NULL); - - ieee80211_agg_splice_finish(sta->sdata, tid); -- ieee80211_agg_start_txq(sta, tid, false); - - kfree_rcu(tid_tx, rcu_head); - } -@@ -889,6 +890,7 @@ void ieee80211_stop_tx_ba_cb(struct sta_ - { - struct ieee80211_sub_if_data *sdata = sta->sdata; - bool send_delba = false; -+ bool start_txq = false; - - ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n", - sta->sta.addr, tid); -@@ -906,10 +908,14 @@ void ieee80211_stop_tx_ba_cb(struct sta_ - send_delba = true; - - ieee80211_remove_tid_tx(sta, tid); -+ start_txq = true; - - unlock_sta: - spin_unlock_bh(&sta->lock); - -+ if (start_txq) -+ ieee80211_agg_start_txq(sta, tid, false); -+ - if (send_delba) - ieee80211_send_delba(sdata, sta->sta.addr, tid, - WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); diff --git a/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch b/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch index 9c7417e5f..c534d1570 100644 --- a/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch +++ b/package/kernel/mac80211/patches/subsys/307-mac80211_hwsim-make-6-GHz-channels-usable.patch @@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -2992,15 +2992,19 @@ static void mac80211_hwsim_he_capab(stru +@@ -3001,15 +3001,19 @@ static void mac80211_hwsim_he_capab(stru { u16 n_iftype_data; @@ -34,7 +34,7 @@ Signed-off-by: Felix Fietkau return; } -@@ -3290,6 +3294,12 @@ static int mac80211_hwsim_new_radio(stru +@@ -3299,6 +3303,12 @@ static int mac80211_hwsim_new_radio(stru sband->vht_cap.vht_mcs.tx_mcs_map = sband->vht_cap.vht_mcs.rx_mcs_map; break; @@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau case NL80211_BAND_S1GHZ: memcpy(&sband->s1g_cap, &hwsim_s1g_cap, sizeof(sband->s1g_cap)); -@@ -3300,6 +3310,13 @@ static int mac80211_hwsim_new_radio(stru +@@ -3309,6 +3319,13 @@ static int mac80211_hwsim_new_radio(stru continue; } @@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau sband->ht_cap.ht_supported = true; sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD | -@@ -3313,10 +3330,6 @@ static int mac80211_hwsim_new_radio(stru +@@ -3322,10 +3339,6 @@ static int mac80211_hwsim_new_radio(stru sband->ht_cap.mcs.rx_mask[0] = 0xff; sband->ht_cap.mcs.rx_mask[1] = 0xff; sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; diff --git a/package/kernel/mac80211/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch b/package/kernel/mac80211/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch index 2f3c1a266..272d84f35 100644 --- a/package/kernel/mac80211/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch +++ b/package/kernel/mac80211/patches/subsys/308-mac80211-add-support-for-.ndo_fill_forward_path.patch @@ -38,10 +38,10 @@ Signed-off-by: Johannes Berg /** --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h -@@ -1483,4 +1483,28 @@ static inline void drv_twt_teardown_requ +@@ -1486,4 +1486,28 @@ static inline void drv_twt_teardown_requ trace_drv_return_void(local); } - + +#if LINUX_VERSION_IS_GEQ(5,10,0) +static inline int drv_net_fill_forward_path(struct ieee80211_local *local, + struct ieee80211_sub_if_data *sdata, @@ -69,7 +69,7 @@ Signed-off-by: Johannes Berg #endif /* __MAC80211_DRIVER_OPS */ --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1465,7 +1465,7 @@ struct ieee80211_local { +@@ -1485,7 +1485,7 @@ struct ieee80211_local { }; static inline struct ieee80211_sub_if_data * @@ -147,7 +147,7 @@ Signed-off-by: Johannes Berg static const struct net_device_ops ieee80211_dataif_8023_ops = { #if LINUX_VERSION_IS_LESS(4,10,0) .ndo_change_mtu = __change_mtu, -@@ -839,7 +901,9 @@ static const struct net_device_ops ieee8 +@@ -839,7 +899,9 @@ static const struct net_device_ops ieee8 #else .ndo_get_stats64 = bp_ieee80211_get_stats64, #endif @@ -163,7 +163,7 @@ Signed-off-by: Johannes Berg @@ -2892,6 +2892,15 @@ TRACE_EVENT(drv_twt_teardown_request, ) ); - + +#if LINUX_VERSION_IS_GEQ(5,10,0) +DEFINE_EVENT(sta_event, drv_net_fill_forward_path, + TP_PROTO(struct ieee80211_local *local, diff --git a/package/kernel/mac80211/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch index 8e6b30188..4fc8b592c 100644 --- a/package/kernel/mac80211/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch +++ b/package/kernel/mac80211/patches/subsys/313-nl80211-MBSSID-and-EMA-support-in-AP-mode.patch @@ -221,7 +221,7 @@ Signed-off-by: Johannes Berg #endif /* __LINUX_NL80211_H */ --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -439,6 +439,16 @@ sar_policy[NL80211_SAR_ATTR_MAX + 1] = { +@@ -442,6 +442,16 @@ sar_policy[NL80211_SAR_ATTR_MAX + 1] = { [NL80211_SAR_ATTR_SPECS] = NLA_POLICY_NESTED_ARRAY(sar_specs_policy), }; @@ -238,7 +238,7 @@ Signed-off-by: Johannes Berg static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [0] = { .strict_start_type = NL80211_ATTR_HE_OBSS_PD }, [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, -@@ -780,6 +790,9 @@ static const struct nla_policy nl80211_p +@@ -783,6 +793,9 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_COLOR_CHANGE_COUNT] = { .type = NLA_U8 }, [NL80211_ATTR_COLOR_CHANGE_COLOR] = { .type = NLA_U8 }, [NL80211_ATTR_COLOR_CHANGE_ELEMS] = NLA_POLICY_NESTED(nl80211_policy), @@ -248,7 +248,7 @@ Signed-off-by: Johannes Berg }; /* policy for the key attributes */ -@@ -2228,6 +2241,35 @@ fail: +@@ -2231,6 +2244,35 @@ fail: return -ENOBUFS; } @@ -284,7 +284,7 @@ Signed-off-by: Johannes Berg struct nl80211_dump_wiphy_state { s64 filter_wiphy; long start; -@@ -2813,6 +2855,9 @@ static int nl80211_send_wiphy(struct cfg +@@ -2816,6 +2858,9 @@ static int nl80211_send_wiphy(struct cfg if (nl80211_put_sar_specs(rdev, msg)) goto nla_put_failure; @@ -294,7 +294,7 @@ Signed-off-by: Johannes Berg /* done */ state->split_start = 0; break; -@@ -5002,6 +5047,96 @@ static int validate_beacon_tx_rate(struc +@@ -5005,6 +5050,96 @@ static int validate_beacon_tx_rate(struc return 0; } @@ -391,7 +391,7 @@ Signed-off-by: Johannes Berg static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev, struct nlattr *attrs[], struct cfg80211_beacon_data *bcn) -@@ -5082,6 +5217,17 @@ static int nl80211_parse_beacon(struct c +@@ -5085,6 +5220,17 @@ static int nl80211_parse_beacon(struct c bcn->ftm_responder = -1; } @@ -409,7 +409,7 @@ Signed-off-by: Johannes Berg return 0; } -@@ -5538,6 +5684,17 @@ static int nl80211_start_ap(struct sk_bu +@@ -5541,6 +5687,17 @@ static int nl80211_start_ap(struct sk_bu goto out; } @@ -427,7 +427,7 @@ Signed-off-by: Johannes Berg nl80211_calculate_ap_params(¶ms); if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT]) -@@ -5559,6 +5716,11 @@ static int nl80211_start_ap(struct sk_bu +@@ -5562,6 +5719,11 @@ static int nl80211_start_ap(struct sk_bu out: kfree(params.acl); @@ -439,7 +439,7 @@ Signed-off-by: Johannes Berg return err; } -@@ -5583,12 +5745,14 @@ static int nl80211_set_beacon(struct sk_ +@@ -5586,12 +5748,14 @@ static int nl80211_set_beacon(struct sk_ err = nl80211_parse_beacon(rdev, info->attrs, ¶ms); if (err) @@ -455,7 +455,7 @@ Signed-off-by: Johannes Berg return err; } -@@ -9265,12 +9429,14 @@ static int nl80211_channel_switch(struct +@@ -9268,12 +9432,14 @@ static int nl80211_channel_switch(struct err = nl80211_parse_beacon(rdev, info->attrs, ¶ms.beacon_after); if (err) @@ -473,7 +473,7 @@ Signed-off-by: Johannes Berg err = nla_parse_nested_deprecated(csa_attrs, NL80211_ATTR_MAX, info->attrs[NL80211_ATTR_CSA_IES], -@@ -9389,6 +9555,8 @@ skip_beacons: +@@ -9392,6 +9558,8 @@ skip_beacons: wdev_unlock(wdev); free: @@ -482,7 +482,7 @@ Signed-off-by: Johannes Berg kfree(csa_attrs); return err; } -@@ -14924,6 +15092,8 @@ static int nl80211_color_change(struct s +@@ -14939,6 +15107,8 @@ static int nl80211_color_change(struct s wdev_unlock(wdev); out: diff --git a/package/kernel/mac80211/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch b/package/kernel/mac80211/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch index 032bcf7a0..90c56b4e4 100644 --- a/package/kernel/mac80211/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch +++ b/package/kernel/mac80211/patches/subsys/314-cfg80211-implement-APIs-for-dedicated-radar-detectio.patch @@ -119,7 +119,7 @@ Signed-off-by: Johannes Berg NUM_NL80211_EXT_FEATURES, --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -552,6 +552,7 @@ use_default_name: +@@ -543,6 +543,7 @@ use_default_name: INIT_WORK(&rdev->rfkill_block, cfg80211_rfkill_block_work); INIT_WORK(&rdev->conn_work, cfg80211_conn_work); INIT_WORK(&rdev->event_work, cfg80211_event_work); @@ -127,7 +127,7 @@ Signed-off-by: Johannes Berg init_waitqueue_head(&rdev->dev_wait); -@@ -1214,6 +1215,8 @@ void __cfg80211_leave(struct cfg80211_re +@@ -1205,6 +1206,8 @@ void __cfg80211_leave(struct cfg80211_re cfg80211_pmsr_wdev_down(wdev); @@ -286,7 +286,7 @@ Signed-off-by: Johannes Berg +} --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -793,6 +793,7 @@ static const struct nla_policy nl80211_p +@@ -796,6 +796,7 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_MBSSID_CONFIG] = NLA_POLICY_NESTED(nl80211_mbssid_config_policy), [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, @@ -294,7 +294,7 @@ Signed-off-by: Johannes Berg }; /* policy for the key attributes */ -@@ -9269,12 +9270,6 @@ static int nl80211_start_radar_detection +@@ -9272,12 +9273,6 @@ static int nl80211_start_radar_detection if (err) return err; @@ -307,7 +307,7 @@ Signed-off-by: Johannes Berg err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype); if (err < 0) return err; -@@ -9285,6 +9280,16 @@ static int nl80211_start_radar_detection +@@ -9288,6 +9283,16 @@ static int nl80211_start_radar_detection if (!cfg80211_chandef_dfs_usable(wiphy, &chandef)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/315-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch b/package/kernel/mac80211/patches/subsys/315-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch index e58c3b99b..b1a1d2c89 100644 --- a/package/kernel/mac80211/patches/subsys/315-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch +++ b/package/kernel/mac80211/patches/subsys/315-cfg80211-move-offchan_cac_event-to-a-dedicated-work.patch @@ -43,7 +43,7 @@ Signed-off-by: Johannes Berg * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -552,7 +552,9 @@ use_default_name: +@@ -543,7 +543,9 @@ use_default_name: INIT_WORK(&rdev->rfkill_block, cfg80211_rfkill_block_work); INIT_WORK(&rdev->conn_work, cfg80211_conn_work); INIT_WORK(&rdev->event_work, cfg80211_event_work); @@ -54,7 +54,7 @@ Signed-off-by: Johannes Berg init_waitqueue_head(&rdev->dev_wait); -@@ -1062,11 +1064,13 @@ void wiphy_unregister(struct wiphy *wiph +@@ -1053,11 +1055,13 @@ void wiphy_unregister(struct wiphy *wiph cancel_work_sync(&rdev->conn_work); flush_work(&rdev->event_work); cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); diff --git a/package/kernel/mac80211/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch b/package/kernel/mac80211/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch index ae97947fa..567743d84 100644 --- a/package/kernel/mac80211/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch +++ b/package/kernel/mac80211/patches/subsys/318-cfg80211-allow-continuous-radar-monitoring-on-offcha.patch @@ -118,7 +118,7 @@ Signed-off-by: Johannes Berg NL80211_RADAR_CAC_ABORTED); --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -9260,42 +9260,60 @@ static int nl80211_start_radar_detection +@@ -9263,42 +9263,60 @@ static int nl80211_start_radar_detection struct cfg80211_chan_def chandef; enum nl80211_dfs_regions dfs_region; unsigned int cac_time_ms; @@ -198,7 +198,7 @@ Signed-off-by: Johannes Berg cac_time_ms = cfg80211_chandef_dfs_cac_time(&rdev->wiphy, &chandef); if (WARN_ON(!cac_time_ms)) -@@ -9308,6 +9326,9 @@ static int nl80211_start_radar_detection +@@ -9311,6 +9329,9 @@ static int nl80211_start_radar_detection wdev->cac_start_time = jiffies; wdev->cac_time_ms = cac_time_ms; } @@ -208,7 +208,7 @@ Signed-off-by: Johannes Berg return err; } -@@ -15926,7 +15947,8 @@ static const struct genl_small_ops nl802 +@@ -15941,7 +15962,8 @@ static const struct genl_small_ops nl802 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = nl80211_start_radar_detection, .flags = GENL_UNS_ADMIN_PERM, diff --git a/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch b/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch index a73e81bec..c3a4c0db2 100644 --- a/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch +++ b/package/kernel/mac80211/patches/subsys/320-cfg80211-rename-offchannel_chain-structs-to-backgrou.patch @@ -204,7 +204,7 @@ Signed-off-by: Johannes Berg bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -552,9 +552,10 @@ use_default_name: +@@ -543,9 +543,10 @@ use_default_name: INIT_WORK(&rdev->rfkill_block, cfg80211_rfkill_block_work); INIT_WORK(&rdev->conn_work, cfg80211_conn_work); INIT_WORK(&rdev->event_work, cfg80211_event_work); @@ -218,7 +218,7 @@ Signed-off-by: Johannes Berg init_waitqueue_head(&rdev->dev_wait); -@@ -1064,13 +1065,13 @@ void wiphy_unregister(struct wiphy *wiph +@@ -1055,13 +1056,13 @@ void wiphy_unregister(struct wiphy *wiph cancel_work_sync(&rdev->conn_work); flush_work(&rdev->event_work); cancel_delayed_work_sync(&rdev->dfs_update_channels_wk); @@ -234,7 +234,7 @@ Signed-off-by: Johannes Berg #ifdef CONFIG_PM if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) -@@ -1219,7 +1220,7 @@ void __cfg80211_leave(struct cfg80211_re +@@ -1210,7 +1211,7 @@ void __cfg80211_leave(struct cfg80211_re cfg80211_pmsr_wdev_down(wdev); @@ -472,7 +472,7 @@ Signed-off-by: Johannes Berg } --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -793,7 +793,7 @@ static const struct nla_policy nl80211_p +@@ -796,7 +796,7 @@ static const struct nla_policy nl80211_p [NL80211_ATTR_MBSSID_CONFIG] = NLA_POLICY_NESTED(nl80211_mbssid_config_policy), [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, @@ -481,7 +481,7 @@ Signed-off-by: Johannes Berg }; /* policy for the key attributes */ -@@ -9288,9 +9288,9 @@ static int nl80211_start_radar_detection +@@ -9291,9 +9291,9 @@ static int nl80211_start_radar_detection goto unlock; } diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211-fix-EAPoL-rekey-fail-in-802.3-rx-path.patch b/package/kernel/mac80211/patches/subsys/321-mac80211-fix-EAPoL-rekey-fail-in-802.3-rx-path.patch deleted file mode 100644 index 932403d65..000000000 --- a/package/kernel/mac80211/patches/subsys/321-mac80211-fix-EAPoL-rekey-fail-in-802.3-rx-path.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Deren Wu -Date: Sun, 13 Feb 2022 00:20:15 +0800 -Subject: [PATCH] mac80211: fix EAPoL rekey fail in 802.3 rx path - -mac80211 set capability NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211 -to upper layer by default. That means we should pass EAPoL packets through -nl80211 path only, and should not send the EAPoL skb to netdevice diretly. -At the meanwhile, wpa_supplicant would not regist sock to listen EAPoL skb -on the netdevice. - -However, there is no contorl_port_protocol handler in mac80211 for 802.3 RX -packets, mac80211 driver would pass up the EAPoL rekey frame to netdevice -and wpa_supplicant would be never interactive with this kind of packets, -if SUPPORTS_RX_DECAP_OFFLOAD is enabled. This causes STA always rekey fail -if EAPoL frame go through 802.3 path. - -To avoid this problem, align the same process as 802.11 type to handle -this frame before put it into network stack. - -Fixes: 80a915ec4427 ("mac80211: add rx decapsulation offload support") -Signed-off-by: Deren Wu ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -4523,16 +4523,7 @@ static void ieee80211_rx_8023(struct iee - - /* deliver to local stack */ - skb->protocol = eth_type_trans(skb, fast_rx->dev); -- memset(skb->cb, 0, sizeof(skb->cb)); -- if (rx->list) --#if LINUX_VERSION_IS_GEQ(4,19,0) -- list_add_tail(&skb->list, rx->list); --#else -- __skb_queue_tail(rx->list, skb); --#endif -- else -- netif_receive_skb(skb); -- -+ ieee80211_deliver_skb_to_local_stack(skb, rx); - } - - static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, diff --git a/package/kernel/mac80211/patches/subsys/322-mac80211-fix-forwarded-mesh-frames-AC-queue-selectio.patch b/package/kernel/mac80211/patches/subsys/322-mac80211-fix-forwarded-mesh-frames-AC-queue-selectio.patch deleted file mode 100644 index 50693f723..000000000 --- a/package/kernel/mac80211/patches/subsys/322-mac80211-fix-forwarded-mesh-frames-AC-queue-selectio.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Nicolas Escande -Date: Mon, 14 Feb 2022 18:32:14 +0100 -Subject: [PATCH] mac80211: fix forwarded mesh frames AC & queue selection - -There are two problems with the current code that have been highlighted -with the AQL feature that is now enbaled by default. - -First problem is in ieee80211_rx_h_mesh_fwding(), -ieee80211_select_queue_80211() is used on received packets to choose -the sending AC queue of the forwarding packet although this function -should only be called on TX packet (it uses ieee80211_tx_info). -This ends with forwarded mesh packets been sent on unrelated random AC -queue. To fix that, AC queue can directly be infered from skb->priority -which has been extracted from QOS info (see ieee80211_parse_qos()). - -Second problem is the value of queue_mapping set on forwarded mesh -frames via skb_set_queue_mapping() is not the AC of the packet but a -hardware queue index. This may or may not work depending on AC to HW -queue mapping which is driver specific. - -Both of these issues lead to improper AC selection while forwarding -mesh packets but more importantly due to improper airtime accounting -(which is done on a per STA, per AC basis) caused traffic stall with -the introduction of AQL. - -Fixes: cf44012810cc ("mac80211: fix unnecessary frame drops in mesh fwding") -Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping") -Co-developed-by: Remi Pommarel -Signed-off-by: Remi Pommarel -Signed-off-by: Nicolas Escande ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2921,13 +2921,13 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 - ether_addr_equal(sdata->vif.addr, hdr->addr3)) - return RX_CONTINUE; - -- ac = ieee80211_select_queue_80211(sdata, skb, hdr); -+ 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, q); -+ skb_set_queue_mapping(skb, ac); - - if (!--mesh_hdr->ttl) { - if (!is_multicast_ether_addr(hdr->addr1)) diff --git a/package/kernel/mac80211/patches/subsys/324-mac80211-MBSSID-beacon-handling-in-AP-mode.patch b/package/kernel/mac80211/patches/subsys/324-mac80211-MBSSID-beacon-handling-in-AP-mode.patch index c76f4ae46..fdbcce945 100644 --- a/package/kernel/mac80211/patches/subsys/324-mac80211-MBSSID-beacon-handling-in-AP-mode.patch +++ b/package/kernel/mac80211/patches/subsys/324-mac80211-MBSSID-beacon-handling-in-AP-mode.patch @@ -106,7 +106,7 @@ Signed-off-by: Johannes Berg if (csa) { new->cntdwn_current_counter = csa->count; -@@ -1329,8 +1366,11 @@ static int ieee80211_stop_ap(struct wiph +@@ -1332,8 +1369,11 @@ static int ieee80211_stop_ap(struct wiph mutex_unlock(&local->mtx); @@ -246,7 +246,7 @@ Signed-off-by: Johannes Berg struct rcu_head rcu_head; }; -@@ -1063,6 +1064,20 @@ ieee80211_vif_get_shift(struct ieee80211 +@@ -1083,6 +1084,20 @@ ieee80211_vif_get_shift(struct ieee80211 return shift; } diff --git a/package/kernel/mac80211/patches/subsys/327-mac80211-allow-non-standard-VHT-MCS-10-11.patch b/package/kernel/mac80211/patches/subsys/327-mac80211-allow-non-standard-VHT-MCS-10-11.patch deleted file mode 100644 index 7c68e7557..000000000 --- a/package/kernel/mac80211/patches/subsys/327-mac80211-allow-non-standard-VHT-MCS-10-11.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: Ping-Ke Shih -Date: Mon, 3 Jan 2022 09:36:21 +0800 -Subject: [PATCH] mac80211: allow non-standard VHT MCS-10/11 - -Some AP can possibly try non-standard VHT rate and mac80211 warns and drops -packets, and leads low TCP throughput. - - Rate marked as a VHT rate but data is invalid: MCS: 10, NSS: 2 - WARNING: CPU: 1 PID: 7817 at net/mac80211/rx.c:4856 ieee80211_rx_list+0x223/0x2f0 [mac8021 - -Since commit c27aa56a72b8 ("cfg80211: add VHT rate entries for MCS-10 and MCS-11") -has added, mac80211 adds this support as well. - -After this patch, throughput is good and iw can get the bitrate: - rx bitrate: 975.1 MBit/s VHT-MCS 10 80MHz short GI VHT-NSS 2 -or - rx bitrate: 1083.3 MBit/s VHT-MCS 11 80MHz short GI VHT-NSS 2 - -Buglink: https://bugzilla.suse.com/show_bug.cgi?id=1192891 -Reported-by: Goldwyn Rodrigues -Signed-off-by: Ping-Ke Shih -Link: https://lore.kernel.org/r/20220103013623.17052-1-pkshih@realtek.com -Signed-off-by: Johannes Berg ---- - ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -4945,7 +4945,7 @@ void ieee80211_rx_list(struct ieee80211_ - goto drop; - break; - case RX_ENC_VHT: -- if (WARN_ONCE(status->rate_idx > 9 || -+ if (WARN_ONCE(status->rate_idx > 11 || - !status->nss || - status->nss > 8, - "Rate marked as a VHT rate but data is invalid: MCS: %d, NSS: %d\n", diff --git a/package/kernel/mac80211/patches/subsys/330-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch b/package/kernel/mac80211/patches/subsys/330-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch new file mode 100644 index 000000000..1a66aa8c0 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/330-mac80211-switch-airtime-fairness-back-to-deficit-rou.patch @@ -0,0 +1,1249 @@ +From: Felix Fietkau +Date: Sun, 19 Jun 2022 23:13:05 +0200 +Subject: [PATCH] mac80211: switch airtime fairness back to deficit round-robin + scheduling + +This reverts commits 6a789ba679d652587532cec2a0e0274fda172f3b and +2433647bc8d983a543e7d31b41ca2de1c7e2c198. + +The virtual time scheduler code has a number of issues: +- queues slowed down by hardware/firmware powersave handling were not properly + handled. +- on ath10k in push-pull mode, tx queues that the driver tries to pull from + were starved, causing excessive latency +- delay between tx enqueue and reported airtime use were causing excessively + bursty tx behavior + +The bursty behavior may also be present on the round-robin scheduler, but there +it is much easier to fix without introducing additional regressions + +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -6666,6 +6666,9 @@ static inline void ieee80211_txq_schedul + { + } + ++void __ieee80211_schedule_txq(struct ieee80211_hw *hw, ++ struct ieee80211_txq *txq, bool force); ++ + /** + * ieee80211_schedule_txq - schedule a TXQ for transmission + * +@@ -6678,7 +6681,11 @@ static inline void ieee80211_txq_schedul + * The driver may call this function if it has buffered packets for + * this TXQ internally. + */ +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq); ++static inline void ++ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) ++{ ++ __ieee80211_schedule_txq(hw, txq, true); ++} + + /** + * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq() +@@ -6690,8 +6697,12 @@ void ieee80211_schedule_txq(struct ieee8 + * The driver may set force=true if it has buffered packets for this TXQ + * internally. + */ +-void ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, +- bool force); ++static inline void ++ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, ++ bool force) ++{ ++ __ieee80211_schedule_txq(hw, txq, force); ++} + + /** + * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -1554,38 +1554,6 @@ static void sta_apply_mesh_params(struct + #endif + } + +-static void sta_apply_airtime_params(struct ieee80211_local *local, +- struct sta_info *sta, +- struct station_parameters *params) +-{ +- u8 ac; +- +- for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { +- struct airtime_sched_info *air_sched = &local->airtime[ac]; +- struct airtime_info *air_info = &sta->airtime[ac]; +- struct txq_info *txqi; +- u8 tid; +- +- spin_lock_bh(&air_sched->lock); +- for (tid = 0; tid < IEEE80211_NUM_TIDS + 1; tid++) { +- if (air_info->weight == params->airtime_weight || +- !sta->sta.txq[tid] || +- ac != ieee80211_ac_from_tid(tid)) +- continue; +- +- airtime_weight_set(air_info, params->airtime_weight); +- +- txqi = to_txq_info(sta->sta.txq[tid]); +- if (RB_EMPTY_NODE(&txqi->schedule_order)) +- continue; +- +- ieee80211_update_airtime_weight(local, air_sched, +- 0, true); +- } +- spin_unlock_bh(&air_sched->lock); +- } +-} +- + static int sta_apply_parameters(struct ieee80211_local *local, + struct sta_info *sta, + struct station_parameters *params) +@@ -1773,8 +1741,7 @@ static int sta_apply_parameters(struct i + sta_apply_mesh_params(local, sta, params); + + if (params->airtime_weight) +- sta_apply_airtime_params(local, sta, params); +- ++ sta->airtime_weight = params->airtime_weight; + + /* set the STA state after all sta info from usermode has been set */ + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) || +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -216,14 +216,14 @@ static ssize_t aql_txq_limit_read(struct + "VI %u %u\n" + "BE %u %u\n" + "BK %u %u\n", +- local->airtime[IEEE80211_AC_VO].aql_txq_limit_low, +- local->airtime[IEEE80211_AC_VO].aql_txq_limit_high, +- local->airtime[IEEE80211_AC_VI].aql_txq_limit_low, +- local->airtime[IEEE80211_AC_VI].aql_txq_limit_high, +- local->airtime[IEEE80211_AC_BE].aql_txq_limit_low, +- local->airtime[IEEE80211_AC_BE].aql_txq_limit_high, +- local->airtime[IEEE80211_AC_BK].aql_txq_limit_low, +- local->airtime[IEEE80211_AC_BK].aql_txq_limit_high); ++ local->aql_txq_limit_low[IEEE80211_AC_VO], ++ local->aql_txq_limit_high[IEEE80211_AC_VO], ++ local->aql_txq_limit_low[IEEE80211_AC_VI], ++ local->aql_txq_limit_high[IEEE80211_AC_VI], ++ local->aql_txq_limit_low[IEEE80211_AC_BE], ++ local->aql_txq_limit_high[IEEE80211_AC_BE], ++ local->aql_txq_limit_low[IEEE80211_AC_BK], ++ local->aql_txq_limit_high[IEEE80211_AC_BK]); + return simple_read_from_buffer(user_buf, count, ppos, + buf, len); + } +@@ -255,11 +255,11 @@ static ssize_t aql_txq_limit_write(struc + if (ac >= IEEE80211_NUM_ACS) + return -EINVAL; + +- q_limit_low_old = local->airtime[ac].aql_txq_limit_low; +- q_limit_high_old = local->airtime[ac].aql_txq_limit_high; ++ q_limit_low_old = local->aql_txq_limit_low[ac]; ++ q_limit_high_old = local->aql_txq_limit_high[ac]; + +- local->airtime[ac].aql_txq_limit_low = q_limit_low; +- local->airtime[ac].aql_txq_limit_high = q_limit_high; ++ local->aql_txq_limit_low[ac] = q_limit_low; ++ local->aql_txq_limit_high[ac] = q_limit_high; + + mutex_lock(&local->sta_mtx); + list_for_each_entry(sta, &local->sta_list, list) { +@@ -382,46 +382,6 @@ static const struct file_operations forc + .llseek = default_llseek, + }; + +-static ssize_t airtime_read(struct file *file, +- char __user *user_buf, +- size_t count, +- loff_t *ppos) +-{ +- struct ieee80211_local *local = file->private_data; +- char buf[200]; +- u64 v_t[IEEE80211_NUM_ACS]; +- u64 wt[IEEE80211_NUM_ACS]; +- int len = 0, ac; +- +- for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { +- spin_lock_bh(&local->airtime[ac].lock); +- v_t[ac] = local->airtime[ac].v_t; +- wt[ac] = local->airtime[ac].weight_sum; +- spin_unlock_bh(&local->airtime[ac].lock); +- } +- len = scnprintf(buf, sizeof(buf), +- "\tVO VI BE BK\n" +- "Virt-t\t%-10llu %-10llu %-10llu %-10llu\n" +- "Weight\t%-10llu %-10llu %-10llu %-10llu\n", +- v_t[0], +- v_t[1], +- v_t[2], +- v_t[3], +- wt[0], +- wt[1], +- wt[2], +- wt[3]); +- +- return simple_read_from_buffer(user_buf, count, ppos, +- buf, len); +-} +- +-static const struct file_operations airtime_ops = { +- .read = airtime_read, +- .open = simple_open, +- .llseek = default_llseek, +-}; +- + #ifdef CONFIG_PM + static ssize_t reset_write(struct file *file, const char __user *user_buf, + size_t count, loff_t *ppos) +@@ -672,11 +632,7 @@ void debugfs_hw_add(struct ieee80211_loc + if (local->ops->wake_tx_queue) + DEBUGFS_ADD_MODE(aqm, 0600); + +- if (wiphy_ext_feature_isset(local->hw.wiphy, +- NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) { +- DEBUGFS_ADD_MODE(airtime, 0600); +- DEBUGFS_ADD_MODE(airtime_flags, 0600); +- } ++ DEBUGFS_ADD_MODE(airtime_flags, 0600); + + DEBUGFS_ADD(aql_txq_limit); + debugfs_create_u32("aql_threshold", 0600, +--- a/net/mac80211/debugfs_netdev.c ++++ b/net/mac80211/debugfs_netdev.c +@@ -512,34 +512,6 @@ static ssize_t ieee80211_if_fmt_aqm( + } + IEEE80211_IF_FILE_R(aqm); + +-static ssize_t ieee80211_if_fmt_airtime( +- const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) +-{ +- struct ieee80211_local *local = sdata->local; +- struct ieee80211_txq *txq = sdata->vif.txq; +- struct airtime_info *air_info; +- int len; +- +- if (!txq) +- return 0; +- +- spin_lock_bh(&local->airtime[txq->ac].lock); +- air_info = to_airtime_info(txq); +- len = scnprintf(buf, +- buflen, +- "RX: %llu us\nTX: %llu us\nWeight: %u\n" +- "Virt-T: %lld us\n", +- air_info->rx_airtime, +- air_info->tx_airtime, +- air_info->weight, +- air_info->v_t); +- spin_unlock_bh(&local->airtime[txq->ac].lock); +- +- return len; +-} +- +-IEEE80211_IF_FILE_R(airtime); +- + IEEE80211_IF_FILE(multicast_to_unicast, u.ap.multicast_to_unicast, HEX); + + /* IBSS attributes */ +@@ -685,10 +657,8 @@ static void add_common_files(struct ieee + + if (sdata->local->ops->wake_tx_queue && + sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && +- sdata->vif.type != NL80211_IFTYPE_NAN) { ++ sdata->vif.type != NL80211_IFTYPE_NAN) + DEBUGFS_ADD(aqm); +- DEBUGFS_ADD(airtime); +- } + } + + static void add_sta_files(struct ieee80211_sub_if_data *sdata) +--- a/net/mac80211/debugfs_sta.c ++++ b/net/mac80211/debugfs_sta.c +@@ -202,7 +202,7 @@ static ssize_t sta_airtime_read(struct f + size_t bufsz = 400; + char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; + u64 rx_airtime = 0, tx_airtime = 0; +- u64 v_t[IEEE80211_NUM_ACS]; ++ s64 deficit[IEEE80211_NUM_ACS]; + ssize_t rv; + int ac; + +@@ -210,18 +210,18 @@ static ssize_t sta_airtime_read(struct f + return -ENOMEM; + + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { +- spin_lock_bh(&local->airtime[ac].lock); ++ spin_lock_bh(&local->active_txq_lock[ac]); + rx_airtime += sta->airtime[ac].rx_airtime; + tx_airtime += sta->airtime[ac].tx_airtime; +- v_t[ac] = sta->airtime[ac].v_t; +- spin_unlock_bh(&local->airtime[ac].lock); ++ deficit[ac] = sta->airtime[ac].deficit; ++ spin_unlock_bh(&local->active_txq_lock[ac]); + } + + p += scnprintf(p, bufsz + buf - p, + "RX: %llu us\nTX: %llu us\nWeight: %u\n" +- "Virt-T: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", +- rx_airtime, tx_airtime, sta->airtime[0].weight, +- v_t[0], v_t[1], v_t[2], v_t[3]); ++ "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", ++ rx_airtime, tx_airtime, sta->airtime_weight, ++ deficit[0], deficit[1], deficit[2], deficit[3]); + + rv = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); + kfree(buf); +@@ -236,11 +236,11 @@ static ssize_t sta_airtime_write(struct + int ac; + + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { +- spin_lock_bh(&local->airtime[ac].lock); ++ spin_lock_bh(&local->active_txq_lock[ac]); + sta->airtime[ac].rx_airtime = 0; + sta->airtime[ac].tx_airtime = 0; +- sta->airtime[ac].v_t = 0; +- spin_unlock_bh(&local->airtime[ac].lock); ++ sta->airtime[ac].deficit = sta->airtime_weight; ++ spin_unlock_bh(&local->active_txq_lock[ac]); + } + + return count; +@@ -263,10 +263,10 @@ static ssize_t sta_aql_read(struct file + return -ENOMEM; + + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { +- spin_lock_bh(&local->airtime[ac].lock); ++ spin_lock_bh(&local->active_txq_lock[ac]); + q_limit_l[ac] = sta->airtime[ac].aql_limit_low; + q_limit_h[ac] = sta->airtime[ac].aql_limit_high; +- spin_unlock_bh(&local->airtime[ac].lock); ++ spin_unlock_bh(&local->active_txq_lock[ac]); + q_depth[ac] = atomic_read(&sta->airtime[ac].aql_tx_pending); + } + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -863,16 +863,20 @@ enum txq_info_flags { + * @def_flow: used as a fallback flow when a packet destined to @tin hashes to + * a fq_flow which is already owned by a different tin + * @def_cvars: codel vars for @def_flow +- * @schedule_order: used with ieee80211_local->active_txqs + * @frags: used to keep fragments created after dequeue ++ * @schedule_order: used with ieee80211_local->active_txqs ++ * @schedule_round: counter to prevent infinite loops on TXQ scheduling + */ + struct txq_info { + struct fq_tin tin; + struct codel_vars def_cvars; + struct codel_stats cstats; +- struct rb_node schedule_order; ++ ++ u16 schedule_round; ++ struct list_head schedule_order; + + struct sk_buff_head frags; ++ + unsigned long flags; + + /* keep last! */ +@@ -949,8 +953,6 @@ struct ieee80211_sub_if_data { + struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; + struct mac80211_qos_map __rcu *qos_map; + +- struct airtime_info airtime[IEEE80211_NUM_ACS]; +- + struct work_struct csa_finalize_work; + bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ + struct cfg80211_chan_def csa_chandef; +@@ -1180,44 +1182,6 @@ enum mac80211_scan_state { + SCAN_ABORT, + }; + +-/** +- * struct airtime_sched_info - state used for airtime scheduling and AQL +- * +- * @lock: spinlock that protects all the fields in this struct +- * @active_txqs: rbtree of currently backlogged queues, sorted by virtual time +- * @schedule_pos: the current position maintained while a driver walks the tree +- * with ieee80211_next_txq() +- * @active_list: list of struct airtime_info structs that were active within +- * the last AIRTIME_ACTIVE_DURATION (100 ms), used to compute +- * weight_sum +- * @last_weight_update: used for rate limiting walking active_list +- * @last_schedule_time: tracks the last time a transmission was scheduled; used +- * for catching up v_t if no stations are eligible for +- * transmission. +- * @v_t: global virtual time; queues with v_t < this are eligible for +- * transmission +- * @weight_sum: total sum of all active stations used for dividing airtime +- * @weight_sum_reciprocal: reciprocal of weight_sum (to avoid divisions in fast +- * path - see comment above +- * IEEE80211_RECIPROCAL_DIVISOR_64) +- * @aql_txq_limit_low: AQL limit when total outstanding airtime +- * is < IEEE80211_AQL_THRESHOLD +- * @aql_txq_limit_high: AQL limit when total outstanding airtime +- * is > IEEE80211_AQL_THRESHOLD +- */ +-struct airtime_sched_info { +- spinlock_t lock; +- struct rb_root_cached active_txqs; +- struct rb_node *schedule_pos; +- struct list_head active_list; +- u64 last_weight_update; +- u64 last_schedule_activity; +- u64 v_t; +- u64 weight_sum; +- u64 weight_sum_reciprocal; +- u32 aql_txq_limit_low; +- u32 aql_txq_limit_high; +-}; + DECLARE_STATIC_KEY_FALSE(aql_disable); + + struct ieee80211_local { +@@ -1231,8 +1195,13 @@ struct ieee80211_local { + struct codel_params cparams; + + /* protects active_txqs and txqi->schedule_order */ +- struct airtime_sched_info airtime[IEEE80211_NUM_ACS]; ++ spinlock_t active_txq_lock[IEEE80211_NUM_ACS]; ++ struct list_head active_txqs[IEEE80211_NUM_ACS]; ++ u16 schedule_round[IEEE80211_NUM_ACS]; ++ + u16 airtime_flags; ++ u32 aql_txq_limit_low[IEEE80211_NUM_ACS]; ++ u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; + u32 aql_threshold; + atomic_t aql_total_pending_airtime; + +@@ -1649,125 +1618,6 @@ static inline bool txq_has_queue(struct + return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets); + } + +-static inline struct airtime_info *to_airtime_info(struct ieee80211_txq *txq) +-{ +- struct ieee80211_sub_if_data *sdata; +- struct sta_info *sta; +- +- if (txq->sta) { +- sta = container_of(txq->sta, struct sta_info, sta); +- return &sta->airtime[txq->ac]; +- } +- +- sdata = vif_to_sdata(txq->vif); +- return &sdata->airtime[txq->ac]; +-} +- +-/* To avoid divisions in the fast path, we keep pre-computed reciprocals for +- * airtime weight calculations. There are two different weights to keep track +- * of: The per-station weight and the sum of weights per phy. +- * +- * For the per-station weights (kept in airtime_info below), we use 32-bit +- * reciprocals with a devisor of 2^19. This lets us keep the multiplications and +- * divisions for the station weights as 32-bit operations at the cost of a bit +- * of rounding error for high weights; but the choice of divisor keeps rounding +- * errors <10% for weights <2^15, assuming no more than 8ms of airtime is +- * reported at a time. +- * +- * For the per-phy sum of weights the values can get higher, so we use 64-bit +- * operations for those with a 32-bit divisor, which should avoid any +- * significant rounding errors. +- */ +-#define IEEE80211_RECIPROCAL_DIVISOR_64 0x100000000ULL +-#define IEEE80211_RECIPROCAL_SHIFT_64 32 +-#define IEEE80211_RECIPROCAL_DIVISOR_32 0x80000U +-#define IEEE80211_RECIPROCAL_SHIFT_32 19 +- +-static inline void airtime_weight_set(struct airtime_info *air_info, u16 weight) +-{ +- if (air_info->weight == weight) +- return; +- +- air_info->weight = weight; +- if (weight) { +- air_info->weight_reciprocal = +- IEEE80211_RECIPROCAL_DIVISOR_32 / weight; +- } else { +- air_info->weight_reciprocal = 0; +- } +-} +- +-static inline void airtime_weight_sum_set(struct airtime_sched_info *air_sched, +- int weight_sum) +-{ +- if (air_sched->weight_sum == weight_sum) +- return; +- +- air_sched->weight_sum = weight_sum; +- if (air_sched->weight_sum) { +- air_sched->weight_sum_reciprocal = IEEE80211_RECIPROCAL_DIVISOR_64; +- do_div(air_sched->weight_sum_reciprocal, air_sched->weight_sum); +- } else { +- air_sched->weight_sum_reciprocal = 0; +- } +-} +- +-/* A problem when trying to enforce airtime fairness is that we want to divide +- * the airtime between the currently *active* stations. However, basing this on +- * the instantaneous queue state of stations doesn't work, as queues tend to +- * oscillate very quickly between empty and occupied, leading to the scheduler +- * thinking only a single station is active when deciding whether to allow +- * transmission (and thus not throttling correctly). +- * +- * To fix this we use a timer-based notion of activity: a station is considered +- * active if it has been scheduled within the last 100 ms; we keep a separate +- * list of all the stations considered active in this manner, and lazily update +- * the total weight of active stations from this list (filtering the stations in +- * the list by their 'last active' time). +- * +- * We add one additional safeguard to guard against stations that manage to get +- * scheduled every 100 ms but don't transmit a lot of data, and thus don't use +- * up any airtime. Such stations would be able to get priority for an extended +- * period of time if they do start transmitting at full capacity again, and so +- * we add an explicit maximum for how far behind a station is allowed to fall in +- * the virtual airtime domain. This limit is set to a relatively high value of +- * 20 ms because the main mechanism for catching up idle stations is the active +- * state as described above; i.e., the hard limit should only be hit in +- * pathological cases. +- */ +-#define AIRTIME_ACTIVE_DURATION (100 * NSEC_PER_MSEC) +-#define AIRTIME_MAX_BEHIND 20000 /* 20 ms */ +- +-static inline bool airtime_is_active(struct airtime_info *air_info, u64 now) +-{ +- return air_info->last_scheduled >= now - AIRTIME_ACTIVE_DURATION; +-} +- +-static inline void airtime_set_active(struct airtime_sched_info *air_sched, +- struct airtime_info *air_info, u64 now) +-{ +- air_info->last_scheduled = now; +- air_sched->last_schedule_activity = now; +- list_move_tail(&air_info->list, &air_sched->active_list); +-} +- +-static inline bool airtime_catchup_v_t(struct airtime_sched_info *air_sched, +- u64 v_t, u64 now) +-{ +- air_sched->v_t = v_t; +- return true; +-} +- +-static inline void init_airtime_info(struct airtime_info *air_info, +- struct airtime_sched_info *air_sched) +-{ +- atomic_set(&air_info->aql_tx_pending, 0); +- air_info->aql_limit_low = air_sched->aql_txq_limit_low; +- air_info->aql_limit_high = air_sched->aql_txq_limit_high; +- airtime_weight_set(air_info, IEEE80211_DEFAULT_AIRTIME_WEIGHT); +- INIT_LIST_HEAD(&air_info->list); +-} +- + static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) + { + return ether_addr_equal(raddr, addr) || +@@ -2013,14 +1863,6 @@ int ieee80211_tx_control_port(struct wip + u64 *cookie); + int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, + const u8 *buf, size_t len); +-void ieee80211_resort_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq); +-void ieee80211_unschedule_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq, +- bool purge); +-void ieee80211_update_airtime_weight(struct ieee80211_local *local, +- struct airtime_sched_info *air_sched, +- u64 now, bool force); + + /* HT */ + void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -2192,9 +2192,6 @@ int ieee80211_if_add(struct ieee80211_lo + } + } + +- for (i = 0; i < IEEE80211_NUM_ACS; i++) +- init_airtime_info(&sdata->airtime[i], &local->airtime[i]); +- + ieee80211_set_default_queues(sdata); + + sdata->ap_power_level = IEEE80211_UNSET_POWER_LEVEL; +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -707,13 +707,10 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + spin_lock_init(&local->queue_stop_reason_lock); + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { +- struct airtime_sched_info *air_sched = &local->airtime[i]; +- +- air_sched->active_txqs = RB_ROOT_CACHED; +- INIT_LIST_HEAD(&air_sched->active_list); +- spin_lock_init(&air_sched->lock); +- air_sched->aql_txq_limit_low = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; +- air_sched->aql_txq_limit_high = ++ INIT_LIST_HEAD(&local->active_txqs[i]); ++ spin_lock_init(&local->active_txq_lock[i]); ++ local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; ++ local->aql_txq_limit_high[i] = + IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; + } + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -1584,8 +1584,12 @@ static void sta_ps_start(struct sta_info + + for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) { + struct ieee80211_txq *txq = sta->sta.txq[tid]; ++ struct txq_info *txqi = to_txq_info(txq); + +- ieee80211_unschedule_txq(&local->hw, txq, false); ++ spin_lock(&local->active_txq_lock[txq->ac]); ++ if (!list_empty(&txqi->schedule_order)) ++ list_del_init(&txqi->schedule_order); ++ spin_unlock(&local->active_txq_lock[txq->ac]); + + if (txq_has_queue(txq)) + set_bit(tid, &sta->txq_buffered_tids); +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -426,11 +426,15 @@ struct sta_info *sta_info_alloc(struct i + if (sta_prepare_rate_control(local, sta, gfp)) + goto free_txq; + ++ sta->airtime_weight = IEEE80211_DEFAULT_AIRTIME_WEIGHT; + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + skb_queue_head_init(&sta->ps_tx_buf[i]); + skb_queue_head_init(&sta->tx_filtered[i]); +- init_airtime_info(&sta->airtime[i], &local->airtime[i]); ++ sta->airtime[i].deficit = sta->airtime_weight; ++ atomic_set(&sta->airtime[i].aql_tx_pending, 0); ++ sta->airtime[i].aql_limit_low = local->aql_txq_limit_low[i]; ++ sta->airtime[i].aql_limit_high = local->aql_txq_limit_high[i]; + } + + for (i = 0; i < IEEE80211_NUM_TIDS; i++) +@@ -1889,59 +1893,24 @@ void ieee80211_sta_set_buffered(struct i + } + EXPORT_SYMBOL(ieee80211_sta_set_buffered); + +-void ieee80211_register_airtime(struct ieee80211_txq *txq, +- u32 tx_airtime, u32 rx_airtime) ++void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, ++ u32 tx_airtime, u32 rx_airtime) + { +- struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->vif); +- struct ieee80211_local *local = sdata->local; +- u64 weight_sum, weight_sum_reciprocal; +- struct airtime_sched_info *air_sched; +- struct airtime_info *air_info; ++ struct sta_info *sta = container_of(pubsta, struct sta_info, sta); ++ struct ieee80211_local *local = sta->sdata->local; ++ u8 ac = ieee80211_ac_from_tid(tid); + u32 airtime = 0; + +- air_sched = &local->airtime[txq->ac]; +- air_info = to_airtime_info(txq); +- +- if (local->airtime_flags & AIRTIME_USE_TX) ++ if (sta->local->airtime_flags & AIRTIME_USE_TX) + airtime += tx_airtime; +- if (local->airtime_flags & AIRTIME_USE_RX) ++ if (sta->local->airtime_flags & AIRTIME_USE_RX) + airtime += rx_airtime; + +- /* Weights scale so the unit weight is 256 */ +- airtime <<= 8; +- +- spin_lock_bh(&air_sched->lock); +- +- air_info->tx_airtime += tx_airtime; +- air_info->rx_airtime += rx_airtime; +- +- if (air_sched->weight_sum) { +- weight_sum = air_sched->weight_sum; +- weight_sum_reciprocal = air_sched->weight_sum_reciprocal; +- } else { +- weight_sum = air_info->weight; +- weight_sum_reciprocal = air_info->weight_reciprocal; +- } +- +- /* Round the calculation of global vt */ +- air_sched->v_t += (u64)((airtime + (weight_sum >> 1)) * +- weight_sum_reciprocal) >> IEEE80211_RECIPROCAL_SHIFT_64; +- air_info->v_t += (u32)((airtime + (air_info->weight >> 1)) * +- air_info->weight_reciprocal) >> IEEE80211_RECIPROCAL_SHIFT_32; +- ieee80211_resort_txq(&local->hw, txq); +- +- spin_unlock_bh(&air_sched->lock); +-} +- +-void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid, +- u32 tx_airtime, u32 rx_airtime) +-{ +- struct ieee80211_txq *txq = pubsta->txq[tid]; +- +- if (!txq) +- return; +- +- ieee80211_register_airtime(txq, tx_airtime, rx_airtime); ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ sta->airtime[ac].tx_airtime += tx_airtime; ++ sta->airtime[ac].rx_airtime += rx_airtime; ++ sta->airtime[ac].deficit -= airtime; ++ spin_unlock_bh(&local->active_txq_lock[ac]); + } + EXPORT_SYMBOL(ieee80211_sta_register_airtime); + +@@ -2385,7 +2354,7 @@ void sta_set_sinfo(struct sta_info *sta, + } + + if (!(sinfo->filled & BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT))) { +- sinfo->airtime_weight = sta->airtime[0].weight; ++ sinfo->airtime_weight = sta->airtime_weight; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_AIRTIME_WEIGHT); + } + +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -135,25 +135,18 @@ enum ieee80211_agg_stop_reason { + #define AIRTIME_USE_TX BIT(0) + #define AIRTIME_USE_RX BIT(1) + +- + struct airtime_info { + u64 rx_airtime; + u64 tx_airtime; +- u64 v_t; +- u64 last_scheduled; +- struct list_head list; ++ s64 deficit; + atomic_t aql_tx_pending; /* Estimated airtime for frames pending */ + u32 aql_limit_low; + u32 aql_limit_high; +- u32 weight_reciprocal; +- u16 weight; + }; + + void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local, + struct sta_info *sta, u8 ac, + u16 tx_airtime, bool tx_completed); +-void ieee80211_register_airtime(struct ieee80211_txq *txq, +- u32 tx_airtime, u32 rx_airtime); + + struct sta_info; + +@@ -523,6 +516,7 @@ struct ieee80211_fragment_cache { + * @tid_seq: per-TID sequence numbers for sending to this STA + * @airtime: per-AC struct airtime_info describing airtime statistics for this + * station ++ * @airtime_weight: station weight for airtime fairness calculation purposes + * @ampdu_mlme: A-MPDU state machine state + * @mesh: mesh STA information + * @debugfs_dir: debug filesystem directory dentry +@@ -653,6 +647,7 @@ struct sta_info { + u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; + + struct airtime_info airtime[IEEE80211_NUM_ACS]; ++ u16 airtime_weight; + + /* + * Aggregation information, locked with lock. +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -983,25 +983,6 @@ static void __ieee80211_tx_status(struct + if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked) + ieee80211_frame_acked(sta, skb); + +- } else if (wiphy_ext_feature_isset(local->hw.wiphy, +- NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) { +- struct ieee80211_sub_if_data *sdata; +- struct ieee80211_txq *txq; +- u32 airtime; +- +- /* Account airtime to multicast queue */ +- sdata = ieee80211_sdata_from_skb(local, skb); +- +- if (sdata && (txq = sdata->vif.txq)) { +- airtime = info->status.tx_time ?: +- ieee80211_calc_expected_tx_airtime(hw, +- &sdata->vif, +- NULL, +- skb->len, +- false); +- +- ieee80211_register_airtime(txq, airtime, 0); +- } + } + + /* SNMP counters +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -18,7 +18,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -1480,7 +1479,7 @@ void ieee80211_txq_init(struct ieee80211 + codel_vars_init(&txqi->def_cvars); + codel_stats_init(&txqi->cstats); + __skb_queue_head_init(&txqi->frags); +- RB_CLEAR_NODE(&txqi->schedule_order); ++ INIT_LIST_HEAD(&txqi->schedule_order); + + txqi->txq.vif = &sdata->vif; + +@@ -1524,7 +1523,9 @@ void ieee80211_txq_purge(struct ieee8021 + ieee80211_purge_tx_queue(&local->hw, &txqi->frags); + spin_unlock_bh(&fq->lock); + +- ieee80211_unschedule_txq(&local->hw, &txqi->txq, true); ++ spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]); ++ list_del_init(&txqi->schedule_order); ++ spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]); + } + + void ieee80211_txq_set_params(struct ieee80211_local *local) +@@ -3819,259 +3820,102 @@ EXPORT_SYMBOL(ieee80211_tx_dequeue); + struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) + { + struct ieee80211_local *local = hw_to_local(hw); +- struct airtime_sched_info *air_sched; +- u64 now = ktime_get_coarse_boottime_ns(); + struct ieee80211_txq *ret = NULL; +- struct airtime_info *air_info; +- struct txq_info *txqi = NULL; +- struct rb_node *node; +- bool first = false; ++ struct txq_info *txqi = NULL, *head = NULL; ++ bool found_eligible_txq = false; + +- air_sched = &local->airtime[ac]; +- spin_lock_bh(&air_sched->lock); ++ spin_lock_bh(&local->active_txq_lock[ac]); + +- node = air_sched->schedule_pos; +- +-begin: +- if (!node) { +- node = rb_first_cached(&air_sched->active_txqs); +- first = true; +- } else { +- node = rb_next(node); +- } +- +- if (!node) +- goto out; +- +- txqi = container_of(node, struct txq_info, schedule_order); +- air_info = to_airtime_info(&txqi->txq); +- +- if (air_info->v_t > air_sched->v_t && +- (!first || !airtime_catchup_v_t(air_sched, air_info->v_t, now))) ++ begin: ++ txqi = list_first_entry_or_null(&local->active_txqs[ac], ++ struct txq_info, ++ schedule_order); ++ if (!txqi) + goto out; + +- if (!ieee80211_txq_airtime_check(hw, &txqi->txq)) { +- first = false; +- goto begin; +- } +- +- air_sched->schedule_pos = node; +- air_sched->last_schedule_activity = now; +- ret = &txqi->txq; +-out: +- spin_unlock_bh(&air_sched->lock); +- return ret; +-} +-EXPORT_SYMBOL(ieee80211_next_txq); +- +-static void __ieee80211_insert_txq(struct rb_root_cached *root, +- struct txq_info *txqi) +-{ +- struct rb_node **new = &root->rb_root.rb_node; +- struct airtime_info *old_air, *new_air; +- struct rb_node *parent = NULL; +- struct txq_info *__txqi; +- bool leftmost = true; +- +- while (*new) { +- parent = *new; +- __txqi = rb_entry(parent, struct txq_info, schedule_order); +- old_air = to_airtime_info(&__txqi->txq); +- new_air = to_airtime_info(&txqi->txq); +- +- if (new_air->v_t <= old_air->v_t) { +- new = &parent->rb_left; +- } else { +- new = &parent->rb_right; +- leftmost = false; +- } ++ if (txqi == head) { ++ if (!found_eligible_txq) ++ goto out; ++ else ++ found_eligible_txq = false; + } + +- rb_link_node(&txqi->schedule_order, parent, new); +- rb_insert_color_cached(&txqi->schedule_order, root, leftmost); +-} +- +-void ieee80211_resort_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq) +-{ +- struct airtime_info *air_info = to_airtime_info(txq); +- struct ieee80211_local *local = hw_to_local(hw); +- struct txq_info *txqi = to_txq_info(txq); +- struct airtime_sched_info *air_sched; +- +- air_sched = &local->airtime[txq->ac]; ++ if (!head) ++ head = txqi; + +- lockdep_assert_held(&air_sched->lock); +- +- if (!RB_EMPTY_NODE(&txqi->schedule_order)) { +- struct airtime_info *a_prev = NULL, *a_next = NULL; +- struct txq_info *t_prev, *t_next; +- struct rb_node *n_prev, *n_next; ++ if (txqi->txq.sta) { ++ struct sta_info *sta = container_of(txqi->txq.sta, ++ struct sta_info, sta); ++ bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); ++ s64 deficit = sta->airtime[txqi->txq.ac].deficit; + +- /* Erasing a node can cause an expensive rebalancing operation, +- * so we check the previous and next nodes first and only remove +- * and re-insert if the current node is not already in the +- * correct position. +- */ +- if ((n_prev = rb_prev(&txqi->schedule_order)) != NULL) { +- t_prev = container_of(n_prev, struct txq_info, +- schedule_order); +- a_prev = to_airtime_info(&t_prev->txq); +- } ++ if (aql_check) ++ found_eligible_txq = true; + +- if ((n_next = rb_next(&txqi->schedule_order)) != NULL) { +- t_next = container_of(n_next, struct txq_info, +- schedule_order); +- a_next = to_airtime_info(&t_next->txq); ++ if (deficit < 0) ++ sta->airtime[txqi->txq.ac].deficit += ++ sta->airtime_weight; ++ ++ if (deficit < 0 || !aql_check) { ++ list_move_tail(&txqi->schedule_order, ++ &local->active_txqs[txqi->txq.ac]); ++ goto begin; + } +- +- if ((!a_prev || a_prev->v_t <= air_info->v_t) && +- (!a_next || a_next->v_t > air_info->v_t)) +- return; +- +- if (air_sched->schedule_pos == &txqi->schedule_order) +- air_sched->schedule_pos = n_prev; +- +- rb_erase_cached(&txqi->schedule_order, +- &air_sched->active_txqs); +- RB_CLEAR_NODE(&txqi->schedule_order); +- __ieee80211_insert_txq(&air_sched->active_txqs, txqi); + } +-} +- +-void ieee80211_update_airtime_weight(struct ieee80211_local *local, +- struct airtime_sched_info *air_sched, +- u64 now, bool force) +-{ +- struct airtime_info *air_info, *tmp; +- u64 weight_sum = 0; +- +- if (unlikely(!now)) +- now = ktime_get_coarse_boottime_ns(); +- +- lockdep_assert_held(&air_sched->lock); +- +- if (!force && (air_sched->last_weight_update < +- now - AIRTIME_ACTIVE_DURATION)) +- return; +- +- list_for_each_entry_safe(air_info, tmp, +- &air_sched->active_list, list) { +- if (airtime_is_active(air_info, now)) +- weight_sum += air_info->weight; +- else +- list_del_init(&air_info->list); +- } +- airtime_weight_sum_set(air_sched, weight_sum); +- air_sched->last_weight_update = now; +-} + +-void ieee80211_schedule_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq) +- __acquires(txq_lock) __releases(txq_lock) +-{ +- struct ieee80211_local *local = hw_to_local(hw); +- struct txq_info *txqi = to_txq_info(txq); +- struct airtime_sched_info *air_sched; +- u64 now = ktime_get_coarse_boottime_ns(); +- struct airtime_info *air_info; +- u8 ac = txq->ac; +- bool was_active; + +- air_sched = &local->airtime[ac]; +- air_info = to_airtime_info(txq); +- +- spin_lock_bh(&air_sched->lock); +- was_active = airtime_is_active(air_info, now); +- airtime_set_active(air_sched, air_info, now); +- +- if (!RB_EMPTY_NODE(&txqi->schedule_order)) ++ if (txqi->schedule_round == local->schedule_round[ac]) + goto out; + +- /* If the station has been inactive for a while, catch up its v_t so it +- * doesn't get indefinite priority; see comment above the definition of +- * AIRTIME_MAX_BEHIND. +- */ +- if ((!was_active && air_info->v_t < air_sched->v_t) || +- air_info->v_t < air_sched->v_t - AIRTIME_MAX_BEHIND) +- air_info->v_t = air_sched->v_t; +- +- ieee80211_update_airtime_weight(local, air_sched, now, !was_active); +- __ieee80211_insert_txq(&air_sched->active_txqs, txqi); ++ list_del_init(&txqi->schedule_order); ++ txqi->schedule_round = local->schedule_round[ac]; ++ ret = &txqi->txq; + + out: +- spin_unlock_bh(&air_sched->lock); +-} +-EXPORT_SYMBOL(ieee80211_schedule_txq); +- +-static void __ieee80211_unschedule_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq, +- bool purge) +-{ +- struct ieee80211_local *local = hw_to_local(hw); +- struct txq_info *txqi = to_txq_info(txq); +- struct airtime_sched_info *air_sched; +- struct airtime_info *air_info; +- +- air_sched = &local->airtime[txq->ac]; +- air_info = to_airtime_info(&txqi->txq); +- +- lockdep_assert_held(&air_sched->lock); +- +- if (purge) { +- list_del_init(&air_info->list); +- ieee80211_update_airtime_weight(local, air_sched, 0, true); +- } +- +- if (RB_EMPTY_NODE(&txqi->schedule_order)) +- return; +- +- if (air_sched->schedule_pos == &txqi->schedule_order) +- air_sched->schedule_pos = rb_prev(&txqi->schedule_order); +- +- if (!purge) +- airtime_set_active(air_sched, air_info, +- ktime_get_coarse_boottime_ns()); +- +- rb_erase_cached(&txqi->schedule_order, +- &air_sched->active_txqs); +- RB_CLEAR_NODE(&txqi->schedule_order); ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++ return ret; + } ++EXPORT_SYMBOL(ieee80211_next_txq); + +-void ieee80211_unschedule_txq(struct ieee80211_hw *hw, ++void __ieee80211_schedule_txq(struct ieee80211_hw *hw, + struct ieee80211_txq *txq, +- bool purge) +- __acquires(txq_lock) __releases(txq_lock) +-{ +- struct ieee80211_local *local = hw_to_local(hw); +- +- spin_lock_bh(&local->airtime[txq->ac].lock); +- __ieee80211_unschedule_txq(hw, txq, purge); +- spin_unlock_bh(&local->airtime[txq->ac].lock); +-} +- +-void ieee80211_return_txq(struct ieee80211_hw *hw, +- struct ieee80211_txq *txq, bool force) ++ bool force) + { + struct ieee80211_local *local = hw_to_local(hw); + struct txq_info *txqi = to_txq_info(txq); + +- spin_lock_bh(&local->airtime[txq->ac].lock); ++ spin_lock_bh(&local->active_txq_lock[txq->ac]); + +- if (!RB_EMPTY_NODE(&txqi->schedule_order) && !force && +- !txq_has_queue(txq)) +- __ieee80211_unschedule_txq(hw, txq, false); ++ if (list_empty(&txqi->schedule_order) && ++ (force || !skb_queue_empty(&txqi->frags) || ++ txqi->tin.backlog_packets)) { ++ /* If airtime accounting is active, always enqueue STAs at the ++ * head of the list to ensure that they only get moved to the ++ * back by the airtime DRR scheduler once they have a negative ++ * deficit. A station that already has a negative deficit will ++ * get immediately moved to the back of the list on the next ++ * call to ieee80211_next_txq(). ++ */ ++ if (txqi->txq.sta && local->airtime_flags && ++ wiphy_ext_feature_isset(local->hw.wiphy, ++ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) ++ list_add(&txqi->schedule_order, ++ &local->active_txqs[txq->ac]); ++ else ++ list_add_tail(&txqi->schedule_order, ++ &local->active_txqs[txq->ac]); ++ } + +- spin_unlock_bh(&local->airtime[txq->ac].lock); ++ spin_unlock_bh(&local->active_txq_lock[txq->ac]); + } +-EXPORT_SYMBOL(ieee80211_return_txq); ++EXPORT_SYMBOL(__ieee80211_schedule_txq); + + DEFINE_STATIC_KEY_FALSE(aql_disable); + + bool ieee80211_txq_airtime_check(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + { +- struct airtime_info *air_info = to_airtime_info(txq); ++ struct sta_info *sta; + struct ieee80211_local *local = hw_to_local(hw); + + if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) +@@ -4086,12 +3930,15 @@ bool ieee80211_txq_airtime_check(struct + if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) + return true; + +- if (atomic_read(&air_info->aql_tx_pending) < air_info->aql_limit_low) ++ sta = container_of(txq->sta, struct sta_info, sta); ++ if (atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < ++ sta->airtime[txq->ac].aql_limit_low) + return true; + + if (atomic_read(&local->aql_total_pending_airtime) < + local->aql_threshold && +- atomic_read(&air_info->aql_tx_pending) < air_info->aql_limit_high) ++ atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < ++ sta->airtime[txq->ac].aql_limit_high) + return true; + + return false; +@@ -4101,59 +3948,60 @@ EXPORT_SYMBOL(ieee80211_txq_airtime_chec + bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + { +- struct txq_info *first_txqi = NULL, *txqi = to_txq_info(txq); + struct ieee80211_local *local = hw_to_local(hw); +- struct airtime_sched_info *air_sched; +- struct airtime_info *air_info; +- struct rb_node *node = NULL; +- bool ret = false; +- u64 now; +- ++ struct txq_info *iter, *tmp, *txqi = to_txq_info(txq); ++ struct sta_info *sta; ++ u8 ac = txq->ac; + +- if (!ieee80211_txq_airtime_check(hw, txq)) +- return false; ++ spin_lock_bh(&local->active_txq_lock[ac]); + +- air_sched = &local->airtime[txq->ac]; +- spin_lock_bh(&air_sched->lock); ++ if (!txqi->txq.sta) ++ goto out; + +- if (RB_EMPTY_NODE(&txqi->schedule_order)) ++ if (list_empty(&txqi->schedule_order)) + goto out; + +- now = ktime_get_coarse_boottime_ns(); ++ list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac], ++ schedule_order) { ++ if (iter == txqi) ++ break; + +- /* Like in ieee80211_next_txq(), make sure the first station in the +- * scheduling order is eligible for transmission to avoid starvation. +- */ +- node = rb_first_cached(&air_sched->active_txqs); +- if (node) { +- first_txqi = container_of(node, struct txq_info, +- schedule_order); +- air_info = to_airtime_info(&first_txqi->txq); +- +- if (air_sched->v_t < air_info->v_t) +- airtime_catchup_v_t(air_sched, air_info->v_t, now); ++ if (!iter->txq.sta) { ++ list_move_tail(&iter->schedule_order, ++ &local->active_txqs[ac]); ++ continue; ++ } ++ sta = container_of(iter->txq.sta, struct sta_info, sta); ++ if (sta->airtime[ac].deficit < 0) ++ sta->airtime[ac].deficit += sta->airtime_weight; ++ list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); + } + +- air_info = to_airtime_info(&txqi->txq); +- if (air_info->v_t <= air_sched->v_t) { +- air_sched->last_schedule_activity = now; +- ret = true; +- } ++ sta = container_of(txqi->txq.sta, struct sta_info, sta); ++ if (sta->airtime[ac].deficit >= 0) ++ goto out; ++ ++ sta->airtime[ac].deficit += sta->airtime_weight; ++ list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); ++ spin_unlock_bh(&local->active_txq_lock[ac]); + ++ return false; + out: +- spin_unlock_bh(&air_sched->lock); +- return ret; ++ if (!list_empty(&txqi->schedule_order)) ++ list_del_init(&txqi->schedule_order); ++ spin_unlock_bh(&local->active_txq_lock[ac]); ++ ++ return true; + } + EXPORT_SYMBOL(ieee80211_txq_may_transmit); + + void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac) + { + struct ieee80211_local *local = hw_to_local(hw); +- struct airtime_sched_info *air_sched = &local->airtime[ac]; + +- spin_lock_bh(&air_sched->lock); +- air_sched->schedule_pos = NULL; +- spin_unlock_bh(&air_sched->lock); ++ spin_lock_bh(&local->active_txq_lock[ac]); ++ local->schedule_round[ac]++; ++ spin_unlock_bh(&local->active_txq_lock[ac]); + } + EXPORT_SYMBOL(ieee80211_txq_schedule_start); + diff --git a/package/kernel/mac80211/patches/subsys/331-mac80211-make-sta-airtime-deficit-field-s32-instead-.patch b/package/kernel/mac80211/patches/subsys/331-mac80211-make-sta-airtime-deficit-field-s32-instead-.patch new file mode 100644 index 000000000..c006d3762 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/331-mac80211-make-sta-airtime-deficit-field-s32-instead-.patch @@ -0,0 +1,52 @@ +From: Felix Fietkau +Date: Mon, 20 Jun 2022 14:53:04 +0200 +Subject: [PATCH] mac80211: make sta airtime deficit field s32 instead of + s64 + +32 bit is more than enough range for the airtime deficit + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/debugfs_sta.c ++++ b/net/mac80211/debugfs_sta.c +@@ -202,7 +202,7 @@ static ssize_t sta_airtime_read(struct f + size_t bufsz = 400; + char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf; + u64 rx_airtime = 0, tx_airtime = 0; +- s64 deficit[IEEE80211_NUM_ACS]; ++ s32 deficit[IEEE80211_NUM_ACS]; + ssize_t rv; + int ac; + +@@ -219,7 +219,7 @@ static ssize_t sta_airtime_read(struct f + + p += scnprintf(p, bufsz + buf - p, + "RX: %llu us\nTX: %llu us\nWeight: %u\n" +- "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n", ++ "Deficit: VO: %d us VI: %d us BE: %d us BK: %d us\n", + rx_airtime, tx_airtime, sta->airtime_weight, + deficit[0], deficit[1], deficit[2], deficit[3]); + +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -138,7 +138,7 @@ enum ieee80211_agg_stop_reason { + struct airtime_info { + u64 rx_airtime; + u64 tx_airtime; +- s64 deficit; ++ s32 deficit; + atomic_t aql_tx_pending; /* Estimated airtime for frames pending */ + u32 aql_limit_low; + u32 aql_limit_high; +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3847,7 +3847,7 @@ struct ieee80211_txq *ieee80211_next_txq + struct sta_info *sta = container_of(txqi->txq.sta, + struct sta_info, sta); + bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); +- s64 deficit = sta->airtime[txqi->txq.ac].deficit; ++ s32 deficit = sta->airtime[txqi->txq.ac].deficit; + + if (aql_check) + found_eligible_txq = true; diff --git a/package/kernel/mac80211/patches/subsys/332-mac80211-consider-aql_tx_pending-when-checking-airti.patch b/package/kernel/mac80211/patches/subsys/332-mac80211-consider-aql_tx_pending-when-checking-airti.patch new file mode 100644 index 000000000..c21429460 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/332-mac80211-consider-aql_tx_pending-when-checking-airti.patch @@ -0,0 +1,48 @@ +From: Felix Fietkau +Date: Mon, 20 Jun 2022 14:59:09 +0200 +Subject: [PATCH] mac80211: consider aql_tx_pending when checking airtime + deficit + +When queueing packets for a station, deficit only gets added once the packets +have been transmitted, which could be much later. During that time, a lot of +temporary unfairness could happen, which could lead to bursty behavior. +Fix this by subtracting the aql_tx_pending when checking the deficit in tx +scheduling. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3817,6 +3817,13 @@ out: + } + EXPORT_SYMBOL(ieee80211_tx_dequeue); + ++static inline s32 ieee80211_sta_deficit(struct sta_info *sta, u8 ac) ++{ ++ struct airtime_info *air_info = &sta->airtime[ac]; ++ ++ return air_info->deficit - atomic_read(&air_info->aql_tx_pending); ++} ++ + struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) + { + struct ieee80211_local *local = hw_to_local(hw); +@@ -3847,7 +3854,7 @@ struct ieee80211_txq *ieee80211_next_txq + struct sta_info *sta = container_of(txqi->txq.sta, + struct sta_info, sta); + bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); +- s32 deficit = sta->airtime[txqi->txq.ac].deficit; ++ s32 deficit = ieee80211_sta_deficit(sta, txqi->txq.ac); + + if (aql_check) + found_eligible_txq = true; +@@ -3972,7 +3979,7 @@ bool ieee80211_txq_may_transmit(struct i + continue; + } + sta = container_of(iter->txq.sta, struct sta_info, sta); +- if (sta->airtime[ac].deficit < 0) ++ if (ieee80211_sta_deficit(sta, ac) < 0) + sta->airtime[ac].deficit += sta->airtime_weight; + list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); + } diff --git a/package/kernel/mac80211/patches/subsys/333-mac80211-keep-recently-active-tx-queues-in-schedulin.patch b/package/kernel/mac80211/patches/subsys/333-mac80211-keep-recently-active-tx-queues-in-schedulin.patch new file mode 100644 index 000000000..317e4f065 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/333-mac80211-keep-recently-active-tx-queues-in-schedulin.patch @@ -0,0 +1,118 @@ +From: Felix Fietkau +Date: Mon, 20 Jun 2022 20:52:50 +0200 +Subject: [PATCH] mac80211: keep recently active tx queues in scheduling + list + +This allows proper deficit accounting to ensure that they don't carry their +deficit until the next time they become active + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -83,6 +83,13 @@ extern const u8 ieee80211_ac_to_qos_mask + + #define IEEE80211_MAX_NAN_INSTANCE_ID 255 + ++ ++/* ++ * Keep a station's queues on the active list for deficit accounting purposes ++ * if it was active or queued during the last 100ms ++ */ ++#define AIRTIME_ACTIVE_DURATION (HZ / 10) ++ + struct ieee80211_bss { + u32 device_ts_beacon, device_ts_presp; + +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -138,6 +138,7 @@ enum ieee80211_agg_stop_reason { + struct airtime_info { + u64 rx_airtime; + u64 tx_airtime; ++ u32 last_active; + s32 deficit; + atomic_t aql_tx_pending; /* Estimated airtime for frames pending */ + u32 aql_limit_low; +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3824,6 +3824,36 @@ static inline s32 ieee80211_sta_deficit( + return air_info->deficit - atomic_read(&air_info->aql_tx_pending); + } + ++static void ++ieee80211_txq_set_active(struct txq_info *txqi) ++{ ++ struct sta_info *sta; ++ ++ if (!txqi->txq.sta) ++ return; ++ ++ sta = container_of(txqi->txq.sta, struct sta_info, sta); ++ sta->airtime[txqi->txq.ac].last_active = (u32)jiffies; ++} ++ ++static bool ++ieee80211_txq_keep_active(struct txq_info *txqi) ++{ ++ struct sta_info *sta; ++ u32 diff; ++ ++ if (!txqi->txq.sta) ++ return false; ++ ++ sta = container_of(txqi->txq.sta, struct sta_info, sta); ++ if (ieee80211_sta_deficit(sta, txqi->txq.ac) >= 0) ++ return false; ++ ++ diff = (u32)jiffies - sta->airtime[txqi->txq.ac].last_active; ++ ++ return diff <= AIRTIME_ACTIVE_DURATION; ++} ++ + struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac) + { + struct ieee80211_local *local = hw_to_local(hw); +@@ -3870,7 +3900,6 @@ struct ieee80211_txq *ieee80211_next_txq + } + } + +- + if (txqi->schedule_round == local->schedule_round[ac]) + goto out; + +@@ -3890,12 +3919,13 @@ void __ieee80211_schedule_txq(struct iee + { + struct ieee80211_local *local = hw_to_local(hw); + struct txq_info *txqi = to_txq_info(txq); ++ bool has_queue; + + spin_lock_bh(&local->active_txq_lock[txq->ac]); + ++ has_queue = force || txq_has_queue(txq); + if (list_empty(&txqi->schedule_order) && +- (force || !skb_queue_empty(&txqi->frags) || +- txqi->tin.backlog_packets)) { ++ (has_queue || ieee80211_txq_keep_active(txqi))) { + /* If airtime accounting is active, always enqueue STAs at the + * head of the list to ensure that they only get moved to the + * back by the airtime DRR scheduler once they have a negative +@@ -3903,7 +3933,7 @@ void __ieee80211_schedule_txq(struct iee + * get immediately moved to the back of the list on the next + * call to ieee80211_next_txq(). + */ +- if (txqi->txq.sta && local->airtime_flags && ++ if (txqi->txq.sta && local->airtime_flags && has_queue && + wiphy_ext_feature_isset(local->hw.wiphy, + NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) + list_add(&txqi->schedule_order, +@@ -3911,6 +3941,8 @@ void __ieee80211_schedule_txq(struct iee + else + list_add_tail(&txqi->schedule_order, + &local->active_txqs[txq->ac]); ++ if (has_queue) ++ ieee80211_txq_set_active(txqi); + } + + spin_unlock_bh(&local->active_txq_lock[txq->ac]); diff --git a/package/kernel/mac80211/patches/subsys/334-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch b/package/kernel/mac80211/patches/subsys/334-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch new file mode 100644 index 000000000..89718a827 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/334-mac80211-add-a-per-PHY-AQL-limit-to-improve-fairness.patch @@ -0,0 +1,131 @@ +From: Felix Fietkau +Date: Mon, 20 Jun 2022 21:26:34 +0200 +Subject: [PATCH] mac80211: add a per-PHY AQL limit to improve fairness + +In order to maintain fairness, the amount of queueing needs to be limited +beyond the simple per-station AQL budget, otherwise the driver can simply +repeatedly do scheduling rounds until all queues that have not used their +AQL budget become eligble. + +To be conservative, use the high AQL limit for the first txq and add half +of the low AQL for each subsequent queue. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1211,6 +1211,7 @@ struct ieee80211_local { + u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; + u32 aql_threshold; + atomic_t aql_total_pending_airtime; ++ atomic_t aql_ac_pending_airtime[IEEE80211_NUM_ACS]; + + const struct ieee80211_ops *ops; + +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -712,6 +712,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; + local->aql_txq_limit_high[i] = + IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H; ++ atomic_set(&local->aql_ac_pending_airtime[i], 0); + } + + local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1929,6 +1929,7 @@ void ieee80211_sta_update_pending_airtim + &sta->airtime[ac].aql_tx_pending); + + atomic_add(tx_airtime, &local->aql_total_pending_airtime); ++ atomic_add(tx_airtime, &local->aql_ac_pending_airtime[ac]); + return; + } + +@@ -1940,14 +1941,17 @@ void ieee80211_sta_update_pending_airtim + tx_pending, 0); + } + ++ atomic_sub(tx_airtime, &local->aql_total_pending_airtime); + tx_pending = atomic_sub_return(tx_airtime, +- &local->aql_total_pending_airtime); ++ &local->aql_ac_pending_airtime[ac]); + if (WARN_ONCE(tx_pending < 0, + "Device %s AC %d pending airtime underflow: %u, %u", + wiphy_name(local->hw.wiphy), ac, tx_pending, +- tx_airtime)) +- atomic_cmpxchg(&local->aql_total_pending_airtime, ++ tx_airtime)) { ++ atomic_cmpxchg(&local->aql_ac_pending_airtime[ac], + tx_pending, 0); ++ atomic_sub(tx_pending, &local->aql_total_pending_airtime); ++ } + } + + int sta_info_move_state(struct sta_info *sta, +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3863,6 +3863,9 @@ struct ieee80211_txq *ieee80211_next_txq + + spin_lock_bh(&local->active_txq_lock[ac]); + ++ if (!local->schedule_round[ac]) ++ goto out; ++ + begin: + txqi = list_first_entry_or_null(&local->active_txqs[ac], + struct txq_info, +@@ -3984,6 +3987,25 @@ bool ieee80211_txq_airtime_check(struct + } + EXPORT_SYMBOL(ieee80211_txq_airtime_check); + ++static bool ++ieee80211_txq_schedule_airtime_check(struct ieee80211_local *local, u8 ac) ++{ ++ unsigned int num_txq = 0; ++ struct txq_info *txq; ++ u32 aql_limit; ++ ++ if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) ++ return true; ++ ++ list_for_each_entry(txq, &local->active_txqs[ac], schedule_order) ++ num_txq++; ++ ++ aql_limit = (num_txq - 1) * local->aql_txq_limit_low[ac] / 2 + ++ local->aql_txq_limit_high[ac]; ++ ++ return atomic_read(&local->aql_ac_pending_airtime[ac]) < aql_limit; ++} ++ + bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) + { +@@ -4000,6 +4022,9 @@ bool ieee80211_txq_may_transmit(struct i + if (list_empty(&txqi->schedule_order)) + goto out; + ++ if (!ieee80211_txq_schedule_airtime_check(local, ac)) ++ goto out; ++ + list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac], + schedule_order) { + if (iter == txqi) +@@ -4039,7 +4064,15 @@ void ieee80211_txq_schedule_start(struct + struct ieee80211_local *local = hw_to_local(hw); + + spin_lock_bh(&local->active_txq_lock[ac]); +- local->schedule_round[ac]++; ++ ++ if (ieee80211_txq_schedule_airtime_check(local, ac)) { ++ local->schedule_round[ac]++; ++ if (!local->schedule_round[ac]) ++ local->schedule_round[ac]++; ++ } else { ++ local->schedule_round[ac] = 0; ++ } ++ + spin_unlock_bh(&local->active_txq_lock[ac]); + } + EXPORT_SYMBOL(ieee80211_txq_schedule_start); diff --git a/package/kernel/mac80211/patches/subsys/335-mac80211-add-debugfs-file-to-display-per-phy-AQL-pen.patch b/package/kernel/mac80211/patches/subsys/335-mac80211-add-debugfs-file-to-display-per-phy-AQL-pen.patch new file mode 100644 index 000000000..df45a520f --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/335-mac80211-add-debugfs-file-to-display-per-phy-AQL-pen.patch @@ -0,0 +1,58 @@ +From: Felix Fietkau +Date: Sat, 25 Jun 2022 21:25:40 +0200 +Subject: [PATCH] mac80211: add debugfs file to display per-phy AQL pending + airtime + +Now that the global pending airtime is more relevant for airtime fairness, +it makes sense to make it accessible via debugfs for debugging + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -201,6 +201,36 @@ static const struct file_operations airt + .llseek = default_llseek, + }; + ++static ssize_t aql_pending_read(struct file *file, ++ char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ieee80211_local *local = file->private_data; ++ char buf[400]; ++ int len = 0; ++ ++ len = scnprintf(buf, sizeof(buf), ++ "AC AQL pending\n" ++ "VO %u us\n" ++ "VI %u us\n" ++ "BE %u us\n" ++ "BK %u us\n" ++ "total %u us\n", ++ atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VO]), ++ atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VI]), ++ atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BE]), ++ atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BK]), ++ atomic_read(&local->aql_total_pending_airtime)); ++ return simple_read_from_buffer(user_buf, count, ppos, ++ buf, len); ++} ++ ++static const struct file_operations aql_pending_ops = { ++ .read = aql_pending_read, ++ .open = simple_open, ++ .llseek = default_llseek, ++}; ++ + static ssize_t aql_txq_limit_read(struct file *file, + char __user *user_buf, + size_t count, +@@ -628,6 +658,7 @@ void debugfs_hw_add(struct ieee80211_loc + DEBUGFS_ADD(hw_conf); + 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); diff --git a/package/kernel/mac80211/patches/subsys/336-mac80211-only-accumulate-airtime-deficit-for-active-.patch b/package/kernel/mac80211/patches/subsys/336-mac80211-only-accumulate-airtime-deficit-for-active-.patch new file mode 100644 index 000000000..35f07c1a9 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/336-mac80211-only-accumulate-airtime-deficit-for-active-.patch @@ -0,0 +1,36 @@ +From: Felix Fietkau +Date: Sat, 25 Jun 2022 23:10:19 +0200 +Subject: [PATCH] mac80211: only accumulate airtime deficit for active + clients + +When a client does not generate any local tx activity, accumulating airtime +deficit for the round-robin scheduler can be harmful. If this goes on for too +long, the deficit could grow quite large, which might cause unreasonable +initial latency once the client becomes active + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1900,6 +1900,7 @@ void ieee80211_sta_register_airtime(stru + struct ieee80211_local *local = sta->sdata->local; + u8 ac = ieee80211_ac_from_tid(tid); + u32 airtime = 0; ++ u32 diff; + + if (sta->local->airtime_flags & AIRTIME_USE_TX) + airtime += tx_airtime; +@@ -1909,7 +1910,11 @@ void ieee80211_sta_register_airtime(stru + spin_lock_bh(&local->active_txq_lock[ac]); + sta->airtime[ac].tx_airtime += tx_airtime; + sta->airtime[ac].rx_airtime += rx_airtime; +- sta->airtime[ac].deficit -= airtime; ++ ++ diff = (u32)jiffies - sta->airtime[ac].last_active; ++ if (diff <= AIRTIME_ACTIVE_DURATION) ++ sta->airtime[ac].deficit -= airtime; ++ + spin_unlock_bh(&local->active_txq_lock[ac]); + } + EXPORT_SYMBOL(ieee80211_sta_register_airtime); diff --git a/package/kernel/mac80211/patches/subsys/337-mac80211-increase-quantum-for-airtime-scheduler.patch b/package/kernel/mac80211/patches/subsys/337-mac80211-increase-quantum-for-airtime-scheduler.patch new file mode 100644 index 000000000..74e857679 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/337-mac80211-increase-quantum-for-airtime-scheduler.patch @@ -0,0 +1,53 @@ +From: Felix Fietkau +Date: Sun, 26 Jun 2022 11:43:25 +0200 +Subject: [PATCH] mac80211: increase quantum for airtime scheduler + +Given the typical AQL budget and queue length, a quantum of 256 with the +default station weight often requires iterating over all queues frequently, +until one of them becomes eligible. +Improve performance by using 8 times station weight as scheduler quantum + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -90,6 +90,8 @@ extern const u8 ieee80211_ac_to_qos_mask + */ + #define AIRTIME_ACTIVE_DURATION (HZ / 10) + ++#define AIRTIME_QUANTUM_SHIFT 3 ++ + struct ieee80211_bss { + u32 device_ts_beacon, device_ts_presp; + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3894,7 +3894,7 @@ struct ieee80211_txq *ieee80211_next_txq + + if (deficit < 0) + sta->airtime[txqi->txq.ac].deficit += +- sta->airtime_weight; ++ sta->airtime_weight << AIRTIME_QUANTUM_SHIFT; + + if (deficit < 0 || !aql_check) { + list_move_tail(&txqi->schedule_order, +@@ -4037,7 +4037,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) +- sta->airtime[ac].deficit += sta->airtime_weight; ++ sta->airtime[ac].deficit += sta->airtime_weight << ++ AIRTIME_QUANTUM_SHIFT; + list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); + } + +@@ -4045,7 +4046,7 @@ bool ieee80211_txq_may_transmit(struct i + if (sta->airtime[ac].deficit >= 0) + goto out; + +- sta->airtime[ac].deficit += sta->airtime_weight; ++ sta->airtime[ac].deficit += sta->airtime_weight << AIRTIME_QUANTUM_SHIFT; + list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]); + spin_unlock_bh(&local->active_txq_lock[ac]); + diff --git a/package/kernel/mac80211/patches/subsys/350-bss-color-collision.patch b/package/kernel/mac80211/patches/subsys/350-bss-color-collision.patch new file mode 100644 index 000000000..d2a43304b --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/350-bss-color-collision.patch @@ -0,0 +1,118 @@ +From 6d945a33f2b0aa24fc210dadaa0af3e8218e7002 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Fri, 25 Mar 2022 11:42:41 +0100 +Subject: [PATCH] mac80211: introduce BSS color collision detection + +Add ieee80211_rx_check_bss_color_collision routine in order to introduce +BSS color collision detection in mac80211 if it is not supported in HW/FW +(e.g. for mt7915 chipset). +Add IEEE80211_HW_DETECTS_COLOR_COLLISION flag to let the driver notify +BSS color collision detection is supported in HW/FW. Set this for ath11k +which apparently didn't need this code. + +Tested-by: Peter Chiu +Co-developed-by: Ryder Lee +Signed-off-by: Ryder Lee +Signed-off-by: Lorenzo Bianconi +Link: https://lore.kernel.org/r/a05eeeb1841a84560dc5aaec77894fcb69a54f27.1648204871.git.lorenzo@kernel.org +[clarify commit message a bit, move flag to mac80211] +Signed-off-by: Johannes Berg +--- + drivers/net/wireless/ath/ath11k/mac.c | 5 ++- + include/net/mac80211.h | 4 +++ + net/mac80211/debugfs.c | 1 + + net/mac80211/rx.c | 46 +++++++++++++++++++++++++++ + 4 files changed, 55 insertions(+), 1 deletion(-) + +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -2418,6 +2418,9 @@ struct ieee80211_txq { + * usage and 802.11 frames with %RX_FLAG_ONLY_MONITOR set for monitor to + * the stack. + * ++ * @IEEE80211_HW_DETECTS_COLOR_COLLISION: HW/driver has support for BSS color ++ * collision detection and doesn't need it in software. ++ * + * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays + */ + enum ieee80211_hw_flags { +@@ -2473,6 +2476,7 @@ enum ieee80211_hw_flags { + IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD, + IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD, + IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP, ++ IEEE80211_HW_DETECTS_COLOR_COLLISION, + + /* keep last, obviously */ + NUM_IEEE80211_HW_FLAGS +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -494,6 +494,7 @@ static const char *hw_flag_names[] = { + FLAG(SUPPORTS_TX_ENCAP_OFFLOAD), + FLAG(SUPPORTS_RX_DECAP_OFFLOAD), + FLAG(SUPPORTS_CONC_MON_RX_DECAP), ++ FLAG(DETECTS_COLOR_COLLISION), + #undef FLAG + }; + +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -3181,6 +3181,49 @@ static void ieee80211_process_sa_query_r + ieee80211_tx_skb(sdata, skb); + } + ++static void ++ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx) ++{ ++ struct ieee80211_mgmt *mgmt = (void *)rx->skb->data; ++ const struct element *ie; ++ size_t baselen; ++ ++ if (!wiphy_ext_feature_isset(rx->local->hw.wiphy, ++ NL80211_EXT_FEATURE_BSS_COLOR)) ++ return; ++ ++ if (ieee80211_hw_check(&rx->local->hw, DETECTS_COLOR_COLLISION)) ++ return; ++ ++ if (rx->sdata->vif.csa_active) ++ return; ++ ++ baselen = mgmt->u.beacon.variable - rx->skb->data; ++ if (baselen > rx->skb->len) ++ return; ++ ++ ie = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION, ++ mgmt->u.beacon.variable, ++ rx->skb->len - baselen); ++ if (ie && ie->datalen >= sizeof(struct ieee80211_he_operation) && ++ ie->datalen >= ieee80211_he_oper_size(ie->data + 1)) { ++ struct ieee80211_bss_conf *bss_conf = &rx->sdata->vif.bss_conf; ++ const struct ieee80211_he_operation *he_oper; ++ u8 color; ++ ++ he_oper = (void *)(ie->data + 1); ++ if (le32_get_bits(he_oper->he_oper_params, ++ IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED)) ++ return; ++ ++ color = le32_get_bits(he_oper->he_oper_params, ++ IEEE80211_HE_OPERATION_BSS_COLOR_MASK); ++ if (color == bss_conf->he_bss_color.color) ++ ieeee80211_obss_color_collision_notify(&rx->sdata->vif, ++ BIT_ULL(color)); ++ } ++} ++ + static ieee80211_rx_result debug_noinline + ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx) + { +@@ -3206,6 +3249,9 @@ ieee80211_rx_h_mgmt_check(struct ieee802 + !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) { + int sig = 0; + ++ /* sw bss color collision detection */ ++ ieee80211_rx_check_bss_color_collision(rx); ++ + if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM) && + !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) + sig = status->signal; diff --git a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch index d12c8ada3..f2ed528d2 100644 --- a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch @@ -5,7 +5,7 @@ and we should ignore this. --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -634,21 +634,6 @@ static int wiphy_verify_combinations(str +@@ -625,21 +625,6 @@ static int wiphy_verify_combinations(str c->limits[j].max > 1)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch index c4acfd143..171af5ee5 100644 --- a/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch @@ -57,7 +57,7 @@ __NL80211_ATTR_AFTER_LAST, --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2845,6 +2845,19 @@ static int ieee80211_get_tx_power(struct +@@ -2812,6 +2812,19 @@ static int ieee80211_get_tx_power(struct return 0; } @@ -77,7 +77,7 @@ static void ieee80211_rfkill_poll(struct wiphy *wiphy) { struct ieee80211_local *local = wiphy_priv(wiphy); -@@ -4549,6 +4562,7 @@ const struct cfg80211_ops mac80211_confi +@@ -4516,6 +4529,7 @@ const struct cfg80211_ops mac80211_confi .set_wiphy_params = ieee80211_set_wiphy_params, .set_tx_power = ieee80211_set_tx_power, .get_tx_power = ieee80211_get_tx_power, @@ -87,7 +87,7 @@ CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump) --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h -@@ -1444,6 +1444,7 @@ struct ieee80211_local { +@@ -1441,6 +1441,7 @@ struct ieee80211_local { int dynamic_ps_forced_timeout; int user_power_level; /* in dBm, for all interfaces */ @@ -129,7 +129,7 @@ local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -794,6 +794,7 @@ static const struct nla_policy nl80211_p +@@ -797,6 +797,7 @@ static const struct nla_policy nl80211_p NLA_POLICY_NESTED(nl80211_mbssid_config_policy), [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, [NL80211_ATTR_RADAR_BACKGROUND] = { .type = NLA_FLAG }, @@ -137,7 +137,7 @@ }; /* policy for the key attributes */ -@@ -3374,6 +3375,22 @@ static int nl80211_set_wiphy(struct sk_b +@@ -3377,6 +3378,22 @@ static int nl80211_set_wiphy(struct sk_b if (result) goto out; } diff --git a/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch b/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch index ffdb07479..2309c8e38 100644 --- a/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch +++ b/package/kernel/mac80211/patches/subsys/600-mac80211-allow-vht-on-2g.patch @@ -12,7 +12,7 @@ have_80mhz = true; --- a/net/mac80211/util.c +++ b/net/mac80211/util.c -@@ -1906,7 +1906,8 @@ static int ieee80211_build_preq_ies_band +@@ -1919,7 +1919,8 @@ static int ieee80211_build_preq_ies_band /* Check if any channel in this sband supports at least 80 MHz */ for (i = 0; i < sband->n_channels; i++) { if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | @@ -24,7 +24,7 @@ have_80mhz = true; --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c -@@ -5068,7 +5068,8 @@ static int ieee80211_prep_channel(struct +@@ -5090,7 +5090,8 @@ static int ieee80211_prep_channel(struct have_80mhz = false; for (i = 0; i < sband->n_channels; i++) { if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED | diff --git a/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch deleted file mode 100644 index 26af6a2fb..000000000 --- a/package/kernel/mac80211/patches/subsys/782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/backport-include/linux/of_net.h -+++ /dev/null -@@ -1,26 +0,0 @@ --#ifndef _BP_OF_NET_H --#define _BP_OF_NET_H --#include_next --#include --#include -- --/* The behavior of of_get_mac_address() changed in kernel 5.2, it now -- * returns an error code and not NULL in case of an error. -- */ --#if LINUX_VERSION_IS_LESS(5,13,0) --static inline int backport_of_get_mac_address(struct device_node *np, u8 *mac_out) --{ -- const void *mac = of_get_mac_address(np); -- -- if (!mac) -- return -ENODEV; -- if (IS_ERR(mac)) -- return PTR_ERR(mac); -- ether_addr_copy(mac_out, mac); -- -- return 0; --} --#define of_get_mac_address LINUX_BACKPORT(of_get_mac_address) --#endif /* < 5.2 */ -- --#endif /* _BP_OF_NET_H */ diff --git a/package/kernel/mac80211/patches/subsys/783-sync-nl80211.patch b/package/kernel/mac80211/patches/subsys/783-sync-nl80211.patch new file mode 100644 index 000000000..dc2b05b1a --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/783-sync-nl80211.patch @@ -0,0 +1,22 @@ +--- a/include/uapi/linux/nl80211.h ++++ b/include/uapi/linux/nl80211.h +@@ -6027,6 +6027,11 @@ enum nl80211_feature_flags { + * @NL80211_EXT_FEATURE_BSS_COLOR: The driver supports BSS color collision + * detection and change announcemnts. + * ++ * @NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD: Driver running in AP mode supports ++ * FILS encryption and decryption for (Re)Association Request and Response ++ * frames. Userspace has to share FILS AAD details to the driver by using ++ * @NL80211_CMD_SET_FILS_AAD. ++ * + * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC + * detection. + * +@@ -6095,6 +6100,7 @@ enum nl80211_ext_feature_index { + NL80211_EXT_FEATURE_SECURE_RTT, + NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE, + NL80211_EXT_FEATURE_BSS_COLOR, ++ NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD, + NL80211_EXT_FEATURE_RADAR_BACKGROUND, + + /* add new features before the definition below */ diff --git a/package/kernel/mac80211/patches/subsys/800-backport-of_get_mac_address.patch b/package/kernel/mac80211/patches/subsys/800-backport-of_get_mac_address.patch new file mode 100644 index 000000000..434638c76 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/800-backport-of_get_mac_address.patch @@ -0,0 +1,12 @@ +--- a/backport-include/linux/of_net.h ++++ b/backport-include/linux/of_net.h +@@ -7,7 +7,7 @@ + /* The behavior of of_get_mac_address() changed in kernel 5.2, it now + * returns an error code and not NULL in case of an error. + */ +-#if LINUX_VERSION_IS_LESS(5,13,0) ++#if LINUX_VERSION_IS_LESS(5,2,0) + static inline int backport_of_get_mac_address(struct device_node *np, u8 *mac_out) + { + const void *mac = of_get_mac_address(np); +