iwlwifi: always restrict scan dwell in P2P
authorJohannes Berg <johannes.berg@intel.com>
Fri, 20 Jan 2012 13:39:19 +0000 (14:39 +0100)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Sat, 28 Jan 2012 16:08:28 +0000 (08:08 -0800)
Whenever the PAN (P2P) context is active, it
has timers in the uCode that prevent sleep,
so scanning can't be out of channel for more
than the beacon interval programmed into the
device.

Before this patch, a full scan including any
passive channels when P2P was active would
stall forever because it wouldn't find time
to execute the passive requests (for default
beacon intervals of 100 TU.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-scan.c

index 2aea20bf0f1094f071f1addd7ac8335e043e2d79..7f2e3a1c80efeaea0ae6b7828cd05f6866c19173 100644 (file)
@@ -414,10 +414,25 @@ static u16 iwl_limit_dwell(struct iwl_priv *priv, u16 dwell_time)
        for_each_context(priv, ctx) {
                u16 value;
 
-               if (!iwl_is_associated_ctx(ctx))
-                       continue;
-               if (ctx->staging.dev_type == RXON_DEV_TYPE_P2P)
+               switch (ctx->staging.dev_type) {
+               case RXON_DEV_TYPE_P2P:
+                       /* no timing constraints */
                        continue;
+               case RXON_DEV_TYPE_ESS:
+               default:
+                       /* timing constraints if associated */
+                       if (!iwl_is_associated_ctx(ctx))
+                               continue;
+                       break;
+               case RXON_DEV_TYPE_CP:
+               case RXON_DEV_TYPE_2STA:
+                       /*
+                        * These seem to always have timers for TBTT
+                        * active in uCode even when not associated yet.
+                        */
+                       break;
+               }
+
                value = ctx->beacon_int;
                if (!value)
                        value = IWL_PASSIVE_DWELL_BASE;