aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2009-07-17 12:30:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:25 -0400
commita562a9dda7f47e7cac58d80bf1ffe441feca510e (patch)
tree54750221d88a8dbd22fba73d4154dda9edbdf91b /drivers/net
parent34a66de628b5dcc4a93129610ccd24814935e8cd (diff)
iwlwifi: make debug level more user friendly
* Deprecate the "debug50" module parameter used to obtain 5000 series and up debugging. Replace it with "debug" module parameter to match with original driver and be consistent between them. The "debug50" module parameter can still be used, except that the module parameter is not writable in keeping with its previous state. We currently just mark it as "deprecated" and do not have it in the feature-removal-schedule. Some more cleanup of module parameters needs to be done and can then be entered together. * Only make "debug" module parameters visible if the driver is compiled with CONFIG_IWLWIFI_DEBUG. This will eliminate a lot of confusion where users think they have set debug flags but yet cannot see any debug output. * Make module parameters writable. This eliminates the need for the "debug_level" sysfs file, which can now also be deprecated and added to feature-removal-schedule. This file is in significant use though with many iwlwifi documents and text referring users to it. We can thus not take its removal lightly and keep it around. With iwlcore shared between iwlagn and iwl3945 we really do not need debug module parameters for each but can instead have one debug module parameter for the iwlcore module. The same issue is here as with the sysfs file - a lot of iwlwifi documentation and text (like bug reports) rely on iwlagn and iwl3945 having this module parameter, so changing this to a module parameter of iwlcore will have significant impact and we do not do this for that reason. One consequence of this patch is that if a user is running a system with both 3945 and later hardware then the setting of the one module parameter will affect the value of the other. The likelihood of this seems low - and even if this setup is present it does not seem like an issue for both modules to run with the same debug level. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c31
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c25
12 files changed, 55 insertions, 46 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 14a47c0a158..8ee403cd9b9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -502,14 +502,14 @@ static void _iwl3945_dbg_report_frame(struct iwl_priv *priv,
502 } 502 }
503 } 503 }
504 if (print_dump) 504 if (print_dump)
505 iwl_print_hex_dump(priv, IWL_DL_RX, data, length); 505 iwl_print_hex_dump(IWL_DL_RX, data, length);
506} 506}
507 507
508static void iwl3945_dbg_report_frame(struct iwl_priv *priv, 508static void iwl3945_dbg_report_frame(struct iwl_priv *priv,
509 struct iwl_rx_packet *pkt, 509 struct iwl_rx_packet *pkt,
510 struct ieee80211_hdr *header, int group100) 510 struct ieee80211_hdr *header, int group100)
511{ 511{
512 if (priv->debug_level & IWL_DL_RX) 512 if (iwl_debug_level & IWL_DL_RX)
513 _iwl3945_dbg_report_frame(priv, pkt, header, group100); 513 _iwl3945_dbg_report_frame(priv, pkt, header, group100);
514} 514}
515 515
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 272409c8061..c30a1b96057 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2376,8 +2376,6 @@ module_param_named(antenna, iwl4965_mod_params.antenna, int, 0444);
2376MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); 2376MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
2377module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, 0444); 2377module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, 0444);
2378MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); 2378MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])");
2379module_param_named(debug, iwl4965_mod_params.debug, uint, 0444);
2380MODULE_PARM_DESC(debug, "debug output mask");
2381module_param_named( 2379module_param_named(
2382 disable_hw_scan, iwl4965_mod_params.disable_hw_scan, int, 0444); 2380 disable_hw_scan, iwl4965_mod_params.disable_hw_scan, int, 0444);
2383MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); 2381MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)");
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 74103cfcace..702db07fa38 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1745,8 +1745,6 @@ MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
1745module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444); 1745module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444);
1746MODULE_PARM_DESC(swcrypto50, 1746MODULE_PARM_DESC(swcrypto50,
1747 "using software crypto engine (default 0 [hardware])\n"); 1747 "using software crypto engine (default 0 [hardware])\n");
1748module_param_named(debug50, iwl50_mod_params.debug, uint, 0444);
1749MODULE_PARM_DESC(debug50, "50XX debug output mask");
1750module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, 0444); 1748module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, 0444);
1751MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series"); 1749MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series");
1752module_param_named(11n_disable50, iwl50_mod_params.disable_11n, int, 0444); 1750module_param_named(11n_disable50, iwl50_mod_params.disable_11n, int, 0444);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index f61f653a1b7..ff4a546f1e6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -904,7 +904,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
904 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); 904 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh);
905 905
906#ifdef CONFIG_IWLWIFI_DEBUG 906#ifdef CONFIG_IWLWIFI_DEBUG
907 if (priv->debug_level & IWL_DL_ISR) { 907 if (iwl_debug_level & IWL_DL_ISR) {
908 /* just for debug */ 908 /* just for debug */
909 inta_mask = iwl_read32(priv, CSR_INT_MASK); 909 inta_mask = iwl_read32(priv, CSR_INT_MASK);
910 IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 910 IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
@@ -939,7 +939,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
939 } 939 }
940 940
941#ifdef CONFIG_IWLWIFI_DEBUG 941#ifdef CONFIG_IWLWIFI_DEBUG
942 if (priv->debug_level & (IWL_DL_ISR)) { 942 if (iwl_debug_level & (IWL_DL_ISR)) {
943 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 943 /* NIC fires this, but we don't use it, redundant with WAKEUP */
944 if (inta & CSR_INT_BIT_SCD) { 944 if (inta & CSR_INT_BIT_SCD) {
945 IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " 945 IWL_DEBUG_ISR(priv, "Scheduler finished to transmit "
@@ -1053,7 +1053,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
1053 iwl_enable_interrupts(priv); 1053 iwl_enable_interrupts(priv);
1054 1054
1055#ifdef CONFIG_IWLWIFI_DEBUG 1055#ifdef CONFIG_IWLWIFI_DEBUG
1056 if (priv->debug_level & (IWL_DL_ISR)) { 1056 if (iwl_debug_level & (IWL_DL_ISR)) {
1057 inta = iwl_read32(priv, CSR_INT); 1057 inta = iwl_read32(priv, CSR_INT);
1058 inta_mask = iwl_read32(priv, CSR_INT_MASK); 1058 inta_mask = iwl_read32(priv, CSR_INT_MASK);
1059 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 1059 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
@@ -1084,7 +1084,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
1084 inta = priv->inta; 1084 inta = priv->inta;
1085 1085
1086#ifdef CONFIG_IWLWIFI_DEBUG 1086#ifdef CONFIG_IWLWIFI_DEBUG
1087 if (priv->debug_level & IWL_DL_ISR) { 1087 if (iwl_debug_level & IWL_DL_ISR) {
1088 /* just for debug */ 1088 /* just for debug */
1089 inta_mask = iwl_read32(priv, CSR_INT_MASK); 1089 inta_mask = iwl_read32(priv, CSR_INT_MASK);
1090 IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x\n ", 1090 IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x\n ",
@@ -1112,7 +1112,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
1112 } 1112 }
1113 1113
1114#ifdef CONFIG_IWLWIFI_DEBUG 1114#ifdef CONFIG_IWLWIFI_DEBUG
1115 if (priv->debug_level & (IWL_DL_ISR)) { 1115 if (iwl_debug_level & (IWL_DL_ISR)) {
1116 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 1116 /* NIC fires this, but we don't use it, redundant with WAKEUP */
1117 if (inta & CSR_INT_BIT_SCD) { 1117 if (inta & CSR_INT_BIT_SCD) {
1118 IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " 1118 IWL_DEBUG_ISR(priv, "Scheduler finished to transmit "
@@ -2456,14 +2456,16 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw,
2456 * used for controlling the debug level. 2456 * used for controlling the debug level.
2457 * 2457 *
2458 * See the level definitions in iwl for details. 2458 * See the level definitions in iwl for details.
2459 *
2460 * FIXME This file can be deprecated as the module parameter is
2461 * writable and users can thus also change the debug level
2462 * using the /sys/module/iwl3945/parameters/debug file.
2459 */ 2463 */
2460 2464
2461static ssize_t show_debug_level(struct device *d, 2465static ssize_t show_debug_level(struct device *d,
2462 struct device_attribute *attr, char *buf) 2466 struct device_attribute *attr, char *buf)
2463{ 2467{
2464 struct iwl_priv *priv = dev_get_drvdata(d); 2468 return sprintf(buf, "0x%08X\n", iwl_debug_level);
2465
2466 return sprintf(buf, "0x%08X\n", priv->debug_level);
2467} 2469}
2468static ssize_t store_debug_level(struct device *d, 2470static ssize_t store_debug_level(struct device *d,
2469 struct device_attribute *attr, 2471 struct device_attribute *attr,
@@ -2477,7 +2479,7 @@ static ssize_t store_debug_level(struct device *d,
2477 if (ret) 2479 if (ret)
2478 IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf); 2480 IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);
2479 else 2481 else
2480 priv->debug_level = val; 2482 iwl_debug_level = val;
2481 2483
2482 return strnlen(buf, count); 2484 return strnlen(buf, count);
2483} 2485}
@@ -2829,7 +2831,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2829 /* Disabling hardware scan means that mac80211 will perform scans 2831 /* Disabling hardware scan means that mac80211 will perform scans
2830 * "the hard way", rather than using device's scan. */ 2832 * "the hard way", rather than using device's scan. */
2831 if (cfg->mod_params->disable_hw_scan) { 2833 if (cfg->mod_params->disable_hw_scan) {
2832 if (cfg->mod_params->debug & IWL_DL_INFO) 2834 if (iwl_debug_level & IWL_DL_INFO)
2833 dev_printk(KERN_DEBUG, &(pdev->dev), 2835 dev_printk(KERN_DEBUG, &(pdev->dev),
2834 "Disabling hw_scan\n"); 2836 "Disabling hw_scan\n");
2835 iwl_hw_ops.hw_scan = NULL; 2837 iwl_hw_ops.hw_scan = NULL;
@@ -2851,7 +2853,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2851 priv->inta_mask = CSR_INI_SET_MASK; 2853 priv->inta_mask = CSR_INI_SET_MASK;
2852 2854
2853#ifdef CONFIG_IWLWIFI_DEBUG 2855#ifdef CONFIG_IWLWIFI_DEBUG
2854 priv->debug_level = priv->cfg->mod_params->debug;
2855 atomic_set(&priv->restrict_refcnt, 0); 2856 atomic_set(&priv->restrict_refcnt, 0);
2856#endif 2857#endif
2857 2858
@@ -3211,3 +3212,11 @@ static void __exit iwl_exit(void)
3211 3212
3212module_exit(iwl_exit); 3213module_exit(iwl_exit);
3213module_init(iwl_init); 3214module_init(iwl_init);
3215
3216#ifdef CONFIG_IWLWIFI_DEBUG
3217module_param_named(debug50, iwl_debug_level, uint, 0444);
3218MODULE_PARM_DESC(debug50, "50XX debug output mask (deprecated)");
3219module_param_named(debug, iwl_debug_level, uint, 0644);
3220MODULE_PARM_DESC(debug, "debug output mask");
3221#endif
3222
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 8655e092fca..976004f6c7d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -59,6 +59,9 @@ MODULE_LICENSE("GPL");
59 IWL_RATE_##pp##M_INDEX, \ 59 IWL_RATE_##pp##M_INDEX, \
60 IWL_RATE_##np##M_INDEX } 60 IWL_RATE_##np##M_INDEX }
61 61
62u32 iwl_debug_level;
63EXPORT_SYMBOL(iwl_debug_level);
64
62static irqreturn_t iwl_isr(int irq, void *data); 65static irqreturn_t iwl_isr(int irq, void *data);
63 66
64/* 67/*
@@ -1275,7 +1278,7 @@ static void iwl_print_rx_config_cmd(struct iwl_priv *priv)
1275 struct iwl_rxon_cmd *rxon = &priv->staging_rxon; 1278 struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
1276 1279
1277 IWL_DEBUG_RADIO(priv, "RX CONFIG:\n"); 1280 IWL_DEBUG_RADIO(priv, "RX CONFIG:\n");
1278 iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); 1281 iwl_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
1279 IWL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); 1282 IWL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
1280 IWL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); 1283 IWL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
1281 IWL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n", 1284 IWL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n",
@@ -1505,7 +1508,7 @@ void iwl_irq_handle_error(struct iwl_priv *priv)
1505 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 1508 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
1506 1509
1507#ifdef CONFIG_IWLWIFI_DEBUG 1510#ifdef CONFIG_IWLWIFI_DEBUG
1508 if (priv->debug_level & IWL_DL_FW_ERRORS) { 1511 if (iwl_debug_level & IWL_DL_FW_ERRORS) {
1509 iwl_dump_nic_error_log(priv); 1512 iwl_dump_nic_error_log(priv);
1510 iwl_dump_nic_event_log(priv); 1513 iwl_dump_nic_event_log(priv);
1511 iwl_print_rx_config_cmd(priv); 1514 iwl_print_rx_config_cmd(priv);
@@ -2004,7 +2007,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
2004 } 2007 }
2005 2008
2006#ifdef CONFIG_IWLWIFI_DEBUG 2009#ifdef CONFIG_IWLWIFI_DEBUG
2007 if (priv->debug_level & (IWL_DL_ISR)) { 2010 if (iwl_debug_level & (IWL_DL_ISR)) {
2008 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 2011 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
2009 IWL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, " 2012 IWL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, "
2010 "fh 0x%08x\n", inta, inta_mask, inta_fh); 2013 "fh 0x%08x\n", inta, inta_mask, inta_fh);
@@ -2311,7 +2314,7 @@ void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
2311 IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled " 2314 IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled "
2312 "notification for %s:\n", 2315 "notification for %s:\n",
2313 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); 2316 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
2314 iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); 2317 iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
2315} 2318}
2316EXPORT_SYMBOL(iwl_rx_pm_debug_statistics_notif); 2319EXPORT_SYMBOL(iwl_rx_pm_debug_statistics_notif);
2317 2320
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index a697b843863..f82ec9e4da0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -190,7 +190,6 @@ struct iwl_ops {
190 190
191struct iwl_mod_params { 191struct iwl_mod_params {
192 int sw_crypto; /* def: 0 = using hardware encryption */ 192 int sw_crypto; /* def: 0 = using hardware encryption */
193 u32 debug; /* def: 0 = minimal debug log messages */
194 int disable_hw_scan; /* def: 0 = use h/w scan */ 193 int disable_hw_scan; /* def: 0 = use h/w scan */
195 int num_of_queues; /* def: HW dependent */ 194 int num_of_queues; /* def: HW dependent */
196 int num_of_ampdu_queues;/* def: HW dependent */ 195 int num_of_ampdu_queues;/* def: HW dependent */
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index e4a4dbd20c9..9faf0c2ff60 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -30,6 +30,7 @@
30#define __iwl_debug_h__ 30#define __iwl_debug_h__
31 31
32struct iwl_priv; 32struct iwl_priv;
33extern u32 iwl_debug_level;
33 34
34#define IWL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a) 35#define IWL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a)
35#define IWL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a) 36#define IWL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a)
@@ -45,7 +46,7 @@ do { \
45#ifdef CONFIG_IWLWIFI_DEBUG 46#ifdef CONFIG_IWLWIFI_DEBUG
46#define IWL_DEBUG(__priv, level, fmt, args...) \ 47#define IWL_DEBUG(__priv, level, fmt, args...) \
47do { \ 48do { \
48 if (__priv->debug_level & (level)) \ 49 if (iwl_debug_level & (level)) \
49 dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \ 50 dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \
50 "%c %s " fmt, in_interrupt() ? 'I' : 'U', \ 51 "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
51 __func__ , ## args); \ 52 __func__ , ## args); \
@@ -53,15 +54,15 @@ do { \
53 54
54#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...) \ 55#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...) \
55do { \ 56do { \
56 if ((__priv->debug_level & (level)) && net_ratelimit()) \ 57 if ((iwl_debug_level & (level)) && net_ratelimit()) \
57 dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \ 58 dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev), \
58 "%c %s " fmt, in_interrupt() ? 'I' : 'U', \ 59 "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
59 __func__ , ## args); \ 60 __func__ , ## args); \
60} while (0) 61} while (0)
61 62
62#define iwl_print_hex_dump(priv, level, p, len) \ 63#define iwl_print_hex_dump(level, p, len) \
63do { \ 64do { \
64 if (priv->debug_level & level) \ 65 if (iwl_debug_level & level) \
65 print_hex_dump(KERN_DEBUG, "iwl data: ", \ 66 print_hex_dump(KERN_DEBUG, "iwl data: ", \
66 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ 67 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
67} while (0) 68} while (0)
@@ -103,8 +104,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv);
103#else 104#else
104#define IWL_DEBUG(__priv, level, fmt, args...) 105#define IWL_DEBUG(__priv, level, fmt, args...)
105#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...) 106#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...)
106static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level, 107static inline void iwl_print_hex_dump(int level, void *p, u32 len)
107 void *p, u32 len)
108{} 108{}
109#endif /* CONFIG_IWLWIFI_DEBUG */ 109#endif /* CONFIG_IWLWIFI_DEBUG */
110 110
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 926df3ae241..0751891f4ab 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1111,7 +1111,6 @@ struct iwl_priv {
1111 1111
1112#ifdef CONFIG_IWLWIFI_DEBUG 1112#ifdef CONFIG_IWLWIFI_DEBUG
1113 /* debugging info */ 1113 /* debugging info */
1114 u32 debug_level;
1115 u32 framecnt_to_us; 1114 u32 framecnt_to_us;
1116 atomic_t restrict_refcnt; 1115 atomic_t restrict_refcnt;
1117#ifdef CONFIG_IWLWIFI_DEBUGFS 1116#ifdef CONFIG_IWLWIFI_DEBUGFS
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index fc7edd1d34d..5d5f2153f44 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -646,7 +646,7 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
646 u32 tsf_low; 646 u32 tsf_low;
647 int rssi; 647 int rssi;
648 648
649 if (likely(!(priv->debug_level & IWL_DL_RX))) 649 if (likely(!(iwl_debug_level & IWL_DL_RX)))
650 return; 650 return;
651 651
652 /* MAC header */ 652 /* MAC header */
@@ -742,7 +742,7 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
742 } 742 }
743 } 743 }
744 if (print_dump) 744 if (print_dump)
745 iwl_print_hex_dump(priv, IWL_DL_RX, header, length); 745 iwl_print_hex_dump(IWL_DL_RX, header, length);
746} 746}
747#endif 747#endif
748 748
@@ -1061,7 +1061,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
1061 1061
1062 /* Set "1" to report good data frames in groups of 100 */ 1062 /* Set "1" to report good data frames in groups of 100 */
1063#ifdef CONFIG_IWLWIFI_DEBUG 1063#ifdef CONFIG_IWLWIFI_DEBUG
1064 if (unlikely(priv->debug_level & IWL_DL_RX)) 1064 if (unlikely(iwl_debug_level & IWL_DL_RX))
1065 iwl_dbg_report_frame(priv, rx_start, len, header, 1); 1065 iwl_dbg_report_frame(priv, rx_start, len, header, 1);
1066#endif 1066#endif
1067 IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n", 1067 IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 7fd806d33a6..cbe4e26d053 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -1093,7 +1093,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
1093 IWL_DEBUG_DROP(priv, "Station %pM not in station map. " 1093 IWL_DEBUG_DROP(priv, "Station %pM not in station map. "
1094 "Defaulting to broadcast...\n", 1094 "Defaulting to broadcast...\n",
1095 hdr->addr1); 1095 hdr->addr1);
1096 iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); 1096 iwl_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
1097 return priv->hw_params.bcast_sta_id; 1097 return priv->hw_params.bcast_sta_id;
1098 1098
1099 default: 1099 default:
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 7073069a61a..ef7e6bdb067 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -869,8 +869,8 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
869 IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n", 869 IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n",
870 le16_to_cpu(out_cmd->hdr.sequence)); 870 le16_to_cpu(out_cmd->hdr.sequence));
871 IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx_cmd->tx_flags)); 871 IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx_cmd->tx_flags));
872 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd)); 872 iwl_print_hex_dump(IWL_DL_TX, (u8 *)tx_cmd, sizeof(*tx_cmd));
873 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len); 873 iwl_print_hex_dump(IWL_DL_TX, (u8 *)tx_cmd->hdr, hdr_len);
874 874
875 /* Set up entry for this TFD in Tx byte-count array */ 875 /* Set up entry for this TFD in Tx byte-count array */
876 if (info->flags & IEEE80211_TX_CTL_AMPDU) 876 if (info->flags & IEEE80211_TX_CTL_AMPDU)
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index bd6a067b488..221a875b016 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -612,8 +612,8 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
612 IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n", 612 IWL_DEBUG_TX(priv, "sequence nr = 0X%x \n",
613 le16_to_cpu(out_cmd->hdr.sequence)); 613 le16_to_cpu(out_cmd->hdr.sequence));
614 IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx->tx_flags)); 614 IWL_DEBUG_TX(priv, "tx_flags = 0X%x \n", le32_to_cpu(tx->tx_flags));
615 iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx)); 615 iwl_print_hex_dump(IWL_DL_TX, tx, sizeof(*tx));
616 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr, 616 iwl_print_hex_dump(IWL_DL_TX, (u8 *)tx->hdr,
617 ieee80211_hdrlen(fc)); 617 ieee80211_hdrlen(fc));
618 618
619 /* 619 /*
@@ -1644,7 +1644,7 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1644 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh); 1644 iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh);
1645 1645
1646#ifdef CONFIG_IWLWIFI_DEBUG 1646#ifdef CONFIG_IWLWIFI_DEBUG
1647 if (priv->debug_level & IWL_DL_ISR) { 1647 if (iwl_debug_level & IWL_DL_ISR) {
1648 /* just for debug */ 1648 /* just for debug */
1649 inta_mask = iwl_read32(priv, CSR_INT_MASK); 1649 inta_mask = iwl_read32(priv, CSR_INT_MASK);
1650 IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 1650 IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
@@ -1679,7 +1679,7 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1679 } 1679 }
1680 1680
1681#ifdef CONFIG_IWLWIFI_DEBUG 1681#ifdef CONFIG_IWLWIFI_DEBUG
1682 if (priv->debug_level & (IWL_DL_ISR)) { 1682 if (iwl_debug_level & (IWL_DL_ISR)) {
1683 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 1683 /* NIC fires this, but we don't use it, redundant with WAKEUP */
1684 if (inta & CSR_INT_BIT_SCD) { 1684 if (inta & CSR_INT_BIT_SCD) {
1685 IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " 1685 IWL_DEBUG_ISR(priv, "Scheduler finished to transmit "
@@ -1758,7 +1758,7 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv)
1758 iwl_enable_interrupts(priv); 1758 iwl_enable_interrupts(priv);
1759 1759
1760#ifdef CONFIG_IWLWIFI_DEBUG 1760#ifdef CONFIG_IWLWIFI_DEBUG
1761 if (priv->debug_level & (IWL_DL_ISR)) { 1761 if (iwl_debug_level & (IWL_DL_ISR)) {
1762 inta = iwl_read32(priv, CSR_INT); 1762 inta = iwl_read32(priv, CSR_INT);
1763 inta_mask = iwl_read32(priv, CSR_INT_MASK); 1763 inta_mask = iwl_read32(priv, CSR_INT_MASK);
1764 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS); 1764 inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
@@ -3308,13 +3308,15 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3308 * used for controlling the debug level. 3308 * used for controlling the debug level.
3309 * 3309 *
3310 * See the level definitions in iwl for details. 3310 * See the level definitions in iwl for details.
3311 *
3312 * FIXME This file can be deprecated as the module parameter is
3313 * writable and users can thus also change the debug level
3314 * using the /sys/module/iwl3945/parameters/debug file.
3311 */ 3315 */
3312static ssize_t show_debug_level(struct device *d, 3316static ssize_t show_debug_level(struct device *d,
3313 struct device_attribute *attr, char *buf) 3317 struct device_attribute *attr, char *buf)
3314{ 3318{
3315 struct iwl_priv *priv = dev_get_drvdata(d); 3319 return sprintf(buf, "0x%08X\n", iwl_debug_level);
3316
3317 return sprintf(buf, "0x%08X\n", priv->debug_level);
3318} 3320}
3319static ssize_t store_debug_level(struct device *d, 3321static ssize_t store_debug_level(struct device *d,
3320 struct device_attribute *attr, 3322 struct device_attribute *attr,
@@ -3328,7 +3330,7 @@ static ssize_t store_debug_level(struct device *d,
3328 if (ret) 3330 if (ret)
3329 IWL_INFO(priv, "%s is not in hex or decimal form.\n", buf); 3331 IWL_INFO(priv, "%s is not in hex or decimal form.\n", buf);
3330 else 3332 else
3331 priv->debug_level = val; 3333 iwl_debug_level = val;
3332 3334
3333 return strnlen(buf, count); 3335 return strnlen(buf, count);
3334} 3336}
@@ -3966,7 +3968,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3966 priv->inta_mask = CSR_INI_SET_MASK; 3968 priv->inta_mask = CSR_INI_SET_MASK;
3967 3969
3968#ifdef CONFIG_IWLWIFI_DEBUG 3970#ifdef CONFIG_IWLWIFI_DEBUG
3969 priv->debug_level = iwl3945_mod_params.debug;
3970 atomic_set(&priv->restrict_refcnt, 0); 3971 atomic_set(&priv->restrict_refcnt, 0);
3971#endif 3972#endif
3972 3973
@@ -4262,8 +4263,10 @@ MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
4262module_param_named(swcrypto, iwl3945_mod_params.sw_crypto, int, 0444); 4263module_param_named(swcrypto, iwl3945_mod_params.sw_crypto, int, 0444);
4263MODULE_PARM_DESC(swcrypto, 4264MODULE_PARM_DESC(swcrypto,
4264 "using software crypto (default 1 [software])\n"); 4265 "using software crypto (default 1 [software])\n");
4265module_param_named(debug, iwl3945_mod_params.debug, uint, 0444); 4266#ifdef CONFIG_IWLWIFI_DEBUG
4267module_param_named(debug, iwl_debug_level, uint, 0644);
4266MODULE_PARM_DESC(debug, "debug output mask"); 4268MODULE_PARM_DESC(debug, "debug output mask");
4269#endif
4267module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan, int, 0444); 4270module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan, int, 0444);
4268MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)"); 4271MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)");
4269module_param_named(fw_restart3945, iwl3945_mod_params.restart_fw, int, 0444); 4272module_param_named(fw_restart3945, iwl3945_mod_params.restart_fw, int, 0444);