From 63a92188fb3b044991f990484432ef4372040eb5 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 2 Aug 2024 15:13:43 -0700 Subject: [PATCH 01/16] kernel: leds-ws2812b: use devm functions Avoids having to free manually. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16587 Signed-off-by: Robert Marko --- package/kernel/leds-ws2812b/src/leds-ws2812b.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/package/kernel/leds-ws2812b/src/leds-ws2812b.c b/package/kernel/leds-ws2812b/src/leds-ws2812b.c index 0dba128c1f..69bc575ba2 100644 --- a/package/kernel/leds-ws2812b/src/leds-ws2812b.c +++ b/package/kernel/leds-ws2812b/src/leds-ws2812b.c @@ -117,7 +117,7 @@ static int ws2812b_probe(struct spi_device *spi) priv->data_len = num_leds * WS2812B_BYTES_PER_COLOR * WS2812B_NUM_COLORS + WS2812B_RESET_LEN; - priv->data_buf = kzalloc(priv->data_len, GFP_KERNEL); + priv->data_buf = devm_kzalloc(dev, priv->data_len, GFP_KERNEL); if (!priv->data_buf) return -ENOMEM; @@ -171,7 +171,7 @@ static int ws2812b_probe(struct spi_device *spi) priv->leds[cur_led].cascade = cascade; - ret = led_classdev_multicolor_register_ext( + ret = devm_led_classdev_multicolor_register_ext( dev, &priv->leds[cur_led].mc_cdev, &init_data); if (ret) { dev_err(dev, "registration of %s failed.", @@ -185,10 +185,7 @@ static int ws2812b_probe(struct spi_device *spi) return 0; ERR_UNREG_LEDS: - for (; cur_led >= 0; cur_led--) - led_classdev_multicolor_unregister(&priv->leds[cur_led].mc_cdev); mutex_destroy(&priv->mutex); - kfree(priv->data_buf); return ret; } @@ -199,11 +196,7 @@ static int ws2812b_remove(struct spi_device *spi) #endif { struct ws2812b_priv *priv = spi_get_drvdata(spi); - int cur_led; - for (cur_led = priv->num_leds - 1; cur_led >= 0; cur_led--) - led_classdev_multicolor_unregister(&priv->leds[cur_led].mc_cdev); - kfree(priv->data_buf); mutex_destroy(&priv->mutex); #if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) From e15aab2a17bd7df5cec09da61d2b0d2f052c7232 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 26 Sep 2024 13:09:19 -0700 Subject: [PATCH 02/16] kernel: leds-ws2812b: remove sub 6.6 support 5.15 and 6.1 are gone. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16587 Signed-off-by: Robert Marko --- package/kernel/leds-ws2812b/src/leds-ws2812b.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/package/kernel/leds-ws2812b/src/leds-ws2812b.c b/package/kernel/leds-ws2812b/src/leds-ws2812b.c index 69bc575ba2..d061ee9dce 100644 --- a/package/kernel/leds-ws2812b/src/leds-ws2812b.c +++ b/package/kernel/leds-ws2812b/src/leds-ws2812b.c @@ -189,19 +189,11 @@ ERR_UNREG_LEDS: return ret; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,18,0) static void ws2812b_remove(struct spi_device *spi) -#else -static int ws2812b_remove(struct spi_device *spi) -#endif { struct ws2812b_priv *priv = spi_get_drvdata(spi); mutex_destroy(&priv->mutex); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) - return 0; -#endif } static const struct spi_device_id ws2812b_spi_ids[] = { From 5ee75b6bb2fbdf2438aa94d9df92b7d76650e633 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 3 Oct 2024 13:20:30 -0700 Subject: [PATCH 03/16] kernel: ws2812b: use devm for mutex_init Allows removal of _remove function. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16587 Signed-off-by: Robert Marko --- .../kernel/leds-ws2812b/src/leds-ws2812b.c | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/package/kernel/leds-ws2812b/src/leds-ws2812b.c b/package/kernel/leds-ws2812b/src/leds-ws2812b.c index d061ee9dce..3f26664913 100644 --- a/package/kernel/leds-ws2812b/src/leds-ws2812b.c +++ b/package/kernel/leds-ws2812b/src/leds-ws2812b.c @@ -124,7 +124,10 @@ static int ws2812b_probe(struct spi_device *spi) for (i = 0; i < num_leds * WS2812B_NUM_COLORS; i++) ws2812b_set_byte(priv, i, 0); - mutex_init(&priv->mutex); + ret = devm_mutex_init(dev, &priv->mutex); + if (ret) + return ret; + priv->num_leds = num_leds; priv->spi = spi; @@ -144,13 +147,12 @@ static int ws2812b_probe(struct spi_device *spi) if (ret) { dev_err(dev, "failed to obtain numerical LED index for %s", fwnode_get_name(led_node)); - goto ERR_UNREG_LEDS; + return ret; } if (cascade >= num_leds) { dev_err(dev, "LED index of %s is larger than the number of LEDs.", fwnode_get_name(led_node)); - ret = -EINVAL; - goto ERR_UNREG_LEDS; + return -EINVAL; } cnt = fwnode_property_count_u32(led_node, "color-index"); @@ -176,7 +178,7 @@ static int ws2812b_probe(struct spi_device *spi) if (ret) { dev_err(dev, "registration of %s failed.", fwnode_get_name(led_node)); - goto ERR_UNREG_LEDS; + return ret; } cur_led++; } @@ -184,16 +186,6 @@ static int ws2812b_probe(struct spi_device *spi) spi_set_drvdata(spi, priv); return 0; -ERR_UNREG_LEDS: - mutex_destroy(&priv->mutex); - return ret; -} - -static void ws2812b_remove(struct spi_device *spi) -{ - struct ws2812b_priv *priv = spi_get_drvdata(spi); - - mutex_destroy(&priv->mutex); } static const struct spi_device_id ws2812b_spi_ids[] = { @@ -210,7 +202,6 @@ MODULE_DEVICE_TABLE(of, ws2812b_dt_ids); static struct spi_driver ws2812b_driver = { .probe = ws2812b_probe, - .remove = ws2812b_remove, .id_table = ws2812b_spi_ids, .driver = { .name = KBUILD_MODNAME, From 7ada5ab1c98a4b8902000e28c1ffa5ca2e6959c4 Mon Sep 17 00:00:00 2001 From: Zxl hhyccc Date: Fri, 4 Oct 2024 22:31:25 +0800 Subject: [PATCH 04/16] kernel-build.mk: Fix multi-core build warning. In the case of multi-core compilation, the warning prompts to add a "+" sign. ```` warning: jobserver unavailable: using -j1. Add `+' to parent make rule. ````` Signed-off-by: Zxl hhyccc Link: https://github.com/openwrt/openwrt/pull/16598 Signed-off-by: Robert Marko --- include/kernel-build.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kernel-build.mk b/include/kernel-build.mk index 48e00fa4c6..404c318d41 100644 --- a/include/kernel-build.mk +++ b/include/kernel-build.mk @@ -154,7 +154,7 @@ define BuildKernel download: $(if $(LINUX_SITE),$(DL_DIR)/$(LINUX_SOURCE)) prepare: $(STAMP_PREPARED) compile: $(LINUX_DIR)/.modules - $(MAKE) -C image compile TARGET_BUILD= + +$(MAKE) -C image compile TARGET_BUILD= dtb: $(STAMP_CONFIGURED) $(_SINGLE)$(KERNEL_MAKE) scripts_dtc From ac840d74f12ff46e34bb51431f2e8a23b63cc34d Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Thu, 26 Sep 2024 19:30:36 +0800 Subject: [PATCH 05/16] ath10k-ct: switch to version 6.10 The mac80211 driver backport has been updated to version 6.11. Let's also push ath10k-ct driver forward. The unsupported feature 'NL80211_EXT_FEATURE_ETHTOOL_VDEV_STATS' has been dropped since it looks like something for debugging and not supported by the mainline. Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16514 Signed-off-by: Hauke Mehrtens --- package/kernel/ath10k-ct/Makefile | 6 +- .../ath10k-ct/patches/001-patch-version.patch | 6 +- ...h10k-6.10-remove-unsupported-feature.patch | 10 ++ .../ath10k-ct/patches/010-api_update.patch | 12 +- ...k-read-qcom-coexist-support-as-a-u32.patch | 6 +- ...LED-and-GPIO-controlling-support-for.patch | 112 +++++++++--------- ...02-ath10k-use-tpt-trigger-by-default.patch | 14 +-- .../300-fix-fortify-checking-error.patch | 4 +- ...0-0010-ath10k-limit-htt-rx-ring-size.patch | 4 +- ...60-0011-ath10k-limit-pci-buffer-size.patch | 4 +- ...k-always-use-mac80211-loss-detection.patch | 6 +- 11 files changed, 97 insertions(+), 87 deletions(-) create mode 100644 package/kernel/ath10k-ct/patches/002-ath10k-6.10-remove-unsupported-feature.patch diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile index bd18930801..dff32716c9 100644 --- a/package/kernel/ath10k-ct/Makefile +++ b/package/kernel/ath10k-ct/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath10k-ct -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= @@ -12,10 +12,10 @@ PKG_SOURCE_DATE:=2024-07-30 PKG_SOURCE_VERSION:=ac71b14dc93aef0af6f0f24808b0afb673eaa5f5 PKG_MIRROR_HASH:=f7774fc7002bbea450f543927acd528fb1bb6742f0e9ef28a402df3796893d93 -# Build the 6.9 ath10k-ct driver version. +# Build the 6.10 ath10k-ct driver version. # Probably this should match as closely as # possible to whatever mac80211 backports version is being used. -CT_KVER="-6.9" +CT_KVER="-6.10" PKG_MAINTAINER:=Ben Greear PKG_BUILD_PARALLEL:=1 diff --git a/package/kernel/ath10k-ct/patches/001-patch-version.patch b/package/kernel/ath10k-ct/patches/001-patch-version.patch index e5ae723cf1..4c90a3f316 100644 --- a/package/kernel/ath10k-ct/patches/001-patch-version.patch +++ b/package/kernel/ath10k-ct/patches/001-patch-version.patch @@ -1,11 +1,11 @@ ---- a/ath10k-6.9/pci.c -+++ b/ath10k-6.9/pci.c +--- a/ath10k-6.10/pci.c ++++ b/ath10k-6.10/pci.c @@ -3871,7 +3871,7 @@ static int __ath10k_pci_probe(struct pci int (*pci_hard_reset)(struct ath10k *ar); u32 (*targ_cpu_to_ce_addr)(struct ath10k *ar, u32 addr); - printk(KERN_INFO "ath10k 6.7 driver, optimized for CT firmware, probing pci device: 0x%x.\n", -+ printk(KERN_INFO "ath10k 6.9 driver, optimized for CT firmware, probing pci device: 0x%x.\n", ++ printk(KERN_INFO "ath10k 6.10 driver, optimized for CT firmware, probing pci device: 0x%x.\n", pci_dev->device); switch (pci_dev->device) { diff --git a/package/kernel/ath10k-ct/patches/002-ath10k-6.10-remove-unsupported-feature.patch b/package/kernel/ath10k-ct/patches/002-ath10k-6.10-remove-unsupported-feature.patch new file mode 100644 index 0000000000..ca64c8a110 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/002-ath10k-6.10-remove-unsupported-feature.patch @@ -0,0 +1,10 @@ +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c +@@ -11626,7 +11626,6 @@ int ath10k_mac_register(struct ath10k *a + ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites; + + wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); +- wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_ETHTOOL_VDEV_STATS); + + ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; + diff --git a/package/kernel/ath10k-ct/patches/010-api_update.patch b/package/kernel/ath10k-ct/patches/010-api_update.patch index f70d8eb460..dff725b4e4 100644 --- a/package/kernel/ath10k-ct/patches/010-api_update.patch +++ b/package/kernel/ath10k-ct/patches/010-api_update.patch @@ -1,5 +1,5 @@ ---- a/ath10k-6.9/mac.c -+++ b/ath10k-6.9/mac.c +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c @@ -1675,7 +1675,7 @@ static void ath10k_recalc_radar_detectio * by indicating that radar was detected. */ @@ -18,8 +18,8 @@ { struct ath10k *ar = hw->priv; u32 opt; ---- a/ath10k-6.9/debug.c -+++ b/ath10k-6.9/debug.c +--- a/ath10k-6.10/debug.c ++++ b/ath10k-6.10/debug.c @@ -3319,7 +3319,7 @@ static ssize_t ath10k_write_simulate_rad if (!arvif->is_started) return -EINVAL; @@ -29,8 +29,8 @@ return count; } ---- a/ath10k-6.9/wmi.c -+++ b/ath10k-6.9/wmi.c +--- a/ath10k-6.10/wmi.c ++++ b/ath10k-6.10/wmi.c @@ -4402,7 +4402,7 @@ static void ath10k_radar_detected(struct if (ar->dfs_block_radar_events) ath10k_info(ar, "DFS Radar detected, but ignored as requested\n"); diff --git a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch b/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch index b15bfdde6a..61090a49d0 100644 --- a/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch +++ b/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch @@ -39,9 +39,9 @@ that the feature is properly initialized: Signed-off-by: Vincent Tremblay ---- a/ath10k-6.9/core.c -+++ b/ath10k-6.9/core.c -@@ -2889,14 +2889,14 @@ done: +--- a/ath10k-6.10/core.c ++++ b/ath10k-6.10/core.c +@@ -2871,14 +2871,14 @@ done: static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar) { struct device_node *node; diff --git a/package/kernel/ath10k-ct/patches/201-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch b/package/kernel/ath10k-ct/patches/201-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch index ba9372f9f0..c1137d081e 100644 --- a/package/kernel/ath10k-ct/patches/201-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch +++ b/package/kernel/ath10k-ct/patches/201-wifi-ath10k-add-LED-and-GPIO-controlling-support-for.patch @@ -20,24 +20,24 @@ Tested-by: Stefan Lippers-Hollmann Signed-off-by: Kalle Valo Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com --- - ath10k-6.9/Kconfig | 6 ++ - ath10k-6.9/Makefile | 1 + - ath10k-6.9/core.c | 32 ++++++++ - ath10k-6.9/core.h | 8 ++ - ath10k-6.9/hw.h | 1 + - ath10k-6.9/leds.c | 90 +++++++++++++++++++++++ - ath10k-6.9/leds.h | 34 +++++++++ - ath10k-6.9/mac.c | 1 + - ath10k-6.9/wmi-ops.h | 32 ++++++++ - ath10k-6.9/wmi-tlv.c | 2 + - ath10k-6.9/wmi.c | 54 ++++++++++++++ - ath10k-6.9/wmi.h | 35 +++++++++ + ath10k-6.10/Kconfig | 6 ++ + ath10k-6.10/Makefile | 1 + + ath10k-6.10/core.c | 32 ++++++++ + ath10k-6.10/core.h | 8 ++ + ath10k-6.10/hw.h | 1 + + ath10k-6.10/leds.c | 90 +++++++++++++++++++++++ + ath10k-6.10/leds.h | 34 +++++++++ + ath10k-6.10/mac.c | 1 + + ath10k-6.10/wmi-ops.h | 32 ++++++++ + ath10k-6.10/wmi-tlv.c | 2 + + ath10k-6.10/wmi.c | 54 ++++++++++++++ + ath10k-6.10/wmi.h | 35 +++++++++ 12 files changed, 296 insertions(+) - create mode 100644 ath10k-6.9/leds.c - create mode 100644 ath10k-6.9/leds.h + create mode 100644 ath10k-6.10/leds.c + create mode 100644 ath10k-6.10/leds.h ---- a/ath10k-6.9/Kconfig -+++ b/ath10k-6.9/Kconfig +--- a/ath10k-6.10/Kconfig ++++ b/ath10k-6.10/Kconfig @@ -68,6 +68,12 @@ config ATH10K_DEBUGFS If unsure, say Y to make it easier to debug problems. @@ -51,8 +51,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com config ATH10K_SPECTRAL bool "Atheros ath10k spectral scan support" depends on ATH10K_DEBUGFS ---- a/ath10k-6.9/Makefile -+++ b/ath10k-6.9/Makefile +--- a/ath10k-6.10/Makefile ++++ b/ath10k-6.10/Makefile @@ -20,6 +20,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o @@ -61,8 +61,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o ath10k_core-$(CONFIG_ATH10K_CE) += ce.o ---- a/ath10k-6.9/core.c -+++ b/ath10k-6.9/core.c +--- a/ath10k-6.10/core.c ++++ b/ath10k-6.10/core.c @@ -29,6 +29,7 @@ #include "testmode.h" #include "wmi-ops.h" @@ -79,7 +79,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, .otp_exe_param = 0, .channel_counters_freq_hz = 88000, -@@ -122,6 +124,7 @@ static const struct ath10k_hw_params ath +@@ -121,6 +123,7 @@ static const struct ath10k_hw_params ath .name = "qca988x hw2.0 ubiquiti", .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -87,7 +87,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, .otp_exe_param = 0, .channel_counters_freq_hz = 88000, -@@ -164,6 +167,7 @@ static const struct ath10k_hw_params ath +@@ -162,6 +165,7 @@ static const struct ath10k_hw_params ath .name = "qca9887 hw1.0", .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -95,7 +95,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL, .otp_exe_param = 0, .channel_counters_freq_hz = 88000, -@@ -206,6 +210,7 @@ static const struct ath10k_hw_params ath +@@ -203,6 +207,7 @@ static const struct ath10k_hw_params ath .name = "qca6174 hw3.2 sdio", .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, .uart_pin = 19, @@ -103,7 +103,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -243,6 +248,7 @@ static const struct ath10k_hw_params ath +@@ -239,6 +244,7 @@ static const struct ath10k_hw_params ath .name = "qca6164 hw2.1", .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -111,7 +111,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -284,6 +290,7 @@ static const struct ath10k_hw_params ath +@@ -279,6 +285,7 @@ static const struct ath10k_hw_params ath .name = "qca6174 hw2.1", .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -119,7 +119,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -325,6 +332,7 @@ static const struct ath10k_hw_params ath +@@ -319,6 +326,7 @@ static const struct ath10k_hw_params ath .name = "qca6174 hw3.0", .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -127,7 +127,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -366,6 +374,7 @@ static const struct ath10k_hw_params ath +@@ -359,6 +367,7 @@ static const struct ath10k_hw_params ath .name = "qca6174 hw3.2", .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -135,7 +135,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -411,6 +420,7 @@ static const struct ath10k_hw_params ath +@@ -403,6 +412,7 @@ static const struct ath10k_hw_params ath .name = "qca99x0 hw2.0", .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -143,7 +143,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0x00000700, .continuous_frag_desc = true, .cck_rate_map_rev2 = true, -@@ -458,6 +468,7 @@ static const struct ath10k_hw_params ath +@@ -449,6 +459,7 @@ static const struct ath10k_hw_params ath .name = "qca9984/qca9994 hw1.0", .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -151,7 +151,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, .otp_exe_param = 0x00000700, .continuous_frag_desc = true, -@@ -512,6 +523,7 @@ static const struct ath10k_hw_params ath +@@ -501,6 +512,7 @@ static const struct ath10k_hw_params ath .name = "qca9888 hw2.0", .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -159,7 +159,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, .otp_exe_param = 0x00000700, .continuous_frag_desc = true, -@@ -563,6 +575,7 @@ static const struct ath10k_hw_params ath +@@ -551,6 +563,7 @@ static const struct ath10k_hw_params ath .name = "qca9377 hw1.0", .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -167,7 +167,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -604,6 +617,7 @@ static const struct ath10k_hw_params ath +@@ -591,6 +604,7 @@ static const struct ath10k_hw_params ath .name = "qca9377 hw1.1", .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 6, @@ -175,7 +175,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -647,6 +661,7 @@ static const struct ath10k_hw_params ath +@@ -633,6 +647,7 @@ static const struct ath10k_hw_params ath .name = "qca9377 hw1.1 sdio", .patch_load_addr = QCA9377_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 19, @@ -183,7 +183,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .otp_exe_param = 0, .channel_counters_freq_hz = 88000, .max_probe_resp_desc_thres = 0, -@@ -681,6 +696,7 @@ static const struct ath10k_hw_params ath +@@ -666,6 +681,7 @@ static const struct ath10k_hw_params ath .name = "qca4019 hw1.0", .patch_load_addr = QCA4019_HW_1_0_PATCH_LOAD_ADDR, .uart_pin = 7, @@ -191,7 +191,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH, .otp_exe_param = 0x0010000, .continuous_frag_desc = true, -@@ -727,6 +743,7 @@ static const struct ath10k_hw_params ath +@@ -711,6 +727,7 @@ static const struct ath10k_hw_params ath .dev_id = 0, .bus = ATH10K_BUS_SNOC, .name = "wcn3990 hw1.0", @@ -199,7 +199,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com .continuous_frag_desc = true, .tx_chain_mask = 0x7, .rx_chain_mask = 0x7, -@@ -4091,6 +4108,10 @@ int ath10k_core_start(struct ath10k *ar, +@@ -4073,6 +4090,10 @@ int ath10k_core_start(struct ath10k *ar, ath10k_wmi_check_apply_board_power_ctl_table(ar); } @@ -210,7 +210,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com return 0; err_hif_stop: -@@ -4352,9 +4373,18 @@ static void ath10k_core_register_work(st +@@ -4334,9 +4355,18 @@ static void ath10k_core_register_work(st goto err_spectral_destroy; } @@ -229,7 +229,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com err_spectral_destroy: ath10k_spectral_destroy(ar); err_debug_destroy: -@@ -4414,6 +4444,8 @@ void ath10k_core_unregister(struct ath10 +@@ -4396,6 +4426,8 @@ void ath10k_core_unregister(struct ath10 if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags)) return; @@ -238,8 +238,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com ath10k_thermal_unregister(ar); /* Stop spectral before unregistering from mac80211 to remove the * relayfs debugfs file cleanly. Otherwise the parent debugfs tree ---- a/ath10k-6.9/core.h -+++ b/ath10k-6.9/core.h +--- a/ath10k-6.10/core.h ++++ b/ath10k-6.10/core.h @@ -15,6 +15,7 @@ #include #include @@ -248,7 +248,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com #include "htt.h" #include "htc.h" -@@ -1590,6 +1591,13 @@ struct ath10k { +@@ -1592,6 +1593,13 @@ struct ath10k { } testmode; struct { @@ -262,9 +262,9 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com /* protected by data_lock */ u32 rx_crc_err_drop; u32 fw_crash_counter; ---- a/ath10k-6.9/hw.h -+++ b/ath10k-6.9/hw.h -@@ -525,6 +525,7 @@ struct ath10k_hw_params { +--- a/ath10k-6.10/hw.h ++++ b/ath10k-6.10/hw.h +@@ -516,6 +516,7 @@ struct ath10k_hw_params { const char *name; u32 patch_load_addr; int uart_pin; @@ -273,7 +273,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com /* Type of hw cycle counter wraparound logic, for more info --- /dev/null -+++ b/ath10k-6.9/leds.c ++++ b/ath10k-6.10/leds.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: ISC +/* @@ -366,7 +366,7 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com +} + --- /dev/null -+++ b/ath10k-6.9/leds.h ++++ b/ath10k-6.10/leds.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: ISC */ +/* @@ -402,8 +402,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com + +#endif +#endif /* _LEDS_H_ */ ---- a/ath10k-6.9/mac.c -+++ b/ath10k-6.9/mac.c +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c @@ -26,6 +26,7 @@ #include "wmi-tlv.h" #include "wmi-ops.h" @@ -412,8 +412,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com /*********/ /* Rates */ ---- a/ath10k-6.9/wmi-ops.h -+++ b/ath10k-6.9/wmi-ops.h +--- a/ath10k-6.10/wmi-ops.h ++++ b/ath10k-6.10/wmi-ops.h @@ -228,7 +228,10 @@ struct wmi_ops { const struct wmi_bb_timing_cfg_arg *arg); struct sk_buff *(*gen_per_peer_per_tid_cfg)(struct ath10k *ar, @@ -461,8 +461,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com static inline int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) { ---- a/ath10k-6.9/wmi-tlv.c -+++ b/ath10k-6.9/wmi-tlv.c +--- a/ath10k-6.10/wmi-tlv.c ++++ b/ath10k-6.10/wmi-tlv.c @@ -4606,6 +4606,8 @@ static const struct wmi_ops wmi_tlv_ops .gen_echo = ath10k_wmi_tlv_op_gen_echo, .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf, @@ -472,8 +472,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com }; static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = { ---- a/ath10k-6.9/wmi.c -+++ b/ath10k-6.9/wmi.c +--- a/ath10k-6.10/wmi.c ++++ b/ath10k-6.10/wmi.c @@ -8467,6 +8467,49 @@ ath10k_wmi_op_gen_peer_set_param(struct return skb; } @@ -570,8 +570,8 @@ Link: https://msgid.link/20230611080505.17393-1-ansuelsmth@gmail.com }; int ath10k_wmi_attach(struct ath10k *ar) ---- a/ath10k-6.9/wmi.h -+++ b/ath10k-6.9/wmi.h +--- a/ath10k-6.10/wmi.h ++++ b/ath10k-6.10/wmi.h @@ -3137,6 +3137,41 @@ enum wmi_10_4_feature_mask { }; diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch index 9bd07a24a6..cd1d300b38 100644 --- a/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch +++ b/package/kernel/ath10k-ct/patches/202-ath10k-use-tpt-trigger-by-default.patch @@ -14,9 +14,9 @@ Signed-off-by: Mathias Kresin ath10k-6.7/mac.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) ---- a/ath10k-6.9/core.h -+++ b/ath10k-6.9/core.h -@@ -1705,6 +1705,10 @@ struct ath10k { +--- a/ath10k-6.10/core.h ++++ b/ath10k-6.10/core.h +@@ -1707,6 +1707,10 @@ struct ath10k { u8 csi_data[4096]; u16 csi_data_len; @@ -27,8 +27,8 @@ Signed-off-by: Mathias Kresin /* must be last */ u8 drv_priv[] __aligned(sizeof(void *)); }; ---- a/ath10k-6.9/leds.c -+++ b/ath10k-6.9/leds.c +--- a/ath10k-6.10/leds.c ++++ b/ath10k-6.10/leds.c @@ -70,7 +70,7 @@ int ath10k_leds_register(struct ath10k * ar->leds.cdev.name = ar->leds.label; @@ -38,8 +38,8 @@ Signed-off-by: Mathias Kresin ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); if (ret) ---- a/ath10k-6.9/mac.c -+++ b/ath10k-6.9/mac.c +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c @@ -11631,7 +11631,7 @@ int ath10k_mac_register(struct ath10k *a ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER; diff --git a/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch b/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch index 122716c24d..89921d6a34 100644 --- a/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch +++ b/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch @@ -1,5 +1,5 @@ ---- a/ath10k-6.9/wmi.h -+++ b/ath10k-6.9/wmi.h +--- a/ath10k-6.10/wmi.h ++++ b/ath10k-6.10/wmi.h @@ -6310,7 +6310,7 @@ struct qca9880_set_ctl_table_cmd { __le32 ctl_len; /* in bytes. This may be ignored in firmware, * make sure ctl_info data is sizeof(qca9880_power_ctl) */ diff --git a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch index c1de78de98..bd25222e1d 100644 --- a/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0010-ath10k-limit-htt-rx-ring-size.patch @@ -1,5 +1,5 @@ ---- a/ath10k-6.9/htt.h -+++ b/ath10k-6.9/htt.h +--- a/ath10k-6.10/htt.h ++++ b/ath10k-6.10/htt.h @@ -238,7 +238,11 @@ enum htt_rx_ring_flags { }; diff --git a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch index 3dcbda3715..708a7caea2 100644 --- a/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch +++ b/package/kernel/ath10k-ct/patches/960-0011-ath10k-limit-pci-buffer-size.patch @@ -1,5 +1,5 @@ ---- a/ath10k-6.9/pci.c -+++ b/ath10k-6.9/pci.c +--- a/ath10k-6.10/pci.c ++++ b/ath10k-6.10/pci.c @@ -132,7 +132,11 @@ static const struct ce_attr pci_host_ce_ .flags = CE_ATTR_FLAGS, .src_nentries = 0, diff --git a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch index 974072fb9a..35026cc0f9 100644 --- a/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch +++ b/package/kernel/ath10k-ct/patches/988-ath10k-always-use-mac80211-loss-detection.patch @@ -13,11 +13,11 @@ own loss detection mechanism. Signed-off-by: David Bauer --- - ath10k-6.9/mac.c | 1 - + ath10k-6.10/mac.c | 1 - 1 file changed, 1 deletion(-) ---- a/ath10k-6.9/mac.c -+++ b/ath10k-6.9/mac.c +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c @@ -11316,7 +11316,6 @@ int ath10k_mac_register(struct ath10k *a ieee80211_hw_set(ar->hw, CHANCTX_STA_CSA); ieee80211_hw_set(ar->hw, QUEUE_CONTROL); From 08eecec3558d9adf351e03b58309e69a77de1a36 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 24 Sep 2024 18:50:01 +0800 Subject: [PATCH 06/16] ramips: introduce TP-Link v1 header OKLI image recipe It can be used to workaround the booting stuck issue caused by the u-boot LZMA decompression error. The new kernel image structure: +------+------------------+------------------+---------------+-----------------+ | name | tplink-v1 header | OKLI lzma-loader | uImage header | lzma kernel+dtb | +------+------------------+------------------+---------------+-----------------+ | size | 0x200 | 0xe00 | 0x40 | dynamic | +------+------------------+------------------+---------------+-----------------+ Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16473 Signed-off-by: Hauke Mehrtens --- target/linux/ramips/image/common-tp-link.mk | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/target/linux/ramips/image/common-tp-link.mk b/target/linux/ramips/image/common-tp-link.mk index cb26275960..665b8f7971 100644 --- a/target/linux/ramips/image/common-tp-link.mk +++ b/target/linux/ramips/image/common-tp-link.mk @@ -1,6 +1,19 @@ DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD DEVICE_VARS += TPLINK_HVERSION TPLINK_BOARD_ID TPLINK_HEADER_VERSION +define Build/tplink-v1-okli-image + cp $(IMAGE_KERNEL) $(IMAGE_ROOTFS).$(word 2,$(1)) + cat $(IMAGE_ROOTFS) >> $(IMAGE_ROOTFS).$(word 2,$(1)) + -$(STAGING_DIR_HOST)/bin/mktplinkfw \ + -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) \ + -N "$(VERSION_DIST)" -V $(REVISION) -m $(TPLINK_HEADER_VERSION) \ + -k "$(KDIR)/loader-$(word 1,$(1)).$(LOADER_TYPE)" -E $(KERNEL_LOADADDR) \ + -r $(IMAGE_ROOTFS).$(word 2,$(1)) -o $@.new -j -X 0x40000 \ + -a $(call rootfs_align,$(FILESYSTEM)) $(wordlist 3,$(words $(1)),$(1)) \ + $(if $(findstring sysupgrade,$(word 2,$(1))),-s) && mv $@.new $@ || rm -f $@ + rm -f $(IMAGE_ROOTFS).$(word 2,$(1)) +endef + define Build/uImage-tplink-c9 mkimage \ -A $(LINUX_KARCH) \ @@ -28,6 +41,18 @@ define Device/tplink-v1 append-metadata endef +define Device/tplink-v1-okli + $(Device/tplink-v1) + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x21000 + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile | pad-to 64k | lzma | pad-to 3584 + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 + IMAGE/factory.bin := tplink-v1-okli-image $(1) factory -e -O + IMAGE/sysupgrade.bin := tplink-v1-okli-image $(1) sysupgrade -e -O | check-size | \ + append-metadata +endef + define Device/tplink-v2 DEVICE_VENDOR := TP-Link TPLINK_FLASHLAYOUT := From b62e6f5beb2a574c67ba5159f0049e54cdf25d69 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 24 Sep 2024 18:50:01 +0800 Subject: [PATCH 07/16] ramips: use OKLI loader for TP-Link RE200 v1 and RE210 v1 Using OKLI image to fix the booting stuck issue. Tested with u-boot extracted from TP-Link stock images "RE200(EU)_V1_171206.zip" and "RE210(US_CA)_V1_171205.zip". Fixes: https://github.com/openwrt/openwrt/issues/16296 Signed-off-by: Shiji Yang Link: https://github.com/openwrt/openwrt/pull/16473 Signed-off-by: Hauke Mehrtens --- target/linux/ramips/dts/mt7620a_tplink_re2x0-v1.dtsi | 5 ++++- target/linux/ramips/image/mt7620.mk | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a_tplink_re2x0-v1.dtsi b/target/linux/ramips/dts/mt7620a_tplink_re2x0-v1.dtsi index 5f06dd4208..371b9f7373 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_re2x0-v1.dtsi +++ b/target/linux/ramips/dts/mt7620a_tplink_re2x0-v1.dtsi @@ -4,6 +4,7 @@ #include #include +#include / { aliases { @@ -63,9 +64,11 @@ }; partition@20000 { - compatible = "tplink,firmware"; + compatible = "openwrt,uimage", "denx,uimage"; label = "firmware"; reg = <0x20000 0x7c0000>; + openwrt,offset = <0x1000>; + openwrt,ih-magic = ; }; partition@7e0000 { diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 9f3a8dce0e..6cf65ad119 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -1290,7 +1290,7 @@ endef TARGET_DEVICES += tplink_ec220-g5-v2 define Device/tplink_re200-v1 - $(Device/tplink-v1) + $(Device/tplink-v1-okli) SOC := mt7620a DEVICE_MODEL := RE200 DEVICE_VARIANT := v1 @@ -1302,7 +1302,7 @@ endef TARGET_DEVICES += tplink_re200-v1 define Device/tplink_re210-v1 - $(Device/tplink-v1) + $(Device/tplink-v1-okli) SOC := mt7620a DEVICE_MODEL := RE210 DEVICE_VARIANT := v1 From cffc52bb9adf8e84e4611c88c8ec4ff2d4111a0c Mon Sep 17 00:00:00 2001 From: Goetz Goerisch Date: Sat, 5 Oct 2024 08:56:43 +0200 Subject: [PATCH 08/16] ramips: ER605v2 fix LED function definition commit 665c2154ef122d10dfffeca95538ebdff82653b5 added support for ER605v2 All three LEDs where configured with LED_FUNCTION_STATUS which worked for 23.05 and kernel 5.15. With the upgrade to kernel 6.6 this leads to a name collision. Therefore the USB and Power LED now use the common.h function LED_FUNCTION_USB and LED_FUNCTION_POWER respectivly. * fixes https://github.com/openwrt/openwrt/issues/16596 Link: https://github.com/openwrt/openwrt/pull/16606 Signed-off-by: Goetz Goerisch Link: https://github.com/openwrt/openwrt/pull/16606 Signed-off-by: Robert Marko --- target/linux/ramips/dts/mt7621_tplink_er605-v2.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts index 28c8e8b083..3d92e343f1 100644 --- a/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts +++ b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts @@ -30,13 +30,13 @@ led_usb: usb { color = ; - function = LED_FUNCTION_STATUS; + function = LED_FUNCTION_USB; gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; }; led_power: power { color = ; - function = LED_FUNCTION_STATUS; + function = LED_FUNCTION_POWER; gpios = <&gpio 12 GPIO_ACTIVE_LOW>; default-state = "on"; }; From 12c1a56ec047d9b70cfb4f3c376c05b523b5537f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 6 Oct 2024 18:52:48 +0200 Subject: [PATCH 09/16] hostapd: reload bss if a relevant ifindex changes This can happen if the bridge or a stacked vlan device gets recreated. Ensure that hostapd sees the change and handles it gracefully. Signed-off-by: Felix Fietkau --- .../network/services/hostapd/files/hostapd.uc | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc index 6774fbf3ba..6bcb32131d 100644 --- a/package/network/services/hostapd/files/hostapd.uc +++ b/package/network/services/hostapd/files/hostapd.uc @@ -22,6 +22,14 @@ hostapd.data.file_fields = { eap_sim_db: true, }; +hostapd.data.iface_fields = { + ft_iface: true, + upnp_iface: true, + snoop_iface: true, + bridge: true, + iapp_interface: true, +}; + function iface_remove(cfg) { if (!cfg || !cfg.bss || !cfg.bss[0] || !cfg.bss[0].ifname) @@ -324,9 +332,24 @@ function bss_remove_file_fields(config) return new_cfg; } +function bss_ifindex_list(config) +{ + config = filter(config, (line) => !!hostapd.data.iface_fields[split(line, "=")[0]]); + + return join(",", map(config, (line) => { + try { + let file = "/sys/class/net/" + split(line, "=")[1] + "/ifindex"; + let val = trim(readfile(file)); + return val; + } catch (e) { + return ""; + } + })); +} + function bss_config_hash(config) { - return hostapd.sha1(remove_file_fields(config) + ""); + return hostapd.sha1(remove_file_fields(config) + bss_ifindex_list(config)); } function bss_find_existing(config, prev_config, prev_hash) From 8660d95860a2ba8edee584954740218adb3b0fd9 Mon Sep 17 00:00:00 2001 From: Janusz Dziedzic Date: Tue, 1 Oct 2024 11:41:23 +0200 Subject: [PATCH 10/16] linux-firmware: intel: update BE200 wifi firmware Kick to version 92 - that already support station MLO correctly. Signed-off-by: Janusz Dziedzic Link: https://github.com/openwrt/openwrt/pull/16558 Signed-off-by: Hauke Mehrtens --- package/firmware/linux-firmware/intel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/firmware/linux-firmware/intel.mk b/package/firmware/linux-firmware/intel.mk index b686a4caf8..cc9bab53f8 100644 --- a/package/firmware/linux-firmware/intel.mk +++ b/package/firmware/linux-firmware/intel.mk @@ -202,7 +202,7 @@ $(eval $(call BuildPackage,iwlwifi-firmware-ax210)) Package/iwlwifi-firmware-be200 = $(call Package/firmware-default,Intel BE200 firmware) define Package/iwlwifi-firmware-be200/install $(INSTALL_DIR) $(1)/lib/firmware - $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-gl-c0-fm-c0-83.ucode $(1)/lib/firmware + $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-gl-c0-fm-c0-92.ucode $(1)/lib/firmware $(INSTALL_DATA) $(PKG_BUILD_DIR)/iwlwifi-gl-c0-fm-c0.pnvm $(1)/lib/firmware endef $(eval $(call BuildPackage,iwlwifi-firmware-be200)) From 3da8e385e0fde0b70d67964ef321482ab27bf95f Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 6 Oct 2024 12:41:45 -0700 Subject: [PATCH 11/16] mediatek: fix wrong compatible string The u-boot,env driver does not have layout in compatible. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16616 Signed-off-by: Robert Marko --- target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts | 4 ++-- .../arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi | 4 ++-- .../arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso | 4 ++-- .../patches-6.6/911-dts-mt7622-bpi-r64-add-rootdisk.patch | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts b/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts index 88538c8b0a..5ee8ba5cd9 100644 --- a/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts +++ b/target/linux/mediatek/dts/mt7622-linksys-e8450-ubi.dts @@ -38,14 +38,14 @@ ubi-volume-ubootenv { volname = "ubootenv"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; ubi-volume-ubootenv2 { volname = "ubootenv2"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi index 14c615b67c..fae5d0ebfa 100644 --- a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi @@ -349,14 +349,14 @@ ubi-volume-ubootenv { volname = "ubootenv"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; ubi-volume-ubootenv2 { volname = "ubootenv2"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso index b5a67c725b..02ecedda72 100644 --- a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-rfb-spim-nand.dtso @@ -44,14 +44,14 @@ ubi-volume-ubootenv { volname = "ubootenv"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; ubi-volume-ubootenv2 { volname = "ubootenv2"; nvmem-layout { - compatible = "u-boot,env-redundant-bool-layout"; + compatible = "u-boot,env-redundant-bool"; }; }; diff --git a/target/linux/mediatek/patches-6.6/911-dts-mt7622-bpi-r64-add-rootdisk.patch b/target/linux/mediatek/patches-6.6/911-dts-mt7622-bpi-r64-add-rootdisk.patch index a28d274493..c378a302d4 100644 --- a/target/linux/mediatek/patches-6.6/911-dts-mt7622-bpi-r64-add-rootdisk.patch +++ b/target/linux/mediatek/patches-6.6/911-dts-mt7622-bpi-r64-add-rootdisk.patch @@ -85,14 +85,14 @@ + ubi-volume-ubootenv { + volname = "ubootenv"; + nvmem-layout { -+ compatible = "u-boot,env-redundant-bool-layout"; ++ compatible = "u-boot,env-redundant-bool"; + }; + }; + + ubi-volume-ubootenv2 { + volname = "ubootenv2"; + nvmem-layout { -+ compatible = "u-boot,env-redundant-bool-layout"; ++ compatible = "u-boot,env-redundant-bool"; + }; + }; + From c80792e666f9a1f40d7b4b846874cdd66d22bd95 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 26 Sep 2024 16:29:43 -0700 Subject: [PATCH 12/16] cmake.mk: disable shared libs for host packages Disable for host to avoid having to use rpath hacks. Signed-off-by: Rosen Penev Link: https://github.com/openwrt/openwrt/pull/16586 Signed-off-by: Robert Marko --- include/cmake.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/cmake.mk b/include/cmake.mk index 00ade7fd7d..87309dd045 100644 --- a/include/cmake.mk +++ b/include/cmake.mk @@ -174,6 +174,7 @@ define Host/Configure/Default -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE \ -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=FALSE \ -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=TRUE \ + -DBUILD_SHARED_LIBS=OFF \ $(CMAKE_HOST_OPTIONS) \ $(HOST_CMAKE_SOURCE_DIR) \ ) From cc29e90d0c822720dcd92890d6ab61ce2e5fd9ac Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 6 Oct 2024 22:02:37 +0200 Subject: [PATCH 13/16] ath10k-ct: select mac80211 debugfs support Trying to compile ath10k-ct without mac80211 debugfs support will result in: openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x_generic/ath10k-ct-regular/ath10k-ct-2024.07.30~ac71b14d/ath10k-6.10/wmi.h:8083:2: error: #warning Please enable ATH10K-DEBUGFS kernel option for optimal support for CT firmware. [-Werror=cpp] 8083 | #warning Please enable ATH10K-DEBUGFS kernel option for optimal support for CT firmware. | ^~~~~~~ cc1: all warnings being treated as errors So, since the driver itself is saying that debugfs is required, then lets make ath10k-ct select mac80211 debugfs support which is selected by default anyway. Fixes: #16302 Link: https://github.com/openwrt/openwrt/pull/16619 Signed-off-by: Robert Marko --- package/kernel/ath10k-ct/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile index dff32716c9..f9795d8c8d 100644 --- a/package/kernel/ath10k-ct/Makefile +++ b/package/kernel/ath10k-ct/Makefile @@ -29,7 +29,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/ath10k-ct SUBMENU:=Wireless Drivers TITLE:=ath10k-ct driver optimized for CT ath10k firmware - DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11AC_SUPPORT @PCI_SUPPORT +kmod-hwmon-core + DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11AC_SUPPORT @PCI_SUPPORT +kmod-hwmon-core +@PACKAGE_MAC80211_DEBUGFS FILES:=\ $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \ $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko From 0b05cc70480af9056f2d1c1efdd464163c50a05a Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 6 Oct 2024 21:42:23 +0200 Subject: [PATCH 14/16] tools: libdeflate: bump to 1.22 Bump to the latest 1.22 version which allows dropping our only patch. Changelog: Version 1.22 * The CMake-based build system now implements a workaround for gcc being paired with a too-old binutils version. This can prevent build errors. Version 1.21 * Fixed build error on x86 with gcc 8.1 and gcc 8.2. * Fixed build error on x86 when gcc 11 is paired with a binutils version that doesn't support AVX-VNNI, e.g. as it is on RHEL 9. * Fixed build error on arm64 with gcc 6. * Fixed build error on arm64 with gcc 13.1 and later with some -mcpu options. * Enabled detection of dotprod support in Windows ARM64 builds. Link: https://github.com/openwrt/openwrt/pull/16617 Signed-off-by: Robert Marko --- tools/libdeflate/Makefile | 6 ++-- ...se-AVX-VNNI-gcc-prerequisite-to-12.1.patch | 32 ------------------- 2 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch diff --git a/tools/libdeflate/Makefile b/tools/libdeflate/Makefile index 6bf25d134d..8f7946d90e 100644 --- a/tools/libdeflate/Makefile +++ b/tools/libdeflate/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libdeflate -PKG_VERSION:=1.20 -PKG_RELEASE:=2 +PKG_VERSION:=1.22 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/ebiggers/libdeflate/releases/download/v$(PKG_VERSION) -PKG_HASH:=c52cf0239fd644d71c9e88613dd7431a5306ebee1280c5791c71ca264869250a +PKG_HASH:=7834d9adbc9a809e0fb0d7b486060a9ae5f7819eb7f55bb8c22b10d7b3bed8da include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch b/tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch deleted file mode 100644 index ea4f4dc4c1..0000000000 --- a/tools/libdeflate/patches/0001-lib-x86-increase-AVX-VNNI-gcc-prerequisite-to-12.1.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e522b1d09d3536ddc15459b4259150f4a53ee65a Mon Sep 17 00:00:00 2001 -From: Eric Biggers -Date: Thu, 4 Apr 2024 20:16:33 -0400 -Subject: [PATCH] lib/x86: increase AVX-VNNI gcc prerequisite to 12.1 - -Although gcc 11.1 supports AVX-VNNI, a popular distro pairs it with a -binutils version that does not. Require gcc 12 instead. - -Resolves https://github.com/ebiggers/libdeflate/issues/365 ---- - lib/x86/adler32_impl.h | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - ---- a/lib/x86/adler32_impl.h -+++ b/lib/x86/adler32_impl.h -@@ -52,8 +52,15 @@ - /* - * AVX-VNNI implementation. This is used on CPUs that have AVX2 and AVX-VNNI - * but don't have AVX-512, for example Intel Alder Lake. -+ * -+ * Unusually for a new CPU feature, gcc added support for the AVX-VNNI -+ * intrinsics (in gcc 11.1) slightly before binutils added support for -+ * assembling AVX-VNNI instructions (in binutils 2.36). Distros can reasonably -+ * have gcc 11 with binutils 2.35. Because of this issue, we check for gcc 12 -+ * instead of gcc 11. (libdeflate supports direct compilation without a -+ * configure step, so checking the binutils version is not always an option.) - */ --#if GCC_PREREQ(11, 1) || CLANG_PREREQ(12, 0, 13000000) || MSVC_PREREQ(1930) -+#if GCC_PREREQ(12, 1) || CLANG_PREREQ(12, 0, 13000000) || MSVC_PREREQ(1930) - # define adler32_x86_avx2_vnni adler32_x86_avx2_vnni - # define SUFFIX _avx2_vnni - # define ATTRIBUTES _target_attribute("avx2,avxvnni") From dae6a871de3df0adca5b7f29a32c8c0642a9415e Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 5 Oct 2024 18:20:35 +0100 Subject: [PATCH 15/16] base-files: don't wipe LED state when adding a single LED Only replace LED state of a single LED instead of removing the entire /var/run/led.state file. Fixes: 511e8f84d0 ("base-files: configure LED when added") Signed-off-by: Daniel Golle --- package/base-files/files/etc/init.d/led | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index 5130ac7d41..7f05254c2b 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -184,7 +184,12 @@ start() { echo "$color" | sed 's/:/\ /g' > \ "/sys/class/leds/$led/multi_intensity" done < /var/run/led.state - rm /var/run/led.state + if [ "$1" ]; then + grep -v "^$1 " /var/run/led.state > /var/run/led.state.new + mv /var/run/led.state.new /var/run/led.state + else + rm /var/run/led.state + fi } config_load system From 73d3789e6792e685aeed039178d263510330f198 Mon Sep 17 00:00:00 2001 From: Janusz Dziedzic Date: Fri, 4 Oct 2024 15:24:14 +0200 Subject: [PATCH 16/16] mac80211: ath12k: allow country set for WCN7850 Update channels when country set. Signed-off-by: Janusz Dziedzic Link: https://github.com/openwrt/openwrt/pull/16613 Signed-off-by: Robert Marko --- ...-and-handle-country-code-for-WCN7850.patch | 924 ++++++++++++++++++ 1 file changed, 924 insertions(+) create mode 100644 package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch diff --git a/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch b/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch new file mode 100644 index 0000000000..d370db1047 --- /dev/null +++ b/package/kernel/mac80211/patches/ath12k/001-wifi-ath12k-add-11d-scan-offload-support-and-handle-country-code-for-WCN7850.patch @@ -0,0 +1,924 @@ +From patchwork Thu Sep 5 02:35:08 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Kang Yang +X-Patchwork-Id: 13791624 +X-Patchwork-Delegate: kvalo@adurom.com +Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com + [205.220.180.131]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by smtp.subspace.kernel.org (Postfix) with ESMTPS id D313D33CFC + for ; Thu, 5 Sep 2024 02:36:17 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + arc=none smtp.client-ip=205.220.180.131 +ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; + t=1725503779; cv=none; + b=blv4mH95IN2AR7Rt90gw/V7DnZRtr3upgAP50X6ew3jh0CusPG6/OTO9CSJVthJnqHU3Y3GT88jaeMzb9+f2xzqgl7+E35TmwN3uf6dFmbp7CD8LL0W6xu76ZZgFGxzRspv9YoVy/fydZY6I4JRc2faWqI540+n9bHEXdSJTZMM= +ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; + s=arc-20240116; t=1725503779; c=relaxed/simple; + bh=vjzfDc6UXtw2Li6Q3bAgcW0K1rcTpi3dAxkQgbT5ogI=; + h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: + MIME-Version:Content-Type; + b=VMgF0PfIOoXmfB6EARb/O+dooXutjAm/cnemJ0RC7uc8TSIAusH1ffc6jF1XndEp+nPTWnuMQ5/d1cE/bPeIvSTxrtWaUepnKNjQDrNKm4NrqmjR446CT9t0VHG16RZ1cmCmU74qXnfgus4XfTqD093lc1N5Q/YRh/kwmcCzxhY= +ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=quicinc.com; + spf=pass smtp.mailfrom=quicinc.com; + dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com + header.b=E5hktrdm; arc=none smtp.client-ip=205.220.180.131 +Authentication-Results: smtp.subspace.kernel.org; + dmarc=pass (p=none dis=none) header.from=quicinc.com +Authentication-Results: smtp.subspace.kernel.org; + spf=pass smtp.mailfrom=quicinc.com +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com + header.b="E5hktrdm" +Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) + by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id + 484MRZwS008193; + Thu, 5 Sep 2024 02:36:12 GMT +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= + cc:content-transfer-encoding:content-type:date:from:in-reply-to + :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= + No6X3gHpioHamjfMDccV8LJEZBGk/uDqbZ/fuGUTvJM=; b=E5hktrdmmOb3KcP6 + Qi3M5Y06Yd8RxNJTps8WMEoXZ7xzROVuhmRmlG/mw21NjBMTTMgtjcaen/n8Anj3 + Ash1VFK6s7PrLcwoUT/uui6hzleGE+X9Wh8DJXYnZKKWmeQ+8E0yEzNR0kt9FG0n + S+asFc8VYEJHid6QDNAfM9e4JqJgU3NGXYJBTBM2lpdbqeWU7LEYnVTGCqvOPaH2 + K+QDwvNiNeXlqbaxnqCYimUrSDnTbSUoiVxSpTe9/muWWAB+6YuUbXRfTceqgcd1 + xFIOE1KrtAowMOk5mO3tn6Tjl7nJzewVUm9hncBRfynP8k2jt1xosMezL42dmb56 + a9VWLQ== +Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com + [129.46.96.20]) + by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 41bt674mq1-1 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); + Thu, 05 Sep 2024 02:36:11 +0000 (GMT) +Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com + [10.47.209.197]) + by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id + 4852aAdV010181 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); + Thu, 5 Sep 2024 02:36:10 GMT +Received: from kangyang.ap.qualcomm.com (10.80.80.8) by + nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server + (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id + 15.2.1544.9; Wed, 4 Sep 2024 19:36:09 -0700 +From: Kang Yang +To: +CC: , +Subject: [PATCH v3 1/4] wifi: ath12k: add configure country code for WCN7850 +Date: Thu, 5 Sep 2024 10:35:08 +0800 +Message-ID: <20240905023511.362-2-quic_kangyang@quicinc.com> +X-Mailer: git-send-email 2.34.1.windows.1 +In-Reply-To: <20240905023511.362-1-quic_kangyang@quicinc.com> +References: <20240905023511.362-1-quic_kangyang@quicinc.com> +Precedence: bulk +X-Mailing-List: linux-wireless@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 +X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To + nalasex01b.na.qualcomm.com (10.47.209.197) +X-QCInternal: smtphost +X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 + signatures=585085 +X-Proofpoint-ORIG-GUID: FzfHe7cZy6IUVu8IKORVKLxkYG9f8WUl +X-Proofpoint-GUID: FzfHe7cZy6IUVu8IKORVKLxkYG9f8WUl +X-Proofpoint-Virus-Version: vendor=baseguard + engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 + definitions=2024-09-05_01,2024-09-04_01,2024-09-02_01 +X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 + malwarescore=0 adultscore=0 + bulkscore=0 mlxscore=0 impostorscore=0 suspectscore=0 phishscore=0 + mlxlogscore=999 lowpriorityscore=0 spamscore=0 clxscore=1015 + priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 + engine=8.19.0-2407110000 definitions=main-2409050018 + +From: Wen Gong + +Add handler to send WMI_SET_CURRENT_COUNTRY_CMDID to firmware, which +is used for WCN7850 to update country code. + +Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 + +Signed-off-by: Wen Gong +Signed-off-by: Kang Yang +Acked-by: Jeff Johnson +--- + drivers/net/wireless/ath/ath12k/wmi.c | 36 +++++++++++++++++++++++++++ + drivers/net/wireless/ath/ath12k/wmi.h | 13 ++++++++++ + 2 files changed, 49 insertions(+) + +--- a/drivers/net/wireless/ath/ath12k/wmi.c ++++ b/drivers/net/wireless/ath/ath12k/wmi.c +@@ -171,6 +171,8 @@ static const struct ath12k_wmi_tlv_polic + .min_len = sizeof(struct ath12k_wmi_p2p_noa_info) }, + [WMI_TAG_P2P_NOA_EVENT] = { + .min_len = sizeof(struct wmi_p2p_noa_event) }, ++ [WMI_TAG_11D_NEW_COUNTRY_EVENT] = { ++ .min_len = sizeof(struct wmi_11d_new_cc_event) }, + }; + + static __le32 ath12k_wmi_tlv_hdr(u32 cmd, u32 len) +@@ -2363,7 +2365,10 @@ int ath12k_wmi_send_scan_start_cmd(struc + cmd->scan_id = cpu_to_le32(arg->scan_id); + cmd->scan_req_id = cpu_to_le32(arg->scan_req_id); + cmd->vdev_id = cpu_to_le32(arg->vdev_id); +- cmd->scan_priority = cpu_to_le32(arg->scan_priority); ++ if (ar->state_11d == ATH12K_11D_PREPARING) ++ arg->scan_priority = WMI_SCAN_PRIORITY_MEDIUM; ++ else ++ arg->scan_priority = WMI_SCAN_PRIORITY_LOW; + cmd->notify_scan_events = cpu_to_le32(arg->notify_scan_events); + + ath12k_wmi_copy_scan_event_cntrl_flags(cmd, arg); +@@ -3083,6 +3088,110 @@ out: + return ret; + } + ++int ath12k_wmi_send_set_current_country_cmd(struct ath12k *ar, ++ struct wmi_set_current_country_arg *arg) ++{ ++ struct ath12k_wmi_pdev *wmi = ar->wmi; ++ struct wmi_set_current_country_cmd *cmd; ++ struct sk_buff *skb; ++ int ret; ++ ++ skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_set_current_country_cmd *)skb->data; ++ cmd->tlv_header = ++ ath12k_wmi_tlv_cmd_hdr(WMI_TAG_SET_CURRENT_COUNTRY_CMD, ++ sizeof(*cmd)); ++ ++ cmd->pdev_id = cpu_to_le32(ar->pdev->pdev_id); ++ memcpy(&cmd->new_alpha2, &arg->alpha2, sizeof(arg->alpha2)); ++ ret = ath12k_wmi_cmd_send(wmi, skb, WMI_SET_CURRENT_COUNTRY_CMDID); ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_WMI, ++ "set current country pdev id %d alpha2 %c%c\n", ++ ar->pdev->pdev_id, ++ arg->alpha2[0], ++ arg->alpha2[1]); ++ ++ if (ret) { ++ ath12k_warn(ar->ab, ++ "failed to send WMI_SET_CURRENT_COUNTRY_CMDID: %d\n", ret); ++ dev_kfree_skb(skb); ++ } ++ ++ return ret; ++} ++ ++int ath12k_wmi_send_11d_scan_start_cmd(struct ath12k *ar, ++ struct wmi_11d_scan_start_arg *arg) ++{ ++ struct ath12k_wmi_pdev *wmi = ar->wmi; ++ struct wmi_11d_scan_start_cmd *cmd; ++ struct sk_buff *skb; ++ int ret; ++ ++ skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_11d_scan_start_cmd *)skb->data; ++ cmd->tlv_header = ++ ath12k_wmi_tlv_cmd_hdr(WMI_TAG_11D_SCAN_START_CMD, ++ sizeof(*cmd)); ++ ++ cmd->vdev_id = cpu_to_le32(arg->vdev_id); ++ cmd->scan_period_msec = cpu_to_le32(arg->scan_period_msec); ++ cmd->start_interval_msec = cpu_to_le32(arg->start_interval_msec); ++ ret = ath12k_wmi_cmd_send(wmi, skb, WMI_11D_SCAN_START_CMDID); ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_WMI, ++ "send 11d scan start vdev id %d period %d ms internal %d ms\n", ++ arg->vdev_id, arg->scan_period_msec, ++ arg->start_interval_msec); ++ ++ if (ret) { ++ ath12k_warn(ar->ab, ++ "failed to send WMI_11D_SCAN_START_CMDID: %d\n", ret); ++ dev_kfree_skb(skb); ++ } ++ ++ return ret; ++} ++ ++int ath12k_wmi_send_11d_scan_stop_cmd(struct ath12k *ar, u32 vdev_id) ++{ ++ struct ath12k_wmi_pdev *wmi = ar->wmi; ++ struct wmi_11d_scan_stop_cmd *cmd; ++ struct sk_buff *skb; ++ int ret; ++ ++ skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd)); ++ if (!skb) ++ return -ENOMEM; ++ ++ cmd = (struct wmi_11d_scan_stop_cmd *)skb->data; ++ cmd->tlv_header = ++ ath12k_wmi_tlv_cmd_hdr(WMI_TAG_11D_SCAN_STOP_CMD, ++ sizeof(*cmd)); ++ ++ cmd->vdev_id = cpu_to_le32(vdev_id); ++ ret = ath12k_wmi_cmd_send(wmi, skb, WMI_11D_SCAN_STOP_CMDID); ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_WMI, ++ "send 11d scan stop vdev id %d\n", ++ cmd->vdev_id); ++ ++ if (ret) { ++ ath12k_warn(ar->ab, ++ "failed to send WMI_11D_SCAN_STOP_CMDID: %d\n", ret); ++ dev_kfree_skb(skb); ++ } ++ ++ return ret; ++} ++ + int + ath12k_wmi_send_twt_enable_cmd(struct ath12k *ar, u32 pdev_id) + { +@@ -5668,6 +5777,50 @@ static void ath12k_wmi_op_ep_tx_credits( + wake_up(&ab->wmi_ab.tx_credits_wq); + } + ++static int ath12k_reg_11d_new_cc_event(struct ath12k_base *ab, struct sk_buff *skb) ++{ ++ const struct wmi_11d_new_cc_event *ev; ++ struct ath12k *ar; ++ struct ath12k_pdev *pdev; ++ const void **tb; ++ int ret, i; ++ ++ tb = ath12k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC); ++ if (IS_ERR(tb)) { ++ ret = PTR_ERR(tb); ++ ath12k_warn(ab, "failed to parse tlv: %d\n", ret); ++ return ret; ++ } ++ ++ ev = tb[WMI_TAG_11D_NEW_COUNTRY_EVENT]; ++ if (!ev) { ++ kfree(tb); ++ ath12k_warn(ab, "failed to fetch 11d new cc ev"); ++ return -EPROTO; ++ } ++ ++ spin_lock_bh(&ab->base_lock); ++ memcpy(&ab->new_alpha2, &ev->new_alpha2, REG_ALPHA2_LEN); ++ spin_unlock_bh(&ab->base_lock); ++ ++ ath12k_dbg(ab, ATH12K_DBG_WMI, "wmi 11d new cc %c%c\n", ++ ab->new_alpha2[0], ++ ab->new_alpha2[1]); ++ ++ kfree(tb); ++ ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++ ++ queue_work(ab->workqueue, &ab->update_11d_work); ++ ++ return 0; ++} ++ + static void ath12k_wmi_htc_tx_complete(struct ath12k_base *ab, + struct sk_buff *skb) + { +@@ -7269,6 +7422,9 @@ static void ath12k_wmi_op_rx(struct ath1 + case WMI_GTK_OFFLOAD_STATUS_EVENTID: + ath12k_wmi_gtk_offload_status_event(ab, skb); + break; ++ case WMI_11D_NEW_COUNTRY_EVENTID: ++ ath12k_reg_11d_new_cc_event(ab, skb); ++ break; + /* TODO: Add remaining events */ + default: + ath12k_dbg(ab, ATH12K_DBG_WMI, "Unknown eventid: 0x%x\n", id); +--- a/drivers/net/wireless/ath/ath12k/wmi.h ++++ b/drivers/net/wireless/ath/ath12k/wmi.h +@@ -3859,6 +3859,28 @@ struct wmi_init_country_cmd { + } cc_info; + } __packed; + ++struct wmi_11d_scan_start_arg { ++ u32 vdev_id; ++ u32 scan_period_msec; ++ u32 start_interval_msec; ++}; ++ ++struct wmi_11d_scan_start_cmd { ++ __le32 tlv_header; ++ __le32 vdev_id; ++ __le32 scan_period_msec; ++ __le32 start_interval_msec; ++} __packed; ++ ++struct wmi_11d_scan_stop_cmd { ++ __le32 tlv_header; ++ __le32 vdev_id; ++} __packed; ++ ++struct wmi_11d_new_cc_event { ++ __le32 new_alpha2; ++} __packed; ++ + struct wmi_delba_send_cmd { + __le32 tlv_header; + __le32 vdev_id; +@@ -3944,6 +3966,16 @@ struct ath12k_wmi_eht_rate_set_params { + #define MAX_6G_REG_RULES 5 + #define REG_US_5G_NUM_REG_RULES 4 + ++struct wmi_set_current_country_arg { ++ u8 alpha2[REG_ALPHA2_LEN]; ++}; ++ ++struct wmi_set_current_country_cmd { ++ __le32 tlv_header; ++ __le32 pdev_id; ++ __le32 new_alpha2; ++} __packed; ++ + enum wmi_start_event_param { + WMI_VDEV_START_RESP_EVENT = 0, + WMI_VDEV_RESTART_RESP_EVENT, +@@ -5546,11 +5578,17 @@ int ath12k_wmi_send_bcn_offload_control_ + u32 vdev_id, u32 bcn_ctrl_op); + int ath12k_wmi_send_init_country_cmd(struct ath12k *ar, + struct ath12k_wmi_init_country_arg *arg); ++int ++ath12k_wmi_send_set_current_country_cmd(struct ath12k *ar, ++ struct wmi_set_current_country_arg *arg); + int ath12k_wmi_peer_rx_reorder_queue_setup(struct ath12k *ar, + int vdev_id, const u8 *addr, + dma_addr_t paddr, u8 tid, + u8 ba_window_size_valid, + u32 ba_window_size); ++int ath12k_wmi_send_11d_scan_start_cmd(struct ath12k *ar, ++ struct wmi_11d_scan_start_arg *arg); ++int ath12k_wmi_send_11d_scan_stop_cmd(struct ath12k *ar, u32 vdev_id); + int + ath12k_wmi_rx_reord_queue_remove(struct ath12k *ar, + struct ath12k_wmi_rx_reorder_queue_remove_arg *arg); +--- a/drivers/net/wireless/ath/ath12k/core.c ++++ b/drivers/net/wireless/ath/ath12k/core.c +@@ -1014,6 +1014,7 @@ void ath12k_core_halt(struct ath12k *ar) + cancel_delayed_work_sync(&ar->scan.timeout); + cancel_work_sync(&ar->regd_update_work); + cancel_work_sync(&ab->rfkill_work); ++ cancel_work_sync(&ab->update_11d_work); + + rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], NULL); + synchronize_rcu(); +@@ -1021,6 +1022,34 @@ void ath12k_core_halt(struct ath12k *ar) + idr_init(&ar->txmgmt_idr); + } + ++static void ath12k_update_11d(struct work_struct *work) ++{ ++ struct ath12k_base *ab = container_of(work, struct ath12k_base, update_11d_work); ++ struct ath12k *ar; ++ struct ath12k_pdev *pdev; ++ struct wmi_set_current_country_arg arg = {}; ++ int ret, i; ++ ++ spin_lock_bh(&ab->base_lock); ++ memcpy(&arg.alpha2, &ab->new_alpha2, 2); ++ spin_unlock_bh(&ab->base_lock); ++ ++ ath12k_dbg(ab, ATH12K_DBG_WMI, "update 11d new cc %c%c\n", ++ arg.alpha2[0], arg.alpha2[1]); ++ ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ ++ memcpy(&ar->alpha2, &arg.alpha2, 2); ++ ret = ath12k_wmi_send_set_current_country_cmd(ar, &arg); ++ if (ret) ++ ath12k_warn(ar->ab, ++ "pdev id %d failed set current country code: %d\n", ++ i, ret); ++ } ++} ++ + static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) + { + struct ath12k *ar; +@@ -1045,8 +1074,10 @@ static void ath12k_core_pre_reconfigure_ + ar = &ah->radio[j]; + + ath12k_mac_drain_tx(ar); ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); + complete(&ar->scan.started); +- complete(&ar->scan.completed); ++ complete_all(&ar->scan.completed); + complete(&ar->scan.on_channel); + complete(&ar->peer_assoc_done); + complete(&ar->peer_delete_done); +@@ -1312,6 +1343,7 @@ struct ath12k_base *ath12k_core_alloc(st + INIT_WORK(&ab->restart_work, ath12k_core_restart); + INIT_WORK(&ab->reset_work, ath12k_core_reset); + INIT_WORK(&ab->rfkill_work, ath12k_rfkill_work); ++ INIT_WORK(&ab->update_11d_work, ath12k_update_11d); + + timer_setup(&ab->rx_replenish_retry, ath12k_ce_rx_replenish_retry, 0); + init_completion(&ab->htc_suspend); +--- a/drivers/net/wireless/ath/ath12k/core.h ++++ b/drivers/net/wireless/ath/ath12k/core.h +@@ -199,6 +199,12 @@ enum ath12k_scan_state { + ATH12K_SCAN_ABORTING, + }; + ++enum ath12k_11d_state { ++ ATH12K_11D_IDLE, ++ ATH12K_11D_PREPARING, ++ ATH12K_11D_RUNNING, ++}; ++ + enum ath12k_dev_flags { + ATH12K_CAC_RUNNING, + ATH12K_FLAG_CRASH_FLUSH, +@@ -313,6 +319,8 @@ struct ath12k_vif_iter { + #define ATH12K_RX_RATE_TABLE_11AX_NUM 576 + #define ATH12K_RX_RATE_TABLE_NUM 320 + ++#define ATH12K_SCAN_TIMEOUT_HZ (20 * HZ) ++ + struct ath12k_rx_peer_rate_stats { + u64 ht_mcs_count[HAL_RX_MAX_MCS_HT + 1]; + u64 vht_mcs_count[HAL_RX_MAX_MCS_VHT + 1]; +@@ -648,6 +656,13 @@ struct ath12k { + u32 freq_low; + u32 freq_high; + ++ /* Protected by wiphy::mtx lock. */ ++ u32 vdev_id_11d_scan; ++ struct completion completed_11d_scan; ++ enum ath12k_11d_state state_11d; ++ u8 alpha2[REG_ALPHA2_LEN]; ++ bool regdom_set_by_user; ++ + bool nlo_enabled; + }; + +@@ -880,6 +895,8 @@ struct ath12k_base { + /* continuous recovery fail count */ + atomic_t fail_cont_count; + unsigned long reset_fail_timeout; ++ struct work_struct update_11d_work; ++ u8 new_alpha2[2]; + struct { + /* protected by data_lock */ + u32 fw_crash_counter; +--- a/drivers/net/wireless/ath/ath12k/mac.c ++++ b/drivers/net/wireless/ath/ath12k/mac.c +@@ -2947,6 +2947,11 @@ static void ath12k_bss_assoc(struct ath1 + if (ret) + ath12k_warn(ar->ab, "failed to set vdev %i OBSS PD parameters: %d\n", + arvif->vdev_id, ret); ++ ++ if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map) && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) ++ ath12k_mac_11d_scan_stop_all(ar->ab); + } + + static void ath12k_bss_disassoc(struct ath12k *ar, +@@ -3522,7 +3527,7 @@ void __ath12k_mac_scan_finish(struct ath + ar->scan_channel = NULL; + ar->scan.roc_freq = 0; + cancel_delayed_work(&ar->scan.timeout); +- complete(&ar->scan.completed); ++ complete_all(&ar->scan.completed); + break; + } + } +@@ -3783,7 +3788,12 @@ scan: + + ret = ath12k_start_scan(ar, &arg); + if (ret) { +- ath12k_warn(ar->ab, "failed to start hw scan: %d\n", ret); ++ if (ret == -EBUSY) ++ ath12k_dbg(ar->ab, ATH12K_DBG_MAC, ++ "scan engine is busy 11d state %d\n", ar->state_11d); ++ else ++ ath12k_warn(ar->ab, "failed to start hw scan: %d\n", ret); ++ + spin_lock_bh(&ar->data_lock); + ar->scan.state = ATH12K_SCAN_IDLE; + spin_unlock_bh(&ar->data_lock); +@@ -3802,6 +3812,11 @@ exit: + + mutex_unlock(&ar->conf_mutex); + ++ if (ar->state_11d == ATH12K_11D_PREPARING && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) ++ ath12k_mac_11d_scan_start(ar, arvif->vdev_id); ++ + return ret; + } + +@@ -5986,7 +6001,7 @@ static int ath12k_mac_start(struct ath12 + + /* TODO: Do we need to enable ANI? */ + +- ath12k_reg_update_chan_list(ar); ++ ath12k_reg_update_chan_list(ar, false); + + ar->num_started_vdevs = 0; + ar->num_created_vdevs = 0; +@@ -6166,6 +6181,9 @@ static void ath12k_mac_stop(struct ath12 + cancel_delayed_work_sync(&ar->scan.timeout); + cancel_work_sync(&ar->regd_update_work); + cancel_work_sync(&ar->ab->rfkill_work); ++ cancel_work_sync(&ar->ab->update_11d_work); ++ ar->state_11d = ATH12K_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) { +@@ -6412,6 +6430,117 @@ static void ath12k_mac_op_update_vif_off + ath12k_mac_update_vif_offload(arvif); + } + ++static bool ath12k_mac_vif_ap_active_any(struct ath12k_base *ab) ++{ ++ struct ath12k *ar; ++ struct ath12k_pdev *pdev; ++ struct ath12k_vif *arvif; ++ int i; ++ ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ list_for_each_entry(arvif, &ar->arvifs, list) { ++ if (arvif->is_up && arvif->vdev_type == WMI_VDEV_TYPE_AP) ++ return true; ++ } ++ } ++ return false; ++} ++ ++void ath12k_mac_11d_scan_start(struct ath12k *ar, u32 vdev_id) ++{ ++ struct wmi_11d_scan_start_arg arg; ++ int ret; ++ ++ lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); ++ ++ if (ar->regdom_set_by_user) ++ goto fin; ++ ++ if (ar->vdev_id_11d_scan != ATH12K_11D_INVALID_VDEV_ID) ++ goto fin; ++ ++ if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) ++ goto fin; ++ ++ if (ath12k_mac_vif_ap_active_any(ar->ab)) ++ goto fin; ++ ++ arg.vdev_id = vdev_id; ++ arg.start_interval_msec = 0; ++ arg.scan_period_msec = ATH12K_SCAN_11D_INTERVAL; ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_MAC, ++ "mac start 11d scan for vdev %d\n", vdev_id); ++ ++ ret = ath12k_wmi_send_11d_scan_start_cmd(ar, &arg); ++ if (ret) { ++ ath12k_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 (ar->state_11d == ATH12K_11D_PREPARING) ++ ar->state_11d = ATH12K_11D_RUNNING; ++ } ++ ++fin: ++ if (ar->state_11d == ATH12K_11D_PREPARING) { ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++} ++ ++void ath12k_mac_11d_scan_stop(struct ath12k *ar) ++{ ++ int ret; ++ u32 vdev_id; ++ ++ lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); ++ ++ if (!test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ar->ab->wmi_ab.svc_map)) ++ return; ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac stop 11d for vdev %d\n", ++ ar->vdev_id_11d_scan); ++ ++ if (ar->state_11d == ATH12K_11D_PREPARING) { ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++ ++ if (ar->vdev_id_11d_scan != ATH12K_11D_INVALID_VDEV_ID) { ++ vdev_id = ar->vdev_id_11d_scan; ++ ++ ret = ath12k_wmi_send_11d_scan_stop_cmd(ar, vdev_id); ++ if (ret) { ++ ath12k_warn(ar->ab, ++ "failed to stopt 11d scan vdev %d ret: %d\n", ++ vdev_id, ret); ++ } else { ++ ar->vdev_id_11d_scan = ATH12K_11D_INVALID_VDEV_ID; ++ ar->state_11d = ATH12K_11D_IDLE; ++ complete(&ar->completed_11d_scan); ++ } ++ } ++} ++ ++void ath12k_mac_11d_scan_stop_all(struct ath12k_base *ab) ++{ ++ struct ath12k *ar; ++ struct ath12k_pdev *pdev; ++ int i; ++ ++ ath12k_dbg(ab, ATH12K_DBG_MAC, "mac stop soc 11d scan\n"); ++ ++ for (i = 0; i < ab->num_radios; i++) { ++ pdev = &ab->pdevs[i]; ++ ar = pdev->ar; ++ ++ ath12k_mac_11d_scan_stop(ar); ++ } ++} ++ + static int ath12k_mac_vdev_create(struct ath12k *ar, struct ieee80211_vif *vif) + { + struct ath12k_hw *ah = ar->ah; +@@ -6526,6 +6655,7 @@ static int ath12k_mac_vdev_create(struct + arvif->vdev_id, ret); + goto err_peer_del; + } ++ ath12k_mac_11d_scan_stop_all(ar->ab); + break; + case WMI_VDEV_TYPE_STA: + param_id = WMI_STA_PS_PARAM_RX_WAKE_POLICY; +@@ -6564,6 +6694,13 @@ static int ath12k_mac_vdev_create(struct + arvif->vdev_id, ret); + goto err_peer_del; + } ++ ++ if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map) && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) { ++ reinit_completion(&ar->completed_11d_scan); ++ ar->state_11d = ATH12K_11D_PREPARING; ++ } + break; + default: + break; +@@ -6904,6 +7041,11 @@ static void ath12k_mac_op_remove_interfa + ath12k_dbg(ab, ATH12K_DBG_MAC, "mac remove interface (vdev %d)\n", + arvif->vdev_id); + ++ if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map) && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE) ++ ath12k_mac_11d_scan_stop(ar); ++ + if (arvif->vdev_type == WMI_VDEV_TYPE_AP) { + ret = ath12k_peer_delete(ar, arvif->vdev_id, vif->addr); + if (ret) +@@ -7744,6 +7886,14 @@ ath12k_mac_op_unassign_vif_chanctx(struc + ar->num_started_vdevs == 1 && ar->monitor_vdev_created) + ath12k_mac_monitor_stop(ar); + ++ if (test_bit(WMI_TLV_SERVICE_11D_OFFLOAD, ab->wmi_ab.svc_map) && ++ arvif->vdev_type == WMI_VDEV_TYPE_STA && ++ arvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE && ++ ar->state_11d != ATH12K_11D_PREPARING) { ++ reinit_completion(&ar->completed_11d_scan); ++ ar->state_11d = ATH12K_11D_PREPARING; ++ } ++ + mutex_unlock(&ar->conf_mutex); + } + +@@ -8282,6 +8432,14 @@ ath12k_mac_op_reconfig_complete(struct i + ath12k_warn(ar->ab, "pdev %d successfully recovered\n", + ar->pdev->pdev_id); + ++ if (ar->ab->hw_params->current_cc_support && ++ ar->alpha2[0] != 0 && ar->alpha2[1] != 0) { ++ struct wmi_set_current_country_arg arg = {}; ++ ++ memcpy(&arg.alpha2, ar->alpha2, 2); ++ ath12k_wmi_send_set_current_country_cmd(ar, &arg); ++ } ++ + if (ab->is_reset) { + recovery_count = atomic_inc_return(&ab->recovery_count); + +@@ -9331,6 +9489,9 @@ static void ath12k_mac_setup(struct ath1 + + INIT_WORK(&ar->wmi_mgmt_tx_work, ath12k_mgmt_over_wmi_tx_work); + skb_queue_head_init(&ar->wmi_mgmt_tx_queue); ++ ++ ar->vdev_id_11d_scan = ATH12K_11D_INVALID_VDEV_ID; ++ init_completion(&ar->completed_11d_scan); + } + + int ath12k_mac_register(struct ath12k_base *ab) +--- a/drivers/net/wireless/ath/ath12k/mac.h ++++ b/drivers/net/wireless/ath/ath12k/mac.h +@@ -51,6 +51,13 @@ enum ath12k_supported_bw { + + extern const struct htt_rx_ring_tlv_filter ath12k_mac_mon_status_filter_default; + ++#define ATH12K_SCAN_11D_INTERVAL 600000 ++#define ATH12K_11D_INVALID_VDEV_ID 0xFFFF ++ ++void ath12k_mac_11d_scan_start(struct ath12k *ar, u32 vdev_id); ++void ath12k_mac_11d_scan_stop(struct ath12k *ar); ++void ath12k_mac_11d_scan_stop_all(struct ath12k_base *ab); ++ + void ath12k_mac_destroy(struct ath12k_base *ab); + void ath12k_mac_unregister(struct ath12k_base *ab); + int ath12k_mac_register(struct ath12k_base *ab); +--- a/drivers/net/wireless/ath/ath12k/reg.c ++++ b/drivers/net/wireless/ath/ath12k/reg.c +@@ -48,6 +48,7 @@ ath12k_reg_notifier(struct wiphy *wiphy, + { + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); + struct ath12k_wmi_init_country_arg arg; ++ struct wmi_set_current_country_arg current_arg = {}; + struct ath12k_hw *ah = ath12k_hw_to_ah(hw); + struct ath12k *ar = ath12k_ah_to_ar(ah, 0); + int ret, i; +@@ -77,27 +78,38 @@ ath12k_reg_notifier(struct wiphy *wiphy, + return; + } + +- /* Set the country code to the firmware and wait for +- * the WMI_REG_CHAN_LIST_CC EVENT for updating the +- * reg info +- */ +- arg.flags = ALPHA_IS_SET; +- memcpy(&arg.cc_info.alpha2, request->alpha2, 2); +- arg.cc_info.alpha2[2] = 0; +- + /* Allow fresh updates to wiphy regd */ + ah->regd_updated = false; + + /* Send the reg change request to all the radios */ + for_each_ar(ah, ar, i) { +- ret = ath12k_wmi_send_init_country_cmd(ar, &arg); +- if (ret) +- ath12k_warn(ar->ab, +- "INIT Country code set to fw failed : %d\n", ret); ++ if (ar->ab->hw_params->current_cc_support) { ++ memcpy(¤t_arg.alpha2, request->alpha2, 2); ++ memcpy(&ar->alpha2, ¤t_arg.alpha2, 2); ++ ret = ath12k_wmi_send_set_current_country_cmd(ar, ¤t_arg); ++ if (ret) ++ ath12k_warn(ar->ab, ++ "failed set current country code: %d\n", ret); ++ } else { ++ arg.flags = ALPHA_IS_SET; ++ memcpy(&arg.cc_info.alpha2, request->alpha2, 2); ++ arg.cc_info.alpha2[2] = 0; ++ ++ ret = ath12k_wmi_send_init_country_cmd(ar, &arg); ++ if (ret) ++ ath12k_warn(ar->ab, ++ "failed set INIT Country code: %d\n", ret); ++ } ++ ++ wiphy_lock(wiphy); ++ ath12k_mac_11d_scan_stop(ar); ++ wiphy_unlock(wiphy); ++ ++ ar->regdom_set_by_user = true; + } + } + +-int ath12k_reg_update_chan_list(struct ath12k *ar) ++int ath12k_reg_update_chan_list(struct ath12k *ar, bool wait) + { + struct ieee80211_supported_band **bands; + struct ath12k_wmi_scan_chan_list_arg *arg; +@@ -106,7 +118,35 @@ int ath12k_reg_update_chan_list(struct a + struct ath12k_wmi_channel_arg *ch; + enum nl80211_band band; + int num_channels = 0; +- int i, ret; ++ int i, ret, left; ++ ++ if (wait && ar->state_11d != ATH12K_11D_IDLE) { ++ left = wait_for_completion_timeout(&ar->completed_11d_scan, ++ ATH12K_SCAN_TIMEOUT_HZ); ++ if (!left) { ++ ath12k_dbg(ar->ab, ATH12K_DBG_REG, ++ "failed to receive 11d scan complete: timed out\n"); ++ ar->state_11d = ATH12K_11D_IDLE; ++ } ++ ath12k_dbg(ar->ab, ATH12K_DBG_REG, ++ "reg 11d scan wait left time %d\n", left); ++ } ++ ++ if (wait && ++ (ar->scan.state == ATH12K_SCAN_STARTING || ++ ar->scan.state == ATH12K_SCAN_RUNNING)) { ++ left = wait_for_completion_timeout(&ar->scan.completed, ++ ATH12K_SCAN_TIMEOUT_HZ); ++ if (!left) ++ ath12k_dbg(ar->ab, ATH12K_DBG_REG, ++ "failed to receive hw scan complete: timed out\n"); ++ ++ ath12k_dbg(ar->ab, ATH12K_DBG_REG, ++ "reg hw scan wait left time %d\n", left); ++ } ++ ++ if (ar->ah->state == ATH12K_HW_STATE_RESTARTING) ++ return 0; + + bands = hw->wiphy->bands; + for (band = 0; band < NUM_NL80211_BANDS; band++) { +@@ -295,7 +335,7 @@ int ath12k_regd_update(struct ath12k *ar + */ + for_each_ar(ah, ar, i) { + ab = ar->ab; +- ret = ath12k_reg_update_chan_list(ar); ++ ret = ath12k_reg_update_chan_list(ar, true); + if (ret) + goto err; + } +--- a/drivers/net/wireless/ath/ath12k/reg.h ++++ b/drivers/net/wireless/ath/ath12k/reg.h +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: BSD-3-Clause-Clear */ + /* + * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. +- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. ++ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. + */ + + #ifndef ATH12K_REG_H +@@ -96,6 +96,6 @@ struct ieee80211_regdomain *ath12k_reg_b + struct ath12k_reg_info *reg_info, + bool intersect); + int ath12k_regd_update(struct ath12k *ar, bool init); +-int ath12k_reg_update_chan_list(struct ath12k *ar); ++int ath12k_reg_update_chan_list(struct ath12k *ar, bool wait); + + #endif +--- a/drivers/net/wireless/ath/ath12k/hw.c ++++ b/drivers/net/wireless/ath/ath12k/hw.c +@@ -926,6 +926,7 @@ static const struct ath12k_hw_params ath + .supports_dynamic_smps_6ghz = true, + + .iova_mask = 0, ++ .current_cc_support = false, + }, + { + .name = "wcn7850 hw2.0", +@@ -1004,6 +1005,7 @@ static const struct ath12k_hw_params ath + .supports_dynamic_smps_6ghz = false, + + .iova_mask = ATH12K_PCIE_MAX_PAYLOAD_SIZE - 1, ++ .current_cc_support = true, + }, + { + .name = "qcn9274 hw2.0", +@@ -1078,6 +1080,7 @@ static const struct ath12k_hw_params ath + .supports_dynamic_smps_6ghz = true, + + .iova_mask = 0, ++ .current_cc_support = false, + }, + }; + +--- a/drivers/net/wireless/ath/ath12k/hw.h ++++ b/drivers/net/wireless/ath/ath12k/hw.h +@@ -189,6 +189,7 @@ struct ath12k_hw_params { + bool tcl_ring_retry:1; + bool reoq_lut_support:1; + bool supports_shadow_regs:1; ++ bool current_cc_support:1; + + u32 num_tcl_banks; + u32 max_tx_ring;