aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-4965-sta.c11
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c204
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-debugfs.c28
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-scan.c20
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-sta.h22
-rw-r--r--drivers/net/wireless/iwlegacy/iwl3945-base.c4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl4965-base.c52
7 files changed, 127 insertions, 214 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
index 4cda277418f..337bf0c1c4c 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-sta.c
@@ -615,16 +615,7 @@ static int il4965_update_bcast_station(struct il_priv *il,
615 615
616int il4965_update_bcast_stations(struct il_priv *il) 616int il4965_update_bcast_stations(struct il_priv *il)
617{ 617{
618 struct il_rxon_context *ctx; 618 return il4965_update_bcast_station(il, &il->ctx);
619 int ret = 0;
620
621 for_each_context(il, ctx) {
622 ret = il4965_update_bcast_station(il, ctx);
623 if (ret)
624 break;
625 }
626
627 return ret;
628} 619}
629 620
630/** 621/**
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index de952fb0a96..bd222f50d26 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -646,10 +646,7 @@ static void _il_set_rxon_ht(struct il_priv *il,
646 646
647void il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf) 647void il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf)
648{ 648{
649 struct il_rxon_context *ctx; 649 _il_set_rxon_ht(il, ht_conf, &il->ctx);
650
651 for_each_context(il, ctx)
652 _il_set_rxon_ht(il, ht_conf, ctx);
653} 650}
654EXPORT_SYMBOL(il_set_rxon_ht); 651EXPORT_SYMBOL(il_set_rxon_ht);
655 652
@@ -661,7 +658,6 @@ u8 il_get_single_channel_number(struct il_priv *il,
661 int i; 658 int i;
662 u8 channel = 0; 659 u8 channel = 0;
663 u8 min, max; 660 u8 min, max;
664 struct il_rxon_context *ctx;
665 661
666 if (band == IEEE80211_BAND_5GHZ) { 662 if (band == IEEE80211_BAND_5GHZ) {
667 min = 14; 663 min = 14;
@@ -672,19 +668,10 @@ u8 il_get_single_channel_number(struct il_priv *il,
672 } 668 }
673 669
674 for (i = min; i < max; i++) { 670 for (i = min; i < max; i++) {
675 bool busy = false; 671 channel = il->channel_info[i].channel;
676 672 if (channel == le16_to_cpu(il->ctx.staging.channel))
677 for_each_context(il, ctx) {
678 busy = il->channel_info[i].channel ==
679 le16_to_cpu(ctx->staging.channel);
680 if (busy)
681 break;
682 }
683
684 if (busy)
685 continue; 673 continue;
686 674
687 channel = il->channel_info[i].channel;
688 ch_info = il_get_channel_info(il, band, channel); 675 ch_info = il_get_channel_info(il, band, channel);
689 if (il_is_channel_valid(ch_info)) 676 if (il_is_channel_valid(ch_info))
690 break; 677 break;
@@ -822,7 +809,6 @@ void il_set_rate(struct il_priv *il)
822{ 809{
823 const struct ieee80211_supported_band *hw = NULL; 810 const struct ieee80211_supported_band *hw = NULL;
824 struct ieee80211_rate *rate; 811 struct ieee80211_rate *rate;
825 struct il_rxon_context *ctx;
826 int i; 812 int i;
827 813
828 hw = il_get_hw_mode(il, il->band); 814 hw = il_get_hw_mode(il, il->band);
@@ -841,13 +827,11 @@ void il_set_rate(struct il_priv *il)
841 827
842 D_RATE("Set active_rate = %0x\n", il->active_rate); 828 D_RATE("Set active_rate = %0x\n", il->active_rate);
843 829
844 for_each_context(il, ctx) { 830 il->ctx.staging.cck_basic_rates =
845 ctx->staging.cck_basic_rates =
846 (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF; 831 (IL_CCK_BASIC_RATES_MASK >> IL_FIRST_CCK_RATE) & 0xF;
847 832
848 ctx->staging.ofdm_basic_rates = 833 il->ctx.staging.ofdm_basic_rates =
849 (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; 834 (IL_OFDM_BASIC_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF;
850 }
851} 835}
852EXPORT_SYMBOL(il_set_rate); 836EXPORT_SYMBOL(il_set_rate);
853 837
@@ -1254,7 +1238,6 @@ int il_mac_conf_tx(struct ieee80211_hw *hw,
1254 const struct ieee80211_tx_queue_params *params) 1238 const struct ieee80211_tx_queue_params *params)
1255{ 1239{
1256 struct il_priv *il = hw->priv; 1240 struct il_priv *il = hw->priv;
1257 struct il_rxon_context *ctx;
1258 unsigned long flags; 1241 unsigned long flags;
1259 int q; 1242 int q;
1260 1243
@@ -1274,17 +1257,15 @@ int il_mac_conf_tx(struct ieee80211_hw *hw,
1274 1257
1275 spin_lock_irqsave(&il->lock, flags); 1258 spin_lock_irqsave(&il->lock, flags);
1276 1259
1277 for_each_context(il, ctx) { 1260 il->ctx.qos_data.def_qos_parm.ac[q].cw_min =
1278 ctx->qos_data.def_qos_parm.ac[q].cw_min =
1279 cpu_to_le16(params->cw_min); 1261 cpu_to_le16(params->cw_min);
1280 ctx->qos_data.def_qos_parm.ac[q].cw_max = 1262 il->ctx.qos_data.def_qos_parm.ac[q].cw_max =
1281 cpu_to_le16(params->cw_max); 1263 cpu_to_le16(params->cw_max);
1282 ctx->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; 1264 il->ctx.qos_data.def_qos_parm.ac[q].aifsn = params->aifs;
1283 ctx->qos_data.def_qos_parm.ac[q].edca_txop = 1265 il->ctx.qos_data.def_qos_parm.ac[q].edca_txop =
1284 cpu_to_le16((params->txop * 32)); 1266 cpu_to_le16((params->txop * 32));
1285 1267
1286 ctx->qos_data.def_qos_parm.ac[q].reserved1 = 0; 1268 il->ctx.qos_data.def_qos_parm.ac[q].reserved1 = 0;
1287 }
1288 1269
1289 spin_unlock_irqrestore(&il->lock, flags); 1270 spin_unlock_irqrestore(&il->lock, flags);
1290 1271
@@ -1344,8 +1325,8 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1344{ 1325{
1345 struct il_priv *il = hw->priv; 1326 struct il_priv *il = hw->priv;
1346 struct il_vif_priv *vif_priv = (void *)vif->drv_priv; 1327 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
1347 struct il_rxon_context *tmp, *ctx = NULL;
1348 int err; 1328 int err;
1329 u32 modes;
1349 1330
1350 D_MAC80211("enter: type %d, addr %pM\n", 1331 D_MAC80211("enter: type %d, addr %pM\n",
1351 vif->type, vif->addr); 1332 vif->type, vif->addr);
@@ -1358,42 +1339,29 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1358 goto out; 1339 goto out;
1359 } 1340 }
1360 1341
1361 for_each_context(il, tmp) {
1362 u32 possible_modes =
1363 tmp->interface_modes | tmp->exclusive_interface_modes;
1364
1365 if (tmp->vif) {
1366 /* check if this busy context is exclusive */
1367 if (tmp->exclusive_interface_modes &
1368 BIT(tmp->vif->type)) {
1369 err = -EINVAL;
1370 goto out;
1371 }
1372 continue;
1373 }
1374 1342
1375 if (!(possible_modes & BIT(vif->type))) 1343 /* check if busy context is exclusive */
1376 continue; 1344 if (il->ctx.vif &&
1377 1345 (il->ctx.exclusive_interface_modes & BIT(il->ctx.vif->type))) {
1378 /* have maybe usable context w/o interface */ 1346 err = -EINVAL;
1379 ctx = tmp; 1347 goto out;
1380 break;
1381 } 1348 }
1382 1349
1383 if (!ctx) { 1350 modes = il->ctx.interface_modes | il->ctx.exclusive_interface_modes;
1351 if (!(modes & BIT(vif->type))) {
1384 err = -EOPNOTSUPP; 1352 err = -EOPNOTSUPP;
1385 goto out; 1353 goto out;
1386 } 1354 }
1387 1355
1388 vif_priv->ctx = ctx; 1356 vif_priv->ctx = &il->ctx;
1389 ctx->vif = vif; 1357 il->ctx.vif = vif;
1390 1358
1391 err = il_setup_interface(il, ctx); 1359 err = il_setup_interface(il, &il->ctx);
1392 if (!err) 1360 if (err) {
1393 goto out; 1361 il->ctx.vif = NULL;
1362 il->iw_mode = NL80211_IFTYPE_STATION;
1363 }
1394 1364
1395 ctx->vif = NULL;
1396 il->iw_mode = NL80211_IFTYPE_STATION;
1397 out: 1365 out:
1398 mutex_unlock(&il->mutex); 1366 mutex_unlock(&il->mutex);
1399 1367
@@ -1764,8 +1732,7 @@ il_mac_change_interface(struct ieee80211_hw *hw,
1764{ 1732{
1765 struct il_priv *il = hw->priv; 1733 struct il_priv *il = hw->priv;
1766 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif); 1734 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
1767 struct il_rxon_context *tmp; 1735 u32 modes;
1768 u32 interface_modes;
1769 int err; 1736 int err;
1770 1737
1771 newtype = ieee80211_iftype_p2p(newtype, newp2p); 1738 newtype = ieee80211_iftype_p2p(newtype, newp2p);
@@ -1781,28 +1748,16 @@ il_mac_change_interface(struct ieee80211_hw *hw,
1781 goto out; 1748 goto out;
1782 } 1749 }
1783 1750
1784 interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; 1751 modes = ctx->interface_modes | ctx->exclusive_interface_modes;
1785 1752 if (!(modes & BIT(newtype))) {
1786 if (!(interface_modes & BIT(newtype))) { 1753 err = -EOPNOTSUPP;
1787 err = -EBUSY;
1788 goto out; 1754 goto out;
1789 } 1755 }
1790 1756
1791 if (ctx->exclusive_interface_modes & BIT(newtype)) { 1757 if ((il->ctx.exclusive_interface_modes & BIT(il->ctx.vif->type)) ||
1792 for_each_context(il, tmp) { 1758 (il->ctx.exclusive_interface_modes & BIT(newtype))) {
1793 if (ctx == tmp) 1759 err = -EINVAL;
1794 continue; 1760 goto out;
1795
1796 if (!tmp->vif)
1797 continue;
1798
1799 /*
1800 * The current mode switch would be exclusive, but
1801 * another context is active ... refuse the switch.
1802 */
1803 err = -EBUSY;
1804 goto out;
1805 }
1806 } 1761 }
1807 1762
1808 /* success */ 1763 /* success */
@@ -2064,7 +2019,7 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed)
2064 struct ieee80211_conf *conf = &hw->conf; 2019 struct ieee80211_conf *conf = &hw->conf;
2065 struct ieee80211_channel *channel = conf->channel; 2020 struct ieee80211_channel *channel = conf->channel;
2066 struct il_ht_config *ht_conf = &il->current_ht_config; 2021 struct il_ht_config *ht_conf = &il->current_ht_config;
2067 struct il_rxon_context *ctx; 2022 struct il_rxon_context *ctx = &il->ctx;
2068 unsigned long flags = 0; 2023 unsigned long flags = 0;
2069 int ret = 0; 2024 int ret = 0;
2070 u16 ch; 2025 u16 ch;
@@ -2097,14 +2052,14 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed)
2097 * configured. 2052 * configured.
2098 */ 2053 */
2099 if (il->cfg->ops->hcmd->set_rxon_chain) 2054 if (il->cfg->ops->hcmd->set_rxon_chain)
2100 for_each_context(il, ctx) 2055 il->cfg->ops->hcmd->set_rxon_chain(il, &il->ctx);
2101 il->cfg->ops->hcmd->set_rxon_chain(il, ctx);
2102 } 2056 }
2103 2057
2104 /* during scanning mac80211 will delay channel setting until 2058 /* during scanning mac80211 will delay channel setting until
2105 * scan finish with changed = 0 2059 * scan finish with changed = 0
2106 */ 2060 */
2107 if (!changed || (changed & IEEE80211_CONF_CHANGE_CHANNEL)) { 2061 if (!changed || (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
2062
2108 if (scan_active) 2063 if (scan_active)
2109 goto set_ch_out; 2064 goto set_ch_out;
2110 2065
@@ -2125,48 +2080,46 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed)
2125 2080
2126 spin_lock_irqsave(&il->lock, flags); 2081 spin_lock_irqsave(&il->lock, flags);
2127 2082
2128 for_each_context(il, ctx) { 2083 /* Configure HT40 channels */
2129 /* Configure HT40 channels */ 2084 if (ctx->ht.enabled != conf_is_ht(conf)) {
2130 if (ctx->ht.enabled != conf_is_ht(conf)) { 2085 ctx->ht.enabled = conf_is_ht(conf);
2131 ctx->ht.enabled = conf_is_ht(conf); 2086 ht_changed = true;
2132 ht_changed = true; 2087 }
2133 } 2088 if (ctx->ht.enabled) {
2134 if (ctx->ht.enabled) { 2089 if (conf_is_ht40_minus(conf)) {
2135 if (conf_is_ht40_minus(conf)) { 2090 ctx->ht.extension_chan_offset =
2136 ctx->ht.extension_chan_offset = 2091 IEEE80211_HT_PARAM_CHA_SEC_BELOW;
2137 IEEE80211_HT_PARAM_CHA_SEC_BELOW; 2092 ctx->ht.is_40mhz = true;
2138 ctx->ht.is_40mhz = true; 2093 } else if (conf_is_ht40_plus(conf)) {
2139 } else if (conf_is_ht40_plus(conf)) { 2094 ctx->ht.extension_chan_offset =
2140 ctx->ht.extension_chan_offset = 2095 IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
2141 IEEE80211_HT_PARAM_CHA_SEC_ABOVE; 2096 ctx->ht.is_40mhz = true;
2142 ctx->ht.is_40mhz = true; 2097 } else {
2143 } else { 2098 ctx->ht.extension_chan_offset =
2144 ctx->ht.extension_chan_offset = 2099 IEEE80211_HT_PARAM_CHA_SEC_NONE;
2145 IEEE80211_HT_PARAM_CHA_SEC_NONE;
2146 ctx->ht.is_40mhz = false;
2147 }
2148 } else
2149 ctx->ht.is_40mhz = false; 2100 ctx->ht.is_40mhz = false;
2101 }
2102 } else
2103 ctx->ht.is_40mhz = false;
2150 2104
2151 /* 2105 /*
2152 * Default to no protection. Protection mode will 2106 * Default to no protection. Protection mode will
2153 * later be set from BSS config in il_ht_conf 2107 * later be set from BSS config in il_ht_conf
2154 */ 2108 */
2155 ctx->ht.protection = 2109 ctx->ht.protection =
2156 IEEE80211_HT_OP_MODE_PROTECTION_NONE; 2110 IEEE80211_HT_OP_MODE_PROTECTION_NONE;
2157 2111
2158 /* if we are switching from ht to 2.4 clear flags 2112 /* if we are switching from ht to 2.4 clear flags
2159 * from any ht related info since 2.4 does not 2113 * from any ht related info since 2.4 does not
2160 * support ht */ 2114 * support ht */
2161 if ((le16_to_cpu(ctx->staging.channel) != ch)) 2115 if ((le16_to_cpu(ctx->staging.channel) != ch))
2162 ctx->staging.flags = 0; 2116 ctx->staging.flags = 0;
2163 2117
2164 il_set_rxon_channel(il, channel, ctx); 2118 il_set_rxon_channel(il, channel, ctx);
2165 il_set_rxon_ht(il, ht_conf); 2119 il_set_rxon_ht(il, ht_conf);
2166 2120
2167 il_set_flags_for_band(il, ctx, channel->band, 2121 il_set_flags_for_band(il, ctx, channel->band,
2168 ctx->vif); 2122 ctx->vif);
2169 }
2170 2123
2171 spin_unlock_irqrestore(&il->lock, flags); 2124 spin_unlock_irqrestore(&il->lock, flags);
2172 2125
@@ -2203,15 +2156,12 @@ int il_mac_config(struct ieee80211_hw *hw, u32 changed)
2203 if (scan_active) 2156 if (scan_active)
2204 goto out; 2157 goto out;
2205 2158
2206 for_each_context(il, ctx) { 2159 if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging)))
2207 if (memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging))) 2160 il_commit_rxon(il, ctx);
2208 il_commit_rxon(il, ctx); 2161 else
2209 else 2162 D_INFO("Not re-sending same RXON configuration.\n");
2210 D_INFO( 2163 if (ht_changed)
2211 "Not re-sending same RXON configuration.\n"); 2164 il_update_qos(il, ctx);
2212 if (ht_changed)
2213 il_update_qos(il, ctx);
2214 }
2215 2165
2216out: 2166out:
2217 D_MAC80211("leave\n"); 2167 D_MAC80211("leave\n");
diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
index e8153b0dc5b..8448db7d8f3 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
@@ -599,26 +599,24 @@ il_dbgfs_qos_read(struct file *file, char __user *user_buf,
599 size_t count, loff_t *ppos) 599 size_t count, loff_t *ppos)
600{ 600{
601 struct il_priv *il = file->private_data; 601 struct il_priv *il = file->private_data;
602 struct il_rxon_context *ctx; 602 struct il_rxon_context *ctx = &il->ctx;
603 int pos = 0, i; 603 int pos = 0, i;
604 char buf[256]; 604 char buf[256];
605 const size_t bufsz = sizeof(buf); 605 const size_t bufsz = sizeof(buf);
606 606
607 for_each_context(il, ctx) { 607 pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n",
608 pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n", 608 ctx->ctxid);
609 ctx->ctxid); 609 for (i = 0; i < AC_NUM; i++) {
610 for (i = 0; i < AC_NUM; i++) { 610 pos += scnprintf(buf + pos, bufsz - pos,
611 pos += scnprintf(buf + pos, bufsz - pos, 611 "\tcw_min\tcw_max\taifsn\ttxop\n");
612 "\tcw_min\tcw_max\taifsn\ttxop\n"); 612 pos += scnprintf(buf + pos, bufsz - pos,
613 pos += scnprintf(buf + pos, bufsz - pos, 613 "AC[%d]\t%u\t%u\t%u\t%u\n", i,
614 "AC[%d]\t%u\t%u\t%u\t%u\n", i, 614 ctx->qos_data.def_qos_parm.ac[i].cw_min,
615 ctx->qos_data.def_qos_parm.ac[i].cw_min, 615 ctx->qos_data.def_qos_parm.ac[i].cw_max,
616 ctx->qos_data.def_qos_parm.ac[i].cw_max, 616 ctx->qos_data.def_qos_parm.ac[i].aifsn,
617 ctx->qos_data.def_qos_parm.ac[i].aifsn, 617 ctx->qos_data.def_qos_parm.ac[i].edca_txop);
618 ctx->qos_data.def_qos_parm.ac[i].edca_txop);
619 }
620 pos += scnprintf(buf + pos, bufsz - pos, "\n");
621 } 618 }
619
622 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 620 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
623} 621}
624 622
diff --git a/drivers/net/wireless/iwlegacy/iwl-scan.c b/drivers/net/wireless/iwlegacy/iwl-scan.c
index 71b2fac1b5d..18226d1988a 100644
--- a/drivers/net/wireless/iwlegacy/iwl-scan.c
+++ b/drivers/net/wireless/iwlegacy/iwl-scan.c
@@ -290,7 +290,9 @@ u16 il_get_passive_dwell_time(struct il_priv *il,
290 enum ieee80211_band band, 290 enum ieee80211_band band,
291 struct ieee80211_vif *vif) 291 struct ieee80211_vif *vif)
292{ 292{
293 struct il_rxon_context *ctx; 293 struct il_rxon_context *ctx = &il->ctx;
294 u16 value;
295
294 u16 passive = (band == IEEE80211_BAND_2GHZ) ? 296 u16 passive = (band == IEEE80211_BAND_2GHZ) ?
295 IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_24 : 297 IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_24 :
296 IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_52; 298 IL_PASSIVE_DWELL_BASE + IL_PASSIVE_DWELL_TIME_52;
@@ -301,17 +303,11 @@ u16 il_get_passive_dwell_time(struct il_priv *il,
301 * dwell time to be 98% of the smallest beacon interval 303 * dwell time to be 98% of the smallest beacon interval
302 * (minus 2 * channel tune time) 304 * (minus 2 * channel tune time)
303 */ 305 */
304 for_each_context(il, ctx) { 306 value = ctx->vif ? ctx->vif->bss_conf.beacon_int : 0;
305 u16 value; 307 if (value > IL_PASSIVE_DWELL_BASE || !value)
306 308 value = IL_PASSIVE_DWELL_BASE;
307 if (!il_is_associated_ctx(ctx)) 309 value = (value * 98) / 100 - IL_CHANNEL_TUNE_TIME * 2;
308 continue; 310 passive = min(value, passive);
309 value = ctx->vif ? ctx->vif->bss_conf.beacon_int : 0;
310 if (value > IL_PASSIVE_DWELL_BASE || !value)
311 value = IL_PASSIVE_DWELL_BASE;
312 value = (value * 98) / 100 - IL_CHANNEL_TUNE_TIME * 2;
313 passive = min(value, passive);
314 }
315 } 311 }
316 312
317 return passive; 313 return passive;
diff --git a/drivers/net/wireless/iwlegacy/iwl-sta.h b/drivers/net/wireless/iwlegacy/iwl-sta.h
index f07cd7f7b8a..afd3003f654 100644
--- a/drivers/net/wireless/iwlegacy/iwl-sta.h
+++ b/drivers/net/wireless/iwlegacy/iwl-sta.h
@@ -84,7 +84,7 @@ int il_send_lq_cmd(struct il_priv *il,
84static inline void il_clear_driver_stations(struct il_priv *il) 84static inline void il_clear_driver_stations(struct il_priv *il)
85{ 85{
86 unsigned long flags; 86 unsigned long flags;
87 struct il_rxon_context *ctx; 87 struct il_rxon_context *ctx = &il->ctx;
88 88
89 spin_lock_irqsave(&il->sta_lock, flags); 89 spin_lock_irqsave(&il->sta_lock, flags);
90 memset(il->stations, 0, sizeof(il->stations)); 90 memset(il->stations, 0, sizeof(il->stations));
@@ -92,17 +92,15 @@ static inline void il_clear_driver_stations(struct il_priv *il)
92 92
93 il->ucode_key_table = 0; 93 il->ucode_key_table = 0;
94 94
95 for_each_context(il, ctx) { 95 /*
96 /* 96 * Remove all key information that is not stored as part
97 * Remove all key information that is not stored as part 97 * of station information since mac80211 may not have had
98 * of station information since mac80211 may not have had 98 * a chance to remove all the keys. When device is
99 * a chance to remove all the keys. When device is 99 * reconfigured by mac80211 after an error all keys will
100 * reconfigured by mac80211 after an error all keys will 100 * be reconfigured.
101 * be reconfigured. 101 */
102 */ 102 memset(ctx->wep_keys, 0, sizeof(ctx->wep_keys));
103 memset(ctx->wep_keys, 0, sizeof(ctx->wep_keys)); 103 ctx->key_mapping_keys = 0;
104 ctx->key_mapping_keys = 0;
105 }
106 104
107 spin_unlock_irqrestore(&il->sta_lock, flags); 105 spin_unlock_irqrestore(&il->sta_lock, flags);
108} 106}
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 41104e72d29..151c8faa18d 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -2710,10 +2710,8 @@ static void il3945_bg_restart(struct work_struct *data)
2710 return; 2710 return;
2711 2711
2712 if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) { 2712 if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) {
2713 struct il_rxon_context *ctx;
2714 mutex_lock(&il->mutex); 2713 mutex_lock(&il->mutex);
2715 for_each_context(il, ctx) 2714 il->ctx.vif = NULL;
2716 ctx->vif = NULL;
2717 il->is_open = 0; 2715 il->is_open = 0;
2718 mutex_unlock(&il->mutex); 2716 mutex_unlock(&il->mutex);
2719 il3945_down(il); 2717 il3945_down(il);
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index 043d51e9d59..df86431d3ba 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -89,14 +89,10 @@ MODULE_ALIAS("iwl4965");
89 89
90void il4965_update_chain_flags(struct il_priv *il) 90void il4965_update_chain_flags(struct il_priv *il)
91{ 91{
92 struct il_rxon_context *ctx;
93
94 if (il->cfg->ops->hcmd->set_rxon_chain) { 92 if (il->cfg->ops->hcmd->set_rxon_chain) {
95 for_each_context(il, ctx) { 93 il->cfg->ops->hcmd->set_rxon_chain(il, &il->ctx);
96 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 94 if (il->ctx.active.rx_chain != il->ctx.staging.rx_chain)
97 if (ctx->active.rx_chain != ctx->staging.rx_chain) 95 il_commit_rxon(il, &il->ctx);
98 il_commit_rxon(il, ctx);
99 }
100 } 96 }
101} 97}
102 98
@@ -1766,10 +1762,8 @@ static void il4965_alive_start(struct il_priv *il)
1766 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 1762 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
1767 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1763 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1768 } else { 1764 } else {
1769 struct il_rxon_context *tmp;
1770 /* Initialize our rx_config data */ 1765 /* Initialize our rx_config data */
1771 for_each_context(il, tmp) 1766 il_connection_init_rx_config(il, &il->ctx);
1772 il_connection_init_rx_config(il, tmp);
1773 1767
1774 if (il->cfg->ops->hcmd->set_rxon_chain) 1768 if (il->cfg->ops->hcmd->set_rxon_chain)
1775 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 1769 il->cfg->ops->hcmd->set_rxon_chain(il, ctx);
@@ -1950,7 +1944,6 @@ static int il4965_prepare_card_hw(struct il_priv *il)
1950 1944
1951static int __il4965_up(struct il_priv *il) 1945static int __il4965_up(struct il_priv *il)
1952{ 1946{
1953 struct il_rxon_context *ctx;
1954 int i; 1947 int i;
1955 int ret; 1948 int ret;
1956 1949
@@ -1964,12 +1957,10 @@ static int __il4965_up(struct il_priv *il)
1964 return -EIO; 1957 return -EIO;
1965 } 1958 }
1966 1959
1967 for_each_context(il, ctx) { 1960 ret = il4965_alloc_bcast_station(il, &il->ctx);
1968 ret = il4965_alloc_bcast_station(il, ctx); 1961 if (ret) {
1969 if (ret) { 1962 il_dealloc_bcast_stations(il);
1970 il_dealloc_bcast_stations(il); 1963 return ret;
1971 return ret;
1972 }
1973 } 1964 }
1974 1965
1975 il4965_prepare_card_hw(il); 1966 il4965_prepare_card_hw(il);
@@ -2121,11 +2112,8 @@ static void il4965_bg_restart(struct work_struct *data)
2121 return; 2112 return;
2122 2113
2123 if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) { 2114 if (test_and_clear_bit(STATUS_FW_ERROR, &il->status)) {
2124 struct il_rxon_context *ctx;
2125
2126 mutex_lock(&il->mutex); 2115 mutex_lock(&il->mutex);
2127 for_each_context(il, ctx) 2116 il->ctx.vif = NULL;
2128 ctx->vif = NULL;
2129 il->is_open = 0; 2117 il->is_open = 0;
2130 2118
2131 __il4965_down(il); 2119 __il4965_down(il);
@@ -2177,7 +2165,6 @@ static int il4965_mac_setup_register(struct il_priv *il,
2177{ 2165{
2178 int ret; 2166 int ret;
2179 struct ieee80211_hw *hw = il->hw; 2167 struct ieee80211_hw *hw = il->hw;
2180 struct il_rxon_context *ctx;
2181 2168
2182 hw->rate_control_algorithm = "iwl-4965-rs"; 2169 hw->rate_control_algorithm = "iwl-4965-rs";
2183 2170
@@ -2195,10 +2182,8 @@ static int il4965_mac_setup_register(struct il_priv *il,
2195 hw->sta_data_size = sizeof(struct il_station_priv); 2182 hw->sta_data_size = sizeof(struct il_station_priv);
2196 hw->vif_data_size = sizeof(struct il_vif_priv); 2183 hw->vif_data_size = sizeof(struct il_vif_priv);
2197 2184
2198 for_each_context(il, ctx) { 2185 hw->wiphy->interface_modes |= il->ctx.interface_modes;
2199 hw->wiphy->interface_modes |= ctx->interface_modes; 2186 hw->wiphy->interface_modes |= il->ctx.exclusive_interface_modes;
2200 hw->wiphy->interface_modes |= ctx->exclusive_interface_modes;
2201 }
2202 2187
2203 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | 2188 hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY |
2204 WIPHY_FLAG_DISABLE_BEACON_HINTS; 2189 WIPHY_FLAG_DISABLE_BEACON_HINTS;
@@ -2590,7 +2575,6 @@ void il4965_configure_filter(struct ieee80211_hw *hw,
2590{ 2575{
2591 struct il_priv *il = hw->priv; 2576 struct il_priv *il = hw->priv;
2592 __le32 filter_or = 0, filter_nand = 0; 2577 __le32 filter_or = 0, filter_nand = 0;
2593 struct il_rxon_context *ctx;
2594 2578
2595#define CHK(test, flag) do { \ 2579#define CHK(test, flag) do { \
2596 if (*total_flags & (test)) \ 2580 if (*total_flags & (test)) \
@@ -2611,15 +2595,13 @@ void il4965_configure_filter(struct ieee80211_hw *hw,
2611 2595
2612 mutex_lock(&il->mutex); 2596 mutex_lock(&il->mutex);
2613 2597
2614 for_each_context(il, ctx) { 2598 il->ctx.staging.filter_flags &= ~filter_nand;
2615 ctx->staging.filter_flags &= ~filter_nand; 2599 il->ctx.staging.filter_flags |= filter_or;
2616 ctx->staging.filter_flags |= filter_or;
2617 2600
2618 /* 2601 /*
2619 * Not committing directly because hardware can perform a scan, 2602 * Not committing directly because hardware can perform a scan,
2620 * but we'll eventually commit the filter flags change anyway. 2603 * but we'll eventually commit the filter flags change anyway.
2621 */ 2604 */
2622 }
2623 2605
2624 mutex_unlock(&il->mutex); 2606 mutex_unlock(&il->mutex);
2625 2607