aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorIlan Peer <ilan.peer@intel.com>2013-06-13 01:30:12 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-06-25 06:13:36 -0400
commit3a3cb92e1daf2f2627df0a1f8c9577501663fef3 (patch)
treef16127d04d4175e377ea3503d5fa95ef2ceb7800 /drivers/net
parentdafe6c4335d042fa6573f40795ccfadc4e4fc7c6 (diff)
iwlwifi: mvm: Change the settings of AP beacon time
In case that an AP/GO interface is started while there is a station/P2P client associated, need to make sure that the AP/GO beacon time is far enough from the station's one in oder to allow the station to receive the DTIM beacons and the following traffic etc. To resolve this, when the AP is started, check if there is an active station interface, and guarantee that the AP/GO TBTT is far enough from the station one. 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')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c56
1 files changed, 51 insertions, 5 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index 273b0cc197ab..94aae9c8562c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -865,6 +865,30 @@ int iwl_mvm_mac_ctxt_beacon_changed(struct iwl_mvm *mvm,
865 return ret; 865 return ret;
866} 866}
867 867
868struct iwl_mvm_mac_ap_iterator_data {
869 struct iwl_mvm *mvm;
870 struct ieee80211_vif *vif;
871 u32 beacon_device_ts;
872 u16 beacon_int;
873};
874
875/* Find the beacon_device_ts and beacon_int for a managed interface */
876static void iwl_mvm_mac_ap_iterator(void *_data, u8 *mac,
877 struct ieee80211_vif *vif)
878{
879 struct iwl_mvm_mac_ap_iterator_data *data = _data;
880
881 if (vif->type != NL80211_IFTYPE_STATION || !vif->bss_conf.assoc)
882 return;
883
884 /* Station client has higher priority over P2P client*/
885 if (vif->p2p && data->beacon_device_ts)
886 return;
887
888 data->beacon_device_ts = vif->bss_conf.sync_device_ts;
889 data->beacon_int = vif->bss_conf.beacon_int;
890}
891
868/* 892/*
869 * Fill the specific data for mac context of type AP of P2P GO 893 * Fill the specific data for mac context of type AP of P2P GO
870 */ 894 */
@@ -874,6 +898,11 @@ static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm,
874 bool add) 898 bool add)
875{ 899{
876 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 900 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
901 struct iwl_mvm_mac_ap_iterator_data data = {
902 .mvm = mvm,
903 .vif = vif,
904 .beacon_device_ts = 0
905 };
877 906
878 ctxt_ap->bi = cpu_to_le32(vif->bss_conf.beacon_int); 907 ctxt_ap->bi = cpu_to_le32(vif->bss_conf.beacon_int);
879 ctxt_ap->bi_reciprocal = 908 ctxt_ap->bi_reciprocal =
@@ -887,16 +916,33 @@ static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm,
887 ctxt_ap->mcast_qid = cpu_to_le32(vif->cab_queue); 916 ctxt_ap->mcast_qid = cpu_to_le32(vif->cab_queue);
888 917
889 /* 918 /*
890 * Only read the system time when the MAC is being added, when we 919 * Only set the beacon time when the MAC is being added, when we
891 * just modify the MAC then we should keep the time -- the firmware 920 * just modify the MAC then we should keep the time -- the firmware
892 * can otherwise have a "jumping" TBTT. 921 * can otherwise have a "jumping" TBTT.
893 */ 922 */
894 if (add) 923 if (add) {
895 mvmvif->ap_beacon_time = 924 /*
896 iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG); 925 * If there is a station/P2P client interface which is
926 * associated, set the AP's TBTT far enough from the station's
927 * TBTT. Otherwise, set it to the current system time
928 */
929 ieee80211_iterate_active_interfaces_atomic(
930 mvm->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
931 iwl_mvm_mac_ap_iterator, &data);
932
933 if (data.beacon_device_ts) {
934 u32 rand = (prandom_u32() % (80 - 20)) + 20;
935 mvmvif->ap_beacon_time = data.beacon_device_ts +
936 ieee80211_tu_to_usec(data.beacon_int * rand /
937 100);
938 } else {
939 mvmvif->ap_beacon_time =
940 iwl_read_prph(mvm->trans,
941 DEVICE_SYSTEM_TIME_REG);
942 }
943 }
897 944
898 ctxt_ap->beacon_time = cpu_to_le32(mvmvif->ap_beacon_time); 945 ctxt_ap->beacon_time = cpu_to_le32(mvmvif->ap_beacon_time);
899
900 ctxt_ap->beacon_tsf = 0; /* unused */ 946 ctxt_ap->beacon_tsf = 0; /* unused */
901 947
902 /* TODO: Assume that the beacon id == mac context id */ 948 /* TODO: Assume that the beacon id == mac context id */