aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-sta.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-sta.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c56
1 files changed, 31 insertions, 25 deletions
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].