aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig5
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-led.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c73
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c22
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c59
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c152
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h28
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-led.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rfkill.c144
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rfkill.h48
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c56
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c269
23 files changed, 183 insertions, 776 deletions
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index 8304f6406a17..029ccb6bdbaa 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -5,16 +5,11 @@ config IWLWIFI
5 select FW_LOADER 5 select FW_LOADER
6 select MAC80211_LEDS if IWLWIFI_LEDS 6 select MAC80211_LEDS if IWLWIFI_LEDS
7 select LEDS_CLASS if IWLWIFI_LEDS 7 select LEDS_CLASS if IWLWIFI_LEDS
8 select RFKILL if IWLWIFI_RFKILL
9 8
10config IWLWIFI_LEDS 9config IWLWIFI_LEDS
11 bool "Enable LED support in iwlagn and iwl3945 drivers" 10 bool "Enable LED support in iwlagn and iwl3945 drivers"
12 depends on IWLWIFI 11 depends on IWLWIFI
13 12
14config IWLWIFI_RFKILL
15 bool "Enable RF kill support in iwlagn and iwl3945 drivers"
16 depends on IWLWIFI
17
18config IWLWIFI_SPECTRUM_MEASUREMENT 13config IWLWIFI_SPECTRUM_MEASUREMENT
19 bool "Enable Spectrum Measurement in iwlagn driver" 14 bool "Enable Spectrum Measurement in iwlagn driver"
20 depends on IWLWIFI 15 depends on IWLWIFI
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index d79d97ad61a5..1d4e0a226fd4 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -4,7 +4,6 @@ iwlcore-objs += iwl-rx.o iwl-tx.o iwl-sta.o iwl-calib.o
4iwlcore-objs += iwl-scan.o 4iwlcore-objs += iwl-scan.o
5iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o 5iwlcore-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
6iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o 6iwlcore-$(CONFIG_IWLWIFI_LEDS) += iwl-led.o
7iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o
8iwlcore-$(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) += iwl-spectrum.o 7iwlcore-$(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) += iwl-spectrum.o
9 8
10obj-$(CONFIG_IWLAGN) += iwlagn.o 9obj-$(CONFIG_IWLAGN) += iwlagn.o
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
index bd7e520d98c2..225e5f889346 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
@@ -167,10 +167,6 @@ static int iwl3945_led_disassociate(struct iwl_priv *priv, int led_id)
167 IWL_DEBUG_LED(priv, "Disassociated\n"); 167 IWL_DEBUG_LED(priv, "Disassociated\n");
168 168
169 priv->allow_blinking = 0; 169 priv->allow_blinking = 0;
170 if (iwl_is_rfkill(priv))
171 iwl3945_led_off(priv, led_id);
172 else
173 iwl3945_led_on(priv, led_id);
174 170
175 return 0; 171 return 0;
176} 172}
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 814afaf6d10b..5eb538d18a80 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -38,6 +38,7 @@
38 38
39#include "iwl-commands.h" 39#include "iwl-commands.h"
40#include "iwl-3945.h" 40#include "iwl-3945.h"
41#include "iwl-sta.h"
41 42
42#define RS_NAME "iwl-3945-rs" 43#define RS_NAME "iwl-3945-rs"
43 44
@@ -714,13 +715,13 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
714 715
715 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && 716 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
716 !rs_sta->ibss_sta_added) { 717 !rs_sta->ibss_sta_added) {
717 u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); 718 u8 sta_id = iwl_find_station(priv, hdr->addr1);
718 719
719 if (sta_id == IWL_INVALID_STATION) { 720 if (sta_id == IWL_INVALID_STATION) {
720 IWL_DEBUG_RATE(priv, "LQ: ADD station %pm\n", 721 IWL_DEBUG_RATE(priv, "LQ: ADD station %pm\n",
721 hdr->addr1); 722 hdr->addr1);
722 sta_id = iwl3945_add_station(priv, 723 sta_id = iwl_add_station(priv, hdr->addr1, false,
723 hdr->addr1, 0, CMD_ASYNC, NULL); 724 CMD_ASYNC, NULL);
724 } 725 }
725 if (sta_id != IWL_INVALID_STATION) 726 if (sta_id != IWL_INVALID_STATION)
726 rs_sta->ibss_sta_added = 1; 727 rs_sta->ibss_sta_added = 1;
@@ -975,7 +976,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
975 976
976 rcu_read_lock(); 977 rcu_read_lock();
977 978
978 sta = ieee80211_find_sta(hw, priv->stations_39[sta_id].sta.sta.addr); 979 sta = ieee80211_find_sta(hw, priv->stations[sta_id].sta.sta.addr);
979 if (!sta) { 980 if (!sta) {
980 rcu_read_unlock(); 981 rcu_read_unlock();
981 return; 982 return;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index fd65e1c3e055..46288e724889 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -769,35 +769,6 @@ void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
769 return ; 769 return ;
770} 770}
771 771
772u8 iwl3945_hw_find_station(struct iwl_priv *priv, const u8 *addr)
773{
774 int i, start = IWL_AP_ID;
775 int ret = IWL_INVALID_STATION;
776 unsigned long flags;
777
778 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) ||
779 (priv->iw_mode == NL80211_IFTYPE_AP))
780 start = IWL_STA_ID;
781
782 if (is_broadcast_ether_addr(addr))
783 return priv->hw_params.bcast_sta_id;
784
785 spin_lock_irqsave(&priv->sta_lock, flags);
786 for (i = start; i < priv->hw_params.max_stations; i++)
787 if ((priv->stations_39[i].used) &&
788 (!compare_ether_addr
789 (priv->stations_39[i].sta.sta.addr, addr))) {
790 ret = i;
791 goto out;
792 }
793
794 IWL_DEBUG_INFO(priv, "can not find STA %pM (total %d)\n",
795 addr, priv->num_stations);
796 out:
797 spin_unlock_irqrestore(&priv->sta_lock, flags);
798 return ret;
799}
800
801/** 772/**
802 * iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD: 773 * iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD:
803 * 774 *
@@ -875,13 +846,13 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, struct iwl_cmd *cmd,
875u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags) 846u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags)
876{ 847{
877 unsigned long flags_spin; 848 unsigned long flags_spin;
878 struct iwl3945_station_entry *station; 849 struct iwl_station_entry *station;
879 850
880 if (sta_id == IWL_INVALID_STATION) 851 if (sta_id == IWL_INVALID_STATION)
881 return IWL_INVALID_STATION; 852 return IWL_INVALID_STATION;
882 853
883 spin_lock_irqsave(&priv->sta_lock, flags_spin); 854 spin_lock_irqsave(&priv->sta_lock, flags_spin);
884 station = &priv->stations_39[sta_id]; 855 station = &priv->stations[sta_id];
885 856
886 station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; 857 station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK;
887 station->sta.rate_n_flags = cpu_to_le16(tx_rate); 858 station->sta.rate_n_flags = cpu_to_le16(tx_rate);
@@ -889,8 +860,7 @@ u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags)
889 860
890 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 861 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
891 862
892 iwl_send_add_sta(priv, 863 iwl_send_add_sta(priv, &station->sta, flags);
893 (struct iwl_addsta_cmd *)&station->sta, flags);
894 IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n", 864 IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n",
895 sta_id, tx_rate); 865 sta_id, tx_rate);
896 return sta_id; 866 return sta_id;
@@ -2029,7 +1999,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
2029 1999
2030 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); 2000 memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
2031 2001
2032 priv->cfg->ops->smgmt->clear_station_table(priv); 2002 iwl_clear_stations_table(priv);
2033 2003
2034 /* If we issue a new RXON command which required a tune then we must 2004 /* If we issue a new RXON command which required a tune then we must
2035 * send a new TXPOWER command or we won't be able to Tx any frames */ 2005 * send a new TXPOWER command or we won't be able to Tx any frames */
@@ -2040,7 +2010,7 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
2040 } 2010 }
2041 2011
2042 /* Add the broadcast address so we can send broadcast frames */ 2012 /* Add the broadcast address so we can send broadcast frames */
2043 if (priv->cfg->ops->smgmt->add_station(priv, iwl_bcast_addr, 0, 0, NULL) == 2013 if (iwl_add_station(priv, iwl_bcast_addr, false, CMD_SYNC, NULL) ==
2044 IWL_INVALID_STATION) { 2014 IWL_INVALID_STATION) {
2045 IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n"); 2015 IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n");
2046 return -EIO; 2016 return -EIO;
@@ -2050,9 +2020,8 @@ static int iwl3945_commit_rxon(struct iwl_priv *priv)
2050 * add the IWL_AP_ID to the station rate table */ 2020 * add the IWL_AP_ID to the station rate table */
2051 if (iwl_is_associated(priv) && 2021 if (iwl_is_associated(priv) &&
2052 (priv->iw_mode == NL80211_IFTYPE_STATION)) 2022 (priv->iw_mode == NL80211_IFTYPE_STATION))
2053 if (priv->cfg->ops->smgmt->add_station(priv, 2023 if (iwl_add_station(priv, priv->active_rxon.bssid_addr,
2054 priv->active_rxon.bssid_addr, 1, 0, NULL) 2024 true, CMD_SYNC, NULL) == IWL_INVALID_STATION) {
2055 == IWL_INVALID_STATION) {
2056 IWL_ERR(priv, "Error adding AP address for transmit\n"); 2025 IWL_ERR(priv, "Error adding AP address for transmit\n");
2057 return -EIO; 2026 return -EIO;
2058 } 2027 }
@@ -2466,13 +2435,25 @@ static u16 iwl3945_get_hcmd_size(u8 cmd_id, u16 len)
2466 } 2435 }
2467} 2436}
2468 2437
2438
2469static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) 2439static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
2470{ 2440{
2471 u16 size = (u16)sizeof(struct iwl3945_addsta_cmd); 2441 struct iwl3945_addsta_cmd *addsta = (struct iwl3945_addsta_cmd *)data;
2472 memcpy(data, cmd, size); 2442 addsta->mode = cmd->mode;
2473 return size; 2443 memcpy(&addsta->sta, &cmd->sta, sizeof(struct sta_id_modify));
2444 memcpy(&addsta->key, &cmd->key, sizeof(struct iwl4965_keyinfo));
2445 addsta->station_flags = cmd->station_flags;
2446 addsta->station_flags_msk = cmd->station_flags_msk;
2447 addsta->tid_disable_tx = cpu_to_le16(0);
2448 addsta->rate_n_flags = cmd->rate_n_flags;
2449 addsta->add_immediate_ba_tid = cmd->add_immediate_ba_tid;
2450 addsta->remove_immediate_ba_tid = cmd->remove_immediate_ba_tid;
2451 addsta->add_immediate_ba_ssn = cmd->add_immediate_ba_ssn;
2452
2453 return (u16)sizeof(struct iwl3945_addsta_cmd);
2474} 2454}
2475 2455
2456
2476/** 2457/**
2477 * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table 2458 * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table
2478 */ 2459 */
@@ -2842,15 +2823,6 @@ static struct iwl_lib_ops iwl3945_lib = {
2842 .config_ap = iwl3945_config_ap, 2823 .config_ap = iwl3945_config_ap,
2843}; 2824};
2844 2825
2845static struct iwl_station_mgmt_ops iwl3945_station_mgmt = {
2846 .add_station = iwl3945_add_station,
2847#if 0
2848 .remove_station = iwl3945_remove_station,
2849#endif
2850 .find_station = iwl3945_hw_find_station,
2851 .clear_station_table = iwl3945_clear_stations_table,
2852};
2853
2854static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { 2826static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
2855 .get_hcmd_size = iwl3945_get_hcmd_size, 2827 .get_hcmd_size = iwl3945_get_hcmd_size,
2856 .build_addsta_hcmd = iwl3945_build_addsta_hcmd, 2828 .build_addsta_hcmd = iwl3945_build_addsta_hcmd,
@@ -2860,7 +2832,6 @@ static struct iwl_ops iwl3945_ops = {
2860 .lib = &iwl3945_lib, 2832 .lib = &iwl3945_lib,
2861 .hcmd = &iwl3945_hcmd, 2833 .hcmd = &iwl3945_hcmd,
2862 .utils = &iwl3945_hcmd_utils, 2834 .utils = &iwl3945_hcmd_utils,
2863 .smgmt = &iwl3945_station_mgmt,
2864}; 2835};
2865 2836
2866static struct iwl_cfg iwl3945_bg_cfg = { 2837static struct iwl_cfg iwl3945_bg_cfg = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index da87528f355f..fbb3a573463e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -36,10 +36,6 @@
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <net/ieee80211_radiotap.h> 37#include <net/ieee80211_radiotap.h>
38 38
39/*used for rfkill*/
40#include <linux/rfkill.h>
41#include <linux/input.h>
42
43/* Hardware specific file defines the PCI IDs table for that hardware module */ 39/* Hardware specific file defines the PCI IDs table for that hardware module */
44extern struct pci_device_id iwl3945_hw_card_ids[]; 40extern struct pci_device_id iwl3945_hw_card_ids[];
45 41
@@ -155,7 +151,6 @@ struct iwl3945_frame {
155#define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */ 151#define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */
156#define STATUS_INT_ENABLED 2 152#define STATUS_INT_ENABLED 2
157#define STATUS_RF_KILL_HW 3 153#define STATUS_RF_KILL_HW 3
158#define STATUS_RF_KILL_SW 4
159#define STATUS_INIT 5 154#define STATUS_INIT 5
160#define STATUS_ALIVE 6 155#define STATUS_ALIVE 6
161#define STATUS_READY 7 156#define STATUS_READY 7
@@ -202,12 +197,6 @@ struct iwl3945_ibss_seq {
202 * for use by iwl-*.c 197 * for use by iwl-*.c
203 * 198 *
204 *****************************************************************************/ 199 *****************************************************************************/
205struct iwl3945_addsta_cmd;
206extern int iwl3945_send_add_station(struct iwl_priv *priv,
207 struct iwl3945_addsta_cmd *sta, u8 flags);
208extern u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *bssid,
209 int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info);
210extern void iwl3945_clear_stations_table(struct iwl_priv *priv);
211extern int iwl3945_power_init_handle(struct iwl_priv *priv); 200extern int iwl3945_power_init_handle(struct iwl_priv *priv);
212extern int iwl3945_eeprom_init(struct iwl_priv *priv); 201extern int iwl3945_eeprom_init(struct iwl_priv *priv);
213extern int iwl3945_calc_db_from_ratio(int sig_ratio); 202extern int iwl3945_calc_db_from_ratio(int sig_ratio);
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index a0b29411a4b3..8f3d4bc6a03f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -2221,13 +2221,6 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv)
2221 cancel_work_sync(&priv->txpower_work); 2221 cancel_work_sync(&priv->txpower_work);
2222} 2222}
2223 2223
2224static struct iwl_station_mgmt_ops iwl4965_station_mgmt = {
2225 .add_station = iwl_add_station_flags,
2226 .remove_station = iwl_remove_station,
2227 .find_station = iwl_find_station,
2228 .clear_station_table = iwl_clear_stations_table,
2229};
2230
2231static struct iwl_hcmd_ops iwl4965_hcmd = { 2224static struct iwl_hcmd_ops iwl4965_hcmd = {
2232 .rxon_assoc = iwl4965_send_rxon_assoc, 2225 .rxon_assoc = iwl4965_send_rxon_assoc,
2233 .commit_rxon = iwl_commit_rxon, 2226 .commit_rxon = iwl_commit_rxon,
@@ -2297,7 +2290,6 @@ static struct iwl_ops iwl4965_ops = {
2297 .lib = &iwl4965_lib, 2290 .lib = &iwl4965_lib,
2298 .hcmd = &iwl4965_hcmd, 2291 .hcmd = &iwl4965_hcmd,
2299 .utils = &iwl4965_hcmd_utils, 2292 .utils = &iwl4965_hcmd_utils,
2300 .smgmt = &iwl4965_station_mgmt,
2301}; 2293};
2302 2294
2303struct iwl_cfg iwl4965_agn_cfg = { 2295struct iwl_cfg iwl4965_agn_cfg = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index ab29aab6b2d5..b3c648ce8c7b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -651,7 +651,7 @@ static void iwl5000_init_alive_start(struct iwl_priv *priv)
651 goto restart; 651 goto restart;
652 } 652 }
653 653
654 priv->cfg->ops->smgmt->clear_station_table(priv); 654 iwl_clear_stations_table(priv);
655 ret = priv->cfg->ops->lib->alive_notify(priv); 655 ret = priv->cfg->ops->lib->alive_notify(priv);
656 if (ret) { 656 if (ret) {
657 IWL_WARN(priv, 657 IWL_WARN(priv,
@@ -1049,7 +1049,10 @@ static int iwl5000_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
1049u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data) 1049u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
1050{ 1050{
1051 u16 size = (u16)sizeof(struct iwl_addsta_cmd); 1051 u16 size = (u16)sizeof(struct iwl_addsta_cmd);
1052 memcpy(data, cmd, size); 1052 struct iwl_addsta_cmd *addsta = (struct iwl_addsta_cmd *)data;
1053 memcpy(addsta, cmd, size);
1054 /* resrved in 5000 */
1055 addsta->rate_n_flags = cpu_to_le16(0);
1053 return size; 1056 return size;
1054} 1057}
1055 1058
@@ -1423,13 +1426,6 @@ int iwl5000_calc_rssi(struct iwl_priv *priv,
1423 return max_rssi - agc - IWL49_RSSI_OFFSET; 1426 return max_rssi - agc - IWL49_RSSI_OFFSET;
1424} 1427}
1425 1428
1426struct iwl_station_mgmt_ops iwl5000_station_mgmt = {
1427 .add_station = iwl_add_station_flags,
1428 .remove_station = iwl_remove_station,
1429 .find_station = iwl_find_station,
1430 .clear_station_table = iwl_clear_stations_table,
1431};
1432
1433struct iwl_hcmd_ops iwl5000_hcmd = { 1429struct iwl_hcmd_ops iwl5000_hcmd = {
1434 .rxon_assoc = iwl5000_send_rxon_assoc, 1430 .rxon_assoc = iwl5000_send_rxon_assoc,
1435 .commit_rxon = iwl_commit_rxon, 1431 .commit_rxon = iwl_commit_rxon,
@@ -1549,14 +1545,12 @@ struct iwl_ops iwl5000_ops = {
1549 .lib = &iwl5000_lib, 1545 .lib = &iwl5000_lib,
1550 .hcmd = &iwl5000_hcmd, 1546 .hcmd = &iwl5000_hcmd,
1551 .utils = &iwl5000_hcmd_utils, 1547 .utils = &iwl5000_hcmd_utils,
1552 .smgmt = &iwl5000_station_mgmt,
1553}; 1548};
1554 1549
1555static struct iwl_ops iwl5150_ops = { 1550static struct iwl_ops iwl5150_ops = {
1556 .lib = &iwl5150_lib, 1551 .lib = &iwl5150_lib,
1557 .hcmd = &iwl5000_hcmd, 1552 .hcmd = &iwl5000_hcmd,
1558 .utils = &iwl5000_hcmd_utils, 1553 .utils = &iwl5000_hcmd_utils,
1559 .smgmt = &iwl5000_station_mgmt,
1560}; 1554};
1561 1555
1562struct iwl_mod_params iwl50_mod_params = { 1556struct iwl_mod_params iwl50_mod_params = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 7236382aeaa6..bd438d8acf55 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -72,7 +72,6 @@ static struct iwl_ops iwl6000_ops = {
72 .lib = &iwl5000_lib, 72 .lib = &iwl5000_lib,
73 .hcmd = &iwl5000_hcmd, 73 .hcmd = &iwl5000_hcmd,
74 .utils = &iwl6000_hcmd_utils, 74 .utils = &iwl6000_hcmd_utils,
75 .smgmt = &iwl5000_station_mgmt,
76}; 75};
77 76
78struct iwl_cfg iwl6000_2ag_cfg = { 77struct iwl_cfg iwl6000_2ag_cfg = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 23a58b00f180..ff20e5048a55 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -2502,15 +2502,13 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2502 2502
2503 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && 2503 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
2504 !lq_sta->ibss_sta_added) { 2504 !lq_sta->ibss_sta_added) {
2505 u8 sta_id = priv->cfg->ops->smgmt->find_station(priv, 2505 u8 sta_id = iwl_find_station(priv, hdr->addr1);
2506 hdr->addr1);
2507 2506
2508 if (sta_id == IWL_INVALID_STATION) { 2507 if (sta_id == IWL_INVALID_STATION) {
2509 IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", 2508 IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n",
2510 hdr->addr1); 2509 hdr->addr1);
2511 sta_id = priv->cfg->ops->smgmt->add_station(priv, 2510 sta_id = iwl_add_station(priv, hdr->addr1,
2512 hdr->addr1, 0, 2511 false, CMD_ASYNC, NULL);
2513 CMD_ASYNC, NULL);
2514 } 2512 }
2515 if ((sta_id != IWL_INVALID_STATION)) { 2513 if ((sta_id != IWL_INVALID_STATION)) {
2516 lq_sta->lq.sta_id = sta_id; 2514 lq_sta->lq.sta_id = sta_id;
@@ -2598,7 +2596,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
2598 2596
2599 lq_sta->ibss_sta_added = 0; 2597 lq_sta->ibss_sta_added = 0;
2600 if (priv->iw_mode == NL80211_IFTYPE_AP) { 2598 if (priv->iw_mode == NL80211_IFTYPE_AP) {
2601 u8 sta_id = priv->cfg->ops->smgmt->find_station(priv, 2599 u8 sta_id = iwl_find_station(priv,
2602 sta->addr); 2600 sta->addr);
2603 2601
2604 /* for IBSS the call are from tasklet */ 2602 /* for IBSS the call are from tasklet */
@@ -2606,9 +2604,8 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
2606 2604
2607 if (sta_id == IWL_INVALID_STATION) { 2605 if (sta_id == IWL_INVALID_STATION) {
2608 IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr); 2606 IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr);
2609 sta_id = priv->cfg->ops->smgmt->add_station(priv, 2607 sta_id = iwl_add_station(priv, sta->addr, false,
2610 sta->addr, 0, 2608 CMD_ASYNC, NULL);
2611 CMD_ASYNC, NULL);
2612 } 2609 }
2613 if ((sta_id != IWL_INVALID_STATION)) { 2610 if ((sta_id != IWL_INVALID_STATION)) {
2614 lq_sta->lq.sta_id = sta_id; 2611 lq_sta->lq.sta_id = sta_id;
@@ -2790,9 +2787,10 @@ static void rs_fill_link_cmd(const struct iwl_priv *priv,
2790 repeat_rate--; 2787 repeat_rate--;
2791 } 2788 }
2792 2789
2793 lq_cmd->agg_params.agg_frame_cnt_limit = 64; 2790 lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_MAX;
2794 lq_cmd->agg_params.agg_dis_start_th = 3; 2791 lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
2795 lq_cmd->agg_params.agg_time_limit = cpu_to_le16(4000); 2792 lq_cmd->agg_params.agg_time_limit =
2793 cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
2796} 2794}
2797 2795
2798static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) 2796static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 0a5507cbeb3f..a5637c4aa85d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -188,7 +188,7 @@ int iwl_commit_rxon(struct iwl_priv *priv)
188 memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); 188 memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
189 } 189 }
190 190
191 priv->cfg->ops->smgmt->clear_station_table(priv); 191 iwl_clear_stations_table(priv);
192 192
193 priv->start_calib = 0; 193 priv->start_calib = 0;
194 194
@@ -737,19 +737,13 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
737 clear_bit(STATUS_RF_KILL_HW, &priv->status); 737 clear_bit(STATUS_RF_KILL_HW, &priv->status);
738 738
739 739
740 if (flags & SW_CARD_DISABLED)
741 set_bit(STATUS_RF_KILL_SW, &priv->status);
742 else
743 clear_bit(STATUS_RF_KILL_SW, &priv->status);
744
745 if (!(flags & RXON_CARD_DISABLED)) 740 if (!(flags & RXON_CARD_DISABLED))
746 iwl_scan_cancel(priv); 741 iwl_scan_cancel(priv);
747 742
748 if ((test_bit(STATUS_RF_KILL_HW, &status) != 743 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
749 test_bit(STATUS_RF_KILL_HW, &priv->status)) || 744 test_bit(STATUS_RF_KILL_HW, &priv->status)))
750 (test_bit(STATUS_RF_KILL_SW, &status) != 745 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
751 test_bit(STATUS_RF_KILL_SW, &priv->status))) 746 test_bit(STATUS_RF_KILL_HW, &priv->status));
752 queue_work(priv->workqueue, &priv->rf_kill);
753 else 747 else
754 wake_up_interruptible(&priv->wait_command_queue); 748 wake_up_interruptible(&priv->wait_command_queue);
755} 749}
@@ -1045,7 +1039,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv)
1045 set_bit(STATUS_RF_KILL_HW, &priv->status); 1039 set_bit(STATUS_RF_KILL_HW, &priv->status);
1046 else 1040 else
1047 clear_bit(STATUS_RF_KILL_HW, &priv->status); 1041 clear_bit(STATUS_RF_KILL_HW, &priv->status);
1048 queue_work(priv->workqueue, &priv->rf_kill); 1042 wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rf_kill);
1049 } 1043 }
1050 1044
1051 handled |= CSR_INT_BIT_RF_KILL; 1045 handled |= CSR_INT_BIT_RF_KILL;
@@ -1218,7 +1212,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
1218 set_bit(STATUS_RF_KILL_HW, &priv->status); 1212 set_bit(STATUS_RF_KILL_HW, &priv->status);
1219 else 1213 else
1220 clear_bit(STATUS_RF_KILL_HW, &priv->status); 1214 clear_bit(STATUS_RF_KILL_HW, &priv->status);
1221 queue_work(priv->workqueue, &priv->rf_kill); 1215 wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rf_kill);
1222 } 1216 }
1223 1217
1224 handled |= CSR_INT_BIT_RF_KILL; 1218 handled |= CSR_INT_BIT_RF_KILL;
@@ -1617,7 +1611,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
1617 goto restart; 1611 goto restart;
1618 } 1612 }
1619 1613
1620 priv->cfg->ops->smgmt->clear_station_table(priv); 1614 iwl_clear_stations_table(priv);
1621 ret = priv->cfg->ops->lib->alive_notify(priv); 1615 ret = priv->cfg->ops->lib->alive_notify(priv);
1622 if (ret) { 1616 if (ret) {
1623 IWL_WARN(priv, 1617 IWL_WARN(priv,
@@ -1703,7 +1697,7 @@ static void __iwl_down(struct iwl_priv *priv)
1703 1697
1704 iwl_leds_unregister(priv); 1698 iwl_leds_unregister(priv);
1705 1699
1706 priv->cfg->ops->smgmt->clear_station_table(priv); 1700 iwl_clear_stations_table(priv);
1707 1701
1708 /* Unblock any waiting calls */ 1702 /* Unblock any waiting calls */
1709 wake_up_interruptible_all(&priv->wait_command_queue); 1703 wake_up_interruptible_all(&priv->wait_command_queue);
@@ -1726,12 +1720,10 @@ static void __iwl_down(struct iwl_priv *priv)
1726 ieee80211_stop_queues(priv->hw); 1720 ieee80211_stop_queues(priv->hw);
1727 1721
1728 /* If we have not previously called iwl_init() then 1722 /* If we have not previously called iwl_init() then
1729 * clear all bits but the RF Kill bits and return */ 1723 * clear all bits but the RF Kill bit and return */
1730 if (!iwl_is_init(priv)) { 1724 if (!iwl_is_init(priv)) {
1731 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 1725 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
1732 STATUS_RF_KILL_HW | 1726 STATUS_RF_KILL_HW |
1733 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
1734 STATUS_RF_KILL_SW |
1735 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 1727 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
1736 STATUS_GEO_CONFIGURED | 1728 STATUS_GEO_CONFIGURED |
1737 test_bit(STATUS_EXIT_PENDING, &priv->status) << 1729 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
@@ -1740,11 +1732,9 @@ static void __iwl_down(struct iwl_priv *priv)
1740 } 1732 }
1741 1733
1742 /* ...otherwise clear out all the status bits but the RF Kill 1734 /* ...otherwise clear out all the status bits but the RF Kill
1743 * bits and continue taking the NIC down. */ 1735 * bit and continue taking the NIC down. */
1744 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << 1736 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
1745 STATUS_RF_KILL_HW | 1737 STATUS_RF_KILL_HW |
1746 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
1747 STATUS_RF_KILL_SW |
1748 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 1738 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
1749 STATUS_GEO_CONFIGURED | 1739 STATUS_GEO_CONFIGURED |
1750 test_bit(STATUS_FW_ERROR, &priv->status) << 1740 test_bit(STATUS_FW_ERROR, &priv->status) <<
@@ -1866,9 +1856,10 @@ static int __iwl_up(struct iwl_priv *priv)
1866 set_bit(STATUS_RF_KILL_HW, &priv->status); 1856 set_bit(STATUS_RF_KILL_HW, &priv->status);
1867 1857
1868 if (iwl_is_rfkill(priv)) { 1858 if (iwl_is_rfkill(priv)) {
1859 wiphy_rfkill_set_hw_state(priv->hw->wiphy, true);
1860
1869 iwl_enable_interrupts(priv); 1861 iwl_enable_interrupts(priv);
1870 IWL_WARN(priv, "Radio disabled by %s RF Kill switch\n", 1862 IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n");
1871 test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW");
1872 return 0; 1863 return 0;
1873 } 1864 }
1874 1865
@@ -1887,8 +1878,6 @@ static int __iwl_up(struct iwl_priv *priv)
1887 1878
1888 /* clear (again), then enable host interrupts */ 1879 /* clear (again), then enable host interrupts */
1889 iwl_write32(priv, CSR_INT, 0xFFFFFFFF); 1880 iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
1890 /* enable dram interrupt */
1891 iwl_reset_ict(priv);
1892 iwl_enable_interrupts(priv); 1881 iwl_enable_interrupts(priv);
1893 1882
1894 /* really make sure rfkill handshake bits are cleared */ 1883 /* really make sure rfkill handshake bits are cleared */
@@ -1903,7 +1892,7 @@ static int __iwl_up(struct iwl_priv *priv)
1903 1892
1904 for (i = 0; i < MAX_HW_RESTARTS; i++) { 1893 for (i = 0; i < MAX_HW_RESTARTS; i++) {
1905 1894
1906 priv->cfg->ops->smgmt->clear_station_table(priv); 1895 iwl_clear_stations_table(priv);
1907 1896
1908 /* load bootstrap state machine, 1897 /* load bootstrap state machine,
1909 * load bootstrap program into processor's memory, 1898 * load bootstrap program into processor's memory,
@@ -1962,6 +1951,9 @@ static void iwl_bg_alive_start(struct work_struct *data)
1962 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1951 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
1963 return; 1952 return;
1964 1953
1954 /* enable dram interrupt */
1955 iwl_reset_ict(priv);
1956
1965 mutex_lock(&priv->mutex); 1957 mutex_lock(&priv->mutex);
1966 iwl_alive_start(priv); 1958 iwl_alive_start(priv);
1967 mutex_unlock(&priv->mutex); 1959 mutex_unlock(&priv->mutex);
@@ -2000,7 +1992,6 @@ static void iwl_bg_up(struct work_struct *data)
2000 mutex_lock(&priv->mutex); 1992 mutex_lock(&priv->mutex);
2001 __iwl_up(priv); 1993 __iwl_up(priv);
2002 mutex_unlock(&priv->mutex); 1994 mutex_unlock(&priv->mutex);
2003 iwl_rfkill_set_hw_state(priv);
2004} 1995}
2005 1996
2006static void iwl_bg_restart(struct work_struct *data) 1997static void iwl_bg_restart(struct work_struct *data)
@@ -2178,8 +2169,6 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
2178 2169
2179 mutex_unlock(&priv->mutex); 2170 mutex_unlock(&priv->mutex);
2180 2171
2181 iwl_rfkill_set_hw_state(priv);
2182
2183 if (ret) 2172 if (ret)
2184 return ret; 2173 return ret;
2185 2174
@@ -2348,7 +2337,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2348 return -EOPNOTSUPP; 2337 return -EOPNOTSUPP;
2349 } 2338 }
2350 addr = sta ? sta->addr : iwl_bcast_addr; 2339 addr = sta ? sta->addr : iwl_bcast_addr;
2351 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 2340 sta_id = iwl_find_station(priv, addr);
2352 if (sta_id == IWL_INVALID_STATION) { 2341 if (sta_id == IWL_INVALID_STATION) {
2353 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", 2342 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
2354 addr); 2343 addr);
@@ -2774,7 +2763,6 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)
2774 INIT_WORK(&priv->up, iwl_bg_up); 2763 INIT_WORK(&priv->up, iwl_bg_up);
2775 INIT_WORK(&priv->restart, iwl_bg_restart); 2764 INIT_WORK(&priv->restart, iwl_bg_restart);
2776 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); 2765 INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish);
2777 INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill);
2778 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); 2766 INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update);
2779 INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); 2767 INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work);
2780 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); 2768 INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start);
@@ -3045,12 +3033,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3045 else 3033 else
3046 set_bit(STATUS_RF_KILL_HW, &priv->status); 3034 set_bit(STATUS_RF_KILL_HW, &priv->status);
3047 3035
3048 err = iwl_rfkill_init(priv); 3036 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
3049 if (err) 3037 test_bit(STATUS_RF_KILL_HW, &priv->status));
3050 IWL_ERR(priv, "Unable to initialize RFKILL system. "
3051 "Ignoring error: %d\n", err);
3052 else
3053 iwl_rfkill_set_hw_state(priv);
3054 3038
3055 iwl_power_initialize(priv); 3039 iwl_power_initialize(priv);
3056 return 0; 3040 return 0;
@@ -3114,14 +3098,13 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
3114 3098
3115 iwl_synchronize_irq(priv); 3099 iwl_synchronize_irq(priv);
3116 3100
3117 iwl_rfkill_unregister(priv);
3118 iwl_dealloc_ucode_pci(priv); 3101 iwl_dealloc_ucode_pci(priv);
3119 3102
3120 if (priv->rxq.bd) 3103 if (priv->rxq.bd)
3121 iwl_rx_queue_free(priv, &priv->rxq); 3104 iwl_rx_queue_free(priv, &priv->rxq);
3122 iwl_hw_txq_ctx_free(priv); 3105 iwl_hw_txq_ctx_free(priv);
3123 3106
3124 priv->cfg->ops->smgmt->clear_station_table(priv); 3107 iwl_clear_stations_table(priv);
3125 iwl_eeprom_free(priv); 3108 iwl_eeprom_free(priv);
3126 3109
3127 3110
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index e581dc323f0a..c87033bf3ad2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -1067,7 +1067,7 @@ struct iwl_addsta_cmd {
1067 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ 1067 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1068 __le16 tid_disable_tx; 1068 __le16 tid_disable_tx;
1069 1069
1070 __le16 reserved1; 1070 __le16 rate_n_flags; /* 3945 only */
1071 1071
1072 /* TID for which to add block-ack support. 1072 /* TID for which to add block-ack support.
1073 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ 1073 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
@@ -1913,6 +1913,18 @@ struct iwl_link_qual_general_params {
1913 u8 start_rate_index[LINK_QUAL_AC_NUM]; 1913 u8 start_rate_index[LINK_QUAL_AC_NUM];
1914} __attribute__ ((packed)); 1914} __attribute__ ((packed));
1915 1915
1916#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
1917#define LINK_QUAL_AGG_TIME_LIMIT_MAX (65535)
1918#define LINK_QUAL_AGG_TIME_LIMIT_MIN (0)
1919
1920#define LINK_QUAL_AGG_DISABLE_START_DEF (3)
1921#define LINK_QUAL_AGG_DISABLE_START_MAX (255)
1922#define LINK_QUAL_AGG_DISABLE_START_MIN (0)
1923
1924#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31)
1925#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (64)
1926#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
1927
1916/** 1928/**
1917 * struct iwl_link_qual_agg_params 1929 * struct iwl_link_qual_agg_params
1918 * 1930 *
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index e93ddb74457e..f9d16ca5b3d9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -36,7 +36,6 @@
36#include "iwl-debug.h" 36#include "iwl-debug.h"
37#include "iwl-core.h" 37#include "iwl-core.h"
38#include "iwl-io.h" 38#include "iwl-io.h"
39#include "iwl-rfkill.h"
40#include "iwl-power.h" 39#include "iwl-power.h"
41#include "iwl-sta.h" 40#include "iwl-sta.h"
42#include "iwl-helpers.h" 41#include "iwl-helpers.h"
@@ -1389,7 +1388,7 @@ int iwl_init_drv(struct iwl_priv *priv)
1389 mutex_init(&priv->mutex); 1388 mutex_init(&priv->mutex);
1390 1389
1391 /* Clear the driver's (not device's) station table */ 1390 /* Clear the driver's (not device's) station table */
1392 priv->cfg->ops->smgmt->clear_station_table(priv); 1391 iwl_clear_stations_table(priv);
1393 1392
1394 priv->data_retry_limit = -1; 1393 priv->data_retry_limit = -1;
1395 priv->ieee_channels = NULL; 1394 priv->ieee_channels = NULL;
@@ -1704,8 +1703,9 @@ static irqreturn_t iwl_isr(int irq, void *data)
1704{ 1703{
1705 struct iwl_priv *priv = data; 1704 struct iwl_priv *priv = data;
1706 u32 inta, inta_mask; 1705 u32 inta, inta_mask;
1706#ifdef CONFIG_IWLWIFI_DEBUG
1707 u32 inta_fh; 1707 u32 inta_fh;
1708 1708#endif
1709 if (!priv) 1709 if (!priv)
1710 return IRQ_NONE; 1710 return IRQ_NONE;
1711 1711
@@ -2210,126 +2210,6 @@ int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
2210} 2210}
2211EXPORT_SYMBOL(iwl_send_card_state); 2211EXPORT_SYMBOL(iwl_send_card_state);
2212 2212
2213void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv)
2214{
2215 unsigned long flags;
2216
2217 if (test_bit(STATUS_RF_KILL_SW, &priv->status))
2218 return;
2219
2220 IWL_DEBUG_RF_KILL(priv, "Manual SW RF KILL set to: RADIO OFF\n");
2221
2222 iwl_scan_cancel(priv);
2223 /* FIXME: This is a workaround for AP */
2224 if (priv->iw_mode != NL80211_IFTYPE_AP) {
2225 spin_lock_irqsave(&priv->lock, flags);
2226 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
2227 CSR_UCODE_SW_BIT_RFKILL);
2228 spin_unlock_irqrestore(&priv->lock, flags);
2229 /* call the host command only if no hw rf-kill set */
2230 if (!test_bit(STATUS_RF_KILL_HW, &priv->status) &&
2231 iwl_is_ready(priv))
2232 iwl_send_card_state(priv,
2233 CARD_STATE_CMD_DISABLE, 0);
2234 set_bit(STATUS_RF_KILL_SW, &priv->status);
2235 /* make sure mac80211 stop sending Tx frame */
2236 if (priv->mac80211_registered)
2237 ieee80211_stop_queues(priv->hw);
2238 }
2239}
2240EXPORT_SYMBOL(iwl_radio_kill_sw_disable_radio);
2241
2242int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv)
2243{
2244 unsigned long flags;
2245
2246 if (!test_bit(STATUS_RF_KILL_SW, &priv->status))
2247 return 0;
2248
2249 IWL_DEBUG_RF_KILL(priv, "Manual SW RF KILL set to: RADIO ON\n");
2250
2251 spin_lock_irqsave(&priv->lock, flags);
2252 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
2253
2254 /* If the driver is up it will receive CARD_STATE_NOTIFICATION
2255 * notification where it will clear SW rfkill status.
2256 * Setting it here would break the handler. Only if the
2257 * interface is down we can set here since we don't
2258 * receive any further notification.
2259 */
2260 if (!priv->is_open)
2261 clear_bit(STATUS_RF_KILL_SW, &priv->status);
2262 spin_unlock_irqrestore(&priv->lock, flags);
2263
2264 /* wake up ucode */
2265 msleep(10);
2266
2267 iwl_read32(priv, CSR_UCODE_DRV_GP1);
2268 spin_lock_irqsave(&priv->reg_lock, flags);
2269 if (!iwl_grab_nic_access(priv))
2270 iwl_release_nic_access(priv);
2271 spin_unlock_irqrestore(&priv->reg_lock, flags);
2272
2273 if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
2274 IWL_DEBUG_RF_KILL(priv, "Can not turn radio back on - "
2275 "disabled by HW switch\n");
2276 return 0;
2277 }
2278
2279 /* when driver is up while rfkill is on, it wont receive
2280 * any CARD_STATE_NOTIFICATION notifications so we have to
2281 * restart it in here
2282 */
2283 if (priv->is_open && !test_bit(STATUS_ALIVE, &priv->status)) {
2284 clear_bit(STATUS_RF_KILL_SW, &priv->status);
2285 if (!iwl_is_rfkill(priv))
2286 queue_work(priv->workqueue, &priv->up);
2287 }
2288
2289 /* If the driver is already loaded, it will receive
2290 * CARD_STATE_NOTIFICATION notifications and the handler will
2291 * call restart to reload the driver.
2292 */
2293 return 1;
2294}
2295EXPORT_SYMBOL(iwl_radio_kill_sw_enable_radio);
2296
2297void iwl_bg_rf_kill(struct work_struct *work)
2298{
2299 struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill);
2300
2301 wake_up_interruptible(&priv->wait_command_queue);
2302
2303 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
2304 return;
2305
2306 mutex_lock(&priv->mutex);
2307
2308 if (!iwl_is_rfkill(priv)) {
2309 IWL_DEBUG_RF_KILL(priv,
2310 "HW and/or SW RF Kill no longer active, restarting "
2311 "device\n");
2312 if (!test_bit(STATUS_EXIT_PENDING, &priv->status) &&
2313 priv->is_open)
2314 queue_work(priv->workqueue, &priv->restart);
2315 } else {
2316 /* make sure mac80211 stop sending Tx frame */
2317 if (priv->mac80211_registered)
2318 ieee80211_stop_queues(priv->hw);
2319
2320 if (!test_bit(STATUS_RF_KILL_HW, &priv->status))
2321 IWL_DEBUG_RF_KILL(priv, "Can not turn radio back on - "
2322 "disabled by SW switch\n");
2323 else
2324 IWL_WARN(priv, "Radio Frequency Kill Switch is On:\n"
2325 "Kill switch must be turned off for "
2326 "wireless networking to work.\n");
2327 }
2328 mutex_unlock(&priv->mutex);
2329 iwl_rfkill_set_hw_state(priv);
2330}
2331EXPORT_SYMBOL(iwl_bg_rf_kill);
2332
2333void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, 2213void iwl_rx_pm_sleep_notif(struct iwl_priv *priv,
2334 struct iwl_rx_mem_buffer *rxb) 2214 struct iwl_rx_mem_buffer *rxb)
2335{ 2215{
@@ -2679,19 +2559,12 @@ int iwl_set_mode(struct iwl_priv *priv, int mode)
2679 2559
2680 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 2560 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
2681 2561
2682 priv->cfg->ops->smgmt->clear_station_table(priv); 2562 iwl_clear_stations_table(priv);
2683 2563
2684 /* dont commit rxon if rf-kill is on*/ 2564 /* dont commit rxon if rf-kill is on*/
2685 if (!iwl_is_ready_rf(priv)) 2565 if (!iwl_is_ready_rf(priv))
2686 return -EAGAIN; 2566 return -EAGAIN;
2687 2567
2688 cancel_delayed_work(&priv->scan_check);
2689 if (iwl_scan_cancel_timeout(priv, 100)) {
2690 IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
2691 IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
2692 return -EAGAIN;
2693 }
2694
2695 iwlcore_commit_rxon(priv); 2568 iwlcore_commit_rxon(priv);
2696 2569
2697 return 0; 2570 return 0;
@@ -2855,23 +2728,6 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2855 if (priv->cfg->ops->hcmd->set_rxon_chain) 2728 if (priv->cfg->ops->hcmd->set_rxon_chain)
2856 priv->cfg->ops->hcmd->set_rxon_chain(priv); 2729 priv->cfg->ops->hcmd->set_rxon_chain(priv);
2857 2730
2858 if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
2859 if (conf->radio_enabled &&
2860 iwl_radio_kill_sw_enable_radio(priv)) {
2861 IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - "
2862 "waiting for uCode\n");
2863 goto out;
2864 }
2865
2866 if (!conf->radio_enabled)
2867 iwl_radio_kill_sw_disable_radio(priv);
2868 }
2869
2870 if (!conf->radio_enabled) {
2871 IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
2872 goto out;
2873 }
2874
2875 if (!iwl_is_ready(priv)) { 2731 if (!iwl_is_ready(priv)) {
2876 IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); 2732 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
2877 goto out; 2733 goto out;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 87df1b767941..dabf663e36e5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -83,15 +83,6 @@ struct iwl_cmd;
83#define IWL_SKU_A 0x2 83#define IWL_SKU_A 0x2
84#define IWL_SKU_N 0x8 84#define IWL_SKU_N 0x8
85 85
86struct iwl_station_mgmt_ops {
87 u8 (*add_station)(struct iwl_priv *priv, const u8 *addr,
88 int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info);
89 int (*remove_station)(struct iwl_priv *priv, const u8 *addr,
90 int is_ap);
91 u8 (*find_station)(struct iwl_priv *priv, const u8 *addr);
92 void (*clear_station_table)(struct iwl_priv *priv);
93};
94
95struct iwl_hcmd_ops { 86struct iwl_hcmd_ops {
96 int (*rxon_assoc)(struct iwl_priv *priv); 87 int (*rxon_assoc)(struct iwl_priv *priv);
97 int (*commit_rxon)(struct iwl_priv *priv); 88 int (*commit_rxon)(struct iwl_priv *priv);
@@ -183,7 +174,6 @@ struct iwl_ops {
183 const struct iwl_lib_ops *lib; 174 const struct iwl_lib_ops *lib;
184 const struct iwl_hcmd_ops *hcmd; 175 const struct iwl_hcmd_ops *hcmd;
185 const struct iwl_hcmd_utils_ops *utils; 176 const struct iwl_hcmd_utils_ops *utils;
186 const struct iwl_station_mgmt_ops *smgmt;
187}; 177};
188 178
189struct iwl_mod_params { 179struct iwl_mod_params {
@@ -192,7 +182,7 @@ struct iwl_mod_params {
192 int disable_hw_scan; /* def: 0 = use h/w scan */ 182 int disable_hw_scan; /* def: 0 = use h/w scan */
193 int num_of_queues; /* def: HW dependent */ 183 int num_of_queues; /* def: HW dependent */
194 int num_of_ampdu_queues;/* def: HW dependent */ 184 int num_of_ampdu_queues;/* def: HW dependent */
195 int disable_11n; /* def: 0 = disable 11n capabilities */ 185 int disable_11n; /* def: 0 = 11n capabilities enabled */
196 int amsdu_size_8K; /* def: 1 = enable 8K amsdu size */ 186 int amsdu_size_8K; /* def: 1 = enable 8K amsdu size */
197 int antenna; /* def: 0 = both antennas (use diversity) */ 187 int antenna; /* def: 0 = both antennas (use diversity) */
198 int restart_fw; /* def: 1 = restart firmware */ 188 int restart_fw; /* def: 1 = restart firmware */
@@ -358,14 +348,6 @@ int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id);
358 ****************************************************/ 348 ****************************************************/
359int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); 349int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force);
360 350
361/*****************************************************
362 * RF -Kill - here and not in iwl-rfkill.h to be available when
363 * RF-kill subsystem is not compiled.
364 ****************************************************/
365void iwl_bg_rf_kill(struct work_struct *work);
366void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv);
367int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv);
368
369/******************************************************************************* 351/*******************************************************************************
370 * Rate 352 * Rate
371 ******************************************************************************/ 353 ******************************************************************************/
@@ -508,7 +490,6 @@ void iwlcore_free_geos(struct iwl_priv *priv);
508#define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */ 490#define STATUS_HCMD_SYNC_ACTIVE 1 /* sync host command in progress */
509#define STATUS_INT_ENABLED 2 491#define STATUS_INT_ENABLED 2
510#define STATUS_RF_KILL_HW 3 492#define STATUS_RF_KILL_HW 3
511#define STATUS_RF_KILL_SW 4
512#define STATUS_INIT 5 493#define STATUS_INIT 5
513#define STATUS_ALIVE 6 494#define STATUS_ALIVE 6
514#define STATUS_READY 7 495#define STATUS_READY 7
@@ -543,11 +524,6 @@ static inline int iwl_is_init(struct iwl_priv *priv)
543 return test_bit(STATUS_INIT, &priv->status); 524 return test_bit(STATUS_INIT, &priv->status);
544} 525}
545 526
546static inline int iwl_is_rfkill_sw(struct iwl_priv *priv)
547{
548 return test_bit(STATUS_RF_KILL_SW, &priv->status);
549}
550
551static inline int iwl_is_rfkill_hw(struct iwl_priv *priv) 527static inline int iwl_is_rfkill_hw(struct iwl_priv *priv)
552{ 528{
553 return test_bit(STATUS_RF_KILL_HW, &priv->status); 529 return test_bit(STATUS_RF_KILL_HW, &priv->status);
@@ -555,7 +531,7 @@ static inline int iwl_is_rfkill_hw(struct iwl_priv *priv)
555 531
556static inline int iwl_is_rfkill(struct iwl_priv *priv) 532static inline int iwl_is_rfkill(struct iwl_priv *priv)
557{ 533{
558 return iwl_is_rfkill_hw(priv) || iwl_is_rfkill_sw(priv); 534 return iwl_is_rfkill_hw(priv);
559} 535}
560 536
561static inline int iwl_is_ready_rf(struct iwl_priv *priv) 537static inline int iwl_is_ready_rf(struct iwl_priv *priv)
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index af70229144b3..11e08c068917 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -449,8 +449,6 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
449 test_bit(STATUS_INT_ENABLED, &priv->status)); 449 test_bit(STATUS_INT_ENABLED, &priv->status));
450 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", 450 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
451 test_bit(STATUS_RF_KILL_HW, &priv->status)); 451 test_bit(STATUS_RF_KILL_HW, &priv->status));
452 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_SW:\t %d\n",
453 test_bit(STATUS_RF_KILL_SW, &priv->status));
454 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n", 452 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
455 test_bit(STATUS_INIT, &priv->status)); 453 test_bit(STATUS_INIT, &priv->status));
456 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n", 454 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 2dafc26fb6a8..e2d620f0b6e8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -41,7 +41,6 @@
41#include "iwl-prph.h" 41#include "iwl-prph.h"
42#include "iwl-fh.h" 42#include "iwl-fh.h"
43#include "iwl-debug.h" 43#include "iwl-debug.h"
44#include "iwl-rfkill.h"
45#include "iwl-4965-hw.h" 44#include "iwl-4965-hw.h"
46#include "iwl-3945-hw.h" 45#include "iwl-3945-hw.h"
47#include "iwl-3945-led.h" 46#include "iwl-3945-led.h"
@@ -70,7 +69,6 @@ extern struct iwl_ops iwl5000_ops;
70extern struct iwl_lib_ops iwl5000_lib; 69extern struct iwl_lib_ops iwl5000_lib;
71extern struct iwl_hcmd_ops iwl5000_hcmd; 70extern struct iwl_hcmd_ops iwl5000_hcmd;
72extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils; 71extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils;
73extern struct iwl_station_mgmt_ops iwl5000_station_mgmt;
74 72
75/* shared functions from iwl-5000.c */ 73/* shared functions from iwl-5000.c */
76extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len); 74extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len);
@@ -290,11 +288,11 @@ struct iwl_frame {
290#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) 288#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
291 289
292enum { 290enum {
293 /* CMD_SIZE_NORMAL = 0, */ 291 CMD_SYNC = 0,
292 CMD_SIZE_NORMAL = 0,
293 CMD_NO_SKB = 0,
294 CMD_SIZE_HUGE = (1 << 0), 294 CMD_SIZE_HUGE = (1 << 0),
295 /* CMD_SYNC = 0, */
296 CMD_ASYNC = (1 << 1), 295 CMD_ASYNC = (1 << 1),
297 /* CMD_NO_SKB = 0, */
298 CMD_WANT_SKB = (1 << 2), 296 CMD_WANT_SKB = (1 << 2),
299}; 297};
300 298
@@ -937,9 +935,6 @@ struct iwl_priv {
937 * 4965's initialize alive response contains some calibration data. */ 935 * 4965's initialize alive response contains some calibration data. */
938 struct iwl_init_alive_resp card_alive_init; 936 struct iwl_init_alive_resp card_alive_init;
939 struct iwl_alive_resp card_alive; 937 struct iwl_alive_resp card_alive;
940#if defined(CONFIG_IWLWIFI_RFKILL)
941 struct rfkill *rfkill;
942#endif
943 938
944#ifdef CONFIG_IWLWIFI_LEDS 939#ifdef CONFIG_IWLWIFI_LEDS
945 unsigned long last_blink_time; 940 unsigned long last_blink_time;
@@ -1073,7 +1068,6 @@ struct iwl_priv {
1073 struct work_struct calibrated_work; 1068 struct work_struct calibrated_work;
1074 struct work_struct scan_completed; 1069 struct work_struct scan_completed;
1075 struct work_struct rx_replenish; 1070 struct work_struct rx_replenish;
1076 struct work_struct rf_kill;
1077 struct work_struct abort_scan; 1071 struct work_struct abort_scan;
1078 struct work_struct update_link_led; 1072 struct work_struct update_link_led;
1079 struct work_struct auth_work; 1073 struct work_struct auth_work;
@@ -1119,8 +1113,6 @@ struct iwl_priv {
1119 1113
1120 struct iwl3945_notif_statistics statistics_39; 1114 struct iwl3945_notif_statistics statistics_39;
1121 1115
1122 struct iwl3945_station_entry stations_39[IWL_STATION_COUNT];
1123
1124 u32 sta_supp_rates; 1116 u32 sta_supp_rates;
1125}; /*iwl_priv */ 1117}; /*iwl_priv */
1126 1118
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index cefa501e5971..7d7554a2f341 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -240,13 +240,11 @@ static int iwl_init_otp_access(struct iwl_priv *priv)
240 if (ret < 0) 240 if (ret < 0)
241 IWL_ERR(priv, "Time out access OTP\n"); 241 IWL_ERR(priv, "Time out access OTP\n");
242 else { 242 else {
243 if (!ret) { 243 iwl_set_bits_prph(priv, APMG_PS_CTRL_REG,
244 iwl_set_bits_prph(priv, APMG_PS_CTRL_REG, 244 APMG_PS_CTRL_VAL_RESET_REQ);
245 APMG_PS_CTRL_VAL_RESET_REQ); 245 udelay(5);
246 udelay(5); 246 iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG,
247 iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG, 247 APMG_PS_CTRL_VAL_RESET_REQ);
248 APMG_PS_CTRL_VAL_RESET_REQ);
249 }
250 } 248 }
251 return ret; 249 return ret;
252} 250}
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index 19680f72087f..5e64252f80f6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -176,10 +176,6 @@ static int iwl_led_associate(struct iwl_priv *priv, int led_id)
176static int iwl_led_disassociate(struct iwl_priv *priv, int led_id) 176static int iwl_led_disassociate(struct iwl_priv *priv, int led_id)
177{ 177{
178 priv->allow_blinking = 0; 178 priv->allow_blinking = 0;
179 if (iwl_is_rfkill(priv))
180 iwl4965_led_off_reg(priv, led_id);
181 else
182 iwl4965_led_on_reg(priv, led_id);
183 179
184 return 0; 180 return 0;
185} 181}
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c
deleted file mode 100644
index 65605ad44e4b..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c
+++ /dev/null
@@ -1,144 +0,0 @@
1/******************************************************************************
2 *
3 * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
4 *
5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of version 2 of the GNU General Public License as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20 *
21 * The full GNU General Public License is included in this distribution in the
22 * file called LICENSE.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28#include <linux/kernel.h>
29#include <linux/module.h>
30#include <linux/init.h>
31
32#include <net/mac80211.h>
33
34#include "iwl-eeprom.h"
35#include "iwl-dev.h"
36#include "iwl-core.h"
37
38/* software rf-kill from user */
39static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state)
40{
41 struct iwl_priv *priv = data;
42 int err = 0;
43
44 if (!priv->rfkill)
45 return 0;
46
47 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
48 return 0;
49
50 IWL_DEBUG_RF_KILL(priv, "we received soft RFKILL set to state %d\n", state);
51 mutex_lock(&priv->mutex);
52
53 switch (state) {
54 case RFKILL_STATE_UNBLOCKED:
55 if (iwl_is_rfkill_hw(priv)) {
56 err = -EBUSY;
57 goto out_unlock;
58 }
59 iwl_radio_kill_sw_enable_radio(priv);
60 break;
61 case RFKILL_STATE_SOFT_BLOCKED:
62 iwl_radio_kill_sw_disable_radio(priv);
63 break;
64 default:
65 IWL_WARN(priv, "we received unexpected RFKILL state %d\n",
66 state);
67 break;
68 }
69out_unlock:
70 mutex_unlock(&priv->mutex);
71
72 return err;
73}
74
75int iwl_rfkill_init(struct iwl_priv *priv)
76{
77 struct device *device = wiphy_dev(priv->hw->wiphy);
78 int ret = 0;
79
80 BUG_ON(device == NULL);
81
82 IWL_DEBUG_RF_KILL(priv, "Initializing RFKILL.\n");
83 priv->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN);
84 if (!priv->rfkill) {
85 IWL_ERR(priv, "Unable to allocate RFKILL device.\n");
86 ret = -ENOMEM;
87 goto error;
88 }
89
90 priv->rfkill->name = priv->cfg->name;
91 priv->rfkill->data = priv;
92 priv->rfkill->state = RFKILL_STATE_UNBLOCKED;
93 priv->rfkill->toggle_radio = iwl_rfkill_soft_rf_kill;
94
95 priv->rfkill->dev.class->suspend = NULL;
96 priv->rfkill->dev.class->resume = NULL;
97
98 ret = rfkill_register(priv->rfkill);
99 if (ret) {
100 IWL_ERR(priv, "Unable to register RFKILL: %d\n", ret);
101 goto free_rfkill;
102 }
103
104 IWL_DEBUG_RF_KILL(priv, "RFKILL initialization complete.\n");
105 return ret;
106
107free_rfkill:
108 if (priv->rfkill != NULL)
109 rfkill_free(priv->rfkill);
110 priv->rfkill = NULL;
111
112error:
113 IWL_DEBUG_RF_KILL(priv, "RFKILL initialization complete.\n");
114 return ret;
115}
116EXPORT_SYMBOL(iwl_rfkill_init);
117
118void iwl_rfkill_unregister(struct iwl_priv *priv)
119{
120
121 if (priv->rfkill)
122 rfkill_unregister(priv->rfkill);
123
124 priv->rfkill = NULL;
125}
126EXPORT_SYMBOL(iwl_rfkill_unregister);
127
128/* set RFKILL to the right state. */
129void iwl_rfkill_set_hw_state(struct iwl_priv *priv)
130{
131 if (!priv->rfkill)
132 return;
133
134 if (iwl_is_rfkill_hw(priv)) {
135 rfkill_force_state(priv->rfkill, RFKILL_STATE_HARD_BLOCKED);
136 return;
137 }
138
139 if (!iwl_is_rfkill_sw(priv))
140 rfkill_force_state(priv->rfkill, RFKILL_STATE_UNBLOCKED);
141 else
142 rfkill_force_state(priv->rfkill, RFKILL_STATE_SOFT_BLOCKED);
143}
144EXPORT_SYMBOL(iwl_rfkill_set_hw_state);
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.h b/drivers/net/wireless/iwlwifi/iwl-rfkill.h
deleted file mode 100644
index 633dafb4bf1b..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-rfkill.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/******************************************************************************
2 *
3 * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
4 *
5 * Portions of this file are derived from the ipw3945 project, as well
6 * as portions of the ieee80211 subsystem header files.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of version 2 of the GNU General Public License as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20 *
21 * The full GNU General Public License is included in this distribution in the
22 * file called LICENSE.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28#ifndef __iwl_rf_kill_h__
29#define __iwl_rf_kill_h__
30
31struct iwl_priv;
32
33#include <linux/rfkill.h>
34
35#ifdef CONFIG_IWLWIFI_RFKILL
36
37void iwl_rfkill_set_hw_state(struct iwl_priv *priv);
38void iwl_rfkill_unregister(struct iwl_priv *priv);
39int iwl_rfkill_init(struct iwl_priv *priv);
40#else
41static inline void iwl_rfkill_set_hw_state(struct iwl_priv *priv) {}
42static inline void iwl_rfkill_unregister(struct iwl_priv *priv) {}
43static inline int iwl_rfkill_init(struct iwl_priv *priv) { return 0; }
44#endif
45
46
47
48#endif /* __iwl_rf_kill_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 0eb939c40ac1..2addf735b193 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -75,7 +75,7 @@ int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
75 return IWL_AP_ID; 75 return IWL_AP_ID;
76 } else { 76 } else {
77 u8 *da = ieee80211_get_DA(hdr); 77 u8 *da = ieee80211_get_DA(hdr);
78 return priv->cfg->ops->smgmt->find_station(priv, da); 78 return iwl_find_station(priv, da);
79 } 79 }
80} 80}
81EXPORT_SYMBOL(iwl_get_ra_sta_id); 81EXPORT_SYMBOL(iwl_get_ra_sta_id);
@@ -86,8 +86,7 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
86 86
87 spin_lock_irqsave(&priv->sta_lock, flags); 87 spin_lock_irqsave(&priv->sta_lock, flags);
88 88
89 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) && 89 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE))
90 !(priv->stations_39[sta_id].used & IWL_STA_DRIVER_ACTIVE))
91 IWL_ERR(priv, "ACTIVATE a non DRIVER active station %d\n", 90 IWL_ERR(priv, "ACTIVATE a non DRIVER active station %d\n",
92 sta_id); 91 sta_id);
93 92
@@ -228,15 +227,16 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
228} 227}
229 228
230/** 229/**
231 * iwl_add_station_flags - Add station to tables in driver and device 230 * iwl_add_station - Add station to tables in driver and device
232 */ 231 */
233u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap, 232u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, bool is_ap, u8 flags,
234 u8 flags, struct ieee80211_sta_ht_cap *ht_info) 233 struct ieee80211_sta_ht_cap *ht_info)
235{ 234{
236 int i;
237 int sta_id = IWL_INVALID_STATION;
238 struct iwl_station_entry *station; 235 struct iwl_station_entry *station;
239 unsigned long flags_spin; 236 unsigned long flags_spin;
237 int i;
238 int sta_id = IWL_INVALID_STATION;
239 u16 rate;
240 240
241 spin_lock_irqsave(&priv->sta_lock, flags_spin); 241 spin_lock_irqsave(&priv->sta_lock, flags_spin);
242 if (is_ap) 242 if (is_ap)
@@ -288,6 +288,12 @@ u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap,
288 priv->iw_mode != NL80211_IFTYPE_ADHOC) 288 priv->iw_mode != NL80211_IFTYPE_ADHOC)
289 iwl_set_ht_add_station(priv, sta_id, ht_info); 289 iwl_set_ht_add_station(priv, sta_id, ht_info);
290 290
291 /* 3945 only */
292 rate = (priv->band == IEEE80211_BAND_5GHZ) ?
293 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP;
294 /* Turn on both antennas for the station... */
295 station->sta.rate_n_flags = cpu_to_le16(rate | RATE_MCS_ANT_AB_MSK);
296
291 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 297 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
292 298
293 /* Add station to device's station table */ 299 /* Add station to device's station table */
@@ -295,12 +301,12 @@ u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap,
295 return sta_id; 301 return sta_id;
296 302
297} 303}
298EXPORT_SYMBOL(iwl_add_station_flags); 304EXPORT_SYMBOL(iwl_add_station);
299 305
300static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr) 306static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr)
301{ 307{
302 unsigned long flags; 308 unsigned long flags;
303 u8 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 309 u8 sta_id = iwl_find_station(priv, addr);
304 310
305 BUG_ON(sta_id == IWL_INVALID_STATION); 311 BUG_ON(sta_id == IWL_INVALID_STATION);
306 312
@@ -408,7 +414,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
408/** 414/**
409 * iwl_remove_station - Remove driver's knowledge of station. 415 * iwl_remove_station - Remove driver's knowledge of station.
410 */ 416 */
411int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) 417int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, bool is_ap)
412{ 418{
413 int sta_id = IWL_INVALID_STATION; 419 int sta_id = IWL_INVALID_STATION;
414 int i, ret = -EINVAL; 420 int i, ret = -EINVAL;
@@ -767,7 +773,7 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
767 unsigned long flags; 773 unsigned long flags;
768 int i; 774 int i;
769 775
770 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 776 sta_id = iwl_find_station(priv, addr);
771 if (sta_id == IWL_INVALID_STATION) { 777 if (sta_id == IWL_INVALID_STATION) {
772 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", 778 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
773 addr); 779 addr);
@@ -946,7 +952,7 @@ EXPORT_SYMBOL(iwl_send_lq_cmd);
946 * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, 952 * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD,
947 * which requires station table entry to exist). 953 * which requires station table entry to exist).
948 */ 954 */
949static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap) 955static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap)
950{ 956{
951 int i, r; 957 int i, r;
952 struct iwl_link_quality_cmd link_cmd = { 958 struct iwl_link_quality_cmd link_cmd = {
@@ -979,8 +985,9 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap)
979 link_cmd.general_params.single_stream_ant_msk = 985 link_cmd.general_params.single_stream_ant_msk =
980 first_antenna(priv->hw_params.valid_tx_ant); 986 first_antenna(priv->hw_params.valid_tx_ant);
981 link_cmd.general_params.dual_stream_ant_msk = 3; 987 link_cmd.general_params.dual_stream_ant_msk = 3;
982 link_cmd.agg_params.agg_dis_start_th = 3; 988 link_cmd.agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
983 link_cmd.agg_params.agg_time_limit = cpu_to_le16(4000); 989 link_cmd.agg_params.agg_time_limit =
990 cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
984 991
985 /* Update the rate scaling for control frame Tx to AP */ 992 /* Update the rate scaling for control frame Tx to AP */
986 link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_params.bcast_sta_id; 993 link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_params.bcast_sta_id;
@@ -995,7 +1002,7 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap)
995 * there is only one AP station with id= IWL_AP_ID 1002 * there is only one AP station with id= IWL_AP_ID
996 * NOTE: mutex must be held before calling this function 1003 * NOTE: mutex must be held before calling this function
997 */ 1004 */
998int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) 1005int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, bool is_ap)
999{ 1006{
1000 struct ieee80211_sta *sta; 1007 struct ieee80211_sta *sta;
1001 struct ieee80211_sta_ht_cap ht_config; 1008 struct ieee80211_sta_ht_cap ht_config;
@@ -1020,8 +1027,7 @@ int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
1020 rcu_read_unlock(); 1027 rcu_read_unlock();
1021 } 1028 }
1022 1029
1023 sta_id = priv->cfg->ops->smgmt->add_station(priv, addr, is_ap, 1030 sta_id = iwl_add_station(priv, addr, is_ap, CMD_SYNC, cur_ht_config);
1024 0, cur_ht_config);
1025 1031
1026 /* Set up default rate scaling table in device's station table */ 1032 /* Set up default rate scaling table in device's station table */
1027 iwl_sta_init_lq(priv, addr, is_ap); 1033 iwl_sta_init_lq(priv, addr, is_ap);
@@ -1054,7 +1060,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
1054 1060
1055 /* If we are an AP, then find the station, or use BCAST */ 1061 /* If we are an AP, then find the station, or use BCAST */
1056 case NL80211_IFTYPE_AP: 1062 case NL80211_IFTYPE_AP:
1057 sta_id = priv->cfg->ops->smgmt->find_station(priv, hdr->addr1); 1063 sta_id = iwl_find_station(priv, hdr->addr1);
1058 if (sta_id != IWL_INVALID_STATION) 1064 if (sta_id != IWL_INVALID_STATION)
1059 return sta_id; 1065 return sta_id;
1060 return priv->hw_params.bcast_sta_id; 1066 return priv->hw_params.bcast_sta_id;
@@ -1062,13 +1068,13 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
1062 /* If this frame is going out to an IBSS network, find the station, 1068 /* If this frame is going out to an IBSS network, find the station,
1063 * or create a new station table entry */ 1069 * or create a new station table entry */
1064 case NL80211_IFTYPE_ADHOC: 1070 case NL80211_IFTYPE_ADHOC:
1065 sta_id = priv->cfg->ops->smgmt->find_station(priv, hdr->addr1); 1071 sta_id = iwl_find_station(priv, hdr->addr1);
1066 if (sta_id != IWL_INVALID_STATION) 1072 if (sta_id != IWL_INVALID_STATION)
1067 return sta_id; 1073 return sta_id;
1068 1074
1069 /* Create new station table entry */ 1075 /* Create new station table entry */
1070 sta_id = priv->cfg->ops->smgmt->add_station(priv, hdr->addr1, 1076 sta_id = iwl_add_station(priv, hdr->addr1, false,
1071 0, CMD_ASYNC, NULL); 1077 CMD_ASYNC, NULL);
1072 1078
1073 if (sta_id != IWL_INVALID_STATION) 1079 if (sta_id != IWL_INVALID_STATION)
1074 return sta_id; 1080 return sta_id;
@@ -1111,7 +1117,7 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv,
1111 unsigned long flags; 1117 unsigned long flags;
1112 int sta_id; 1118 int sta_id;
1113 1119
1114 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 1120 sta_id = iwl_find_station(priv, addr);
1115 if (sta_id == IWL_INVALID_STATION) 1121 if (sta_id == IWL_INVALID_STATION)
1116 return -ENXIO; 1122 return -ENXIO;
1117 1123
@@ -1133,7 +1139,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid)
1133 unsigned long flags; 1139 unsigned long flags;
1134 int sta_id; 1140 int sta_id;
1135 1141
1136 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 1142 sta_id = iwl_find_station(priv, addr);
1137 if (sta_id == IWL_INVALID_STATION) { 1143 if (sta_id == IWL_INVALID_STATION) {
1138 IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); 1144 IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid);
1139 return -ENXIO; 1145 return -ENXIO;
@@ -1168,7 +1174,7 @@ static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id)
1168void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) 1174void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr)
1169{ 1175{
1170 /* FIXME: need locking over ps_status ??? */ 1176 /* FIXME: need locking over ps_status ??? */
1171 u8 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 1177 u8 sta_id = iwl_find_station(priv, addr);
1172 1178
1173 if (sta_id != IWL_INVALID_STATION) { 1179 if (sta_id != IWL_INVALID_STATION) {
1174 u8 sta_awake = priv->stations[sta_id]. 1180 u8 sta_awake = priv->stations[sta_id].
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h
index 59a586b6b56c..6deebade6361 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.h
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.h
@@ -51,16 +51,15 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
51 struct ieee80211_key_conf *keyconf, 51 struct ieee80211_key_conf *keyconf,
52 const u8 *addr, u32 iv32, u16 *phase1key); 52 const u8 *addr, u32 iv32, u16 *phase1key);
53 53
54int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap); 54int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, bool is_ap);
55int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap); 55int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, bool is_ap);
56void iwl_clear_stations_table(struct iwl_priv *priv); 56void iwl_clear_stations_table(struct iwl_priv *priv);
57int iwl_get_free_ucode_key_index(struct iwl_priv *priv); 57int iwl_get_free_ucode_key_index(struct iwl_priv *priv);
58int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); 58int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr);
59int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr); 59int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr);
60int iwl_send_add_sta(struct iwl_priv *priv, 60int iwl_send_add_sta(struct iwl_priv *priv,
61 struct iwl_addsta_cmd *sta, u8 flags); 61 struct iwl_addsta_cmd *sta, u8 flags);
62u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, 62u8 iwl_add_station(struct iwl_priv *priv, const u8 *addr, bool is_ap, u8 flags,
63 int is_ap, u8 flags,
64 struct ieee80211_sta_ht_cap *ht_info); 63 struct ieee80211_sta_ht_cap *ht_info);
65void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid); 64void iwl_sta_tx_modify_enable_tid(struct iwl_priv *priv, int sta_id, int tid);
66int iwl_sta_rx_agg_start(struct iwl_priv *priv, 65int iwl_sta_rx_agg_start(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 5c10b87d0336..83d31606dd00 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -95,144 +95,6 @@ struct iwl_mod_params iwl3945_mod_params = {
95 /* the rest are 0 by default */ 95 /* the rest are 0 by default */
96}; 96};
97 97
98/*************** STATION TABLE MANAGEMENT ****
99 * mac80211 should be examined to determine if sta_info is duplicating
100 * the functionality provided here
101 */
102
103/**************************************************************/
104#if 0 /* temporary disable till we add real remove station */
105/**
106 * iwl3945_remove_station - Remove driver's knowledge of station.
107 *
108 * NOTE: This does not remove station from device's station table.
109 */
110static u8 iwl3945_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
111{
112 int index = IWL_INVALID_STATION;
113 int i;
114 unsigned long flags;
115
116 spin_lock_irqsave(&priv->sta_lock, flags);
117
118 if (is_ap)
119 index = IWL_AP_ID;
120 else if (is_broadcast_ether_addr(addr))
121 index = priv->hw_params.bcast_sta_id;
122 else
123 for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++)
124 if (priv->stations_39[i].used &&
125 !compare_ether_addr(priv->stations_39[i].sta.sta.addr,
126 addr)) {
127 index = i;
128 break;
129 }
130
131 if (unlikely(index == IWL_INVALID_STATION))
132 goto out;
133
134 if (priv->stations_39[index].used) {
135 priv->stations_39[index].used = 0;
136 priv->num_stations--;
137 }
138
139 BUG_ON(priv->num_stations < 0);
140
141out:
142 spin_unlock_irqrestore(&priv->sta_lock, flags);
143 return 0;
144}
145#endif
146
147/**
148 * iwl3945_clear_stations_table - Clear the driver's station table
149 *
150 * NOTE: This does not clear or otherwise alter the device's station table.
151 */
152void iwl3945_clear_stations_table(struct iwl_priv *priv)
153{
154 unsigned long flags;
155
156 spin_lock_irqsave(&priv->sta_lock, flags);
157
158 priv->num_stations = 0;
159 memset(priv->stations_39, 0, sizeof(priv->stations_39));
160
161 spin_unlock_irqrestore(&priv->sta_lock, flags);
162}
163
164/**
165 * iwl3945_add_station - Add station to station tables in driver and device
166 */
167u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info)
168{
169 int i;
170 int index = IWL_INVALID_STATION;
171 struct iwl3945_station_entry *station;
172 unsigned long flags_spin;
173 u8 rate;
174
175 spin_lock_irqsave(&priv->sta_lock, flags_spin);
176 if (is_ap)
177 index = IWL_AP_ID;
178 else if (is_broadcast_ether_addr(addr))
179 index = priv->hw_params.bcast_sta_id;
180 else
181 for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) {
182 if (!compare_ether_addr(priv->stations_39[i].sta.sta.addr,
183 addr)) {
184 index = i;
185 break;
186 }
187
188 if (!priv->stations_39[i].used &&
189 index == IWL_INVALID_STATION)
190 index = i;
191 }
192
193 /* These two conditions has the same outcome but keep them separate
194 since they have different meaning */
195 if (unlikely(index == IWL_INVALID_STATION)) {
196 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
197 return index;
198 }
199
200 if (priv->stations_39[index].used &&
201 !compare_ether_addr(priv->stations_39[index].sta.sta.addr, addr)) {
202 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
203 return index;
204 }
205
206 IWL_DEBUG_ASSOC(priv, "Add STA ID %d: %pM\n", index, addr);
207 station = &priv->stations_39[index];
208 station->used = 1;
209 priv->num_stations++;
210
211 /* Set up the REPLY_ADD_STA command to send to device */
212 memset(&station->sta, 0, sizeof(struct iwl3945_addsta_cmd));
213 memcpy(station->sta.sta.addr, addr, ETH_ALEN);
214 station->sta.mode = 0;
215 station->sta.sta.sta_id = index;
216 station->sta.station_flags = 0;
217
218 if (priv->band == IEEE80211_BAND_5GHZ)
219 rate = IWL_RATE_6M_PLCP;
220 else
221 rate = IWL_RATE_1M_PLCP;
222
223 /* Turn on both antennas for the station... */
224 station->sta.rate_n_flags =
225 iwl3945_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK);
226
227 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
228
229 /* Add station to device's station table */
230 iwl_send_add_sta(priv,
231 (struct iwl_addsta_cmd *)&station->sta, flags);
232 return index;
233
234}
235
236/** 98/**
237 * iwl3945_get_antenna_flags - Get antenna flags for RXON command 99 * iwl3945_get_antenna_flags - Get antenna flags for RXON command
238 * @priv: eeprom and antenna fields are used to determine antenna flags 100 * @priv: eeprom and antenna fields are used to determine antenna flags
@@ -289,32 +151,31 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
289 key_flags &= ~STA_KEY_FLG_INVALID; 151 key_flags &= ~STA_KEY_FLG_INVALID;
290 152
291 spin_lock_irqsave(&priv->sta_lock, flags); 153 spin_lock_irqsave(&priv->sta_lock, flags);
292 priv->stations_39[sta_id].keyinfo.alg = keyconf->alg; 154 priv->stations[sta_id].keyinfo.alg = keyconf->alg;
293 priv->stations_39[sta_id].keyinfo.keylen = keyconf->keylen; 155 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
294 memcpy(priv->stations_39[sta_id].keyinfo.key, keyconf->key, 156 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key,
295 keyconf->keylen); 157 keyconf->keylen);
296 158
297 memcpy(priv->stations_39[sta_id].sta.key.key, keyconf->key, 159 memcpy(priv->stations[sta_id].sta.key.key, keyconf->key,
298 keyconf->keylen); 160 keyconf->keylen);
299 161
300 if ((priv->stations_39[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) 162 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
301 == STA_KEY_FLG_NO_ENC) 163 == STA_KEY_FLG_NO_ENC)
302 priv->stations_39[sta_id].sta.key.key_offset = 164 priv->stations[sta_id].sta.key.key_offset =
303 iwl_get_free_ucode_key_index(priv); 165 iwl_get_free_ucode_key_index(priv);
304 /* else, we are overriding an existing key => no need to allocated room 166 /* else, we are overriding an existing key => no need to allocated room
305 * in uCode. */ 167 * in uCode. */
306 168
307 WARN(priv->stations_39[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, 169 WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
308 "no space for a new key"); 170 "no space for a new key");
309 171
310 priv->stations_39[sta_id].sta.key.key_flags = key_flags; 172 priv->stations[sta_id].sta.key.key_flags = key_flags;
311 priv->stations_39[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 173 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
312 priv->stations_39[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 174 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
313 175
314 IWL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n"); 176 IWL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n");
315 177
316 ret = iwl_send_add_sta(priv, 178 ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
317 (struct iwl_addsta_cmd *)&priv->stations_39[sta_id].sta, CMD_ASYNC);
318 179
319 spin_unlock_irqrestore(&priv->sta_lock, flags); 180 spin_unlock_irqrestore(&priv->sta_lock, flags);
320 181
@@ -340,17 +201,16 @@ static int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id)
340 unsigned long flags; 201 unsigned long flags;
341 202
342 spin_lock_irqsave(&priv->sta_lock, flags); 203 spin_lock_irqsave(&priv->sta_lock, flags);
343 memset(&priv->stations_39[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); 204 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key));
344 memset(&priv->stations_39[sta_id].sta.key, 0, 205 memset(&priv->stations[sta_id].sta.key, 0,
345 sizeof(struct iwl4965_keyinfo)); 206 sizeof(struct iwl4965_keyinfo));
346 priv->stations_39[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; 207 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
347 priv->stations_39[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 208 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
348 priv->stations_39[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 209 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
349 spin_unlock_irqrestore(&priv->sta_lock, flags); 210 spin_unlock_irqrestore(&priv->sta_lock, flags);
350 211
351 IWL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n"); 212 IWL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n");
352 iwl_send_add_sta(priv, 213 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, 0);
353 (struct iwl_addsta_cmd *)&priv->stations_39[sta_id].sta, 0);
354 return 0; 214 return 0;
355} 215}
356 216
@@ -578,7 +438,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
578 int sta_id) 438 int sta_id)
579{ 439{
580 struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload; 440 struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
581 struct iwl_hw_key *keyinfo = &priv->stations_39[sta_id].keyinfo; 441 struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo;
582 442
583 switch (keyinfo->alg) { 443 switch (keyinfo->alg) {
584 case ALG_CCMP: 444 case ALG_CCMP:
@@ -753,7 +613,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
753 if (ieee80211_is_data_qos(fc)) { 613 if (ieee80211_is_data_qos(fc)) {
754 qc = ieee80211_get_qos_ctl(hdr); 614 qc = ieee80211_get_qos_ctl(hdr);
755 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK; 615 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
756 seq_number = priv->stations_39[sta_id].tid[tid].seq_number & 616 seq_number = priv->stations[sta_id].tid[tid].seq_number &
757 IEEE80211_SCTL_SEQ; 617 IEEE80211_SCTL_SEQ;
758 hdr->seq_ctrl = cpu_to_le16(seq_number) | 618 hdr->seq_ctrl = cpu_to_le16(seq_number) |
759 (hdr->seq_ctrl & 619 (hdr->seq_ctrl &
@@ -813,7 +673,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
813 if (!ieee80211_has_morefrags(hdr->frame_control)) { 673 if (!ieee80211_has_morefrags(hdr->frame_control)) {
814 txq->need_update = 1; 674 txq->need_update = 1;
815 if (qc) 675 if (qc)
816 priv->stations_39[sta_id].tid[tid].seq_number = seq_number; 676 priv->stations[sta_id].tid[tid].seq_number = seq_number;
817 } else { 677 } else {
818 wait_write_ptr = 1; 678 wait_write_ptr = 1;
819 txq->need_update = 0; 679 txq->need_update = 0;
@@ -1149,18 +1009,12 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
1149 clear_bit(STATUS_RF_KILL_HW, &priv->status); 1009 clear_bit(STATUS_RF_KILL_HW, &priv->status);
1150 1010
1151 1011
1152 if (flags & SW_CARD_DISABLED)
1153 set_bit(STATUS_RF_KILL_SW, &priv->status);
1154 else
1155 clear_bit(STATUS_RF_KILL_SW, &priv->status);
1156
1157 iwl_scan_cancel(priv); 1012 iwl_scan_cancel(priv);
1158 1013
1159 if ((test_bit(STATUS_RF_KILL_HW, &status) != 1014 if ((test_bit(STATUS_RF_KILL_HW, &status) !=
1160 test_bit(STATUS_RF_KILL_HW, &priv->status)) || 1015 test_bit(STATUS_RF_KILL_HW, &priv->status)))
1161 (test_bit(STATUS_RF_KILL_SW, &status) != 1016 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
1162 test_bit(STATUS_RF_KILL_SW, &priv->status))) 1017 test_bit(STATUS_RF_KILL_HW, &priv->status));
1163 queue_work(priv->workqueue, &priv->rf_kill);
1164 else 1018 else
1165 wake_up_interruptible(&priv->wait_command_queue); 1019 wake_up_interruptible(&priv->wait_command_queue);
1166} 1020}
@@ -1316,7 +1170,7 @@ static int iwl3945_rx_queue_restock(struct iwl_priv *priv)
1316 1170
1317 /* If we've added more space for the firmware to place data, tell it. 1171 /* If we've added more space for the firmware to place data, tell it.
1318 * Increment device's write pointer in multiples of 8. */ 1172 * Increment device's write pointer in multiples of 8. */
1319 if ((write != (rxq->write & ~0x7)) 1173 if ((rxq->write_actual != (rxq->write & ~0x7))
1320 || (abs(rxq->write - rxq->read) > 7)) { 1174 || (abs(rxq->write - rxq->read) > 7)) {
1321 spin_lock_irqsave(&rxq->lock, flags); 1175 spin_lock_irqsave(&rxq->lock, flags);
1322 rxq->need_update = 1; 1176 rxq->need_update = 1;
@@ -1337,7 +1191,7 @@ static int iwl3945_rx_queue_restock(struct iwl_priv *priv)
1337 * Also restock the Rx queue via iwl3945_rx_queue_restock. 1191 * Also restock the Rx queue via iwl3945_rx_queue_restock.
1338 * This is called as a scheduled work item (except for during initialization) 1192 * This is called as a scheduled work item (except for during initialization)
1339 */ 1193 */
1340static void iwl3945_rx_allocate(struct iwl_priv *priv) 1194static void iwl3945_rx_allocate(struct iwl_priv *priv, gfp_t priority)
1341{ 1195{
1342 struct iwl_rx_queue *rxq = &priv->rxq; 1196 struct iwl_rx_queue *rxq = &priv->rxq;
1343 struct list_head *element; 1197 struct list_head *element;
@@ -1360,7 +1214,7 @@ static void iwl3945_rx_allocate(struct iwl_priv *priv)
1360 /* Alloc a new receive buffer */ 1214 /* Alloc a new receive buffer */
1361 rxb->skb = 1215 rxb->skb =
1362 alloc_skb(priv->hw_params.rx_buf_size, 1216 alloc_skb(priv->hw_params.rx_buf_size,
1363 GFP_KERNEL); 1217 priority);
1364 if (!rxb->skb) { 1218 if (!rxb->skb) {
1365 if (net_ratelimit()) 1219 if (net_ratelimit())
1366 IWL_CRIT(priv, ": Can not allocate SKB buffers\n"); 1220 IWL_CRIT(priv, ": Can not allocate SKB buffers\n");
@@ -1419,6 +1273,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1419 * not restocked the Rx queue with fresh buffers */ 1273 * not restocked the Rx queue with fresh buffers */
1420 rxq->read = rxq->write = 0; 1274 rxq->read = rxq->write = 0;
1421 rxq->free_count = 0; 1275 rxq->free_count = 0;
1276 rxq->write_actual = 0;
1422 spin_unlock_irqrestore(&rxq->lock, flags); 1277 spin_unlock_irqrestore(&rxq->lock, flags);
1423} 1278}
1424 1279
@@ -1427,13 +1282,21 @@ void iwl3945_rx_replenish(void *data)
1427 struct iwl_priv *priv = data; 1282 struct iwl_priv *priv = data;
1428 unsigned long flags; 1283 unsigned long flags;
1429 1284
1430 iwl3945_rx_allocate(priv); 1285 iwl3945_rx_allocate(priv, GFP_KERNEL);
1431 1286
1432 spin_lock_irqsave(&priv->lock, flags); 1287 spin_lock_irqsave(&priv->lock, flags);
1433 iwl3945_rx_queue_restock(priv); 1288 iwl3945_rx_queue_restock(priv);
1434 spin_unlock_irqrestore(&priv->lock, flags); 1289 spin_unlock_irqrestore(&priv->lock, flags);
1435} 1290}
1436 1291
1292static void iwl3945_rx_replenish_now(struct iwl_priv *priv)
1293{
1294 iwl3945_rx_allocate(priv, GFP_ATOMIC);
1295
1296 iwl3945_rx_queue_restock(priv);
1297}
1298
1299
1437/* Assumes that the skb field of the buffers in 'pool' is kept accurate. 1300/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
1438 * If an SKB has been detached, the POOL needs to have its SKB set to NULL 1301 * If an SKB has been detached, the POOL needs to have its SKB set to NULL
1439 * This free routine walks the list of POOL entries and if SKB is set to 1302 * This free routine walks the list of POOL entries and if SKB is set to
@@ -1556,13 +1419,19 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1556 unsigned long flags; 1419 unsigned long flags;
1557 u8 fill_rx = 0; 1420 u8 fill_rx = 0;
1558 u32 count = 8; 1421 u32 count = 8;
1422 int total_empty = 0;
1559 1423
1560 /* uCode's read index (stored in shared DRAM) indicates the last Rx 1424 /* uCode's read index (stored in shared DRAM) indicates the last Rx
1561 * buffer that the driver may process (last buffer filled by ucode). */ 1425 * buffer that the driver may process (last buffer filled by ucode). */
1562 r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF; 1426 r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF;
1563 i = rxq->read; 1427 i = rxq->read;
1564 1428
1565 if (iwl_rx_queue_space(rxq) > (RX_QUEUE_SIZE / 2)) 1429 /* calculate total frames need to be restock after handling RX */
1430 total_empty = r - priv->rxq.write_actual;
1431 if (total_empty < 0)
1432 total_empty += RX_QUEUE_SIZE;
1433
1434 if (total_empty > (RX_QUEUE_SIZE / 2))
1566 fill_rx = 1; 1435 fill_rx = 1;
1567 /* Rx interrupt, but nothing sent from uCode */ 1436 /* Rx interrupt, but nothing sent from uCode */
1568 if (i == r) 1437 if (i == r)
@@ -1639,7 +1508,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1639 count++; 1508 count++;
1640 if (count >= 8) { 1509 if (count >= 8) {
1641 priv->rxq.read = i; 1510 priv->rxq.read = i;
1642 iwl3945_rx_queue_restock(priv); 1511 iwl3945_rx_replenish_now(priv);
1643 count = 0; 1512 count = 0;
1644 } 1513 }
1645 } 1514 }
@@ -1647,7 +1516,10 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1647 1516
1648 /* Backtrack one entry */ 1517 /* Backtrack one entry */
1649 priv->rxq.read = i; 1518 priv->rxq.read = i;
1650 iwl3945_rx_queue_restock(priv); 1519 if (fill_rx)
1520 iwl3945_rx_replenish_now(priv);
1521 else
1522 iwl3945_rx_queue_restock(priv);
1651} 1523}
1652 1524
1653/* call this function to flush any scheduled tasklet */ 1525/* call this function to flush any scheduled tasklet */
@@ -2589,7 +2461,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2589 goto restart; 2461 goto restart;
2590 } 2462 }
2591 2463
2592 priv->cfg->ops->smgmt->clear_station_table(priv); 2464 iwl_clear_stations_table(priv);
2593 2465
2594 rfkill = iwl_read_prph(priv, APMG_RFKILL_REG); 2466 rfkill = iwl_read_prph(priv, APMG_RFKILL_REG);
2595 IWL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill); 2467 IWL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill);
@@ -2681,7 +2553,7 @@ static void __iwl3945_down(struct iwl_priv *priv)
2681 set_bit(STATUS_EXIT_PENDING, &priv->status); 2553 set_bit(STATUS_EXIT_PENDING, &priv->status);
2682 2554
2683 iwl3945_led_unregister(priv); 2555 iwl3945_led_unregister(priv);
2684 priv->cfg->ops->smgmt->clear_station_table(priv); 2556 iwl_clear_stations_table(priv);
2685 2557
2686 /* Unblock any waiting calls */ 2558 /* Unblock any waiting calls */
2687 wake_up_interruptible_all(&priv->wait_command_queue); 2559 wake_up_interruptible_all(&priv->wait_command_queue);
@@ -2708,8 +2580,6 @@ static void __iwl3945_down(struct iwl_priv *priv)
2708 if (!iwl_is_init(priv)) { 2580 if (!iwl_is_init(priv)) {
2709 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << 2581 priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
2710 STATUS_RF_KILL_HW | 2582 STATUS_RF_KILL_HW |
2711 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
2712 STATUS_RF_KILL_SW |
2713 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 2583 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
2714 STATUS_GEO_CONFIGURED | 2584 STATUS_GEO_CONFIGURED |
2715 test_bit(STATUS_EXIT_PENDING, &priv->status) << 2585 test_bit(STATUS_EXIT_PENDING, &priv->status) <<
@@ -2718,11 +2588,9 @@ static void __iwl3945_down(struct iwl_priv *priv)
2718 } 2588 }
2719 2589
2720 /* ...otherwise clear out all the status bits but the RF Kill 2590 /* ...otherwise clear out all the status bits but the RF Kill
2721 * bits and continue taking the NIC down. */ 2591 * bit and continue taking the NIC down. */
2722 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << 2592 priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
2723 STATUS_RF_KILL_HW | 2593 STATUS_RF_KILL_HW |
2724 test_bit(STATUS_RF_KILL_SW, &priv->status) <<
2725 STATUS_RF_KILL_SW |
2726 test_bit(STATUS_GEO_CONFIGURED, &priv->status) << 2594 test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
2727 STATUS_GEO_CONFIGURED | 2595 STATUS_GEO_CONFIGURED |
2728 test_bit(STATUS_FW_ERROR, &priv->status) << 2596 test_bit(STATUS_FW_ERROR, &priv->status) <<
@@ -2779,12 +2647,6 @@ static int __iwl3945_up(struct iwl_priv *priv)
2779 return -EIO; 2647 return -EIO;
2780 } 2648 }
2781 2649
2782 if (test_bit(STATUS_RF_KILL_SW, &priv->status)) {
2783 IWL_WARN(priv, "Radio disabled by SW RF kill (module "
2784 "parameter)\n");
2785 return -ENODEV;
2786 }
2787
2788 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) { 2650 if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
2789 IWL_ERR(priv, "ucode not available for device bring up\n"); 2651 IWL_ERR(priv, "ucode not available for device bring up\n");
2790 return -EIO; 2652 return -EIO;
@@ -2833,7 +2695,7 @@ static int __iwl3945_up(struct iwl_priv *priv)
2833 2695
2834 for (i = 0; i < MAX_HW_RESTARTS; i++) { 2696 for (i = 0; i < MAX_HW_RESTARTS; i++) {
2835 2697
2836 priv->cfg->ops->smgmt->clear_station_table(priv); 2698 iwl_clear_stations_table(priv);
2837 2699
2838 /* load bootstrap state machine, 2700 /* load bootstrap state machine,
2839 * load bootstrap program into processor's memory, 2701 * load bootstrap program into processor's memory,
@@ -2901,15 +2763,14 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2901{ 2763{
2902 struct iwl_priv *priv = 2764 struct iwl_priv *priv =
2903 container_of(data, struct iwl_priv, rfkill_poll.work); 2765 container_of(data, struct iwl_priv, rfkill_poll.work);
2904 unsigned long status = priv->status;
2905 2766
2906 if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) 2767 if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
2907 clear_bit(STATUS_RF_KILL_HW, &priv->status); 2768 clear_bit(STATUS_RF_KILL_HW, &priv->status);
2908 else 2769 else
2909 set_bit(STATUS_RF_KILL_HW, &priv->status); 2770 set_bit(STATUS_RF_KILL_HW, &priv->status);
2910 2771
2911 if (test_bit(STATUS_RF_KILL_HW, &status) != test_bit(STATUS_RF_KILL_HW, &priv->status)) 2772 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
2912 queue_work(priv->workqueue, &priv->rf_kill); 2773 test_bit(STATUS_RF_KILL_HW, &priv->status));
2913 2774
2914 queue_delayed_work(priv->workqueue, &priv->rfkill_poll, 2775 queue_delayed_work(priv->workqueue, &priv->rfkill_poll,
2915 round_jiffies_relative(2 * HZ)); 2776 round_jiffies_relative(2 * HZ));
@@ -3141,7 +3002,6 @@ static void iwl3945_bg_up(struct work_struct *data)
3141 mutex_lock(&priv->mutex); 3002 mutex_lock(&priv->mutex);
3142 __iwl3945_up(priv); 3003 __iwl3945_up(priv);
3143 mutex_unlock(&priv->mutex); 3004 mutex_unlock(&priv->mutex);
3144 iwl_rfkill_set_hw_state(priv);
3145} 3005}
3146 3006
3147static void iwl3945_bg_restart(struct work_struct *data) 3007static void iwl3945_bg_restart(struct work_struct *data)
@@ -3247,7 +3107,7 @@ void iwl3945_post_associate(struct iwl_priv *priv)
3247 case NL80211_IFTYPE_ADHOC: 3107 case NL80211_IFTYPE_ADHOC:
3248 3108
3249 priv->assoc_id = 1; 3109 priv->assoc_id = 1;
3250 priv->cfg->ops->smgmt->add_station(priv, priv->bssid, 0, 0, NULL); 3110 iwl_add_station(priv, priv->bssid, 0, CMD_SYNC, NULL);
3251 iwl3945_sync_sta(priv, IWL_STA_ID, 3111 iwl3945_sync_sta(priv, IWL_STA_ID,
3252 (priv->band == IEEE80211_BAND_5GHZ) ? 3112 (priv->band == IEEE80211_BAND_5GHZ) ?
3253 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, 3113 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP,
@@ -3304,8 +3164,6 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
3304 3164
3305 mutex_unlock(&priv->mutex); 3165 mutex_unlock(&priv->mutex);
3306 3166
3307 iwl_rfkill_set_hw_state(priv);
3308
3309 if (ret) 3167 if (ret)
3310 goto out_release_irq; 3168 goto out_release_irq;
3311 3169
@@ -3438,7 +3296,7 @@ void iwl3945_config_ap(struct iwl_priv *priv)
3438 /* restore RXON assoc */ 3296 /* restore RXON assoc */
3439 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 3297 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
3440 iwlcore_commit_rxon(priv); 3298 iwlcore_commit_rxon(priv);
3441 priv->cfg->ops->smgmt->add_station(priv, iwl_bcast_addr, 0, 0, NULL); 3299 iwl_add_station(priv, iwl_bcast_addr, 0, CMD_SYNC, NULL);
3442 } 3300 }
3443 iwl3945_send_beacon_cmd(priv); 3301 iwl3945_send_beacon_cmd(priv);
3444 3302
@@ -3469,7 +3327,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3469 static_key = !iwl_is_associated(priv); 3327 static_key = !iwl_is_associated(priv);
3470 3328
3471 if (!static_key) { 3329 if (!static_key) {
3472 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 3330 sta_id = iwl_find_station(priv, addr);
3473 if (sta_id == IWL_INVALID_STATION) { 3331 if (sta_id == IWL_INVALID_STATION) {
3474 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", 3332 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
3475 addr); 3333 addr);
@@ -3958,7 +3816,6 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv)
3958 INIT_WORK(&priv->up, iwl3945_bg_up); 3816 INIT_WORK(&priv->up, iwl3945_bg_up);
3959 INIT_WORK(&priv->restart, iwl3945_bg_restart); 3817 INIT_WORK(&priv->restart, iwl3945_bg_restart);
3960 INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish); 3818 INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish);
3961 INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill);
3962 INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update); 3819 INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update);
3963 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start); 3820 INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start);
3964 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); 3821 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
@@ -4044,7 +3901,7 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
4044 mutex_init(&priv->mutex); 3901 mutex_init(&priv->mutex);
4045 3902
4046 /* Clear the driver's (not device's) station table */ 3903 /* Clear the driver's (not device's) station table */
4047 priv->cfg->ops->smgmt->clear_station_table(priv); 3904 iwl_clear_stations_table(priv);
4048 3905
4049 priv->data_retry_limit = -1; 3906 priv->data_retry_limit = -1;
4050 priv->ieee_channels = NULL; 3907 priv->ieee_channels = NULL;
@@ -4325,13 +4182,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
4325 if (err) 4182 if (err)
4326 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); 4183 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);
4327 4184
4328 err = iwl_rfkill_init(priv);
4329 if (err)
4330 IWL_ERR(priv, "Unable to initialize RFKILL system. "
4331 "Ignoring error: %d\n", err);
4332 else
4333 iwl_rfkill_set_hw_state(priv);
4334
4335 /* Start monitoring the killswitch */ 4185 /* Start monitoring the killswitch */
4336 queue_delayed_work(priv->workqueue, &priv->rfkill_poll, 4186 queue_delayed_work(priv->workqueue, &priv->rfkill_poll,
4337 2 * HZ); 4187 2 * HZ);
@@ -4397,7 +4247,6 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
4397 4247
4398 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 4248 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
4399 4249
4400 iwl_rfkill_unregister(priv);
4401 cancel_delayed_work_sync(&priv->rfkill_poll); 4250 cancel_delayed_work_sync(&priv->rfkill_poll);
4402 4251
4403 iwl3945_dealloc_ucode_pci(priv); 4252 iwl3945_dealloc_ucode_pci(priv);
@@ -4407,7 +4256,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
4407 iwl3945_hw_txq_ctx_free(priv); 4256 iwl3945_hw_txq_ctx_free(priv);
4408 4257
4409 iwl3945_unset_hw_params(priv); 4258 iwl3945_unset_hw_params(priv);
4410 priv->cfg->ops->smgmt->clear_station_table(priv); 4259 iwl_clear_stations_table(priv);
4411 4260
4412 /*netif_stop_queue(dev); */ 4261 /*netif_stop_queue(dev); */
4413 flush_workqueue(priv->workqueue); 4262 flush_workqueue(priv->workqueue);