public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] mac80211: tell driver when dtim change detected
@ 2010-01-21 15:51 wey-yi.w.guy
  2010-01-21 16:32 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: wey-yi.w.guy @ 2010-01-21 15:51 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Wey-Yi Guy

From: Wey-Yi Guy <wey-yi.w.guy@intel.com>

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.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
---
 net/mac80211/scan.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 71e10ca..a5508f5 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -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 */
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-21 16:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-21 15:51 [PATCH 1/1] mac80211: tell driver when dtim change detected wey-yi.w.guy
2010-01-21 16:32 ` Johannes Berg
2010-01-21 16:34   ` Guy, Wey-Yi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox