aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/base.c
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2010-09-08 03:04:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-09-16 15:19:45 -0400
commite0f8c2a9b879e1e65d588a40a3c88db69a7d6956 (patch)
tree414c5fb35665de34c8d56015887d73b48f30501f /drivers/net/wireless/ath/ath5k/base.c
parent1bba5b7329e15555dab90071b24ca84d0afcc635 (diff)
ath5k: Use common ath key management functions
Use common ath key management functions in ath5k. This fixes problems with HW encryption in AP mode, which was broken in the ath5k implementation. Before (with the ath5k implementation) only one client could connect to the AP using HW encryption and WPA. When a second client connected, the first client was not able to send/receive any more packets. Because of the problems with HW encryption, software encryption was always used in AP mode, which resulted in a high CPU load (and/or low thruput) on embedded devices. Instead of trying to fix the implementation in ath5k it makes more sense to share the code with ath9k. This also enables HW encryption for AP mode again. Signed-off-by: Bruno Randolf <br1@einfach.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/base.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 45789c8990d3..7933646583a9 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -2570,6 +2570,7 @@ static int
2570ath5k_init(struct ath5k_softc *sc) 2570ath5k_init(struct ath5k_softc *sc)
2571{ 2571{
2572 struct ath5k_hw *ah = sc->ah; 2572 struct ath5k_hw *ah = sc->ah;
2573 struct ath_common *common = ath5k_hw_common(ah);
2573 int ret, i; 2574 int ret, i;
2574 2575
2575 mutex_lock(&sc->lock); 2576 mutex_lock(&sc->lock);
@@ -2605,8 +2606,8 @@ ath5k_init(struct ath5k_softc *sc)
2605 * Reset the key cache since some parts do not reset the 2606 * Reset the key cache since some parts do not reset the
2606 * contents on initial power up or resume from suspend. 2607 * contents on initial power up or resume from suspend.
2607 */ 2608 */
2608 for (i = 0; i < AR5K_KEYTABLE_SIZE; i++) 2609 for (i = 0; i < common->keymax; i++)
2609 ath5k_hw_reset_key(ah, i); 2610 ath_hw_keyreset(common, (u16)i);
2610 2611
2611 ath5k_hw_set_ack_bitrate_high(ah, true); 2612 ath5k_hw_set_ack_bitrate_high(ah, true);
2612 ret = 0; 2613 ret = 0;
@@ -3287,9 +3288,6 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3287 if (modparam_nohwcrypt) 3288 if (modparam_nohwcrypt)
3288 return -EOPNOTSUPP; 3289 return -EOPNOTSUPP;
3289 3290
3290 if (sc->opmode == NL80211_IFTYPE_AP)
3291 return -EOPNOTSUPP;
3292
3293 switch (key->cipher) { 3291 switch (key->cipher) {
3294 case WLAN_CIPHER_SUITE_WEP40: 3292 case WLAN_CIPHER_SUITE_WEP40:
3295 case WLAN_CIPHER_SUITE_WEP104: 3293 case WLAN_CIPHER_SUITE_WEP104:
@@ -3298,7 +3296,6 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3298 case WLAN_CIPHER_SUITE_CCMP: 3296 case WLAN_CIPHER_SUITE_CCMP:
3299 if (sc->ah->ah_aes_support) 3297 if (sc->ah->ah_aes_support)
3300 break; 3298 break;
3301
3302 return -EOPNOTSUPP; 3299 return -EOPNOTSUPP;
3303 default: 3300 default:
3304 WARN_ON(1); 3301 WARN_ON(1);
@@ -3309,27 +3306,25 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3309 3306
3310 switch (cmd) { 3307 switch (cmd) {
3311 case SET_KEY: 3308 case SET_KEY:
3312 ret = ath5k_hw_set_key(sc->ah, key->keyidx, key, 3309 ret = ath_key_config(common, vif, sta, key);
3313 sta ? sta->addr : NULL); 3310 if (ret >= 0) {
3314 if (ret) { 3311 key->hw_key_idx = ret;
3315 ATH5K_ERR(sc, "can't set the key\n"); 3312 /* push IV and Michael MIC generation to stack */
3316 goto unlock; 3313 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
3314 if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
3315 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
3316 if (key->cipher == WLAN_CIPHER_SUITE_CCMP)
3317 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
3318 ret = 0;
3317 } 3319 }
3318 __set_bit(key->keyidx, common->keymap);
3319 key->hw_key_idx = key->keyidx;
3320 key->flags |= (IEEE80211_KEY_FLAG_GENERATE_IV |
3321 IEEE80211_KEY_FLAG_GENERATE_MMIC);
3322 break; 3320 break;
3323 case DISABLE_KEY: 3321 case DISABLE_KEY:
3324 ath5k_hw_reset_key(sc->ah, key->keyidx); 3322 ath_key_delete(common, key);
3325 __clear_bit(key->keyidx, common->keymap);
3326 break; 3323 break;
3327 default: 3324 default:
3328 ret = -EINVAL; 3325 ret = -EINVAL;
3329 goto unlock;
3330 } 3326 }
3331 3327
3332unlock:
3333 mmiowb(); 3328 mmiowb();
3334 mutex_unlock(&sc->lock); 3329 mutex_unlock(&sc->lock);
3335 return ret; 3330 return ret;