aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c71
1 files changed, 22 insertions, 49 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 3a92c09d4692..6a3b11dd2edf 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -2714,9 +2714,6 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
2714 2714
2715 iwl_mvm_mac_ctxt_remove(mvm, vif); 2715 iwl_mvm_mac_ctxt_remove(mvm, vif);
2716 2716
2717 kfree(mvmvif->ap_wep_key);
2718 mvmvif->ap_wep_key = NULL;
2719
2720 mutex_unlock(&mvm->mutex); 2717 mutex_unlock(&mvm->mutex);
2721} 2718}
2722 2719
@@ -3183,24 +3180,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
3183 ret = iwl_mvm_update_sta(mvm, vif, sta); 3180 ret = iwl_mvm_update_sta(mvm, vif, sta);
3184 } else if (old_state == IEEE80211_STA_ASSOC && 3181 } else if (old_state == IEEE80211_STA_ASSOC &&
3185 new_state == IEEE80211_STA_AUTHORIZED) { 3182 new_state == IEEE80211_STA_AUTHORIZED) {
3186 /* if wep is used, need to set the key for the station now */ 3183 ret = 0;
3187 if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key) {
3188 mvm_sta->wep_key =
3189 kmemdup(mvmvif->ap_wep_key,
3190 sizeof(*mvmvif->ap_wep_key) +
3191 mvmvif->ap_wep_key->keylen,
3192 GFP_KERNEL);
3193 if (!mvm_sta->wep_key) {
3194 ret = -ENOMEM;
3195 goto out_unlock;
3196 }
3197
3198 ret = iwl_mvm_set_sta_key(mvm, vif, sta,
3199 mvm_sta->wep_key,
3200 STA_KEY_IDX_INVALID);
3201 } else {
3202 ret = 0;
3203 }
3204 3184
3205 /* we don't support TDLS during DCM */ 3185 /* we don't support TDLS during DCM */
3206 if (iwl_mvm_phy_ctx_count(mvm) > 1) 3186 if (iwl_mvm_phy_ctx_count(mvm) > 1)
@@ -3242,17 +3222,6 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
3242 NL80211_TDLS_DISABLE_LINK); 3222 NL80211_TDLS_DISABLE_LINK);
3243 } 3223 }
3244 3224
3245 /* Remove STA key if this is an AP using WEP */
3246 if (vif->type == NL80211_IFTYPE_AP && mvmvif->ap_wep_key) {
3247 int rm_ret = iwl_mvm_remove_sta_key(mvm, vif, sta,
3248 mvm_sta->wep_key);
3249
3250 if (!ret)
3251 ret = rm_ret;
3252 kfree(mvm_sta->wep_key);
3253 mvm_sta->wep_key = NULL;
3254 }
3255
3256 if (unlikely(ret && 3225 if (unlikely(ret &&
3257 test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, 3226 test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
3258 &mvm->status))) 3227 &mvm->status)))
@@ -3289,6 +3258,13 @@ static void iwl_mvm_sta_rc_update(struct ieee80211_hw *hw,
3289 struct ieee80211_sta *sta, u32 changed) 3258 struct ieee80211_sta *sta, u32 changed)
3290{ 3259{
3291 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 3260 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3261 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3262
3263 if (changed & (IEEE80211_RC_BW_CHANGED |
3264 IEEE80211_RC_SUPP_RATES_CHANGED |
3265 IEEE80211_RC_NSS_CHANGED))
3266 iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band,
3267 true);
3292 3268
3293 if (vif->type == NL80211_IFTYPE_STATION && 3269 if (vif->type == NL80211_IFTYPE_STATION &&
3294 changed & IEEE80211_RC_NSS_CHANGED) 3270 changed & IEEE80211_RC_NSS_CHANGED)
@@ -3439,20 +3415,12 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
3439 break; 3415 break;
3440 case WLAN_CIPHER_SUITE_WEP40: 3416 case WLAN_CIPHER_SUITE_WEP40:
3441 case WLAN_CIPHER_SUITE_WEP104: 3417 case WLAN_CIPHER_SUITE_WEP104:
3442 if (vif->type == NL80211_IFTYPE_AP) { 3418 if (vif->type == NL80211_IFTYPE_STATION)
3443 struct iwl_mvm_vif *mvmvif = 3419 break;
3444 iwl_mvm_vif_from_mac80211(vif); 3420 if (iwl_mvm_has_new_tx_api(mvm))
3445 3421 return -EOPNOTSUPP;
3446 mvmvif->ap_wep_key = kmemdup(key, 3422 /* support HW crypto on TX */
3447 sizeof(*key) + key->keylen, 3423 return 0;
3448 GFP_KERNEL);
3449 if (!mvmvif->ap_wep_key)
3450 return -ENOMEM;
3451 }
3452
3453 if (vif->type != NL80211_IFTYPE_STATION)
3454 return 0;
3455 break;
3456 default: 3424 default:
3457 /* currently FW supports only one optional cipher scheme */ 3425 /* currently FW supports only one optional cipher scheme */
3458 if (hw->n_cipher_schemes && 3426 if (hw->n_cipher_schemes &&
@@ -3540,12 +3508,17 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
3540 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, key_offset); 3508 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, key_offset);
3541 if (ret) { 3509 if (ret) {
3542 IWL_WARN(mvm, "set key failed\n"); 3510 IWL_WARN(mvm, "set key failed\n");
3511 key->hw_key_idx = STA_KEY_IDX_INVALID;
3543 /* 3512 /*
3544 * can't add key for RX, but we don't need it 3513 * can't add key for RX, but we don't need it
3545 * in the device for TX so still return 0 3514 * in the device for TX so still return 0,
3515 * unless we have new TX API where we cannot
3516 * put key material into the TX_CMD
3546 */ 3517 */
3547 key->hw_key_idx = STA_KEY_IDX_INVALID; 3518 if (iwl_mvm_has_new_tx_api(mvm))
3548 ret = 0; 3519 ret = -EOPNOTSUPP;
3520 else
3521 ret = 0;
3549 } 3522 }
3550 3523
3551 break; 3524 break;