Lines Matching +full:no +full:- +full:unaligned +full:- +full:direct +full:- +full:access
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 #include <asm/unaligned.h>
25 #define REG_READ (common->ops->read)
26 #define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg)
28 if (common->ops->enable_write_buffer) \
29 common->ops->enable_write_buffer((_ah));
32 if (common->ops->write_flush) \
33 common->ops->write_flush((_ah));
45 void *ah = common->ah; in ath_hw_keyreset()
47 if (entry >= common->keymax) { in ath_hw_keyreset()
73 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { in ath_hw_keyreset()
91 void *ah = common->ah; in ath_hw_keysetmac()
93 if (entry >= common->keymax) { in ath_hw_keysetmac()
133 void *ah = common->ah; in ath_hw_set_keycache_entry()
137 if (entry >= common->keymax) { in ath_hw_set_keycache_entry()
138 ath_err(common, "set-entry: keycache entry %u out of range\n", in ath_hw_set_keycache_entry()
143 switch (k->kv_type) { in ath_hw_set_keycache_entry()
148 if (!(common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)) { in ath_hw_set_keycache_entry()
150 "AES-CCM not supported by this mac rev\n"); in ath_hw_set_keycache_entry()
157 if (entry + 64 >= common->keymax) { in ath_hw_set_keycache_entry()
164 if (k->kv_len < WLAN_KEY_LEN_WEP40) { in ath_hw_set_keycache_entry()
166 k->kv_len); in ath_hw_set_keycache_entry()
169 if (k->kv_len <= WLAN_KEY_LEN_WEP40) in ath_hw_set_keycache_entry()
171 else if (k->kv_len <= WLAN_KEY_LEN_WEP104) in ath_hw_set_keycache_entry()
180 ath_err(common, "cipher %u not supported\n", k->kv_type); in ath_hw_set_keycache_entry()
184 key0 = get_unaligned_le32(k->kv_val + 0); in ath_hw_set_keycache_entry()
185 key1 = get_unaligned_le16(k->kv_val + 4); in ath_hw_set_keycache_entry()
186 key2 = get_unaligned_le32(k->kv_val + 6); in ath_hw_set_keycache_entry()
187 key3 = get_unaligned_le16(k->kv_val + 10); in ath_hw_set_keycache_entry()
188 key4 = get_unaligned_le32(k->kv_val + 12); in ath_hw_set_keycache_entry()
189 if (k->kv_len <= WLAN_KEY_LEN_WEP104) in ath_hw_set_keycache_entry()
193 * Note: Key cache registers access special memory area that requires in ath_hw_set_keycache_entry()
194 * two 32-bit writes to actually update the values in the internal in ath_hw_set_keycache_entry()
222 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { in ath_hw_set_keycache_entry()
237 mic0 = get_unaligned_le32(k->kv_mic + 0); in ath_hw_set_keycache_entry()
238 mic2 = get_unaligned_le32(k->kv_mic + 4); in ath_hw_set_keycache_entry()
239 mic1 = get_unaligned_le16(k->kv_txmic + 2) & 0xffff; in ath_hw_set_keycache_entry()
240 mic3 = get_unaligned_le16(k->kv_txmic + 0) & 0xffff; in ath_hw_set_keycache_entry()
241 mic4 = get_unaligned_le32(k->kv_txmic + 4); in ath_hw_set_keycache_entry()
279 mic0 = get_unaligned_le32(k->kv_mic + 0); in ath_hw_set_keycache_entry()
280 mic2 = get_unaligned_le32(k->kv_mic + 4); in ath_hw_set_keycache_entry()
307 * Write the correct (un-inverted) key[47:0] last to enable in ath_hw_set_keycache_entry()
351 * Group key installation - only two key cache entries are used in ath_setkey_tkip()
356 memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); in ath_setkey_tkip()
357 memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_mic)); in ath_setkey_tkip()
359 memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); in ath_setkey_tkip()
360 memcpy(hk->kv_txmic, key_rxmic, sizeof(hk->kv_mic)); in ath_setkey_tkip()
364 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { in ath_setkey_tkip()
366 memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); in ath_setkey_tkip()
367 memcpy(hk->kv_txmic, key_txmic, sizeof(hk->kv_txmic)); in ath_setkey_tkip()
374 memcpy(hk->kv_mic, key_txmic, sizeof(hk->kv_mic)); in ath_setkey_tkip()
376 /* TX MIC entry failed. No need to proceed further */ in ath_setkey_tkip()
381 memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic)); in ath_setkey_tkip()
390 for (i = IEEE80211_WEP_NKID; i < common->keymax / 2; i++) { in ath_reserve_key_cache_slot_tkip()
391 if (test_bit(i, common->keymap) || in ath_reserve_key_cache_slot_tkip()
392 test_bit(i + 64, common->keymap)) in ath_reserve_key_cache_slot_tkip()
394 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) && in ath_reserve_key_cache_slot_tkip()
395 (test_bit(i + 32, common->keymap) || in ath_reserve_key_cache_slot_tkip()
396 test_bit(i + 64 + 32, common->keymap))) in ath_reserve_key_cache_slot_tkip()
402 return -1; in ath_reserve_key_cache_slot_tkip()
414 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { in ath_reserve_key_cache_slot()
415 for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) { in ath_reserve_key_cache_slot()
416 if (!test_bit(i, common->keymap) && in ath_reserve_key_cache_slot()
417 (test_bit(i + 32, common->keymap) || in ath_reserve_key_cache_slot()
418 test_bit(i + 64, common->keymap) || in ath_reserve_key_cache_slot()
419 test_bit(i + 64 + 32, common->keymap))) in ath_reserve_key_cache_slot()
421 if (!test_bit(i + 32, common->keymap) && in ath_reserve_key_cache_slot()
422 (test_bit(i, common->keymap) || in ath_reserve_key_cache_slot()
423 test_bit(i + 64, common->keymap) || in ath_reserve_key_cache_slot()
424 test_bit(i + 64 + 32, common->keymap))) in ath_reserve_key_cache_slot()
426 if (!test_bit(i + 64, common->keymap) && in ath_reserve_key_cache_slot()
427 (test_bit(i , common->keymap) || in ath_reserve_key_cache_slot()
428 test_bit(i + 32, common->keymap) || in ath_reserve_key_cache_slot()
429 test_bit(i + 64 + 32, common->keymap))) in ath_reserve_key_cache_slot()
431 if (!test_bit(i + 64 + 32, common->keymap) && in ath_reserve_key_cache_slot()
432 (test_bit(i, common->keymap) || in ath_reserve_key_cache_slot()
433 test_bit(i + 32, common->keymap) || in ath_reserve_key_cache_slot()
434 test_bit(i + 64, common->keymap))) in ath_reserve_key_cache_slot()
438 for (i = IEEE80211_WEP_NKID; i < common->keymax / 2; i++) { in ath_reserve_key_cache_slot()
439 if (!test_bit(i, common->keymap) && in ath_reserve_key_cache_slot()
440 test_bit(i + 64, common->keymap)) in ath_reserve_key_cache_slot()
442 if (test_bit(i, common->keymap) && in ath_reserve_key_cache_slot()
443 !test_bit(i + 64, common->keymap)) in ath_reserve_key_cache_slot()
448 /* No partially used TKIP slots, pick any available slot */ in ath_reserve_key_cache_slot()
449 for (i = IEEE80211_WEP_NKID; i < common->keymax; i++) { in ath_reserve_key_cache_slot()
455 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { in ath_reserve_key_cache_slot()
462 if (!test_bit(i, common->keymap)) in ath_reserve_key_cache_slot()
466 /* No free slot found */ in ath_reserve_key_cache_slot()
467 return -1; in ath_reserve_key_cache_slot()
486 switch (key->cipher) { in ath_key_config()
501 return -EOPNOTSUPP; in ath_key_config()
504 hk.kv_len = key->keylen; in ath_key_config()
505 if (key->keylen) in ath_key_config()
506 memcpy(hk.kv_val, key->key, key->keylen); in ath_key_config()
508 if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) { in ath_key_config()
509 switch (vif->type) { in ath_key_config()
511 memcpy(gmac, vif->addr, ETH_ALEN); in ath_key_config()
514 idx = ath_reserve_key_cache_slot(common, key->cipher); in ath_key_config()
518 idx = key->keyidx; in ath_key_config()
521 memcpy(gmac, sta->addr, ETH_ALEN); in ath_key_config()
524 idx = ath_reserve_key_cache_slot(common, key->cipher); in ath_key_config()
527 idx = key->keyidx; in ath_key_config()
530 } else if (key->keyidx) { in ath_key_config()
532 return -EOPNOTSUPP; in ath_key_config()
533 mac = sta->addr; in ath_key_config()
535 if (vif->type != NL80211_IFTYPE_AP) { in ath_key_config()
538 idx = key->keyidx; in ath_key_config()
540 return -EIO; in ath_key_config()
543 return -EOPNOTSUPP; in ath_key_config()
544 mac = sta->addr; in ath_key_config()
546 idx = ath_reserve_key_cache_slot(common, key->cipher); in ath_key_config()
550 return -ENOSPC; /* no free key cache entries */ in ath_key_config()
552 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) in ath_key_config()
553 ret = ath_setkey_tkip(common, idx, key->key, &hk, mac, in ath_key_config()
554 vif->type == NL80211_IFTYPE_AP); in ath_key_config()
559 return -EIO; in ath_key_config()
561 set_bit(idx, common->keymap); in ath_key_config()
562 if (key->cipher == WLAN_CIPHER_SUITE_CCMP) in ath_key_config()
563 set_bit(idx, common->ccmp_keymap); in ath_key_config()
565 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { in ath_key_config()
566 set_bit(idx + 64, common->keymap); in ath_key_config()
567 set_bit(idx, common->tkip_keymap); in ath_key_config()
568 set_bit(idx + 64, common->tkip_keymap); in ath_key_config()
569 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { in ath_key_config()
570 set_bit(idx + 32, common->keymap); in ath_key_config()
571 set_bit(idx + 64 + 32, common->keymap); in ath_key_config()
572 set_bit(idx + 32, common->tkip_keymap); in ath_key_config()
573 set_bit(idx + 64 + 32, common->tkip_keymap); in ath_key_config()
591 if (test_bit(hw_key_idx, common->ccmp_keymap) || in ath_key_delete()
592 test_bit(hw_key_idx, common->tkip_keymap)) in ath_key_delete()
599 clear_bit(hw_key_idx, common->keymap); in ath_key_delete()
600 clear_bit(hw_key_idx, common->ccmp_keymap); in ath_key_delete()
601 if (!test_bit(hw_key_idx, common->tkip_keymap)) in ath_key_delete()
604 clear_bit(hw_key_idx + 64, common->keymap); in ath_key_delete()
606 clear_bit(hw_key_idx, common->tkip_keymap); in ath_key_delete()
607 clear_bit(hw_key_idx + 64, common->tkip_keymap); in ath_key_delete()
609 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { in ath_key_delete()
611 clear_bit(hw_key_idx + 32, common->keymap); in ath_key_delete()
612 clear_bit(hw_key_idx + 64 + 32, common->keymap); in ath_key_delete()
614 clear_bit(hw_key_idx + 32, common->tkip_keymap); in ath_key_delete()
615 clear_bit(hw_key_idx + 64 + 32, common->tkip_keymap); in ath_key_delete()