ath9k, ath10k(-ct): move spectral scan support under a separate config symbol
authorMatthias Schiffer <mschiffer@universe-factory.net>
Wed, 10 Jan 2018 20:46:46 +0000 (21:46 +0100)
committerMatthias Schiffer <mschiffer@universe-factory.net>
Sat, 13 Jan 2018 18:54:45 +0000 (19:54 +0100)
Backport patches that separate spectral scan support from general debugfs
support of ath9k/ath10k; this allows to remove the dependency on
KERNEL_RELAY from these driver packages even with debugfs enabled and
avoids the memory footprint of the relay buffers allocated by ath9k/ath10k
even when they aren't used at all.

The KERNEL_RELAY dependency is moved to a new config symbol that enables
spectral scan support in these drivers.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
package/kernel/ath10k-ct/Makefile
package/kernel/ath10k-ct/patches/200-ath10k-move-spectral-scan-support-under-a-separate-c.patch [new file with mode: 0644]
package/kernel/mac80211/Makefile
package/kernel/mac80211/patches/321-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch [new file with mode: 0644]
package/kernel/mac80211/patches/321-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch [new file with mode: 0644]

index 82d7664b76e1fd143b2e7373bb05a3fddb64ae2b..fe094e76a3c3f5759ba7706eb415b0d28decfb9c 100644 (file)
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ath10k-ct
-PKG_RELEASE=1
+PKG_RELEASE=2
 
 PKG_LICENSE:=GPLv2
 PKG_LICENSE_FILES:=
@@ -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_11N_SUPPORT +@DRIVER_11AC_SUPPORT @PCI_SUPPORT +@KERNEL_RELAY +kmod-hwmon-core
+  DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT @PCI_SUPPORT +kmod-hwmon-core
   FILES:=\
        $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \
        $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko
@@ -69,6 +69,11 @@ ifdef CONFIG_PACKAGE_ATH_DFS
   NOSTDINC_FLAGS += -DCONFIG_ATH10K_DFS_CERTIFIED
 endif
 
+ifdef CONFIG_PACKAGE_ATH_SPECTRAL
+  CT_MAKEDEFS += CONFIG_ATH10K_SPECTRAL=y
+  NOSTDINC_FLAGS += -DCONFIG_ATH10K_SPECTRAL
+endif
+
 define Build/Configure
        cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
 endef
