aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-23 04:46:40 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-08-27 12:15:20 -0400
commit8bd413e611d4324f17e54a2a89b4d09216c22a37 (patch)
tree64385ef0b39d6216bc5cacab03b68a18c90b92a5 /drivers/net/wireless
parentc90cbbbd78e45abbefd5e9e1c3c179d6126e3ddf (diff)
iwlwifi: move virtual interface pointer into context
iwlwifi occasionally needs to find the virtual interface pointer to give it to mac80211, but right now it only keeps one. Move it into the context so that we can keep one pointer each. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c17
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c48
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c7
10 files changed, 66 insertions, 38 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 0cfc7a605e3..d707f5bb1a8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -932,7 +932,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
932 932
933 rcu_read_lock(); 933 rcu_read_lock();
934 934
935 sta = ieee80211_find_sta(priv->vif, 935 sta = ieee80211_find_sta(priv->contexts[IWL_RXON_CTX_BSS].vif,
936 priv->stations[sta_id].sta.sta.addr); 936 priv->stations[sta_id].sta.sta.addr);
937 if (!sta) { 937 if (!sta) {
938 IWL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n"); 938 IWL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index c155816f811..1d6a46d4db5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1462,7 +1462,7 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv,
1462 u32 tsf_low; 1462 u32 tsf_low;
1463 u8 switch_count; 1463 u8 switch_count;
1464 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); 1464 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
1465 struct ieee80211_vif *vif = priv->vif; 1465 struct ieee80211_vif *vif = ctx->vif;
1466 band = priv->band == IEEE80211_BAND_2GHZ; 1466 band = priv->band == IEEE80211_BAND_2GHZ;
1467 1467
1468 is_ht40 = is_ht40_channel(ctx->staging.flags); 1468 is_ht40 = is_ht40_channel(ctx->staging.flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index d67031f080c..1dbb1246c08 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -287,7 +287,7 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv,
287 u32 tsf_low; 287 u32 tsf_low;
288 u8 switch_count; 288 u8 switch_count;
289 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); 289 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
290 struct ieee80211_vif *vif = priv->vif; 290 struct ieee80211_vif *vif = ctx->vif;
291 struct iwl_host_cmd hcmd = { 291 struct iwl_host_cmd hcmd = {
292 .id = REPLY_CHANNEL_SWITCH, 292 .id = REPLY_CHANNEL_SWITCH,
293 .len = sizeof(cmd), 293 .len = sizeof(cmd),
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 8c4a98b82e3..2fdba088bd2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -210,7 +210,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
210 u32 tsf_low; 210 u32 tsf_low;
211 u8 switch_count; 211 u8 switch_count;
212 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); 212 u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval);
213 struct ieee80211_vif *vif = priv->vif; 213 struct ieee80211_vif *vif = ctx->vif;
214 struct iwl_host_cmd hcmd = { 214 struct iwl_host_cmd hcmd = {
215 .id = REPLY_CHANNEL_SWITCH, 215 .id = REPLY_CHANNEL_SWITCH,
216 .len = sizeof(cmd), 216 .len = sizeof(cmd),
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index cb3c173e7c8..7002d7d0fac 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -1720,6 +1720,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work)
1720{ 1720{
1721 struct iwl_priv *priv = 1721 struct iwl_priv *priv =
1722 container_of(work, struct iwl_priv, bt_traffic_change_work); 1722 container_of(work, struct iwl_priv, bt_traffic_change_work);
1723 struct iwl_rxon_context *ctx;
1723 int smps_request = -1; 1724 int smps_request = -1;
1724 1725
1725 IWL_DEBUG_INFO(priv, "BT traffic load changes: %d\n", 1726 IWL_DEBUG_INFO(priv, "BT traffic load changes: %d\n",
@@ -1747,9 +1748,12 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work)
1747 if (priv->cfg->ops->lib->update_chain_flags) 1748 if (priv->cfg->ops->lib->update_chain_flags)
1748 priv->cfg->ops->lib->update_chain_flags(priv); 1749 priv->cfg->ops->lib->update_chain_flags(priv);
1749 1750
1750 if (smps_request != -1 && 1751 if (smps_request != -1) {
1751 priv->vif && priv->vif->type == NL80211_IFTYPE_STATION) 1752 for_each_context(priv, ctx) {
1752 ieee80211_request_smps(priv->vif, smps_request); 1753 if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION)
1754 ieee80211_request_smps(ctx->vif, smps_request);
1755 }
1756 }
1753 1757
1754 mutex_unlock(&priv->mutex); 1758 mutex_unlock(&priv->mutex);
1755} 1759}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index bff593ab094..64daddd9227 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -1120,6 +1120,9 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
1120 struct iwl_queue *q = &priv->txq[txq_id].q; 1120 struct iwl_queue *q = &priv->txq[txq_id].q;
1121 u8 *addr = priv->stations[sta_id].sta.sta.addr; 1121 u8 *addr = priv->stations[sta_id].sta.sta.addr;
1122 struct iwl_tid_data *tid_data = &priv->stations[sta_id].tid[tid]; 1122 struct iwl_tid_data *tid_data = &priv->stations[sta_id].tid[tid];
1123 struct iwl_rxon_context *ctx;
1124
1125 ctx = &priv->contexts[priv->stations[sta_id].ctxid];
1123 1126
1124 lockdep_assert_held(&priv->sta_lock); 1127 lockdep_assert_held(&priv->sta_lock);
1125 1128
@@ -1135,7 +1138,7 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
1135 priv->cfg->ops->lib->txq_agg_disable(priv, txq_id, 1138 priv->cfg->ops->lib->txq_agg_disable(priv, txq_id,
1136 ssn, tx_fifo); 1139 ssn, tx_fifo);
1137 tid_data->agg.state = IWL_AGG_OFF; 1140 tid_data->agg.state = IWL_AGG_OFF;
1138 ieee80211_stop_tx_ba_cb_irqsafe(priv->vif, addr, tid); 1141 ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid);
1139 } 1142 }
1140 break; 1143 break;
1141 case IWL_EMPTYING_HW_QUEUE_ADDBA: 1144 case IWL_EMPTYING_HW_QUEUE_ADDBA:
@@ -1143,7 +1146,7 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
1143 if (tid_data->tfds_in_queue == 0) { 1146 if (tid_data->tfds_in_queue == 0) {
1144 IWL_DEBUG_HT(priv, "HW queue empty: continue ADDBA flow\n"); 1147 IWL_DEBUG_HT(priv, "HW queue empty: continue ADDBA flow\n");
1145 tid_data->agg.state = IWL_AGG_ON; 1148 tid_data->agg.state = IWL_AGG_ON;
1146 ieee80211_start_tx_ba_cb_irqsafe(priv->vif, addr, tid); 1149 ieee80211_start_tx_ba_cb_irqsafe(ctx->vif, addr, tid);
1147 } 1150 }
1148 break; 1151 break;
1149 } 1152 }
@@ -1151,14 +1154,14 @@ int iwlagn_txq_check_empty(struct iwl_priv *priv,
1151 return 0; 1154 return 0;
1152} 1155}
1153 1156
1154static void iwlagn_tx_status(struct iwl_priv *priv, struct sk_buff *skb) 1157static void iwlagn_tx_status(struct iwl_priv *priv, struct iwl_tx_info *tx_info)
1155{ 1158{
1156 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1159 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx_info->skb->data;
1157 struct ieee80211_sta *sta; 1160 struct ieee80211_sta *sta;
1158 struct iwl_station_priv *sta_priv; 1161 struct iwl_station_priv *sta_priv;
1159 1162
1160 rcu_read_lock(); 1163 rcu_read_lock();
1161 sta = ieee80211_find_sta(priv->vif, hdr->addr1); 1164 sta = ieee80211_find_sta(tx_info->ctx->vif, hdr->addr1);
1162 if (sta) { 1165 if (sta) {
1163 sta_priv = (void *)sta->drv_priv; 1166 sta_priv = (void *)sta->drv_priv;
1164 /* avoid atomic ops if this isn't a client */ 1167 /* avoid atomic ops if this isn't a client */
@@ -1168,7 +1171,7 @@ static void iwlagn_tx_status(struct iwl_priv *priv, struct sk_buff *skb)
1168 } 1171 }
1169 rcu_read_unlock(); 1172 rcu_read_unlock();
1170 1173
1171 ieee80211_tx_status_irqsafe(priv->hw, skb); 1174 ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb);
1172} 1175}
1173 1176
1174int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) 1177int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
@@ -1191,7 +1194,7 @@ int iwlagn_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
1191 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 1194 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1192 1195
1193 tx_info = &txq->txb[txq->q.read_ptr]; 1196 tx_info = &txq->txb[txq->q.read_ptr];
1194 iwlagn_tx_status(priv, tx_info->skb); 1197 iwlagn_tx_status(priv, tx_info);
1195 1198
1196 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 1199 hdr = (struct ieee80211_hdr *)tx_info->skb->data;
1197 if (hdr && ieee80211_is_data_qos(hdr->frame_control)) 1200 if (hdr && ieee80211_is_data_qos(hdr->frame_control))
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 007dede7369..5e1df24bdb5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -603,7 +603,9 @@ static void iwl_bg_beacon_update(struct work_struct *work)
603 struct sk_buff *beacon; 603 struct sk_buff *beacon;
604 604
605 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ 605 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
606 beacon = ieee80211_beacon_get(priv->hw, priv->vif); 606#warning "introduce and use beacon context"
607 beacon = ieee80211_beacon_get(priv->hw,
608 priv->contexts[IWL_RXON_CTX_BSS].vif);
607 609
608 if (!beacon) { 610 if (!beacon) {
609 IWL_ERR(priv, "update beacon failed\n"); 611 IWL_ERR(priv, "update beacon failed\n");
@@ -3154,13 +3156,15 @@ static void iwl_bg_restart(struct work_struct *data)
3154 return; 3156 return;
3155 3157
3156 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { 3158 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
3159 struct iwl_rxon_context *ctx;
3157 bool bt_sco, bt_full_concurrent; 3160 bool bt_sco, bt_full_concurrent;
3158 u8 bt_ci_compliance; 3161 u8 bt_ci_compliance;
3159 u8 bt_load; 3162 u8 bt_load;
3160 u8 bt_status; 3163 u8 bt_status;
3161 3164
3162 mutex_lock(&priv->mutex); 3165 mutex_lock(&priv->mutex);
3163 priv->vif = NULL; 3166 for_each_context(priv, ctx)
3167 ctx->vif = NULL;
3164 priv->is_open = 0; 3168 priv->is_open = 0;
3165 3169
3166 /* 3170 /*
@@ -3838,7 +3842,7 @@ static void iwl_mac_channel_switch(struct ieee80211_hw *hw,
3838 iwl_set_rxon_channel(priv, channel, ctx); 3842 iwl_set_rxon_channel(priv, channel, ctx);
3839 iwl_set_rxon_ht(priv, ht_conf); 3843 iwl_set_rxon_ht(priv, ht_conf);
3840 iwl_set_flags_for_band(priv, ctx, channel->band, 3844 iwl_set_flags_for_band(priv, ctx, channel->band,
3841 priv->vif); 3845 ctx->vif);
3842 spin_unlock_irqrestore(&priv->lock, flags); 3846 spin_unlock_irqrestore(&priv->lock, flags);
3843 3847
3844 iwl_set_rate(priv); 3848 iwl_set_rate(priv);
@@ -3855,7 +3859,7 @@ out:
3855 mutex_unlock(&priv->mutex); 3859 mutex_unlock(&priv->mutex);
3856out_exit: 3860out_exit:
3857 if (!priv->switch_rxon.switch_in_progress) 3861 if (!priv->switch_rxon.switch_in_progress)
3858 ieee80211_chswitch_done(priv->vif, false); 3862 ieee80211_chswitch_done(ctx->vif, false);
3859 IWL_DEBUG_MAC80211(priv, "leave\n"); 3863 IWL_DEBUG_MAC80211(priv, "leave\n");
3860} 3864}
3861 3865
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index d5499db34eb..f9abcd80271 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1133,11 +1133,17 @@ EXPORT_SYMBOL(iwl_set_rate);
1133 1133
1134void iwl_chswitch_done(struct iwl_priv *priv, bool is_success) 1134void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
1135{ 1135{
1136 /*
1137 * MULTI-FIXME
1138 * See iwl_mac_channel_switch.
1139 */
1140 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1141
1136 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1142 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1137 return; 1143 return;
1138 1144
1139 if (priv->switch_rxon.switch_in_progress) { 1145 if (priv->switch_rxon.switch_in_progress) {
1140 ieee80211_chswitch_done(priv->vif, is_success); 1146 ieee80211_chswitch_done(ctx->vif, is_success);
1141 mutex_lock(&priv->mutex); 1147 mutex_lock(&priv->mutex);
1142 priv->switch_rxon.switch_in_progress = false; 1148 priv->switch_rxon.switch_in_progress = false;
1143 mutex_unlock(&priv->mutex); 1149 mutex_unlock(&priv->mutex);
@@ -1149,9 +1155,11 @@ void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
1149{ 1155{
1150 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1156 struct iwl_rx_packet *pkt = rxb_addr(rxb);
1151 struct iwl_csa_notification *csa = &(pkt->u.csa_notif); 1157 struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
1152#if !TODO 1158 /*
1159 * MULTI-FIXME
1160 * See iwl_mac_channel_switch.
1161 */
1153 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1162 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1154#endif
1155 struct iwl_rxon_cmd *rxon = (void *)&ctx->active; 1163 struct iwl_rxon_cmd *rxon = (void *)&ctx->active;
1156 1164
1157 if (priv->switch_rxon.switch_in_progress) { 1165 if (priv->switch_rxon.switch_in_progress) {
@@ -1735,7 +1743,9 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
1735 IWL_DEBUG_MAC80211(priv, "leave\n"); 1743 IWL_DEBUG_MAC80211(priv, "leave\n");
1736 spin_unlock_irqrestore(&priv->lock, flags); 1744 spin_unlock_irqrestore(&priv->lock, flags);
1737 1745
1738 priv->cfg->ops->lib->post_associate(priv, priv->vif); 1746#warning "use beacon context?"
1747 priv->cfg->ops->lib->post_associate(
1748 priv, priv->contexts[IWL_RXON_CTX_BSS].vif);
1739 1749
1740 return 0; 1750 return 0;
1741} 1751}
@@ -1927,6 +1937,7 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1927{ 1937{
1928 struct iwl_priv *priv = hw->priv; 1938 struct iwl_priv *priv = hw->priv;
1929 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv; 1939 struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
1940 struct iwl_rxon_context *ctx;
1930 int err = 0; 1941 int err = 0;
1931 1942
1932 IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", 1943 IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n",
@@ -1934,20 +1945,23 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1934 1945
1935 mutex_lock(&priv->mutex); 1946 mutex_lock(&priv->mutex);
1936 1947
1937 vif_priv->ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 1948 /* For now always use this context. */
1949 ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1950
1951 vif_priv->ctx = ctx;
1938 1952
1939 if (WARN_ON(!iwl_is_ready_rf(priv))) { 1953 if (WARN_ON(!iwl_is_ready_rf(priv))) {
1940 err = -EINVAL; 1954 err = -EINVAL;
1941 goto out; 1955 goto out;
1942 } 1956 }
1943 1957
1944 if (priv->vif) { 1958 if (ctx->vif) {
1945 IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n"); 1959 IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n");
1946 err = -EOPNOTSUPP; 1960 err = -EOPNOTSUPP;
1947 goto out; 1961 goto out;
1948 } 1962 }
1949 1963
1950 priv->vif = vif; 1964 ctx->vif = vif;
1951 priv->iw_mode = vif->type; 1965 priv->iw_mode = vif->type;
1952 1966
1953 err = iwl_set_mode(priv, vif); 1967 err = iwl_set_mode(priv, vif);
@@ -1967,7 +1981,7 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1967 goto out; 1981 goto out;
1968 1982
1969 out_err: 1983 out_err:
1970 priv->vif = NULL; 1984 ctx->vif = NULL;
1971 priv->iw_mode = NL80211_IFTYPE_STATION; 1985 priv->iw_mode = NL80211_IFTYPE_STATION;
1972 out: 1986 out:
1973 mutex_unlock(&priv->mutex); 1987 mutex_unlock(&priv->mutex);
@@ -1993,14 +2007,11 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw,
1993 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2007 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1994 iwlcore_commit_rxon(priv, ctx); 2008 iwlcore_commit_rxon(priv, ctx);
1995 } 2009 }
1996 if (priv->vif == vif) { 2010
1997 priv->vif = NULL; 2011 if (priv->scan_vif == vif) {
1998 if (priv->scan_vif == vif) { 2012 scan_completed = true;
1999 scan_completed = true; 2013 priv->scan_vif = NULL;
2000 priv->scan_vif = NULL; 2014 priv->scan_request = NULL;
2001 priv->scan_request = NULL;
2002 }
2003 memset(priv->bssid, 0, ETH_ALEN);
2004 } 2015 }
2005 2016
2006 /* 2017 /*
@@ -2013,6 +2024,9 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw,
2013 if (vif->type == NL80211_IFTYPE_ADHOC) 2024 if (vif->type == NL80211_IFTYPE_ADHOC)
2014 priv->bt_traffic_load = priv->notif_bt_traffic_load; 2025 priv->bt_traffic_load = priv->notif_bt_traffic_load;
2015 2026
2027 WARN_ON(ctx->vif != vif);
2028 ctx->vif = NULL;
2029 memset(priv->bssid, 0, ETH_ALEN);
2016 mutex_unlock(&priv->mutex); 2030 mutex_unlock(&priv->mutex);
2017 2031
2018 if (scan_completed) 2032 if (scan_completed)
@@ -2117,7 +2131,7 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2117 iwl_set_rxon_ht(priv, ht_conf); 2131 iwl_set_rxon_ht(priv, ht_conf);
2118 2132
2119 iwl_set_flags_for_band(priv, ctx, channel->band, 2133 iwl_set_flags_for_band(priv, ctx, channel->band,
2120 priv->vif); 2134 ctx->vif);
2121 } 2135 }
2122 2136
2123 spin_unlock_irqrestore(&priv->lock, flags); 2137 spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 90bf6b317fc..a332ec55f14 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1114,6 +1114,7 @@ enum iwl_rxon_context_id {
1114}; 1114};
1115 1115
1116struct iwl_rxon_context { 1116struct iwl_rxon_context {
1117 struct ieee80211_vif *vif;
1117 enum iwl_rxon_context_id ctxid; 1118 enum iwl_rxon_context_id ctxid;
1118 /* 1119 /*
1119 * We declare this const so it can only be 1120 * We declare this const so it can only be
@@ -1321,7 +1322,6 @@ struct iwl_priv {
1321 1322
1322 /* Last Rx'd beacon timestamp */ 1323 /* Last Rx'd beacon timestamp */
1323 u64 timestamp; 1324 u64 timestamp;
1324 struct ieee80211_vif *vif;
1325 1325
1326 union { 1326 union {
1327#if defined(CONFIG_IWL3945) || defined(CONFIG_IWL3945_MODULE) 1327#if defined(CONFIG_IWL3945) || defined(CONFIG_IWL3945_MODULE)
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index aef5f812c7e..6b562957058 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -802,7 +802,8 @@ static void iwl3945_bg_beacon_update(struct work_struct *work)
802 struct sk_buff *beacon; 802 struct sk_buff *beacon;
803 803
804 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ 804 /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
805 beacon = ieee80211_beacon_get(priv->hw, priv->vif); 805 beacon = ieee80211_beacon_get(priv->hw,
806 priv->contexts[IWL_RXON_CTX_BSS].vif);
806 807
807 if (!beacon) { 808 if (!beacon) {
808 IWL_ERR(priv, "update beacon failed\n"); 809 IWL_ERR(priv, "update beacon failed\n");
@@ -3048,8 +3049,10 @@ static void iwl3945_bg_restart(struct work_struct *data)
3048 return; 3049 return;
3049 3050
3050 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { 3051 if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
3052 struct iwl_rxon_context *ctx;
3051 mutex_lock(&priv->mutex); 3053 mutex_lock(&priv->mutex);
3052 priv->vif = NULL; 3054 for_each_context(priv, ctx)
3055 ctx->vif = NULL;
3053 priv->is_open = 0; 3056 priv->is_open = 0;
3054 mutex_unlock(&priv->mutex); 3057 mutex_unlock(&priv->mutex);
3055 iwl3945_down(priv); 3058 iwl3945_down(priv);