aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlegacy/3945-mac.c82
-rw-r--r--drivers/net/wireless/iwlegacy/3945-rs.c2
-rw-r--r--drivers/net/wireless/iwlegacy/3945.c22
-rw-r--r--drivers/net/wireless/iwlegacy/4965-calib.c6
-rw-r--r--drivers/net/wireless/iwlegacy/4965-mac.c31
-rw-r--r--drivers/net/wireless/iwlegacy/4965.c99
-rw-r--r--drivers/net/wireless/iwlegacy/common.c157
-rw-r--r--drivers/net/wireless/iwlegacy/common.h30
-rw-r--r--drivers/net/wireless/iwlegacy/debug.c4
9 files changed, 205 insertions, 228 deletions
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 54b2d391e91a..980566fdb81a 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -672,15 +672,13 @@ il3945_get_measurement(struct il_priv *il,
672 int rc; 672 int rc;
673 int spectrum_resp_status; 673 int spectrum_resp_status;
674 int duration = le16_to_cpu(params->duration); 674 int duration = le16_to_cpu(params->duration);
675 struct il_rxon_context *ctx = &il->ctx;
676 675
677 if (il_is_associated(il)) 676 if (il_is_associated(il))
678 add_time = 677 add_time =
679 il_usecs_to_beacons(il, 678 il_usecs_to_beacons(il,
680 le64_to_cpu(params->start_time) - 679 le64_to_cpu(params->start_time) -
681 il->_3945.last_tsf, 680 il->_3945.last_tsf,
682 le16_to_cpu(ctx->timing. 681 le16_to_cpu(il->timing.beacon_interval));
683 beacon_interval));
684 682
685 memset(&spectrum, 0, sizeof(spectrum)); 683 memset(&spectrum, 0, sizeof(spectrum));
686 684
@@ -694,15 +692,14 @@ il3945_get_measurement(struct il_priv *il,
694 if (il_is_associated(il)) 692 if (il_is_associated(il))
695 spectrum.start_time = 693 spectrum.start_time =
696 il_add_beacon_time(il, il->_3945.last_beacon_time, add_time, 694 il_add_beacon_time(il, il->_3945.last_beacon_time, add_time,
697 le16_to_cpu(ctx->timing. 695 le16_to_cpu(il->timing.beacon_interval));
698 beacon_interval));
699 else 696 else
700 spectrum.start_time = 0; 697 spectrum.start_time = 0;
701 698
702 spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT); 699 spectrum.channels[0].duration = cpu_to_le32(duration * TIME_UNIT);
703 spectrum.channels[0].channel = params->channel; 700 spectrum.channels[0].channel = params->channel;
704 spectrum.channels[0].type = type; 701 spectrum.channels[0].type = type;
705 if (ctx->active.flags & RXON_FLG_BAND_24G_MSK) 702 if (il->active.flags & RXON_FLG_BAND_24G_MSK)
706 spectrum.flags |= 703 spectrum.flags |=
707 RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK | 704 RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK |
708 RXON_FLG_TGG_PROTECT_MSK; 705 RXON_FLG_TGG_PROTECT_MSK;
@@ -2150,7 +2147,6 @@ il3945_alive_start(struct il_priv *il)
2150{ 2147{
2151 int thermal_spin = 0; 2148 int thermal_spin = 0;
2152 u32 rfkill; 2149 u32 rfkill;
2153 struct il_rxon_context *ctx = &il->ctx;
2154 2150
2155 D_INFO("Runtime Alive received.\n"); 2151 D_INFO("Runtime Alive received.\n");
2156 2152
@@ -2206,13 +2202,13 @@ il3945_alive_start(struct il_priv *il)
2206 2202
2207 if (il_is_associated(il)) { 2203 if (il_is_associated(il)) {
2208 struct il3945_rxon_cmd *active_rxon = 2204 struct il3945_rxon_cmd *active_rxon =
2209 (struct il3945_rxon_cmd *)(&ctx->active); 2205 (struct il3945_rxon_cmd *)(&il->active);
2210 2206
2211 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2207 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2212 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2208 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2213 } else { 2209 } else {
2214 /* Initialize our rx_config data */ 2210 /* Initialize our rx_config data */
2215 il_connection_init_rx_config(il, ctx); 2211 il_connection_init_rx_config(il, &il->ctx);
2216 } 2212 }
2217 2213
2218 /* Configure Bluetooth device coexistence support */ 2214 /* Configure Bluetooth device coexistence support */
@@ -2221,7 +2217,7 @@ il3945_alive_start(struct il_priv *il)
2221 set_bit(S_READY, &il->status); 2217 set_bit(S_READY, &il->status);
2222 2218
2223 /* Configure the adapter for unassociated operation */ 2219 /* Configure the adapter for unassociated operation */
2224 il3945_commit_rxon(il, ctx); 2220 il3945_commit_rxon(il, &il->ctx);
2225 2221
2226 il3945_reg_txpower_periodic(il); 2222 il3945_reg_txpower_periodic(il);
2227 2223
@@ -2670,7 +2666,7 @@ il3945_post_scan(struct il_priv *il)
2670 * Since setting the RXON may have been deferred while 2666 * Since setting the RXON may have been deferred while
2671 * performing the scan, fire one off if needed 2667 * performing the scan, fire one off if needed
2672 */ 2668 */
2673 if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) 2669 if (memcmp(&il->staging, &il->active, sizeof(il->staging)))
2674 il3945_commit_rxon(il, ctx); 2670 il3945_commit_rxon(il, ctx);
2675} 2671}
2676 2672
@@ -2728,7 +2724,7 @@ il3945_post_associate(struct il_priv *il)
2728 return; 2724 return;
2729 2725
2730 D_ASSOC("Associated as %d to: %pM\n", ctx->vif->bss_conf.aid, 2726 D_ASSOC("Associated as %d to: %pM\n", ctx->vif->bss_conf.aid,
2731 ctx->active.bssid_addr); 2727 il->active.bssid_addr);
2732 2728
2733 if (test_bit(S_EXIT_PENDING, &il->status)) 2729 if (test_bit(S_EXIT_PENDING, &il->status))
2734 return; 2730 return;
@@ -2737,30 +2733,30 @@ il3945_post_associate(struct il_priv *il)
2737 2733
2738 conf = &il->hw->conf; 2734 conf = &il->hw->conf;
2739 2735
2740 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2736 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2741 il3945_commit_rxon(il, ctx); 2737 il3945_commit_rxon(il, ctx);
2742 2738
2743 rc = il_send_rxon_timing(il, ctx); 2739 rc = il_send_rxon_timing(il, ctx);
2744 if (rc) 2740 if (rc)
2745 IL_WARN("C_RXON_TIMING failed - " "Attempting to continue.\n"); 2741 IL_WARN("C_RXON_TIMING failed - " "Attempting to continue.\n");
2746 2742
2747 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2743 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2748 2744
2749 ctx->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid); 2745 il->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid);
2750 2746
2751 D_ASSOC("assoc id %d beacon interval %d\n", ctx->vif->bss_conf.aid, 2747 D_ASSOC("assoc id %d beacon interval %d\n", ctx->vif->bss_conf.aid,
2752 ctx->vif->bss_conf.beacon_int); 2748 ctx->vif->bss_conf.beacon_int);
2753 2749
2754 if (ctx->vif->bss_conf.use_short_preamble) 2750 if (ctx->vif->bss_conf.use_short_preamble)
2755 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 2751 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
2756 else 2752 else
2757 ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 2753 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
2758 2754
2759 if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) { 2755 if (il->staging.flags & RXON_FLG_BAND_24G_MSK) {
2760 if (ctx->vif->bss_conf.use_short_slot) 2756 if (ctx->vif->bss_conf.use_short_slot)
2761 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 2757 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
2762 else 2758 else
2763 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 2759 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
2764 } 2760 }
2765 2761
2766 il3945_commit_rxon(il, ctx); 2762 il3945_commit_rxon(il, ctx);
@@ -2902,7 +2898,7 @@ il3945_config_ap(struct il_priv *il)
2902 if (!(il_is_associated(il))) { 2898 if (!(il_is_associated(il))) {
2903 2899
2904 /* RXON - unassoc (to set timing command) */ 2900 /* RXON - unassoc (to set timing command) */
2905 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2901 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2906 il3945_commit_rxon(il, ctx); 2902 il3945_commit_rxon(il, ctx);
2907 2903
2908 /* RXON Timing */ 2904 /* RXON Timing */
@@ -2911,21 +2907,21 @@ il3945_config_ap(struct il_priv *il)
2911 IL_WARN("C_RXON_TIMING failed - " 2907 IL_WARN("C_RXON_TIMING failed - "
2912 "Attempting to continue.\n"); 2908 "Attempting to continue.\n");
2913 2909
2914 ctx->staging.assoc_id = 0; 2910 il->staging.assoc_id = 0;
2915 2911
2916 if (vif->bss_conf.use_short_preamble) 2912 if (vif->bss_conf.use_short_preamble)
2917 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 2913 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
2918 else 2914 else
2919 ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 2915 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
2920 2916
2921 if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) { 2917 if (il->staging.flags & RXON_FLG_BAND_24G_MSK) {
2922 if (vif->bss_conf.use_short_slot) 2918 if (vif->bss_conf.use_short_slot)
2923 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 2919 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
2924 else 2920 else
2925 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 2921 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
2926 } 2922 }
2927 /* restore RXON assoc */ 2923 /* restore RXON assoc */
2928 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2924 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2929 il3945_commit_rxon(il, ctx); 2925 il3945_commit_rxon(il, ctx);
2930 } 2926 }
2931 il3945_send_beacon_cmd(il); 2927 il3945_send_beacon_cmd(il);
@@ -3032,7 +3028,6 @@ il3945_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
3032{ 3028{
3033 struct il_priv *il = hw->priv; 3029 struct il_priv *il = hw->priv;
3034 __le32 filter_or = 0, filter_nand = 0; 3030 __le32 filter_or = 0, filter_nand = 0;
3035 struct il_rxon_context *ctx = &il->ctx;
3036 3031
3037#define CHK(test, flag) do { \ 3032#define CHK(test, flag) do { \
3038 if (*total_flags & (test)) \ 3033 if (*total_flags & (test)) \
@@ -3052,8 +3047,8 @@ il3945_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
3052 3047
3053 mutex_lock(&il->mutex); 3048 mutex_lock(&il->mutex);
3054 3049
3055 ctx->staging.filter_flags &= ~filter_nand; 3050 il->staging.filter_flags &= ~filter_nand;
3056 ctx->staging.filter_flags |= filter_or; 3051 il->staging.filter_flags |= filter_or;
3057 3052
3058 /* 3053 /*
3059 * Not committing directly because hardware can perform a scan, 3054 * Not committing directly because hardware can perform a scan,
@@ -3170,9 +3165,8 @@ static ssize_t
3170il3945_show_flags(struct device *d, struct device_attribute *attr, char *buf) 3165il3945_show_flags(struct device *d, struct device_attribute *attr, char *buf)
3171{ 3166{
3172 struct il_priv *il = dev_get_drvdata(d); 3167 struct il_priv *il = dev_get_drvdata(d);
3173 struct il_rxon_context *ctx = &il->ctx;
3174 3168
3175 return sprintf(buf, "0x%04X\n", ctx->active.flags); 3169 return sprintf(buf, "0x%04X\n", il->active.flags);
3176} 3170}
3177 3171
3178static ssize_t 3172static ssize_t
@@ -3181,17 +3175,16 @@ il3945_store_flags(struct device *d, struct device_attribute *attr,
3181{ 3175{
3182 struct il_priv *il = dev_get_drvdata(d); 3176 struct il_priv *il = dev_get_drvdata(d);
3183 u32 flags = simple_strtoul(buf, NULL, 0); 3177 u32 flags = simple_strtoul(buf, NULL, 0);
3184 struct il_rxon_context *ctx = &il->ctx;
3185 3178
3186 mutex_lock(&il->mutex); 3179 mutex_lock(&il->mutex);
3187 if (le32_to_cpu(ctx->staging.flags) != flags) { 3180 if (le32_to_cpu(il->staging.flags) != flags) {
3188 /* Cancel any currently running scans... */ 3181 /* Cancel any currently running scans... */
3189 if (il_scan_cancel_timeout(il, 100)) 3182 if (il_scan_cancel_timeout(il, 100))
3190 IL_WARN("Could not cancel scan.\n"); 3183 IL_WARN("Could not cancel scan.\n");
3191 else { 3184 else {
3192 D_INFO("Committing rxon.flags = 0x%04X\n", flags); 3185 D_INFO("Committing rxon.flags = 0x%04X\n", flags);
3193 ctx->staging.flags = cpu_to_le32(flags); 3186 il->staging.flags = cpu_to_le32(flags);
3194 il3945_commit_rxon(il, ctx); 3187 il3945_commit_rxon(il, &il->ctx);
3195 } 3188 }
3196 } 3189 }
3197 mutex_unlock(&il->mutex); 3190 mutex_unlock(&il->mutex);
@@ -3207,9 +3200,8 @@ il3945_show_filter_flags(struct device *d, struct device_attribute *attr,
3207 char *buf) 3200 char *buf)
3208{ 3201{
3209 struct il_priv *il = dev_get_drvdata(d); 3202 struct il_priv *il = dev_get_drvdata(d);
3210 struct il_rxon_context *ctx = &il->ctx;
3211 3203
3212 return sprintf(buf, "0x%04X\n", le32_to_cpu(ctx->active.filter_flags)); 3204 return sprintf(buf, "0x%04X\n", le32_to_cpu(il->active.filter_flags));
3213} 3205}
3214 3206
3215static ssize_t 3207static ssize_t
@@ -3217,19 +3209,18 @@ il3945_store_filter_flags(struct device *d, struct device_attribute *attr,
3217 const char *buf, size_t count) 3209 const char *buf, size_t count)
3218{ 3210{
3219 struct il_priv *il = dev_get_drvdata(d); 3211 struct il_priv *il = dev_get_drvdata(d);
3220 struct il_rxon_context *ctx = &il->ctx;
3221 u32 filter_flags = simple_strtoul(buf, NULL, 0); 3212 u32 filter_flags = simple_strtoul(buf, NULL, 0);
3222 3213
3223 mutex_lock(&il->mutex); 3214 mutex_lock(&il->mutex);
3224 if (le32_to_cpu(ctx->staging.filter_flags) != filter_flags) { 3215 if (le32_to_cpu(il->staging.filter_flags) != filter_flags) {
3225 /* Cancel any currently running scans... */ 3216 /* Cancel any currently running scans... */
3226 if (il_scan_cancel_timeout(il, 100)) 3217 if (il_scan_cancel_timeout(il, 100))
3227 IL_WARN("Could not cancel scan.\n"); 3218 IL_WARN("Could not cancel scan.\n");
3228 else { 3219 else {
3229 D_INFO("Committing rxon.filter_flags = " "0x%04X\n", 3220 D_INFO("Committing rxon.filter_flags = " "0x%04X\n",
3230 filter_flags); 3221 filter_flags);
3231 ctx->staging.filter_flags = cpu_to_le32(filter_flags); 3222 il->staging.filter_flags = cpu_to_le32(filter_flags);
3232 il3945_commit_rxon(il, ctx); 3223 il3945_commit_rxon(il, &il->ctx);
3233 } 3224 }
3234 } 3225 }
3235 mutex_unlock(&il->mutex); 3226 mutex_unlock(&il->mutex);
@@ -3278,9 +3269,8 @@ il3945_store_measurement(struct device *d, struct device_attribute *attr,
3278 const char *buf, size_t count) 3269 const char *buf, size_t count)
3279{ 3270{
3280 struct il_priv *il = dev_get_drvdata(d); 3271 struct il_priv *il = dev_get_drvdata(d);
3281 struct il_rxon_context *ctx = &il->ctx;
3282 struct ieee80211_measurement_params params = { 3272 struct ieee80211_measurement_params params = {
3283 .channel = le16_to_cpu(ctx->active.channel), 3273 .channel = le16_to_cpu(il->active.channel),
3284 .start_time = cpu_to_le64(il->_3945.last_tsf), 3274 .start_time = cpu_to_le64(il->_3945.last_tsf),
3285 .duration = cpu_to_le16(1), 3275 .duration = cpu_to_le16(1),
3286 }; 3276 };
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index d7a83f229190..40d17d7fcfef 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -944,7 +944,7 @@ il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
944 switch (il->band) { 944 switch (il->band) {
945 case IEEE80211_BAND_2GHZ: 945 case IEEE80211_BAND_2GHZ:
946 /* TODO: this always does G, not a regression */ 946 /* TODO: this always does G, not a regression */
947 if (il->ctx.active.flags & RXON_FLG_TGG_PROTECT_MSK) { 947 if (il->active.flags & RXON_FLG_TGG_PROTECT_MSK) {
948 rs_sta->tgg = 1; 948 rs_sta->tgg = 1;
949 rs_sta->expected_tpt = il3945_expected_tpt_g_prot; 949 rs_sta->expected_tpt = il3945_expected_tpt_g_prot;
950 } else 950 } else
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c
index 1489b1573a6a..dc0433f6801c 100644
--- a/drivers/net/wireless/iwlegacy/3945.c
+++ b/drivers/net/wireless/iwlegacy/3945.c
@@ -1388,7 +1388,7 @@ il3945_send_tx_power(struct il_priv *il)
1388 int rate_idx, i; 1388 int rate_idx, i;
1389 const struct il_channel_info *ch_info = NULL; 1389 const struct il_channel_info *ch_info = NULL;
1390 struct il3945_txpowertable_cmd txpower = { 1390 struct il3945_txpowertable_cmd txpower = {
1391 .channel = il->ctx.active.channel, 1391 .channel = il->active.channel,
1392 }; 1392 };
1393 u16 chan; 1393 u16 chan;
1394 1394
@@ -1397,7 +1397,7 @@ il3945_send_tx_power(struct il_priv *il)
1397 "TX Power requested while scanning!\n")) 1397 "TX Power requested while scanning!\n"))
1398 return -EAGAIN; 1398 return -EAGAIN;
1399 1399
1400 chan = le16_to_cpu(il->ctx.active.channel); 1400 chan = le16_to_cpu(il->active.channel);
1401 1401
1402 txpower.band = (il->band == IEEE80211_BAND_5GHZ) ? 0 : 1; 1402 txpower.band = (il->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
1403 ch_info = il_get_channel_info(il, il->band, chan); 1403 ch_info = il_get_channel_info(il, il->band, chan);
@@ -1673,8 +1673,8 @@ il3945_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx)
1673 .flags = CMD_WANT_SKB, 1673 .flags = CMD_WANT_SKB,
1674 .data = &rxon_assoc, 1674 .data = &rxon_assoc,
1675 }; 1675 };
1676 const struct il_rxon_cmd *rxon1 = &ctx->staging; 1676 const struct il_rxon_cmd *rxon1 = &il->staging;
1677 const struct il_rxon_cmd *rxon2 = &ctx->active; 1677 const struct il_rxon_cmd *rxon2 = &il->active;
1678 1678
1679 if (rxon1->flags == rxon2->flags && 1679 if (rxon1->flags == rxon2->flags &&
1680 rxon1->filter_flags == rxon2->filter_flags && 1680 rxon1->filter_flags == rxon2->filter_flags &&
@@ -1684,10 +1684,10 @@ il3945_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx)
1684 return 0; 1684 return 0;
1685 } 1685 }
1686 1686
1687 rxon_assoc.flags = ctx->staging.flags; 1687 rxon_assoc.flags = il->staging.flags;
1688 rxon_assoc.filter_flags = ctx->staging.filter_flags; 1688 rxon_assoc.filter_flags = il->staging.filter_flags;
1689 rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates; 1689 rxon_assoc.ofdm_basic_rates = il->staging.ofdm_basic_rates;
1690 rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; 1690 rxon_assoc.cck_basic_rates = il->staging.cck_basic_rates;
1691 rxon_assoc.reserved = 0; 1691 rxon_assoc.reserved = 0;
1692 1692
1693 rc = il_send_cmd_sync(il, &cmd); 1693 rc = il_send_cmd_sync(il, &cmd);
@@ -1717,8 +1717,8 @@ int
1717il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx) 1717il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1718{ 1718{
1719 /* cast away the const for active_rxon in this function */ 1719 /* cast away the const for active_rxon in this function */
1720 struct il3945_rxon_cmd *active_rxon = (void *)&ctx->active; 1720 struct il3945_rxon_cmd *active_rxon = (void *)&il->active;
1721 struct il3945_rxon_cmd *staging_rxon = (void *)&ctx->staging; 1721 struct il3945_rxon_cmd *staging_rxon = (void *)&il->staging;
1722 int rc = 0; 1722 int rc = 0;
1723 bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK); 1723 bool new_assoc = !!(staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK);
1724 1724
@@ -1776,7 +1776,7 @@ il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1776 active_rxon->reserved4 = 0; 1776 active_rxon->reserved4 = 0;
1777 active_rxon->reserved5 = 0; 1777 active_rxon->reserved5 = 0;
1778 rc = il_send_cmd_pdu(il, C_RXON, sizeof(struct il3945_rxon_cmd), 1778 rc = il_send_cmd_pdu(il, C_RXON, sizeof(struct il3945_rxon_cmd),
1779 &il->ctx.active); 1779 &il->active);
1780 1780
1781 /* If the mask clearing failed then we set 1781 /* If the mask clearing failed then we set
1782 * active_rxon back to what it was previously */ 1782 * active_rxon back to what it was previously */
diff --git a/drivers/net/wireless/iwlegacy/4965-calib.c b/drivers/net/wireless/iwlegacy/4965-calib.c
index d3248e3ef23b..f302a6ac6286 100644
--- a/drivers/net/wireless/iwlegacy/4965-calib.c
+++ b/drivers/net/wireless/iwlegacy/4965-calib.c
@@ -806,8 +806,6 @@ il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)
806 unsigned long flags; 806 unsigned long flags;
807 struct stats_rx_non_phy *rx_info; 807 struct stats_rx_non_phy *rx_info;
808 808
809 struct il_rxon_context *ctx = &il->ctx;
810
811 if (il->disable_chain_noise_cal) 809 if (il->disable_chain_noise_cal)
812 return; 810 return;
813 811
@@ -833,8 +831,8 @@ il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)
833 return; 831 return;
834 } 832 }
835 833
836 rxon_band24 = !!(ctx->staging.flags & RXON_FLG_BAND_24G_MSK); 834 rxon_band24 = !!(il->staging.flags & RXON_FLG_BAND_24G_MSK);
837 rxon_chnum = le16_to_cpu(ctx->staging.channel); 835 rxon_chnum = le16_to_cpu(il->staging.channel);
838 836
839 stat_band24 = 837 stat_band24 =
840 !!(((struct il_notif_stats *)stat_resp)-> 838 !!(((struct il_notif_stats *)stat_resp)->
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 1667232af647..6a77f41dd367 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -926,8 +926,7 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
926 case IEEE80211_BAND_2GHZ: 926 case IEEE80211_BAND_2GHZ:
927 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 927 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
928 chan_mod = 928 chan_mod =
929 le32_to_cpu(il->ctx.active. 929 le32_to_cpu(il->active.flags & RXON_FLG_CHANNEL_MODE_MSK) >>
930 flags & RXON_FLG_CHANNEL_MODE_MSK) >>
931 RXON_FLG_CHANNEL_MODE_POS; 930 RXON_FLG_CHANNEL_MODE_POS;
932 if (chan_mod == CHANNEL_MODE_PURE_40) { 931 if (chan_mod == CHANNEL_MODE_PURE_40) {
933 rate = RATE_6M_PLCP; 932 rate = RATE_6M_PLCP;
@@ -1164,14 +1163,14 @@ il4965_set_rxon_chain(struct il_priv *il, struct il_rxon_context *ctx)
1164 rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS; 1163 rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS;
1165 rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS; 1164 rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS;
1166 1165
1167 ctx->staging.rx_chain = cpu_to_le16(rx_chain); 1166 il->staging.rx_chain = cpu_to_le16(rx_chain);
1168 1167
1169 if (!is_single && active_rx_cnt >= IL_NUM_RX_CHAINS_SINGLE && is_cam) 1168 if (!is_single && active_rx_cnt >= IL_NUM_RX_CHAINS_SINGLE && is_cam)
1170 ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK; 1169 il->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK;
1171 else 1170 else
1172 ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK; 1171 il->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK;
1173 1172
1174 D_ASSOC("rx_chain=0x%X active=%d idle=%d\n", ctx->staging.rx_chain, 1173 D_ASSOC("rx_chain=0x%X active=%d idle=%d\n", il->staging.rx_chain,
1175 active_rx_cnt, idle_rx_cnt); 1174 active_rx_cnt, idle_rx_cnt);
1176 1175
1177 WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 || 1176 WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 ||
@@ -3378,7 +3377,7 @@ il4965_update_chain_flags(struct il_priv *il)
3378{ 3377{
3379 if (il->cfg->ops->hcmd->set_rxon_chain) { 3378 if (il->cfg->ops->hcmd->set_rxon_chain) {
3380 il->cfg->ops->hcmd->set_rxon_chain(il, &il->ctx); 3379 il->cfg->ops->hcmd->set_rxon_chain(il, &il->ctx);
3381 if (il->ctx.active.rx_chain != il->ctx.staging.rx_chain) 3380 if (il->active.rx_chain != il->staging.rx_chain)
3382 il_commit_rxon(il, &il->ctx); 3381 il_commit_rxon(il, &il->ctx);
3383 } 3382 }
3384} 3383}
@@ -5019,11 +5018,11 @@ il4965_alive_start(struct il_priv *il)
5019 5018
5020 il->active_rate = RATES_MASK; 5019 il->active_rate = RATES_MASK;
5021 5020
5022 if (il_is_associated_ctx(ctx)) { 5021 if (il_is_associated(il)) {
5023 struct il_rxon_cmd *active_rxon = 5022 struct il_rxon_cmd *active_rxon =
5024 (struct il_rxon_cmd *)&ctx->active; 5023 (struct il_rxon_cmd *)&il->active;
5025 /* apply any changes in staging */ 5024 /* apply any changes in staging */
5026 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 5025 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
5027 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 5026 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5028 } else { 5027 } else {
5029 /* Initialize our rx_config data */ 5028 /* Initialize our rx_config data */
@@ -5768,14 +5767,14 @@ il4965_mac_channel_switch(struct ieee80211_hw *hw,
5768 test_bit(S_CHANNEL_SWITCH_PENDING, &il->status)) 5767 test_bit(S_CHANNEL_SWITCH_PENDING, &il->status))
5769 goto out; 5768 goto out;
5770 5769
5771 if (!il_is_associated_ctx(ctx)) 5770 if (!il_is_associated(il))
5772 goto out; 5771 goto out;
5773 5772
5774 if (!il->cfg->ops->lib->set_channel_switch) 5773 if (!il->cfg->ops->lib->set_channel_switch)
5775 goto out; 5774 goto out;
5776 5775
5777 ch = channel->hw_value; 5776 ch = channel->hw_value;
5778 if (le16_to_cpu(ctx->active.channel) == ch) 5777 if (le16_to_cpu(il->active.channel) == ch)
5779 goto out; 5778 goto out;
5780 5779
5781 ch_info = il_get_channel_info(il, channel->band, ch); 5780 ch_info = il_get_channel_info(il, channel->band, ch);
@@ -5807,8 +5806,8 @@ il4965_mac_channel_switch(struct ieee80211_hw *hw,
5807 } else 5806 } else
5808 ctx->ht.is_40mhz = false; 5807 ctx->ht.is_40mhz = false;
5809 5808
5810 if ((le16_to_cpu(ctx->staging.channel) != ch)) 5809 if ((le16_to_cpu(il->staging.channel) != ch))
5811 ctx->staging.flags = 0; 5810 il->staging.flags = 0;
5812 5811
5813 il_set_rxon_channel(il, channel, ctx); 5812 il_set_rxon_channel(il, channel, ctx);
5814 il_set_rxon_ht(il, ht_conf); 5813 il_set_rxon_ht(il, ht_conf);
@@ -5860,8 +5859,8 @@ il4965_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
5860 5859
5861 mutex_lock(&il->mutex); 5860 mutex_lock(&il->mutex);
5862 5861
5863 il->ctx.staging.filter_flags &= ~filter_nand; 5862 il->staging.filter_flags &= ~filter_nand;
5864 il->ctx.staging.filter_flags |= filter_or; 5863 il->staging.filter_flags |= filter_or;
5865 5864
5866 /* 5865 /*
5867 * Not committing directly because hardware can perform a scan, 5866 * Not committing directly because hardware can perform a scan,
diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c
index cacbc03880b0..b34de1433123 100644
--- a/drivers/net/wireless/iwlegacy/4965.c
+++ b/drivers/net/wireless/iwlegacy/4965.c
@@ -1342,7 +1342,6 @@ il4965_send_tx_power(struct il_priv *il)
1342 u8 band = 0; 1342 u8 band = 0;
1343 bool is_ht40 = false; 1343 bool is_ht40 = false;
1344 u8 ctrl_chan_high = 0; 1344 u8 ctrl_chan_high = 0;
1345 struct il_rxon_context *ctx = &il->ctx;
1346 1345
1347 if (WARN_ONCE 1346 if (WARN_ONCE
1348 (test_bit(S_SCAN_HW, &il->status), 1347 (test_bit(S_SCAN_HW, &il->status),
@@ -1351,16 +1350,16 @@ il4965_send_tx_power(struct il_priv *il)
1351 1350
1352 band = il->band == IEEE80211_BAND_2GHZ; 1351 band = il->band == IEEE80211_BAND_2GHZ;
1353 1352
1354 is_ht40 = iw4965_is_ht40_channel(ctx->active.flags); 1353 is_ht40 = iw4965_is_ht40_channel(il->active.flags);
1355 1354
1356 if (is_ht40 && (ctx->active.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) 1355 if (is_ht40 && (il->active.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
1357 ctrl_chan_high = 1; 1356 ctrl_chan_high = 1;
1358 1357
1359 cmd.band = band; 1358 cmd.band = band;
1360 cmd.channel = ctx->active.channel; 1359 cmd.channel = il->active.channel;
1361 1360
1362 ret = 1361 ret =
1363 il4965_fill_txpower_tbl(il, band, le16_to_cpu(ctx->active.channel), 1362 il4965_fill_txpower_tbl(il, band, le16_to_cpu(il->active.channel),
1364 is_ht40, ctrl_chan_high, &cmd.tx_power); 1363 is_ht40, ctrl_chan_high, &cmd.tx_power);
1365 if (ret) 1364 if (ret)
1366 goto out; 1365 goto out;
@@ -1376,8 +1375,8 @@ il4965_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx)
1376{ 1375{
1377 int ret = 0; 1376 int ret = 0;
1378 struct il4965_rxon_assoc_cmd rxon_assoc; 1377 struct il4965_rxon_assoc_cmd rxon_assoc;
1379 const struct il_rxon_cmd *rxon1 = &ctx->staging; 1378 const struct il_rxon_cmd *rxon1 = &il->staging;
1380 const struct il_rxon_cmd *rxon2 = &ctx->active; 1379 const struct il_rxon_cmd *rxon2 = &il->active;
1381 1380
1382 if (rxon1->flags == rxon2->flags && 1381 if (rxon1->flags == rxon2->flags &&
1383 rxon1->filter_flags == rxon2->filter_flags && 1382 rxon1->filter_flags == rxon2->filter_flags &&
@@ -1392,16 +1391,16 @@ il4965_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx)
1392 return 0; 1391 return 0;
1393 } 1392 }
1394 1393
1395 rxon_assoc.flags = ctx->staging.flags; 1394 rxon_assoc.flags = il->staging.flags;
1396 rxon_assoc.filter_flags = ctx->staging.filter_flags; 1395 rxon_assoc.filter_flags = il->staging.filter_flags;
1397 rxon_assoc.ofdm_basic_rates = ctx->staging.ofdm_basic_rates; 1396 rxon_assoc.ofdm_basic_rates = il->staging.ofdm_basic_rates;
1398 rxon_assoc.cck_basic_rates = ctx->staging.cck_basic_rates; 1397 rxon_assoc.cck_basic_rates = il->staging.cck_basic_rates;
1399 rxon_assoc.reserved = 0; 1398 rxon_assoc.reserved = 0;
1400 rxon_assoc.ofdm_ht_single_stream_basic_rates = 1399 rxon_assoc.ofdm_ht_single_stream_basic_rates =
1401 ctx->staging.ofdm_ht_single_stream_basic_rates; 1400 il->staging.ofdm_ht_single_stream_basic_rates;
1402 rxon_assoc.ofdm_ht_dual_stream_basic_rates = 1401 rxon_assoc.ofdm_ht_dual_stream_basic_rates =
1403 ctx->staging.ofdm_ht_dual_stream_basic_rates; 1402 il->staging.ofdm_ht_dual_stream_basic_rates;
1404 rxon_assoc.rx_chain_select_flags = ctx->staging.rx_chain; 1403 rxon_assoc.rx_chain_select_flags = il->staging.rx_chain;
1405 1404
1406 ret = 1405 ret =
1407 il_send_cmd_pdu_async(il, C_RXON_ASSOC, sizeof(rxon_assoc), 1406 il_send_cmd_pdu_async(il, C_RXON_ASSOC, sizeof(rxon_assoc),
@@ -1414,9 +1413,9 @@ static int
1414il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx) 1413il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1415{ 1414{
1416 /* cast away the const for active_rxon in this function */ 1415 /* cast away the const for active_rxon in this function */
1417 struct il_rxon_cmd *active_rxon = (void *)&ctx->active; 1416 struct il_rxon_cmd *active_rxon = (void *)&il->active;
1418 int ret; 1417 int ret;
1419 bool new_assoc = !!(ctx->staging.filter_flags & RXON_FILTER_ASSOC_MSK); 1418 bool new_assoc = !!(il->staging.filter_flags & RXON_FILTER_ASSOC_MSK);
1420 1419
1421 if (!il_is_alive(il)) 1420 if (!il_is_alive(il))
1422 return -EBUSY; 1421 return -EBUSY;
@@ -1425,7 +1424,7 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1425 return 0; 1424 return 0;
1426 1425
1427 /* always get timestamp with Rx frame */ 1426 /* always get timestamp with Rx frame */
1428 ctx->staging.flags |= RXON_FLG_TSF2HOST_MSK; 1427 il->staging.flags |= RXON_FLG_TSF2HOST_MSK;
1429 1428
1430 ret = il_check_rxon_cmd(il, ctx); 1429 ret = il_check_rxon_cmd(il, ctx);
1431 if (ret) { 1430 if (ret) {
@@ -1438,7 +1437,7 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1438 * abort any previous channel switch if still in process 1437 * abort any previous channel switch if still in process
1439 */ 1438 */
1440 if (test_bit(S_CHANNEL_SWITCH_PENDING, &il->status) && 1439 if (test_bit(S_CHANNEL_SWITCH_PENDING, &il->status) &&
1441 il->switch_channel != ctx->staging.channel) { 1440 il->switch_channel != il->staging.channel) {
1442 D_11H("abort channel switch on %d\n", 1441 D_11H("abort channel switch on %d\n",
1443 le16_to_cpu(il->switch_channel)); 1442 le16_to_cpu(il->switch_channel));
1444 il_chswitch_done(il, false); 1443 il_chswitch_done(il, false);
@@ -1454,7 +1453,7 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1454 return ret; 1453 return ret;
1455 } 1454 }
1456 1455
1457 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); 1456 memcpy(active_rxon, &il->staging, sizeof(*active_rxon));
1458 il_print_rx_config_cmd(il, ctx); 1457 il_print_rx_config_cmd(il, ctx);
1459 /* 1458 /*
1460 * We do not commit tx power settings while channel changing, 1459 * We do not commit tx power settings while channel changing,
@@ -1468,7 +1467,7 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1468 * an RXON_ASSOC and the new config wants the associated mask enabled, 1467 * an RXON_ASSOC and the new config wants the associated mask enabled,
1469 * we must clear the associated from the active configuration 1468 * we must clear the associated from the active configuration
1470 * before we apply the new config */ 1469 * before we apply the new config */
1471 if (il_is_associated_ctx(ctx) && new_assoc) { 1470 if (il_is_associated(il) && new_assoc) {
1472 D_INFO("Toggling associated bit on current RXON\n"); 1471 D_INFO("Toggling associated bit on current RXON\n");
1473 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1472 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1474 1473
@@ -1494,7 +1493,7 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1494 1493
1495 D_INFO("Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n" 1494 D_INFO("Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n"
1496 "* channel = %d\n" "* bssid = %pM\n", (new_assoc ? "" : "out"), 1495 "* channel = %d\n" "* bssid = %pM\n", (new_assoc ? "" : "out"),
1497 le16_to_cpu(ctx->staging.channel), ctx->staging.bssid_addr); 1496 le16_to_cpu(il->staging.channel), il->staging.bssid_addr);
1498 1497
1499 il_set_rxon_hwcrypto(il, ctx, !il->cfg->mod_params->sw_crypto); 1498 il_set_rxon_hwcrypto(il, ctx, !il->cfg->mod_params->sw_crypto);
1500 1499
@@ -1505,13 +1504,13 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1505 if (!new_assoc) { 1504 if (!new_assoc) {
1506 ret = 1505 ret =
1507 il_send_cmd_pdu(il, ctx->rxon_cmd, 1506 il_send_cmd_pdu(il, ctx->rxon_cmd,
1508 sizeof(struct il_rxon_cmd), &ctx->staging); 1507 sizeof(struct il_rxon_cmd), &il->staging);
1509 if (ret) { 1508 if (ret) {
1510 IL_ERR("Error setting new RXON (%d)\n", ret); 1509 IL_ERR("Error setting new RXON (%d)\n", ret);
1511 return ret; 1510 return ret;
1512 } 1511 }
1513 D_INFO("Return from !new_assoc RXON.\n"); 1512 D_INFO("Return from !new_assoc RXON.\n");
1514 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); 1513 memcpy(active_rxon, &il->staging, sizeof(*active_rxon));
1515 il_clear_ucode_stations(il, ctx); 1514 il_clear_ucode_stations(il, ctx);
1516 il_restore_stations(il, ctx); 1515 il_restore_stations(il, ctx);
1517 ret = il4965_restore_default_wep_keys(il, ctx); 1516 ret = il4965_restore_default_wep_keys(il, ctx);
@@ -1527,12 +1526,12 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1527 */ 1526 */
1528 ret = 1527 ret =
1529 il_send_cmd_pdu(il, ctx->rxon_cmd, 1528 il_send_cmd_pdu(il, ctx->rxon_cmd,
1530 sizeof(struct il_rxon_cmd), &ctx->staging); 1529 sizeof(struct il_rxon_cmd), &il->staging);
1531 if (ret) { 1530 if (ret) {
1532 IL_ERR("Error setting new RXON (%d)\n", ret); 1531 IL_ERR("Error setting new RXON (%d)\n", ret);
1533 return ret; 1532 return ret;
1534 } 1533 }
1535 memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); 1534 memcpy(active_rxon, &il->staging, sizeof(*active_rxon));
1536 } 1535 }
1537 il_print_rx_config_cmd(il, ctx); 1536 il_print_rx_config_cmd(il, ctx);
1538 1537
@@ -1564,21 +1563,21 @@ il4965_hw_channel_switch(struct il_priv *il,
1564 u16 ch; 1563 u16 ch;
1565 u32 tsf_low; 1564 u32 tsf_low;
1566 u8 switch_count; 1565 u8 switch_count;
1567 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); 1566 u16 beacon_interval = le16_to_cpu(il->timing.beacon_interval);
1568 struct ieee80211_vif *vif = ctx->vif; 1567 struct ieee80211_vif *vif = ctx->vif;
1569 band = il->band == IEEE80211_BAND_2GHZ; 1568 band = il->band == IEEE80211_BAND_2GHZ;
1570 1569
1571 is_ht40 = iw4965_is_ht40_channel(ctx->staging.flags); 1570 is_ht40 = iw4965_is_ht40_channel(il->staging.flags);
1572 1571
1573 if (is_ht40 && (ctx->staging.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK)) 1572 if (is_ht40 && (il->staging.flags & RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK))
1574 ctrl_chan_high = 1; 1573 ctrl_chan_high = 1;
1575 1574
1576 cmd.band = band; 1575 cmd.band = band;
1577 cmd.expect_beacon = 0; 1576 cmd.expect_beacon = 0;
1578 ch = ch_switch->channel->hw_value; 1577 ch = ch_switch->channel->hw_value;
1579 cmd.channel = cpu_to_le16(ch); 1578 cmd.channel = cpu_to_le16(ch);
1580 cmd.rxon_flags = ctx->staging.flags; 1579 cmd.rxon_flags = il->staging.flags;
1581 cmd.rxon_filter_flags = ctx->staging.filter_flags; 1580 cmd.rxon_filter_flags = il->staging.filter_flags;
1582 switch_count = ch_switch->count; 1581 switch_count = ch_switch->count;
1583 tsf_low = ch_switch->timestamp & 0x0ffffffff; 1582 tsf_low = ch_switch->timestamp & 0x0ffffffff;
1584 /* 1583 /*
@@ -1611,7 +1610,7 @@ il4965_hw_channel_switch(struct il_priv *il,
1611 cmd.expect_beacon = il_is_channel_radar(ch_info); 1610 cmd.expect_beacon = il_is_channel_radar(ch_info);
1612 else { 1611 else {
1613 IL_ERR("invalid channel switch from %u to %u\n", 1612 IL_ERR("invalid channel switch from %u to %u\n",
1614 ctx->active.channel, ch); 1613 il->active.channel, ch);
1615 return -EFAULT; 1614 return -EFAULT;
1616 } 1615 }
1617 1616
@@ -2139,7 +2138,7 @@ il4965_post_scan(struct il_priv *il)
2139 * Since setting the RXON may have been deferred while 2138 * Since setting the RXON may have been deferred while
2140 * performing the scan, fire one off if needed 2139 * performing the scan, fire one off if needed
2141 */ 2140 */
2142 if (memcmp(&ctx->staging, &ctx->active, sizeof(ctx->staging))) 2141 if (memcmp(&il->staging, &il->active, sizeof(il->staging)))
2143 il_commit_rxon(il, ctx); 2142 il_commit_rxon(il, ctx);
2144} 2143}
2145 2144
@@ -2161,41 +2160,41 @@ il4965_post_associate(struct il_priv *il)
2161 2160
2162 conf = &il->hw->conf; 2161 conf = &il->hw->conf;
2163 2162
2164 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2163 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2165 il_commit_rxon(il, ctx); 2164 il_commit_rxon(il, ctx);
2166 2165
2167 ret = il_send_rxon_timing(il, ctx); 2166 ret = il_send_rxon_timing(il, ctx);
2168 if (ret) 2167 if (ret)
2169 IL_WARN("RXON timing - " "Attempting to continue.\n"); 2168 IL_WARN("RXON timing - " "Attempting to continue.\n");
2170 2169
2171 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2170 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2172 2171
2173 il_set_rxon_ht(il, &il->current_ht_config); 2172 il_set_rxon_ht(il, &il->current_ht_config);
2174 2173
2175 if (il->cfg->ops->hcmd->set_rxon_chain) 2174 if (il->cfg->ops->hcmd->set_rxon_chain)
2176 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 2175 il->cfg->ops->hcmd->set_rxon_chain(il, ctx);
2177 2176
2178 ctx->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); 2177 il->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid);
2179 2178
2180 D_ASSOC("assoc id %d beacon interval %d\n", vif->bss_conf.aid, 2179 D_ASSOC("assoc id %d beacon interval %d\n", vif->bss_conf.aid,
2181 vif->bss_conf.beacon_int); 2180 vif->bss_conf.beacon_int);
2182 2181
2183 if (vif->bss_conf.use_short_preamble) 2182 if (vif->bss_conf.use_short_preamble)
2184 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 2183 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
2185 else 2184 else
2186 ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 2185 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
2187 2186
2188 if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) { 2187 if (il->staging.flags & RXON_FLG_BAND_24G_MSK) {
2189 if (vif->bss_conf.use_short_slot) 2188 if (vif->bss_conf.use_short_slot)
2190 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 2189 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
2191 else 2190 else
2192 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 2191 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
2193 } 2192 }
2194 2193
2195 il_commit_rxon(il, ctx); 2194 il_commit_rxon(il, ctx);
2196 2195
2197 D_ASSOC("Associated as %d to: %pM\n", vif->bss_conf.aid, 2196 D_ASSOC("Associated as %d to: %pM\n", vif->bss_conf.aid,
2198 ctx->active.bssid_addr); 2197 il->active.bssid_addr);
2199 2198
2200 switch (vif->type) { 2199 switch (vif->type) {
2201 case NL80211_IFTYPE_STATION: 2200 case NL80211_IFTYPE_STATION:
@@ -2233,10 +2232,10 @@ il4965_config_ap(struct il_priv *il)
2233 return; 2232 return;
2234 2233
2235 /* The following should be done only at AP bring up */ 2234 /* The following should be done only at AP bring up */
2236 if (!il_is_associated_ctx(ctx)) { 2235 if (!il_is_associated(il)) {
2237 2236
2238 /* RXON - unassoc (to set timing command) */ 2237 /* RXON - unassoc (to set timing command) */
2239 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2238 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2240 il_commit_rxon(il, ctx); 2239 il_commit_rxon(il, ctx);
2241 2240
2242 /* RXON Timing */ 2241 /* RXON Timing */
@@ -2251,23 +2250,23 @@ il4965_config_ap(struct il_priv *il)
2251 if (il->cfg->ops->hcmd->set_rxon_chain) 2250 if (il->cfg->ops->hcmd->set_rxon_chain)
2252 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 2251 il->cfg->ops->hcmd->set_rxon_chain(il, ctx);
2253 2252
2254 ctx->staging.assoc_id = 0; 2253 il->staging.assoc_id = 0;
2255 2254
2256 if (vif->bss_conf.use_short_preamble) 2255 if (vif->bss_conf.use_short_preamble)
2257 ctx->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 2256 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
2258 else 2257 else
2259 ctx->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 2258 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
2260 2259
2261 if (ctx->staging.flags & RXON_FLG_BAND_24G_MSK) { 2260 if (il->staging.flags & RXON_FLG_BAND_24G_MSK) {
2262 if (vif->bss_conf.use_short_slot) 2261 if (vif->bss_conf.use_short_slot)
2263 ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 2262 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
2264 else 2263 else
2265 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 2264 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
2266 } 2265 }
2267 /* need to send beacon cmd before committing assoc RXON! */ 2266 /* need to send beacon cmd before committing assoc RXON! */
2268 il4965_send_beacon_cmd(il); 2267 il4965_send_beacon_cmd(il);
2269 /* restore RXON assoc */ 2268 /* restore RXON assoc */
2270 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2269 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2271 il_commit_rxon(il, ctx); 2270 il_commit_rxon(il, ctx);
2272 } 2271 }
2273 il4965_send_beacon_cmd(il); 2272 il4965_send_beacon_cmd(il);
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);
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index abfa388588be..ba801c7d9ad4 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -1171,17 +1171,6 @@ struct il_rxon_context {
1171 u32 interface_modes, exclusive_interface_modes; 1171 u32 interface_modes, exclusive_interface_modes;
1172 u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype; 1172 u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype;
1173 1173
1174 /*
1175 * We declare this const so it can only be
1176 * changed via explicit cast within the
1177 * routines that actually update the physical
1178 * hardware.
1179 */
1180 const struct il_rxon_cmd active;
1181 struct il_rxon_cmd staging;
1182
1183 struct il_rxon_time_cmd timing;
1184
1185 struct il_qos_info qos_data; 1174 struct il_qos_info qos_data;
1186 1175
1187 u8 bcast_sta_id, ap_sta_id; 1176 u8 bcast_sta_id, ap_sta_id;
@@ -1306,6 +1295,17 @@ struct il_priv {
1306 1295
1307 struct il_rxon_context ctx; 1296 struct il_rxon_context ctx;
1308 1297
1298 /*
1299 * We declare this const so it can only be
1300 * changed via explicit cast within the
1301 * routines that actually update the physical
1302 * hardware.
1303 */
1304 const struct il_rxon_cmd active;
1305 struct il_rxon_cmd staging;
1306
1307 struct il_rxon_time_cmd timing;
1308
1309 __le16 switch_channel; 1309 __le16 switch_channel;
1310 1310
1311 /* 1st responses from initialize and runtime uCode images. 1311 /* 1st responses from initialize and runtime uCode images.
@@ -1530,7 +1530,7 @@ il_rxon_ctx_from_vif(struct ieee80211_vif *vif)
1530static inline int 1530static inline int
1531il_is_associated(struct il_priv *il) 1531il_is_associated(struct il_priv *il)
1532{ 1532{
1533 return (il->ctx.active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; 1533 return (il->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
1534} 1534}
1535 1535
1536static inline int 1536static inline int
@@ -1540,12 +1540,6 @@ il_is_any_associated(struct il_priv *il)
1540} 1540}
1541 1541
1542static inline int 1542static inline int
1543il_is_associated_ctx(struct il_rxon_context *ctx)
1544{
1545 return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
1546}
1547
1548static inline int
1549il_is_channel_valid(const struct il_channel_info *ch_info) 1543il_is_channel_valid(const struct il_channel_info *ch_info)
1550{ 1544{
1551 if (ch_info == NULL) 1545 if (ch_info == NULL)
diff --git a/drivers/net/wireless/iwlegacy/debug.c b/drivers/net/wireless/iwlegacy/debug.c
index b1b8926a9c7b..6e3841beb1df 100644
--- a/drivers/net/wireless/iwlegacy/debug.c
+++ b/drivers/net/wireless/iwlegacy/debug.c
@@ -1153,7 +1153,7 @@ il_dbgfs_rxon_flags_read(struct file *file, char __user *user_buf,
1153 int len = 0; 1153 int len = 0;
1154 char buf[20]; 1154 char buf[20];
1155 1155
1156 len = sprintf(buf, "0x%04X\n", le32_to_cpu(il->ctx.active.flags)); 1156 len = sprintf(buf, "0x%04X\n", le32_to_cpu(il->active.flags));
1157 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 1157 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1158} 1158}
1159 1159
@@ -1167,7 +1167,7 @@ il_dbgfs_rxon_filter_flags_read(struct file *file, char __user *user_buf,
1167 char buf[20]; 1167 char buf[20];
1168 1168
1169 len = 1169 len =
1170 sprintf(buf, "0x%04X\n", le32_to_cpu(il->ctx.active.filter_flags)); 1170 sprintf(buf, "0x%04X\n", le32_to_cpu(il->active.filter_flags));
1171 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 1171 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1172} 1172}
1173 1173