Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315221
b: refs/heads/master
c: b3a6d2e
h: refs/heads/master
i:
  315219: 131bd5c
v: v3
  • Loading branch information
Johannes Berg committed Jun 25, 2012
1 parent 392cbcf commit 53a33df
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 94bfa4a255b3436e9a258585be6687d1f5c02a71
refs/heads/master: b3a6d2e0e727c3b126093c9b5fcdf41dd12bc4fd
37 changes: 27 additions & 10 deletions trunk/drivers/net/wireless/iwlwifi/dvm/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,21 @@ static u16 iwl_get_active_dwell_time(struct iwl_priv *priv,
static u16 iwl_limit_dwell(struct iwl_priv *priv, u16 dwell_time)
{
struct iwl_rxon_context *ctx;
int limits[NUM_IWL_RXON_CTX] = {};
int n_active = 0;
u16 limit;

BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);

/*
* If we're associated, we clamp the dwell time 98%
* of the smallest beacon interval (minus 2 * channel
* tune time)
* of the beacon interval (minus 2 * channel tune time)
* If both contexts are active, we have to restrict to
* 1/2 of the minimum of them, because they might be in
* lock-step with the time inbetween only half of what
* time we'd have in each of them.
*/
for_each_context(priv, ctx) {
u16 value;

switch (ctx->staging.dev_type) {
case RXON_DEV_TYPE_P2P:
/* no timing constraints */
Expand All @@ -424,14 +430,25 @@ static u16 iwl_limit_dwell(struct iwl_priv *priv, u16 dwell_time)
break;
}

value = ctx->beacon_int;
if (!value)
value = IWL_PASSIVE_DWELL_BASE;
value = (value * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2;
dwell_time = min(value, dwell_time);
limits[n_active++] = ctx->beacon_int ?: IWL_PASSIVE_DWELL_BASE;
}

return dwell_time;
switch (n_active) {
case 0:
return dwell_time;
case 2:
limit = (limits[1] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2;
limit /= 2;
dwell_time = min(limit, dwell_time);
/* fall through to limit further */
case 1:
limit = (limits[0] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2;
limit /= n_active;
return min(limit, dwell_time);
default:
WARN_ON_ONCE(1);
return dwell_time;
}
}

static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
Expand Down

0 comments on commit 53a33df

Please sign in to comment.