aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c37
1 files changed, 35 insertions, 2 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 =