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

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

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: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 34a66de6
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(priv, IWL_DL_RX, data, length);
		iwl_print_hex_dump(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 (priv->debug_level & IWL_DL_RX)
	if (iwl_debug_level & IWL_DL_RX)
		_iwl3945_dbg_report_frame(priv, pkt, header, group100);
}

+0 −2
Original line number Diff line number Diff line
@@ -2376,8 +2376,6 @@ module_param_named(antenna, iwl4965_mod_params.antenna, int, 0444);
MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, 0444);
MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])");
module_param_named(debug, iwl4965_mod_params.debug, uint, 0444);
MODULE_PARM_DESC(debug, "debug output mask");
module_param_named(
	disable_hw_scan, iwl4965_mod_params.disable_hw_scan, int, 0444);
MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)");
+0 −2
Original line number Diff line number Diff line
@@ -1745,8 +1745,6 @@ MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444);
MODULE_PARM_DESC(swcrypto50,
		  "using software crypto engine (default 0 [hardware])\n");
module_param_named(debug50, iwl50_mod_params.debug, uint, 0444);
MODULE_PARM_DESC(debug50, "50XX debug output mask");
module_param_named(queues_num50, iwl50_mod_params.num_of_queues, int, 0444);
MODULE_PARM_DESC(queues_num50, "number of hw queues in 50xx series");
module_param_named(11n_disable50, iwl50_mod_params.disable_11n, int, 0444);
+20 −11
Original line number Diff line number Diff line
@@ -904,7 +904,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 (priv->debug_level & IWL_DL_ISR) {
	if (iwl_debug_level & 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",
@@ -939,7 +939,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
	}

#ifdef CONFIG_IWLWIFI_DEBUG
	if (priv->debug_level & (IWL_DL_ISR)) {
	if (iwl_debug_level & (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 "
@@ -1053,7 +1053,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
		iwl_enable_interrupts(priv);

#ifdef CONFIG_IWLWIFI_DEBUG
	if (priv->debug_level & (IWL_DL_ISR)) {
	if (iwl_debug_level & (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);
@@ -1084,7 +1084,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
	inta = priv->inta;

#ifdef CONFIG_IWLWIFI_DEBUG
	if (priv->debug_level & IWL_DL_ISR) {
	if (iwl_debug_level & 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 ",
@@ -1112,7 +1112,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
	}

#ifdef CONFIG_IWLWIFI_DEBUG
	if (priv->debug_level & (IWL_DL_ISR)) {
	if (iwl_debug_level & (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 "
@@ -2456,14 +2456,16 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw,
 * used for controlling the debug level.
 *
 * 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.
 */

static ssize_t show_debug_level(struct device *d,
				struct device_attribute *attr, char *buf)
{
	struct iwl_priv *priv = dev_get_drvdata(d);

	return sprintf(buf, "0x%08X\n", priv->debug_level);
	return sprintf(buf, "0x%08X\n", iwl_debug_level);
}
static ssize_t store_debug_level(struct device *d,
				struct device_attribute *attr,
@@ -2477,7 +2479,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
		priv->debug_level = val;
		iwl_debug_level = val;

	return strnlen(buf, count);
}
@@ -2829,7 +2831,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	/* Disabling hardware scan means that mac80211 will perform scans
	 * "the hard way", rather than using device's scan. */
	if (cfg->mod_params->disable_hw_scan) {
		if (cfg->mod_params->debug & IWL_DL_INFO)
		if (iwl_debug_level & IWL_DL_INFO)
			dev_printk(KERN_DEBUG, &(pdev->dev),
				   "Disabling hw_scan\n");
		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)
	priv->inta_mask = CSR_INI_SET_MASK;

#ifdef CONFIG_IWLWIFI_DEBUG
	priv->debug_level = priv->cfg->mod_params->debug;
	atomic_set(&priv->restrict_refcnt, 0);
#endif

@@ -3211,3 +3212,11 @@ static void __exit iwl_exit(void)

module_exit(iwl_exit);
module_init(iwl_init);

#ifdef CONFIG_IWLWIFI_DEBUG
module_param_named(debug50, iwl_debug_level, uint, 0444);
MODULE_PARM_DESC(debug50, "50XX debug output mask (deprecated)");
module_param_named(debug, iwl_debug_level, uint, 0644);
MODULE_PARM_DESC(debug, "debug output mask");
#endif
+7 −4
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ MODULE_LICENSE("GPL");
				    IWL_RATE_##pp##M_INDEX,    \
				    IWL_RATE_##np##M_INDEX }

u32 iwl_debug_level;
EXPORT_SYMBOL(iwl_debug_level);

static irqreturn_t iwl_isr(int irq, void *data);

/*
@@ -1275,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(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
	iwl_print_hex_dump(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",
@@ -1505,7 +1508,7 @@ void iwl_irq_handle_error(struct iwl_priv *priv)
	clear_bit(STATUS_HCMD_ACTIVE, &priv->status);

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

#ifdef CONFIG_IWLWIFI_DEBUG
	if (priv->debug_level & (IWL_DL_ISR)) {
	if (iwl_debug_level & (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);
@@ -2311,7 +2314,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(priv, IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
	iwl_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
}
EXPORT_SYMBOL(iwl_rx_pm_debug_statistics_notif);

Loading