diff --git a/package/kernel/ath10k-ct/patches/200-ath10k-move-spectral-scan-support-under-a-separate-c.patch b/package/kernel/ath10k-ct/patches/200-ath10k-move-spectral-scan-support-under-a-separate-c.patch
new file mode 100644 (file)
index 0000000..bdc82f0
--- /dev/null
@@ -0,0 +1,81 @@
+From 42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61 Mon Sep 17 00:00:00 2001
+Message-Id: <42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61.1515610034.git.mschiffer@universe-factory.net>
+In-Reply-To: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net>
+References: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Mon, 27 Nov 2017 18:56:23 +0100
+Subject: [PATCH 2/2] ath10k: move spectral scan support under a separate
+ config symbol
+
+At the moment, spectral scan support, and with it RELAY, is always enabled
+with ATH10K_DEBUGFS. Spectral scan support is currently the only user of
+RELAY in ath10k, and it unconditionally reserves a relay channel.
+
+Having debugfs support in ath10k is often useful even on very small
+embedded routers, where we'd rather like to avoid the code size and RAM
+usage of the relay support. While ath10k-based devices usually have more
+resources than ath9k-based ones, it makes sense to keep the configuration
+symmetric to ath9k, so the same base kernel without RELAY can be used for
+both ath9k and ath10k hardware.
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
+---
+ ath10k-4.13/Kconfig    | 9 ++++++++-
+ ath10k-4.13/Makefile   | 2 +-
+ ath10k-4.13/spectral.h | 4 ++--
+ 3 files changed, 11 insertions(+), 4 deletions(-)
+
+--- a/ath10k-4.13/Kconfig
++++ b/ath10k-4.13/Kconfig
+@@ -40,12 +40,19 @@ config ATH10K_DEBUG
+ config ATH10K_DEBUGFS
+       bool "Atheros ath10k debugfs support"
+       depends on ATH10K && DEBUG_FS
+-      select RELAY
+       ---help---
+         Enabled debugfs support
+         If unsure, say Y to make it easier to debug problems.
++config ATH10K_SPECTRAL
++      bool "Atheros ath10k spectral scan support"
++      depends on ATH10K_DEBUGFS
++      select RELAY
++      default n
++      ---help---
++        Say Y to enable access to the FFT/spectral data via debugfs.
++
+ config ATH10K_TRACING
+       bool "Atheros ath10k tracing support"
+       depends on ATH10K
+--- a/ath10k-4.13/Makefile
++++ b/ath10k-4.13/Makefile
+@@ -14,7 +14,7 @@ ath10k_core-y += mac.o \
+                p2p.o \
+                swap.o
+-ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o
++ath10k_core-$(CONFIG_ATH10K_SPECTRAL) += spectral.o
+ ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
+ ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o
+ ath10k_core-$(CONFIG_THERMAL) += thermal.o
+--- a/ath10k-4.13/spectral.h
++++ b/ath10k-4.13/spectral.h
+@@ -44,7 +44,7 @@ enum ath10k_spectral_mode {
+       SPECTRAL_MANUAL,
+ };
+-#ifdef CONFIG_ATH10K_DEBUGFS
++#ifdef CONFIG_ATH10K_SPECTRAL
+ int ath10k_spectral_process_fft(struct ath10k *ar,
+                               struct wmi_phyerr_ev_arg *phyerr,
+@@ -85,6 +85,6 @@ static inline void ath10k_spectral_destr
+ {
+ }
+-#endif /* CONFIG_ATH10K_DEBUGFS */
++#endif /* CONFIG_ATH10K_SPECTRAL */
+ #endif /* SPECTRAL_H */
index 385bea4d2f5db3325f96db767a893b903da81261..cf17c9f4fecda2e010512dba43e48e4cc482f794 100644 (file)
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 PKG_NAME:=mac80211
 
 PKG_VERSION:=2017-11-01
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
 PKG_HASH:=8437ab7886b988c8152e7a4db30b7f41009e49a3b2cb863edd05da1ecd7eb05a
 
@@ -55,6 +55,7 @@ PKG_CONFIG_DEPENDS:= \
        CONFIG_PACKAGE_MAC80211_TRACING \
        CONFIG_PACKAGE_ATH_DEBUG \
        CONFIG_PACKAGE_ATH_DFS \
+       CONFIG_PACKAGE_ATH_SPECTRAL \
        CONFIG_PACKAGE_B43_DEBUG \
        CONFIG_PACKAGE_B43_PIO \
        CONFIG_PACKAGE_B43_PHY_G \
@@ -188,6 +189,13 @@ define KernelPackage/ath/config
 
                  Select this option if you want to use such channels.
 
+       config PACKAGE_ATH_SPECTRAL
+               bool "Atheros spectral scan support"
+               depends on PACKAGE_ATH_DEBUG
+               select KERNEL_RELAY
+               help
+                 Say Y to enable access to the FFT/spectral data via debugfs.
+
   endif
 endef
 
@@ -222,7 +230,7 @@ define KernelPackage/ath6kl
   TITLE:=Atheros FullMAC wireless devices (common code for ath6kl_sdio and ath6kl_usb)
   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath6kl
   HIDDEN:=1
-  DEPENDS+= +kmod-ath +@DRIVER_11N_SUPPORT +@KERNEL_RELAY
+  DEPENDS+= +kmod-ath +@DRIVER_11N_SUPPORT
   FILES:= $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath6kl/ath6kl_core.ko
 endef
 
@@ -259,7 +267,7 @@ define KernelPackage/ath9k-common
   TITLE:=Atheros 802.11n wireless devices (common code for ath9k and ath9k_htc)
   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath9k
   HIDDEN:=1
-  DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
+  DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ar71xx +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11W_SUPPORT
   FILES:= \
        $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_common.ko \
        $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_hw.ko
@@ -316,7 +324,7 @@ define KernelPackage/ath10k
   $(call KernelPackage/mac80211/Default)
   TITLE:=Atheros 802.11ac wireless cards support
   URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath10k
-  DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT +@KERNEL_RELAY
+  DEPENDS+= @PCI_SUPPORT +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT
   FILES:= \
        $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
        $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
@@ -1571,6 +1579,7 @@ config-$(call config_package,airo) += AIRO
 config-$(call config_package,ath) += ATH_CARDS ATH_COMMON ATH_REG_DYNAMIC_USER_REG_HINTS
 config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS
 config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
+config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL
 
 config-$(call config_package,ath9k) += ATH9K
 config-$(call config_package,ath9k-common) += ATH9K_COMMON
diff --git a/package/kernel/mac80211/patches/321-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch b/package/kernel/mac80211/patches/321-0001-ath9k-move-spectral-scan-support-under-a-separate-co.patch
new file mode 100644 (file)
index 0000000..703051f
--- /dev/null
@@ -0,0 +1,103 @@
+From 9df7ddc3ed25b7d3473f117a0680b9418adb5753 Mon Sep 17 00:00:00 2001
+Message-Id: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Mon, 27 Nov 2017 18:56:22 +0100
+Subject: [PATCH 1/2] ath9k: move spectral scan support under a separate config
+ symbol
+
+At the moment, spectral scan support, and with it RELAY, is always enabled
+with ATH9K[_HTC]_DEBUGFS. Spectral scan support is currently the only user
+of RELAY in ath9k, and it unconditionally reserves a relay channel.
+
+Having debugfs support in ath9k is often useful even on very small embedded
+routers, where we'd rather like to avoid the code size and RAM usage of the
+relay support.
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
+---
+ drivers/net/wireless/ath/ath9k/Kconfig           | 14 ++++++++++----
+ drivers/net/wireless/ath/ath9k/Makefile          |  4 ++--
+ drivers/net/wireless/ath/ath9k/common-spectral.h |  4 ++--
+ 3 files changed, 14 insertions(+), 8 deletions(-)
+
+--- a/drivers/net/wireless/ath/ath9k/Kconfig
++++ b/drivers/net/wireless/ath/ath9k/Kconfig
+@@ -64,13 +64,12 @@ config ATH9K_DEBUGFS
+       depends on ATH9K && DEBUG_FS
+       select MAC80211_DEBUGFS
+       select ATH9K_COMMON_DEBUG
+-      depends on RELAY
+       ---help---
+         Say Y, if you need access to ath9k's statistics for
+         interrupts, rate control, etc.
+-        Also required for changing debug message flags at run time.
+-        As well as access to the FFT/spectral data and TX99.
++        Also required for changing debug message flags at run time and for
++        TX99.
+ config ATH9K_STATION_STATISTICS
+       bool "Detailed station statistics"
+@@ -181,7 +180,6 @@ config ATH9K_HTC_DEBUGFS
+       bool "Atheros ath9k_htc debugging"
+       depends on ATH9K_HTC && DEBUG_FS
+       select ATH9K_COMMON_DEBUG
+-      depends on RELAY
+       ---help---
+         Say Y, if you need access to ath9k_htc's statistics.
+         As well as access to the FFT/spectral data.
+@@ -197,3 +195,11 @@ config ATH9K_HWRNG
+         Say Y, feeds the entropy directly from the WiFi driver to the input
+         pool.
++
++config ATH9K_COMMON_SPECTRAL
++      bool "Atheros ath9k/ath9k_htc spectral scan support"
++      depends on ATH9K_DEBUGFS || ATH9K_HTC_DEBUGFS
++      depends on RELAY
++      default n
++      ---help---
++        Say Y to enable access to the FFT/spectral data via debugfs.
+--- a/drivers/net/wireless/ath/ath9k/Makefile
++++ b/drivers/net/wireless/ath/ath9k/Makefile
+@@ -61,8 +61,8 @@ ath9k_common-y:=     common.o \
+                       common-init.o \
+                       common-beacon.o \
+-ath9k_common-$(CPTCFG_ATH9K_COMMON_DEBUG) += common-debug.o \
+-                                           common-spectral.o
++ath9k_common-$(CPTCFG_ATH9K_COMMON_DEBUG) += common-debug.o
++ath9k_common-$(CPTCFG_ATH9K_COMMON_SPECTRAL) += common-spectral.o
+ ath9k_htc-y +=        htc_hst.o \
+               hif_usb.o \
+--- a/drivers/net/wireless/ath/ath9k/common-spectral.h
++++ b/drivers/net/wireless/ath/ath9k/common-spectral.h
+@@ -151,7 +151,7 @@ static inline u8 spectral_bitmap_weight(
+       return bins[0] & 0x3f;
+ }
+-#ifdef CPTCFG_ATH9K_COMMON_DEBUG
++#ifdef CPTCFG_ATH9K_COMMON_SPECTRAL
+ void ath9k_cmn_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, struct dentry *debugfs_phy);
+ void ath9k_cmn_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv);
+@@ -183,6 +183,6 @@ static inline int ath_cmn_process_fft(st
+ {
+       return 0;
+ }
+-#endif /* CPTCFG_ATH9K_COMMON_DEBUG */
++#endif /* CPTCFG_ATH9K_COMMON_SPECTRAL */
+ #endif /* SPECTRAL_H */
+--- a/local-symbols
++++ b/local-symbols
+@@ -116,6 +116,7 @@ ATH9K_PCOEM=
+ ATH9K_HTC=
+ ATH9K_HTC_DEBUGFS=
+ ATH9K_HWRNG=
++ATH9K_COMMON_SPECTRAL=
+ CARL9170=
+ CARL9170_LEDS=
+ CARL9170_DEBUGFS=
diff --git a/package/kernel/mac80211/patches/321-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch b/package/kernel/mac80211/patches/321-0002-ath10k-move-spectral-scan-support-under-a-separate-c.patch
new file mode 100644 (file)
index 0000000..604a6f1
--- /dev/null
@@ -0,0 +1,91 @@
+From 42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61 Mon Sep 17 00:00:00 2001
+Message-Id: <42e01cb9cb109fb0bb4743f6c54d6aa67ac39b61.1515610034.git.mschiffer@universe-factory.net>
+In-Reply-To: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net>
+References: <9df7ddc3ed25b7d3473f117a0680b9418adb5753.1515610034.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Mon, 27 Nov 2017 18:56:23 +0100
+Subject: [PATCH 2/2] ath10k: move spectral scan support under a separate
+ config symbol
+
+At the moment, spectral scan support, and with it RELAY, is always enabled
+with ATH10K_DEBUGFS. Spectral scan support is currently the only user of
+RELAY in ath10k, and it unconditionally reserves a relay channel.
+
+Having debugfs support in ath10k is often useful even on very small
+embedded routers, where we'd rather like to avoid the code size and RAM
+usage of the relay support. While ath10k-based devices usually have more
+resources than ath9k-based ones, it makes sense to keep the configuration
+symmetric to ath9k, so the same base kernel without RELAY can be used for
+both ath9k and ath10k hardware.
+
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
+---
+ drivers/net/wireless/ath/ath10k/Kconfig    | 9 ++++++++-
+ drivers/net/wireless/ath/ath10k/Makefile   | 2 +-
+ drivers/net/wireless/ath/ath10k/spectral.h | 4 ++--
+ 3 files changed, 11 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/wireless/ath/ath10k/Kconfig
++++ b/drivers/net/wireless/ath/ath10k/Kconfig
+@@ -51,12 +51,19 @@ config ATH10K_DEBUG
+ config ATH10K_DEBUGFS
+       bool "Atheros ath10k debugfs support"
+       depends on ATH10K && DEBUG_FS
+-      depends on RELAY
+       ---help---
+         Enabled debugfs support
+         If unsure, say Y to make it easier to debug problems.
++config ATH10K_SPECTRAL
++      bool "Atheros ath10k spectral scan support"
++      depends on ATH10K_DEBUGFS
++      depends on RELAY
++      default n
++      ---help---
++        Say Y to enable access to the FFT/spectral data via debugfs.
++
+ config ATH10K_TRACING
+       depends on !KERNEL_3_4
+       bool "Atheros ath10k tracing support"
+--- a/drivers/net/wireless/ath/ath10k/Makefile
++++ b/drivers/net/wireless/ath/ath10k/Makefile
+@@ -14,7 +14,7 @@ ath10k_core-y += mac.o \
+                p2p.o \
+                swap.o
+-ath10k_core-$(CPTCFG_ATH10K_DEBUGFS) += spectral.o
++ath10k_core-$(CPTCFG_ATH10K_SPECTRAL) += spectral.o
+ ath10k_core-$(CPTCFG_NL80211_TESTMODE) += testmode.o
+ ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o
+ ath10k_core-$(CPTCFG_ATH10K_THERMAL) += thermal.o
+--- a/drivers/net/wireless/ath/ath10k/spectral.h
++++ b/drivers/net/wireless/ath/ath10k/spectral.h
+@@ -44,7 +44,7 @@ enum ath10k_spectral_mode {
+       SPECTRAL_MANUAL,
+ };
+-#ifdef CPTCFG_ATH10K_DEBUGFS
++#ifdef CPTCFG_ATH10K_SPECTRAL
+ int ath10k_spectral_process_fft(struct ath10k *ar,
+                               struct wmi_phyerr_ev_arg *phyerr,
+@@ -85,6 +85,6 @@ static inline void ath10k_spectral_destr
+ {
+ }
+-#endif /* CPTCFG_ATH10K_DEBUGFS */
++#endif /* CPTCFG_ATH10K_SPECTRAL */
+ #endif /* SPECTRAL_H */
+--- a/local-symbols
++++ b/local-symbols
+@@ -140,6 +140,7 @@ ATH10K_SDIO=
+ ATH10K_USB=
+ ATH10K_DEBUG=
+ ATH10K_DEBUGFS=
++ATH10K_SPECTRAL=
+ ATH10K_TRACING=
+ ATH10K_DFS_CERTIFIED=
+ WCN36XX=