linux-wireless.vger.kernel.org archive mirror
 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

* Re: [PATCH 1/1] mac80211: tell driver when dtim change detected
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2010-01-21 16:32 UTC (permalink / raw)
  To: wey-yi.w.guy; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 992 bytes --]

On Thu, 2010-01-21 at 07:51 -0800, wey-yi.w.guy@intel.com wrote:
> 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.

Good catch.

> 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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

* Re: [PATCH 1/1] mac80211: tell driver when dtim change detected
  2010-01-21 16:32 ` Johannes Berg
@ 2010-01-21 16:34   ` Guy, Wey-Yi
  0 siblings, 0 replies; 3+ messages in thread
From: Guy, Wey-Yi @ 2010-01-21 16:34 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org

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

On Thu, 2010-01-21 at 08:32 -0800, Johannes Berg wrote:
> On Thu, 2010-01-21 at 07:51 -0800, wey-yi.w.guy@intel.com wrote:
> > 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.
> 
> Good catch.
> 
> > 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


^ permalink raw reply	[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;
as well as URLs for NNTP newsgroup(s).