aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/common.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-10 03:46:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-16 16:45:11 -0400
commit97359d1235eaf634fe706c9faa6e40181cc95fb8 (patch)
tree5799455c94622eaa6a4fb065bd3b5c350bb705e0 /drivers/net/wireless/ath/ath9k/common.c
parent915a824e30c503157c38115eb6a85f60bb653738 (diff)
mac80211: use cipher suite selectors
Currently, mac80211 translates the cfg80211 cipher suite selectors into ALG_* values. That isn't all too useful, and some drivers benefit from the distinction between WEP40 and WEP104 as well. Therefore, convert it all to use the cipher suite selectors. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/common.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index c86f7d3593ab..3100c87a4fcd 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -46,12 +46,17 @@ int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb)
46 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 46 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
47 47
48 if (tx_info->control.hw_key) { 48 if (tx_info->control.hw_key) {
49 if (tx_info->control.hw_key->alg == ALG_WEP) 49 switch (tx_info->control.hw_key->cipher) {
50 case WLAN_CIPHER_SUITE_WEP40:
51 case WLAN_CIPHER_SUITE_WEP104:
50 return ATH9K_KEY_TYPE_WEP; 52 return ATH9K_KEY_TYPE_WEP;
51 else if (tx_info->control.hw_key->alg == ALG_TKIP) 53 case WLAN_CIPHER_SUITE_TKIP:
52 return ATH9K_KEY_TYPE_TKIP; 54 return ATH9K_KEY_TYPE_TKIP;
53 else if (tx_info->control.hw_key->alg == ALG_CCMP) 55 case WLAN_CIPHER_SUITE_CCMP:
54 return ATH9K_KEY_TYPE_AES; 56 return ATH9K_KEY_TYPE_AES;
57 default:
58 break;
59 }
55 } 60 }
56 61
57 return ATH9K_KEY_TYPE_CLEAR; 62 return ATH9K_KEY_TYPE_CLEAR;
@@ -212,11 +217,11 @@ static int ath_reserve_key_cache_slot_tkip(struct ath_common *common)
212} 217}
213 218
214static int ath_reserve_key_cache_slot(struct ath_common *common, 219static int ath_reserve_key_cache_slot(struct ath_common *common,
215 enum ieee80211_key_alg alg) 220 u32 cipher)
216{ 221{
217 int i; 222 int i;
218 223
219 if (alg == ALG_TKIP) 224 if (cipher == WLAN_CIPHER_SUITE_TKIP)
220 return ath_reserve_key_cache_slot_tkip(common); 225 return ath_reserve_key_cache_slot_tkip(common);
221 226
222 /* First, try to find slots that would not be available for TKIP. */ 227 /* First, try to find slots that would not be available for TKIP. */
@@ -293,14 +298,15 @@ int ath9k_cmn_key_config(struct ath_common *common,
293 298
294 memset(&hk, 0, sizeof(hk)); 299 memset(&hk, 0, sizeof(hk));
295 300
296 switch (key->alg) { 301 switch (key->cipher) {
297 case ALG_WEP: 302 case WLAN_CIPHER_SUITE_WEP40:
303 case WLAN_CIPHER_SUITE_WEP104:
298 hk.kv_type = ATH9K_CIPHER_WEP; 304 hk.kv_type = ATH9K_CIPHER_WEP;
299 break; 305 break;
300 case ALG_TKIP: 306 case WLAN_CIPHER_SUITE_TKIP:
301 hk.kv_type = ATH9K_CIPHER_TKIP; 307 hk.kv_type = ATH9K_CIPHER_TKIP;
302 break; 308 break;
303 case ALG_CCMP: 309 case WLAN_CIPHER_SUITE_CCMP:
304 hk.kv_type = ATH9K_CIPHER_AES_CCM; 310 hk.kv_type = ATH9K_CIPHER_AES_CCM;
305 break; 311 break;
306 default: 312 default:
@@ -316,7 +322,7 @@ int ath9k_cmn_key_config(struct ath_common *common,
316 memcpy(gmac, vif->addr, ETH_ALEN); 322 memcpy(gmac, vif->addr, ETH_ALEN);
317 gmac[0] |= 0x01; 323 gmac[0] |= 0x01;
318 mac = gmac; 324 mac = gmac;
319 idx = ath_reserve_key_cache_slot(common, key->alg); 325 idx = ath_reserve_key_cache_slot(common, key->cipher);
320 break; 326 break;
321 case NL80211_IFTYPE_ADHOC: 327 case NL80211_IFTYPE_ADHOC:
322 if (!sta) { 328 if (!sta) {
@@ -326,7 +332,7 @@ int ath9k_cmn_key_config(struct ath_common *common,
326 memcpy(gmac, sta->addr, ETH_ALEN); 332 memcpy(gmac, sta->addr, ETH_ALEN);
327 gmac[0] |= 0x01; 333 gmac[0] |= 0x01;
328 mac = gmac; 334 mac = gmac;
329 idx = ath_reserve_key_cache_slot(common, key->alg); 335 idx = ath_reserve_key_cache_slot(common, key->cipher);
330 break; 336 break;
331 default: 337 default:
332 idx = key->keyidx; 338 idx = key->keyidx;
@@ -348,13 +354,13 @@ int ath9k_cmn_key_config(struct ath_common *common,
348 return -EOPNOTSUPP; 354 return -EOPNOTSUPP;
349 mac = sta->addr; 355 mac = sta->addr;
350 356
351 idx = ath_reserve_key_cache_slot(common, key->alg); 357 idx = ath_reserve_key_cache_slot(common, key->cipher);
352 } 358 }
353 359
354 if (idx < 0) 360 if (idx < 0)
355 return -ENOSPC; /* no free key cache entries */ 361 return -ENOSPC; /* no free key cache entries */
356 362
357 if (key->alg == ALG_TKIP) 363 if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
358 ret = ath_setkey_tkip(common, idx, key->key, &hk, mac, 364 ret = ath_setkey_tkip(common, idx, key->key, &hk, mac,
359 vif->type == NL80211_IFTYPE_AP); 365 vif->type == NL80211_IFTYPE_AP);
360 else 366 else
@@ -364,7 +370,7 @@ int ath9k_cmn_key_config(struct ath_common *common,
364 return -EIO; 370 return -EIO;
365 371
366 set_bit(idx, common->keymap); 372 set_bit(idx, common->keymap);
367 if (key->alg == ALG_TKIP) { 373 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
368 set_bit(idx + 64, common->keymap); 374 set_bit(idx + 64, common->keymap);
369 if (common->splitmic) { 375 if (common->splitmic) {
370 set_bit(idx + 32, common->keymap); 376 set_bit(idx + 32, common->keymap);
@@ -389,7 +395,7 @@ void ath9k_cmn_key_delete(struct ath_common *common,
389 return; 395 return;
390 396
391 clear_bit(key->hw_key_idx, common->keymap); 397 clear_bit(key->hw_key_idx, common->keymap);
392 if (key->alg != ALG_TKIP) 398 if (key->cipher != WLAN_CIPHER_SUITE_TKIP)
393 return; 399 return;
394 400
395 clear_bit(key->hw_key_idx + 64, common->keymap); 401 clear_bit(key->hw_key_idx + 64, common->keymap);