Skip to contentSkip to conversation

ath9k_htc: Adjust beacon timers for Power Save

RFC-PATCH Doru 2 participants 3 messages Feb 14, 2017 – Feb 15, 2017

Subsystems (2)
lore
Share & tools
lore

Doru

author
#0 lore raw

From: Doru Gucea <[email protected]>

Each time we receive a beacon we need to adjust the hardware timers for next DTIM and next TBTT.

Before this commit, the Power Save behaviour was incorrect. The scenario was:
- STA receives a beacon from AP with TIM unset;
- mac80211 layers puts the chip to sleep;
- chip is woken up by mac80211's software timer reponsible for beacon miss after 7 * beacon_interval period.

Normally the chip should sleep at most DTIM period. This commit configures hardware timers for waking up the chip correctly.

More details on the wiki:
https://github.com/doru91/linux-stable/wiki/Single-Interface-Power-Save

---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 4 ++++
 net/mac80211/mlme.c                           | 6 ++++++
 2 files changed, 10 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_main.c +4 -0
index 172a9ff..59a76e0 100644
@@ -1521,6 +1521,10 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
 	mutex_lock(&priv->mutex);
 	ath9k_htc_ps_wakeup(priv);
 
+	/* adjust beacon timers */
+	if (changed && BSS_CHANGED_BEACON_INFO)
+		ath9k_htc_beacon_config(priv, vif);
+
 	if (changed & BSS_CHANGED_ASSOC) {
 		ath_dbg(common, CONFIG, "BSS Changed ASSOC %d\n",
 			bss_conf->assoc);
net/mac80211/mlme.c +6 -0
index cd7e55e..ce92a39 100644
@@ -3536,6 +3536,12 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 			sdata->vif.bss_conf.sync_dtim_count = 0;
 	}
 
+	/* trigger hardware timers adjustment
+	 * this needs to be done before beacon filtering
+	 */
+	changed |= BSS_CHANGED_BEACON_INFO;
+	ieee80211_bss_info_change_notify(sdata, changed);
+
 	if (ncrc == ifmgd->beacon_crc && ifmgd->beacon_crc_valid)
 		return;
 	ifmgd->beacon_crc = ncrc;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 23 lines · Doru

From: Doru Gucea <[email protected]>

Each time we receive a beacon we need to adjust the hardware timers for next DTIM and next TBTT.

Before this commit, the Power Save behaviour was incorrect. The scenario was:
- STA receives a beacon from AP with TIM unset;
- mac80211 layers puts the chip to sleep;
- chip is woken up by mac80211's software timer reponsible for beacon miss after 7 * beacon_interval period.

Normally the chip should sleep at most DTIM period. This commit configures hardware timers for waking up the chip correctly.

More details on the wiki:
https://github.com/doru91/linux-stable/wiki/Single-Interface-Power-Save

---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 4 ++++
 net/mac80211/mlme.c                           | 6 ++++++
 2 files changed, 10 insertions(+)

[...]

net/mac80211/mlme.c static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, · line 3543

Quoted 11 lines
net/mac80211/mlme.c +5 -0
@@ -3536,6 +3536,12 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 			sdata->vif.bss_conf.sync_dtim_count = 0;
 	}
 
+	/* trigger hardware timers adjustment
+	 * this needs to be done before beacon filtering
+	 */
+	changed |= BSS_CHANGED_BEACON_INFO;
+	ieee80211_bss_info_change_notify(sdata, changed);

You shouldn't mix driver and mac80211 changes in the same patch, I suspect Johannes didn't even notice this change because of that. Create a new patchset with two patches, one for ath9k and another for mac80211.

Signature · 1 line
Kalle Valo
author
#2 lore raw
Quoted 34 lines · Kalle Valo
Quoted 23 lines · Doru

From: Doru Gucea <[email protected]>

Each time we receive a beacon we need to adjust the hardware timers for next DTIM and next TBTT.

Before this commit, the Power Save behaviour was incorrect. The scenario was:
- STA receives a beacon from AP with TIM unset;
- mac80211 layers puts the chip to sleep;
- chip is woken up by mac80211's software timer reponsible for beacon miss after 7 * beacon_interval period.

Normally the chip should sleep at most DTIM period. This commit configures hardware timers for waking up the chip correctly.

More details on the wiki:
https://github.com/doru91/linux-stable/wiki/Single-Interface-Power-Save

---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 4 ++++
 net/mac80211/mlme.c                           | 6 ++++++
 2 files changed, 10 insertions(+)

[...]

Quoted 6 lines
net/mac80211/mlme.c +0 -0
@@ -3536,6 +3536,12 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
                      sdata->vif.bss_conf.sync_dtim_count = 0;
      }
 
Quoted 9 lines

net/mac80211/mlme.c static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, · line 3543

Quoted 5 lines
net/mac80211/mlme.c +5 -0
+     /* trigger hardware timers adjustment
+      * this needs to be done before beacon filtering
+      */
+     changed |= BSS_CHANGED_BEACON_INFO;
+     ieee80211_bss_info_change_notify(sdata, changed);

You shouldn't mix driver and mac80211 changes in the same patch, I suspect Johannes didn't even notice this change because of that. Create a new patchset with two patches, one for ath9k and another for mac80211.

Thanks, I've just sent two patches as you suggested.

Quoted 3 lines

--
Kalle Valo