aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2012-02-03 11:31:57 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-06 14:56:11 -0500
commit83007196037cc2d0bffd9f7afbe56d675779a6cb (patch)
treeb123ce53f42ea20eb0ea53803bf9f259f019823d
parent20c47eba7001680e62878c5b20e487a8b0b873ad (diff)
iwlegacy: get rid of ctx structure
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlegacy/3945-mac.c67
-rw-r--r--drivers/net/wireless/iwlegacy/3945-rs.c3
-rw-r--r--drivers/net/wireless/iwlegacy/3945.c23
-rw-r--r--drivers/net/wireless/iwlegacy/3945.h2
-rw-r--r--drivers/net/wireless/iwlegacy/4965-mac.c150
-rw-r--r--drivers/net/wireless/iwlegacy/4965-rs.c35
-rw-r--r--drivers/net/wireless/iwlegacy/4965.c62
-rw-r--r--drivers/net/wireless/iwlegacy/4965.h19
-rw-r--r--drivers/net/wireless/iwlegacy/common.c199
-rw-r--r--drivers/net/wireless/iwlegacy/common.h79
10 files changed, 261 insertions, 378 deletions
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 7c81f5aaf7a3..b2e04c591c6e 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -341,7 +341,7 @@ il3945_send_beacon_cmd(struct il_priv *il)
341 return -ENOMEM; 341 return -ENOMEM;
342 } 342 }
343 343
344 rate = il_get_lowest_plcp(il, &il->ctx); 344 rate = il_get_lowest_plcp(il);
345 345
346 frame_size = il3945_hw_get_beacon_cmd(il, frame, rate); 346 frame_size = il3945_hw_get_beacon_cmd(il, frame, rate);
347 347
@@ -512,7 +512,7 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
512 hdr_len = ieee80211_hdrlen(fc); 512 hdr_len = ieee80211_hdrlen(fc);
513 513
514 /* Find idx into station table for destination station */ 514 /* Find idx into station table for destination station */
515 sta_id = il_sta_id_or_broadcast(il, &il->ctx, info->control.sta); 515 sta_id = il_sta_id_or_broadcast(il, info->control.sta);
516 if (sta_id == IL_INVALID_STATION) { 516 if (sta_id == IL_INVALID_STATION) {
517 D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1); 517 D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1);
518 goto drop; 518 goto drop;
@@ -541,7 +541,6 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
541 /* Set up driver data for this TFD */ 541 /* Set up driver data for this TFD */
542 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info)); 542 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info));
543 txq->txb[q->write_ptr].skb = skb; 543 txq->txb[q->write_ptr].skb = skb;
544 txq->txb[q->write_ptr].ctx = &il->ctx;
545 544
546 /* Init first empty entry in queue's array of Tx/cmd buffers */ 545 /* Init first empty entry in queue's array of Tx/cmd buffers */
547 out_cmd = txq->cmd[idx]; 546 out_cmd = txq->cmd[idx];
@@ -2208,7 +2207,7 @@ il3945_alive_start(struct il_priv *il)
2208 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2207 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2209 } else { 2208 } else {
2210 /* Initialize our rx_config data */ 2209 /* Initialize our rx_config data */
2211 il_connection_init_rx_config(il, &il->ctx); 2210 il_connection_init_rx_config(il);
2212 } 2211 }
2213 2212
2214 /* Configure Bluetooth device coexistence support */ 2213 /* Configure Bluetooth device coexistence support */
@@ -2217,7 +2216,7 @@ il3945_alive_start(struct il_priv *il)
2217 set_bit(S_READY, &il->status); 2216 set_bit(S_READY, &il->status);
2218 2217
2219 /* Configure the adapter for unassociated operation */ 2218 /* Configure the adapter for unassociated operation */
2220 il3945_commit_rxon(il, &il->ctx); 2219 il3945_commit_rxon(il);
2221 2220
2222 il3945_reg_txpower_periodic(il); 2221 il3945_reg_txpower_periodic(il);
2223 2222
@@ -2249,7 +2248,7 @@ __il3945_down(struct il_priv *il)
2249 del_timer_sync(&il->watchdog); 2248 del_timer_sync(&il->watchdog);
2250 2249
2251 /* Station information will now be cleared in device */ 2250 /* Station information will now be cleared in device */
2252 il_clear_ucode_stations(il, NULL); 2251 il_clear_ucode_stations(il);
2253 il_dealloc_bcast_stations(il); 2252 il_dealloc_bcast_stations(il);
2254 il_clear_driver_stations(il); 2253 il_clear_driver_stations(il);
2255 2254
@@ -2335,12 +2334,11 @@ il3945_down(struct il_priv *il)
2335static int 2334static int
2336il3945_alloc_bcast_station(struct il_priv *il) 2335il3945_alloc_bcast_station(struct il_priv *il)
2337{ 2336{
2338 struct il_rxon_context *ctx = &il->ctx;
2339 unsigned long flags; 2337 unsigned long flags;
2340 u8 sta_id; 2338 u8 sta_id;
2341 2339
2342 spin_lock_irqsave(&il->sta_lock, flags); 2340 spin_lock_irqsave(&il->sta_lock, flags);
2343 sta_id = il_prep_station(il, ctx, il_bcast_addr, false, NULL); 2341 sta_id = il_prep_station(il, il_bcast_addr, false, NULL);
2344 if (sta_id == IL_INVALID_STATION) { 2342 if (sta_id == IL_INVALID_STATION) {
2345 IL_ERR("Unable to prepare broadcast station\n"); 2343 IL_ERR("Unable to prepare broadcast station\n");
2346 spin_unlock_irqrestore(&il->sta_lock, flags); 2344 spin_unlock_irqrestore(&il->sta_lock, flags);
@@ -2660,14 +2658,12 @@ il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
2660void 2658void
2661il3945_post_scan(struct il_priv *il) 2659il3945_post_scan(struct il_priv *il)
2662{ 2660{
2663 struct il_rxon_context *ctx = &il->ctx;
2664
2665 /* 2661 /*
2666 * Since setting the RXON may have been deferred while 2662 * Since setting the RXON may have been deferred while
2667 * performing the scan, fire one off if needed 2663 * performing the scan, fire one off if needed
2668 */ 2664 */
2669 if (memcmp(&il->staging, &il->active, sizeof(il->staging))) 2665 if (memcmp(&il->staging, &il->active, sizeof(il->staging)))
2670 il3945_commit_rxon(il, ctx); 2666 il3945_commit_rxon(il);
2671} 2667}
2672 2668
2673static void 2669static void
@@ -2680,7 +2676,8 @@ il3945_bg_restart(struct work_struct *data)
2680 2676
2681 if (test_and_clear_bit(S_FW_ERROR, &il->status)) { 2677 if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
2682 mutex_lock(&il->mutex); 2678 mutex_lock(&il->mutex);
2683 il->ctx.vif = NULL; 2679 /* FIXME: vif can be dereferenced */
2680 il->vif = NULL;
2684 il->is_open = 0; 2681 il->is_open = 0;
2685 mutex_unlock(&il->mutex); 2682 mutex_unlock(&il->mutex);
2686 il3945_down(il); 2683 il3945_down(il);
@@ -2718,12 +2715,11 @@ il3945_post_associate(struct il_priv *il)
2718{ 2715{
2719 int rc = 0; 2716 int rc = 0;
2720 struct ieee80211_conf *conf = NULL; 2717 struct ieee80211_conf *conf = NULL;
2721 struct il_rxon_context *ctx = &il->ctx;
2722 2718
2723 if (!ctx->vif || !il->is_open) 2719 if (!il->vif || !il->is_open)
2724 return; 2720 return;
2725 2721
2726 D_ASSOC("Associated as %d to: %pM\n", ctx->vif->bss_conf.aid, 2722 D_ASSOC("Associated as %d to: %pM\n", il->vif->bss_conf.aid,
2727 il->active.bssid_addr); 2723 il->active.bssid_addr);
2728 2724
2729 if (test_bit(S_EXIT_PENDING, &il->status)) 2725 if (test_bit(S_EXIT_PENDING, &il->status))
@@ -2734,34 +2730,34 @@ il3945_post_associate(struct il_priv *il)
2734 conf = &il->hw->conf; 2730 conf = &il->hw->conf;
2735 2731
2736 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2732 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2737 il3945_commit_rxon(il, ctx); 2733 il3945_commit_rxon(il);
2738 2734
2739 rc = il_send_rxon_timing(il, ctx); 2735 rc = il_send_rxon_timing(il);
2740 if (rc) 2736 if (rc)
2741 IL_WARN("C_RXON_TIMING failed - " "Attempting to continue.\n"); 2737 IL_WARN("C_RXON_TIMING failed - " "Attempting to continue.\n");
2742 2738
2743 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2739 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2744 2740
2745 il->staging.assoc_id = cpu_to_le16(ctx->vif->bss_conf.aid); 2741 il->staging.assoc_id = cpu_to_le16(il->vif->bss_conf.aid);
2746 2742
2747 D_ASSOC("assoc id %d beacon interval %d\n", ctx->vif->bss_conf.aid, 2743 D_ASSOC("assoc id %d beacon interval %d\n", il->vif->bss_conf.aid,
2748 ctx->vif->bss_conf.beacon_int); 2744 il->vif->bss_conf.beacon_int);
2749 2745
2750 if (ctx->vif->bss_conf.use_short_preamble) 2746 if (il->vif->bss_conf.use_short_preamble)
2751 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; 2747 il->staging.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
2752 else 2748 else
2753 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; 2749 il->staging.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
2754 2750
2755 if (il->staging.flags & RXON_FLG_BAND_24G_MSK) { 2751 if (il->staging.flags & RXON_FLG_BAND_24G_MSK) {
2756 if (ctx->vif->bss_conf.use_short_slot) 2752 if (il->vif->bss_conf.use_short_slot)
2757 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; 2753 il->staging.flags |= RXON_FLG_SHORT_SLOT_MSK;
2758 else 2754 else
2759 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 2755 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
2760 } 2756 }
2761 2757
2762 il3945_commit_rxon(il, ctx); 2758 il3945_commit_rxon(il);
2763 2759
2764 switch (ctx->vif->type) { 2760 switch (il->vif->type) {
2765 case NL80211_IFTYPE_STATION: 2761 case NL80211_IFTYPE_STATION:
2766 il3945_rate_scale_init(il->hw, IL_AP_ID); 2762 il3945_rate_scale_init(il->hw, IL_AP_ID);
2767 break; 2763 break;
@@ -2770,7 +2766,7 @@ il3945_post_associate(struct il_priv *il)
2770 break; 2766 break;
2771 default: 2767 default:
2772 IL_ERR("%s Should not be called in %d mode\n", __func__, 2768 IL_ERR("%s Should not be called in %d mode\n", __func__,
2773 ctx->vif->type); 2769 il->vif->type);
2774 break; 2770 break;
2775 } 2771 }
2776} 2772}
@@ -2887,8 +2883,7 @@ il3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2887void 2883void
2888il3945_config_ap(struct il_priv *il) 2884il3945_config_ap(struct il_priv *il)
2889{ 2885{
2890 struct il_rxon_context *ctx = &il->ctx; 2886 struct ieee80211_vif *vif = il->vif;
2891 struct ieee80211_vif *vif = ctx->vif;
2892 int rc = 0; 2887 int rc = 0;
2893 2888
2894 if (test_bit(S_EXIT_PENDING, &il->status)) 2889 if (test_bit(S_EXIT_PENDING, &il->status))
@@ -2899,10 +2894,10 @@ il3945_config_ap(struct il_priv *il)
2899 2894
2900 /* RXON - unassoc (to set timing command) */ 2895 /* RXON - unassoc (to set timing command) */
2901 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2896 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2902 il3945_commit_rxon(il, ctx); 2897 il3945_commit_rxon(il);
2903 2898
2904 /* RXON Timing */ 2899 /* RXON Timing */
2905 rc = il_send_rxon_timing(il, ctx); 2900 rc = il_send_rxon_timing(il);
2906 if (rc) 2901 if (rc)
2907 IL_WARN("C_RXON_TIMING failed - " 2902 IL_WARN("C_RXON_TIMING failed - "
2908 "Attempting to continue.\n"); 2903 "Attempting to continue.\n");
@@ -2922,7 +2917,7 @@ il3945_config_ap(struct il_priv *il)
2922 } 2917 }
2923 /* restore RXON assoc */ 2918 /* restore RXON assoc */
2924 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2919 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2925 il3945_commit_rxon(il, ctx); 2920 il3945_commit_rxon(il);
2926 } 2921 }
2927 il3945_send_beacon_cmd(il); 2922 il3945_send_beacon_cmd(il);
2928} 2923}
@@ -2955,7 +2950,7 @@ il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2955 static_key = !il_is_associated(il); 2950 static_key = !il_is_associated(il);
2956 2951
2957 if (!static_key) { 2952 if (!static_key) {
2958 sta_id = il_sta_id_or_broadcast(il, &il->ctx, sta); 2953 sta_id = il_sta_id_or_broadcast(il, sta);
2959 if (sta_id == IL_INVALID_STATION) 2954 if (sta_id == IL_INVALID_STATION)
2960 return -EINVAL; 2955 return -EINVAL;
2961 } 2956 }
@@ -3003,8 +2998,7 @@ il3945_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
3003 D_INFO("proceeding to add station %pM\n", sta->addr); 2998 D_INFO("proceeding to add station %pM\n", sta->addr);
3004 sta_priv->common.sta_id = IL_INVALID_STATION; 2999 sta_priv->common.sta_id = IL_INVALID_STATION;
3005 3000
3006 ret = 3001 ret = il_add_station_common(il, sta->addr, is_ap, sta, &sta_id);
3007 il_add_station_common(il, &il->ctx, sta->addr, is_ap, sta, &sta_id);
3008 if (ret) { 3002 if (ret) {
3009 IL_ERR("Unable to add station %pM (%d)\n", sta->addr, ret); 3003 IL_ERR("Unable to add station %pM (%d)\n", sta->addr, ret);
3010 /* Should we return success if return code is EEXIST ? */ 3004 /* Should we return success if return code is EEXIST ? */
@@ -3184,7 +3178,7 @@ il3945_store_flags(struct device *d, struct device_attribute *attr,
3184 else { 3178 else {
3185 D_INFO("Committing rxon.flags = 0x%04X\n", flags); 3179 D_INFO("Committing rxon.flags = 0x%04X\n", flags);
3186 il->staging.flags = cpu_to_le32(flags); 3180 il->staging.flags = cpu_to_le32(flags);
3187 il3945_commit_rxon(il, &il->ctx); 3181 il3945_commit_rxon(il);
3188 } 3182 }
3189 } 3183 }
3190 mutex_unlock(&il->mutex); 3184 mutex_unlock(&il->mutex);
@@ -3220,7 +3214,7 @@ il3945_store_filter_flags(struct device *d, struct device_attribute *attr,
3220 D_INFO("Committing rxon.filter_flags = " "0x%04X\n", 3214 D_INFO("Committing rxon.filter_flags = " "0x%04X\n",
3221 filter_flags); 3215 filter_flags);
3222 il->staging.filter_flags = cpu_to_le32(filter_flags); 3216 il->staging.filter_flags = cpu_to_le32(filter_flags);
3223 il3945_commit_rxon(il, &il->ctx); 3217 il3945_commit_rxon(il);
3224 } 3218 }
3225 } 3219 }
3226 mutex_unlock(&il->mutex); 3220 mutex_unlock(&il->mutex);
@@ -3750,8 +3744,7 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3750 goto out_release_irq; 3744 goto out_release_irq;
3751 } 3745 }
3752 3746
3753 il_set_rxon_channel(il, &il->bands[IEEE80211_BAND_2GHZ].channels[5], 3747 il_set_rxon_channel(il, &il->bands[IEEE80211_BAND_2GHZ].channels[5]);
3754 &il->ctx);
3755 il3945_setup_deferred_work(il); 3748 il3945_setup_deferred_work(il);
3756 il3945_setup_handlers(il); 3749 il3945_setup_handlers(il);
3757 il_power_initialize(il); 3750 il_power_initialize(il);
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c
index 6a782b5c0c5f..70bee1a4d876 100644
--- a/drivers/net/wireless/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/iwlegacy/3945-rs.c
@@ -927,8 +927,7 @@ il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
927 927
928 rcu_read_lock(); 928 rcu_read_lock();
929 929
930 sta = 930 sta = ieee80211_find_sta(il->vif, il->stations[sta_id].sta.sta.addr);
931 ieee80211_find_sta(il->ctx.vif, il->stations[sta_id].sta.sta.addr);
932 if (!sta) { 931 if (!sta) {
933 D_RATE("Unable to find station to initialize rate scaling.\n"); 932 D_RATE("Unable to find station to initialize rate scaling.\n");
934 rcu_read_unlock(); 933 rcu_read_unlock();
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c
index 3024645a6be9..1e617c9fc3cc 100644
--- a/drivers/net/wireless/iwlegacy/3945.c
+++ b/drivers/net/wireless/iwlegacy/3945.c
@@ -1662,7 +1662,7 @@ il3945_hw_reg_set_txpower(struct il_priv *il, s8 power)
1662} 1662}
1663 1663
1664static int 1664static int
1665il3945_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx) 1665il3945_send_rxon_assoc(struct il_priv *il)
1666{ 1666{
1667 int rc = 0; 1667 int rc = 0;
1668 struct il_rx_pkt *pkt; 1668 struct il_rx_pkt *pkt;
@@ -1714,7 +1714,7 @@ il3945_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx)
1714 * a HW tune is required based on the RXON structure changes. 1714 * a HW tune is required based on the RXON structure changes.
1715 */ 1715 */
1716int 1716int
1717il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx) 1717il3945_commit_rxon(struct il_priv *il)
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 *)&il->active; 1720 struct il3945_rxon_cmd *active_rxon = (void *)&il->active;
@@ -1735,7 +1735,7 @@ il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1735 staging_rxon->flags &= ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); 1735 staging_rxon->flags &= ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
1736 staging_rxon->flags |= il3945_get_antenna_flags(il); 1736 staging_rxon->flags |= il3945_get_antenna_flags(il);
1737 1737
1738 rc = il_check_rxon_cmd(il, ctx); 1738 rc = il_check_rxon_cmd(il);
1739 if (rc) { 1739 if (rc) {
1740 IL_ERR("Invalid RXON configuration. Not committing.\n"); 1740 IL_ERR("Invalid RXON configuration. Not committing.\n");
1741 return -EINVAL; 1741 return -EINVAL;
@@ -1744,8 +1744,8 @@ il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1744 /* If we don't need to send a full RXON, we can use 1744 /* If we don't need to send a full RXON, we can use
1745 * il3945_rxon_assoc_cmd which is used to reconfigure filter 1745 * il3945_rxon_assoc_cmd which is used to reconfigure filter
1746 * and other flags for the current radio configuration. */ 1746 * and other flags for the current radio configuration. */
1747 if (!il_full_rxon_required(il, &il->ctx)) { 1747 if (!il_full_rxon_required(il)) {
1748 rc = il_send_rxon_assoc(il, &il->ctx); 1748 rc = il_send_rxon_assoc(il);
1749 if (rc) { 1749 if (rc) {
1750 IL_ERR("Error setting RXON_ASSOC " 1750 IL_ERR("Error setting RXON_ASSOC "
1751 "configuration (%d).\n", rc); 1751 "configuration (%d).\n", rc);
@@ -1786,8 +1786,8 @@ il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1786 "configuration (%d).\n", rc); 1786 "configuration (%d).\n", rc);
1787 return rc; 1787 return rc;
1788 } 1788 }
1789 il_clear_ucode_stations(il, &il->ctx); 1789 il_clear_ucode_stations(il);
1790 il_restore_stations(il, &il->ctx); 1790 il_restore_stations(il);
1791 } 1791 }
1792 1792
1793 D_INFO("Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n" 1793 D_INFO("Sending RXON\n" "* with%s RXON_FILTER_ASSOC_MSK\n"
@@ -1801,7 +1801,7 @@ il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1801 staging_rxon->reserved4 = 0; 1801 staging_rxon->reserved4 = 0;
1802 staging_rxon->reserved5 = 0; 1802 staging_rxon->reserved5 = 0;
1803 1803
1804 il_set_rxon_hwcrypto(il, ctx, !il3945_mod_params.sw_crypto); 1804 il_set_rxon_hwcrypto(il, !il3945_mod_params.sw_crypto);
1805 1805
1806 /* Apply the new configuration */ 1806 /* Apply the new configuration */
1807 rc = il_send_cmd_pdu(il, C_RXON, sizeof(struct il3945_rxon_cmd), 1807 rc = il_send_cmd_pdu(il, C_RXON, sizeof(struct il3945_rxon_cmd),
@@ -1814,8 +1814,8 @@ il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1814 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); 1814 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
1815 1815
1816 if (!new_assoc) { 1816 if (!new_assoc) {
1817 il_clear_ucode_stations(il, &il->ctx); 1817 il_clear_ucode_stations(il);
1818 il_restore_stations(il, &il->ctx); 1818 il_restore_stations(il);
1819 } 1819 }
1820 1820
1821 /* If we issue a new RXON command which required a tune then we must 1821 /* If we issue a new RXON command which required a tune then we must
@@ -2258,7 +2258,6 @@ il3945_build_addsta_hcmd(const struct il_addsta_cmd *cmd, u8 * data)
2258static int 2258static int
2259il3945_add_bssid_station(struct il_priv *il, const u8 * addr, u8 * sta_id_r) 2259il3945_add_bssid_station(struct il_priv *il, const u8 * addr, u8 * sta_id_r)
2260{ 2260{
2261 struct il_rxon_context *ctx = &il->ctx;
2262 int ret; 2261 int ret;
2263 u8 sta_id; 2262 u8 sta_id;
2264 unsigned long flags; 2263 unsigned long flags;
@@ -2266,7 +2265,7 @@ il3945_add_bssid_station(struct il_priv *il, const u8 * addr, u8 * sta_id_r)
2266 if (sta_id_r) 2265 if (sta_id_r)
2267 *sta_id_r = IL_INVALID_STATION; 2266 *sta_id_r = IL_INVALID_STATION;
2268 2267
2269 ret = il_add_station_common(il, ctx, addr, 0, NULL, &sta_id); 2268 ret = il_add_station_common(il, addr, 0, NULL, &sta_id);
2270 if (ret) { 2269 if (ret) {
2271 IL_ERR("Unable to add station %pM\n", addr); 2270 IL_ERR("Unable to add station %pM\n", addr);
2272 return ret; 2271 return ret;
diff --git a/drivers/net/wireless/iwlegacy/3945.h b/drivers/net/wireless/iwlegacy/3945.h
index 9f42f79f8778..8bee127d413d 100644
--- a/drivers/net/wireless/iwlegacy/3945.h
+++ b/drivers/net/wireless/iwlegacy/3945.h
@@ -249,7 +249,7 @@ extern int il4965_get_temperature(const struct il_priv *il);
249extern void il3945_post_associate(struct il_priv *il); 249extern void il3945_post_associate(struct il_priv *il);
250extern void il3945_config_ap(struct il_priv *il); 250extern void il3945_config_ap(struct il_priv *il);
251 251
252extern int il3945_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx); 252extern int il3945_commit_rxon(struct il_priv *il);
253 253
254/** 254/**
255 * il3945_hw_find_station - Find station id for a given BSSID 255 * il3945_hw_find_station - Find station id for a given BSSID
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 1a54c1a812dd..4be53cc91981 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -843,7 +843,6 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
843 .flags = CMD_SIZE_HUGE, 843 .flags = CMD_SIZE_HUGE,
844 }; 844 };
845 struct il_scan_cmd *scan; 845 struct il_scan_cmd *scan;
846 struct il_rxon_context *ctx = &il->ctx;
847 u32 rate_flags = 0; 846 u32 rate_flags = 0;
848 u16 cmd_len; 847 u16 cmd_len;
849 u16 rx_chain = 0; 848 u16 rx_chain = 0;
@@ -859,8 +858,6 @@ il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif)
859 858
860 lockdep_assert_held(&il->mutex); 859 lockdep_assert_held(&il->mutex);
861 860
862 ctx = il_rxon_ctx_from_vif(vif);
863
864 if (!il->scan_cmd) { 861 if (!il->scan_cmd) {
865 il->scan_cmd = 862 il->scan_cmd =
866 kmalloc(sizeof(struct il_scan_cmd) + IL_MAX_SCAN_SIZE, 863 kmalloc(sizeof(struct il_scan_cmd) + IL_MAX_SCAN_SIZE,
@@ -1033,8 +1030,7 @@ il4965_manage_ibss_station(struct il_priv *il, struct ieee80211_vif *vif,
1033 struct il_vif_priv *vif_priv = (void *)vif->drv_priv; 1030 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
1034 1031
1035 if (add) 1032 if (add)
1036 return il4965_add_bssid_station(il, vif_priv->ctx, 1033 return il4965_add_bssid_station(il, vif->bss_conf.bssid,
1037 vif->bss_conf.bssid,
1038 &vif_priv->ibss_bssid_sta_id); 1034 &vif_priv->ibss_bssid_sta_id);
1039 return il_remove_station(il, vif_priv->ibss_bssid_sta_id, 1035 return il_remove_station(il, vif_priv->ibss_bssid_sta_id,
1040 vif->bss_conf.bssid); 1036 vif->bss_conf.bssid);
@@ -1127,7 +1123,7 @@ il4965_count_chain_bitmap(u32 chain_bitmap)
1127 * This should not be used for scan command ... it puts data in wrong place. 1123 * This should not be used for scan command ... it puts data in wrong place.
1128 */ 1124 */
1129void 1125void
1130il4965_set_rxon_chain(struct il_priv *il, struct il_rxon_context *ctx) 1126il4965_set_rxon_chain(struct il_priv *il)
1131{ 1127{
1132 bool is_single = il4965_is_single_rx_stream(il); 1128 bool is_single = il4965_is_single_rx_stream(il);
1133 bool is_cam = !test_bit(S_POWER_PMI, &il->status); 1129 bool is_cam = !test_bit(S_POWER_PMI, &il->status);
@@ -1456,7 +1452,7 @@ il4965_get_ac_from_tid(u16 tid)
1456} 1452}
1457 1453
1458static inline int 1454static inline int
1459il4965_get_fifo_from_tid(struct il_rxon_context *ctx, u16 tid) 1455il4965_get_fifo_from_tid(u16 tid)
1460{ 1456{
1461 const u8 ac_to_fifo[] = { 1457 const u8 ac_to_fifo[] = {
1462 IL_TX_FIFO_VO, 1458 IL_TX_FIFO_VO,
@@ -1645,7 +1641,6 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
1645 struct il_device_cmd *out_cmd; 1641 struct il_device_cmd *out_cmd;
1646 struct il_cmd_meta *out_meta; 1642 struct il_cmd_meta *out_meta;
1647 struct il_tx_cmd *tx_cmd; 1643 struct il_tx_cmd *tx_cmd;
1648 struct il_rxon_context *ctx = &il->ctx;
1649 int txq_id; 1644 int txq_id;
1650 dma_addr_t phys_addr; 1645 dma_addr_t phys_addr;
1651 dma_addr_t txcmd_phys; 1646 dma_addr_t txcmd_phys;
@@ -1661,9 +1656,6 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
1661 unsigned long flags; 1656 unsigned long flags;
1662 bool is_agg = false; 1657 bool is_agg = false;
1663 1658
1664 if (info->control.vif)
1665 ctx = il_rxon_ctx_from_vif(info->control.vif);
1666
1667 spin_lock_irqsave(&il->lock, flags); 1659 spin_lock_irqsave(&il->lock, flags);
1668 if (il_is_rfkill(il)) { 1660 if (il_is_rfkill(il)) {
1669 D_DROP("Dropping - RF KILL\n"); 1661 D_DROP("Dropping - RF KILL\n");
@@ -1688,7 +1680,7 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
1688 sta_id = il->hw_params.bcast_id; 1680 sta_id = il->hw_params.bcast_id;
1689 else { 1681 else {
1690 /* Find idx into station table for destination station */ 1682 /* Find idx into station table for destination station */
1691 sta_id = il_sta_id_or_broadcast(il, ctx, info->control.sta); 1683 sta_id = il_sta_id_or_broadcast(il, info->control.sta);
1692 1684
1693 if (sta_id == IL_INVALID_STATION) { 1685 if (sta_id == IL_INVALID_STATION) {
1694 D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1); 1686 D_DROP("Dropping - INVALID STATION: %pM\n", hdr->addr1);
@@ -1764,7 +1756,6 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
1764 /* Set up driver data for this TFD */ 1756 /* Set up driver data for this TFD */
1765 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info)); 1757 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info));
1766 txq->txb[q->write_ptr].skb = skb; 1758 txq->txb[q->write_ptr].skb = skb;
1767 txq->txb[q->write_ptr].ctx = ctx;
1768 1759
1769 /* Set up first empty entry in queue's array of Tx/cmd buffers */ 1760 /* Set up first empty entry in queue's array of Tx/cmd buffers */
1770 out_cmd = txq->cmd[q->write_ptr]; 1761 out_cmd = txq->cmd[q->write_ptr];
@@ -2228,7 +2219,8 @@ il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif,
2228 unsigned long flags; 2219 unsigned long flags;
2229 struct il_tid_data *tid_data; 2220 struct il_tid_data *tid_data;
2230 2221
2231 tx_fifo = il4965_get_fifo_from_tid(il_rxon_ctx_from_vif(vif), tid); 2222 /* FIXME: warning if tx fifo not found ? */
2223 tx_fifo = il4965_get_fifo_from_tid(tid);
2232 if (unlikely(tx_fifo < 0)) 2224 if (unlikely(tx_fifo < 0))
2233 return tx_fifo; 2225 return tx_fifo;
2234 2226
@@ -2321,7 +2313,8 @@ il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif,
2321 int write_ptr, read_ptr; 2313 int write_ptr, read_ptr;
2322 unsigned long flags; 2314 unsigned long flags;
2323 2315
2324 tx_fifo_id = il4965_get_fifo_from_tid(il_rxon_ctx_from_vif(vif), tid); 2316 /* FIXME: warning if tx_fifo_id not found ? */
2317 tx_fifo_id = il4965_get_fifo_from_tid(tid);
2325 if (unlikely(tx_fifo_id < 0)) 2318 if (unlikely(tx_fifo_id < 0))
2326 return tx_fifo_id; 2319 return tx_fifo_id;
2327 2320
@@ -2395,9 +2388,6 @@ il4965_txq_check_empty(struct il_priv *il, int sta_id, u8 tid, int txq_id)
2395 struct il_queue *q = &il->txq[txq_id].q; 2388 struct il_queue *q = &il->txq[txq_id].q;
2396 u8 *addr = il->stations[sta_id].sta.sta.addr; 2389 u8 *addr = il->stations[sta_id].sta.sta.addr;
2397 struct il_tid_data *tid_data = &il->stations[sta_id].tid[tid]; 2390 struct il_tid_data *tid_data = &il->stations[sta_id].tid[tid];
2398 struct il_rxon_context *ctx;
2399
2400 ctx = &il->ctx;
2401 2391
2402 lockdep_assert_held(&il->sta_lock); 2392 lockdep_assert_held(&il->sta_lock);
2403 2393
@@ -2408,11 +2398,11 @@ il4965_txq_check_empty(struct il_priv *il, int sta_id, u8 tid, int txq_id)
2408 if (txq_id == tid_data->agg.txq_id && 2398 if (txq_id == tid_data->agg.txq_id &&
2409 q->read_ptr == q->write_ptr) { 2399 q->read_ptr == q->write_ptr) {
2410 u16 ssn = SEQ_TO_SN(tid_data->seq_number); 2400 u16 ssn = SEQ_TO_SN(tid_data->seq_number);
2411 int tx_fifo = il4965_get_fifo_from_tid(ctx, tid); 2401 int tx_fifo = il4965_get_fifo_from_tid(tid);
2412 D_HT("HW queue empty: continue DELBA flow\n"); 2402 D_HT("HW queue empty: continue DELBA flow\n");
2413 il4965_txq_agg_disable(il, txq_id, ssn, tx_fifo); 2403 il4965_txq_agg_disable(il, txq_id, ssn, tx_fifo);
2414 tid_data->agg.state = IL_AGG_OFF; 2404 tid_data->agg.state = IL_AGG_OFF;
2415 ieee80211_stop_tx_ba_cb_irqsafe(ctx->vif, addr, tid); 2405 ieee80211_stop_tx_ba_cb_irqsafe(il->vif, addr, tid);
2416 } 2406 }
2417 break; 2407 break;
2418 case IL_EMPTYING_HW_QUEUE_ADDBA: 2408 case IL_EMPTYING_HW_QUEUE_ADDBA:
@@ -2420,7 +2410,7 @@ il4965_txq_check_empty(struct il_priv *il, int sta_id, u8 tid, int txq_id)
2420 if (tid_data->tfds_in_queue == 0) { 2410 if (tid_data->tfds_in_queue == 0) {
2421 D_HT("HW queue empty: continue ADDBA flow\n"); 2411 D_HT("HW queue empty: continue ADDBA flow\n");
2422 tid_data->agg.state = IL_AGG_ON; 2412 tid_data->agg.state = IL_AGG_ON;
2423 ieee80211_start_tx_ba_cb_irqsafe(ctx->vif, addr, tid); 2413 ieee80211_start_tx_ba_cb_irqsafe(il->vif, addr, tid);
2424 } 2414 }
2425 break; 2415 break;
2426 } 2416 }
@@ -2429,14 +2419,13 @@ il4965_txq_check_empty(struct il_priv *il, int sta_id, u8 tid, int txq_id)
2429} 2419}
2430 2420
2431static void 2421static void
2432il4965_non_agg_tx_status(struct il_priv *il, struct il_rxon_context *ctx, 2422il4965_non_agg_tx_status(struct il_priv *il, const u8 *addr1)
2433 const u8 *addr1)
2434{ 2423{
2435 struct ieee80211_sta *sta; 2424 struct ieee80211_sta *sta;
2436 struct il_station_priv *sta_priv; 2425 struct il_station_priv *sta_priv;
2437 2426
2438 rcu_read_lock(); 2427 rcu_read_lock();
2439 sta = ieee80211_find_sta(ctx->vif, addr1); 2428 sta = ieee80211_find_sta(il->vif, addr1);
2440 if (sta) { 2429 if (sta) {
2441 sta_priv = (void *)sta->drv_priv; 2430 sta_priv = (void *)sta->drv_priv;
2442 /* avoid atomic ops if this isn't a client */ 2431 /* avoid atomic ops if this isn't a client */
@@ -2453,7 +2442,7 @@ il4965_tx_status(struct il_priv *il, struct il_tx_info *tx_info, bool is_agg)
2453 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx_info->skb->data; 2442 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx_info->skb->data;
2454 2443
2455 if (!is_agg) 2444 if (!is_agg)
2456 il4965_non_agg_tx_status(il, tx_info->ctx, hdr->addr1); 2445 il4965_non_agg_tx_status(il, hdr->addr1);
2457 2446
2458 ieee80211_tx_status_irqsafe(il->hw, tx_info->skb); 2447 ieee80211_tx_status_irqsafe(il->hw, tx_info->skb);
2459} 2448}
@@ -2769,8 +2758,7 @@ il4965_sta_alloc_lq(struct il_priv *il, u8 sta_id)
2769 * Function sleeps. 2758 * Function sleeps.
2770 */ 2759 */
2771int 2760int
2772il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx, 2761il4965_add_bssid_station(struct il_priv *il, const u8 *addr, u8 *sta_id_r)
2773 const u8 *addr, u8 *sta_id_r)
2774{ 2762{
2775 int ret; 2763 int ret;
2776 u8 sta_id; 2764 u8 sta_id;
@@ -2780,7 +2768,7 @@ il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx,
2780 if (sta_id_r) 2768 if (sta_id_r)
2781 *sta_id_r = IL_INVALID_STATION; 2769 *sta_id_r = IL_INVALID_STATION;
2782 2770
2783 ret = il_add_station_common(il, ctx, addr, 0, NULL, &sta_id); 2771 ret = il_add_station_common(il, addr, 0, NULL, &sta_id);
2784 if (ret) { 2772 if (ret) {
2785 IL_ERR("Unable to add station %pM\n", addr); 2773 IL_ERR("Unable to add station %pM\n", addr);
2786 return ret; 2774 return ret;
@@ -2801,7 +2789,7 @@ il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx,
2801 return -ENOMEM; 2789 return -ENOMEM;
2802 } 2790 }
2803 2791
2804 ret = il_send_lq_cmd(il, ctx, link_cmd, CMD_SYNC, true); 2792 ret = il_send_lq_cmd(il, link_cmd, CMD_SYNC, true);
2805 if (ret) 2793 if (ret)
2806 IL_ERR("Link quality command failed (%d)\n", ret); 2794 IL_ERR("Link quality command failed (%d)\n", ret);
2807 2795
@@ -2813,8 +2801,7 @@ il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx,
2813} 2801}
2814 2802
2815static int 2803static int
2816il4965_static_wepkey_cmd(struct il_priv *il, struct il_rxon_context *ctx, 2804il4965_static_wepkey_cmd(struct il_priv *il, bool send_if_empty)
2817 bool send_if_empty)
2818{ 2805{
2819 int i; 2806 int i;
2820 u8 buff[sizeof(struct il_wep_cmd) + 2807 u8 buff[sizeof(struct il_wep_cmd) +
@@ -2860,15 +2847,15 @@ il4965_static_wepkey_cmd(struct il_priv *il, struct il_rxon_context *ctx,
2860} 2847}
2861 2848
2862int 2849int
2863il4965_restore_default_wep_keys(struct il_priv *il, struct il_rxon_context *ctx) 2850il4965_restore_default_wep_keys(struct il_priv *il)
2864{ 2851{
2865 lockdep_assert_held(&il->mutex); 2852 lockdep_assert_held(&il->mutex);
2866 2853
2867 return il4965_static_wepkey_cmd(il, ctx, false); 2854 return il4965_static_wepkey_cmd(il, false);
2868} 2855}
2869 2856
2870int 2857int
2871il4965_remove_default_wep_key(struct il_priv *il, struct il_rxon_context *ctx, 2858il4965_remove_default_wep_key(struct il_priv *il,
2872 struct ieee80211_key_conf *keyconf) 2859 struct ieee80211_key_conf *keyconf)
2873{ 2860{
2874 int ret; 2861 int ret;
@@ -2884,14 +2871,14 @@ il4965_remove_default_wep_key(struct il_priv *il, struct il_rxon_context *ctx,
2884 /* but keys in device are clear anyway so return success */ 2871 /* but keys in device are clear anyway so return success */
2885 return 0; 2872 return 0;
2886 } 2873 }
2887 ret = il4965_static_wepkey_cmd(il, ctx, 1); 2874 ret = il4965_static_wepkey_cmd(il, 1);
2888 D_WEP("Remove default WEP key: idx=%d ret=%d\n", idx, ret); 2875 D_WEP("Remove default WEP key: idx=%d ret=%d\n", idx, ret);
2889 2876
2890 return ret; 2877 return ret;
2891} 2878}
2892 2879
2893int 2880int
2894il4965_set_default_wep_key(struct il_priv *il, struct il_rxon_context *ctx, 2881il4965_set_default_wep_key(struct il_priv *il,
2895 struct ieee80211_key_conf *keyconf) 2882 struct ieee80211_key_conf *keyconf)
2896{ 2883{
2897 int ret; 2884 int ret;
@@ -2912,14 +2899,14 @@ il4965_set_default_wep_key(struct il_priv *il, struct il_rxon_context *ctx,
2912 il->_4965.wep_keys[idx].key_size = len; 2899 il->_4965.wep_keys[idx].key_size = len;
2913 memcpy(&il->_4965.wep_keys[idx].key, &keyconf->key, len); 2900 memcpy(&il->_4965.wep_keys[idx].key, &keyconf->key, len);
2914 2901
2915 ret = il4965_static_wepkey_cmd(il, ctx, false); 2902 ret = il4965_static_wepkey_cmd(il, false);
2916 2903
2917 D_WEP("Set default WEP key: len=%d idx=%d ret=%d\n", len, idx, ret); 2904 D_WEP("Set default WEP key: len=%d idx=%d ret=%d\n", len, idx, ret);
2918 return ret; 2905 return ret;
2919} 2906}
2920 2907
2921static int 2908static int
2922il4965_set_wep_dynamic_key_info(struct il_priv *il, struct il_rxon_context *ctx, 2909il4965_set_wep_dynamic_key_info(struct il_priv *il,
2923 struct ieee80211_key_conf *keyconf, u8 sta_id) 2910 struct ieee80211_key_conf *keyconf, u8 sta_id)
2924{ 2911{
2925 unsigned long flags; 2912 unsigned long flags;
@@ -2974,7 +2961,6 @@ il4965_set_wep_dynamic_key_info(struct il_priv *il, struct il_rxon_context *ctx,
2974 2961
2975static int 2962static int
2976il4965_set_ccmp_dynamic_key_info(struct il_priv *il, 2963il4965_set_ccmp_dynamic_key_info(struct il_priv *il,
2977 struct il_rxon_context *ctx,
2978 struct ieee80211_key_conf *keyconf, u8 sta_id) 2964 struct ieee80211_key_conf *keyconf, u8 sta_id)
2979{ 2965{
2980 unsigned long flags; 2966 unsigned long flags;
@@ -3023,7 +3009,6 @@ il4965_set_ccmp_dynamic_key_info(struct il_priv *il,
3023 3009
3024static int 3010static int
3025il4965_set_tkip_dynamic_key_info(struct il_priv *il, 3011il4965_set_tkip_dynamic_key_info(struct il_priv *il,
3026 struct il_rxon_context *ctx,
3027 struct ieee80211_key_conf *keyconf, u8 sta_id) 3012 struct ieee80211_key_conf *keyconf, u8 sta_id)
3028{ 3013{
3029 unsigned long flags; 3014 unsigned long flags;
@@ -3068,9 +3053,8 @@ il4965_set_tkip_dynamic_key_info(struct il_priv *il,
3068} 3053}
3069 3054
3070void 3055void
3071il4965_update_tkip_key(struct il_priv *il, struct il_rxon_context *ctx, 3056il4965_update_tkip_key(struct il_priv *il, struct ieee80211_key_conf *keyconf,
3072 struct ieee80211_key_conf *keyconf, 3057 struct ieee80211_sta *sta, u32 iv32, u16 *phase1key)
3073 struct ieee80211_sta *sta, u32 iv32, u16 * phase1key)
3074{ 3058{
3075 u8 sta_id; 3059 u8 sta_id;
3076 unsigned long flags; 3060 unsigned long flags;
@@ -3082,7 +3066,7 @@ il4965_update_tkip_key(struct il_priv *il, struct il_rxon_context *ctx,
3082 return; 3066 return;
3083 } 3067 }
3084 3068
3085 sta_id = il_sta_id_or_broadcast(il, ctx, sta); 3069 sta_id = il_sta_id_or_broadcast(il, sta);
3086 if (sta_id == IL_INVALID_STATION) 3070 if (sta_id == IL_INVALID_STATION)
3087 return; 3071 return;
3088 3072
@@ -3100,11 +3084,10 @@ il4965_update_tkip_key(struct il_priv *il, struct il_rxon_context *ctx,
3100 il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC); 3084 il_send_add_sta(il, &il->stations[sta_id].sta, CMD_ASYNC);
3101 3085
3102 spin_unlock_irqrestore(&il->sta_lock, flags); 3086 spin_unlock_irqrestore(&il->sta_lock, flags);
3103
3104} 3087}
3105 3088
3106int 3089int
3107il4965_remove_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx, 3090il4965_remove_dynamic_key(struct il_priv *il,
3108 struct ieee80211_key_conf *keyconf, u8 sta_id) 3091 struct ieee80211_key_conf *keyconf, u8 sta_id)
3109{ 3092{
3110 unsigned long flags; 3093 unsigned long flags;
@@ -3165,8 +3148,8 @@ il4965_remove_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx,
3165} 3148}
3166 3149
3167int 3150int
3168il4965_set_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx, 3151il4965_set_dynamic_key(struct il_priv *il, struct ieee80211_key_conf *keyconf,
3169 struct ieee80211_key_conf *keyconf, u8 sta_id) 3152 u8 sta_id)
3170{ 3153{
3171 int ret; 3154 int ret;
3172 3155
@@ -3178,15 +3161,15 @@ il4965_set_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx,
3178 switch (keyconf->cipher) { 3161 switch (keyconf->cipher) {
3179 case WLAN_CIPHER_SUITE_CCMP: 3162 case WLAN_CIPHER_SUITE_CCMP:
3180 ret = 3163 ret =
3181 il4965_set_ccmp_dynamic_key_info(il, ctx, keyconf, sta_id); 3164 il4965_set_ccmp_dynamic_key_info(il, keyconf, sta_id);
3182 break; 3165 break;
3183 case WLAN_CIPHER_SUITE_TKIP: 3166 case WLAN_CIPHER_SUITE_TKIP:
3184 ret = 3167 ret =
3185 il4965_set_tkip_dynamic_key_info(il, ctx, keyconf, sta_id); 3168 il4965_set_tkip_dynamic_key_info(il, keyconf, sta_id);
3186 break; 3169 break;
3187 case WLAN_CIPHER_SUITE_WEP40: 3170 case WLAN_CIPHER_SUITE_WEP40:
3188 case WLAN_CIPHER_SUITE_WEP104: 3171 case WLAN_CIPHER_SUITE_WEP104:
3189 ret = il4965_set_wep_dynamic_key_info(il, ctx, keyconf, sta_id); 3172 ret = il4965_set_wep_dynamic_key_info(il, keyconf, sta_id);
3190 break; 3173 break;
3191 default: 3174 default:
3192 IL_ERR("Unknown alg: %s cipher = %x\n", __func__, 3175 IL_ERR("Unknown alg: %s cipher = %x\n", __func__,
@@ -3208,14 +3191,14 @@ il4965_set_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx,
3208 * device at the next best time. 3191 * device at the next best time.
3209 */ 3192 */
3210int 3193int
3211il4965_alloc_bcast_station(struct il_priv *il, struct il_rxon_context *ctx) 3194il4965_alloc_bcast_station(struct il_priv *il)
3212{ 3195{
3213 struct il_link_quality_cmd *link_cmd; 3196 struct il_link_quality_cmd *link_cmd;
3214 unsigned long flags; 3197 unsigned long flags;
3215 u8 sta_id; 3198 u8 sta_id;
3216 3199
3217 spin_lock_irqsave(&il->sta_lock, flags); 3200 spin_lock_irqsave(&il->sta_lock, flags);
3218 sta_id = il_prep_station(il, ctx, il_bcast_addr, false, NULL); 3201 sta_id = il_prep_station(il, il_bcast_addr, false, NULL);
3219 if (sta_id == IL_INVALID_STATION) { 3202 if (sta_id == IL_INVALID_STATION) {
3220 IL_ERR("Unable to prepare broadcast station\n"); 3203 IL_ERR("Unable to prepare broadcast station\n");
3221 spin_unlock_irqrestore(&il->sta_lock, flags); 3204 spin_unlock_irqrestore(&il->sta_lock, flags);
@@ -3248,7 +3231,7 @@ il4965_alloc_bcast_station(struct il_priv *il, struct il_rxon_context *ctx)
3248 * code together. 3231 * code together.
3249 */ 3232 */
3250static int 3233static int
3251il4965_update_bcast_station(struct il_priv *il, struct il_rxon_context *ctx) 3234il4965_update_bcast_station(struct il_priv *il)
3252{ 3235{
3253 unsigned long flags; 3236 unsigned long flags;
3254 struct il_link_quality_cmd *link_cmd; 3237 struct il_link_quality_cmd *link_cmd;
@@ -3274,7 +3257,7 @@ il4965_update_bcast_station(struct il_priv *il, struct il_rxon_context *ctx)
3274int 3257int
3275il4965_update_bcast_stations(struct il_priv *il) 3258il4965_update_bcast_stations(struct il_priv *il)
3276{ 3259{
3277 return il4965_update_bcast_station(il, &il->ctx); 3260 return il4965_update_bcast_station(il);
3278} 3261}
3279 3262
3280/** 3263/**
@@ -3375,9 +3358,9 @@ void
3375il4965_update_chain_flags(struct il_priv *il) 3358il4965_update_chain_flags(struct il_priv *il)
3376{ 3359{
3377 if (il->cfg->ops->hcmd->set_rxon_chain) { 3360 if (il->cfg->ops->hcmd->set_rxon_chain) {
3378 il->cfg->ops->hcmd->set_rxon_chain(il, &il->ctx); 3361 il->cfg->ops->hcmd->set_rxon_chain(il);
3379 if (il->active.rx_chain != il->staging.rx_chain) 3362 if (il->active.rx_chain != il->staging.rx_chain)
3380 il_commit_rxon(il, &il->ctx); 3363 il_commit_rxon(il);
3381 } 3364 }
3382} 3365}
3383 3366
@@ -3489,8 +3472,8 @@ il4965_hw_get_beacon_cmd(struct il_priv *il, struct il_frame *frame)
3489 3472
3490 lockdep_assert_held(&il->mutex); 3473 lockdep_assert_held(&il->mutex);
3491 3474
3492 if (!il->beacon_ctx) { 3475 if (!il->beacon_enabled) {
3493 IL_ERR("trying to build beacon w/o beacon context!\n"); 3476 IL_ERR("Trying to build beacon without beaconing enabled\n");
3494 return 0; 3477 return 0;
3495 } 3478 }
3496 3479
@@ -3520,7 +3503,7 @@ il4965_hw_get_beacon_cmd(struct il_priv *il, struct il_frame *frame)
3520 frame_size); 3503 frame_size);
3521 3504
3522 /* Set up packet rate and flags */ 3505 /* Set up packet rate and flags */
3523 rate = il_get_lowest_plcp(il, il->beacon_ctx); 3506 rate = il_get_lowest_plcp(il);
3524 il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant); 3507 il4965_toggle_tx_ant(il, &il->mgmt_tx_ant, il->hw_params.valid_tx_ant);
3525 rate_flags = BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS; 3508 rate_flags = BIT(il->mgmt_tx_ant) << RATE_MCS_ANT_POS;
3526 if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE)) 3509 if ((rate >= IL_FIRST_CCK_RATE) && (rate <= IL_LAST_CCK_RATE))
@@ -4977,7 +4960,6 @@ static void
4977il4965_alive_start(struct il_priv *il) 4960il4965_alive_start(struct il_priv *il)
4978{ 4961{
4979 int ret = 0; 4962 int ret = 0;
4980 struct il_rxon_context *ctx = &il->ctx;
4981 4963
4982 D_INFO("Runtime Alive received.\n"); 4964 D_INFO("Runtime Alive received.\n");
4983 4965
@@ -5025,10 +5007,10 @@ il4965_alive_start(struct il_priv *il)
5025 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; 5007 active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5026 } else { 5008 } else {
5027 /* Initialize our rx_config data */ 5009 /* Initialize our rx_config data */
5028 il_connection_init_rx_config(il, &il->ctx); 5010 il_connection_init_rx_config(il);
5029 5011
5030 if (il->cfg->ops->hcmd->set_rxon_chain) 5012 if (il->cfg->ops->hcmd->set_rxon_chain)
5031 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 5013 il->cfg->ops->hcmd->set_rxon_chain(il);
5032 } 5014 }
5033 5015
5034 /* Configure bluetooth coexistence if enabled */ 5016 /* Configure bluetooth coexistence if enabled */
@@ -5039,7 +5021,7 @@ il4965_alive_start(struct il_priv *il)
5039 set_bit(S_READY, &il->status); 5021 set_bit(S_READY, &il->status);
5040 5022
5041 /* Configure the adapter for unassociated operation */ 5023 /* Configure the adapter for unassociated operation */
5042 il_commit_rxon(il, ctx); 5024 il_commit_rxon(il);
5043 5025
5044 /* At this point, the NIC is initialized and operational */ 5026 /* At this point, the NIC is initialized and operational */
5045 il4965_rf_kill_ct_config(il); 5027 il4965_rf_kill_ct_config(il);
@@ -5074,7 +5056,7 @@ __il4965_down(struct il_priv *il)
5074 * to prevent rearm timer */ 5056 * to prevent rearm timer */
5075 del_timer_sync(&il->watchdog); 5057 del_timer_sync(&il->watchdog);
5076 5058
5077 il_clear_ucode_stations(il, NULL); 5059 il_clear_ucode_stations(il);
5078 5060
5079 /* FIXME: race conditions ? */ 5061 /* FIXME: race conditions ? */
5080 spin_lock_irq(&il->sta_lock); 5062 spin_lock_irq(&il->sta_lock);
@@ -5239,7 +5221,7 @@ __il4965_up(struct il_priv *il)
5239 return -EIO; 5221 return -EIO;
5240 } 5222 }
5241 5223
5242 ret = il4965_alloc_bcast_station(il, &il->ctx); 5224 ret = il4965_alloc_bcast_station(il);
5243 if (ret) { 5225 if (ret) {
5244 il_dealloc_bcast_stations(il); 5226 il_dealloc_bcast_stations(il);
5245 return ret; 5227 return ret;
@@ -5393,7 +5375,8 @@ il4965_bg_restart(struct work_struct *data)
5393 5375
5394 if (test_and_clear_bit(S_FW_ERROR, &il->status)) { 5376 if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
5395 mutex_lock(&il->mutex); 5377 mutex_lock(&il->mutex);
5396 il->ctx.vif = NULL; 5378 /* FIXME: do we dereference vif without mutex locked ? */
5379 il->vif = NULL;
5397 il->is_open = 0; 5380 il->is_open = 0;
5398 5381
5399 __il4965_down(il); 5382 __il4965_down(il);
@@ -5590,12 +5573,10 @@ il4965_mac_update_tkip_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5590 struct ieee80211_sta *sta, u32 iv32, u16 * phase1key) 5573 struct ieee80211_sta *sta, u32 iv32, u16 * phase1key)
5591{ 5574{
5592 struct il_priv *il = hw->priv; 5575 struct il_priv *il = hw->priv;
5593 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
5594 5576
5595 D_MAC80211("enter\n"); 5577 D_MAC80211("enter\n");
5596 5578
5597 il4965_update_tkip_key(il, vif_priv->ctx, keyconf, sta, iv32, 5579 il4965_update_tkip_key(il, keyconf, sta, iv32, phase1key);
5598 phase1key);
5599 5580
5600 D_MAC80211("leave\n"); 5581 D_MAC80211("leave\n");
5601} 5582}
@@ -5606,8 +5587,6 @@ il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
5606 struct ieee80211_key_conf *key) 5587 struct ieee80211_key_conf *key)
5607{ 5588{
5608 struct il_priv *il = hw->priv; 5589 struct il_priv *il = hw->priv;
5609 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
5610 struct il_rxon_context *ctx = vif_priv->ctx;
5611 int ret; 5590 int ret;
5612 u8 sta_id; 5591 u8 sta_id;
5613 bool is_default_wep_key = false; 5592 bool is_default_wep_key = false;
@@ -5619,7 +5598,7 @@ il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
5619 return -EOPNOTSUPP; 5598 return -EOPNOTSUPP;
5620 } 5599 }
5621 5600
5622 sta_id = il_sta_id_or_broadcast(il, vif_priv->ctx, sta); 5601 sta_id = il_sta_id_or_broadcast(il, sta);
5623 if (sta_id == IL_INVALID_STATION) 5602 if (sta_id == IL_INVALID_STATION)
5624 return -EINVAL; 5603 return -EINVAL;
5625 5604
@@ -5644,20 +5623,17 @@ il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
5644 switch (cmd) { 5623 switch (cmd) {
5645 case SET_KEY: 5624 case SET_KEY:
5646 if (is_default_wep_key) 5625 if (is_default_wep_key)
5647 ret = 5626 ret = il4965_set_default_wep_key(il, key);
5648 il4965_set_default_wep_key(il, vif_priv->ctx, key);
5649 else 5627 else
5650 ret = 5628 ret = il4965_set_dynamic_key(il, key, sta_id);
5651 il4965_set_dynamic_key(il, vif_priv->ctx, key,
5652 sta_id);
5653 5629
5654 D_MAC80211("enable hwcrypto key\n"); 5630 D_MAC80211("enable hwcrypto key\n");
5655 break; 5631 break;
5656 case DISABLE_KEY: 5632 case DISABLE_KEY:
5657 if (is_default_wep_key) 5633 if (is_default_wep_key)
5658 ret = il4965_remove_default_wep_key(il, ctx, key); 5634 ret = il4965_remove_default_wep_key(il, key);
5659 else 5635 else
5660 ret = il4965_remove_dynamic_key(il, ctx, key, sta_id); 5636 ret = il4965_remove_dynamic_key(il, key, sta_id);
5661 5637
5662 D_MAC80211("disable hwcrypto key\n"); 5638 D_MAC80211("disable hwcrypto key\n");
5663 break; 5639 break;
@@ -5723,7 +5699,6 @@ il4965_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5723{ 5699{
5724 struct il_priv *il = hw->priv; 5700 struct il_priv *il = hw->priv;
5725 struct il_station_priv *sta_priv = (void *)sta->drv_priv; 5701 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
5726 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
5727 bool is_ap = vif->type == NL80211_IFTYPE_STATION; 5702 bool is_ap = vif->type == NL80211_IFTYPE_STATION;
5728 int ret; 5703 int ret;
5729 u8 sta_id; 5704 u8 sta_id;
@@ -5736,8 +5711,7 @@ il4965_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5736 atomic_set(&sta_priv->pending_frames, 0); 5711 atomic_set(&sta_priv->pending_frames, 0);
5737 5712
5738 ret = 5713 ret =
5739 il_add_station_common(il, vif_priv->ctx, sta->addr, is_ap, sta, 5714 il_add_station_common(il, sta->addr, is_ap, sta, &sta_id);
5740 &sta_id);
5741 if (ret) { 5715 if (ret) {
5742 IL_ERR("Unable to add station %pM (%d)\n", sta->addr, ret); 5716 IL_ERR("Unable to add station %pM (%d)\n", sta->addr, ret);
5743 /* Should we return success if return code is EEXIST ? */ 5717 /* Should we return success if return code is EEXIST ? */
@@ -5764,8 +5738,6 @@ il4965_mac_channel_switch(struct ieee80211_hw *hw,
5764 struct ieee80211_conf *conf = &hw->conf; 5738 struct ieee80211_conf *conf = &hw->conf;
5765 struct ieee80211_channel *channel = ch_switch->channel; 5739 struct ieee80211_channel *channel = ch_switch->channel;
5766 struct il_ht_config *ht_conf = &il->current_ht_config; 5740 struct il_ht_config *ht_conf = &il->current_ht_config;
5767
5768 struct il_rxon_context *ctx = &il->ctx;
5769 u16 ch; 5741 u16 ch;
5770 5742
5771 D_MAC80211("enter\n"); 5743 D_MAC80211("enter\n");
@@ -5822,9 +5794,9 @@ il4965_mac_channel_switch(struct ieee80211_hw *hw,
5822 if ((le16_to_cpu(il->staging.channel) != ch)) 5794 if ((le16_to_cpu(il->staging.channel) != ch))
5823 il->staging.flags = 0; 5795 il->staging.flags = 0;
5824 5796
5825 il_set_rxon_channel(il, channel, ctx); 5797 il_set_rxon_channel(il, channel);
5826 il_set_rxon_ht(il, ht_conf); 5798 il_set_rxon_ht(il, ht_conf);
5827 il_set_flags_for_band(il, ctx, channel->band, ctx->vif); 5799 il_set_flags_for_band(il, channel->band, il->vif);
5828 5800
5829 spin_unlock_irq(&il->lock); 5801 spin_unlock_irq(&il->lock);
5830 5802
@@ -5838,7 +5810,7 @@ il4965_mac_channel_switch(struct ieee80211_hw *hw,
5838 if (il->cfg->ops->lib->set_channel_switch(il, ch_switch)) { 5810 if (il->cfg->ops->lib->set_channel_switch(il, ch_switch)) {
5839 clear_bit(S_CHANNEL_SWITCH_PENDING, &il->status); 5811 clear_bit(S_CHANNEL_SWITCH_PENDING, &il->status);
5840 il->switch_channel = 0; 5812 il->switch_channel = 0;
5841 ieee80211_chswitch_done(ctx->vif, false); 5813 ieee80211_chswitch_done(il->vif, false);
5842 } 5814 }
5843 5815
5844out: 5816out:
@@ -6049,7 +6021,7 @@ il4965_init_drv(struct il_priv *il)
6049 6021
6050 /* Choose which receivers/antennas to use */ 6022 /* Choose which receivers/antennas to use */
6051 if (il->cfg->ops->hcmd->set_rxon_chain) 6023 if (il->cfg->ops->hcmd->set_rxon_chain)
6052 il->cfg->ops->hcmd->set_rxon_chain(il, &il->ctx); 6024 il->cfg->ops->hcmd->set_rxon_chain(il);
6053 6025
6054 il_init_scan_params(il); 6026 il_init_scan_params(il);
6055 6027
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index ad186d9a598f..d7e2856e41d3 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -820,8 +820,6 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
820 u32 tx_rate; 820 u32 tx_rate;
821 struct il_scale_tbl_info tbl_type; 821 struct il_scale_tbl_info tbl_type;
822 struct il_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; 822 struct il_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl;
823 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
824 struct il_rxon_context *ctx = sta_priv->common.ctx;
825 823
826 D_RATE("get frame ack response, update rate scale win\n"); 824 D_RATE("get frame ack response, update rate scale win\n");
827 825
@@ -889,7 +887,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
889 lq_sta->missed_rate_counter++; 887 lq_sta->missed_rate_counter++;
890 if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) { 888 if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) {
891 lq_sta->missed_rate_counter = 0; 889 lq_sta->missed_rate_counter = 0;
892 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); 890 il_send_lq_cmd(il, &lq_sta->lq, CMD_ASYNC, false);
893 } 891 }
894 /* Regardless, ignore this status info for outdated rate */ 892 /* Regardless, ignore this status info for outdated rate */
895 return; 893 return;
@@ -1181,8 +1179,6 @@ il4965_rs_switch_to_mimo2(struct il_priv *il, struct il_lq_sta *lq_sta,
1181 u16 rate_mask; 1179 u16 rate_mask;
1182 s32 rate; 1180 s32 rate;
1183 s8 is_green = lq_sta->is_green; 1181 s8 is_green = lq_sta->is_green;
1184 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
1185 struct il_rxon_context *ctx = sta_priv->common.ctx;
1186 1182
1187 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) 1183 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
1188 return -1; 1184 return -1;
@@ -1203,7 +1199,7 @@ il4965_rs_switch_to_mimo2(struct il_priv *il, struct il_lq_sta *lq_sta,
1203 tbl->max_search = IL_MAX_SEARCH; 1199 tbl->max_search = IL_MAX_SEARCH;
1204 rate_mask = lq_sta->active_mimo2_rate; 1200 rate_mask = lq_sta->active_mimo2_rate;
1205 1201
1206 if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) 1202 if (il_is_ht40_tx_allowed(il, &sta->ht_cap))
1207 tbl->is_ht40 = 1; 1203 tbl->is_ht40 = 1;
1208 else 1204 else
1209 tbl->is_ht40 = 0; 1205 tbl->is_ht40 = 0;
@@ -1237,8 +1233,6 @@ il4965_rs_switch_to_siso(struct il_priv *il, struct il_lq_sta *lq_sta,
1237 u16 rate_mask; 1233 u16 rate_mask;
1238 u8 is_green = lq_sta->is_green; 1234 u8 is_green = lq_sta->is_green;
1239 s32 rate; 1235 s32 rate;
1240 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
1241 struct il_rxon_context *ctx = sta_priv->common.ctx;
1242 1236
1243 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) 1237 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
1244 return -1; 1238 return -1;
@@ -1251,7 +1245,7 @@ il4965_rs_switch_to_siso(struct il_priv *il, struct il_lq_sta *lq_sta,
1251 tbl->max_search = IL_MAX_SEARCH; 1245 tbl->max_search = IL_MAX_SEARCH;
1252 rate_mask = lq_sta->active_siso_rate; 1246 rate_mask = lq_sta->active_siso_rate;
1253 1247
1254 if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) 1248 if (il_is_ht40_tx_allowed(il, &sta->ht_cap))
1255 tbl->is_ht40 = 1; 1249 tbl->is_ht40 = 1;
1256 else 1250 else
1257 tbl->is_ht40 = 0; 1251 tbl->is_ht40 = 0;
@@ -1730,8 +1724,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search)
1730 * setup rate table in uCode 1724 * setup rate table in uCode
1731 */ 1725 */
1732static void 1726static void
1733il4965_rs_update_rate_tbl(struct il_priv *il, struct il_rxon_context *ctx, 1727il4965_rs_update_rate_tbl(struct il_priv *il, struct il_lq_sta *lq_sta,
1734 struct il_lq_sta *lq_sta,
1735 struct il_scale_tbl_info *tbl, int idx, u8 is_green) 1728 struct il_scale_tbl_info *tbl, int idx, u8 is_green)
1736{ 1729{
1737 u32 rate; 1730 u32 rate;
@@ -1739,7 +1732,7 @@ il4965_rs_update_rate_tbl(struct il_priv *il, struct il_rxon_context *ctx,
1739 /* Update uCode's rate table. */ 1732 /* Update uCode's rate table. */
1740 rate = il4965_rate_n_flags_from_tbl(il, tbl, idx, is_green); 1733 rate = il4965_rate_n_flags_from_tbl(il, tbl, idx, is_green);
1741 il4965_rs_fill_link_cmd(il, lq_sta, rate); 1734 il4965_rs_fill_link_cmd(il, lq_sta, rate);
1742 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); 1735 il_send_lq_cmd(il, &lq_sta->lq, CMD_ASYNC, false);
1743} 1736}
1744 1737
1745/* 1738/*
@@ -1775,8 +1768,6 @@ il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb,
1775 s32 sr; 1768 s32 sr;
1776 u8 tid = MAX_TID_COUNT; 1769 u8 tid = MAX_TID_COUNT;
1777 struct il_tid_data *tid_data; 1770 struct il_tid_data *tid_data;
1778 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
1779 struct il_rxon_context *ctx = sta_priv->common.ctx;
1780 1771
1781 D_RATE("rate scale calculate new rate for skb\n"); 1772 D_RATE("rate scale calculate new rate for skb\n");
1782 1773
@@ -1851,7 +1842,7 @@ il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb,
1851 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1842 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1852 /* get "active" rate info */ 1843 /* get "active" rate info */
1853 idx = il4965_hwrate_to_plcp_idx(tbl->current_rate); 1844 idx = il4965_hwrate_to_plcp_idx(tbl->current_rate);
1854 il4965_rs_update_rate_tbl(il, ctx, lq_sta, tbl, idx, 1845 il4965_rs_update_rate_tbl(il, lq_sta, tbl, idx,
1855 is_green); 1846 is_green);
1856 } 1847 }
1857 return; 1848 return;
@@ -2054,8 +2045,7 @@ il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb,
2054lq_update: 2045lq_update:
2055 /* Replace uCode's rate table for the destination station. */ 2046 /* Replace uCode's rate table for the destination station. */
2056 if (update_lq) 2047 if (update_lq)
2057 il4965_rs_update_rate_tbl(il, ctx, lq_sta, tbl, idx, 2048 il4965_rs_update_rate_tbl(il, lq_sta, tbl, idx, is_green);
2058 is_green);
2059 2049
2060 /* Should we stay with this modulation mode, 2050 /* Should we stay with this modulation mode,
2061 * or search for a new one? */ 2051 * or search for a new one? */
@@ -2095,7 +2085,7 @@ lq_update:
2095 D_RATE("Switch current mcs: %X idx: %d\n", 2085 D_RATE("Switch current mcs: %X idx: %d\n",
2096 tbl->current_rate, idx); 2086 tbl->current_rate, idx);
2097 il4965_rs_fill_link_cmd(il, lq_sta, tbl->current_rate); 2087 il4965_rs_fill_link_cmd(il, lq_sta, tbl->current_rate);
2098 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); 2088 il_send_lq_cmd(il, &lq_sta->lq, CMD_ASYNC, false);
2099 } else 2089 } else
2100 done_search = 1; 2090 done_search = 1;
2101 } 2091 }
@@ -2167,13 +2157,11 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf,
2167 u8 active_tbl = 0; 2157 u8 active_tbl = 0;
2168 u8 valid_tx_ant; 2158 u8 valid_tx_ant;
2169 struct il_station_priv *sta_priv; 2159 struct il_station_priv *sta_priv;
2170 struct il_rxon_context *ctx;
2171 2160
2172 if (!sta || !lq_sta) 2161 if (!sta || !lq_sta)
2173 return; 2162 return;
2174 2163
2175 sta_priv = (void *)sta->drv_priv; 2164 sta_priv = (void *)sta->drv_priv;
2176 ctx = sta_priv->common.ctx;
2177 2165
2178 i = lq_sta->last_txrate_idx; 2166 i = lq_sta->last_txrate_idx;
2179 2167
@@ -2205,7 +2193,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf,
2205 il4965_rs_set_expected_tpt_table(lq_sta, tbl); 2193 il4965_rs_set_expected_tpt_table(lq_sta, tbl);
2206 il4965_rs_fill_link_cmd(NULL, lq_sta, rate); 2194 il4965_rs_fill_link_cmd(NULL, lq_sta, rate);
2207 il->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; 2195 il->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq;
2208 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_SYNC, true); 2196 il_send_lq_cmd(il, &lq_sta->lq, CMD_SYNC, true);
2209} 2197}
2210 2198
2211static void 2199static void
@@ -2576,9 +2564,6 @@ il4965_rs_sta_dbgfs_scale_table_write(struct file *file,
2576 char buf[64]; 2564 char buf[64];
2577 size_t buf_size; 2565 size_t buf_size;
2578 u32 parsed_rate; 2566 u32 parsed_rate;
2579 struct il_station_priv *sta_priv =
2580 container_of(lq_sta, struct il_station_priv, lq_sta);
2581 struct il_rxon_context *ctx = sta_priv->common.ctx;
2582 2567
2583 il = lq_sta->drv; 2568 il = lq_sta->drv;
2584 memset(buf, 0, sizeof(buf)); 2569 memset(buf, 0, sizeof(buf));
@@ -2600,7 +2585,7 @@ il4965_rs_sta_dbgfs_scale_table_write(struct file *file,
2600 2585
2601 if (lq_sta->dbg_fixed_rate) { 2586 if (lq_sta->dbg_fixed_rate) {
2602 il4965_rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); 2587 il4965_rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate);
2603 il_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC, false); 2588 il_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC, false);
2604 } 2589 }
2605 2590
2606 return count; 2591 return count;
diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c
index 7b0192aff839..9d9197f7fa38 100644
--- a/drivers/net/wireless/iwlegacy/4965.c
+++ b/drivers/net/wireless/iwlegacy/4965.c
@@ -1370,7 +1370,7 @@ out:
1370} 1370}
1371 1371
1372static int 1372static int
1373il4965_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx) 1373il4965_send_rxon_assoc(struct il_priv *il)
1374{ 1374{
1375 int ret = 0; 1375 int ret = 0;
1376 struct il4965_rxon_assoc_cmd rxon_assoc; 1376 struct il4965_rxon_assoc_cmd rxon_assoc;
@@ -1409,7 +1409,7 @@ il4965_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx)
1409} 1409}
1410 1410
1411static int 1411static int
1412il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx) 1412il4965_commit_rxon(struct il_priv *il)
1413{ 1413{
1414 /* cast away the const for active_rxon in this function */ 1414 /* cast away the const for active_rxon in this function */
1415 struct il_rxon_cmd *active_rxon = (void *)&il->active; 1415 struct il_rxon_cmd *active_rxon = (void *)&il->active;
@@ -1422,7 +1422,7 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1422 /* always get timestamp with Rx frame */ 1422 /* always get timestamp with Rx frame */
1423 il->staging.flags |= RXON_FLG_TSF2HOST_MSK; 1423 il->staging.flags |= RXON_FLG_TSF2HOST_MSK;
1424 1424
1425 ret = il_check_rxon_cmd(il, ctx); 1425 ret = il_check_rxon_cmd(il);
1426 if (ret) { 1426 if (ret) {
1427 IL_ERR("Invalid RXON configuration. Not committing.\n"); 1427 IL_ERR("Invalid RXON configuration. Not committing.\n");
1428 return -EINVAL; 1428 return -EINVAL;
@@ -1442,15 +1442,15 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1442 /* If we don't need to send a full RXON, we can use 1442 /* If we don't need to send a full RXON, we can use
1443 * il_rxon_assoc_cmd which is used to reconfigure filter 1443 * il_rxon_assoc_cmd which is used to reconfigure filter
1444 * and other flags for the current radio configuration. */ 1444 * and other flags for the current radio configuration. */
1445 if (!il_full_rxon_required(il, ctx)) { 1445 if (!il_full_rxon_required(il)) {
1446 ret = il_send_rxon_assoc(il, ctx); 1446 ret = il_send_rxon_assoc(il);
1447 if (ret) { 1447 if (ret) {
1448 IL_ERR("Error setting RXON_ASSOC (%d)\n", ret); 1448 IL_ERR("Error setting RXON_ASSOC (%d)\n", ret);
1449 return ret; 1449 return ret;
1450 } 1450 }
1451 1451
1452 memcpy(active_rxon, &il->staging, sizeof(*active_rxon)); 1452 memcpy(active_rxon, &il->staging, sizeof(*active_rxon));
1453 il_print_rx_config_cmd(il, ctx); 1453 il_print_rx_config_cmd(il);
1454 /* 1454 /*
1455 * We do not commit tx power settings while channel changing, 1455 * We do not commit tx power settings while channel changing,
1456 * do it now if tx power changed. 1456 * do it now if tx power changed.
@@ -1478,9 +1478,9 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1478 IL_ERR("Error clearing ASSOC_MSK (%d)\n", ret); 1478 IL_ERR("Error clearing ASSOC_MSK (%d)\n", ret);
1479 return ret; 1479 return ret;
1480 } 1480 }
1481 il_clear_ucode_stations(il, ctx); 1481 il_clear_ucode_stations(il);
1482 il_restore_stations(il, ctx); 1482 il_restore_stations(il);
1483 ret = il4965_restore_default_wep_keys(il, ctx); 1483 ret = il4965_restore_default_wep_keys(il);
1484 if (ret) { 1484 if (ret) {
1485 IL_ERR("Failed to restore WEP keys (%d)\n", ret); 1485 IL_ERR("Failed to restore WEP keys (%d)\n", ret);
1486 return ret; 1486 return ret;
@@ -1491,7 +1491,7 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1491 "* channel = %d\n" "* bssid = %pM\n", (new_assoc ? "" : "out"), 1491 "* channel = %d\n" "* bssid = %pM\n", (new_assoc ? "" : "out"),
1492 le16_to_cpu(il->staging.channel), il->staging.bssid_addr); 1492 le16_to_cpu(il->staging.channel), il->staging.bssid_addr);
1493 1493
1494 il_set_rxon_hwcrypto(il, ctx, !il->cfg->mod_params->sw_crypto); 1494 il_set_rxon_hwcrypto(il, !il->cfg->mod_params->sw_crypto);
1495 1495
1496 /* Apply the new configuration 1496 /* Apply the new configuration
1497 * RXON unassoc clears the station table in uCode so restoration of 1497 * RXON unassoc clears the station table in uCode so restoration of
@@ -1507,9 +1507,9 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1507 } 1507 }
1508 D_INFO("Return from !new_assoc RXON.\n"); 1508 D_INFO("Return from !new_assoc RXON.\n");
1509 memcpy(active_rxon, &il->staging, sizeof(*active_rxon)); 1509 memcpy(active_rxon, &il->staging, sizeof(*active_rxon));
1510 il_clear_ucode_stations(il, ctx); 1510 il_clear_ucode_stations(il);
1511 il_restore_stations(il, ctx); 1511 il_restore_stations(il);
1512 ret = il4965_restore_default_wep_keys(il, ctx); 1512 ret = il4965_restore_default_wep_keys(il);
1513 if (ret) { 1513 if (ret) {
1514 IL_ERR("Failed to restore WEP keys (%d)\n", ret); 1514 IL_ERR("Failed to restore WEP keys (%d)\n", ret);
1515 return ret; 1515 return ret;
@@ -1529,7 +1529,7 @@ il4965_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx)
1529 } 1529 }
1530 memcpy(active_rxon, &il->staging, sizeof(*active_rxon)); 1530 memcpy(active_rxon, &il->staging, sizeof(*active_rxon));
1531 } 1531 }
1532 il_print_rx_config_cmd(il, ctx); 1532 il_print_rx_config_cmd(il);
1533 1533
1534 il4965_init_sensitivity(il); 1534 il4965_init_sensitivity(il);
1535 1535
@@ -1548,7 +1548,6 @@ static int
1548il4965_hw_channel_switch(struct il_priv *il, 1548il4965_hw_channel_switch(struct il_priv *il,
1549 struct ieee80211_channel_switch *ch_switch) 1549 struct ieee80211_channel_switch *ch_switch)
1550{ 1550{
1551 struct il_rxon_context *ctx = &il->ctx;
1552 int rc; 1551 int rc;
1553 u8 band = 0; 1552 u8 band = 0;
1554 bool is_ht40 = false; 1553 bool is_ht40 = false;
@@ -1560,8 +1559,11 @@ il4965_hw_channel_switch(struct il_priv *il,
1560 u32 tsf_low; 1559 u32 tsf_low;
1561 u8 switch_count; 1560 u8 switch_count;
1562 u16 beacon_interval = le16_to_cpu(il->timing.beacon_interval); 1561 u16 beacon_interval = le16_to_cpu(il->timing.beacon_interval);
1563 struct ieee80211_vif *vif = ctx->vif; 1562 struct ieee80211_vif *vif = il->vif;
1564 band = il->band == IEEE80211_BAND_2GHZ; 1563 band = (il->band == IEEE80211_BAND_2GHZ);
1564
1565 if (WARN_ON_ONCE(vif == NULL))
1566 return -EIO;
1565 1567
1566 is_ht40 = iw4965_is_ht40_channel(il->staging.flags); 1568 is_ht40 = iw4965_is_ht40_channel(il->staging.flags);
1567 1569
@@ -2128,21 +2130,18 @@ static struct il_hcmd_ops il4965_hcmd = {
2128static void 2130static void
2129il4965_post_scan(struct il_priv *il) 2131il4965_post_scan(struct il_priv *il)
2130{ 2132{
2131 struct il_rxon_context *ctx = &il->ctx;
2132
2133 /* 2133 /*
2134 * Since setting the RXON may have been deferred while 2134 * Since setting the RXON may have been deferred while
2135 * performing the scan, fire one off if needed 2135 * performing the scan, fire one off if needed
2136 */ 2136 */
2137 if (memcmp(&il->staging, &il->active, sizeof(il->staging))) 2137 if (memcmp(&il->staging, &il->active, sizeof(il->staging)))
2138 il_commit_rxon(il, ctx); 2138 il_commit_rxon(il);
2139} 2139}
2140 2140
2141static void 2141static void
2142il4965_post_associate(struct il_priv *il) 2142il4965_post_associate(struct il_priv *il)
2143{ 2143{
2144 struct il_rxon_context *ctx = &il->ctx; 2144 struct ieee80211_vif *vif = il->vif;
2145 struct ieee80211_vif *vif = ctx->vif;
2146 struct ieee80211_conf *conf = NULL; 2145 struct ieee80211_conf *conf = NULL;
2147 int ret = 0; 2146 int ret = 0;
2148 2147
@@ -2157,9 +2156,9 @@ il4965_post_associate(struct il_priv *il)
2157 conf = &il->hw->conf; 2156 conf = &il->hw->conf;
2158 2157
2159 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2158 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2160 il_commit_rxon(il, ctx); 2159 il_commit_rxon(il);
2161 2160
2162 ret = il_send_rxon_timing(il, ctx); 2161 ret = il_send_rxon_timing(il);
2163 if (ret) 2162 if (ret)
2164 IL_WARN("RXON timing - " "Attempting to continue.\n"); 2163 IL_WARN("RXON timing - " "Attempting to continue.\n");
2165 2164
@@ -2168,7 +2167,7 @@ il4965_post_associate(struct il_priv *il)
2168 il_set_rxon_ht(il, &il->current_ht_config); 2167 il_set_rxon_ht(il, &il->current_ht_config);
2169 2168
2170 if (il->cfg->ops->hcmd->set_rxon_chain) 2169 if (il->cfg->ops->hcmd->set_rxon_chain)
2171 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 2170 il->cfg->ops->hcmd->set_rxon_chain(il);
2172 2171
2173 il->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid); 2172 il->staging.assoc_id = cpu_to_le16(vif->bss_conf.aid);
2174 2173
@@ -2187,7 +2186,7 @@ il4965_post_associate(struct il_priv *il)
2187 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 2186 il->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
2188 } 2187 }
2189 2188
2190 il_commit_rxon(il, ctx); 2189 il_commit_rxon(il);
2191 2190
2192 D_ASSOC("Associated as %d to: %pM\n", vif->bss_conf.aid, 2191 D_ASSOC("Associated as %d to: %pM\n", vif->bss_conf.aid,
2193 il->active.bssid_addr); 2192 il->active.bssid_addr);
@@ -2218,8 +2217,7 @@ il4965_post_associate(struct il_priv *il)
2218static void 2217static void
2219il4965_config_ap(struct il_priv *il) 2218il4965_config_ap(struct il_priv *il)
2220{ 2219{
2221 struct il_rxon_context *ctx = &il->ctx; 2220 struct ieee80211_vif *vif = il->vif;
2222 struct ieee80211_vif *vif = ctx->vif;
2223 int ret = 0; 2221 int ret = 0;
2224 2222
2225 lockdep_assert_held(&il->mutex); 2223 lockdep_assert_held(&il->mutex);
@@ -2232,10 +2230,10 @@ il4965_config_ap(struct il_priv *il)
2232 2230
2233 /* RXON - unassoc (to set timing command) */ 2231 /* RXON - unassoc (to set timing command) */
2234 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 2232 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
2235 il_commit_rxon(il, ctx); 2233 il_commit_rxon(il);
2236 2234
2237 /* RXON Timing */ 2235 /* RXON Timing */
2238 ret = il_send_rxon_timing(il, ctx); 2236 ret = il_send_rxon_timing(il);
2239 if (ret) 2237 if (ret)
2240 IL_WARN("RXON timing failed - " 2238 IL_WARN("RXON timing failed - "
2241 "Attempting to continue.\n"); 2239 "Attempting to continue.\n");
@@ -2244,7 +2242,7 @@ il4965_config_ap(struct il_priv *il)
2244 il->chain_noise_data.active_chains = il->hw_params.valid_rx_ant; 2242 il->chain_noise_data.active_chains = il->hw_params.valid_rx_ant;
2245 il_set_rxon_ht(il, &il->current_ht_config); 2243 il_set_rxon_ht(il, &il->current_ht_config);
2246 if (il->cfg->ops->hcmd->set_rxon_chain) 2244 if (il->cfg->ops->hcmd->set_rxon_chain)
2247 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 2245 il->cfg->ops->hcmd->set_rxon_chain(il);
2248 2246
2249 il->staging.assoc_id = 0; 2247 il->staging.assoc_id = 0;
2250 2248
@@ -2263,7 +2261,7 @@ il4965_config_ap(struct il_priv *il)
2263 il4965_send_beacon_cmd(il); 2261 il4965_send_beacon_cmd(il);
2264 /* restore RXON assoc */ 2262 /* restore RXON assoc */
2265 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 2263 il->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
2266 il_commit_rxon(il, ctx); 2264 il_commit_rxon(il);
2267 } 2265 }
2268 il4965_send_beacon_cmd(il); 2266 il4965_send_beacon_cmd(il);
2269} 2267}
diff --git a/drivers/net/wireless/iwlegacy/4965.h b/drivers/net/wireless/iwlegacy/4965.h
index f280e0161b17..67899602ee52 100644
--- a/drivers/net/wireless/iwlegacy/4965.h
+++ b/drivers/net/wireless/iwlegacy/4965.h
@@ -48,7 +48,7 @@ void il4965_free_tfds_in_queue(struct il_priv *il, int sta_id, int tid,
48 int freed); 48 int freed);
49 49
50/* RXON */ 50/* RXON */
51void il4965_set_rxon_chain(struct il_priv *il, struct il_rxon_context *ctx); 51void il4965_set_rxon_chain(struct il_priv *il);
52 52
53/* uCode */ 53/* uCode */
54int il4965_verify_ucode(struct il_priv *il); 54int il4965_verify_ucode(struct il_priv *il);
@@ -134,21 +134,18 @@ il4965_get_tx_fail_reason(u32 status)
134#endif 134#endif
135 135
136/* station management */ 136/* station management */
137int il4965_alloc_bcast_station(struct il_priv *il, struct il_rxon_context *ctx); 137int il4965_alloc_bcast_station(struct il_priv *il);
138int il4965_add_bssid_station(struct il_priv *il, struct il_rxon_context *ctx, 138int il4965_add_bssid_station(struct il_priv *il, const u8 *addr, u8 *sta_id_r);
139 const u8 *addr, u8 *sta_id_r);
140int il4965_remove_default_wep_key(struct il_priv *il, 139int il4965_remove_default_wep_key(struct il_priv *il,
141 struct il_rxon_context *ctx,
142 struct ieee80211_key_conf *key); 140 struct ieee80211_key_conf *key);
143int il4965_set_default_wep_key(struct il_priv *il, struct il_rxon_context *ctx, 141int il4965_set_default_wep_key(struct il_priv *il,
144 struct ieee80211_key_conf *key); 142 struct ieee80211_key_conf *key);
145int il4965_restore_default_wep_keys(struct il_priv *il, 143int il4965_restore_default_wep_keys(struct il_priv *il);
146 struct il_rxon_context *ctx); 144int il4965_set_dynamic_key(struct il_priv *il,
147int il4965_set_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx,
148 struct ieee80211_key_conf *key, u8 sta_id); 145 struct ieee80211_key_conf *key, u8 sta_id);
149int il4965_remove_dynamic_key(struct il_priv *il, struct il_rxon_context *ctx, 146int il4965_remove_dynamic_key(struct il_priv *il,
150 struct ieee80211_key_conf *key, u8 sta_id); 147 struct ieee80211_key_conf *key, u8 sta_id);
151void il4965_update_tkip_key(struct il_priv *il, struct il_rxon_context *ctx, 148void il4965_update_tkip_key(struct il_priv *il,
152 struct ieee80211_key_conf *keyconf, 149 struct ieee80211_key_conf *keyconf,
153 struct ieee80211_sta *sta, u32 iv32, 150 struct ieee80211_sta *sta, u32 iv32,
154 u16 *phase1key); 151 u16 *phase1key);
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index ea2fa97fa36b..bee11a3aeac0 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -1442,7 +1442,6 @@ u16
1442il_get_passive_dwell_time(struct il_priv *il, enum ieee80211_band band, 1442il_get_passive_dwell_time(struct il_priv *il, enum ieee80211_band band,
1443 struct ieee80211_vif *vif) 1443 struct ieee80211_vif *vif)
1444{ 1444{
1445 struct il_rxon_context *ctx = &il->ctx;
1446 u16 value; 1445 u16 value;
1447 1446
1448 u16 passive = 1447 u16 passive =
@@ -1457,7 +1456,7 @@ il_get_passive_dwell_time(struct il_priv *il, enum ieee80211_band band,
1457 * dwell time to be 98% of the smallest beacon interval 1456 * dwell time to be 98% of the smallest beacon interval
1458 * (minus 2 * channel tune time) 1457 * (minus 2 * channel tune time)
1459 */ 1458 */
1460 value = ctx->vif ? ctx->vif->bss_conf.beacon_int : 0; 1459 value = il->vif ? il->vif->bss_conf.beacon_int : 0;
1461 if (value > IL_PASSIVE_DWELL_BASE || !value) 1460 if (value > IL_PASSIVE_DWELL_BASE || !value)
1462 value = IL_PASSIVE_DWELL_BASE; 1461 value = IL_PASSIVE_DWELL_BASE;
1463 value = (value * 98) / 100 - IL_CHANNEL_TUNE_TIME * 2; 1462 value = (value * 98) / 100 - IL_CHANNEL_TUNE_TIME * 2;
@@ -1832,8 +1831,7 @@ il_send_add_sta(struct il_priv *il, struct il_addsta_cmd *sta, u8 flags)
1832EXPORT_SYMBOL(il_send_add_sta); 1831EXPORT_SYMBOL(il_send_add_sta);
1833 1832
1834static void 1833static void
1835il_set_ht_add_station(struct il_priv *il, u8 idx, struct ieee80211_sta *sta, 1834il_set_ht_add_station(struct il_priv *il, u8 idx, struct ieee80211_sta *sta)
1836 struct il_rxon_context *ctx)
1837{ 1835{
1838 struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap; 1836 struct ieee80211_sta_ht_cap *sta_ht_inf = &sta->ht_cap;
1839 __le32 sta_flags; 1837 __le32 sta_flags;
@@ -1874,7 +1872,7 @@ il_set_ht_add_station(struct il_priv *il, u8 idx, struct ieee80211_sta *sta,
1874 cpu_to_le32((u32) sta_ht_inf-> 1872 cpu_to_le32((u32) sta_ht_inf->
1875 ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS); 1873 ampdu_density << STA_FLG_AGG_MPDU_DENSITY_POS);
1876 1874
1877 if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) 1875 if (il_is_ht40_tx_allowed(il, &sta->ht_cap))
1878 sta_flags |= STA_FLG_HT40_EN_MSK; 1876 sta_flags |= STA_FLG_HT40_EN_MSK;
1879 else 1877 else
1880 sta_flags &= ~STA_FLG_HT40_EN_MSK; 1878 sta_flags &= ~STA_FLG_HT40_EN_MSK;
@@ -1890,8 +1888,8 @@ done:
1890 * should be called with sta_lock held 1888 * should be called with sta_lock held
1891 */ 1889 */
1892u8 1890u8
1893il_prep_station(struct il_priv *il, struct il_rxon_context *ctx, 1891il_prep_station(struct il_priv *il, const u8 *addr, bool is_ap,
1894 const u8 *addr, bool is_ap, struct ieee80211_sta *sta) 1892 struct ieee80211_sta *sta)
1895{ 1893{
1896 struct il_station_entry *station; 1894 struct il_station_entry *station;
1897 int i; 1895 int i;
@@ -1952,19 +1950,12 @@ il_prep_station(struct il_priv *il, struct il_rxon_context *ctx,
1952 station->sta.sta.sta_id = sta_id; 1950 station->sta.sta.sta_id = sta_id;
1953 station->sta.station_flags = 0; 1951 station->sta.station_flags = 0;
1954 1952
1955 if (sta) {
1956 struct il_station_priv_common *sta_priv;
1957
1958 sta_priv = (void *)sta->drv_priv;
1959 sta_priv->ctx = ctx;
1960 }
1961
1962 /* 1953 /*
1963 * OK to call unconditionally, since local stations (IBSS BSSID 1954 * OK to call unconditionally, since local stations (IBSS BSSID
1964 * STA and broadcast STA) pass in a NULL sta, and mac80211 1955 * STA and broadcast STA) pass in a NULL sta, and mac80211
1965 * doesn't allow HT IBSS. 1956 * doesn't allow HT IBSS.
1966 */ 1957 */
1967 il_set_ht_add_station(il, sta_id, sta, ctx); 1958 il_set_ht_add_station(il, sta_id, sta);
1968 1959
1969 /* 3945 only */ 1960 /* 3945 only */
1970 rate = (il->band == IEEE80211_BAND_5GHZ) ? RATE_6M_PLCP : RATE_1M_PLCP; 1961 rate = (il->band == IEEE80211_BAND_5GHZ) ? RATE_6M_PLCP : RATE_1M_PLCP;
@@ -1982,9 +1973,8 @@ EXPORT_SYMBOL_GPL(il_prep_station);
1982 * il_add_station_common - 1973 * il_add_station_common -
1983 */ 1974 */
1984int 1975int
1985il_add_station_common(struct il_priv *il, struct il_rxon_context *ctx, 1976il_add_station_common(struct il_priv *il, const u8 *addr, bool is_ap,
1986 const u8 *addr, bool is_ap, struct ieee80211_sta *sta, 1977 struct ieee80211_sta *sta, u8 *sta_id_r)
1987 u8 *sta_id_r)
1988{ 1978{
1989 unsigned long flags_spin; 1979 unsigned long flags_spin;
1990 int ret = 0; 1980 int ret = 0;
@@ -1993,7 +1983,7 @@ il_add_station_common(struct il_priv *il, struct il_rxon_context *ctx,
1993 1983
1994 *sta_id_r = 0; 1984 *sta_id_r = 0;
1995 spin_lock_irqsave(&il->sta_lock, flags_spin); 1985 spin_lock_irqsave(&il->sta_lock, flags_spin);
1996 sta_id = il_prep_station(il, ctx, addr, is_ap, sta); 1986 sta_id = il_prep_station(il, addr, is_ap, sta);
1997 if (sta_id == IL_INVALID_STATION) { 1987 if (sta_id == IL_INVALID_STATION) {
1998 IL_ERR("Unable to prepare station %pM for addition\n", addr); 1988 IL_ERR("Unable to prepare station %pM for addition\n", addr);
1999 spin_unlock_irqrestore(&il->sta_lock, flags_spin); 1989 spin_unlock_irqrestore(&il->sta_lock, flags_spin);
@@ -2180,7 +2170,7 @@ EXPORT_SYMBOL_GPL(il_remove_station);
2180 * the ucode, e.g. unassociated RXON. 2170 * the ucode, e.g. unassociated RXON.
2181 */ 2171 */
2182void 2172void
2183il_clear_ucode_stations(struct il_priv *il, struct il_rxon_context *ctx) 2173il_clear_ucode_stations(struct il_priv *il)
2184{ 2174{
2185 int i; 2175 int i;
2186 unsigned long flags_spin; 2176 unsigned long flags_spin;
@@ -2212,7 +2202,7 @@ EXPORT_SYMBOL(il_clear_ucode_stations);
2212 * Function sleeps. 2202 * Function sleeps.
2213 */ 2203 */
2214void 2204void
2215il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx) 2205il_restore_stations(struct il_priv *il)
2216{ 2206{
2217 struct il_addsta_cmd sta_cmd; 2207 struct il_addsta_cmd sta_cmd;
2218 struct il_link_quality_cmd lq; 2208 struct il_link_quality_cmd lq;
@@ -2267,7 +2257,7 @@ il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx)
2267 * current LQ command 2257 * current LQ command
2268 */ 2258 */
2269 if (send_lq) 2259 if (send_lq)
2270 il_send_lq_cmd(il, ctx, &lq, CMD_SYNC, true); 2260 il_send_lq_cmd(il, &lq, CMD_SYNC, true);
2271 spin_lock_irqsave(&il->sta_lock, flags_spin); 2261 spin_lock_irqsave(&il->sta_lock, flags_spin);
2272 il->stations[i].used &= ~IL_STA_UCODE_INPROGRESS; 2262 il->stations[i].used &= ~IL_STA_UCODE_INPROGRESS;
2273 } 2263 }
@@ -2347,8 +2337,7 @@ il_dump_lq_cmd(struct il_priv *il, struct il_link_quality_cmd *lq)
2347 * RXON flags are updated and when LQ command is updated. 2337 * RXON flags are updated and when LQ command is updated.
2348 */ 2338 */
2349static bool 2339static bool
2350il_is_lq_table_valid(struct il_priv *il, struct il_rxon_context *ctx, 2340il_is_lq_table_valid(struct il_priv *il, struct il_link_quality_cmd *lq)
2351 struct il_link_quality_cmd *lq)
2352{ 2341{
2353 int i; 2342 int i;
2354 2343
@@ -2376,8 +2365,8 @@ il_is_lq_table_valid(struct il_priv *il, struct il_rxon_context *ctx,
2376 * progress. 2365 * progress.
2377 */ 2366 */
2378int 2367int
2379il_send_lq_cmd(struct il_priv *il, struct il_rxon_context *ctx, 2368il_send_lq_cmd(struct il_priv *il, struct il_link_quality_cmd *lq,
2380 struct il_link_quality_cmd *lq, u8 flags, bool init) 2369 u8 flags, bool init)
2381{ 2370{
2382 int ret = 0; 2371 int ret = 0;
2383 unsigned long flags_spin; 2372 unsigned long flags_spin;
@@ -2402,7 +2391,7 @@ il_send_lq_cmd(struct il_priv *il, struct il_rxon_context *ctx,
2402 il_dump_lq_cmd(il, lq); 2391 il_dump_lq_cmd(il, lq);
2403 BUG_ON(init && (cmd.flags & CMD_ASYNC)); 2392 BUG_ON(init && (cmd.flags & CMD_ASYNC));
2404 2393
2405 if (il_is_lq_table_valid(il, ctx, lq)) 2394 if (il_is_lq_table_valid(il, lq))
2406 ret = il_send_cmd(il, &cmd); 2395 ret = il_send_cmd(il, &cmd);
2407 else 2396 else
2408 ret = -EINVAL; 2397 ret = -EINVAL;
@@ -3556,8 +3545,7 @@ il_is_channel_extension(struct il_priv *il, enum ieee80211_band band,
3556} 3545}
3557 3546
3558bool 3547bool
3559il_is_ht40_tx_allowed(struct il_priv *il, struct il_rxon_context *ctx, 3548il_is_ht40_tx_allowed(struct il_priv *il, struct ieee80211_sta_ht_cap *ht_cap)
3560 struct ieee80211_sta_ht_cap *ht_cap)
3561{ 3549{
3562 if (!il->ht.enabled || !il->ht.is_40mhz) 3550 if (!il->ht.enabled || !il->ht.is_40mhz)
3563 return false; 3551 return false;
@@ -3615,13 +3603,13 @@ il_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val)
3615} 3603}
3616 3604
3617int 3605int
3618il_send_rxon_timing(struct il_priv *il, struct il_rxon_context *ctx) 3606il_send_rxon_timing(struct il_priv *il)
3619{ 3607{
3620 u64 tsf; 3608 u64 tsf;
3621 s32 interval_tm, rem; 3609 s32 interval_tm, rem;
3622 struct ieee80211_conf *conf = NULL; 3610 struct ieee80211_conf *conf = NULL;
3623 u16 beacon_int; 3611 u16 beacon_int;
3624 struct ieee80211_vif *vif = ctx->vif; 3612 struct ieee80211_vif *vif = il->vif;
3625 3613
3626 conf = &il->hw->conf; 3614 conf = &il->hw->conf;
3627 3615
@@ -3664,8 +3652,7 @@ il_send_rxon_timing(struct il_priv *il, struct il_rxon_context *ctx)
3664EXPORT_SYMBOL(il_send_rxon_timing); 3652EXPORT_SYMBOL(il_send_rxon_timing);
3665 3653
3666void 3654void
3667il_set_rxon_hwcrypto(struct il_priv *il, struct il_rxon_context *ctx, 3655il_set_rxon_hwcrypto(struct il_priv *il, int hw_decrypt)
3668 int hw_decrypt)
3669{ 3656{
3670 struct il_rxon_cmd *rxon = &il->staging; 3657 struct il_rxon_cmd *rxon = &il->staging;
3671 3658
@@ -3679,7 +3666,7 @@ EXPORT_SYMBOL(il_set_rxon_hwcrypto);
3679 3666
3680/* validate RXON structure is valid */ 3667/* validate RXON structure is valid */
3681int 3668int
3682il_check_rxon_cmd(struct il_priv *il, struct il_rxon_context *ctx) 3669il_check_rxon_cmd(struct il_priv *il)
3683{ 3670{
3684 struct il_rxon_cmd *rxon = &il->staging; 3671 struct il_rxon_cmd *rxon = &il->staging;
3685 bool error = false; 3672 bool error = false;
@@ -3759,7 +3746,7 @@ EXPORT_SYMBOL(il_check_rxon_cmd);
3759 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required. 3746 * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
3760 */ 3747 */
3761int 3748int
3762il_full_rxon_required(struct il_priv *il, struct il_rxon_context *ctx) 3749il_full_rxon_required(struct il_priv *il)
3763{ 3750{
3764 const struct il_rxon_cmd *staging = &il->staging; 3751 const struct il_rxon_cmd *staging = &il->staging;
3765 const struct il_rxon_cmd *active = &il->active; 3752 const struct il_rxon_cmd *active = &il->active;
@@ -3813,7 +3800,7 @@ il_full_rxon_required(struct il_priv *il, struct il_rxon_context *ctx)
3813EXPORT_SYMBOL(il_full_rxon_required); 3800EXPORT_SYMBOL(il_full_rxon_required);
3814 3801
3815u8 3802u8
3816il_get_lowest_plcp(struct il_priv *il, struct il_rxon_context *ctx) 3803il_get_lowest_plcp(struct il_priv *il)
3817{ 3804{
3818 /* 3805 /*
3819 * Assign the lowest rate -- should really get this from 3806 * Assign the lowest rate -- should really get this from
@@ -3827,8 +3814,7 @@ il_get_lowest_plcp(struct il_priv *il, struct il_rxon_context *ctx)
3827EXPORT_SYMBOL(il_get_lowest_plcp); 3814EXPORT_SYMBOL(il_get_lowest_plcp);
3828 3815
3829static void 3816static void
3830_il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf, 3817_il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf)
3831 struct il_rxon_context *ctx)
3832{ 3818{
3833 struct il_rxon_cmd *rxon = &il->staging; 3819 struct il_rxon_cmd *rxon = &il->staging;
3834 3820
@@ -3848,7 +3834,7 @@ _il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf,
3848 /* clear the HT channel mode before set the mode */ 3834 /* clear the HT channel mode before set the mode */
3849 rxon->flags &= 3835 rxon->flags &=
3850 ~(RXON_FLG_CHANNEL_MODE_MSK | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK); 3836 ~(RXON_FLG_CHANNEL_MODE_MSK | RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK);
3851 if (il_is_ht40_tx_allowed(il, ctx, NULL)) { 3837 if (il_is_ht40_tx_allowed(il, NULL)) {
3852 /* pure ht40 */ 3838 /* pure ht40 */
3853 if (il->ht.protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) { 3839 if (il->ht.protection == IEEE80211_HT_OP_MODE_PROTECTION_20MHZ) {
3854 rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40; 3840 rxon->flags |= RXON_FLG_CHANNEL_MODE_PURE_40;
@@ -3886,7 +3872,7 @@ _il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf,
3886 } 3872 }
3887 3873
3888 if (il->cfg->ops->hcmd->set_rxon_chain) 3874 if (il->cfg->ops->hcmd->set_rxon_chain)
3889 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 3875 il->cfg->ops->hcmd->set_rxon_chain(il);
3890 3876
3891 D_ASSOC("rxon flags 0x%X operation mode :0x%X " 3877 D_ASSOC("rxon flags 0x%X operation mode :0x%X "
3892 "extension channel offset 0x%x\n", le32_to_cpu(rxon->flags), 3878 "extension channel offset 0x%x\n", le32_to_cpu(rxon->flags),
@@ -3896,7 +3882,7 @@ _il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf,
3896void 3882void
3897il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf) 3883il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf)
3898{ 3884{
3899 _il_set_rxon_ht(il, ht_conf, &il->ctx); 3885 _il_set_rxon_ht(il, ht_conf);
3900} 3886}
3901EXPORT_SYMBOL(il_set_rxon_ht); 3887EXPORT_SYMBOL(il_set_rxon_ht);
3902 3888
@@ -3939,8 +3925,7 @@ EXPORT_SYMBOL(il_get_single_channel_number);
3939 * in the staging RXON flag structure based on the ch->band 3925 * in the staging RXON flag structure based on the ch->band
3940 */ 3926 */
3941int 3927int
3942il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch, 3928il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch)
3943 struct il_rxon_context *ctx)
3944{ 3929{
3945 enum ieee80211_band band = ch->band; 3930 enum ieee80211_band band = ch->band;
3946 u16 channel = ch->hw_value; 3931 u16 channel = ch->hw_value;
@@ -3963,8 +3948,8 @@ il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch,
3963EXPORT_SYMBOL(il_set_rxon_channel); 3948EXPORT_SYMBOL(il_set_rxon_channel);
3964 3949
3965void 3950void
3966il_set_flags_for_band(struct il_priv *il, struct il_rxon_context *ctx, 3951il_set_flags_for_band(struct il_priv *il, enum ieee80211_band band,
3967 enum ieee80211_band band, struct ieee80211_vif *vif) 3952 struct ieee80211_vif *vif)
3968{ 3953{
3969 if (band == IEEE80211_BAND_5GHZ) { 3954 if (band == IEEE80211_BAND_5GHZ) {
3970 il->staging.flags &= 3955 il->staging.flags &=
@@ -3989,35 +3974,26 @@ EXPORT_SYMBOL(il_set_flags_for_band);
3989 * initialize rxon structure with default values from eeprom 3974 * initialize rxon structure with default values from eeprom
3990 */ 3975 */
3991void 3976void
3992il_connection_init_rx_config(struct il_priv *il, struct il_rxon_context *ctx) 3977il_connection_init_rx_config(struct il_priv *il)
3993{ 3978{
3994 const struct il_channel_info *ch_info; 3979 const struct il_channel_info *ch_info;
3995 3980
3996 memset(&il->staging, 0, sizeof(il->staging)); 3981 memset(&il->staging, 0, sizeof(il->staging));
3997 3982
3998 if (!ctx->vif) { 3983 if (!il->vif) {
3999 il->staging.dev_type = RXON_DEV_TYPE_ESS; 3984 il->staging.dev_type = RXON_DEV_TYPE_ESS;
4000 } else 3985 } else if (il->vif->type == NL80211_IFTYPE_STATION) {
4001 switch (ctx->vif->type) { 3986 il->staging.dev_type = RXON_DEV_TYPE_ESS;
4002 3987 il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
4003 case NL80211_IFTYPE_STATION: 3988 } else if (il->vif->type == NL80211_IFTYPE_ADHOC) {
4004 il->staging.dev_type = RXON_DEV_TYPE_ESS; 3989 il->staging.dev_type = RXON_DEV_TYPE_IBSS;
4005 il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; 3990 il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
4006 break; 3991 il->staging.filter_flags =
4007 3992 RXON_FILTER_BCON_AWARE_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
4008 case NL80211_IFTYPE_ADHOC: 3993 } else {
4009 il->staging.dev_type = RXON_DEV_TYPE_IBSS; 3994 IL_ERR("Unsupported interface type %d\n", il->vif->type);
4010 il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; 3995 return;
4011 il->staging.filter_flags = 3996 }
4012 RXON_FILTER_BCON_AWARE_MSK |
4013 RXON_FILTER_ACCEPT_GRP_MSK;
4014 break;
4015
4016 default:
4017 IL_ERR("Unsupported interface type %d\n",
4018 ctx->vif->type);
4019 break;
4020 }
4021 3997
4022#if 0 3998#if 0
4023 /* TODO: Figure out when short_preamble would be set and cache from 3999 /* TODO: Figure out when short_preamble would be set and cache from
@@ -4037,7 +4013,7 @@ il_connection_init_rx_config(struct il_priv *il, struct il_rxon_context *ctx)
4037 il->staging.channel = cpu_to_le16(ch_info->channel); 4013 il->staging.channel = cpu_to_le16(ch_info->channel);
4038 il->band = ch_info->band; 4014 il->band = ch_info->band;
4039 4015
4040 il_set_flags_for_band(il, ctx, il->band, ctx->vif); 4016 il_set_flags_for_band(il, il->band, il->vif);
4041 4017
4042 il->staging.ofdm_basic_rates = 4018 il->staging.ofdm_basic_rates =
4043 (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF; 4019 (IL_OFDM_RATES_MASK >> IL_FIRST_OFDM_RATE) & 0xFF;
@@ -4047,8 +4023,8 @@ il_connection_init_rx_config(struct il_priv *il, struct il_rxon_context *ctx)
4047 /* clear both MIX and PURE40 mode flag */ 4023 /* clear both MIX and PURE40 mode flag */
4048 il->staging.flags &= 4024 il->staging.flags &=
4049 ~(RXON_FLG_CHANNEL_MODE_MIXED | RXON_FLG_CHANNEL_MODE_PURE_40); 4025 ~(RXON_FLG_CHANNEL_MODE_MIXED | RXON_FLG_CHANNEL_MODE_PURE_40);
4050 if (ctx->vif) 4026 if (il->vif)
4051 memcpy(il->staging.node_addr, ctx->vif->addr, ETH_ALEN); 4027 memcpy(il->staging.node_addr, il->vif->addr, ETH_ALEN);
4052 4028
4053 il->staging.ofdm_ht_single_stream_basic_rates = 0xff; 4029 il->staging.ofdm_ht_single_stream_basic_rates = 0xff;
4054 il->staging.ofdm_ht_dual_stream_basic_rates = 0xff; 4030 il->staging.ofdm_ht_dual_stream_basic_rates = 0xff;
@@ -4089,13 +4065,11 @@ EXPORT_SYMBOL(il_set_rate);
4089void 4065void
4090il_chswitch_done(struct il_priv *il, bool is_success) 4066il_chswitch_done(struct il_priv *il, bool is_success)
4091{ 4067{
4092 struct il_rxon_context *ctx = &il->ctx;
4093
4094 if (test_bit(S_EXIT_PENDING, &il->status)) 4068 if (test_bit(S_EXIT_PENDING, &il->status))
4095 return; 4069 return;
4096 4070
4097 if (test_and_clear_bit(S_CHANNEL_SWITCH_PENDING, &il->status)) 4071 if (test_and_clear_bit(S_CHANNEL_SWITCH_PENDING, &il->status))
4098 ieee80211_chswitch_done(ctx->vif, is_success); 4072 ieee80211_chswitch_done(il->vif, is_success);
4099} 4073}
4100EXPORT_SYMBOL(il_chswitch_done); 4074EXPORT_SYMBOL(il_chswitch_done);
4101 4075
@@ -4124,7 +4098,7 @@ EXPORT_SYMBOL(il_hdl_csa);
4124 4098
4125#ifdef CONFIG_IWLEGACY_DEBUG 4099#ifdef CONFIG_IWLEGACY_DEBUG
4126void 4100void
4127il_print_rx_config_cmd(struct il_priv *il, struct il_rxon_context *ctx) 4101il_print_rx_config_cmd(struct il_priv *il)
4128{ 4102{
4129 struct il_rxon_cmd *rxon = &il->staging; 4103 struct il_rxon_cmd *rxon = &il->staging;
4130 4104
@@ -4161,7 +4135,7 @@ il_irq_handle_error(struct il_priv *il)
4161 il->cfg->ops->lib->dump_fh(il, NULL, false); 4135 il->cfg->ops->lib->dump_fh(il, NULL, false);
4162#ifdef CONFIG_IWLEGACY_DEBUG 4136#ifdef CONFIG_IWLEGACY_DEBUG
4163 if (il_get_debug_level(il) & IL_DL_FW_ERRORS) 4137 if (il_get_debug_level(il) & IL_DL_FW_ERRORS)
4164 il_print_rx_config_cmd(il, &il->ctx); 4138 il_print_rx_config_cmd(il);
4165#endif 4139#endif
4166 4140
4167 wake_up(&il->wait_command_queue); 4141 wake_up(&il->wait_command_queue);
@@ -4523,21 +4497,20 @@ il_mac_tx_last_beacon(struct ieee80211_hw *hw)
4523EXPORT_SYMBOL_GPL(il_mac_tx_last_beacon); 4497EXPORT_SYMBOL_GPL(il_mac_tx_last_beacon);
4524 4498
4525static int 4499static int
4526il_set_mode(struct il_priv *il, struct il_rxon_context *ctx) 4500il_set_mode(struct il_priv *il)
4527{ 4501{
4528 il_connection_init_rx_config(il, ctx); 4502 il_connection_init_rx_config(il);
4529 4503
4530 if (il->cfg->ops->hcmd->set_rxon_chain) 4504 if (il->cfg->ops->hcmd->set_rxon_chain)
4531 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 4505 il->cfg->ops->hcmd->set_rxon_chain(il);
4532 4506
4533 return il_commit_rxon(il, ctx); 4507 return il_commit_rxon(il);
4534} 4508}
4535 4509
4536int 4510int
4537il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 4511il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
4538{ 4512{
4539 struct il_priv *il = hw->priv; 4513 struct il_priv *il = hw->priv;
4540 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
4541 int err; 4514 int err;
4542 4515
4543 D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr); 4516 D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr);
@@ -4550,18 +4523,17 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
4550 goto out; 4523 goto out;
4551 } 4524 }
4552 4525
4553 if (il->ctx.vif) { 4526 if (il->vif) {
4554 err = -EOPNOTSUPP; 4527 err = -EOPNOTSUPP;
4555 goto out; 4528 goto out;
4556 } 4529 }
4557 4530
4558 vif_priv->ctx = &il->ctx; 4531 il->vif = vif;
4559 il->ctx.vif = vif;
4560 il->iw_mode = vif->type; 4532 il->iw_mode = vif->type;
4561 4533
4562 err = il_set_mode(il, &il->ctx); 4534 err = il_set_mode(il);
4563 if (err) { 4535 if (err) {
4564 il->ctx.vif = NULL; 4536 il->vif = NULL;
4565 il->iw_mode = NL80211_IFTYPE_STATION; 4537 il->iw_mode = NL80211_IFTYPE_STATION;
4566 } 4538 }
4567 4539
@@ -4577,8 +4549,6 @@ static void
4577il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif, 4549il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif,
4578 bool mode_change) 4550 bool mode_change)
4579{ 4551{
4580 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
4581
4582 lockdep_assert_held(&il->mutex); 4552 lockdep_assert_held(&il->mutex);
4583 4553
4584 if (il->scan_vif == vif) { 4554 if (il->scan_vif == vif) {
@@ -4587,7 +4557,7 @@ il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif,
4587 } 4557 }
4588 4558
4589 if (!mode_change) 4559 if (!mode_change)
4590 il_set_mode(il, ctx); 4560 il_set_mode(il);
4591 4561
4592} 4562}
4593 4563
@@ -4595,14 +4565,13 @@ void
4595il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 4565il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
4596{ 4566{
4597 struct il_priv *il = hw->priv; 4567 struct il_priv *il = hw->priv;
4598 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
4599 4568
4600 D_MAC80211("enter\n"); 4569 D_MAC80211("enter\n");
4601 4570
4602 mutex_lock(&il->mutex); 4571 mutex_lock(&il->mutex);
4603 4572
4604 WARN_ON(ctx->vif != vif); 4573 WARN_ON(il->vif != vif);
4605 ctx->vif = NULL; 4574 il->vif = NULL;
4606 4575
4607 il_teardown_interface(il, vif, false); 4576 il_teardown_interface(il, vif, false);
4608 4577
@@ -4941,7 +4910,6 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4941 enum nl80211_iftype newtype, bool newp2p) 4910 enum nl80211_iftype newtype, bool newp2p)
4942{ 4911{
4943 struct il_priv *il = hw->priv; 4912 struct il_priv *il = hw->priv;
4944 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
4945 int err; 4913 int err;
4946 4914
4947 if (newp2p) 4915 if (newp2p)
@@ -4949,7 +4917,7 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4949 4917
4950 mutex_lock(&il->mutex); 4918 mutex_lock(&il->mutex);
4951 4919
4952 if (!ctx->vif || !il_is_ready_rf(il)) { 4920 if (!il->vif || !il_is_ready_rf(il)) {
4953 /* 4921 /*
4954 * Huh? But wait ... this can maybe happen when 4922 * Huh? But wait ... this can maybe happen when
4955 * we're in the middle of a firmware restart! 4923 * we're in the middle of a firmware restart!
@@ -4962,7 +4930,7 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4962 il_teardown_interface(il, vif, true); 4930 il_teardown_interface(il, vif, true);
4963 vif->type = newtype; 4931 vif->type = newtype;
4964 vif->p2p = false; 4932 vif->p2p = false;
4965 err = il_set_mode(il, ctx); 4933 err = il_set_mode(il);
4966 WARN_ON(err); 4934 WARN_ON(err);
4967 /* 4935 /*
4968 * We've switched internally, but submitting to the 4936 * We've switched internally, but submitting to the
@@ -5194,7 +5162,7 @@ EXPORT_SYMBOL(il_pm_ops);
5194#endif /* CONFIG_PM */ 5162#endif /* CONFIG_PM */
5195 5163
5196static void 5164static void
5197il_update_qos(struct il_priv *il, struct il_rxon_context *ctx) 5165il_update_qos(struct il_priv *il)
5198{ 5166{
5199 if (test_bit(S_EXIT_PENDING, &il->status)) 5167 if (test_bit(S_EXIT_PENDING, &il->status))
5200 return; 5168 return;
@@ -5226,7 +5194,6 @@ il_mac_config(struct ieee80211_hw *hw, u32 changed)
5226 struct ieee80211_conf *conf = &hw->conf; 5194 struct ieee80211_conf *conf = &hw->conf;
5227 struct ieee80211_channel *channel = conf->channel; 5195 struct ieee80211_channel *channel = conf->channel;
5228 struct il_ht_config *ht_conf = &il->current_ht_config; 5196 struct il_ht_config *ht_conf = &il->current_ht_config;
5229 struct il_rxon_context *ctx = &il->ctx;
5230 unsigned long flags = 0; 5197 unsigned long flags = 0;
5231 int ret = 0; 5198 int ret = 0;
5232 u16 ch; 5199 u16 ch;
@@ -5259,7 +5226,7 @@ il_mac_config(struct ieee80211_hw *hw, u32 changed)
5259 * configured. 5226 * configured.
5260 */ 5227 */
5261 if (il->cfg->ops->hcmd->set_rxon_chain) 5228 if (il->cfg->ops->hcmd->set_rxon_chain)
5262 il->cfg->ops->hcmd->set_rxon_chain(il, &il->ctx); 5229 il->cfg->ops->hcmd->set_rxon_chain(il);
5263 } 5230 }
5264 5231
5265 /* during scanning mac80211 will delay channel setting until 5232 /* during scanning mac80211 will delay channel setting until
@@ -5321,10 +5288,10 @@ il_mac_config(struct ieee80211_hw *hw, u32 changed)
5321 if ((le16_to_cpu(il->staging.channel) != ch)) 5288 if ((le16_to_cpu(il->staging.channel) != ch))
5322 il->staging.flags = 0; 5289 il->staging.flags = 0;
5323 5290
5324 il_set_rxon_channel(il, channel, ctx); 5291 il_set_rxon_channel(il, channel);
5325 il_set_rxon_ht(il, ht_conf); 5292 il_set_rxon_ht(il, ht_conf);
5326 5293
5327 il_set_flags_for_band(il, ctx, channel->band, ctx->vif); 5294 il_set_flags_for_band(il, channel->band, il->vif);
5328 5295
5329 spin_unlock_irqrestore(&il->lock, flags); 5296 spin_unlock_irqrestore(&il->lock, flags);
5330 5297
@@ -5360,11 +5327,11 @@ set_ch_out:
5360 goto out; 5327 goto out;
5361 5328
5362 if (memcmp(&il->active, &il->staging, sizeof(il->staging))) 5329 if (memcmp(&il->active, &il->staging, sizeof(il->staging)))
5363 il_commit_rxon(il, ctx); 5330 il_commit_rxon(il);
5364 else 5331 else
5365 D_INFO("Not re-sending same RXON configuration.\n"); 5332 D_INFO("Not re-sending same RXON configuration.\n");
5366 if (ht_changed) 5333 if (ht_changed)
5367 il_update_qos(il, ctx); 5334 il_update_qos(il);
5368 5335
5369out: 5336out:
5370 D_MAC80211("leave\n"); 5337 D_MAC80211("leave\n");
@@ -5378,7 +5345,6 @@ il_mac_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
5378{ 5345{
5379 struct il_priv *il = hw->priv; 5346 struct il_priv *il = hw->priv;
5380 unsigned long flags; 5347 unsigned long flags;
5381 struct il_rxon_context *ctx = &il->ctx;
5382 5348
5383 if (WARN_ON(!il->cfg->ops->legacy)) 5349 if (WARN_ON(!il->cfg->ops->legacy))
5384 return; 5350 return;
@@ -5413,7 +5379,7 @@ il_mac_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
5413 * clear RXON_FILTER_ASSOC_MSK bit 5379 * clear RXON_FILTER_ASSOC_MSK bit
5414 */ 5380 */
5415 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 5381 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5416 il_commit_rxon(il, ctx); 5382 il_commit_rxon(il);
5417 5383
5418 il_set_rate(il); 5384 il_set_rate(il);
5419 5385
@@ -5486,8 +5452,6 @@ il_ht_conf(struct il_priv *il, struct ieee80211_vif *vif)
5486static inline void 5452static inline void
5487il_set_no_assoc(struct il_priv *il, struct ieee80211_vif *vif) 5453il_set_no_assoc(struct il_priv *il, struct ieee80211_vif *vif)
5488{ 5454{
5489 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
5490
5491 /* 5455 /*
5492 * inform the ucode that there is no longer an 5456 * inform the ucode that there is no longer an
5493 * association and that no more packets should be 5457 * association and that no more packets should be
@@ -5495,7 +5459,7 @@ il_set_no_assoc(struct il_priv *il, struct ieee80211_vif *vif)
5495 */ 5459 */
5496 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 5460 il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
5497 il->staging.assoc_id = 0; 5461 il->staging.assoc_id = 0;
5498 il_commit_rxon(il, ctx); 5462 il_commit_rxon(il);
5499} 5463}
5500 5464
5501static void 5465static void
@@ -5513,8 +5477,8 @@ il_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
5513 5477
5514 lockdep_assert_held(&il->mutex); 5478 lockdep_assert_held(&il->mutex);
5515 5479
5516 if (!il->beacon_ctx) { 5480 if (!il->beacon_enabled) {
5517 IL_ERR("update beacon but no beacon context!\n"); 5481 IL_ERR("update beacon with no beaconing enabled\n");
5518 dev_kfree_skb(skb); 5482 dev_kfree_skb(skb);
5519 return; 5483 return;
5520 } 5484 }
@@ -5545,7 +5509,6 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5545 struct ieee80211_bss_conf *bss_conf, u32 changes) 5509 struct ieee80211_bss_conf *bss_conf, u32 changes)
5546{ 5510{
5547 struct il_priv *il = hw->priv; 5511 struct il_priv *il = hw->priv;
5548 struct il_rxon_context *ctx = il_rxon_ctx_from_vif(vif);
5549 int ret; 5512 int ret;
5550 5513
5551 if (WARN_ON(!il->cfg->ops->legacy)) 5514 if (WARN_ON(!il->cfg->ops->legacy))
@@ -5565,20 +5528,16 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5565 5528
5566 spin_lock_irqsave(&il->lock, flags); 5529 spin_lock_irqsave(&il->lock, flags);
5567 il->qos_data.qos_active = bss_conf->qos; 5530 il->qos_data.qos_active = bss_conf->qos;
5568 il_update_qos(il, ctx); 5531 il_update_qos(il);
5569 spin_unlock_irqrestore(&il->lock, flags); 5532 spin_unlock_irqrestore(&il->lock, flags);
5570 } 5533 }
5571 5534
5572 if (changes & BSS_CHANGED_BEACON_ENABLED) { 5535 if (changes & BSS_CHANGED_BEACON_ENABLED) {
5573 /* 5536 /* FIXME: can we remove beacon_enabled ? */
5574 * the add_interface code must make sure we only ever
5575 * have a single interface that could be beaconing at
5576 * any time.
5577 */
5578 if (vif->bss_conf.enable_beacon) 5537 if (vif->bss_conf.enable_beacon)
5579 il->beacon_ctx = ctx; 5538 il->beacon_enabled = true;
5580 else 5539 else
5581 il->beacon_ctx = NULL; 5540 il->beacon_enabled = false;
5582 } 5541 }
5583 5542
5584 if (changes & BSS_CHANGED_BSSID) { 5543 if (changes & BSS_CHANGED_BSSID) {
@@ -5658,7 +5617,7 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5658 il_ht_conf(il, vif); 5617 il_ht_conf(il, vif);
5659 5618
5660 if (il->cfg->ops->hcmd->set_rxon_chain) 5619 if (il->cfg->ops->hcmd->set_rxon_chain)
5661 il->cfg->ops->hcmd->set_rxon_chain(il, ctx); 5620 il->cfg->ops->hcmd->set_rxon_chain(il);
5662 } 5621 }
5663 5622
5664 if (changes & BSS_CHANGED_ASSOC) { 5623 if (changes & BSS_CHANGED_ASSOC) {
@@ -5674,7 +5633,7 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5674 5633
5675 if (changes && il_is_associated(il) && bss_conf->aid) { 5634 if (changes && il_is_associated(il) && bss_conf->aid) {
5676 D_MAC80211("Changes (%#x) while associated\n", changes); 5635 D_MAC80211("Changes (%#x) while associated\n", changes);
5677 ret = il_send_rxon_assoc(il, ctx); 5636 ret = il_send_rxon_assoc(il);
5678 if (!ret) { 5637 if (!ret) {
5679 /* Sync active_rxon with latest change. */ 5638 /* Sync active_rxon with latest change. */
5680 memcpy((void *)&il->active, &il->staging, 5639 memcpy((void *)&il->active, &il->staging,
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index 51c1eecf7510..746eec08886d 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -146,7 +146,6 @@ struct il_queue {
146/* One for each TFD */ 146/* One for each TFD */
147struct il_tx_info { 147struct il_tx_info {
148 struct sk_buff *skb; 148 struct sk_buff *skb;
149 struct il_rxon_context *ctx;
150}; 149};
151 150
152/** 151/**
@@ -741,7 +740,6 @@ struct il_station_entry {
741}; 740};
742 741
743struct il_station_priv_common { 742struct il_station_priv_common {
744 struct il_rxon_context *ctx;
745 u8 sta_id; 743 u8 sta_id;
746}; 744};
747 745
@@ -752,7 +750,6 @@ struct il_station_priv_common {
752 * space for us to put data into. 750 * space for us to put data into.
753 */ 751 */
754struct il_vif_priv { 752struct il_vif_priv {
755 struct il_rxon_context *ctx;
756 u8 ibss_bssid_sta_id; 753 u8 ibss_bssid_sta_id;
757}; 754};
758 755
@@ -1257,7 +1254,7 @@ struct il_priv {
1257 u8 ucode_write_complete; /* the image write is complete */ 1254 u8 ucode_write_complete; /* the image write is complete */
1258 char firmware_name[25]; 1255 char firmware_name[25];
1259 1256
1260 struct il_rxon_context ctx; 1257 struct ieee80211_vif *vif;
1261 1258
1262 struct il_qos_info qos_data; 1259 struct il_qos_info qos_data;
1263 1260
@@ -1426,7 +1423,7 @@ struct il_priv {
1426 struct work_struct rx_replenish; 1423 struct work_struct rx_replenish;
1427 struct work_struct abort_scan; 1424 struct work_struct abort_scan;
1428 1425
1429 struct il_rxon_context *beacon_ctx; 1426 bool beacon_enabled;
1430 struct sk_buff *beacon_skb; 1427 struct sk_buff *beacon_skb;
1431 1428
1432 struct work_struct tx_flush; 1429 struct work_struct tx_flush;
@@ -1493,17 +1490,6 @@ il_tx_queue_get_hdr(struct il_priv *il, int txq_id, int idx)
1493 return NULL; 1490 return NULL;
1494} 1491}
1495 1492
1496static inline struct il_rxon_context *
1497il_rxon_ctx_from_vif(struct ieee80211_vif *vif)
1498{
1499 struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
1500
1501 return vif_priv->ctx;
1502}
1503
1504#define for_each_context(il, _ctx) \
1505 for (_ctx = &il->ctx; _ctx == &il->ctx; _ctx++)
1506
1507static inline int 1493static inline int
1508il_is_associated(struct il_priv *il) 1494il_is_associated(struct il_priv *il)
1509{ 1495{
@@ -1585,10 +1571,9 @@ il_free_pages(struct il_priv *il, unsigned long page)
1585#define IL_RX_BUF_SIZE_8K (8 * 1024) 1571#define IL_RX_BUF_SIZE_8K (8 * 1024)
1586 1572
1587struct il_hcmd_ops { 1573struct il_hcmd_ops {
1588 int (*rxon_assoc) (struct il_priv *il, struct il_rxon_context *ctx); 1574 int (*rxon_assoc) (struct il_priv *il);
1589 int (*commit_rxon) (struct il_priv *il, struct il_rxon_context *ctx); 1575 int (*commit_rxon) (struct il_priv *il);
1590 void (*set_rxon_chain) (struct il_priv *il, 1576 void (*set_rxon_chain) (struct il_priv *il);
1591 struct il_rxon_context *ctx);
1592}; 1577};
1593 1578
1594struct il_hcmd_utils_ops { 1579struct il_hcmd_utils_ops {
@@ -1811,20 +1796,17 @@ int il_mac_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1811 u16 queue, const struct ieee80211_tx_queue_params *params); 1796 u16 queue, const struct ieee80211_tx_queue_params *params);
1812int il_mac_tx_last_beacon(struct ieee80211_hw *hw); 1797int il_mac_tx_last_beacon(struct ieee80211_hw *hw);
1813 1798
1814void il_set_rxon_hwcrypto(struct il_priv *il, struct il_rxon_context *ctx, 1799void il_set_rxon_hwcrypto(struct il_priv *il, int hw_decrypt);
1815 int hw_decrypt); 1800int il_check_rxon_cmd(struct il_priv *il);
1816int il_check_rxon_cmd(struct il_priv *il, struct il_rxon_context *ctx); 1801int il_full_rxon_required(struct il_priv *il);
1817int il_full_rxon_required(struct il_priv *il, struct il_rxon_context *ctx); 1802int il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch);
1818int il_set_rxon_channel(struct il_priv *il, struct ieee80211_channel *ch, 1803void il_set_flags_for_band(struct il_priv *il, enum ieee80211_band band,
1819 struct il_rxon_context *ctx); 1804 struct ieee80211_vif *vif);
1820void il_set_flags_for_band(struct il_priv *il, struct il_rxon_context *ctx,
1821 enum ieee80211_band band, struct ieee80211_vif *vif);
1822u8 il_get_single_channel_number(struct il_priv *il, enum ieee80211_band band); 1805u8 il_get_single_channel_number(struct il_priv *il, enum ieee80211_band band);
1823void il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf); 1806void il_set_rxon_ht(struct il_priv *il, struct il_ht_config *ht_conf);
1824bool il_is_ht40_tx_allowed(struct il_priv *il, struct il_rxon_context *ctx, 1807bool il_is_ht40_tx_allowed(struct il_priv *il,
1825 struct ieee80211_sta_ht_cap *ht_cap); 1808 struct ieee80211_sta_ht_cap *ht_cap);
1826void il_connection_init_rx_config(struct il_priv *il, 1809void il_connection_init_rx_config(struct il_priv *il);
1827 struct il_rxon_context *ctx);
1828void il_set_rate(struct il_priv *il); 1810void il_set_rate(struct il_priv *il);
1829int il_set_decrypted_flag(struct il_priv *il, struct ieee80211_hdr *hdr, 1811int il_set_decrypted_flag(struct il_priv *il, struct ieee80211_hdr *hdr,
1830 u32 decrypt_res, struct ieee80211_rx_status *stats); 1812 u32 decrypt_res, struct ieee80211_rx_status *stats);
@@ -1927,7 +1909,7 @@ int il_set_tx_power(struct il_priv *il, s8 tx_power, bool force);
1927 * Rate 1909 * Rate
1928 ******************************************************************************/ 1910 ******************************************************************************/
1929 1911
1930u8 il_get_lowest_plcp(struct il_priv *il, struct il_rxon_context *ctx); 1912u8 il_get_lowest_plcp(struct il_priv *il);
1931 1913
1932/******************************************************************************* 1914/*******************************************************************************
1933 * Scanning 1915 * Scanning
@@ -2014,10 +1996,10 @@ extern const struct dev_pm_ops il_pm_ops;
2014******************************************************/ 1996******************************************************/
2015void il4965_dump_nic_error_log(struct il_priv *il); 1997void il4965_dump_nic_error_log(struct il_priv *il);
2016#ifdef CONFIG_IWLEGACY_DEBUG 1998#ifdef CONFIG_IWLEGACY_DEBUG
2017void il_print_rx_config_cmd(struct il_priv *il, struct il_rxon_context *ctx); 1999void il_print_rx_config_cmd(struct il_priv *il);
2018#else 2000#else
2019static inline void 2001static inline void
2020il_print_rx_config_cmd(struct il_priv *il, struct il_rxon_context *ctx) 2002il_print_rx_config_cmd(struct il_priv *il)
2021{ 2003{
2022} 2004}
2023#endif 2005#endif
@@ -2106,17 +2088,18 @@ extern int il_send_stats_request(struct il_priv *il, u8 flags, bool clear);
2106void il_apm_stop(struct il_priv *il); 2088void il_apm_stop(struct il_priv *il);
2107int il_apm_init(struct il_priv *il); 2089int il_apm_init(struct il_priv *il);
2108 2090
2109int il_send_rxon_timing(struct il_priv *il, struct il_rxon_context *ctx); 2091int il_send_rxon_timing(struct il_priv *il);
2092
2110static inline int 2093static inline int
2111il_send_rxon_assoc(struct il_priv *il, struct il_rxon_context *ctx) 2094il_send_rxon_assoc(struct il_priv *il)
2112{ 2095{
2113 return il->cfg->ops->hcmd->rxon_assoc(il, ctx); 2096 return il->cfg->ops->hcmd->rxon_assoc(il);
2114} 2097}
2115 2098
2116static inline int 2099static inline int
2117il_commit_rxon(struct il_priv *il, struct il_rxon_context *ctx) 2100il_commit_rxon(struct il_priv *il)
2118{ 2101{
2119 return il->cfg->ops->hcmd->commit_rxon(il, ctx); 2102 return il->cfg->ops->hcmd->commit_rxon(il);
2120} 2103}
2121 2104
2122static inline const struct ieee80211_supported_band * 2105static inline const struct ieee80211_supported_band *
@@ -2274,23 +2257,22 @@ il_clear_bits_prph(struct il_priv *il, u32 reg, u32 mask)
2274 (this is for the IBSS BSSID stations) */ 2257 (this is for the IBSS BSSID stations) */
2275#define IL_STA_BCAST BIT(4) /* this station is the special bcast station */ 2258#define IL_STA_BCAST BIT(4) /* this station is the special bcast station */
2276 2259
2277void il_restore_stations(struct il_priv *il, struct il_rxon_context *ctx); 2260void il_restore_stations(struct il_priv *il);
2278void il_clear_ucode_stations(struct il_priv *il, struct il_rxon_context *ctx); 2261void il_clear_ucode_stations(struct il_priv *il);
2279void il_dealloc_bcast_stations(struct il_priv *il); 2262void il_dealloc_bcast_stations(struct il_priv *il);
2280int il_get_free_ucode_key_idx(struct il_priv *il); 2263int il_get_free_ucode_key_idx(struct il_priv *il);
2281int il_send_add_sta(struct il_priv *il, struct il_addsta_cmd *sta, u8 flags); 2264int il_send_add_sta(struct il_priv *il, struct il_addsta_cmd *sta, u8 flags);
2282int il_add_station_common(struct il_priv *il, struct il_rxon_context *ctx, 2265int il_add_station_common(struct il_priv *il, const u8 *addr, bool is_ap,
2283 const u8 *addr, bool is_ap,
2284 struct ieee80211_sta *sta, u8 *sta_id_r); 2266 struct ieee80211_sta *sta, u8 *sta_id_r);
2285int il_remove_station(struct il_priv *il, const u8 sta_id, const u8 * addr); 2267int il_remove_station(struct il_priv *il, const u8 sta_id, const u8 * addr);
2286int il_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2268int il_mac_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2287 struct ieee80211_sta *sta); 2269 struct ieee80211_sta *sta);
2288 2270
2289u8 il_prep_station(struct il_priv *il, struct il_rxon_context *ctx, 2271u8 il_prep_station(struct il_priv *il, const u8 *addr, bool is_ap,
2290 const u8 *addr, bool is_ap, struct ieee80211_sta *sta); 2272 struct ieee80211_sta *sta);
2291 2273
2292int il_send_lq_cmd(struct il_priv *il, struct il_rxon_context *ctx, 2274int il_send_lq_cmd(struct il_priv *il, struct il_link_quality_cmd *lq,
2293 struct il_link_quality_cmd *lq, u8 flags, bool init); 2275 u8 flags, bool init);
2294 2276
2295/** 2277/**
2296 * il_clear_driver_stations - clear knowledge of all stations from driver 2278 * il_clear_driver_stations - clear knowledge of all stations from driver
@@ -2334,8 +2316,7 @@ il_sta_id(struct ieee80211_sta *sta)
2334 * inline wraps that pattern. 2316 * inline wraps that pattern.
2335 */ 2317 */
2336static inline int 2318static inline int
2337il_sta_id_or_broadcast(struct il_priv *il, struct il_rxon_context *context, 2319il_sta_id_or_broadcast(struct il_priv *il, struct ieee80211_sta *sta)
2338 struct ieee80211_sta *sta)
2339{ 2320{
2340 int sta_id; 2321 int sta_id;
2341 2322