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

Commit c34df318 authored by Larry Finger's avatar Larry Finger Committed by Kalle Valo
Browse files

rtlwifi: Convert COMP_XX entries into a proper debugging mask



The debugging macros contain a parameter COMP_XX that could be used as a
mask; however, the code turns all these various bits on at the same time.
This change implements them as a proper mask, and adds module parameters
to set the mask at load time.

The current name "debug" for the debug level has been changed to
"debug_level" to better differentiate it from "debug_mask".

The debug routines have also been changed to interrogate the structure
that is loaded at entry time. As a result, the structure rtl_debug is no
longer needed, and all references to it are deleted.

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 102e295e
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -2094,7 +2094,7 @@ static ssize_t rtl_show_debug_level(struct device *d,
	struct ieee80211_hw *hw = dev_get_drvdata(d);
	struct ieee80211_hw *hw = dev_get_drvdata(d);
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_priv *rtlpriv = rtl_priv(hw);


	return sprintf(buf, "0x%08X\n", rtlpriv->dbg.global_debuglevel);
	return sprintf(buf, "0x%08X\n", rtlpriv->cfg->mod_params->debug_level);
}
}


static ssize_t rtl_store_debug_level(struct device *d,
static ssize_t rtl_store_debug_level(struct device *d,
@@ -2111,10 +2111,10 @@ static ssize_t rtl_store_debug_level(struct device *d,
		RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
		RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
			 "%s is not in hex or decimal form.\n", buf);
			 "%s is not in hex or decimal form.\n", buf);
	} else {
	} else {
		rtlpriv->dbg.global_debuglevel = val;
		rtlpriv->cfg->mod_params->debug_level = val;
		RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
		RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG,
			 "debuglevel:%x\n",
			 "debuglevel:%x\n",
			 rtlpriv->dbg.global_debuglevel);
			 rtlpriv->cfg->mod_params->debug_level);
	}
	}


	return strnlen(buf, count);
	return strnlen(buf, count);
+10 −33
Original line number Original line Diff line number Diff line
@@ -26,35 +26,12 @@


#include <linux/moduleparam.h>
#include <linux/moduleparam.h>


void rtl_dbgp_flag_init(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	u8 i;

	rtlpriv->dbg.global_debugcomponents =
	    COMP_ERR | COMP_FW | COMP_INIT | COMP_RECV | COMP_SEND |
	    COMP_MLME | COMP_SCAN | COMP_INTR | COMP_LED | COMP_SEC |
	    COMP_BEACON | COMP_RATE | COMP_RXDESC | COMP_DIG | COMP_TXAGC |
	    COMP_POWER | COMP_POWER_TRACKING | COMP_BB_POWERSAVING | COMP_SWAS |
	    COMP_RF | COMP_TURBO | COMP_RATR | COMP_CMD |
	    COMP_EFUSE | COMP_QOS | COMP_MAC80211 | COMP_REGD | COMP_CHAN |
	    COMP_EASY_CONCURRENT | COMP_EFUSE | COMP_QOS | COMP_MAC80211 |
	    COMP_REGD | COMP_CHAN | COMP_BT_COEXIST;


	for (i = 0; i < DBGP_TYPE_MAX; i++)
		rtlpriv->dbg.dbgp_type[i] = 0;

	/*Init Debug flag enable condition */
}
EXPORT_SYMBOL_GPL(rtl_dbgp_flag_init);

#ifdef CONFIG_RTLWIFI_DEBUG
#ifdef CONFIG_RTLWIFI_DEBUG
void _rtl_dbg_trace(struct rtl_priv *rtlpriv, int comp, int level,
void _rtl_dbg_trace(struct rtl_priv *rtlpriv, int comp, int level,
		    const char *fmt, ...)
		    const char *fmt, ...)
{
{
	if (unlikely((comp & rtlpriv->dbg.global_debugcomponents) &&
	if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
		     (level <= rtlpriv->dbg.global_debuglevel))) {
		     (level <= rtlpriv->cfg->mod_params->debug_level))) {
		struct va_format vaf;
		struct va_format vaf;
		va_list args;
		va_list args;


@@ -63,7 +40,7 @@ void _rtl_dbg_trace(struct rtl_priv *rtlpriv, int comp, int level,
		vaf.fmt = fmt;
		vaf.fmt = fmt;
		vaf.va = &args;
		vaf.va = &args;


		pr_debug(":<%lx> %pV", in_interrupt(), &vaf);
		pr_info(":<%lx> %pV", in_interrupt(), &vaf);


		va_end(args);
		va_end(args);
	}
	}
@@ -73,8 +50,8 @@ EXPORT_SYMBOL_GPL(_rtl_dbg_trace);
void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
		    const char *fmt, ...)
		    const char *fmt, ...)
{
{
	if (unlikely((comp & rtlpriv->dbg.global_debugcomponents) &&
	if (unlikely((comp & rtlpriv->cfg->mod_params->debug_mask) &&
		     (level <= rtlpriv->dbg.global_debuglevel))) {
		     (level <= rtlpriv->cfg->mod_params->debug_level))) {
		struct va_format vaf;
		struct va_format vaf;
		va_list args;
		va_list args;


@@ -83,7 +60,7 @@ void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
		vaf.fmt = fmt;
		vaf.fmt = fmt;
		vaf.va = &args;
		vaf.va = &args;


		pr_debug("%pV", &vaf);
		pr_info("%pV", &vaf);


		va_end(args);
		va_end(args);
	}
	}
@@ -94,9 +71,9 @@ void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
			 const char *titlestring,
			 const char *titlestring,
			 const void *hexdata, int hexdatalen)
			 const void *hexdata, int hexdatalen)
{
{
	if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) &&
	if (unlikely(((comp) & rtlpriv->cfg->mod_params->debug_mask) &&
		     ((level) <= rtlpriv->dbg.global_debuglevel))) {
		     ((level) <= rtlpriv->cfg->mod_params->debug_level))) {
		pr_debug("In process \"%s\" (pid %i): %s\n",
		pr_info("In process \"%s\" (pid %i): %s\n",
			current->comm, current->pid, titlestring);
			current->comm, current->pid, titlestring);
		print_hex_dump_bytes("", DUMP_PREFIX_NONE,
		print_hex_dump_bytes("", DUMP_PREFIX_NONE,
				     hexdata, hexdatalen);
				     hexdata, hexdatalen);
+0 −2
Original line number Original line Diff line number Diff line
@@ -218,6 +218,4 @@ static inline void RT_PRINT_DATA(struct rtl_priv *rtlpriv,
}
}


