aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2009-06-03 14:44:07 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-06-04 10:56:20 -0400
commitc587de0b8d6e194f7a1719fc6af8a81b4e8916d2 (patch)
tree1537752cd44caa46883d1bdc2c6b7f40b3ef2600 /drivers/net/wireless/iwlwifi
parent0aa8204b46e0fb155a98074d53f8b31ca04269b2 (diff)
iwlwifi: unify station management
This patch unifies 3945 and AGN station management It also removes useless struct iwl_station_mgmt ops and cleanups a bit the interface Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Tested-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-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.h6
-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.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c51
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.h7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c196
15 files changed, 109 insertions, 310 deletions
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..4d8a325ea9d8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -202,12 +202,6 @@ struct iwl3945_ibss_seq {
202 * for use by iwl-*.c 202 * for use by iwl-*.c
203 * 203 *
204 *****************************************************************************/ 204 *****************************************************************************/
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); 205extern int iwl3945_power_init_handle(struct iwl_priv *priv);
212extern int iwl3945_eeprom_init(struct iwl_priv *priv); 206extern int iwl3945_eeprom_init(struct iwl_priv *priv);
213extern int iwl3945_calc_db_from_ratio(int sig_ratio); 207extern 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..2cdd191205b9 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;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 0a5507cbeb3f..e6ecb3fb8ec9 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
@@ -1617,7 +1617,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
1617 goto restart; 1617 goto restart;
1618 } 1618 }
1619 1619
1620 priv->cfg->ops->smgmt->clear_station_table(priv); 1620 iwl_clear_stations_table(priv);
1621 ret = priv->cfg->ops->lib->alive_notify(priv); 1621 ret = priv->cfg->ops->lib->alive_notify(priv);
1622 if (ret) { 1622 if (ret) {
1623 IWL_WARN(priv, 1623 IWL_WARN(priv,
@@ -1703,7 +1703,7 @@ static void __iwl_down(struct iwl_priv *priv)
1703 1703
1704 iwl_leds_unregister(priv); 1704 iwl_leds_unregister(priv);
1705 1705
1706 priv->cfg->ops->smgmt->clear_station_table(priv); 1706 iwl_clear_stations_table(priv);
1707 1707
1708 /* Unblock any waiting calls */ 1708 /* Unblock any waiting calls */
1709 wake_up_interruptible_all(&priv->wait_command_queue); 1709 wake_up_interruptible_all(&priv->wait_command_queue);
@@ -1903,7 +1903,7 @@ static int __iwl_up(struct iwl_priv *priv)
1903 1903
1904 for (i = 0; i < MAX_HW_RESTARTS; i++) { 1904 for (i = 0; i < MAX_HW_RESTARTS; i++) {
1905 1905
1906 priv->cfg->ops->smgmt->clear_station_table(priv); 1906 iwl_clear_stations_table(priv);
1907 1907
1908 /* load bootstrap state machine, 1908 /* load bootstrap state machine,
1909 * load bootstrap program into processor's memory, 1909 * load bootstrap program into processor's memory,
@@ -2348,7 +2348,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2348 return -EOPNOTSUPP; 2348 return -EOPNOTSUPP;
2349 } 2349 }
2350 addr = sta ? sta->addr : iwl_bcast_addr; 2350 addr = sta ? sta->addr : iwl_bcast_addr;
2351 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 2351 sta_id = iwl_find_station(priv, addr);
2352 if (sta_id == IWL_INVALID_STATION) { 2352 if (sta_id == IWL_INVALID_STATION) {
2353 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", 2353 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
2354 addr); 2354 addr);
@@ -3121,7 +3121,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
3121 iwl_rx_queue_free(priv, &priv->rxq); 3121 iwl_rx_queue_free(priv, &priv->rxq);
3122 iwl_hw_txq_ctx_free(priv); 3122 iwl_hw_txq_ctx_free(priv);
3123 3123
3124 priv->cfg->ops->smgmt->clear_station_table(priv); 3124 iwl_clear_stations_table(priv);
3125 iwl_eeprom_free(priv); 3125 iwl_eeprom_free(priv);
3126 3126
3127 3127
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index e581dc323f0a..b3229f2db503 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. */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index ddd2219c2b0a..51cae4ec26a5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1389,7 +1389,7 @@ int iwl_init_drv(struct iwl_priv *priv)
1389 mutex_init(&priv->mutex); 1389 mutex_init(&priv->mutex);
1390 1390
1391 /* Clear the driver's (not device's) station table */ 1391 /* Clear the driver's (not device's) station table */
1392 priv->cfg->ops->smgmt->clear_station_table(priv); 1392 iwl_clear_stations_table(priv);
1393 1393
1394 priv->data_retry_limit = -1; 1394 priv->data_retry_limit = -1;
1395 priv->ieee_channels = NULL; 1395 priv->ieee_channels = NULL;
@@ -2680,7 +2680,7 @@ int iwl_set_mode(struct iwl_priv *priv, int mode)
2680 2680
2681 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); 2681 memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
2682 2682
2683 priv->cfg->ops->smgmt->clear_station_table(priv); 2683 iwl_clear_stations_table(priv);
2684 2684
2685 /* dont commit rxon if rf-kill is on*/ 2685 /* dont commit rxon if rf-kill is on*/
2686 if (!iwl_is_ready_rf(priv)) 2686 if (!iwl_is_ready_rf(priv))
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 87df1b767941..4173a401bd7e 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 {
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 2dafc26fb6a8..28c39cf8b126 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -70,7 +70,6 @@ extern struct iwl_ops iwl5000_ops;
70extern struct iwl_lib_ops iwl5000_lib; 70extern struct iwl_lib_ops iwl5000_lib;
71extern struct iwl_hcmd_ops iwl5000_hcmd; 71extern struct iwl_hcmd_ops iwl5000_hcmd;
72extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils; 72extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils;
73extern struct iwl_station_mgmt_ops iwl5000_station_mgmt;
74 73
75/* shared functions from iwl-5000.c */ 74/* shared functions from iwl-5000.c */
76extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len); 75extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len);
@@ -290,11 +289,11 @@ struct iwl_frame {
290#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) 289#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
291 290
292enum { 291enum {
293 /* CMD_SIZE_NORMAL = 0, */ 292 CMD_SYNC = 0,
293 CMD_SIZE_NORMAL = 0,
294 CMD_NO_SKB = 0,
294 CMD_SIZE_HUGE = (1 << 0), 295 CMD_SIZE_HUGE = (1 << 0),
295 /* CMD_SYNC = 0, */
296 CMD_ASYNC = (1 << 1), 296 CMD_ASYNC = (1 << 1),
297 /* CMD_NO_SKB = 0, */
298 CMD_WANT_SKB = (1 << 2), 297 CMD_WANT_SKB = (1 << 2),
299}; 298};
300 299
@@ -1119,8 +1118,6 @@ struct iwl_priv {
1119 1118
1120 struct iwl3945_notif_statistics statistics_39; 1119 struct iwl3945_notif_statistics statistics_39;
1121 1120
1122 struct iwl3945_station_entry stations_39[IWL_STATION_COUNT];
1123
1124 u32 sta_supp_rates; 1121 u32 sta_supp_rates;
1125}; /*iwl_priv */ 1122}; /*iwl_priv */
1126 1123
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 0eb939c40ac1..5ea3bc78a66e 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 = {
@@ -995,7 +1001,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 1001 * there is only one AP station with id= IWL_AP_ID
996 * NOTE: mutex must be held before calling this function 1002 * NOTE: mutex must be held before calling this function
997 */ 1003 */
998int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) 1004int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, bool is_ap)
999{ 1005{
1000 struct ieee80211_sta *sta; 1006 struct ieee80211_sta *sta;
1001 struct ieee80211_sta_ht_cap ht_config; 1007 struct ieee80211_sta_ht_cap ht_config;
@@ -1020,8 +1026,7 @@ int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
1020 rcu_read_unlock(); 1026 rcu_read_unlock();
1021 } 1027 }
1022 1028
1023 sta_id = priv->cfg->ops->smgmt->add_station(priv, addr, is_ap, 1029 sta_id = iwl_add_station(priv, addr, is_ap, CMD_SYNC, cur_ht_config);
1024 0, cur_ht_config);
1025 1030
1026 /* Set up default rate scaling table in device's station table */ 1031 /* Set up default rate scaling table in device's station table */
1027 iwl_sta_init_lq(priv, addr, is_ap); 1032 iwl_sta_init_lq(priv, addr, is_ap);
@@ -1054,7 +1059,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
1054 1059
1055 /* If we are an AP, then find the station, or use BCAST */ 1060 /* If we are an AP, then find the station, or use BCAST */
1056 case NL80211_IFTYPE_AP: 1061 case NL80211_IFTYPE_AP:
1057 sta_id = priv->cfg->ops->smgmt->find_station(priv, hdr->addr1); 1062 sta_id = iwl_find_station(priv, hdr->addr1);
1058 if (sta_id != IWL_INVALID_STATION) 1063 if (sta_id != IWL_INVALID_STATION)
1059 return sta_id; 1064 return sta_id;
1060 return priv->hw_params.bcast_sta_id; 1065 return priv->hw_params.bcast_sta_id;
@@ -1062,13 +1067,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, 1067 /* If this frame is going out to an IBSS network, find the station,
1063 * or create a new station table entry */ 1068 * or create a new station table entry */
1064 case NL80211_IFTYPE_ADHOC: 1069 case NL80211_IFTYPE_ADHOC:
1065 sta_id = priv->cfg->ops->smgmt->find_station(priv, hdr->addr1); 1070 sta_id = iwl_find_station(priv, hdr->addr1);
1066 if (sta_id != IWL_INVALID_STATION) 1071 if (sta_id != IWL_INVALID_STATION)
1067 return sta_id; 1072 return sta_id;
1068 1073
1069 /* Create new station table entry */ 1074 /* Create new station table entry */
1070 sta_id = priv->cfg->ops->smgmt->add_station(priv, hdr->addr1, 1075 sta_id = iwl_add_station(priv, hdr->addr1, false,
1071 0, CMD_ASYNC, NULL); 1076 CMD_ASYNC, NULL);
1072 1077
1073 if (sta_id != IWL_INVALID_STATION) 1078 if (sta_id != IWL_INVALID_STATION)
1074 return sta_id; 1079 return sta_id;
@@ -1111,7 +1116,7 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv,
1111 unsigned long flags; 1116 unsigned long flags;
1112 int sta_id; 1117 int sta_id;
1113 1118
1114 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 1119 sta_id = iwl_find_station(priv, addr);
1115 if (sta_id == IWL_INVALID_STATION) 1120 if (sta_id == IWL_INVALID_STATION)
1116 return -ENXIO; 1121 return -ENXIO;
1117 1122
@@ -1133,7 +1138,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid)
1133 unsigned long flags; 1138 unsigned long flags;
1134 int sta_id; 1139 int sta_id;
1135 1140
1136 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 1141 sta_id = iwl_find_station(priv, addr);
1137 if (sta_id == IWL_INVALID_STATION) { 1142 if (sta_id == IWL_INVALID_STATION) {
1138 IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); 1143 IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid);
1139 return -ENXIO; 1144 return -ENXIO;
@@ -1168,7 +1173,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) 1173void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr)
1169{ 1174{
1170 /* FIXME: need locking over ps_status ??? */ 1175 /* FIXME: need locking over ps_status ??? */
1171 u8 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 1176 u8 sta_id = iwl_find_station(priv, addr);
1172 1177
1173 if (sta_id != IWL_INVALID_STATION) { 1178 if (sta_id != IWL_INVALID_STATION) {
1174 u8 sta_awake = priv->stations[sta_id]. 1179 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..745eaaec5954 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;
@@ -2589,7 +2449,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2589 goto restart; 2449 goto restart;
2590 } 2450 }
2591 2451
2592 priv->cfg->ops->smgmt->clear_station_table(priv); 2452 iwl_clear_stations_table(priv);
2593 2453
2594 rfkill = iwl_read_prph(priv, APMG_RFKILL_REG); 2454 rfkill = iwl_read_prph(priv, APMG_RFKILL_REG);
2595 IWL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill); 2455 IWL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill);
@@ -2681,7 +2541,7 @@ static void __iwl3945_down(struct iwl_priv *priv)
2681 set_bit(STATUS_EXIT_PENDING, &priv->status); 2541 set_bit(STATUS_EXIT_PENDING, &priv->status);
2682 2542
2683 iwl3945_led_unregister(priv); 2543 iwl3945_led_unregister(priv);
2684 priv->cfg->ops->smgmt->clear_station_table(priv); 2544 iwl_clear_stations_table(priv);
2685 2545
2686 /* Unblock any waiting calls */ 2546 /* Unblock any waiting calls */
2687 wake_up_interruptible_all(&priv->wait_command_queue); 2547 wake_up_interruptible_all(&priv->wait_command_queue);
@@ -2833,7 +2693,7 @@ static int __iwl3945_up(struct iwl_priv *priv)
2833 2693
2834 for (i = 0; i < MAX_HW_RESTARTS; i++) { 2694 for (i = 0; i < MAX_HW_RESTARTS; i++) {
2835 2695
2836 priv->cfg->ops->smgmt->clear_station_table(priv); 2696 iwl_clear_stations_table(priv);
2837 2697
2838 /* load bootstrap state machine, 2698 /* load bootstrap state machine,
2839 * load bootstrap program into processor's memory, 2699 * load bootstrap program into processor's memory,
@@ -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,
@@ -3438,7 +3298,7 @@ void iwl3945_config_ap(struct iwl_priv *priv)
3438 /* restore RXON assoc */ 3298 /* restore RXON assoc */
3439 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; 3299 priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
3440 iwlcore_commit_rxon(priv); 3300 iwlcore_commit_rxon(priv);
3441 priv->cfg->ops->smgmt->add_station(priv, iwl_bcast_addr, 0, 0, NULL); 3301 iwl_add_station(priv, iwl_bcast_addr, 0, CMD_SYNC, NULL);
3442 } 3302 }
3443 iwl3945_send_beacon_cmd(priv); 3303 iwl3945_send_beacon_cmd(priv);
3444 3304
@@ -3469,7 +3329,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3469 static_key = !iwl_is_associated(priv); 3329 static_key = !iwl_is_associated(priv);
3470 3330
3471 if (!static_key) { 3331 if (!static_key) {
3472 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); 3332 sta_id = iwl_find_station(priv, addr);
3473 if (sta_id == IWL_INVALID_STATION) { 3333 if (sta_id == IWL_INVALID_STATION) {
3474 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", 3334 IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
3475 addr); 3335 addr);
@@ -4044,7 +3904,7 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
4044 mutex_init(&priv->mutex); 3904 mutex_init(&priv->mutex);
4045 3905
4046 /* Clear the driver's (not device's) station table */ 3906 /* Clear the driver's (not device's) station table */
4047 priv->cfg->ops->smgmt->clear_station_table(priv); 3907 iwl_clear_stations_table(priv);
4048 3908
4049 priv->data_retry_limit = -1; 3909 priv->data_retry_limit = -1;
4050 priv->ieee_channels = NULL; 3910 priv->ieee_channels = NULL;
@@ -4407,7 +4267,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
4407 iwl3945_hw_txq_ctx_free(priv); 4267 iwl3945_hw_txq_ctx_free(priv);
4408 4268
4409 iwl3945_unset_hw_params(priv); 4269 iwl3945_unset_hw_params(priv);
4410 priv->cfg->ops->smgmt->clear_station_table(priv); 4270 iwl_clear_stations_table(priv);
4411 4271
4412 /*netif_stop_queue(dev); */ 4272 /*netif_stop_queue(dev); */
4413 flush_workqueue(priv->workqueue); 4273 flush_workqueue(priv->workqueue);