Re: [PATCH 04/19] iwlwifi: mvm: add debugfs to force CT-kill

2017-08-07 Thread Kalle Valo
Luca Coelho  writes:

> On Mon, 2017-08-07 at 16:11 +0300, Kalle Valo wrote:
>> Luca Coelho  writes:
>> 
>> > From: Chaya Rachel Ivgi 
>> > 
>> > In order to test the enter/exit CT-kill flow.
>> > 
>> > Signed-off-by: Chaya Rachel Ivgi 
>> > Signed-off-by: Luca Coelho 
>> 
>> The commit log doesn't explain what's CT-kill and how/where it could be
>> used. For example, I have no clue what this could be about.
>
> You're right, sorry for that.  I'll update the commit log and submit v2.
>
> Basically CT-kill is a thermal "RF-kill".  Whenever the NIC gets too
> hot, we shut it down to prevent further damage.  This is nothing new. 
> What this patch is adding is a fake way to simulate the NIC getting too
> hot by kicking off a debugfs entry, in the same way the FW would kick it
> off by sending a notification to the driver.
>
> This is mostly for R, but it's very useful for us and I we need it for
> our internal tests.  Not that useful for non-developers but I didn't
> want to carry this in internal driver to avoid unnecessary conflicts
> when syncing it with upstream.

Thanks, makes sense now.

-- 
Kalle Valo


Re: [PATCH 04/19] iwlwifi: mvm: add debugfs to force CT-kill

2017-08-07 Thread Luca Coelho
On Mon, 2017-08-07 at 16:11 +0300, Kalle Valo wrote:
> Luca Coelho  writes:
> 
> > From: Chaya Rachel Ivgi 
> > 
> > In order to test the enter/exit CT-kill flow.
> > 
> > Signed-off-by: Chaya Rachel Ivgi 
> > Signed-off-by: Luca Coelho 
> 
> The commit log doesn't explain what's CT-kill and how/where it could be
> used. For example, I have no clue what this could be about.

You're right, sorry for that.  I'll update the commit log and submit v2.

Basically CT-kill is a thermal "RF-kill".  Whenever the NIC gets too
hot, we shut it down to prevent further damage.  This is nothing new. 
What this patch is adding is a fake way to simulate the NIC getting too
hot by kicking off a debugfs entry, in the same way the FW would kick it
off by sending a notification to the driver.

This is mostly for R, but it's very useful for us and I we need it for
our internal tests.  Not that useful for non-developers but I didn't
want to carry this in internal driver to avoid unnecessary conflicts
when syncing it with upstream.

--
Luca.


Re: [PATCH 04/19] iwlwifi: mvm: add debugfs to force CT-kill

2017-08-07 Thread Kalle Valo
Luca Coelho  writes:

> From: Chaya Rachel Ivgi 
>
> In order to test the enter/exit CT-kill flow.
>
> Signed-off-by: Chaya Rachel Ivgi 
> Signed-off-by: Luca Coelho 

The commit log doesn't explain what's CT-kill and how/where it could be
used. For example, I have no clue what this could be about.

-- 
Kalle Valo


[PATCH 04/19] iwlwifi: mvm: add debugfs to force CT-kill

2017-08-05 Thread Luca Coelho
From: Chaya Rachel Ivgi 

In order to test the enter/exit CT-kill flow.

Signed-off-by: Chaya Rachel Ivgi 
Signed-off-by: Luca Coelho 
---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 14 ++
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h |  1 +
 drivers/net/wireless/intel/iwlwifi/mvm/tt.c  |  2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index 29f1d1807415..0b5cae54b86b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -114,6 +114,18 @@ static ssize_t iwl_dbgfs_stop_ctdp_write(struct iwl_mvm 
*mvm, char *buf,
return ret ?: count;
 }
 
+static ssize_t iwl_dbgfs_force_ctkill_write(struct iwl_mvm *mvm, char *buf,
+   size_t count, loff_t *ppos)
+{
+   if (!iwl_mvm_firmware_running(mvm) ||
+   mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR)
+   return -EIO;
+
+   iwl_mvm_enter_ctkill(mvm);
+
+   return count;
+}
+
 static ssize_t iwl_dbgfs_tx_flush_write(struct iwl_mvm *mvm, char *buf,
size_t count, loff_t *ppos)
 {
@@ -1641,6 +1653,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(prph_reg, 64);
 /* Device wide debugfs entries */
 MVM_DEBUGFS_READ_FILE_OPS(ctdp_budget);
 MVM_DEBUGFS_WRITE_FILE_OPS(stop_ctdp, 8);
+MVM_DEBUGFS_WRITE_FILE_OPS(force_ctkill, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16);
 MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain, 8);
 MVM_DEBUGFS_WRITE_FILE_OPS(send_echo_cmd, 8);
@@ -1828,6 +1841,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct 
dentry *dbgfs_dir)
MVM_DEBUGFS_ADD_FILE(nic_temp, dbgfs_dir, S_IRUSR);
MVM_DEBUGFS_ADD_FILE(ctdp_budget, dbgfs_dir, S_IRUSR);
MVM_DEBUGFS_ADD_FILE(stop_ctdp, dbgfs_dir, S_IWUSR);
+   MVM_DEBUGFS_ADD_FILE(force_ctkill, dbgfs_dir, S_IWUSR);
MVM_DEBUGFS_ADD_FILE(stations, dbgfs_dir, S_IRUSR);
MVM_DEBUGFS_ADD_FILE(bt_notif, dbgfs_dir, S_IRUSR);
MVM_DEBUGFS_ADD_FILE(bt_cmd, dbgfs_dir, S_IRUSR);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h 
b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index ae53d8564342..7423b5632bfa 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1753,6 +1753,7 @@ void iwl_mvm_thermal_exit(struct iwl_mvm *mvm);
 void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state);
 int iwl_mvm_get_temp(struct iwl_mvm *mvm, s32 *temp);
 void iwl_mvm_ct_kill_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
+void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm);
 int iwl_mvm_send_temp_report_ths_cmd(struct iwl_mvm *mvm);
 int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 budget);
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c 
b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index 3f143402cf7f..8876c2abc440 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -71,7 +71,7 @@
 
 #define IWL_MVM_TEMP_NOTIF_WAIT_TIMEOUTHZ
 
-static void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm)
+void iwl_mvm_enter_ctkill(struct iwl_mvm *mvm)
 {
struct iwl_mvm_tt_mgmt *tt = >thermal_throttle;
u32 duration = tt->params.ct_kill_duration;
-- 
2.13.2