diff options
author | Michael Buesch <mb@bu3sch.de> | 2009-01-25 09:49:59 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:01:47 -0500 |
commit | 060210f938d8aa0b9d795588a2274cd67ba9d6a4 (patch) | |
tree | 74eceabb2bb5b945862f49e567bf862d243ff13a /drivers/net/wireless/b43 | |
parent | 08e87a833f5e77ff33b64c9ac27cb7fb9ecd4a48 (diff) |
b43: Dynamically control log verbosity
Dynamically control the log verbosity with a module parameter.
This enables us to dynamically enable debugging messages (or disable
info, warn, error messages) via module parameter or /sys/module/b43/parameters/verbose.
This increases the module size by about 3k. But in practice it reduces the
module size for the user, because some distributions ship the b43 module
with CONFIG_B43_DEBUG set, which increases the module by about 15k.
So with this patch applied, distributions should really _disable_ CONFIG_B43_DEBUG.
There is no reason to keep it in a production-release kernel.
So we have a net reduction in size by about 12k.
This patch also adds a printk of the wireless core revision, so people
don't have to enable SSB debugging to get the wireless core revision.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r-- | drivers/net/wireless/b43/Kconfig | 14 | ||||
-rw-r--r-- | drivers/net/wireless/b43/b43.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/b43/debugfs.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/b43/debugfs.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.h | 18 |
6 files changed, 60 insertions, 19 deletions
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index 1f81d36f87c5..aab71a70ba78 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -110,10 +110,18 @@ config B43_DEBUG | |||
110 | bool "Broadcom 43xx debugging" | 110 | bool "Broadcom 43xx debugging" |
111 | depends on B43 | 111 | depends on B43 |
112 | ---help--- | 112 | ---help--- |
113 | Broadcom 43xx debugging messages. | 113 | Broadcom 43xx debugging. |
114 | 114 | ||
115 | Say Y, if you want to find out why the driver does not | 115 | This adds additional runtime sanity checks and statistics to the driver. |
116 | work for you. | 116 | These checks and statistics might me expensive and hurt runtime performance |
117 | of your system. | ||
118 | This also adds the b43 debugfs interface. | ||
119 | |||
120 | Do not enable this, unless you are debugging the driver. | ||
121 | |||
122 | Say N, if you are a distributor or user building a release kernel | ||
123 | for production use. | ||
124 | Only say Y, if you are debugging a problem in the b43 driver sourcecode. | ||
117 | 125 | ||
118 | config B43_FORCE_PIO | 126 | config B43_FORCE_PIO |
119 | bool "Force usage of PIO instead of DMA" | 127 | bool "Force usage of PIO instead of DMA" |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 9e0da212f8ce..e9d60f0910be 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -878,12 +878,9 @@ void b43err(struct b43_wl *wl, const char *fmt, ...) | |||
878 | __attribute__ ((format(printf, 2, 3))); | 878 | __attribute__ ((format(printf, 2, 3))); |
879 | void b43warn(struct b43_wl *wl, const char *fmt, ...) | 879 | void b43warn(struct b43_wl *wl, const char *fmt, ...) |
880 | __attribute__ ((format(printf, 2, 3))); | 880 | __attribute__ ((format(printf, 2, 3))); |
881 | #if B43_DEBUG | ||
882 | void b43dbg(struct b43_wl *wl, const char *fmt, ...) | 881 | void b43dbg(struct b43_wl *wl, const char *fmt, ...) |
883 | __attribute__ ((format(printf, 2, 3))); | 882 | __attribute__ ((format(printf, 2, 3))); |
884 | #else /* DEBUG */ | 883 | |
885 | # define b43dbg(wl, fmt...) do { /* nothing */ } while (0) | ||
886 | #endif /* DEBUG */ | ||
887 | 884 | ||
888 | /* A WARN_ON variant that vanishes when b43 debugging is disabled. | 885 | /* A WARN_ON variant that vanishes when b43 debugging is disabled. |
889 | * This _also_ evaluates the arg with debugging disabled. */ | 886 | * This _also_ evaluates the arg with debugging disabled. */ |
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index 7ed0eeeddeaa..bc2767da46e8 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -668,9 +668,18 @@ B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1); | |||
668 | B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0); | 668 | B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0); |
669 | 669 | ||
670 | 670 | ||
671 | int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) | 671 | bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) |
672 | { | 672 | { |
673 | return !!(dev->dfsentry && dev->dfsentry->dyn_debug[feature]); | 673 | bool enabled; |
674 | |||
675 | enabled = (dev->dfsentry && dev->dfsentry->dyn_debug[feature]); | ||
676 | if (unlikely(enabled)) { | ||
677 | /* Force full debugging messages, if the user enabled | ||
678 | * some dynamic debugging feature. */ | ||
679 | b43_modparam_verbose = B43_VERBOSITY_MAX; | ||
680 | } | ||
681 | |||
682 | return enabled; | ||
674 | } | 683 | } |
675 | 684 | ||
676 | static void b43_remove_dynamic_debug(struct b43_wldev *dev) | 685 | static void b43_remove_dynamic_debug(struct b43_wldev *dev) |
diff --git a/drivers/net/wireless/b43/debugfs.h b/drivers/net/wireless/b43/debugfs.h index 91a2f2918a2e..b9d4de4a979c 100644 --- a/drivers/net/wireless/b43/debugfs.h +++ b/drivers/net/wireless/b43/debugfs.h | |||
@@ -71,7 +71,7 @@ struct b43_dfsentry { | |||
71 | struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG]; | 71 | struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG]; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature); | 74 | bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature); |
75 | 75 | ||
76 | void b43_debugfs_init(void); | 76 | void b43_debugfs_init(void); |
77 | void b43_debugfs_exit(void); | 77 | void b43_debugfs_exit(void); |
@@ -82,7 +82,7 @@ void b43_debugfs_log_txstat(struct b43_wldev *dev, | |||
82 | 82 | ||
83 | #else /* CONFIG_B43_DEBUG */ | 83 | #else /* CONFIG_B43_DEBUG */ |
84 | 84 | ||
85 | static inline int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) | 85 | static inline bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature) |
86 | { | 86 | { |
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index e41c10fd31d3..dbb8765506e8 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | Copyright (c) 2005 Martin Langer <martin-langer@gmx.de> | 5 | Copyright (c) 2005 Martin Langer <martin-langer@gmx.de> |
6 | Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it> | 6 | Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it> |
7 | Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de> | 7 | Copyright (c) 2005-2009 Michael Buesch <mb@bu3sch.de> |
8 | Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> | 8 | Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> |
9 | Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> | 9 | Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> |
10 | 10 | ||
@@ -88,6 +88,10 @@ static int modparam_btcoex = 1; | |||
88 | module_param_named(btcoex, modparam_btcoex, int, 0444); | 88 | module_param_named(btcoex, modparam_btcoex, int, 0444); |
89 | MODULE_PARM_DESC(btcoex, "Enable Bluetooth coexistance (default on)"); | 89 | MODULE_PARM_DESC(btcoex, "Enable Bluetooth coexistance (default on)"); |
90 | 90 | ||
91 | int b43_modparam_verbose = B43_VERBOSITY_DEFAULT; | ||
92 | module_param_named(verbose, b43_modparam_verbose, int, 0644); | ||
93 | MODULE_PARM_DESC(verbose, "Log message verbosity: 0=error, 1=warn, 2=info(default), 3=debug"); | ||
94 | |||
91 | 95 | ||
92 | static const struct ssb_device_id b43_ssb_tbl[] = { | 96 | static const struct ssb_device_id b43_ssb_tbl[] = { |
93 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5), | 97 | SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5), |
@@ -300,6 +304,8 @@ void b43info(struct b43_wl *wl, const char *fmt, ...) | |||
300 | { | 304 | { |
301 | va_list args; | 305 | va_list args; |
302 | 306 | ||
307 | if (b43_modparam_verbose < B43_VERBOSITY_INFO) | ||
308 | return; | ||
303 | if (!b43_ratelimit(wl)) | 309 | if (!b43_ratelimit(wl)) |
304 | return; | 310 | return; |
305 | va_start(args, fmt); | 311 | va_start(args, fmt); |
@@ -313,6 +319,8 @@ void b43err(struct b43_wl *wl, const char *fmt, ...) | |||
313 | { | 319 | { |
314 | va_list args; | 320 | va_list args; |
315 | 321 | ||
322 | if (b43_modparam_verbose < B43_VERBOSITY_ERROR) | ||
323 | return; | ||
316 | if (!b43_ratelimit(wl)) | 324 | if (!b43_ratelimit(wl)) |
317 | return; | 325 | return; |
318 | va_start(args, fmt); | 326 | va_start(args, fmt); |
@@ -326,6 +334,8 @@ void b43warn(struct b43_wl *wl, const char *fmt, ...) | |||
326 | { | 334 | { |
327 | va_list args; | 335 | va_list args; |
328 | 336 | ||
337 | if (b43_modparam_verbose < B43_VERBOSITY_WARN) | ||
338 | return; | ||
329 | if (!b43_ratelimit(wl)) | 339 | if (!b43_ratelimit(wl)) |
330 | return; | 340 | return; |
331 | va_start(args, fmt); | 341 | va_start(args, fmt); |
@@ -335,18 +345,18 @@ void b43warn(struct b43_wl *wl, const char *fmt, ...) | |||
335 | va_end(args); | 345 | va_end(args); |
336 | } | 346 | } |
337 | 347 | ||
338 | #if B43_DEBUG | ||
339 | void b43dbg(struct b43_wl *wl, const char *fmt, ...) | 348 | void b43dbg(struct b43_wl *wl, const char *fmt, ...) |
340 | { | 349 | { |
341 | va_list args; | 350 | va_list args; |
342 | 351 | ||
352 | if (b43_modparam_verbose < B43_VERBOSITY_DEBUG) | ||
353 | return; | ||
343 | va_start(args, fmt); | 354 | va_start(args, fmt); |
344 | printk(KERN_DEBUG "b43-%s debug: ", | 355 | printk(KERN_DEBUG "b43-%s debug: ", |
345 | (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan"); | 356 | (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan"); |
346 | vprintk(fmt, args); | 357 | vprintk(fmt, args); |
347 | va_end(args); | 358 | va_end(args); |
348 | } | 359 | } |
349 | #endif /* DEBUG */ | ||
350 | 360 | ||
351 | static void b43_ram_write(struct b43_wldev *dev, u16 offset, u32 val) | 361 | static void b43_ram_write(struct b43_wldev *dev, u16 offset, u32 val) |
352 | { | 362 | { |
@@ -3589,9 +3599,7 @@ static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
3589 | u8 algorithm; | 3599 | u8 algorithm; |
3590 | u8 index; | 3600 | u8 index; |
3591 | int err; | 3601 | int err; |
3592 | #if B43_DEBUG | 3602 | static const u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
3593 | static const u8 bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; | ||
3594 | #endif | ||
3595 | 3603 | ||
3596 | if (modparam_nohwcrypt) | 3604 | if (modparam_nohwcrypt) |
3597 | return -ENOSPC; /* User disabled HW-crypto */ | 3605 | return -ENOSPC; /* User disabled HW-crypto */ |
@@ -4744,9 +4752,10 @@ static int b43_wireless_init(struct ssb_device *dev) | |||
4744 | INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work); | 4752 | INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work); |
4745 | 4753 | ||
4746 | ssb_set_devtypedata(dev, wl); | 4754 | ssb_set_devtypedata(dev, wl); |
4747 | b43info(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id); | 4755 | b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n", |
4756 | dev->bus->chip_id, dev->id.revision); | ||
4748 | err = 0; | 4757 | err = 0; |
4749 | out: | 4758 | out: |
4750 | return err; | 4759 | return err; |
4751 | } | 4760 | } |
4752 | 4761 | ||
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h index e6d90f377d9b..40abcf5d1b43 100644 --- a/drivers/net/wireless/b43/main.h +++ b/drivers/net/wireless/b43/main.h | |||
@@ -40,6 +40,24 @@ | |||
40 | 40 | ||
41 | 41 | ||
42 | extern int b43_modparam_qos; | 42 | extern int b43_modparam_qos; |
43 | extern int b43_modparam_verbose; | ||
44 | |||
45 | /* Logmessage verbosity levels. Update the b43_modparam_verbose helptext, if | ||
46 | * you add or remove levels. */ | ||
47 | enum b43_verbosity { | ||
48 | B43_VERBOSITY_ERROR, | ||
49 | B43_VERBOSITY_WARN, | ||
50 | B43_VERBOSITY_INFO, | ||
51 | B43_VERBOSITY_DEBUG, | ||
52 | __B43_VERBOSITY_AFTERLAST, /* keep last */ | ||
53 | |||
54 | B43_VERBOSITY_MAX = __B43_VERBOSITY_AFTERLAST - 1, | ||
55 | #if B43_DEBUG | ||
56 | B43_VERBOSITY_DEFAULT = B43_VERBOSITY_DEBUG, | ||
57 | #else | ||
58 | B43_VERBOSITY_DEFAULT = B43_VERBOSITY_INFO, | ||
59 | #endif | ||
60 | }; | ||
43 | 61 | ||
44 | 62 | ||
45 | /* Lightweight function to convert a frequency (in Mhz) to a channel number. */ | 63 | /* Lightweight function to convert a frequency (in Mhz) to a channel number. */ |