OSDN Git Service

iwlwifi: mvm: add thermal throttling debugging
authoreytan lifshitz <eytan.lifshitz@intel.com>
Tue, 18 Jun 2013 11:28:56 +0000 (14:28 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 25 Jun 2013 10:12:24 +0000 (12:12 +0200)
Add prints visible to the user when entering and exiting
thrermal throttling, because so users can tell that the
NIC is getting too hot (and throughput will decrease.)

Signed-off-by: eytan lifshitz <eytan.lifshitz@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/tt.c

index 7d216dd..1c6476e 100644 (file)
@@ -352,12 +352,14 @@ struct iwl_tt_params {
  * @dynamic_smps: Is thermal throttling enabled dynamic_smps?
  * @tx_backoff: The current thremal throttling tx backoff in uSec.
  * @params: Parameters to configure the thermal throttling algorithm.
+ * @throttle: Is thermal throttling is active?
  */
 struct iwl_mvm_tt_mgmt {
        struct delayed_work ct_kill_exit;
        bool dynamic_smps;
        u32 tx_backoff;
        const struct iwl_tt_params *params;
+       bool throttle;
 };
 
 struct iwl_mvm {
index a7e3b8d..d6ae7f1 100644 (file)
@@ -427,6 +427,7 @@ void iwl_mvm_tt_handler(struct iwl_mvm *mvm)
        const struct iwl_tt_params *params = mvm->thermal_throttle.params;
        struct iwl_mvm_tt_mgmt *tt = &mvm->thermal_throttle;
        s32 temperature = mvm->temperature;
+       bool throttle_enable = false;
        int i;
        u32 tx_backoff;
 
@@ -445,6 +446,7 @@ void iwl_mvm_tt_handler(struct iwl_mvm *mvm)
                        ieee80211_iterate_active_interfaces_atomic(
                                        mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
                                        iwl_mvm_tt_smps_iterator, mvm);
+                       throttle_enable = true;
                } else if (tt->dynamic_smps &&
                           temperature <= params->dynamic_smps_exit) {
                        IWL_DEBUG_TEMP(mvm, "Disable dynamic SMPS\n");
@@ -456,10 +458,12 @@ void iwl_mvm_tt_handler(struct iwl_mvm *mvm)
        }
 
        if (params->support_tx_protection) {
-               if (temperature >= params->tx_protection_entry)
+               if (temperature >= params->tx_protection_entry) {
                        iwl_mvm_tt_tx_protection(mvm, true);
-               else if (temperature <= params->tx_protection_exit)
+                       throttle_enable = true;
+               } else if (temperature <= params->tx_protection_exit) {
                        iwl_mvm_tt_tx_protection(mvm, false);
+               }
        }
 
        if (params->support_tx_backoff) {
@@ -469,9 +473,22 @@ void iwl_mvm_tt_handler(struct iwl_mvm *mvm)
                                break;
                        tx_backoff = params->tx_backoff[i].backoff;
                }
+               if (tx_backoff != 0)
+                       throttle_enable = true;
                if (tt->tx_backoff != tx_backoff)
                        iwl_mvm_tt_tx_backoff(mvm, tx_backoff);
        }
+
+       if (!tt->throttle && throttle_enable) {
+               IWL_WARN(mvm,
+                        "Due to high temperature thermal throttling initiated\n");
+               tt->throttle = true;
+       } else if (tt->throttle && !tt->dynamic_smps && tt->tx_backoff == 0 &&
+                  temperature <= params->tx_protection_exit) {
+               IWL_WARN(mvm,
+                        "Temperature is back to normal thermal throttling stopped\n");
+               tt->throttle = false;
+       }
 }
 
 static const struct iwl_tt_params iwl7000_tt_params = {
@@ -502,6 +519,7 @@ void iwl_mvm_tt_initialize(struct iwl_mvm *mvm)
 
        IWL_DEBUG_TEMP(mvm, "Initialize Thermal Throttling\n");
        tt->params = &iwl7000_tt_params;
+       tt->throttle = false;
        INIT_DELAYED_WORK(&tt->ct_kill_exit, check_exit_ctkill);
 }