Commit 47313e34 authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy

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: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 52a02d15
...@@ -183,14 +183,12 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) ...@@ -183,14 +183,12 @@ int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
iwl_set_rxon_hwcrypto(priv, ctx, !priv->cfg->mod_params->sw_crypto); iwl_set_rxon_hwcrypto(priv, ctx, !priv->cfg->mod_params->sw_crypto);
if (new_assoc) { if (new_assoc) {
if (WARN_ON(!ctx->vif))
return -EINVAL;
/* /*
* First of all, before setting associated, we need to * First of all, before setting associated, we need to
* send RXON timing so the device knows about the DTIM * send RXON timing so the device knows about the DTIM
* period and other timing values * period and other timing values
*/ */
ret = iwl_send_rxon_timing(priv, ctx->vif); ret = iwl_send_rxon_timing(priv, ctx);
if (ret) { if (ret) {
IWL_ERR(priv, "Error setting RXON timing!\n"); IWL_ERR(priv, "Error setting RXON timing!\n");
return ret; return ret;
...@@ -3296,7 +3294,7 @@ void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3296,7 +3294,7 @@ void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
iwlcore_commit_rxon(priv, ctx); iwlcore_commit_rxon(priv, ctx);
ret = iwl_send_rxon_timing(priv, vif); ret = iwl_send_rxon_timing(priv, ctx);
if (ret) if (ret)
IWL_WARN(priv, "RXON timing - " IWL_WARN(priv, "RXON timing - "
"Attempting to continue.\n"); "Attempting to continue.\n");
...@@ -3536,7 +3534,7 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3536,7 +3534,7 @@ void iwl_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
iwlcore_commit_rxon(priv, ctx); iwlcore_commit_rxon(priv, ctx);
/* RXON Timing */ /* RXON Timing */
ret = iwl_send_rxon_timing(priv, vif); ret = iwl_send_rxon_timing(priv, ctx);
if (ret) if (ret)
IWL_WARN(priv, "RXON timing failed - " IWL_WARN(priv, "RXON timing failed - "
"Attempting to continue.\n"); "Attempting to continue.\n");
......
...@@ -500,13 +500,13 @@ static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) ...@@ -500,13 +500,13 @@ static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val)
return new_val; return new_val;
} }
int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
{ {
u64 tsf; u64 tsf;
s32 interval_tm, rem; s32 interval_tm, rem;
struct ieee80211_conf *conf = NULL; struct ieee80211_conf *conf = NULL;
u16 beacon_int; u16 beacon_int;
struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); struct ieee80211_vif *vif = ctx->vif;
conf = ieee80211_get_hw_conf(priv->hw); conf = ieee80211_get_hw_conf(priv->hw);
...@@ -517,15 +517,13 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -517,15 +517,13 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif)
ctx->timing.timestamp = cpu_to_le64(priv->timestamp); ctx->timing.timestamp = cpu_to_le64(priv->timestamp);
ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval); ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval);
beacon_int = vif->bss_conf.beacon_int; beacon_int = vif ? vif->bss_conf.beacon_int : 0;
if (vif->type == NL80211_IFTYPE_ADHOC) { /*
/* TODO: we need to get atim_window from upper stack * TODO: For IBSS we need to get atim_window from mac80211,
* for now we set to 0 */ * for now just always use 0
ctx->timing.atim_window = 0; */
} else { ctx->timing.atim_window = 0;
ctx->timing.atim_window = 0;
}
beacon_int = iwl_adjust_beacon_interval(beacon_int, beacon_int = iwl_adjust_beacon_interval(beacon_int,
priv->hw_params.max_beacon_itrvl * TIME_UNIT); 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,7 +534,7 @@ int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif)
rem = do_div(tsf, interval_tm); rem = do_div(tsf, interval_tm);
ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem); ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem);
ctx->timing.dtim_period = vif->bss_conf.dtim_period; ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ?: 1) : 1;
IWL_DEBUG_ASSOC(priv, IWL_DEBUG_ASSOC(priv,
"beacon interval %d beacon timer %d beacon tim %d\n", "beacon interval %d beacon timer %d beacon tim %d\n",
......
...@@ -728,7 +728,7 @@ extern int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, ...@@ -728,7 +728,7 @@ extern int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
void iwl_apm_stop(struct iwl_priv *priv); void iwl_apm_stop(struct iwl_priv *priv);
int iwl_apm_init(struct iwl_priv *priv); int iwl_apm_init(struct iwl_priv *priv);
int iwl_send_rxon_timing(struct iwl_priv *priv, struct ieee80211_vif *vif); int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
static inline int iwl_send_rxon_assoc(struct iwl_priv *priv, static inline int iwl_send_rxon_assoc(struct iwl_priv *priv,
struct iwl_rxon_context *ctx) struct iwl_rxon_context *ctx)
{ {
......
...@@ -3110,7 +3110,7 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3110,7 +3110,7 @@ void iwl3945_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif)
ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
iwlcore_commit_rxon(priv, ctx); iwlcore_commit_rxon(priv, ctx);
rc = iwl_send_rxon_timing(priv, vif); rc = iwl_send_rxon_timing(priv, ctx);
if (rc) if (rc)
IWL_WARN(priv, "REPLY_RXON_TIMING failed - " IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
"Attempting to continue.\n"); "Attempting to continue.\n");
...@@ -3285,7 +3285,7 @@ void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -3285,7 +3285,7 @@ void iwl3945_config_ap(struct iwl_priv *priv, struct ieee80211_vif *vif)
iwlcore_commit_rxon(priv, ctx); iwlcore_commit_rxon(priv, ctx);
/* RXON Timing */ /* RXON Timing */
rc = iwl_send_rxon_timing(priv, vif); rc = iwl_send_rxon_timing(priv, ctx);
if (rc) if (rc)
IWL_WARN(priv, "REPLY_RXON_TIMING failed - " IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
"Attempting to continue.\n"); "Attempting to continue.\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment