aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-23 04:46:55 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-08-27 12:48:16 -0400
commit47313e340ee6faa43d8ad8a509a00ed1584fb34d (patch)
treeccef408ed10257eb3f23437961affdc13e6ab6d4 /drivers/net/wireless
parent52a02d1500e4cbb347006e407d1c0bd941eee7fc (diff)
iwlwifi: pass context to iwl_send_rxon_timing
Sometimes we need to send RXON timing even when we don't have a virtual interface yet, so pass the context and allow passing one without a virtual interface pointer. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c4
4 files changed, 15 insertions, 19 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index f2884b5ca5b4..85eea944498e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -183,14 +183,12 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
183 iwl_set_rxon_hwcrypto(priv, ctx, !priv->cfg->mod_params->sw_crypto); 183 iwl_set_rxon_hwcrypto(priv, ctx, !priv->cfg->mod_params->sw_crypto);
184 184
185 if (new_assoc) { 185 if (new_assoc) {
186 if (WARN_ON(!ctx->vif))
187 return -EINVAL;
188 /* 186 /*
189 * First of all, before setting associated, we need to 187 * First of all, before setting associated, we need to
190 * send RXON timing so the device knows about the DTIM 188 * send RXON timing so the device knows about the DTIM
191 * period and other timing values 189 * period and other timing values
192 */ 190 */
193 ret = iwl_send_rxon_timing(priv, ctx->vif); 191 ret = iwl_send_rxon_timing(priv, ctx);
194 if (ret) { 192 if (ret) {
195 IWL_ERR(priv, "Error setting RXON timing!\n"); 193 IWL_ERR(priv, "Error setting RXON timing!\n");
196 return ret; 194 return ret;
@@ -3296,7 +3294,7 @@ void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
3296 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3294 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3297 iwlcore_commit_rxon(priv, ctx); 3295 iwlcore_commit_rxon(priv, ctx);
3298 3296
3299 ret = iwl_send_rxon_timing(priv, vif); 3297 ret = iwl_send_rxon_timing(priv, ctx);
3300 if (ret) 3298 if (ret)
3301 IWL_WARN(priv, "RXON timing - " 3299 IWL_WARN(priv, "RXON timing - "
3302 "Attempting to continue.\n"); 3300 "Attempting to continue.\n");
@@ -3536,7 +3534,7 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
3536 iwlcore_commit_rxon(priv, ctx); 3534 iwlcore_commit_rxon(priv, ctx);
3537 3535
3538 /* RXON Timing */ 3536 /* RXON Timing */
3539 ret = iwl_send_rxon_timing(priv, vif); 3537 ret = iwl_send_rxon_timing(priv, ctx);
3540 if (ret) 3538 if (ret)
3541 IWL_WARN(priv, "RXON timing failed - " 3539 IWL_WARN(priv, "RXON timing failed - "
3542 "Attempting to continue.\n"); 3540 "Attempting to continue.\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index b61b838a24b5..91ca5173e862 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -500,13 +500,13 @@ static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val)
500 return new_val; 500 return new_val;
501} 501}
502 502
503int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) 503int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
504{ 504{
505 u64 tsf; 505 u64 tsf;
506 s32 interval_tm, rem; 506 s32 interval_tm, rem;
507 struct ieee80211_conf *conf = NULL; 507 struct ieee80211_conf *conf = NULL;
508 u16 beacon_int; 508 u16 beacon_int;
509 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 509 struct ieee80211_vif *vif = ctx->vif;
510 510
511 conf = ieee80211_get_hw_conf(priv->hw); 511 conf = ieee80211_get_hw_conf(priv->hw);
512 512
@@ -517,15 +517,13 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif)
517 ctx->timing.timestamp = cpu_to_le64(priv->timestamp); 517 ctx->timing.timestamp = cpu_to_le64(priv->timestamp);
518 ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval); 518 ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval);
519 519
520 beacon_int = vif->bss_conf.beacon_int; 520 beacon_int = vif ? vif->bss_conf.beacon_int : 0;
521 521
522 if (vif->type == NL80211_IFTYPE_ADHOC) { 522 /*
523 /* TODO: we need to get atim_window from upper stack 523 * TODO: For IBSS we need to get atim_window from mac80211,
524 * for now we set to 0 */ 524 * for now just always use 0
525 ctx->timing.atim_window = 0; 525 */
526 } else { 526 ctx->timing.atim_window = 0;
527 ctx->timing.atim_window = 0;
528 }
529 527
530 beacon_int = iwl_adjust_beacon_interval(beacon_int, 528 beacon_int = iwl_adjust_beacon_interval(beacon_int,
531 priv->hw_params.max_beacon_itrvl * TIME_UNIT); 529 priv->hw_params.max_beacon_itrvl * TIME_UNIT);
@@ -536,7 +534,7 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif)
536 rem = do_div(tsf, interval_tm); 534 rem = do_div(tsf, interval_tm);
537 ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem); 535 ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem);
538 536
539 ctx->timing.dtim_period = vif->bss_conf.dtim_period; 537 ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1;
540 538
541 IWL_DEBUG_ASSOC(priv, 539 IWL_DEBUG_ASSOC(priv,
542 "beacon interval %d beacon timer %d beacon tim %d\n", 540 "beacon interval %d beacon timer %d beacon tim %d\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index ab465c5fd6f6..4d7910001b75 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -728,7 +728,7 @@ extern int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
728void iwl_apm_stop(struct iwl_priv *priv); 728void iwl_apm_stop(struct iwl_priv *priv);
729int iwl_apm_init(struct iwl_priv *priv); 729int iwl_apm_init(struct iwl_priv *priv);
730 730
731int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif); 731int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
732static inline int iwl_send_rxon_assoc(struct iwl_priv *priv, 732static inline int iwl_send_rxon_assoc(struct iwl_priv *priv,
733 struct iwl_rxon_context *ctx) 733 struct iwl_rxon_context *ctx)
734{ 734{
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index e81c438b3348..76a45b239664 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3110,7 +3110,7 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
3110 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 3110 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
3111 iwlcore_commit_rxon(priv, ctx); 3111 iwlcore_commit_rxon(priv, ctx);
3112 3112
3113 rc = iwl_send_rxon_timing(priv, vif); 3113 rc = iwl_send_rxon_timing(priv, ctx);
3114 if (rc) 3114 if (rc)
3115 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 3115 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
3116 "Attempting to continue.\n"); 3116 "Attempting to continue.\n");
@@ -3285,7 +3285,7 @@ void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
3285 iwlcore_commit_rxon(priv, ctx); 3285 iwlcore_commit_rxon(priv, ctx);
3286 3286
3287 /* RXON Timing */ 3287 /* RXON Timing */
3288 rc = iwl_send_rxon_timing(priv, vif); 3288 rc = iwl_send_rxon_timing(priv, ctx);
3289 if (rc) 3289 if (rc)
3290 IWL_WARN(priv, "REPLY_RXON_TIMING failed - " 3290 IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
3291 "Attempting to continue.\n"); 3291 "Attempting to continue.\n");