diff mbox series

[1/6] iwlwifi: Decrease firmware monitor debug area from 4MB to 512k.

Message ID 20201231000523.14963-1-greearb@candelatech.com
State New
Headers show
Series [1/6] iwlwifi: Decrease firmware monitor debug area from 4MB to 512k. | expand

Commit Message

Ben Greear Dec. 31, 2020, 12:05 a.m. UTC
From: Ben Greear <greearb@candelatech.com>

It appears the code can handle down to 2^11, so set max in
this case to 2^19 to save mem.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Julian Calaby Dec. 31, 2020, 1:19 a.m. UTC | #1
Hi Ben,

On Thu, Dec 31, 2020 at 11:17 AM <greearb@candelatech.com> wrote:
>

> From: Ben Greear <greearb@candelatech.com>

>

> This allows one to set the NSS and some

> other low-level features for ax200 radios.

>

> Signed-off-by: Ben Greear <greearb@candelatech.com>

> ---

>  drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c | 8 ++++++--

>  1 file changed, 6 insertions(+), 2 deletions(-)

>

> diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c

> index 223c716d9fce..e2ae509d1650 100644

> --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c

> +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c

> @@ -246,12 +246,16 @@ void iwl_dbg_cfg_load_ini(struct device *dev, struct iwl_dbg_cfg *dbgcfg)

>         const struct firmware *fw;

>         char *data, *end, *pos;

>         int err;

> +       char fname[128];

>

>         if (dbgcfg->loaded)

>                 return;

>

> -       /* TODO: maybe add a per-device file? */

> -       err = firmware_request_nowarn(&fw, "iwl-dbg-cfg.ini", dev);

> +       snprintf(fname, 127, "iwl-dbg-cfg-%s.ini", dev_name(dev));

> +       fname[127] = 0;

> +

> +       /* TODO: maybe add a per-device file?  Yes, did that. --Ben */


You probably don't need the comment anymore =)

> +       err = firmware_request_nowarn(&fw, fname, dev);


Would it make sense to fall back to "iwl-dbg-cfg.ini" if the
per-device one isn't available?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
Ben Greear Dec. 31, 2020, 2:47 a.m. UTC | #2
On 12/30/20 5:19 PM, Julian Calaby wrote:
> Hi Ben,

> 

> On Thu, Dec 31, 2020 at 11:17 AM <greearb@candelatech.com> wrote:

>>

>> From: Ben Greear <greearb@candelatech.com>

>>

>> This allows one to set the NSS and some

>> other low-level features for ax200 radios.

>>

>> Signed-off-by: Ben Greear <greearb@candelatech.com>

>> ---

>>   drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c | 8 ++++++--

>>   1 file changed, 6 insertions(+), 2 deletions(-)

>>

>> diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c

>> index 223c716d9fce..e2ae509d1650 100644

>> --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c

>> +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-cfg.c

>> @@ -246,12 +246,16 @@ void iwl_dbg_cfg_load_ini(struct device *dev, struct iwl_dbg_cfg *dbgcfg)

>>          const struct firmware *fw;

>>          char *data, *end, *pos;

>>          int err;

>> +       char fname[128];

>>

>>          if (dbgcfg->loaded)

>>                  return;

>>

>> -       /* TODO: maybe add a per-device file? */

>> -       err = firmware_request_nowarn(&fw, "iwl-dbg-cfg.ini", dev);

>> +       snprintf(fname, 127, "iwl-dbg-cfg-%s.ini", dev_name(dev));

>> +       fname[127] = 0;

>> +

>> +       /* TODO: maybe add a per-device file?  Yes, did that. --Ben */

> 

> You probably don't need the comment anymore =)

> 

>> +       err = firmware_request_nowarn(&fw, fname, dev);

> 

> Would it make sense to fall back to "iwl-dbg-cfg.ini" if the

> per-device one isn't available?


It would be fine with me, lets see if Luca has any interest in the patches
in general before I go tweaking on them...

Thanks,
Ben

> 

> Thanks,

> 



-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 2fffbbc8462f..18ddaa2c73fc 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -223,8 +223,8 @@  static void iwl_pcie_alloc_fw_monitor_block(struct iwl_trans *trans,
 			continue;
 
 		IWL_INFO(trans,
-			 "Allocated 0x%08x bytes for firmware monitor.\n",
-			 size);
+			 "Allocated 0x%08x bytes for firmware monitor, max_power: %d  min_power: %d  power: %d.\n",
+			 size, max_power, min_power, power);
 		break;
 	}
 
@@ -244,6 +244,8 @@  static void iwl_pcie_alloc_fw_monitor_block(struct iwl_trans *trans,
 
 void iwl_pcie_alloc_fw_monitor(struct iwl_trans *trans, u8 max_power)
 {
+	pr_err("iwl_pcie_alloc_fw_monitor, monitor size max_power requested: %d\n",
+	       max_power);
 	if (!max_power) {
 		/* default max_power is maximum */
 		max_power = 26;
@@ -256,6 +258,13 @@  void iwl_pcie_alloc_fw_monitor(struct iwl_trans *trans, u8 max_power)
 		 max_power))
 		return;
 
+	/* Try to use less memory, there are other things in the system as well! */
+	if (max_power > 19) {
+		pr_err("iwl_pcie_alloc_fw_monitor, decreasing max-power from %d to 19 to save memory.\n",
+		       max_power);
+		max_power = 19;
+	}
+
 	if (trans->dbg.fw_mon.size)
 		return;