aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-02-28 08:05:14 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-03-06 10:47:54 -0500
commit506a81e6ba1148a4435dec95651cd93874c2b7cf (patch)
treec8fc7e20b647cfe210dbfc255552baab63d04266 /drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
parentb1f553c7484b983aac20c107b9766804b69cf73f (diff)
iwlwifi: mvm: don't read system time when modifying AP/GO MAC
When modifying a MAC, we update its beacon system time which is taken as a base to calculate TBTT. The firmware doesn't use the new timestamp because the time is never used after the MAC and broadcast station were added, but it is safer to not rely on this and avoids the overhead of reading the register every time the MAC is updated. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Reviewed-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index a993f6c7dac0..2779235daa35 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -855,10 +855,10 @@ int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
855 */ 855 */
856static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm, 856static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm,
857 struct ieee80211_vif *vif, 857 struct ieee80211_vif *vif,
858 struct iwl_mac_data_ap *ctxt_ap) 858 struct iwl_mac_data_ap *ctxt_ap,
859 bool add)
859{ 860{
860 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 861 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
861 u32 curr_dev_time;
862 862
863 ctxt_ap->bi = cpu_to_le32(vif->bss_conf.beacon_int); 863 ctxt_ap->bi = cpu_to_le32(vif->bss_conf.beacon_int);
864 ctxt_ap->bi_reciprocal = 864 ctxt_ap->bi_reciprocal =
@@ -870,10 +870,19 @@ static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm,
870 vif->bss_conf.dtim_period)); 870 vif->bss_conf.dtim_period));
871 871
872 ctxt_ap->mcast_qid = cpu_to_le32(vif->cab_queue); 872 ctxt_ap->mcast_qid = cpu_to_le32(vif->cab_queue);
873 curr_dev_time = iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG);
874 ctxt_ap->beacon_time = cpu_to_le32(curr_dev_time);
875 873
876 ctxt_ap->beacon_tsf = cpu_to_le64(curr_dev_time); 874 /*
875 * Only read the system time when the MAC is being added, when we
876 * just modify the MAC then we should keep the time -- the firmware
877 * can otherwise have a "jumping" TBTT.
878 */
879 if (add)
880 mvmvif->ap_beacon_time =
881 iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG);
882
883 ctxt_ap->beacon_time = cpu_to_le32(mvmvif->ap_beacon_time);
884
885 ctxt_ap->beacon_tsf = 0; /* unused */
877 886
878 /* TODO: Assume that the beacon id == mac context id */ 887 /* TODO: Assume that the beacon id == mac context id */
879 ctxt_ap->beacon_template = cpu_to_le32(mvmvif->id); 888 ctxt_ap->beacon_template = cpu_to_le32(mvmvif->id);
@@ -894,7 +903,8 @@ static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm,
894 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST); 903 cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST);
895 904
896 /* Fill the data specific for ap mode */ 905 /* Fill the data specific for ap mode */
897 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.ap); 906 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.ap,
907 action == FW_CTXT_ACTION_ADD);
898 908
899 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd); 909 return iwl_mvm_mac_ctxt_send_cmd(mvm, &cmd);
900} 910}
@@ -911,7 +921,8 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm,
911 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); 921 iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action);
912 922
913 /* Fill the data specific for GO mode */ 923 /* Fill the data specific for GO mode */
914 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap); 924 iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap,
925 action == FW_CTXT_ACTION_ADD);
915 926
916 cmd.go.ctwin = cpu_to_le32(vif->bss_conf.p2p_ctwindow); 927 cmd.go.ctwin = cpu_to_le32(vif->bss_conf.p2p_ctwindow);
917 cmd.go.opp_ps_enabled = cpu_to_le32(!!vif->bss_conf.p2p_oppps); 928 cmd.go.opp_ps_enabled = cpu_to_le32(!!vif->bss_conf.p2p_oppps);