Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d816c77 authored by Reinette Chatre's avatar Reinette Chatre Committed by John W. Linville
Browse files

iwlwifi: re-introduce per device debugging



Commit "iwlwifi: make debug level more user friendly" cleaned up the
debug level handling. In doing so it created a single global debug
level for all devices. Some setups do consits of more that one iwlwifi
device and in these setups there is a requirement that debug levels
should be unique per device.

We now re-introduce the per device debugging while maintaining the
cleanup effort of the previous patch.

The maintain the global debug level and now introduce a per-device debug
level that will be used if it (the per-device debug level) is set. The
per-device debug level can be controlled via the debug_level sysfs file
while the global debug level is controlled by the debug module parameter.

Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Acked-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 34b921cf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -502,14 +502,14 @@ static void _iwl3945_dbg_report_frame(struct iwl_priv *priv,
		}
	}
	if (print_dump)
		iwl_print_hex_dump(IWL_DL_RX, data, length);
		iwl_print_hex_dump(priv, IWL_DL_RX, data, length);
}

static void iwl3945_dbg_report_frame(struct iwl_priv *priv,
		      struct iwl_rx_packet *pkt,
		      struct ieee80211_hdr *header, int group100)
{
	if (iwl_debug_level & IWL_DL_RX)
	if (iwl_get_debug_level(priv) & IWL_DL_RX)
		_iwl3945_dbg_report_frame(priv, pkt, header, group100);
}

+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
#include "iwl-sta.h"

static int iwl4965_send_tx_power(struct iwl_priv *priv);
static int iwl4965_hw_get_temperature(const struct iwl_priv *priv);
static int iwl4965_hw_get_temperature(struct iwl_priv *priv);

/* Highest firmware API version supported */
#define IWL4965_UCODE_API_MAX 2
@@ -1680,7 +1680,7 @@ static s32 sign_extend(u32 oper, int index)
 *
 * A return of <0 indicates bogus data in the statistics
 */
static int iwl4965_hw_get_temperature(const struct iwl_priv *priv)
static int iwl4965_hw_get_temperature(struct iwl_priv *priv)
{
	s32 temperature;
	s32 vt;
+11 −11
Original line number Diff line number Diff line
@@ -896,7 +896,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
	iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh);

