aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-02-05 12:10:04 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-02-18 14:17:38 -0500
commitd2931bbd5471c35f55856e5a4f001160df9951dc (patch)
tree5f8a07ab95fd46caa54df7417f718ee2a9aa0ef6 /drivers/net/wireless/iwlwifi
parentb18bf9733c4ca4db6fdb692895fabc9d934b7303 (diff)
iwlwifi: mvm: program DTIM timings properly
For the firmware to know when DTIM beacons arrive we have to program the DTIM time in TSF and system time in the MAC context. Since mac80211 now tracks the different times (on demand), this becomes easy. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c37
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c3
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rx.c1
3 files changed, 38 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
index 0854dc338881..c33bec83b807 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
@@ -585,10 +585,43 @@ static void iwl_mvm_mac_ctxt_cmd_fill_sta(struct iwl_mvm *mvm,
585 struct iwl_mac_data_sta *ctxt_sta) 585 struct iwl_mac_data_sta *ctxt_sta)
586{ 586{
587 /* We need the dtim_period to set the MAC as associated */ 587 /* We need the dtim_period to set the MAC as associated */
588 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) 588 if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) {
589 u32 dtim_offs;
590
591 /*
592 * The DTIM count counts down, so when it is N that means N
593 * more beacon intervals happen until the DTIM TBTT. Therefore
594 * add this to the current time. If that ends up being in the
595 * future, the firmware will handle it.
596 *
597 * Also note that the system_timestamp (which we get here as
598 * "sync_device_ts") and TSF timestamp aren't at exactly the
599 * same offset in the frame -- the TSF is at the first symbol
600 * of the TSF, the system timestamp is at signal acquisition
601 * time. This means there's an offset between them of at most
602 * a few hundred microseconds (24 * 8 bits + PLCP time gives
603 * 384us in the longest case), this is currently not relevant
604 * as the firmware wakes up around 2ms before the TBTT.
605 */
606 dtim_offs = vif->bss_conf.sync_dtim_count *
607 vif->bss_conf.beacon_int;
608 /* convert TU to usecs */
609 dtim_offs *= 1024;
610
611 ctxt_sta->dtim_tsf =
612 cpu_to_le64(vif->bss_conf.sync_tsf + dtim_offs);
613 ctxt_sta->dtim_time =
614 cpu_to_le32(vif->bss_conf.sync_device_ts + dtim_offs);
615
616 IWL_DEBUG_INFO(mvm, "DTIM TBTT is 0x%llx/0x%x, offset %d\n",
617 le64_to_cpu(ctxt_sta->dtim_tsf),
618 le32_to_cpu(ctxt_sta->dtim_time),
619 dtim_offs);
620
589 ctxt_sta->is_assoc = cpu_to_le32(1); 621 ctxt_sta->is_assoc = cpu_to_le32(1);
590 else 622 } else {
591 ctxt_sta->is_assoc = cpu_to_le32(0); 623 ctxt_sta->is_assoc = cpu_to_le32(0);
624 }
592 625
593 ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int); 626 ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int);
594 ctxt_sta->bi_reciprocal = 627 ctxt_sta->bi_reciprocal =
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 6fb084f2c257..76794940e1f0 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -115,7 +115,8 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
115 IEEE80211_HW_WANT_MONITOR_VIF | 115 IEEE80211_HW_WANT_MONITOR_VIF |
116 IEEE80211_HW_SUPPORTS_PS | 116 IEEE80211_HW_SUPPORTS_PS |
117 IEEE80211_HW_SUPPORTS_DYNAMIC_PS | 117 IEEE80211_HW_SUPPORTS_DYNAMIC_PS |
118 IEEE80211_HW_AMPDU_AGGREGATION; 118 IEEE80211_HW_AMPDU_AGGREGATION |
119 IEEE80211_HW_TIMING_BEACON_ONLY;
119 120
120 hw->queues = IWL_FIRST_AMPDU_QUEUE; 121 hw->queues = IWL_FIRST_AMPDU_QUEUE;
121 hw->offchannel_tx_hw_queue = IWL_OFFCHANNEL_QUEUE; 122 hw->offchannel_tx_hw_queue = IWL_OFFCHANNEL_QUEUE;
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c
index 3f3ce91ad5c2..3f40ab05bbd8 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rx.c
@@ -267,6 +267,7 @@ int iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
267 267
268 /* rx_status carries information about the packet to mac80211 */ 268 /* rx_status carries information about the packet to mac80211 */
269 rx_status.mactime = le64_to_cpu(phy_info->timestamp); 269 rx_status.mactime = le64_to_cpu(phy_info->timestamp);
270 rx_status.device_timestamp = le32_to_cpu(phy_info->system_timestamp);
270 rx_status.band = 271 rx_status.band =
271 (phy_info->phy_flags & cpu_to_le16(RX_RES_PHY_FLAGS_BAND_24)) ? 272 (phy_info->phy_flags & cpu_to_le16(RX_RES_PHY_FLAGS_BAND_24)) ?
272 IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; 273 IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;