aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/mvm.h
diff options
context:
space:
mode:
authorEytan Lifshitz <eytan.lifshitz@intel.com>2013-05-19 12:14:41 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-05-29 03:03:18 -0400
commit9ee718aa9269cf56040cf12f0f6ac6e0057397b2 (patch)
tree5d4b9d8bb7b16f758ea0d6c8a4c85e87f4681600 /drivers/net/wireless/iwlwifi/mvm/mvm.h
parentf68d18f202d50f60746a8bcce1dc965b2f5035c0 (diff)
iwlwifi: mvm: add thermal throttling and CT kill
In order to avoid NIC destruction due to high temperature, CT kill will power down the NIC. To avoid this, thermal throttling will decrease throughput to prevent the NIC from reaching the temperature at which CT kill is performed. Signed-off-by: Eytan Lifshitz <eytan.lifshitz@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/mvm.h')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h101
1 files changed, 95 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 4e87a321e107..a288552491b3 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -150,6 +150,12 @@ enum iwl_power_scheme {
150 150
151#define IWL_CONN_MAX_LISTEN_INTERVAL 70 151#define IWL_CONN_MAX_LISTEN_INTERVAL 70
152 152
153enum iwl_mvm_smps_type_request {
154 IWL_MVM_SMPS_REQ_BT_COEX,
155 IWL_MVM_SMPS_REQ_TT,
156 NUM_IWL_MVM_SMPS_REQ,
157};
158
153/** 159/**
154 * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context 160 * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context
155 * @id: between 0 and 3 161 * @id: between 0 and 3
@@ -164,6 +170,8 @@ enum iwl_power_scheme {
164 * @bcast_sta: station used for broadcast packets. Used by the following 170 * @bcast_sta: station used for broadcast packets. Used by the following
165 * vifs: P2P_DEVICE, GO and AP. 171 * vifs: P2P_DEVICE, GO and AP.
166 * @beacon_skb: the skb used to hold the AP/GO beacon template 172 * @beacon_skb: the skb used to hold the AP/GO beacon template
173 * @smps_requests: the requests of of differents parts of the driver, regard
174 the desired smps mode.
167 */ 175 */
168struct iwl_mvm_vif { 176struct iwl_mvm_vif {
169 u16 id; 177 u16 id;
@@ -218,6 +226,8 @@ struct iwl_mvm_vif {
218 struct dentry *dbgfs_slink; 226 struct dentry *dbgfs_slink;
219 void *dbgfs_data; 227 void *dbgfs_data;
220#endif 228#endif
229
230 enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ];
221}; 231};
222 232
223static inline struct iwl_mvm_vif * 233static inline struct iwl_mvm_vif *
@@ -226,12 +236,6 @@ iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif)
226 return (void *)vif->drv_priv; 236 return (void *)vif->drv_priv;
227} 237}
228 238
229enum iwl_mvm_status {
230 IWL_MVM_STATUS_HW_RFKILL,
231 IWL_MVM_STATUS_ROC_RUNNING,
232 IWL_MVM_STATUS_IN_HW_RESTART,
233};
234
235enum iwl_scan_status { 239enum iwl_scan_status {
236 IWL_MVM_SCAN_NONE, 240 IWL_MVM_SCAN_NONE,
237 IWL_MVM_SCAN_OS, 241 IWL_MVM_SCAN_OS,
@@ -249,6 +253,63 @@ struct iwl_nvm_section {
249 const u8 *data; 253 const u8 *data;
250}; 254};
251 255
256/*
257 * Tx-backoff threshold
258 * @temperature: The threshold in Celsius
259 * @backoff: The tx-backoff in uSec
260 */
261struct iwl_tt_tx_backoff {
262 s32 temperature;
263 u32 backoff;
264};
265
266#define TT_TX_BACKOFF_SIZE 6
267
268/**
269 * struct iwl_tt_params - thermal throttling parameters
270 * @ct_kill_entry: CT Kill entry threshold
271 * @ct_kill_exit: CT Kill exit threshold
272 * @ct_kill_duration: The time intervals (in uSec) in which the driver needs
273 * to checks whether to exit CT Kill.
274 * @dynamic_smps_entry: Dynamic SMPS entry threshold
275 * @dynamic_smps_exit: Dynamic SMPS exit threshold
276 * @tx_protection_entry: TX protection entry threshold
277 * @tx_protection_exit: TX protection exit threshold
278 * @tx_backoff: Array of thresholds for tx-backoff , in ascending order.
279 * @support_ct_kill: Support CT Kill?
280 * @support_dynamic_smps: Support dynamic SMPS?
281 * @support_tx_protection: Support tx protection?
282 * @support_tx_backoff: Support tx-backoff?
283 */
284struct iwl_tt_params {
285 s32 ct_kill_entry;
286 s32 ct_kill_exit;
287 u32 ct_kill_duration;
288 s32 dynamic_smps_entry;
289 s32 dynamic_smps_exit;
290 s32 tx_protection_entry;
291 s32 tx_protection_exit;
292 struct iwl_tt_tx_backoff tx_backoff[TT_TX_BACKOFF_SIZE];
293 bool support_ct_kill;
294 bool support_dynamic_smps;
295 bool support_tx_protection;
296 bool support_tx_backoff;
297};
298
299/**
300 * struct iwl_mvm_tt_mgnt - Thermal Throttling Management structure
301 * @ct_kill_exit: worker to exit thermal kill
302 * @dynamic_smps: Is thermal throttling enabled dynamic_smps?
303 * @tx_backoff: The current thremal throttling tx backoff in uSec.
304 * @params: Parameters to configure the thermal throttling algorithm.
305 */
306struct iwl_mvm_tt_mgmt {
307 struct delayed_work ct_kill_exit;
308 bool dynamic_smps;
309 u32 tx_backoff;
310 const struct iwl_tt_params *params;
311};
312
252struct iwl_mvm { 313struct iwl_mvm {
253 /* for logger access */ 314 /* for logger access */
254 struct device *dev; 315 struct device *dev;
@@ -356,6 +417,10 @@ struct iwl_mvm {
356 /* BT-Coex */ 417 /* BT-Coex */
357 u8 bt_kill_msk; 418 u8 bt_kill_msk;
358 struct iwl_bt_coex_profile_notif last_bt_notif; 419 struct iwl_bt_coex_profile_notif last_bt_notif;
420
421 /* Thermal Throttling and CTkill */
422 struct iwl_mvm_tt_mgmt thermal_throttle;
423 s32 temperature; /* Celsius */
359}; 424};
360 425
361/* Extract MVM priv from op_mode and _hw */ 426/* Extract MVM priv from op_mode and _hw */
@@ -365,6 +430,19 @@ struct iwl_mvm {
365#define IWL_MAC80211_GET_MVM(_hw) \ 430#define IWL_MAC80211_GET_MVM(_hw) \
366 IWL_OP_MODE_GET_MVM((struct iwl_op_mode *)((_hw)->priv)) 431 IWL_OP_MODE_GET_MVM((struct iwl_op_mode *)((_hw)->priv))
367 432
433enum iwl_mvm_status {
434 IWL_MVM_STATUS_HW_RFKILL,
435 IWL_MVM_STATUS_HW_CTKILL,
436 IWL_MVM_STATUS_ROC_RUNNING,
437 IWL_MVM_STATUS_IN_HW_RESTART,
438};
439
440static inline bool iwl_mvm_is_radio_killed(struct iwl_mvm *mvm)
441{
442 return test_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status) ||
443 test_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status);
444}
445
368extern const u8 iwl_mvm_ac_to_tx_fifo[]; 446extern const u8 iwl_mvm_ac_to_tx_fifo[];
369 447
370struct iwl_rate_info { 448struct iwl_rate_info {
@@ -555,4 +633,15 @@ int iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm,
555int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm, 633int iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm,
556 struct ieee80211_vif *vif); 634 struct ieee80211_vif *vif);
557 635
636/* SMPS */
637void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
638 enum iwl_mvm_smps_type_request req_type,
639 enum ieee80211_smps_mode smps_request);
640
641/* Thermal management and CT-kill */
642void iwl_mvm_tt_handler(struct iwl_mvm *mvm);
643void iwl_mvm_tt_initialize(struct iwl_mvm *mvm);
644void iwl_mvm_tt_exit(struct iwl_mvm *mvm);
645void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state);
646
558#endif /* __IWL_MVM_H__ */ 647#endif /* __IWL_MVM_H__ */