Re: [ath9k-devel] [RFC] ath9k: move RELAY and DEBUG_FS to ATH9K[_HTC]_DEBUGFS

2017-01-09 Thread Kalle Valo
Christian Lamparter  writes:

> Currently, the common ath9k_common module needs to have a
> dependency on RELAY and DEBUG_FS in order to built. This
> is usually not a problem. But for RAM and FLASH starved
> AR71XX devices, every little bit counts.
>
> This patch adds a new symbol CONFIG_ATH9K_COMMON_DEBUG
> which makes it possible to drop the RELAY and DEBUG_FS
> dependency there and move it to ATH_(HTC)_DEBUGFS.
>
> Note: The shared FFT/spectral code (which is the only user
> of the relayfs in ath9k*) needs DEBUG_FS to export the relayfs
> interface to dump the data to userspace. So it makes no sense
> to have the functions compiled in, if DEBUG_FS is not there.
>
> Signed-off-by: Christian Lamparter 
> ---
> Here are some numbers for my WD Range Extender (AR7370 with a AR9300):
> For both configurations MAC80211_DEBUGFS and ATH_DEBUG is disabled.
> (if they are enabled, there should be no change). All sizes are in
> bytes. And I only test with or without the patch applied.
>
> module | file size | .text size |
> ath9k_common.ko (w/o)  | 32208 |  12832 |
> ath9k_common.ko (with) | 12204 |   3456 |
>
> Note: The kernel with the patch, doesn't need RELAY support anymore.
> Therefore it shrinks a bit as well.
>
>   | lzma uimage size | .text size |
> kernel (w/o)  |  1181777 |3004592 |
> kernel (with) |  1179666 |2999448 |
>
> If anyone wants to play with it, I made a test-patch For LEDE [0].
> Just remember to disable CONFIG_PACKAGE_MAC80211_DEBUGFS and
> CONFIG_PACKAGE_ATH_DEBUG.
>
> There are more ways to do this. Let's hear if there's support for
> it or not. The main motivation was that relayfs can be very costly
> on the RAM as well (on ath10k in can eat like 4MiB with VM 
> debugging etc...).
>
> [0] 
> 

No complaints so far so I guess people don't have any issues :) Please
submit this as a proper patch and if there are no comments I'll apply
it.

-- 
Kalle Valo
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [RFC] ath9k: move RELAY and DEBUG_FS to ATH9K[_HTC]_DEBUGFS

2017-01-06 Thread Christian Lamparter
Currently, the common ath9k_common module needs to have a
dependency on RELAY and DEBUG_FS in order to built. This
is usually not a problem. But for RAM and FLASH starved
AR71XX devices, every little bit counts.

This patch adds a new symbol CONFIG_ATH9K_COMMON_DEBUG
which makes it possible to drop the RELAY and DEBUG_FS
dependency there and move it to ATH_(HTC)_DEBUGFS.

Note: The shared FFT/spectral code (which is the only user
of the relayfs in ath9k*) needs DEBUG_FS to export the relayfs
interface to dump the data to userspace. So it makes no sense
to have the functions compiled in, if DEBUG_FS is not there.

Signed-off-by: Christian Lamparter 
---
Here are some numbers for my WD Range Extender (AR7370 with a AR9300):
For both configurations MAC80211_DEBUGFS and ATH_DEBUG is disabled.
(if they are enabled, there should be no change). All sizes are in
bytes. And I only test with or without the patch applied.

module | file size | .text size |
ath9k_common.ko (w/o)  | 32208 |  12832 |
ath9k_common.ko (with) | 12204 |   3456 |

Note: The kernel with the patch, doesn't need RELAY support anymore.
Therefore it shrinks a bit as well.

  | lzma uimage size | .text size |
kernel (w/o)  |  1181777 |3004592 |
kernel (with) |  1179666 |2999448 |

