diff options
author | Bruno Randolf <br1@einfach.org> | 2010-09-08 03:04:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-09-16 15:19:45 -0400 |
commit | 117675d06ad2dd16fcf466669ba9700a8d589ea3 (patch) | |
tree | b8239f2eea26890607b3adfe5115022573a59c32 | |
parent | d8878f83cf1cc0061e8b3bcf7dbd589410a51039 (diff) |
ath/ath9k: Replace common->splitmic with a flag
Replace common->splitmic with ATH_CRYPT_CAP_MIC_COMBINED flag.
splitmic has to be used when the ATH_CRYPT_CAP_MIC_COMBINED capability flag is
not set.
Signed-off-by: Bruno Randolf <br1@einfach.org>
Acked-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/common.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/key.c | 14 |
4 files changed, 16 insertions, 16 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index fb24f66373fd..c5584077d1de 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -78,6 +78,7 @@ enum ath_crypt_caps { | |||
78 | ATH_CRYPT_CAP_CIPHER_AESCCM = BIT(3), | 78 | ATH_CRYPT_CAP_CIPHER_AESCCM = BIT(3), |
79 | ATH_CRYPT_CAP_CIPHER_CKIP = BIT(4), | 79 | ATH_CRYPT_CAP_CIPHER_CKIP = BIT(4), |
80 | ATH_CRYPT_CAP_CIPHER_TKIP = BIT(5), | 80 | ATH_CRYPT_CAP_CIPHER_TKIP = BIT(5), |
81 | ATH_CRYPT_CAP_MIC_COMBINED = BIT(6), | ||
81 | }; | 82 | }; |
82 | 83 | ||
83 | struct ath_keyval { | 84 | struct ath_keyval { |
@@ -150,7 +151,6 @@ struct ath_common { | |||
150 | u32 keymax; | 151 | u32 keymax; |
151 | DECLARE_BITMAP(keymap, ATH_KEYMAX); | 152 | DECLARE_BITMAP(keymap, ATH_KEYMAX); |
152 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); | 153 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); |
153 | u8 splitmic; | ||
154 | enum ath_crypt_caps crypt_caps; | 154 | enum ath_crypt_caps crypt_caps; |
155 | 155 | ||
156 | struct ath_regulatory regulatory; | 156 | struct ath_regulatory regulatory; |
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index 2dab64bb23a8..2db24eb5f0ee 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
@@ -174,7 +174,7 @@ static int ath_setkey_tkip(struct ath_common *common, u16 keyix, const u8 *key, | |||
174 | } | 174 | } |
175 | return ath9k_hw_set_keycache_entry(ah, keyix, hk, addr); | 175 | return ath9k_hw_set_keycache_entry(ah, keyix, hk, addr); |
176 | } | 176 | } |
177 | if (!common->splitmic) { | 177 | if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { |
178 | /* TX and RX keys share the same key cache entry. */ | 178 | /* TX and RX keys share the same key cache entry. */ |
179 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); | 179 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); |
180 | memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_txmic)); | 180 | memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_txmic)); |
@@ -205,7 +205,7 @@ static int ath_reserve_key_cache_slot_tkip(struct ath_common *common) | |||
205 | if (test_bit(i, common->keymap) || | 205 | if (test_bit(i, common->keymap) || |
206 | test_bit(i + 64, common->keymap)) | 206 | test_bit(i + 64, common->keymap)) |
207 | continue; /* At least one part of TKIP key allocated */ | 207 | continue; /* At least one part of TKIP key allocated */ |
208 | if (common->splitmic && | 208 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) && |
209 | (test_bit(i + 32, common->keymap) || | 209 | (test_bit(i + 32, common->keymap) || |
210 | test_bit(i + 64 + 32, common->keymap))) | 210 | test_bit(i + 64 + 32, common->keymap))) |
211 | continue; /* At least one part of TKIP key allocated */ | 211 | continue; /* At least one part of TKIP key allocated */ |
@@ -225,7 +225,7 @@ static int ath_reserve_key_cache_slot(struct ath_common *common, | |||
225 | return ath_reserve_key_cache_slot_tkip(common); | 225 | return ath_reserve_key_cache_slot_tkip(common); |
226 | 226 | ||
227 | /* 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. */ |
228 | if (common->splitmic) { | 228 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { |
229 | for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) { | 229 | for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) { |
230 | if (!test_bit(i, common->keymap) && | 230 | if (!test_bit(i, common->keymap) && |
231 | (test_bit(i + 32, common->keymap) || | 231 | (test_bit(i + 32, common->keymap) || |
@@ -266,7 +266,7 @@ static int ath_reserve_key_cache_slot(struct ath_common *common, | |||
266 | * TKIP will not be used. */ | 266 | * TKIP will not be used. */ |
267 | if (i >= 64 && i < 64 + IEEE80211_WEP_NKID) | 267 | if (i >= 64 && i < 64 + IEEE80211_WEP_NKID) |
268 | continue; | 268 | continue; |
269 | if (common->splitmic) { | 269 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { |
270 | if (i >= 32 && i < 32 + IEEE80211_WEP_NKID) | 270 | if (i >= 32 && i < 32 + IEEE80211_WEP_NKID) |
271 | continue; | 271 | continue; |
272 | if (i >= 64 + 32 && i < 64 + 32 + IEEE80211_WEP_NKID) | 272 | if (i >= 64 + 32 && i < 64 + 32 + IEEE80211_WEP_NKID) |
@@ -374,7 +374,7 @@ int ath9k_cmn_key_config(struct ath_common *common, | |||
374 | set_bit(idx + 64, common->keymap); | 374 | set_bit(idx + 64, common->keymap); |
375 | set_bit(idx, common->tkip_keymap); | 375 | set_bit(idx, common->tkip_keymap); |
376 | set_bit(idx + 64, common->tkip_keymap); | 376 | set_bit(idx + 64, common->tkip_keymap); |
377 | if (common->splitmic) { | 377 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { |
378 | set_bit(idx + 32, common->keymap); | 378 | set_bit(idx + 32, common->keymap); |
379 | set_bit(idx + 64 + 32, common->keymap); | 379 | set_bit(idx + 64 + 32, common->keymap); |
380 | set_bit(idx + 32, common->tkip_keymap); | 380 | set_bit(idx + 32, common->tkip_keymap); |
@@ -407,7 +407,7 @@ void ath9k_cmn_key_delete(struct ath_common *common, | |||
407 | clear_bit(key->hw_key_idx, common->tkip_keymap); | 407 | clear_bit(key->hw_key_idx, common->tkip_keymap); |
408 | clear_bit(key->hw_key_idx + 64, common->tkip_keymap); | 408 | clear_bit(key->hw_key_idx + 64, common->tkip_keymap); |
409 | 409 | ||
410 | if (common->splitmic) { | 410 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { |
411 | ath9k_hw_keyreset(ah, key->hw_key_idx + 32); | 411 | ath9k_hw_keyreset(ah, key->hw_key_idx + 32); |
412 | clear_bit(key->hw_key_idx + 32, common->keymap); | 412 | clear_bit(key->hw_key_idx + 32, common->keymap); |
413 | clear_bit(key->hw_key_idx + 64 + 32, common->keymap); | 413 | clear_bit(key->hw_key_idx + 64 + 32, common->keymap); |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 5c77a9913e03..fd651d8ef816 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -389,8 +389,8 @@ static void ath9k_init_crypto(struct ath_softc *sc) | |||
389 | * With split mic keys the number of stations is limited | 389 | * With split mic keys the number of stations is limited |
390 | * to 27 otherwise 59. | 390 | * to 27 otherwise 59. |
391 | */ | 391 | */ |
392 | if (!(sc->sc_ah->misc_mode & AR_PCU_MIC_NEW_LOC_ENA)) | 392 | if (sc->sc_ah->misc_mode & AR_PCU_MIC_NEW_LOC_ENA) |
393 | common->splitmic = 1; | 393 | common->crypt_caps |= ATH_CRYPT_CAP_MIC_COMBINED; |
394 | } | 394 | } |
395 | 395 | ||
396 | static int ath9k_init_btcoex(struct ath_softc *sc) | 396 | static int ath9k_init_btcoex(struct ath_softc *sc) |
diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c index e45b8546810a..bd21a4d82085 100644 --- a/drivers/net/wireless/ath/key.c +++ b/drivers/net/wireless/ath/key.c | |||
@@ -201,7 +201,7 @@ bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, | |||
201 | /* Write MAC address for the entry */ | 201 | /* Write MAC address for the entry */ |
202 | (void) ath_hw_keysetmac(common, entry, mac); | 202 | (void) ath_hw_keysetmac(common, entry, mac); |
203 | 203 | ||
204 | if (common->splitmic == 0) { | 204 | if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { |
205 | /* | 205 | /* |
206 | * TKIP uses two key cache entries: | 206 | * TKIP uses two key cache entries: |
207 | * Michael MIC TX/RX keys in the same key cache entry | 207 | * Michael MIC TX/RX keys in the same key cache entry |
@@ -327,7 +327,7 @@ static int ath_setkey_tkip(struct ath_common *common, u16 keyix, const u8 *key, | |||
327 | } | 327 | } |
328 | return ath_hw_set_keycache_entry(common, keyix, hk, addr); | 328 | return ath_hw_set_keycache_entry(common, keyix, hk, addr); |
329 | } | 329 | } |
330 | if (!common->splitmic) { | 330 | if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { |
331 | /* TX and RX keys share the same key cache entry. */ | 331 | /* TX and RX keys share the same key cache entry. */ |
332 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); | 332 | memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); |
333 | memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_txmic)); | 333 | memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_txmic)); |
@@ -358,7 +358,7 @@ static int ath_reserve_key_cache_slot_tkip(struct ath_common *common) | |||
358 | if (test_bit(i, common->keymap) || | 358 | if (test_bit(i, common->keymap) || |
359 | test_bit(i + 64, common->keymap)) | 359 | test_bit(i + 64, common->keymap)) |
360 | continue; /* At least one part of TKIP key allocated */ | 360 | continue; /* At least one part of TKIP key allocated */ |
361 | if (common->splitmic && | 361 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) && |
362 | (test_bit(i + 32, common->keymap) || | 362 | (test_bit(i + 32, common->keymap) || |
363 | test_bit(i + 64 + 32, common->keymap))) | 363 | test_bit(i + 64 + 32, common->keymap))) |
364 | continue; /* At least one part of TKIP key allocated */ | 364 | continue; /* At least one part of TKIP key allocated */ |
@@ -378,7 +378,7 @@ static int ath_reserve_key_cache_slot(struct ath_common *common, | |||
378 | return ath_reserve_key_cache_slot_tkip(common); | 378 | return ath_reserve_key_cache_slot_tkip(common); |
379 | 379 | ||
380 | /* First, try to find slots that would not be available for TKIP. */ | 380 | /* First, try to find slots that would not be available for TKIP. */ |
381 | if (common->splitmic) { | 381 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { |
382 | for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) { | 382 | for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) { |
383 | if (!test_bit(i, common->keymap) && | 383 | if (!test_bit(i, common->keymap) && |
384 | (test_bit(i + 32, common->keymap) || | 384 | (test_bit(i + 32, common->keymap) || |
@@ -419,7 +419,7 @@ static int ath_reserve_key_cache_slot(struct ath_common *common, | |||
419 | * TKIP will not be used. */ | 419 | * TKIP will not be used. */ |
420 | if (i >= 64 && i < 64 + IEEE80211_WEP_NKID) | 420 | if (i >= 64 && i < 64 + IEEE80211_WEP_NKID) |
421 | continue; | 421 | continue; |
422 | if (common->splitmic) { | 422 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { |
423 | if (i >= 32 && i < 32 + IEEE80211_WEP_NKID) | 423 | if (i >= 32 && i < 32 + IEEE80211_WEP_NKID) |
424 | continue; | 424 | continue; |
425 | if (i >= 64 + 32 && i < 64 + 32 + IEEE80211_WEP_NKID) | 425 | if (i >= 64 + 32 && i < 64 + 32 + IEEE80211_WEP_NKID) |
@@ -526,7 +526,7 @@ int ath_key_config(struct ath_common *common, | |||
526 | set_bit(idx + 64, common->keymap); | 526 | set_bit(idx + 64, common->keymap); |
527 | set_bit(idx, common->tkip_keymap); | 527 | set_bit(idx, common->tkip_keymap); |
528 | set_bit(idx + 64, common->tkip_keymap); | 528 | set_bit(idx + 64, common->tkip_keymap); |
529 | if (common->splitmic) { | 529 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { |
530 | set_bit(idx + 32, common->keymap); | 530 | set_bit(idx + 32, common->keymap); |
531 | set_bit(idx + 64 + 32, common->keymap); | 531 | set_bit(idx + 64 + 32, common->keymap); |
532 | set_bit(idx + 32, common->tkip_keymap); | 532 | set_bit(idx + 32, common->tkip_keymap); |
@@ -556,7 +556,7 @@ void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key) | |||
556 | clear_bit(key->hw_key_idx, common->tkip_keymap); | 556 | clear_bit(key->hw_key_idx, common->tkip_keymap); |
557 | clear_bit(key->hw_key_idx + 64, common->tkip_keymap); | 557 | clear_bit(key->hw_key_idx + 64, common->tkip_keymap); |
558 | 558 | ||
559 | if (common->splitmic) { | 559 | if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { |
560 | ath_hw_keyreset(common, key->hw_key_idx + 32); | 560 | ath_hw_keyreset(common, key->hw_key_idx + 32); |
561 | clear_bit(key->hw_key_idx + 32, common->keymap); | 561 | clear_bit(key->hw_key_idx + 32, common->keymap); |
562 | clear_bit(key->hw_key_idx + 64 + 32, common->keymap); | 562 | clear_bit(key->hw_key_idx + 64 + 32, common->keymap); |