diff options
author | Ilan Peer <ilan.peer@intel.com> | 2013-02-13 04:05:18 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-03-20 09:31:04 -0400 |
commit | e635c797b3b18ffbe4ef5db27971f48b661f03bd (patch) | |
tree | 9bf53c9f0eeed95c7acb5d3ba7f517346d15cf5a /drivers/net/wireless/iwlwifi/mvm/time-event.c | |
parent | fc8fed0eae4c2d1756ffd2f4f86c3e4357bebb08 (diff) |
iwlwifi: mvm: Add support for different ROC types
Schedule different time event based on the ROC type
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/time-event.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/time-event.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c index 989f6c8b75d2..4dc934bed055 100644 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c | |||
@@ -76,14 +76,12 @@ | |||
76 | #define TU_TO_JIFFIES(_tu) (usecs_to_jiffies((_tu) * 1024)) | 76 | #define TU_TO_JIFFIES(_tu) (usecs_to_jiffies((_tu) * 1024)) |
77 | #define MSEC_TO_TU(_msec) (_msec*1000/1024) | 77 | #define MSEC_TO_TU(_msec) (_msec*1000/1024) |
78 | 78 | ||
79 | /* For ROC use a TE type which has priority high enough to be scheduled when | 79 | /* |
80 | * there is a concurrent BSS or GO/AP. Currently, use a TE type that has | 80 | * For the high priority TE use a time event type that has similar priority to |
81 | * priority similar to the TE priority used for action scans by the FW. | 81 | * the FW's action scan priority. |
82 | * TODO: This needs to be changed, based on the reason for the ROC, i.e., use | ||
83 | * TE_P2P_DEVICE_DISCOVERABLE for remain on channel without mgmt skb, and use | ||
84 | * TE_P2P_DEVICE_ACTION_SCAN | ||
85 | */ | 82 | */ |
86 | #define IWL_MVM_ROC_TE_TYPE TE_P2P_DEVICE_ACTION_SCAN | 83 | #define IWL_MVM_ROC_TE_TYPE_NORMAL TE_P2P_DEVICE_DISCOVERABLE |
84 | #define IWL_MVM_ROC_TE_TYPE_MGMT_TX TE_P2P_CLIENT_ASSOC | ||
87 | 85 | ||
88 | void iwl_mvm_te_clear_data(struct iwl_mvm *mvm, | 86 | void iwl_mvm_te_clear_data(struct iwl_mvm *mvm, |
89 | struct iwl_mvm_time_event_data *te_data) | 87 | struct iwl_mvm_time_event_data *te_data) |
@@ -438,7 +436,7 @@ void iwl_mvm_stop_session_protection(struct iwl_mvm *mvm, | |||
438 | } | 436 | } |
439 | 437 | ||
440 | int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 438 | int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
441 | int duration) | 439 | int duration, enum ieee80211_roc_type type) |
442 | { | 440 | { |
443 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 441 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
444 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; | 442 | struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; |
@@ -459,21 +457,29 @@ int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
459 | time_cmd.action = cpu_to_le32(FW_CTXT_ACTION_ADD); | 457 | time_cmd.action = cpu_to_le32(FW_CTXT_ACTION_ADD); |
460 | time_cmd.id_and_color = | 458 | time_cmd.id_and_color = |
461 | cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); | 459 | cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); |
462 | time_cmd.id = cpu_to_le32(IWL_MVM_ROC_TE_TYPE); | 460 | |
461 | switch (type) { | ||
462 | case IEEE80211_ROC_TYPE_NORMAL: | ||
463 | time_cmd.id = cpu_to_le32(IWL_MVM_ROC_TE_TYPE_NORMAL); | ||
464 | break; | ||
465 | case IEEE80211_ROC_TYPE_MGMT_TX: | ||
466 | time_cmd.id = cpu_to_le32(IWL_MVM_ROC_TE_TYPE_MGMT_TX); | ||
467 | break; | ||
468 | default: | ||
469 | WARN_ONCE(1, "Got an invalid ROC type\n"); | ||
470 | return -EINVAL; | ||
471 | } | ||
463 | 472 | ||
464 | time_cmd.apply_time = cpu_to_le32(0); | 473 | time_cmd.apply_time = cpu_to_le32(0); |
465 | time_cmd.dep_policy = cpu_to_le32(TE_INDEPENDENT); | 474 | time_cmd.dep_policy = cpu_to_le32(TE_INDEPENDENT); |
466 | time_cmd.is_present = cpu_to_le32(1); | 475 | time_cmd.is_present = cpu_to_le32(1); |
467 | |||
468 | time_cmd.interval = cpu_to_le32(1); | 476 | time_cmd.interval = cpu_to_le32(1); |
469 | 477 | ||
470 | /* | 478 | /* |
471 | * IWL_MVM_ROC_TE_TYPE can have lower priority than other events | 479 | * The P2P Device TEs can have lower priority than other events |
472 | * that are being scheduled by the driver/fw, and thus it might not be | 480 | * that are being scheduled by the driver/fw, and thus it might not be |
473 | * scheduled. To improve the chances of it being scheduled, allow it to | 481 | * scheduled. To improve the chances of it being scheduled, allow them |
474 | * be fragmented. | 482 | * to be fragmented, and in addition allow them to be delayed. |
475 | * In addition, for the same reasons, allow to delay the scheduling of | ||
476 | * the time event. | ||
477 | */ | 483 | */ |
478 | time_cmd.max_frags = cpu_to_le32(MSEC_TO_TU(duration)/20); | 484 | time_cmd.max_frags = cpu_to_le32(MSEC_TO_TU(duration)/20); |
479 | time_cmd.max_delay = cpu_to_le32(MSEC_TO_TU(duration/2)); | 485 | time_cmd.max_delay = cpu_to_le32(MSEC_TO_TU(duration/2)); |