If anyone wants to play with it, I made a test-patch For LEDE [0].
Just remember to disable CONFIG_PACKAGE_MAC80211_DEBUGFS and
CONFIG_PACKAGE_ATH_DEBUG.

There are more ways to do this. Let's hear if there's support for
it or not. The main motivation was that relayfs can be very costly
on the RAM as well (on ath10k in can eat like 4MiB with VM 
debugging etc...).

[0] 

---
---
 drivers/net/wireless/ath/ath9k/Kconfig   |  9 ++--
 drivers/net/wireless/ath/ath9k/Makefile  |  5 +++--
 drivers/net/wireless/ath/ath9k/common-debug.h| 27 
 drivers/net/wireless/ath/ath9k/common-spectral.c |  2 +-
 drivers/net/wireless/ath/ath9k/common-spectral.h | 23 
 drivers/net/wireless/ath/ath9k/eeprom_4k.c   |  2 +-
 drivers/net/wireless/ath/ath9k/eeprom_9287.c |  2 +-
 drivers/net/wireless/ath/ath9k/eeprom_def.c  |  2 +-
 8 files changed, 64 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/Kconfig 
b/drivers/net/wireless/ath/ath9k/Kconfig
index 8f231c67dd51..783a38f1a626 100644
--- a/drivers/net/wireless/ath/ath9k/Kconfig
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
@@ -3,8 +3,8 @@ config ATH9K_HW
 config ATH9K_COMMON
tristate
select ATH_COMMON
-   select DEBUG_FS
-   select RELAY
+config ATH9K_COMMON_DEBUG
+   bool
 config ATH9K_DFS_DEBUGFS
def_bool y
depends on ATH9K_DEBUGFS && ATH9K_DFS_CERTIFIED
@@ -60,12 +60,14 @@ config ATH9K_DEBUGFS
bool "Atheros ath9k debugging"
depends on ATH9K && DEBUG_FS
select MAC80211_DEBUGFS
+   select ATH9K_COMMON_DEBUG
select 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.
 
 config ATH9K_STATION_STATISTICS
bool "Detailed station statistics"
@@ -174,8 +176,11 @@ config ATH9K_HTC
 config ATH9K_HTC_DEBUGFS
bool "Atheros ath9k_htc debugging"
depends on ATH9K_HTC && DEBUG_FS
+   select ATH9K_COMMON_DEBUG
+   select RELAY
---help---
  Say Y, if you need access to ath9k_htc's statistics.
+ As well as access to the FFT/spectral data.
 
 config ATH9K_HWRNG
bool "Random number generator support"
diff --git a/drivers/net/wireless/ath/ath9k/Makefile 
b/drivers/net/wireless/ath/ath9k/Makefile
index 76f9dc37500b..36a40ffdce15 100644
--- a/drivers/net/wireless/ath/ath9k/Makefile
+++ b/drivers/net/wireless/ath/ath9k/Makefile
@@ -60,8 +60,9 @@ obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o
 ath9k_common-y:=   common.o \
common-init.o \
common-beacon.o \
-   common-debug.o \
-   common-spectral.o
+
+ath9k_common-$(CONFIG_ATH9K_COMMON_DEBUG) += common-debug.o \
+common-spectral.o
 
 ath9k_htc-y += htc_hst.o \
hif_usb.o \
diff --git a/drivers/net/wireless/ath/ath9k/common-debug.h 
b/drivers/net/wireless/ath/ath9k/common-debug.h
index 7c9788490f7f..3376990d3a24 100644
--- a/drivers/net/wireless/ath/ath9k/common-debug.h
+++ b/drivers/net/wireless/ath/ath9k/common-debug.h
@@ -60,6 +60,7 @@ struct ath_rx_stats {
u32 rx_spectral;
 };
 
+#ifdef CONFIG_ATH9K_COMMON_DEBUG
 void ath9k_cmn_debug_modal_eeprom(struct dentry *debugfs_phy,
  struct ath_hw *ah);
 void ath9k_cmn_debug_base_ee