diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-sta.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-sta.c | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index d401b6f226f9..d86ecd2f9ec2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -71,7 +71,7 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr) | |||
71 | (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) || | 71 | (!(priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) || |
72 | ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) && | 72 | ((priv->stations[ret].used & IWL_STA_UCODE_ACTIVE) && |
73 | (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) { | 73 | (priv->stations[ret].used & IWL_STA_UCODE_INPROGRESS)))) { |
74 | IWL_ERR(priv, "Requested station info for sta %d before ready. \n", | 74 | IWL_ERR(priv, "Requested station info for sta %d before ready.\n", |
75 | ret); | 75 | ret); |
76 | ret = IWL_INVALID_STATION; | 76 | ret = IWL_INVALID_STATION; |
77 | } | 77 | } |
@@ -143,7 +143,7 @@ static void iwl_process_add_sta_resp(struct iwl_priv *priv, | |||
143 | sta_id); | 143 | sta_id); |
144 | break; | 144 | break; |
145 | case ADD_STA_MODIFY_NON_EXIST_STA: | 145 | case ADD_STA_MODIFY_NON_EXIST_STA: |
146 | IWL_ERR(priv, "Attempting to modify non-existing station %d \n", | 146 | IWL_ERR(priv, "Attempting to modify non-existing station %d\n", |
147 | sta_id); | 147 | sta_id); |
148 | break; | 148 | break; |
149 | default: | 149 | default: |
@@ -194,7 +194,7 @@ int iwl_send_add_sta(struct iwl_priv *priv, | |||
194 | .flags = flags, | 194 | .flags = flags, |
195 | .data = data, | 195 | .data = data, |
196 | }; | 196 | }; |
197 | u8 sta_id = sta->sta.sta_id; | 197 | u8 sta_id __maybe_unused = sta->sta.sta_id; |
198 | 198 | ||
199 | IWL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n", | 199 | IWL_DEBUG_INFO(priv, "Adding sta %u (%pM) %ssynchronously\n", |
200 | sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); | 200 | sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); |
@@ -425,6 +425,7 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap) | |||
425 | .reserved1 = 0, | 425 | .reserved1 = 0, |
426 | }; | 426 | }; |
427 | u32 rate_flags; | 427 | u32 rate_flags; |
428 | int ret = 0; | ||
428 | 429 | ||
429 | /* Set up the rate scaling to start at selected rate, fall back | 430 | /* Set up the rate scaling to start at selected rate, fall back |
430 | * all the way down to 1M in IEEE order, and then spin on 1M */ | 431 | * all the way down to 1M in IEEE order, and then spin on 1M */ |
@@ -458,8 +459,10 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap) | |||
458 | /* Update the rate scaling for control frame Tx to AP */ | 459 | /* Update the rate scaling for control frame Tx to AP */ |
459 | link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_params.bcast_sta_id; | 460 | link_cmd.sta_id = is_ap ? IWL_AP_ID : priv->hw_params.bcast_sta_id; |
460 | 461 | ||
461 | iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, | 462 | ret = iwl_send_cmd_pdu(priv, REPLY_TX_LINK_QUALITY_CMD, |
462 | sizeof(link_cmd), &link_cmd); | 463 | sizeof(link_cmd), &link_cmd); |
464 | if (ret) | ||
465 | IWL_ERR(priv, "REPLY_TX_LINK_QUALITY_CMD failed (%d)\n", ret); | ||
463 | } | 466 | } |
464 | 467 | ||
465 | /* | 468 | /* |
@@ -571,7 +574,7 @@ static int iwl_remove_station(struct iwl_priv *priv, struct ieee80211_sta *sta) | |||
571 | 574 | ||
572 | if (!iwl_is_ready(priv)) { | 575 | if (!iwl_is_ready(priv)) { |
573 | IWL_DEBUG_INFO(priv, | 576 | IWL_DEBUG_INFO(priv, |
574 | "Unable to remove station %pM, device not ready. \n", | 577 | "Unable to remove station %pM, device not ready.\n", |
575 | sta->addr); | 578 | sta->addr); |
576 | /* | 579 | /* |
577 | * It is typical for stations to be removed when we are | 580 | * It is typical for stations to be removed when we are |
@@ -668,7 +671,7 @@ void iwl_clear_ucode_stations(struct iwl_priv *priv, bool force) | |||
668 | } else { | 671 | } else { |
669 | for (i = 0; i < priv->hw_params.max_stations; i++) { | 672 | for (i = 0; i < priv->hw_params.max_stations; i++) { |
670 | if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { | 673 | if (priv->stations[i].used & IWL_STA_UCODE_ACTIVE) { |
671 | IWL_DEBUG_INFO(priv, "Clearing ucode active for station %d \n", i); | 674 | IWL_DEBUG_INFO(priv, "Clearing ucode active for station %d\n", i); |
672 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; | 675 | priv->stations[i].used &= ~IWL_STA_UCODE_ACTIVE; |
673 | cleared = true; | 676 | cleared = true; |
674 | } | 677 | } |
@@ -759,7 +762,7 @@ int iwl_get_free_ucode_key_index(struct iwl_priv *priv) | |||
759 | } | 762 | } |
760 | EXPORT_SYMBOL(iwl_get_free_ucode_key_index); | 763 | EXPORT_SYMBOL(iwl_get_free_ucode_key_index); |
761 | 764 | ||
762 | int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) | 765 | static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) |
763 | { | 766 | { |
764 | int i, not_empty = 0; | 767 | int i, not_empty = 0; |
765 | u8 buff[sizeof(struct iwl_wep_cmd) + | 768 | u8 buff[sizeof(struct iwl_wep_cmd) + |
@@ -803,7 +806,14 @@ int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) | |||
803 | else | 806 | else |
804 | return 0; | 807 | return 0; |
805 | } | 808 | } |
806 | EXPORT_SYMBOL(iwl_send_static_wepkey_cmd); | 809 | |
810 | int iwl_restore_default_wep_keys(struct iwl_priv *priv) | ||
811 | { | ||
812 | WARN_ON(!mutex_is_locked(&priv->mutex)); | ||
813 | |||
814 | return iwl_send_static_wepkey_cmd(priv, 0); | ||
815 | } | ||
816 | EXPORT_SYMBOL(iwl_restore_default_wep_keys); | ||
807 | 817 | ||
808 | int iwl_remove_default_wep_key(struct iwl_priv *priv, | 818 | int iwl_remove_default_wep_key(struct iwl_priv *priv, |
809 | struct ieee80211_key_conf *keyconf) | 819 | struct ieee80211_key_conf *keyconf) |
@@ -815,11 +825,6 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv, | |||
815 | IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", | 825 | IWL_DEBUG_WEP(priv, "Removing default WEP key: idx=%d\n", |
816 | keyconf->keyidx); | 826 | keyconf->keyidx); |
817 | 827 | ||
818 | if (!test_and_clear_bit(keyconf->keyidx, &priv->ucode_key_table)) | ||
819 | IWL_ERR(priv, "index %d not used in uCode key table.\n", | ||
820 | keyconf->keyidx); | ||
821 | |||
822 | priv->default_wep_key--; | ||
823 | memset(&priv->wep_keys[keyconf->keyidx], 0, sizeof(priv->wep_keys[0])); | 828 | memset(&priv->wep_keys[keyconf->keyidx], 0, sizeof(priv->wep_keys[0])); |
824 | if (iwl_is_rfkill(priv)) { | 829 | if (iwl_is_rfkill(priv)) { |
825 | IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); | 830 | IWL_DEBUG_WEP(priv, "Not sending REPLY_WEPKEY command due to RFKILL.\n"); |
@@ -851,12 +856,6 @@ int iwl_set_default_wep_key(struct iwl_priv *priv, | |||
851 | keyconf->hw_key_idx = HW_KEY_DEFAULT; | 856 | keyconf->hw_key_idx = HW_KEY_DEFAULT; |
852 | priv->stations[IWL_AP_ID].keyinfo.alg = ALG_WEP; | 857 | priv->stations[IWL_AP_ID].keyinfo.alg = ALG_WEP; |
853 | 858 | ||
854 | priv->default_wep_key++; | ||
855 | |||
856 | if (test_and_set_bit(keyconf->keyidx, &priv->ucode_key_table)) | ||
857 | IWL_ERR(priv, "index %d already used in uCode key table.\n", | ||
858 | keyconf->keyidx); | ||
859 | |||
860 | priv->wep_keys[keyconf->keyidx].key_size = keyconf->keylen; | 859 | priv->wep_keys[keyconf->keyidx].key_size = keyconf->keylen; |
861 | memcpy(&priv->wep_keys[keyconf->keyidx].key, &keyconf->key, | 860 | memcpy(&priv->wep_keys[keyconf->keyidx].key, &keyconf->key, |
862 | keyconf->keylen); | 861 | keyconf->keylen); |
@@ -1105,7 +1104,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, | |||
1105 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 1104 | priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
1106 | 1105 | ||
1107 | if (iwl_is_rfkill(priv)) { | 1106 | if (iwl_is_rfkill(priv)) { |
1108 | IWL_DEBUG_WEP(priv, "Not sending REPLY_ADD_STA command because RFKILL enabled. \n"); | 1107 | IWL_DEBUG_WEP(priv, "Not sending REPLY_ADD_STA command because RFKILL enabled.\n"); |
1109 | spin_unlock_irqrestore(&priv->sta_lock, flags); | 1108 | spin_unlock_irqrestore(&priv->sta_lock, flags); |
1110 | return 0; | 1109 | return 0; |
1111 | } | 1110 | } |
@@ -1191,13 +1190,9 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
1191 | .data = lq, | 1190 | .data = lq, |
1192 | }; | 1191 | }; |
1193 | 1192 | ||
1194 | if ((lq->sta_id == 0xFF) && | 1193 | if (WARN_ON(lq->sta_id == IWL_INVALID_STATION)) |
1195 | (priv->iw_mode == NL80211_IFTYPE_ADHOC)) | ||
1196 | return -EINVAL; | 1194 | return -EINVAL; |
1197 | 1195 | ||
1198 | if (lq->sta_id == 0xFF) | ||
1199 | lq->sta_id = IWL_AP_ID; | ||
1200 | |||
1201 | iwl_dump_lq_cmd(priv, lq); | 1196 | iwl_dump_lq_cmd(priv, lq); |
1202 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); | 1197 | BUG_ON(init && (cmd.flags & CMD_ASYNC)); |
1203 | 1198 | ||
@@ -1207,7 +1202,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv, | |||
1207 | return ret; | 1202 | return ret; |
1208 | 1203 | ||
1209 | if (init) { | 1204 | if (init) { |
1210 | IWL_DEBUG_INFO(priv, "init LQ command complete, clearing sta addition status for sta %d \n", | 1205 | IWL_DEBUG_INFO(priv, "init LQ command complete, clearing sta addition status for sta %d\n", |
1211 | lq->sta_id); | 1206 | lq->sta_id); |
1212 | spin_lock_irqsave(&priv->sta_lock, flags_spin); | 1207 | spin_lock_irqsave(&priv->sta_lock, flags_spin); |
1213 | priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; | 1208 | priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; |
@@ -1395,6 +1390,7 @@ void iwl_sta_modify_sleep_tx_count(struct iwl_priv *priv, int sta_id, int cnt) | |||
1395 | 1390 | ||
1396 | iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); | 1391 | iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC); |
1397 | } | 1392 | } |
1393 | EXPORT_SYMBOL(iwl_sta_modify_sleep_tx_count); | ||
1398 | 1394 | ||
1399 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, | 1395 | int iwl_mac_sta_remove(struct ieee80211_hw *hw, |
1400 | struct ieee80211_vif *vif, | 1396 | struct ieee80211_vif *vif, |