aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-03-05 14:24:30 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-06 15:16:10 -0500
commita8bceb392a739321ec20d03a91a86ebdde9c07bb (patch)
treeaa3257edba10f5358bd0d96c38ab39546e9af034 /drivers/net
parentfb5fe5b9da167f25fd44818327338eeec20c2a5a (diff)
iwlwifi: remove per-device debug level
There's no need for the per-device debug level that we expose in debugfs since the module parameter is writable in sysfs. At the same time, simplify code by changing iwl_get_debug_level(shrd) & IWL_DL_ISR) to iwl_have_debug_level(IWL_DL_ISR) Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c55
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h27
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c10
6 files changed, 22 insertions, 96 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 8551c95e7437..8d25fd6be645 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -836,7 +836,7 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
836 unsigned long reload_jiffies; 836 unsigned long reload_jiffies;
837 837
838#ifdef CONFIG_IWLWIFI_DEBUG 838#ifdef CONFIG_IWLWIFI_DEBUG
839 if (iwl_get_debug_level(priv->shrd) & IWL_DL_FW_ERRORS) 839 if (iwl_have_debug_level(IWL_DL_FW_ERRORS))
840 iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS); 840 iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS);
841#endif 841#endif
842 842
@@ -1004,7 +1004,7 @@ int iwl_alloc_traffic_mem(struct iwl_priv *priv)
1004{ 1004{
1005 u32 traffic_size = IWL_TRAFFIC_DUMP_SIZE; 1005 u32 traffic_size = IWL_TRAFFIC_DUMP_SIZE;
1006 1006
1007 if (iwl_get_debug_level(priv->shrd) & IWL_DL_TX) { 1007 if (iwl_have_debug_level(IWL_DL_TX)) {
1008 if (!priv->tx_traffic) { 1008 if (!priv->tx_traffic) {
1009 priv->tx_traffic = 1009 priv->tx_traffic =
1010 kzalloc(traffic_size, GFP_KERNEL); 1010 kzalloc(traffic_size, GFP_KERNEL);
@@ -1012,7 +1012,7 @@ int iwl_alloc_traffic_mem(struct iwl_priv *priv)
1012 return -ENOMEM; 1012 return -ENOMEM;
1013 } 1013 }
1014 } 1014 }
1015 if (iwl_get_debug_level(priv->shrd) & IWL_DL_RX) { 1015 if (iwl_have_debug_level(IWL_DL_RX)) {
1016 if (!priv->rx_traffic) { 1016 if (!priv->rx_traffic) {
1017 priv->rx_traffic = 1017 priv->rx_traffic =
1018 kzalloc(traffic_size, GFP_KERNEL); 1018 kzalloc(traffic_size, GFP_KERNEL);
@@ -1039,7 +1039,7 @@ void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv,
1039 __le16 fc; 1039 __le16 fc;
1040 u16 len; 1040 u16 len;
1041 1041
1042 if (likely(!(iwl_get_debug_level(priv->shrd) & IWL_DL_TX))) 1042 if (likely(!iwl_have_debug_level(IWL_DL_TX)))
1043 return; 1043 return;
1044 1044
1045 if (!priv->tx_traffic) 1045 if (!priv->tx_traffic)
@@ -1063,7 +1063,7 @@ void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv,
1063 __le16 fc; 1063 __le16 fc;
1064 u16 len; 1064 u16 len;
1065 1065
1066 if (likely(!(iwl_get_debug_level(priv->shrd) & IWL_DL_RX))) 1066 if (likely(!iwl_have_debug_level(IWL_DL_RX)))
1067 return; 1067 return;
1068 1068
1069 if (!priv->rx_traffic) 1069 if (!priv->rx_traffic)
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.c b/drivers/net/wireless/iwlwifi/iwl-debug.c
index 4bc2e70051d6..059efabda184 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.c
@@ -104,7 +104,7 @@ void __iwl_err(struct device *dev, bool rfkill_prefix, bool trace_only,
104} 104}
105 105
106#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) 106#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
107void __iwl_dbg(struct iwl_shared *shared, struct device *dev, 107void __iwl_dbg(struct device *dev,
108 u32 level, bool limit, const char *function, 108 u32 level, bool limit, const char *function,
109 const char *fmt, ...) 109 const char *fmt, ...)
110{ 110{
@@ -116,7 +116,7 @@ void __iwl_dbg(struct iwl_shared *shared, struct device *dev,
116 va_start(args, fmt); 116 va_start(args, fmt);
117 vaf.va = &args; 117 vaf.va = &args;
118#ifdef CONFIG_IWLWIFI_DEBUG 118#ifdef CONFIG_IWLWIFI_DEBUG
119 if (iwl_get_debug_level(shared) & level && 119 if (iwl_have_debug_level(level) &&
120 (!limit || net_ratelimit())) 120 (!limit || net_ratelimit()))
121 dev_err(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U', 121 dev_err(dev, "%c %s %pV", in_interrupt() ? 'I' : 'U',
122 function, &vaf); 122 function, &vaf);
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 01b23303d736..163d259198be 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -47,12 +47,12 @@ void __iwl_crit(struct device *dev, const char *fmt, ...);
47#define IWL_CRIT(m, f, a...) __iwl_crit(trans(m)->dev, f, ## a) 47#define IWL_CRIT(m, f, a...) __iwl_crit(trans(m)->dev, f, ## a)
48 48
49#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING) 49#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
50void __iwl_dbg(struct iwl_shared *shared, struct device *dev, 50void __iwl_dbg(struct device *dev,
51 u32 level, bool limit, const char *function, 51 u32 level, bool limit, const char *function,
52 const char *fmt, ...); 52 const char *fmt, ...);
53#else 53#else
54static inline void 54static inline void
55__iwl_dbg(struct iwl_shared *shared, struct device *dev, 55__iwl_dbg(struct device *dev,
56 u32 level, bool limit, const char *function, 56 u32 level, bool limit, const char *function,
57 const char *fmt, ...) 57 const char *fmt, ...)
58{} 58{}
@@ -65,14 +65,14 @@ do { \
65} while (0) 65} while (0)
66 66
67#define IWL_DEBUG(m, level, fmt, args...) \ 67#define IWL_DEBUG(m, level, fmt, args...) \
68 __iwl_dbg((m)->shrd, trans(m)->dev, level, false, __func__, fmt, ##args) 68 __iwl_dbg(trans(m)->dev, level, false, __func__, fmt, ##args)
69#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \ 69#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \
70 __iwl_dbg((m)->shrd, trans(m)->dev, level, true, __func__, fmt, ##args) 70 __iwl_dbg(trans(m)->dev, level, true, __func__, fmt, ##args)
71 71
72#ifdef CONFIG_IWLWIFI_DEBUG 72#ifdef CONFIG_IWLWIFI_DEBUG
73#define iwl_print_hex_dump(m, level, p, len) \ 73#define iwl_print_hex_dump(m, level, p, len) \
74do { \ 74do { \
75 if (iwl_get_debug_level((m)->shrd) & level) \ 75 if (iwl_have_debug_level(level)) \
76 print_hex_dump(KERN_DEBUG, "iwl data: ", \ 76 print_hex_dump(KERN_DEBUG, "iwl data: ", \
77 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \ 77 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
78} while (0) 78} while (0)
@@ -82,7 +82,7 @@ do { \
82 IWL_ERR(m, fmt, ##args); \ 82 IWL_ERR(m, fmt, ##args); \
83 else \ 83 else \
84 __iwl_err(trans(m)->dev, true, \ 84 __iwl_err(trans(m)->dev, true, \
85 !(iwl_get_debug_level((m)->shrd) & IWL_DL_RADIO),\ 85 !iwl_have_debug_level(IWL_DL_RADIO), \
86 fmt, ##args); \ 86 fmt, ##args); \
87} while (0) 87} while (0)
88#else 88#else
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 628af563e4e1..dd502e82e410 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -845,8 +845,7 @@ static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
845 IWL_ERR(priv, "Can not allocate buffer\n"); 845 IWL_ERR(priv, "Can not allocate buffer\n");
846 return -ENOMEM; 846 return -ENOMEM;
847 } 847 }
848 if (priv->tx_traffic && 848 if (priv->tx_traffic && iwl_have_debug_level(IWL_DL_TX)) {
849 (iwl_get_debug_level(priv->shrd) & IWL_DL_TX)) {
850 ptr = priv->tx_traffic; 849 ptr = priv->tx_traffic;
851 pos += scnprintf(buf + pos, bufsz - pos, 850 pos += scnprintf(buf + pos, bufsz - pos,
852 "Tx Traffic idx: %u\n", priv->tx_traffic_idx); 851 "Tx Traffic idx: %u\n", priv->tx_traffic_idx);
@@ -864,8 +863,7 @@ static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
864 } 863 }
865 } 864 }
866 865
867 if (priv->rx_traffic && 866 if (priv->rx_traffic && iwl_have_debug_level(IWL_DL_RX)) {
868 (iwl_get_debug_level(priv->shrd) & IWL_DL_RX)) {
869 ptr = priv->rx_traffic; 867 ptr = priv->rx_traffic;
870 pos += scnprintf(buf + pos, bufsz - pos, 868 pos += scnprintf(buf + pos, bufsz - pos,
871 "Rx Traffic idx: %u\n", priv->rx_traffic_idx); 869 "Rx Traffic idx: %u\n", priv->rx_traffic_idx);
@@ -2507,52 +2505,6 @@ DEBUGFS_READ_WRITE_FILE_OPS(protection_mode);
2507DEBUGFS_READ_FILE_OPS(reply_tx_error); 2505DEBUGFS_READ_FILE_OPS(reply_tx_error);
2508DEBUGFS_WRITE_FILE_OPS(echo_test); 2506DEBUGFS_WRITE_FILE_OPS(echo_test);
2509 2507
2510#ifdef CONFIG_IWLWIFI_DEBUG
2511static ssize_t iwl_dbgfs_debug_level_read(struct file *file,
2512 char __user *user_buf,
2513 size_t count, loff_t *ppos)
2514{
2515 struct iwl_priv *priv = file->private_data;
2516 struct iwl_shared *shrd = priv->shrd;
2517 char buf[11];
2518 int len;
2519
2520 len = scnprintf(buf, sizeof(buf), "0x%.8x",
2521 iwl_get_debug_level(shrd));
2522
2523 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
2524}
2525
2526static ssize_t iwl_dbgfs_debug_level_write(struct file *file,
2527 const char __user *user_buf,
2528 size_t count, loff_t *ppos)
2529{
2530 struct iwl_priv *priv = file->private_data;
2531 struct iwl_shared *shrd = priv->shrd;
2532 char buf[11];
2533 unsigned long val;
2534 int ret;
2535
2536 if (count > sizeof(buf))
2537 return -EINVAL;
2538
2539 memset(buf, 0, sizeof(buf));
2540 if (copy_from_user(buf, user_buf, count))
2541 return -EFAULT;
2542
2543 ret = strict_strtoul(buf, 0, &val);
2544 if (ret)
2545 return ret;
2546
2547 shrd->dbg_level_dev = val;
2548 if (iwl_alloc_traffic_mem(priv))
2549 IWL_ERR(priv, "Not enough memory to generate traffic log\n");
2550
2551 return count;
2552}
2553DEBUGFS_READ_WRITE_FILE_OPS(debug_level);
2554#endif /* CONFIG_IWLWIFI_DEBUG */
2555
2556/* 2508/*
2557 * Create the debugfs files and directories 2509 * Create the debugfs files and directories
2558 * 2510 *
@@ -2617,9 +2569,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2617 DEBUGFS_ADD_FILE(echo_test, dir_debug, S_IWUSR); 2569 DEBUGFS_ADD_FILE(echo_test, dir_debug, S_IWUSR);
2618 if (iwl_advanced_bt_coexist(priv)) 2570 if (iwl_advanced_bt_coexist(priv))
2619 DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); 2571 DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR);
2620#ifdef CONFIG_IWLWIFI_DEBUG
2621 DEBUGFS_ADD_FILE(debug_level, dir_debug, S_IRUSR | S_IWUSR);
2622#endif
2623 2572
2624 DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, 2573 DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf,
2625 &priv->disable_sens_cal); 2574 &priv->disable_sens_cal);
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 7720fc34c278..239dfbc57bee 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -346,8 +346,6 @@ struct iwl_cfg {
346/** 346/**
347 * struct iwl_shared - shared fields for all the layers of the driver 347 * struct iwl_shared - shared fields for all the layers of the driver
348 * 348 *
349 * @dbg_level_dev: dbg level set per device. Prevails on
350 * iwlagn_mod_params.debug_level if set (!= 0)
351 * @ucode_owner: IWL_OWNERSHIP_* 349 * @ucode_owner: IWL_OWNERSHIP_*
352 * @cmd_queue: command queue number 350 * @cmd_queue: command queue number
353 * @status: STATUS_* 351 * @status: STATUS_*
@@ -370,10 +368,6 @@ struct iwl_cfg {
370 * @device_pointers: pointers to ucode event tables 368 * @device_pointers: pointers to ucode event tables
371 */ 369 */
372struct iwl_shared { 370struct iwl_shared {
373#ifdef CONFIG_IWLWIFI_DEBUG
374 u32 dbg_level_dev;
375#endif /* CONFIG_IWLWIFI_DEBUG */
376
377#define IWL_OWNERSHIP_DRIVER 0 371#define IWL_OWNERSHIP_DRIVER 0
378#define IWL_OWNERSHIP_TM 1 372#define IWL_OWNERSHIP_TM 1
379 u8 ucode_owner; 373 u8 ucode_owner;
@@ -417,27 +411,10 @@ struct iwl_shared {
417#define trans(_m) ((_m)->shrd->trans) 411#define trans(_m) ((_m)->shrd->trans)
418#define hw_params(_m) ((_m)->shrd->hw_params) 412#define hw_params(_m) ((_m)->shrd->hw_params)
419 413
420#ifdef CONFIG_IWLWIFI_DEBUG 414static inline bool iwl_have_debug_level(u32 level)
421/*
422 * iwl_get_debug_level: Return active debug level for device
423 *
424 * Using sysfs it is possible to set per device debug level. This debug
425 * level will be used if set, otherwise the global debug level which can be
426 * set via module parameter is used.
427 */
428static inline u32 iwl_get_debug_level(struct iwl_shared *shrd)
429{
430 if (shrd->dbg_level_dev)
431 return shrd->dbg_level_dev;
432 else
433 return iwlagn_mod_params.debug_level;
434}
435#else
436static inline u32 iwl_get_debug_level(struct iwl_shared *shrd)
437{ 415{
438 return iwlagn_mod_params.debug_level; 416 return iwlagn_mod_params.debug_level & level;
439} 417}
440#endif
441 418
442static inline void iwl_free_pages(struct iwl_shared *shrd, unsigned long page) 419static inline void iwl_free_pages(struct iwl_shared *shrd, unsigned long page)
443{ 420{
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
index 2c910fddaaf6..6495945637b9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
@@ -881,7 +881,7 @@ int iwl_dump_nic_event_log(struct iwl_trans *trans, bool full_log,
881 } 881 }
882 882
883#ifdef CONFIG_IWLWIFI_DEBUG 883#ifdef CONFIG_IWLWIFI_DEBUG
884 if (!(iwl_get_debug_level(trans->shrd) & IWL_DL_FW_ERRORS) && !full_log) 884 if (!(iwl_have_debug_level(IWL_DL_FW_ERRORS)) && !full_log)
885 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) 885 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
886 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; 886 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
887#else 887#else
@@ -901,7 +901,7 @@ int iwl_dump_nic_event_log(struct iwl_trans *trans, bool full_log,
901 if (!*buf) 901 if (!*buf)
902 return -ENOMEM; 902 return -ENOMEM;
903 } 903 }
904 if ((iwl_get_debug_level(trans->shrd) & IWL_DL_FW_ERRORS) || full_log) { 904 if (iwl_have_debug_level(IWL_DL_FW_ERRORS) || full_log) {
905 /* 905 /*
906 * if uCode has wrapped back to top of log, 906 * if uCode has wrapped back to top of log,
907 * start at the oldest entry, 907 * start at the oldest entry,
@@ -960,7 +960,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
960 inta = trans_pcie->inta; 960 inta = trans_pcie->inta;
961 961
962#ifdef CONFIG_IWLWIFI_DEBUG 962#ifdef CONFIG_IWLWIFI_DEBUG
963 if (iwl_get_debug_level(trans->shrd) & IWL_DL_ISR) { 963 if (iwl_have_debug_level(IWL_DL_ISR)) {
964 /* just for debug */ 964 /* just for debug */
965 inta_mask = iwl_read32(trans, CSR_INT_MASK); 965 inta_mask = iwl_read32(trans, CSR_INT_MASK);
966 IWL_DEBUG_ISR(trans, "inta 0x%08x, enabled 0x%08x\n ", 966 IWL_DEBUG_ISR(trans, "inta 0x%08x, enabled 0x%08x\n ",
@@ -989,7 +989,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
989 } 989 }
990 990
991#ifdef CONFIG_IWLWIFI_DEBUG 991#ifdef CONFIG_IWLWIFI_DEBUG
992 if (iwl_get_debug_level(trans->shrd) & (IWL_DL_ISR)) { 992 if (iwl_have_debug_level(IWL_DL_ISR)) {
993 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 993 /* NIC fires this, but we don't use it, redundant with WAKEUP */
994 if (inta & CSR_INT_BIT_SCD) { 994 if (inta & CSR_INT_BIT_SCD) {
995 IWL_DEBUG_ISR(trans, "Scheduler finished to transmit " 995 IWL_DEBUG_ISR(trans, "Scheduler finished to transmit "
@@ -1301,7 +1301,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
1301 } 1301 }
1302 1302
1303#ifdef CONFIG_IWLWIFI_DEBUG 1303#ifdef CONFIG_IWLWIFI_DEBUG
1304 if (iwl_get_debug_level(trans->shrd) & (IWL_DL_ISR)) { 1304 if (iwl_have_debug_level(IWL_DL_ISR)) {
1305 inta_fh = iwl_read32(trans, CSR_FH_INT_STATUS); 1305 inta_fh = iwl_read32(trans, CSR_FH_INT_STATUS);
1306 IWL_DEBUG_ISR(trans, "ISR inta 0x%08x, enabled 0x%08x, " 1306 IWL_DEBUG_ISR(trans, "ISR inta 0x%08x, enabled 0x%08x, "
1307 "fh 0x%08x\n", inta, inta_mask, inta_fh); 1307 "fh 0x%08x\n", inta, inta_mask, inta_fh);