Commit 246ed355 authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy

iwlwifi: initial contextification

In order to support multiple interfaces, we must move
a lot of data into per-context structures so we can
use the contexts the device offers. To start with,
this makes a lot of code context-aware, more changes
will move more things into the context structure.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 903786a5
...@@ -949,7 +949,8 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) ...@@ -949,7 +949,8 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
switch (priv->band) { switch (priv->band) {
case IEEE80211_BAND_2GHZ: case IEEE80211_BAND_2GHZ:
/* TODO: this always does G, not a regression */ /* TODO: this always does G, not a regression */
if (priv->active_rxon.flags & RXON_FLG_TGG_PROTECT_MSK) { if (priv->contexts[IWL_RXON_CTX_BSS].active.flags &
RXON_FLG_TGG_PROTECT_MSK) {
rs_sta->tgg = 1; rs_sta->tgg = 1;
rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot; rs_sta->expected_tpt = iwl3945_expected_tpt_g_prot;
} else } else
......
...@@ -245,7 +245,7 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate) ...@@ -245,7 +245,7 @@ int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate)
break; break;
case IEEE80211_BAND_2GHZ: case IEEE80211_BAND_2GHZ:
if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) &&
iwl_is_associated(priv)) { iwl_is_associated(priv, IWL_RXON_CTX_BSS)) {
if (rate == IWL_RATE_11M_INDEX) if (rate == IWL_RATE_11M_INDEX)
next_rate = IWL_RATE_5M_INDEX; next_rate = IWL_RATE_5M_INDEX;
} }
...@@ -1439,17 +1439,18 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv) ...@@ -1439,17 +1439,18 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv)
int rate_idx, i; int rate_idx, i;
const struct iwl_channel_info *ch_info = NULL; const struct iwl_channel_info *ch_info = NULL;
struct iwl3945_txpowertable_cmd txpower = { struct iwl3945_txpowertable_cmd txpower = {
.channel = priv->active_rxon.channel, .channel = priv->contexts[IWL_RXON_CTX_BSS].active.channel,
}; };
u16 chan;
chan = le16_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.channel);
txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1; txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
ch_info = iwl_get_channel_info(priv, ch_info = iwl_get_channel_info(priv, priv->band, chan);
priv->band,
le16_to_cpu(priv->active_rxon.channel));
if (!ch_info) { if (!ch_info) {
IWL_ERR(priv, IWL_ERR(priv,
"Failed to get channel info for channel %d [%d]\n", "Failed to get channel info for channel %d [%d]\n",
le16_to_cpu(priv->active_rxon.channel), priv->band); chan, priv->band);
return -EINVAL; return -EINVAL;
} }
...@@ -1710,7 +1711,8 @@ int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) ...@@ -1710,7 +1711,8 @@ int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power)
return 0; return 0;
} }
static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) static int iwl3945_send_rxon_assoc(struct iwl_priv *priv,
struct iwl_rxon_context *ctx)
{ {
int rc = 0; int rc = 0;
struct iwl_rx_packet *pkt; struct iwl_rx_packet *pkt;
...@@ -1721,8 +1723,8 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) ...@@ -1721,8 +1723,8 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
.flags = CMD_WANT_SKB, .flags = CMD_WANT_SKB,
.data = &rxon_assoc, .data = &rxon_assoc,
}; };
const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; const struct iwl_rxon_cmd *rxon1 = &ctx->staging;
const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; const struct iwl_rxon_cmd *rxon2 = &ctx->active;
if ((rxon1->flags == rxon2->flags) && if ((rxon1->flags == rxon2->flags) &&
(rxon1->filter_flags == rxon2->filter_flags) && (rxon1->filter_flags == rxon2->filter_flags) &&
...@@ -1732,10 +1734,10 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) ...@@ -1732,10 +1734,10 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
return 0; return 0;
} }
rxon_assoc.flags = priv->staging_rxon.flags; rxon_assoc.flags = ctx->staging.flags;
rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; rxon_assoc.filter_flags = ctx->staging.filter_flags;
rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates;
rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates;
rxon_assoc.reserved = 0; rxon_assoc.reserved = 0;
rc = iwl_send_cmd_sync(priv, &cmd); rc = iwl_send_cmd_sync(priv, &cmd);
...@@ -1761,14 +1763,14 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) ...@@ -1761,14 +1763,14 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
* function correctly transitions out of the RXON_ASSOC_MSK state if * function correctly transitions out of the RXON_ASSOC_MSK state if
* a HW tune is required based on the RXON structure changes. * a HW tune is required based on the RXON structure changes.
*/ */
static int iwl3945_commit_rxon(struct iwl_priv *priv) static int iwl3945_commit_rxon(struct iwl_priv *priv,
struct iwl_rxon_context *ctx)
{ {
/* cast away the const for active_rxon in this function */ /* cast away the const for active_rxon in this function */
struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon; struct iwl3945_rxon_cmd *active_rxon = (void *)&ctx->active;
struct iwl3945_rxon_cmd *staging_rxon = (void *)&priv->staging_rxon; struct iwl3945_rxon_cmd *staging_rxon = (void *)&ctx->staging;
int rc = 0; int rc = 0;
bool new_assoc = bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK);
!!(priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK);
if (!iwl_is_alive(priv)) if (!iwl_is_alive(priv))
return -1; return -1;
...@@ -1781,7 +1783,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) ...@@ -1781,7 +1783,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
staging_rxon->flags |= iwl3945_get_antenna_flags(priv); staging_rxon->flags |= iwl3945_get_antenna_flags(priv);
rc = iwl_check_rxon_cmd(priv); rc = iwl_check_rxon_cmd(priv, ctx);
if (rc) { if (rc) {
IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n");
return -EINVAL; return -EINVAL;
...@@ -1790,8 +1792,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) ...@@ -1790,8 +1792,9 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
/* If we don't need to send a full RXON, we can use /* If we don't need to send a full RXON, we can use
* iwl3945_rxon_assoc_cmd which is used to reconfigure filter * iwl3945_rxon_assoc_cmd which is used to reconfigure filter
* and other flags for the current radio configuration. */ * and other flags for the current radio configuration. */
if (!iwl_full_rxon_required(priv)) { if (!iwl_full_rxon_required(priv, &priv->contexts[IWL_RXON_CTX_BSS])) {
rc = iwl_send_rxon_assoc(priv); rc = iwl_send_rxon_assoc(priv,
&priv->contexts[IWL_RXON_CTX_BSS]);
if (rc) { if (rc) {
IWL_ERR(priv, "Error setting RXON_ASSOC " IWL_ERR(priv, "Error setting RXON_ASSOC "
"configuration (%d).\n", rc); "configuration (%d).\n", rc);
...@@ -1807,7 +1810,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) ...@@ -1807,7 +1810,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
* an RXON_ASSOC and the new config wants the associated mask enabled, * an RXON_ASSOC and the new config wants the associated mask enabled,
* we must clear the associated from the active configuration * we must clear the associated from the active configuration
* before we apply the new config */ * before we apply the new config */
if (iwl_is_associated(priv) && new_assoc) { if (iwl_is_associated(priv, IWL_RXON_CTX_BSS) && new_assoc) {
IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n");
active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
...@@ -1819,7 +1822,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) ...@@ -1819,7 +1822,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
active_rxon->reserved5 = 0; active_rxon->reserved5 = 0;
rc = iwl_send_cmd_pdu(priv, REPLY_RXON, rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
sizeof(struct iwl3945_rxon_cmd), sizeof(struct iwl3945_rxon_cmd),
&priv->active_rxon); &priv->contexts[IWL_RXON_CTX_BSS].active);
/* If the mask clearing failed then we set /* If the mask clearing failed then we set
* active_rxon back to what it was previously */ * active_rxon back to what it was previously */
...@@ -1848,7 +1851,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv) ...@@ -1848,7 +1851,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
staging_rxon->reserved4 = 0; staging_rxon->reserved4 = 0;
staging_rxon->reserved5 = 0; staging_rxon->reserved5 = 0;
iwl_set_rxon_hwcrypto(priv, !iwl3945_mod_params.sw_crypto); iwl_set_rxon_hwcrypto(priv, ctx, !iwl3945_mod_params.sw_crypto);
/* Apply the new configuration */ /* Apply the new configuration */
rc = iwl_send_cmd_pdu(priv, REPLY_RXON, rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
...@@ -2366,7 +2369,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv) ...@@ -2366,7 +2369,7 @@ int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
* 1M CCK rates */ * 1M CCK rates */
if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) && if (!(priv->_3945.sta_supp_rates & IWL_OFDM_RATES_MASK) &&
iwl_is_associated(priv)) { iwl_is_associated(priv, IWL_RXON_CTX_BSS)) {
index = IWL_FIRST_CCK_RATE; index = IWL_FIRST_CCK_RATE;
for (i = IWL_RATE_6M_INDEX_TABLE; for (i = IWL_RATE_6M_INDEX_TABLE;
......
...@@ -347,7 +347,7 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv) ...@@ -347,7 +347,7 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv)
struct iwl_chain_noise_data *data = &(priv->chain_noise_data); struct iwl_chain_noise_data *data = &(priv->chain_noise_data);
if ((data->state == IWL_CHAIN_NOISE_ALIVE) && if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
iwl_is_associated(priv)) { iwl_is_any_associated(priv)) {
struct iwl_calib_diff_gain_cmd cmd; struct iwl_calib_diff_gain_cmd cmd;
/* clear data for chain noise calibration algorithm */ /* clear data for chain noise calibration algorithm */
...@@ -1374,6 +1374,7 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv) ...@@ -1374,6 +1374,7 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
u8 band = 0; u8 band = 0;
bool is_ht40 = false; bool is_ht40 = false;
u8 ctrl_chan_high = 0; u8 ctrl_chan_high = 0;
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
if (test_bit(STATUS_SCANNING, &priv->status)) { if (test_bit(STATUS_SCANNING, &priv->status)) {
/* If this gets hit a lot, switch it to a BUG() and catch /* If this gets hit a lot, switch it to a BUG() and catch
...@@ -1385,17 +1386,16 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv) ...@@ -1385,17 +1386,16 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
band = priv->band == IEEE80211_BAND_2GHZ; band = priv->band == IEEE80211_BAND_2GHZ;
is_ht40 = is_ht40_channel(priv->active_rxon.flags); is_ht40 = is_ht40_channel(ctx->active.flags);
if (is_ht40 && if (is_ht40 && (ctx->active.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
(priv->active_rxon.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
ctrl_chan_high = 1; ctrl_chan_high = 1;
cmd.band = band; cmd.band = band;
cmd.channel = priv->active_rxon.channel; cmd.channel = ctx->active.channel;
ret = iwl4965_fill_txpower_tbl(priv, band, ret = iwl4965_fill_txpower_tbl(priv, band,
le16_to_cpu(priv->active_rxon.channel), le16_to_cpu(ctx->active.channel),
is_ht40, ctrl_chan_high, &cmd.tx_power); is_ht40, ctrl_chan_high, &cmd.tx_power);
if (ret) if (ret)
goto out; goto out;
...@@ -1406,12 +1406,13 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv) ...@@ -1406,12 +1406,13 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
return ret; return ret;
} }
static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) static int iwl4965_send_rxon_assoc(struct iwl_priv *priv,
struct iwl_rxon_context *ctx)
{ {
int ret = 0; int ret = 0;
struct iwl4965_rxon_assoc_cmd rxon_assoc; struct iwl4965_rxon_assoc_cmd rxon_assoc;
const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; const struct iwl_rxon_cmd *rxon1 = &ctx->staging;
const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; const struct iwl_rxon_cmd *rxon2 = &ctx->active;
if ((rxon1->flags == rxon2->flags) && if ((rxon1->flags == rxon2->flags) &&
(rxon1->filter_flags == rxon2->filter_flags) && (rxon1->filter_flags == rxon2->filter_flags) &&
...@@ -1426,16 +1427,16 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) ...@@ -1426,16 +1427,16 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
return 0; return 0;
} }
rxon_assoc.flags = priv->staging_rxon.flags; rxon_assoc.flags = ctx->staging.flags;
rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; rxon_assoc.filter_flags = ctx->staging.filter_flags;
rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates;
rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates;
rxon_assoc.reserved = 0; rxon_assoc.reserved = 0;
rxon_assoc.ofdm_ht_single_stream_basic_rates = rxon_assoc.ofdm_ht_single_stream_basic_rates =
priv->staging_rxon.ofdm_ht_single_stream_basic_rates; ctx->staging.ofdm_ht_single_stream_basic_rates;
rxon_assoc.ofdm_ht_dual_stream_basic_rates = rxon_assoc.ofdm_ht_dual_stream_basic_rates =
priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; ctx->staging.ofdm_ht_dual_stream_basic_rates;
rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain;
ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC,
sizeof(rxon_assoc), &rxon_assoc, NULL); sizeof(rxon_assoc), &rxon_assoc, NULL);
...@@ -1448,6 +1449,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv) ...@@ -1448,6 +1449,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
static int iwl4965_hw_channel_switch(struct iwl_priv *priv, static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
struct ieee80211_channel_switch *ch_switch) struct ieee80211_channel_switch *ch_switch)
{ {
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
int rc; int rc;
u8 band = 0; u8 band = 0;
bool is_ht40 = false; bool is_ht40 = false;
...@@ -1458,22 +1460,22 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, ...@@ -1458,22 +1460,22 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
u16 ch; u16 ch;
u32 tsf_low; u32 tsf_low;
u8 switch_count; u8 switch_count;
u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval); u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
struct ieee80211_vif *vif = priv->vif; struct ieee80211_vif *vif = priv->vif;
band = priv->band == IEEE80211_BAND_2GHZ; band = priv->band == IEEE80211_BAND_2GHZ;
is_ht40 = is_ht40_channel(priv->staging_rxon.flags); is_ht40 = is_ht40_channel(ctx->staging.flags);
if (is_ht40 && if (is_ht40 &&
(priv->staging_rxon.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) (ctx->staging.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
ctrl_chan_high = 1; ctrl_chan_high = 1;
cmd.band = band; cmd.band = band;
cmd.expect_beacon = 0; cmd.expect_beacon = 0;
ch = ch_switch->channel->hw_value; ch = ch_switch->channel->hw_value;
cmd.channel = cpu_to_le16(ch); cmd.channel = cpu_to_le16(ch);
cmd.rxon_flags = priv->staging_rxon.flags; cmd.rxon_flags = ctx->staging.flags;
cmd.rxon_filter_flags = priv->staging_rxon.filter_flags; cmd.rxon_filter_flags = ctx->staging.filter_flags;
switch_count = ch_switch->count; switch_count = ch_switch->count;
tsf_low = ch_switch->timestamp & 0x0ffffffff; tsf_low = ch_switch->timestamp & 0x0ffffffff;
/* /*
...@@ -1508,7 +1510,7 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, ...@@ -1508,7 +1510,7 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
cmd.expect_beacon = is_channel_radar(ch_info); cmd.expect_beacon = is_channel_radar(ch_info);
else { else {
IWL_ERR(priv, "invalid channel switch from %u to %u\n", IWL_ERR(priv, "invalid channel switch from %u to %u\n",
priv->active_rxon.channel, ch); ctx->active.channel, ch);
return -EFAULT; return -EFAULT;
} }
......
...@@ -275,13 +275,18 @@ static void iwl5150_temperature(struct iwl_priv *priv) ...@@ -275,13 +275,18 @@ static void iwl5150_temperature(struct iwl_priv *priv)
static int iwl5000_hw_channel_switch(struct iwl_priv *priv, static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
struct ieee80211_channel_switch *ch_switch) struct ieee80211_channel_switch *ch_switch)
{ {
/*
* MULTI-FIXME
* See iwl_mac_channel_switch.
*/
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
struct iwl5000_channel_switch_cmd cmd; struct iwl5000_channel_switch_cmd cmd;
const struct iwl_channel_info *ch_info; const struct iwl_channel_info *ch_info;
u32 switch_time_in_usec, ucode_switch_time; u32 switch_time_in_usec, ucode_switch_time;
u16 ch; u16 ch;
u32 tsf_low; u32 tsf_low;
u8 switch_count; u8 switch_count;
u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval); u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
struct ieee80211_vif *vif = priv->vif; struct ieee80211_vif *vif = priv->vif;
struct iwl_host_cmd hcmd = { struct iwl_host_cmd hcmd = {
.id = REPLY_CHANNEL_SWITCH, .id = REPLY_CHANNEL_SWITCH,
...@@ -293,10 +298,10 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, ...@@ -293,10 +298,10 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
cmd.band = priv->band == IEEE80211_BAND_2GHZ; cmd.band = priv->band == IEEE80211_BAND_2GHZ;
ch = ch_switch->channel->hw_value; ch = ch_switch->channel->hw_value;
IWL_DEBUG_11H(priv, "channel switch from %d to %d\n", IWL_DEBUG_11H(priv, "channel switch from %d to %d\n",
priv->active_rxon.channel, ch); ctx->active.channel, ch);
cmd.channel = cpu_to_le16(ch); cmd.channel = cpu_to_le16(ch);
cmd.rxon_flags = priv->staging_rxon.flags; cmd.rxon_flags = ctx->staging.flags;
cmd.rxon_filter_flags = priv->staging_rxon.filter_flags; cmd.rxon_filter_flags = ctx->staging.filter_flags;
switch_count = ch_switch->count; switch_count = ch_switch->count;
tsf_low = ch_switch->timestamp & 0x0ffffffff; tsf_low = ch_switch->timestamp & 0x0ffffffff;
/* /*
...@@ -331,7 +336,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, ...@@ -331,7 +336,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
cmd.expect_beacon = is_channel_radar(ch_info); cmd.expect_beacon = is_channel_radar(ch_info);
else { else {
IWL_ERR(priv, "invalid channel switch from %u to %u\n", IWL_ERR(priv, "invalid channel switch from %u to %u\n",
priv->active_rxon.channel, ch); ctx->active.channel, ch);
return -EFAULT; return -EFAULT;
} }
priv->switch_rxon.channel = cmd.channel; priv->switch_rxon.channel = cmd.channel;
......
...@@ -198,13 +198,18 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv) ...@@ -198,13 +198,18 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
static int iwl6000_hw_channel_switch(struct iwl_priv *priv, static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
struct ieee80211_channel_switch *ch_switch) struct ieee80211_channel_switch *ch_switch)
{ {
/*
* MULTI-FIXME
* See iwl_mac_channel_switch.
*/
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
struct iwl6000_channel_switch_cmd cmd; struct iwl6000_channel_switch_cmd cmd;
const struct iwl_channel_info *ch_info; const struct iwl_channel_info *ch_info;
u32 switch_time_in_usec, ucode_switch_time; u32 switch_time_in_usec, ucode_switch_time;
u16 ch; u16 ch;
u32 tsf_low; u32 tsf_low;
u8 switch_count; u8 switch_count;
u16 beacon_interval = le16_to_cpu(priv->rxon_timing.beacon_interval); u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
struct ieee80211_vif *vif = priv->vif; struct ieee80211_vif *vif = priv->vif;
struct iwl_host_cmd hcmd = { struct iwl_host_cmd hcmd = {
.id = REPLY_CHANNEL_SWITCH, .id = REPLY_CHANNEL_SWITCH,
...@@ -216,10 +221,10 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, ...@@ -216,10 +221,10 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
cmd.band = priv->band == IEEE80211_BAND_2GHZ; cmd.band = priv->band == IEEE80211_BAND_2GHZ;
ch = ch_switch->channel->hw_value; ch = ch_switch->channel->hw_value;
IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
priv->active_rxon.channel, ch); ctx->active.channel, ch);
cmd.channel = cpu_to_le16(ch); cmd.channel = cpu_to_le16(ch);
cmd.rxon_flags = priv->staging_rxon.flags; cmd.rxon_flags = ctx->staging.flags;
cmd.rxon_filter_flags = priv->staging_rxon.filter_flags; cmd.rxon_filter_flags = ctx->staging.filter_flags;
switch_count = ch_switch->count; switch_count = ch_switch->count;
tsf_low = ch_switch->timestamp & 0x0ffffffff; tsf_low = ch_switch->timestamp & 0x0ffffffff;
/* /*
...@@ -254,7 +259,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, ...@@ -254,7 +259,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
cmd.expect_beacon = is_channel_radar(ch_info); cmd.expect_beacon = is_channel_radar(ch_info);
else { else {
IWL_ERR(priv, "invalid channel switch from %u to %u\n", IWL_ERR(priv, "invalid channel switch from %u to %u\n",
priv->active_rxon.channel, ch); ctx->active.channel, ch);
return -EFAULT; return -EFAULT;
} }
priv->switch_rxon.channel = cmd.channel; priv->switch_rxon.channel = cmd.channel;
......
...@@ -625,7 +625,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp) ...@@ -625,7 +625,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv, void *resp)
data = &(priv->sensitivity_data); data = &(priv->sensitivity_data);
if (!iwl_is_associated(priv)) { if (!iwl_is_any_associated(priv)) {
IWL_DEBUG_CALIB(priv, "<< - not associated\n"); IWL_DEBUG_CALIB(priv, "<< - not associated\n");
return; return;
} }
...@@ -763,6 +763,12 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) ...@@ -763,6 +763,12 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
unsigned long flags; unsigned long flags;
struct statistics_rx_non_phy *rx_info; struct statistics_rx_non_phy *rx_info;
u8 first_chain; u8 first_chain;
/*
* MULTI-FIXME:
* When we support multiple interfaces on different channels,
* this must be modified/fixed.
*/
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
if (priv->disable_chain_noise_cal) if (priv->disable_chain_noise_cal)
return; return;
...@@ -793,8 +799,8 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp) ...@@ -793,8 +799,8 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv, void *stat_resp)
return; return;
} }
rxon_band24 = !!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK); rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK);
rxon_chnum = le16_to_cpu(priv->staging_rxon.channel); rxon_chnum = le16_to_cpu(ctx->staging.channel);
if (priv->cfg->bt_statistics) { if (priv->cfg->bt_statistics) {
stat_band24 = !!(((struct iwl_bt_notif_statistics *) stat_band24 = !!(((struct iwl_bt_notif_statistics *)
stat_resp)->flag & stat_resp)->flag &
......
...@@ -37,12 +37,13 @@ ...@@ -37,12 +37,13 @@
#include "iwl-io.h" #include "iwl-io.h"
#include "iwl-agn.h" #include "iwl-agn.h"
int iwlagn_send_rxon_assoc(struct iwl_priv *priv) int iwlagn_send_rxon_assoc(struct iwl_priv *priv,
struct iwl_rxon_context *ctx)
{ {
int ret = 0; int ret = 0;
struct iwl5000_rxon_assoc_cmd rxon_assoc; struct iwl5000_rxon_assoc_cmd rxon_assoc;
const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; const struct iwl_rxon_cmd *rxon1 = &ctx->staging;
const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; const struct iwl_rxon_cmd *rxon2 = &ctx->active;
if ((rxon1->flags == rxon2->flags) && if ((rxon1->flags == rxon2->flags) &&
(rxon1->filter_flags == rxon2->filter_flags) && (rxon1->filter_flags == rxon2->filter_flags) &&
...@@ -60,21 +61,21 @@ int iwlagn_send_rxon_assoc(struct iwl_priv *priv) ...@@ -60,21 +61,21 @@ int iwlagn_send_rxon_assoc(struct iwl_priv *priv)
return 0; return 0;
} }
rxon_assoc.flags = priv->staging_rxon.flags; rxon_assoc.flags = ctx->staging.flags;
rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; rxon_assoc.filter_flags = ctx->staging.filter_flags;
rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates;
rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates;
rxon_assoc.reserved1 = 0; rxon_assoc.reserved1 = 0;
rxon_assoc.reserved2 = 0; rxon_assoc.reserved2 = 0;
rxon_assoc.reserved3 = 0; rxon_assoc.reserved3 = 0;
rxon_assoc.ofdm_ht_single_stream_basic_rates = rxon_assoc.ofdm_ht_single_stream_basic_rates =
priv->staging_rxon.ofdm_ht_single_stream_basic_rates; ctx->staging.ofdm_ht_single_stream_basic_rates;
rxon_assoc.ofdm_ht_dual_stream_basic_rates = rxon_assoc.ofdm_ht_dual_stream_basic_rates =
priv->staging_rxon.ofdm_ht_dual_stream_basic_rates; ctx->staging.ofdm_ht_dual_stream_basic_rates;
rxon_assoc.rx_chain_select_flags = priv->staging_rxon.rx_chain; rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain;
rxon_assoc.ofdm_ht_triple_stream_basic_rates = rxon_assoc.ofdm_ht_triple_stream_basic_rates =
priv->staging_rxon.ofdm_ht_triple_stream_basic_rates; ctx->staging.ofdm_ht_triple_stream_basic_rates;
rxon_assoc.acquisition_data = priv->staging_rxon.acquisition_data; rxon_assoc.acquisition_data = ctx->staging.acquisition_data;
ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC, ret = iwl_send_cmd_pdu_async(priv, REPLY_RXON_ASSOC,
sizeof(rxon_assoc), &rxon_assoc, NULL); sizeof(rxon_assoc), &rxon_assoc, NULL);
...@@ -184,7 +185,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv) ...@@ -184,7 +185,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)
int ret; int ret;
if ((data->state == IWL_CHAIN_NOISE_ALIVE) && if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
iwl_is_associated(priv)) { iwl_is_any_associated(priv)) {
struct iwl_calib_chain_noise_reset_cmd cmd; struct iwl_calib_chain_noise_reset_cmd cmd;
/* clear data for chain noise calibration algorithm */ /* clear data for chain noise calibration algorithm */
......
...@@ -1232,7 +1232,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -1232,7 +1232,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
scan->quiet_time = IWL_ACTIVE_QUIET_TIME; scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
if (iwl_is_associated(priv)) { if (iwl_is_any_associated(priv)) {
u16 interval = 0; u16 interval = 0;
u32 extra; u32 extra;
u32 suspend_time = 100; u32 suspend_time = 100;
...@@ -1289,7 +1289,9 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -1289,7 +1289,9 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
switch (priv->scan_band) { switch (priv->scan_band) {
case IEEE80211_BAND_2GHZ: case IEEE80211_BAND_2GHZ:
scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
chan_mod = le32_to_cpu(priv->active_rxon.flags & RXON_FLG_CHANNEL_MODE_MSK) chan_mod = le32_to_cpu(
priv->contexts[IWL_RXON_CTX_BSS].active.flags &
RXON_FLG_CHANNEL_MODE_MSK)
>> RXON_FLG_CHANNEL_MODE_POS; >> RXON_FLG_CHANNEL_MODE_POS;
if (chan_mod == CHANNEL_MODE_PURE_40) { if (chan_mod == CHANNEL_MODE_PURE_40) {
rate = IWL_RATE_6M_PLCP; rate = IWL_RATE_6M_PLCP;
......
...@@ -416,18 +416,26 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force) ...@@ -416,18 +416,26 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
/* stop ct_kill_waiting_tm timer */ /* stop ct_kill_waiting_tm timer */
del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm); del_timer_sync(&priv->thermal_throttle.ct_kill_waiting_tm);
if (changed) { if (changed) {
struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
if (tt->state >= IWL_TI_1) { if (tt->state >= IWL_TI_1) {
/* force PI = IWL_POWER_INDEX_5 in the case of TI > 0 */ /* force PI = IWL_POWER_INDEX_5 in the case of TI > 0 */
tt->tt_power_mode = IWL_POWER_INDEX_5; tt->tt_power_mode = IWL_POWER_INDEX_5;
if (!iwl_ht_enabled(priv))
if (!iwl_ht_enabled(priv)) {
struct iwl_rxon_context *ctx;
for_each_context(priv, ctx) {
struct iwl_rxon_cmd *rxon;
rxon = &ctx->staging;
/* disable HT */ /* disable HT */
rxon->flags &= ~(RXON_FLG_CHANNEL_MODE_MSK | rxon->flags &= ~(
RXON_FLG_CHANNEL_MODE_MSK |
RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK |
RXON_FLG_HT40_PROT_MSK | RXON_FLG_HT40_PROT_MSK |
RXON_FLG_HT_PROT_MSK); RXON_FLG_HT_PROT_MSK);
else { }
} else {
/* check HT capability and set /* check HT capability and set
* according to the system HT capability * according to the system HT capability
* in case get disabled before */ * in case get disabled before */
......
This diff is collapsed.
...@@ -224,7 +224,8 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv, ...@@ -224,7 +224,8 @@ int iwlagn_manage_ibss_station(struct iwl_priv *priv,
struct ieee80211_vif *vif, bool add); struct ieee80211_vif *vif, bool add);
/* hcmd */ /* hcmd */
int iwlagn_send_rxon_assoc(struct iwl_priv *priv); int iwlagn_send_rxon_assoc(struct iwl_priv *priv,
struct iwl_rxon_context *ctx);
int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant); int iwlagn_send_tx_ant_config(struct iwl_priv *priv, u8 valid_tx_ant);
/* bt coex */ /* bt coex */
......
This diff is collapsed.
...@@ -88,9 +88,10 @@ struct iwl_cmd; ...@@ -88,9 +88,10 @@ struct iwl_cmd;
#define IWL_CMD(x) case x: return #x #define IWL_CMD(x) case x: return #x
struct iwl_hcmd_ops { struct iwl_hcmd_ops {
int (*rxon_assoc)(struct iwl_priv *priv); int (*rxon_assoc)(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
int (*commit_rxon)(struct iwl_priv *priv); int (*commit_rxon)(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
void (*set_rxon_chain)(struct iwl_priv *priv); void (*set_rxon_chain)(struct iwl_priv *priv,
struct iwl_rxon_context *ctx);
int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant); int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant);
void (*send_bt_config)(struct iwl_priv *priv); void (*send_bt_config)(struct iwl_priv *priv);
}; };
...@@ -374,12 +375,15 @@ void iwl_activate_qos(struct iwl_priv *priv); ...@@ -374,12 +375,15 @@ void iwl_activate_qos(struct iwl_priv *priv);
int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
const struct ieee80211_tx_queue_params *params); const struct ieee80211_tx_queue_params *params);
int iwl_mac_tx_last_beacon(struct ieee80211_hw *hw); int iwl_mac_tx_last_beacon(struct ieee80211_hw *hw);
void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt); void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
int iwl_check_rxon_cmd(struct iwl_priv *priv); int hw_decrypt);
int iwl_full_rxon_required(struct iwl_priv *priv); int iwl_check_rxon_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
void iwl_set_rxon_chain(struct iwl_priv *priv); int iwl_full_rxon_required(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); void iwl_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch,
struct iwl_rxon_context *ctx);
void iwl_set_flags_for_band(struct iwl_priv *priv, void iwl_set_flags_for_band(struct iwl_priv *priv,
struct iwl_rxon_context *ctx,
enum ieee80211_band band, enum ieee80211_band band,
struct ieee80211_vif *vif); struct ieee80211_vif *vif);
u8 iwl_get_single_channel_number(struct iwl_priv *priv, u8 iwl_get_single_channel_number(struct iwl_priv *priv,
...@@ -400,7 +404,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw, ...@@ -400,7 +404,7 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *bss_conf, struct ieee80211_bss_conf *bss_conf,
u32 changes); u32 changes);
int iwl_commit_rxon(struct iwl_priv *priv); int iwl_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
int iwl_mac_add_interface(struct ieee80211_hw *hw, int iwl_mac_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif); struct ieee80211_vif *vif);
void iwl_mac_remove_interface(struct ieee80211_hw *hw, void iwl_mac_remove_interface(struct ieee80211_hw *hw,
...@@ -632,9 +636,11 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, ...@@ -632,9 +636,11 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv,
void iwl_dump_csr(struct iwl_priv *priv); void iwl_dump_csr(struct iwl_priv *priv);
int iwl_dump_fh(struct iwl_priv *priv, char **buf, bool display); int iwl_dump_fh(struct iwl_priv *priv, char **buf, bool display);
#ifdef CONFIG_IWLWIFI_DEBUG #ifdef CONFIG_IWLWIFI_DEBUG
void iwl_print_rx_config_cmd(struct iwl_priv *priv); void iwl_print_rx_config_cmd(struct iwl_priv *priv,
struct iwl_rxon_context *ctx);
#else #else
static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv) static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv,
struct iwl_rxon_context *ctx)
{ {
} }
#endif #endif
...@@ -720,13 +726,15 @@ void iwl_apm_stop(struct iwl_priv *priv); ...@@ -720,13 +726,15 @@ 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 ieee80211_vif *vif);
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)
{ {
return priv->cfg->ops->hcmd->rxon_assoc(priv); return priv->cfg->ops->hcmd->rxon_assoc(priv, ctx);
} }
static inline int iwlcore_commit_rxon(struct iwl_priv *priv) static inline int iwlcore_commit_rxon(struct iwl_priv *priv,
struct iwl_rxon_context *ctx)
{ {
return priv->cfg->ops->hcmd->commit_rxon(priv); return priv->cfg->ops->hcmd->commit_rxon(priv, ctx);
} }
static inline void iwlcore_config_ap(struct iwl_priv *priv, static inline void iwlcore_config_ap(struct iwl_priv *priv,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
......
...@@ -730,7 +730,7 @@ static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file, ...@@ -730,7 +730,7 @@ static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file,
return -EFAULT; return -EFAULT;
if (sscanf(buf, "%d", &ht40) != 1) if (sscanf(buf, "%d", &ht40) != 1)
return -EFAULT; return -EFAULT;
if (!iwl_is_associated(priv)) if (!iwl_is_any_associated(priv))
priv->disable_ht40 = ht40 ? true : false; priv->disable_ht40 = ht40 ? true : false;
else { else {
IWL_ERR(priv, "Sta associated with AP - " IWL_ERR(priv, "Sta associated with AP - "
...@@ -1319,7 +1319,8 @@ static ssize_t iwl_dbgfs_rxon_flags_read(struct file *file, ...@@ -1319,7 +1319,8 @@ static ssize_t iwl_dbgfs_rxon_flags_read(struct file *file,
int len = 0; int len = 0;
char buf[20]; char buf[20];
len = sprintf(buf, "0x%04X\n", le32_to_cpu(priv->active_rxon.flags)); len = sprintf(buf, "0x%04X\n",
le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.flags));
return simple_read_from_buffer(user_buf, count, ppos, buf, len); return simple_read_from_buffer(user_buf, count, ppos, buf, len);
} }
...@@ -1332,7 +1333,7 @@ static ssize_t iwl_dbgfs_rxon_filter_flags_read(struct file *file, ...@@ -1332,7 +1333,7 @@ static ssize_t iwl_dbgfs_rxon_filter_flags_read(struct file *file,
char buf[20]; char buf[20];
len = sprintf(buf, "0x%04X\n", len = sprintf(buf, "0x%04X\n",
le32_to_cpu(priv->active_rxon.filter_flags)); le32_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags));
return simple_read_from_buffer(user_buf, count, ppos, buf, len); return simple_read_from_buffer(user_buf, count, ppos, buf, len);
} }
......
...@@ -519,6 +519,7 @@ struct iwl_station_priv { ...@@ -519,6 +519,7 @@ struct iwl_station_priv {
* space for us to put data into. * space for us to put data into.
*/ */
struct iwl_vif_priv { struct iwl_vif_priv {
struct iwl_rxon_context *ctx;
u8 ibss_bssid_sta_id; u8 ibss_bssid_sta_id;
}; };
...@@ -1097,6 +1098,26 @@ struct iwl_force_reset { ...@@ -1097,6 +1098,26 @@ struct iwl_force_reset {
*/ */
#define IWLAGN_EXT_BEACON_TIME_POS 22 #define IWLAGN_EXT_BEACON_TIME_POS 22
enum iwl_rxon_context_id {
IWL_RXON_CTX_BSS,
NUM_IWL_RXON_CTX
};
struct iwl_rxon_context {
enum iwl_rxon_context_id ctxid;
/*
* We declare this const so it can only be
* changed via explicit cast within the
* routines that actually update the physical
* hardware.
*/
const struct iwl_rxon_cmd active;
struct iwl_rxon_cmd staging;
struct iwl_rxon_time_cmd timing;
};
struct iwl_priv { struct iwl_priv {
/* ieee device used by generic ieee processing code */ /* ieee device used by generic ieee processing code */
...@@ -1173,6 +1194,9 @@ struct iwl_priv { ...@@ -1173,6 +1194,9 @@ struct iwl_priv {
u32 hw_wa_rev; u32 hw_wa_rev;
u8 rev_id; u8 rev_id;
/* microcode/device supports multiple contexts */
u8 valid_contexts;
/* EEPROM MAC addresses */ /* EEPROM MAC addresses */
struct mac_address addresses[2]; struct mac_address addresses[2];
...@@ -1190,15 +1214,7 @@ struct iwl_priv { ...@@ -1190,15 +1214,7 @@ struct iwl_priv {
u8 ucode_write_complete; /* the image write is complete */ u8 ucode_write_complete; /* the image write is complete */
char firmware_name[25]; char firmware_name[25];
struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
struct iwl_rxon_time_cmd rxon_timing;
/* We declare this const so it can only be
* changed via explicit cast within the
* routines that actually update the physical
* hardware */
const struct iwl_rxon_cmd active_rxon;
struct iwl_rxon_cmd staging_rxon;
struct iwl_switch_rxon switch_rxon; struct iwl_switch_rxon switch_rxon;
...@@ -1490,10 +1506,34 @@ static inline struct ieee80211_hdr *iwl_tx_queue_get_hdr(struct iwl_priv *priv, ...@@ -1490,10 +1506,34 @@ static inline struct ieee80211_hdr *iwl_tx_queue_get_hdr(struct iwl_priv *priv,
return NULL; return NULL;
} }
static inline struct iwl_rxon_context *
iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif)
{
struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
return vif_priv->ctx;
}
#define for_each_context(priv, ctx) \
for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \
ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \
if (priv->valid_contexts & BIT(ctx->ctxid))
static inline int iwl_is_associated(struct iwl_priv *priv,
enum iwl_rxon_context_id ctxid)
{
return (priv->contexts[ctxid].active.filter_flags &
RXON_FILTER_ASSOC_MSK) ? 1 : 0;
}
static inline int iwl_is_any_associated(struct iwl_priv *priv)
{
return iwl_is_associated(priv, IWL_RXON_CTX_BSS);
}
static inline int iwl_is_associated(struct iwl_priv *priv) static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx)
{ {
return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
} }
static inline int is_channel_valid(const struct iwl_channel_info *ch_info) static inline int is_channel_valid(const struct iwl_channel_info *ch_info)
......
...@@ -228,7 +228,7 @@ void iwl_recover_from_statistics(struct iwl_priv *priv, ...@@ -228,7 +228,7 @@ void iwl_recover_from_statistics(struct iwl_priv *priv,
{ {
if (test_bit(STATUS_EXIT_PENDING, &priv->status)) if (test_bit(STATUS_EXIT_PENDING, &priv->status))
return; return;
if (iwl_is_associated(priv)) { if (iwl_is_any_associated(priv)) {
if (priv->cfg->ops->lib->check_ack_health) { if (priv->cfg->ops->lib->check_ack_health) {
if (!priv->cfg->ops->lib->check_ack_health( if (!priv->cfg->ops->lib->check_ack_health(
priv, pkt)) { priv, pkt)) {
...@@ -266,7 +266,12 @@ int iwl_set_decrypted_flag(struct iwl_priv *priv, ...@@ -266,7 +266,12 @@ int iwl_set_decrypted_flag(struct iwl_priv *priv,
{ {
u16 fc = le16_to_cpu(hdr->frame_control); u16 fc = le16_to_cpu(hdr->frame_control);
if (priv->active_rxon.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK) /*
* All contexts have the same setting here due to it being
* a module parameter, so OK to check any context.
*/
if (priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags &
RXON_FILTER_DIS_DECRYPT_MSK)
return 0; return 0;
if (!(fc & IEEE80211_FCTL_PROTECTED)) if (!(fc & IEEE80211_FCTL_PROTECTED))
......
...@@ -290,7 +290,8 @@ u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, ...@@ -290,7 +290,8 @@ u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 :
IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52;
if (iwl_is_associated(priv)) { if (iwl_is_any_associated(priv)) {
/* TODO: should use minimum of all contexts */
/* If we're associated, we clamp the maximum passive /* If we're associated, we clamp the maximum passive
* dwell time to be 98% of the beacon interval (minus * dwell time to be 98% of the beacon interval (minus
* 2 * channel tune time) */ * 2 * channel tune time) */
...@@ -527,6 +528,7 @@ static void iwl_bg_scan_completed(struct work_struct *work) ...@@ -527,6 +528,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
container_of(work, struct iwl_priv, scan_completed); container_of(work, struct iwl_priv, scan_completed);
bool internal = false; bool internal = false;
bool scan_completed = false; bool scan_completed = false;
struct iwl_rxon_context *ctx;
IWL_DEBUG_SCAN(priv, "SCAN complete scan\n"); IWL_DEBUG_SCAN(priv, "SCAN complete scan\n");
...@@ -557,9 +559,8 @@ static void iwl_bg_scan_completed(struct work_struct *work) ...@@ -557,9 +559,8 @@ static void iwl_bg_scan_completed(struct work_struct *work)
* Since setting the RXON may have been deferred while * Since setting the RXON may have been deferred while
* performing the scan, fire one off if needed * performing the scan, fire one off if needed
*/ */
if (memcmp(&priv->active_rxon, for_each_context(priv, ctx)
&priv->staging_rxon, sizeof(priv->staging_rxon))) iwlcore_commit_rxon(priv, ctx);
iwlcore_commit_rxon(priv);
out: out:
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
......
...@@ -1153,12 +1153,16 @@ static bool is_lq_table_valid(struct iwl_priv *priv, ...@@ -1153,12 +1153,16 @@ static bool is_lq_table_valid(struct iwl_priv *priv,
{ {
int i; int i;
struct iwl_ht_config *ht_conf = &priv->current_ht_config; struct iwl_ht_config *ht_conf = &priv->current_ht_config;
#if !TODO
struct iwl_rxon_context *ctx =
&priv->contexts[IWL_RXON_CTX_BSS];
#endif
if (ht_conf->is_ht) if (ht_conf->is_ht)
return true; return true;
IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n", IWL_DEBUG_INFO(priv, "Channel %u is not an HT channel\n",
priv->active_rxon.channel); ctx->active.channel);
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) { if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) {
IWL_DEBUG_INFO(priv, IWL_DEBUG_INFO(priv,
......
This diff is collapsed.
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