#ifdef CONFIG_IWLWIFI_DEBUG
	if (iwl_debug_level & IWL_DL_ISR) {
	if (iwl_get_debug_level(priv) & IWL_DL_ISR) {
		/* just for debug */
		inta_mask = iwl_read32(priv, CSR_INT_MASK);
		IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
@@ -931,7 +931,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
	}

#ifdef CONFIG_IWLWIFI_DEBUG
	if (iwl_debug_level & (IWL_DL_ISR)) {
	if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) {
		/* NIC fires this, but we don't use it, redundant with WAKEUP */
		if (inta & CSR_INT_BIT_SCD) {
			IWL_DEBUG_ISR(priv, "Scheduler finished to transmit "
@@ -1045,7 +1045,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
		iwl_enable_interrupts(priv);

#ifdef CONFIG_IWLWIFI_DEBUG
	if (iwl_debug_level & (IWL_DL_ISR)) {
	if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) {
		inta = iwl_read32(priv, CSR_INT);
		inta_mask = iwl_read32(priv, CSR_INT_MASK);
		inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
@@ -1076,7 +1076,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
	inta = priv->inta;

#ifdef CONFIG_IWLWIFI_DEBUG
	if (iwl_debug_level & IWL_DL_ISR) {
	if (iwl_get_debug_level(priv) & IWL_DL_ISR) {
		/* just for debug */
		inta_mask = iwl_read32(priv, CSR_INT_MASK);
		IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x\n ",
@@ -1104,7 +1104,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
	}

#ifdef CONFIG_IWLWIFI_DEBUG
	if (iwl_debug_level & (IWL_DL_ISR)) {
	if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) {
		/* NIC fires this, but we don't use it, redundant with WAKEUP */
		if (inta & CSR_INT_BIT_SCD) {
			IWL_DEBUG_ISR(priv, "Scheduler finished to transmit "
@@ -2455,15 +2455,15 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw,
 *
 * See the level definitions in iwl for details.
 *
 * FIXME This file can be deprecated as the module parameter is
 * writable and users can thus also change the debug level
 * using the /sys/module/iwl3945/parameters/debug file.
 * The debug_level being managed using sysfs below is a per device debug
 * level that is used instead of the global debug level if it (the per
 * device debug level) is set.
 */

static ssize_t show_debug_level(struct device *d,
				struct device_attribute *attr, char *buf)
{
	return sprintf(buf, "0x%08X\n", iwl_debug_level);
	struct iwl_priv *priv = dev_get_drvdata(d);
	return sprintf(buf, "0x%08X\n", iwl_get_debug_level(priv));
}
static ssize_t store_debug_level(struct device *d,
				struct device_attribute *attr,
@@ -2477,7 +2477,7 @@ static ssize_t store_debug_level(struct device *d,
	if (ret)
		IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);
	else
		iwl_debug_level = val;
		priv->debug_level = val;

	return strnlen(buf, count);
}
+4 −4
Original line number Diff line number Diff line
@@ -1278,7 +1278,7 @@ static void iwl_print_rx_config_cmd(struct iwl_priv *priv)
	struct iwl_rxon_cmd *rxon = &priv->staging_rxon;

	IWL_DEBUG_RADIO(priv, "RX CONFIG:\n");
	iwl_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
	iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
	IWL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
	IWL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
	IWL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n",
@@ -1508,7 +1508,7 @@ void iwl_irq_handle_error(struct iwl_priv *priv)
	clear_bit(STATUS_HCMD_ACTIVE, &priv->status);

#ifdef CONFIG_IWLWIFI_DEBUG
	if (iwl_debug_level & IWL_DL_FW_ERRORS) {
	if (iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) {
		iwl_dump_nic_error_log(priv);
		iwl_dump_nic_event_log(priv);
		iwl_print_rx_config_cmd(priv);
@@ -1985,7 +1985,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
	}

#ifdef CONFIG_IWLWIFI_DEBUG
	if (iwl_debug_level & (IWL_DL_ISR)) {
	if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) {
		inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
		IWL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, "
			      "fh 0x%08x\n", inta, inta_mask, inta_fh);
@@ -2310,7 +2310,7 @@ void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
	IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled "
			"notification for %s:\n",
			le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
	iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
	iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
}
EXPORT_SYMBOL(iwl_rx_pm_debug_statistics_notif);

+6 −5
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ do { \
#ifdef CONFIG_IWLWIFI_DEBUG
#define IWL_DEBUG(__priv, level, fmt, args...)				\
do {									\
	if (iwl_debug_level & (level))					\
	if (iwl_get_debug_level(__priv) & (level))					\
		dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev),		\
			 "%c %s " fmt, in_interrupt() ? 'I' : 'U',	\
			__func__ , ## args);				\
@@ -54,15 +54,15 @@ do { \

#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...)			\
do {									\
	if ((iwl_debug_level & (level)) && net_ratelimit())		\
	if ((iwl_get_debug_level(__priv) & (level)) && net_ratelimit())		\
		dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev),		\
			"%c %s " fmt, in_interrupt() ? 'I' : 'U',	\
			 __func__ , ## args);				\
} while (0)

#define iwl_print_hex_dump(level, p, len) 				\
#define iwl_print_hex_dump(priv, level, p, len) 			\
do {                                            			\
	if (iwl_debug_level & level)          				\
	if (iwl_get_debug_level(priv) & level) 				\
		print_hex_dump(KERN_DEBUG, "iwl data: ",		\
			       DUMP_PREFIX_OFFSET, 16, 1, p, len, 1);	\
} while (0)
@@ -106,7 +106,8 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv);
#else
#define IWL_DEBUG(__priv, level, fmt, args...)
#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...)
static inline void iwl_print_hex_dump(int level, void *p, u32 len)
static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level,
				      void *p, u32 len)
{}
#endif				/* CONFIG_IWLWIFI_DEBUG */

Loading