#endif
#endif

void rtl_dbgp_flag_init(struct ieee80211_hw *hw);
#endif
#endif
+0 −10
Original line number Original line Diff line number Diff line
@@ -2212,16 +2212,6 @@ int rtl_pci_probe(struct pci_dev *pdev,
	rtlpriv->intf_ops = &rtl_pci_ops;
	rtlpriv->intf_ops = &rtl_pci_ops;
	rtlpriv->glb_var = &rtl_global_var;
	rtlpriv->glb_var = &rtl_global_var;


	/*
	 *init dbgp flags before all
	 *other functions, because we will
	 *use it in other funtions like
	 *RT_TRACE/RT_PRINT/RTL_PRINT_DATA
	 *you can not use these macro
	 *before this
	 */
	rtl_dbgp_flag_init(hw);

	/* MEM map */
	/* MEM map */
	err = pci_request_regions(pdev, KBUILD_MODNAME);
	err = pci_request_regions(pdev, KBUILD_MODNAME);
	if (err) {
	if (err) {
+6 −5
Original line number Original line Diff line number Diff line
@@ -131,8 +131,6 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw)
	rtlpci->irq_mask[1] = (u32) (IMR_RXFOVW | 0);
	rtlpci->irq_mask[1] = (u32) (IMR_RXFOVW | 0);
	rtlpci->sys_irq_mask = (u32) (HSIMR_PDN_INT_EN | HSIMR_RON_INT_EN);
	rtlpci->sys_irq_mask = (u32) (HSIMR_PDN_INT_EN | HSIMR_RON_INT_EN);


	/* for debug level */
	rtlpriv->dbg.global_debuglevel = rtlpriv->cfg->mod_params->debug;
	/* for LPS & IPS */
	/* for LPS & IPS */
	rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps;
	rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps;
	rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
	rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
@@ -276,7 +274,8 @@ static struct rtl_mod_params rtl88ee_mod_params = {
	.swctrl_lps = false,
	.swctrl_lps = false,
	.fwctrl_lps = false,
	.fwctrl_lps = false,
	.msi_support = true,
	.msi_support = true,
	.debug = 0,
	.debug_level = 0,
	.debug_mask = 0,
};
};


static const struct rtl_hal_cfg rtl88ee_hal_cfg = {
static const struct rtl_hal_cfg rtl88ee_hal_cfg = {
@@ -392,7 +391,8 @@ MODULE_DESCRIPTION("Realtek 8188E 802.11n PCI wireless");
MODULE_FIRMWARE("rtlwifi/rtl8188efw.bin");
MODULE_FIRMWARE("rtlwifi/rtl8188efw.bin");


module_param_named(swenc, rtl88ee_mod_params.sw_crypto, bool, 0444);
module_param_named(swenc, rtl88ee_mod_params.sw_crypto, bool, 0444);
module_param_named(debug, rtl88ee_mod_params.debug, int, 0444);
module_param_named(debug_level, rtl88ee_mod_params.debug_level, int, 0644);
module_param_named(debug_mask, rtl88ee_mod_params.debug_mask, ullong, 0644);
module_param_named(ips, rtl88ee_mod_params.inactiveps, bool, 0444);
module_param_named(ips, rtl88ee_mod_params.inactiveps, bool, 0444);
module_param_named(swlps, rtl88ee_mod_params.swctrl_lps, bool, 0444);
module_param_named(swlps, rtl88ee_mod_params.swctrl_lps, bool, 0444);
module_param_named(fwlps, rtl88ee_mod_params.fwctrl_lps, bool, 0444);
module_param_named(fwlps, rtl88ee_mod_params.fwctrl_lps, bool, 0444);
@@ -404,7 +404,8 @@ MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
MODULE_PARM_DESC(fwlps, "Set to 1 to use FW control power save (default 1)\n");
MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 1)\n");
MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 1)\n");
MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
MODULE_PARM_DESC(debug_level, "Set debug level (0-5) (default 0)");
MODULE_PARM_DESC(debug_mask, "Set debug mask (default 0)");
MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n");
MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n");


static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
Loading