Skip to contentSkip to conversation

mac80211: tell driver when dtim change detected

PATCH Superseded [email protected] 2 participants 3 messages Jan 21, 2010 mac80211

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: tell driver when dtim change detected

From: Wey-Yi Guy <[email protected]>

In current implementation, mac80211 send dtim_period update to driver during association, but if no NetworkManager or similar application perform scan operation, plus tim_ie is not part of probe response; mac80211 will not get beacon with dtim information later, then mac80211 will not pass the information to driver for update.

Call ieee80211_hw_config() with IEEE80211_CONF_CHANGE_PS flag set to allow driver make correct dtim adjustment if dtim_period change detected.

---
 net/mac80211/scan.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
net/mac80211/scan.c +18 -1
index 71e10ca..a5508f5 100644
@@ -64,6 +64,7 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
 	struct ieee80211_bss *bss;
 	int clen;
 	s32 signal = 0;
+	struct ieee80211_sub_if_data *sdata;
 
 	if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
 		signal = rx_status->signal * 100;
@@ -87,7 +88,23 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
 	if (elems->tim) {
 		struct ieee80211_tim_ie *tim_ie =
 			(struct ieee80211_tim_ie *)elems->tim;
-		bss->dtim_period = tim_ie->dtim_period;
+		if (bss->dtim_period != tim_ie->dtim_period) {
+			bss->dtim_period = tim_ie->dtim_period;
+			mutex_lock(&local->iflist_mtx);
+			list_for_each_entry(sdata, &local->interfaces, list) {
+				if (!netif_running(sdata->dev))
+					continue;
+				if (sdata->vif.type ==
+				    NL80211_IFTYPE_STATION &&
+				    sdata->u.mgd.associated == bss) {
+					sdata->vif.bss_conf.dtim_period =
+						bss->dtim_period;
+					ieee80211_hw_config(local,
+						IEEE80211_CONF_CHANGE_PS);
+				}
+			}
+			mutex_unlock(&local->iflist_mtx);
+		}
 	}
 
 	/* set default value for buggy AP/no TIM element */
Signature · 1 line
1.5.6.3
maintainer
#1 lore raw
Quoted 7 lines · On Thu, 2010-01-21 at 07:51 -0800, [email protected] wrote:

From: Wey-Yi Guy <[email protected]>

In current implementation, mac80211 send dtim_period update to driver during association, but if no NetworkManager or similar application perform scan operation, plus tim_ie is not part of probe response; mac80211 will not get beacon with dtim information later, then mac80211 will not pass the information to driver for update.

Good catch.

Quoted 2 lines

Call ieee80211_hw_config() with IEEE80211_CONF_CHANGE_PS flag set to allow driver make correct dtim adjustment if dtim_period change detected.

I don't think this is the right place or the right thing to do though, this seems like an implementation detail from iwlwifi -- it only (and maybe only it) uses the DTIM interval for power saving.

However, the internal power saving stuff from mac80211 should also be recalculated if this happens, and then we can probably call it a PS change?

johannes

#2 lore raw

Hi Johannes,

Agree, only iwlwifi use the dtim information now, but not sure it will be always true. Yes, we should recalculate the internal power save when it happen, I will make the changes and re-submit

Quoted 23 lines · Johannes Berg
Quoted 7 lines · On Thu, 2010-01-21 at 07:51 -0800, [email protected] wrote:

From: Wey-Yi Guy <[email protected]>

In current implementation, mac80211 send dtim_period update to driver during association, but if no NetworkManager or similar application perform scan operation, plus tim_ie is not part of probe response; mac80211 will not get beacon with dtim information later, then mac80211 will not pass the information to driver for update.

Good catch.

Quoted 2 lines

Call ieee80211_hw_config() with IEEE80211_CONF_CHANGE_PS flag set to allow driver make correct dtim adjustment if dtim_period change detected.

I don't think this is the right place or the right thing to do though, this seems like an implementation detail from iwlwifi -- it only (and maybe only it) uses the DTIM interval for power saving.

However, the internal power saving stuff from mac80211 should also be recalculated if this happens, and then we can probably call it a PS change?

johannes