aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlegacy/common.c')
-rw-r--r--drivers/net/wireless/iwlegacy/common.c157
1 files changed, 77 insertions, 80 deletions
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 36454d0bbeed..2b5622695cc7 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -2361,7 +2361,7 @@ il_is_lq_table_valid(struct il_priv *il, struct il_rxon_context *ctx,
2361 if (ctx->ht.enabled) 2361 if (ctx->ht.enabled)
2362 return true; 2362 return true;
2363 2363
2364 D_INFO("Channel %u is not an HT channel\n", ctx->active.channel); 2364 D_INFO("Channel %u is not an HT channel\n", il->active.channel);
2365 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { 2365 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
2366 if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) { 2366 if (le32_to_cpu(lq->rs_table[i].rate_n_flags) & RATE_MCS_HT_MSK) {
2367 D_INFO("idx %d of LQ expects HT channel\n", i); 2367 D_INFO("idx %d of LQ expects HT channel\n", i);
@@ -2648,7 +2648,7 @@ il_set_decrypted_flag(struct il_priv *il, struct ieee80211_hdr *hdr,
2648 * All contexts have the same setting here due to it being 2648 * All contexts have the same setting here due to it being
2649 * a module parameter, so OK to check any context. 2649 * a module parameter, so OK to check any context.
2650 */ 2650 */
2651 if (il->ctx.active.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK) 2651 if (il->active.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK)
2652 return 0; 2652 return 0;
2653 2653
2654 if (!(fc & IEEE80211_FCTL_PROTECTED)) 2654 if (!(fc & IEEE80211_FCTL_PROTECTED))
@@ -3581,7 +3581,7 @@ il_is_ht40_tx_allowed(struct il_priv *il, struct il_rxon_context *ctx,
3581#endif 3581#endif
3582 3582
3583 return il_is_channel_extension(il, il->band, 3583 return il_is_channel_extension(il, il->band,
3584 le16_to_cpu(ctx->staging.channel), 3584 le16_to_cpu(il->staging.channel),
3585 ctx->ht.extension_chan_offset); 3585 ctx->ht.extension_chan_offset);
3586} 3586}
3587EXPORT_SYMBOL(il_is_ht40_tx_allowed); 3587EXPORT_SYMBOL(il_is_ht40_tx_allowed);
@@ -3633,10 +3633,10 @@ il_send_rxon_timing(struct il_priv *il, struct il_rxon_context *ctx)
3633 3633
3634 lockdep_assert_held(&il->mutex); 3634 lockdep_assert_held(&il->mutex);
3635 3635
3636 memset(&ctx->timing, 0, sizeof(struct il_rxon_time_cmd)); 3636 memset(&il->timing, 0, sizeof(struct il_rxon_time_cmd));
3637 3637
3638 ctx->timing.timestamp = cpu_to_le64(il->timestamp); 3638 il->timing.timestamp = cpu_to_le64(il->timestamp);
3639 ctx->timing.listen_interval = cpu_to_le16(conf->listen_interval); 3639 il->timing.listen_interval = cpu_to_le16(conf->listen_interval);
3640 3640
3641 beacon_int = vif ? vif->bss_conf.beacon_int : 0; 3641 beacon_int = vif ? vif->bss_conf.beacon_int : 0;
3642 3642
@@ -3644,28 +3644,28 @@ il_send_rxon_timing(struct il_priv *il, struct il_rxon_context *ctx)
3644 * TODO: For IBSS we need to get atim_win from mac80211, 3644 * TODO: For IBSS we need to get atim_win from mac80211,
3645 * for now just always use 0 3645 * for now just always use 0
3646 */ 3646 */
3647 ctx->timing.atim_win = 0; 3647 il->timing.atim_win = 0;
3648 3648
3649 beacon_int = 3649 beacon_int =
3650 il_adjust_beacon_interval(beacon_int, 3650 il_adjust_beacon_interval(beacon_int,
3651 il->hw_params.max_beacon_itrvl * 3651 il->hw_params.max_beacon_itrvl *
3652 TIME_UNIT); 3652 TIME_UNIT);
3653 ctx->timing.beacon_interval = cpu_to_le16(beacon_int); 3653 il->timing.beacon_interval = cpu_to_le16(beacon_int);
3654 3654
3655 tsf = il->timestamp; /* tsf is modifed by do_div: copy it */ 3655 tsf = il->timestamp; /* tsf is modifed by do_div: copy it */
3656 interval_tm = beacon_int * TIME_UNIT; 3656 interval_tm = beacon_int * TIME_UNIT;
3657 rem = do_div(tsf, interval_tm); 3657 rem = do_div(tsf, interval_tm);
3658 ctx->timing.beacon_init_val = cpu_to_le32(interval_tm - rem); 3658 il->timing.beacon_init_val = cpu_to_le32(interval_tm - rem);
3659 3659
3660 ctx->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ? : 1) : 1; 3660 il->timing.dtim_period = vif ? (vif->bss_conf.dtim_period ? : 1) : 1;
3661 3661
3662 D_ASSOC("beacon interval %d beacon timer %d beacon tim %d\n", 3662 D_ASSOC("beacon interval %d beacon timer %d beacon tim %d\n",
3663 le16_to_cpu(ctx->timing.beacon_interval), 3663 le16_to_cpu(il->timing.beacon_interval),
3664 le32_to_cpu(ctx->timing.beacon_init_val), 3664 le32_to_cpu(il->timing.beacon_init_val),
3665 le16_to_cpu(ctx->timing.atim_win)); 3665 le16_to_cpu(il->timing.atim_win));
3666 3666
3667 return il_send_cmd_pdu(il, ctx->rxon_timing_cmd, sizeof(ctx->timing), 3667 return il_send_cmd_pdu(il, il->ctx.rxon_timing_cmd, sizeof(il->timing),
3668 &ctx->timing); 3668 &il->timing);
3669} 3669}
3670EXPORT_SYMBOL(il_send_rxon_timing); 3670EXPORT_SYMBOL(il_send_rxon_timing);
3671 3671
@@ -3673,7 +3673,7 @@ void
3673il_set_rxon_hwcrypto(struct il_priv *il, struct il_rxon_context *ctx, 3673il_set_rxon_hwcrypto(struct il_priv *il, struct il_rxon_context *ctx,
3674 int hw_decrypt) 3674 int hw_decrypt)
3675{ 3675{
3676 struct il_rxon_cmd *rxon = &ctx->staging; 3676 struct il_rxon_cmd *rxon = &il->staging;
3677 3677
3678 if (hw_decrypt) 3678 if (hw_decrypt)
3679 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK; 3679 rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
@@ -3687,7 +3687,7 @@ EXPORT_SYMBOL(il_set_rxon_hwcrypto);
3687int 3687int
3688il_check_rxon_cmd(struct il_priv *il, struct il_rxon_context *ctx) 3688il_check_rxon_cmd(struct il_priv *il, struct il_rxon_context *ctx)
3689{ 3689{
3690 struct il_rxon_cmd *rxon = &ctx->staging; 3690 struct il_rxon_cmd *rxon = &il->staging;
3691 bool error = false; 3691 bool error = false;
3692 3692
3693 if (rxon->flags & RXON_FLG_BAND_24G_MSK) { 3693 if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
@@ -3767,8 +3767,8 @@ EXPORT_SYMBOL(il_check_rxon_cmd);
3767int 3767int
3768il_full_rxon_required(struct il_priv *il, struct il_rxon_context *ctx) 3768il_full_rxon_required(struct il_priv *il, struct il_rxon_context *ctx)
3769{ 3769{
3770 const struct il_rxon_cmd *staging = &ctx->staging; 3770 const struct il_rxon_cmd *staging = &il->staging;
3771 const struct il_rxon_cmd *active = &ctx->active; 3771 const struct il_rxon_cmd *active = &il->active;
3772 3772
3773#define CHK(cond) \ 3773#define CHK(cond) \
3774 if ((cond)) { \ 3774 if ((cond)) { \
@@ -3785,7 +3785,7 @@ il_full_rxon_required(struct il_priv *il, struct il_rxon_context *ctx)
3785 } 3785 }
3786 3786
3787 /* These items are only settable from the full RXON command */ 3787 /* These items are only settable from the full RXON command */
3788 CHK(!il_is_associated_ctx(ctx)); 3788 CHK(!il_is_associated(il));
3789 CHK(compare_ether_addr(staging->bssid_addr, active->bssid_addr)); 3789 CHK(compare_ether_addr(staging->bssid_addr, active->bssid_addr));
3790 CHK(compare_ether_addr(staging->node_addr, active->node_addr)); 3790 CHK(compare_ether_addr(staging->node_addr, active->node_addr));
3791 CHK(compare_ether_addr 3791 CHK(compare_ether_addr
@@ -3825,7 +3825,7 @@ il_get_lowest_plcp(struct il_priv *il, struct il_rxon_context *ctx)
3825 * Assign the lowest rate -- should really get this from 3825 * Assign the lowest rate -- should really get this from
3826 * the beacon skb from mac80211. 3826 * the beacon skb from mac80211.
3827 */ 3827 */
3828 if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) 3828 if (il->staging.flags & RXON_FLG_BAND_24G_MSK)
3829 return RATE_1M_PLCP; 3829 return RATE_1M_PLCP;
3830 else 3830 else
3831 return RATE_6M_PLCP; 3831 return RATE_6M_PLCP;
@@ -3836,7 +3836,7 @@ static void
3836_il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf, 3836_il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf,
3837 struct il_rxon_context *ctx) 3837 struct il_rxon_context *ctx)
3838{ 3838{
3839 struct il_rxon_cmd *rxon = &ctx->staging; 3839 struct il_rxon_cmd *rxon = &il->staging;
3840 3840
3841 if (!ctx->ht.enabled) { 3841 if (!ctx->ht.enabled) {
3842 rxon->flags &= 3842 rxon->flags &=
@@ -3925,7 +3925,7 @@ il_get_single_channel_number(struct il_priv *il, enum ieee80211_band band)
3925 3925
3926 for (i = min; i < max; i++) { 3926 for (i = min; i < max; i++) {
3927 channel = il->channel_info[i].channel; 3927 channel = il->channel_info[i].channel;
3928 if (channel == le16_to_cpu(il->ctx.staging.channel)) 3928 if (channel == le16_to_cpu(il->staging.channel))
3929 continue; 3929 continue;
3930 3930
3931 ch_info = il_get_channel_info(il, band, channel); 3931 ch_info = il_get_channel_info(il, band, channel);
@@ -3951,14 +3951,14 @@ il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch,
3951 enum ieee80211_band band = ch->band; 3951 enum ieee80211_band band = ch->band;
3952 u16 channel = ch->hw_value; 3952 u16 channel = ch->hw_value;
3953 3953
3954 if (le16_to_cpu(ctx->staging.channel) == channel && il->band == band) 3954 if (le16_to_cpu(il->staging.channel) == channel && il->band == band)
3955 return 0; 3955 return 0;
3956 3956
3957 ctx->staging.channel = cpu_to_le16(channel); 3957 il->staging.channel = cpu_to_le16(channel);
3958 if (band == IEEE80211_BAND_5GHZ) 3958 if (band == IEEE80211_BAND_5GHZ)
3959 ctx->staging.flags &= ~RXON_FLG_BAND_24G_MSK; 3959 il->staging.flags &= ~RXON_FLG_BAND_24G_MSK;
3960 else 3960 else
3961 ctx->staging.flags |= RXON_FLG_BAND_24G_MSK; 3961 il->staging.flags |= RXON_FLG_BAND_24G_MSK;
3962 3962
3963 il->band = band; 3963 il->band = band;
3964 3964
@@ -3973,20 +3973,20 @@ il_set_flags_for_band(struct il_priv *il, struct il_rxon_context *ctx,
3973 enum ieee80211_band band, struct ieee80211_vif *vif) 3973 enum ieee80211_band band, struct ieee80211_vif *vif)
3974{ 3974{
3975 if (band == IEEE80211_BAND_5GHZ) { 3975 if (band == IEEE80211_BAND_5GHZ) {
3976 ctx->staging.flags &= 3976 il->staging.flags &=
3977 ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | 3977 ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK |
3978 RXON_FLG_CCK_MSK); 3978 RXON_FLG_CCK_MSK);
3979 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 3979 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
3980 } else { 3980 } else {
3981 /* Copied from il_post_associate() */ 3981 /* Copied from il_post_associate() */
3982 if (vif && vif->bss_conf.use_short_slot) 3982 if (vif && vif->bss_conf.use_short_slot)
3983 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 3983 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
3984 else 3984 else
3985 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 3985 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
3986 3986
3987 ctx->staging.flags |= RXON_FLG_BAND_24G_MSK; 3987 il->staging.flags |= RXON_FLG_BAND_24G_MSK;
3988 ctx->staging.flags |= RXON_FLG_AUTO_DETECT_MSK; 3988 il->staging.flags |= RXON_FLG_AUTO_DETECT_MSK;
3989 ctx->staging.flags &= ~RXON_FLG_CCK_MSK; 3989 il->staging.flags &= ~RXON_FLG_CCK_MSK;
3990 } 3990 }
3991} 3991}
3992EXPORT_SYMBOL(il_set_flags_for_band); 3992EXPORT_SYMBOL(il_set_flags_for_band);
@@ -3999,22 +3999,22 @@ il_connection_init_rx_config(struct il_priv *il, struct il_rxon_context *ctx)
3999{ 3999{
4000 const struct il_channel_info *ch_info; 4000 const struct il_channel_info *ch_info;
4001 4001
4002 memset(&ctx->staging, 0, sizeof(ctx->staging)); 4002 memset(&il->staging, 0, sizeof(il->staging));
4003 4003
4004 if (!ctx->vif) { 4004 if (!ctx->vif) {
4005 ctx->staging.dev_type = ctx->unused_devtype; 4005 il->staging.dev_type = ctx->unused_devtype;
4006 } else 4006 } else
4007 switch (ctx->vif->type) { 4007 switch (ctx->vif->type) {
4008 4008
4009 case NL80211_IFTYPE_STATION: 4009 case NL80211_IFTYPE_STATION:
4010 ctx->staging.dev_type = ctx->station_devtype; 4010 il->staging.dev_type = ctx->station_devtype;
4011 ctx->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; 4011 il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
4012 break; 4012 break;
4013 4013
4014 case NL80211_IFTYPE_ADHOC: 4014 case NL80211_IFTYPE_ADHOC:
4015 ctx->staging.dev_type = ctx->ibss_devtype; 4015 il->staging.dev_type = ctx->ibss_devtype;
4016 ctx->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; 4016 il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
4017 ctx->staging.filter_flags = 4017 il->staging.filter_flags =
4018 RXON_FILTER_BCON_AWARE_MSK | 4018 RXON_FILTER_BCON_AWARE_MSK |
4019 RXON_FILTER_ACCEPT_GRP_MSK; 4019 RXON_FILTER_ACCEPT_GRP_MSK;
4020 break; 4020 break;
@@ -4029,35 +4029,35 @@ il_connection_init_rx_config(struct il_priv *il, struct il_rxon_context *ctx)
4029 /* TODO: Figure out when short_preamble would be set and cache from 4029 /* TODO: Figure out when short_preamble would be set and cache from
4030 * that */ 4030 * that */
4031 if (!hw_to_local(il->hw)->short_preamble) 4031 if (!hw_to_local(il->hw)->short_preamble)
4032 ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 4032 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
4033 else 4033 else
4034 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 4034 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
4035#endif 4035#endif
4036 4036
4037 ch_info = 4037 ch_info =
4038 il_get_channel_info(il, il->band, le16_to_cpu(ctx->active.channel)); 4038 il_get_channel_info(il, il->band, le16_to_cpu(il->active.channel));
4039 4039
4040 if (!ch_info) 4040 if (!ch_info)
4041 ch_info = &il->channel_info[0]; 4041 ch_info = &il->channel_info[0];
4042 4042
4043 ctx->staging.channel = cpu_to_le16(ch_info->channel); 4043 il->staging.channel = cpu_to_le16(ch_info->channel);
4044 il->band = ch_info->band; 4044 il->band = ch_info->band;
4045 4045
4046 il_set_flags_for_band(il, ctx, il->band, ctx->vif); 4046 il_set_flags_for_band(il, ctx, il->band, ctx->vif);
4047 4047
4048 ctx->staging.ofdm_basic_rates = 4048 il->staging.ofdm_basic_rates =
4049 (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; 4049 (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF;
4050 ctx->staging.cck_basic_rates = 4050 il->staging.cck_basic_rates =
4051 (IL_CCK_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; 4051 (IL_CCK_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF;
4052 4052
4053 /* clear both MIX and PURE40 mode flag */ 4053 /* clear both MIX and PURE40 mode flag */
4054 ctx->staging.flags &= 4054 il->staging.flags &=
4055 ~(RXON_FLG_CHANNEL_MODE_MIXED | RXON_FLG_CHANNEL_MODE_PURE_40); 4055 ~(RXON_FLG_CHANNEL_MODE_MIXED | RXON_FLG_CHANNEL_MODE_PURE_40);
4056 if (ctx->vif) 4056 if (ctx->vif)
4057 memcpy(ctx->staging.node_addr, ctx->vif->addr, ETH_ALEN); 4057 memcpy(il->staging.node_addr, ctx->vif->addr, ETH_ALEN);
4058 4058
4059 ctx->staging.ofdm_ht_single_stream_basic_rates = 0xff; 4059 il->staging.ofdm_ht_single_stream_basic_rates = 0xff;
4060 ctx->staging.ofdm_ht_dual_stream_basic_rates = 0xff; 4060 il->staging.ofdm_ht_dual_stream_basic_rates = 0xff;
4061} 4061}
4062EXPORT_SYMBOL(il_connection_init_rx_config); 4062EXPORT_SYMBOL(il_connection_init_rx_config);
4063 4063
@@ -4084,10 +4084,10 @@ il_set_rate(struct il_priv *il)
4084 4084
4085 D_RATE("Set active_rate = %0x\n", il->active_rate); 4085 D_RATE("Set active_rate = %0x\n", il->active_rate);
4086 4086
4087 il->ctx.staging.cck_basic_rates = 4087 il->staging.cck_basic_rates =
4088 (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; 4088 (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF;
4089 4089
4090 il->ctx.staging.ofdm_basic_rates = 4090 il->staging.ofdm_basic_rates =
4091 (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; 4091 (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF;
4092} 4092}
4093EXPORT_SYMBOL(il_set_rate); 4093EXPORT_SYMBOL(il_set_rate);
@@ -4110,16 +4110,14 @@ il_hdl_csa(struct il_priv *il, struct il_rx_buf *rxb)
4110{ 4110{
4111 struct il_rx_pkt *pkt = rxb_addr(rxb); 4111 struct il_rx_pkt *pkt = rxb_addr(rxb);
4112 struct il_csa_notification *csa = &(pkt->u.csa_notif); 4112 struct il_csa_notification *csa = &(pkt->u.csa_notif);
4113 4113 struct il_rxon_cmd *rxon = (void *)&il->active;
4114 struct il_rxon_context *ctx = &il->ctx;
4115 struct il_rxon_cmd *rxon = (void *)&ctx->active;
4116 4114
4117 if (!test_bit(S_CHANNEL_SWITCH_PENDING, &il->status)) 4115 if (!test_bit(S_CHANNEL_SWITCH_PENDING, &il->status))
4118 return; 4116 return;
4119 4117
4120 if (!le32_to_cpu(csa->status) && csa->channel == il->switch_channel) { 4118 if (!le32_to_cpu(csa->status) && csa->channel == il->switch_channel) {
4121 rxon->channel = csa->channel; 4119 rxon->channel = csa->channel;
4122 ctx->staging.channel = csa->channel; 4120 il->staging.channel = csa->channel;
4123 D_11H("CSA notif: channel %d\n", le16_to_cpu(csa->channel)); 4121 D_11H("CSA notif: channel %d\n", le16_to_cpu(csa->channel));
4124 il_chswitch_done(il, true); 4122 il_chswitch_done(il, true);
4125 } else { 4123 } else {
@@ -4134,7 +4132,7 @@ EXPORT_SYMBOL(il_hdl_csa);
4134void 4132void
4135il_print_rx_config_cmd(struct il_priv *il, struct il_rxon_context *ctx) 4133il_print_rx_config_cmd(struct il_priv *il, struct il_rxon_context *ctx)
4136{ 4134{
4137 struct il_rxon_cmd *rxon = &ctx->staging; 4135 struct il_rxon_cmd *rxon = &il->staging;
4138 4136
4139 D_RADIO("RX CONFIG:\n"); 4137 D_RADIO("RX CONFIG:\n");
4140 il_print_hex_dump(il, IL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); 4138 il_print_hex_dump(il, IL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
@@ -4347,7 +4345,6 @@ il_set_tx_power(struct il_priv *il, s8 tx_power, bool force)
4347 int ret; 4345 int ret;
4348 s8 prev_tx_power; 4346 s8 prev_tx_power;
4349 bool defer; 4347 bool defer;
4350 struct il_rxon_context *ctx = &il->ctx;
4351 4348
4352 lockdep_assert_held(&il->mutex); 4349 lockdep_assert_held(&il->mutex);
4353 4350
@@ -4378,7 +4375,7 @@ il_set_tx_power(struct il_priv *il, s8 tx_power, bool force)
4378 4375
4379 /* do not set tx power when scanning or channel changing */ 4376 /* do not set tx power when scanning or channel changing */
4380 defer = test_bit(S_SCANNING, &il->status) || 4377 defer = test_bit(S_SCANNING, &il->status) ||
4381 memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)); 4378 memcmp(&il->active, &il->staging, sizeof(il->staging));
4382 if (defer && !force) { 4379 if (defer && !force) {
4383 D_INFO("Deferring tx power set\n"); 4380 D_INFO("Deferring tx power set\n");
4384 return 0; 4381 return 0;
@@ -5379,8 +5376,8 @@ il_mac_config(struct ieee80211_hw *hw, u32 changed)
5379 /* if we are switching from ht to 2.4 clear flags 5376 /* if we are switching from ht to 2.4 clear flags
5380 * from any ht related info since 2.4 does not 5377 * from any ht related info since 2.4 does not
5381 * support ht */ 5378 * support ht */
5382 if ((le16_to_cpu(ctx->staging.channel) != ch)) 5379 if ((le16_to_cpu(il->staging.channel) != ch))
5383 ctx->staging.flags = 0; 5380 il->staging.flags = 0;
5384 5381
5385 il_set_rxon_channel(il, channel, ctx); 5382 il_set_rxon_channel(il, channel, ctx);
5386 il_set_rxon_ht(il, ht_conf); 5383 il_set_rxon_ht(il, ht_conf);
@@ -5420,7 +5417,7 @@ set_ch_out:
5420 if (scan_active) 5417 if (scan_active)
5421 goto out; 5418 goto out;
5422 5419
5423 if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging))) 5420 if (memcmp(&il->active, &il->staging, sizeof(il->staging)))
5424 il_commit_rxon(il, ctx); 5421 il_commit_rxon(il, ctx);
5425 else 5422 else
5426 D_INFO("Not re-sending same RXON configuration.\n"); 5423 D_INFO("Not re-sending same RXON configuration.\n");
@@ -5473,7 +5470,7 @@ il_mac_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
5473 /* we are restarting association process 5470 /* we are restarting association process
5474 * clear RXON_FILTER_ASSOC_MSK bit 5471 * clear RXON_FILTER_ASSOC_MSK bit
5475 */ 5472 */
5476 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 5473 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5477 il_commit_rxon(il, ctx); 5474 il_commit_rxon(il, ctx);
5478 5475
5479 il_set_rate(il); 5476 il_set_rate(il);
@@ -5555,8 +5552,8 @@ il_set_no_assoc(struct il_priv *il, struct ieee80211_vif *vif)
5555 * association and that no more packets should be 5552 * association and that no more packets should be
5556 * sent 5553 * sent
5557 */ 5554 */
5558 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 5555 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5559 ctx->staging.assoc_id = 0; 5556 il->staging.assoc_id = 0;
5560 il_commit_rxon(il, ctx); 5557 il_commit_rxon(il, ctx);
5561} 5558}
5562 5559
@@ -5660,13 +5657,13 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5660 5657
5661 /* mac80211 only sets assoc when in STATION mode */ 5658 /* mac80211 only sets assoc when in STATION mode */
5662 if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) { 5659 if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) {
5663 memcpy(ctx->staging.bssid_addr, bss_conf->bssid, 5660 memcpy(il->staging.bssid_addr, bss_conf->bssid,
5664 ETH_ALEN); 5661 ETH_ALEN);
5665 5662
5666 /* currently needed in a few places */ 5663 /* currently needed in a few places */
5667 memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); 5664 memcpy(il->bssid, bss_conf->bssid, ETH_ALEN);
5668 } else { 5665 } else {
5669 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 5666 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5670 } 5667 }
5671 5668
5672 } 5669 }
@@ -5682,21 +5679,21 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5682 if (changes & BSS_CHANGED_ERP_PREAMBLE) { 5679 if (changes & BSS_CHANGED_ERP_PREAMBLE) {
5683 D_MAC80211("ERP_PREAMBLE %d\n", bss_conf->use_short_preamble); 5680 D_MAC80211("ERP_PREAMBLE %d\n", bss_conf->use_short_preamble);
5684 if (bss_conf->use_short_preamble) 5681 if (bss_conf->use_short_preamble)
5685 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 5682 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
5686 else 5683 else
5687 ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 5684 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
5688 } 5685 }
5689 5686
5690 if (changes & BSS_CHANGED_ERP_CTS_PROT) { 5687 if (changes & BSS_CHANGED_ERP_CTS_PROT) {
5691 D_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot); 5688 D_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot);
5692 if (bss_conf->use_cts_prot && il->band != IEEE80211_BAND_5GHZ) 5689 if (bss_conf->use_cts_prot && il->band != IEEE80211_BAND_5GHZ)
5693 ctx->staging.flags |= RXON_FLG_TGG_PROTECT_MSK; 5690 il->staging.flags |= RXON_FLG_TGG_PROTECT_MSK;
5694 else 5691 else
5695 ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; 5692 il->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK;
5696 if (bss_conf->use_cts_prot) 5693 if (bss_conf->use_cts_prot)
5697 ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; 5694 il->staging.flags |= RXON_FLG_SELF_CTS_EN;
5698 else 5695 else
5699 ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN; 5696 il->staging.flags &= ~RXON_FLG_SELF_CTS_EN;
5700 } 5697 }
5701 5698
5702 if (changes & BSS_CHANGED_BASIC_RATES) { 5699 if (changes & BSS_CHANGED_BASIC_RATES) {
@@ -5706,12 +5703,12 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5706 * like this here: 5703 * like this here:
5707 * 5704 *
5708 if (A-band) 5705 if (A-band)
5709 ctx->staging.ofdm_basic_rates = 5706 il->staging.ofdm_basic_rates =
5710 bss_conf->basic_rates; 5707 bss_conf->basic_rates;
5711 else 5708 else
5712 ctx->staging.ofdm_basic_rates = 5709 il->staging.ofdm_basic_rates =
5713 bss_conf->basic_rates >> 4; 5710 bss_conf->basic_rates >> 4;
5714 ctx->staging.cck_basic_rates = 5711 il->staging.cck_basic_rates =
5715 bss_conf->basic_rates & 0xF; 5712 bss_conf->basic_rates & 0xF;
5716 */ 5713 */
5717 } 5714 }
@@ -5734,19 +5731,19 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5734 il_set_no_assoc(il, vif); 5731 il_set_no_assoc(il, vif);
5735 } 5732 }
5736 5733
5737 if (changes && il_is_associated_ctx(ctx) && bss_conf->aid) { 5734 if (changes && il_is_associated(il) && bss_conf->aid) {
5738 D_MAC80211("Changes (%#x) while associated\n", changes); 5735 D_MAC80211("Changes (%#x) while associated\n", changes);
5739 ret = il_send_rxon_assoc(il, ctx); 5736 ret = il_send_rxon_assoc(il, ctx);
5740 if (!ret) { 5737 if (!ret) {
5741 /* Sync active_rxon with latest change. */ 5738 /* Sync active_rxon with latest change. */
5742 memcpy((void *)&ctx->active, &ctx->staging, 5739 memcpy((void *)&il->active, &il->staging,
5743 sizeof(struct il_rxon_cmd)); 5740 sizeof(struct il_rxon_cmd));
5744 } 5741 }
5745 } 5742 }
5746 5743
5747 if (changes & BSS_CHANGED_BEACON_ENABLED) { 5744 if (changes & BSS_CHANGED_BEACON_ENABLED) {
5748 if (vif->bss_conf.enable_beacon) { 5745 if (vif->bss_conf.enable_beacon) {
5749 memcpy(ctx->staging.bssid_addr, bss_conf->bssid, 5746 memcpy(il->staging.bssid_addr, bss_conf->bssid,
5750 ETH_ALEN); 5747 ETH_ALEN);
5751 memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); 5748 memcpy(il->bssid, bss_conf->bssid, ETH_ALEN);
5752 il->cfg->ops->legacy->config_ap(il); 5749 il->cfg->ops->legacy->config_ap(il);