diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2009-06-03 14:44:07 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-06-04 10:56:20 -0400 |
commit | c587de0b8d6e194f7a1719fc6af8a81b4e8916d2 (patch) | |
tree | 1537752cd44caa46883d1bdc2c6b7f40b3ef2600 /drivers/net/wireless/iwlwifi/iwl-sta.c | |
parent | 0aa8204b46e0fb155a98074d53f8b31ca04269b2 (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/iwl-sta.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-sta.c | 51 |
1 files changed, 28 insertions, 23 deletions
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 | } |
81 | EXPORT_SYMBOL(iwl_get_ra_sta_id); | 81 | EXPORT_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 | */ |
233 | u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap, | 232 | u8 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 | } |
298 | EXPORT_SYMBOL(iwl_add_station_flags); | 304 | EXPORT_SYMBOL(iwl_add_station); |
299 | 305 | ||
300 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr) | 306 | static 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 | */ |
411 | int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | 417 | int 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 | */ |
949 | static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap) | 955 | static 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 | */ |
998 | int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | 1004 | int 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) | |||
1168 | void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) | 1173 | void 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]. |