Lines Matching refs:common
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));
42 bool ath_hw_keyreset(struct ath_common *common, u16 entry) in ath_hw_keyreset() argument
45 void *ah = common->ah; in ath_hw_keyreset()
47 if (entry >= common->keymax) { in ath_hw_keyreset()
48 ath_err(common, "keyreset: keycache entry %u out of range\n", in ath_hw_keyreset()
73 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { in ath_hw_keyreset()
87 bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac) in ath_hw_keysetmac() argument
91 void *ah = common->ah; in ath_hw_keysetmac()
93 if (entry >= common->keymax) { in ath_hw_keysetmac()
94 ath_err(common, "keysetmac: keycache entry %u out of range\n", in ath_hw_keysetmac()
129 static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, in ath_hw_set_keycache_entry() argument
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()
148 if (!(common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)) { in ath_hw_set_keycache_entry()
149 ath_dbg(common, ANY, in ath_hw_set_keycache_entry()
157 if (entry + 64 >= common->keymax) { in ath_hw_set_keycache_entry()
158 ath_dbg(common, ANY, in ath_hw_set_keycache_entry()
165 ath_dbg(common, ANY, "WEP key length %u too small\n", in ath_hw_set_keycache_entry()
180 ath_err(common, "cipher %u not supported\n", k->kv_type); in ath_hw_set_keycache_entry()
220 (void) ath_hw_keysetmac(common, entry, mac); in ath_hw_set_keycache_entry()
222 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { in ath_hw_set_keycache_entry()
333 (void) ath_hw_keysetmac(common, entry, mac); in ath_hw_set_keycache_entry()
339 static int ath_setkey_tkip(struct ath_common *common, u16 keyix, const u8 *key, in ath_setkey_tkip() argument
362 return ath_hw_set_keycache_entry(common, keyix, hk, addr); in ath_setkey_tkip()
364 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) { in ath_setkey_tkip()
368 return ath_hw_set_keycache_entry(common, keyix, hk, addr); in ath_setkey_tkip()
375 if (!ath_hw_set_keycache_entry(common, keyix, hk, NULL)) { in ath_setkey_tkip()
377 ath_err(common, "Setting TX MIC Key Failed\n"); in ath_setkey_tkip()
383 return ath_hw_set_keycache_entry(common, keyix + 32, hk, addr); in ath_setkey_tkip()
386 static int ath_reserve_key_cache_slot_tkip(struct ath_common *common) in ath_reserve_key_cache_slot_tkip() argument
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()
405 static int ath_reserve_key_cache_slot(struct ath_common *common, in ath_reserve_key_cache_slot() argument
411 return ath_reserve_key_cache_slot_tkip(common); in ath_reserve_key_cache_slot()
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()
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()
473 int ath_key_config(struct ath_common *common, in ath_key_config() argument
514 idx = ath_reserve_key_cache_slot(common, key->cipher); in ath_key_config()
524 idx = ath_reserve_key_cache_slot(common, key->cipher); in ath_key_config()
546 idx = ath_reserve_key_cache_slot(common, key->cipher); in ath_key_config()
553 ret = ath_setkey_tkip(common, idx, key->key, &hk, mac, in ath_key_config()
556 ret = ath_hw_set_keycache_entry(common, idx, &hk, mac); in ath_key_config()
561 set_bit(idx, common->keymap); in ath_key_config()
563 set_bit(idx, common->ccmp_keymap); 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()
584 void ath_key_delete(struct ath_common *common, u8 hw_key_idx) in ath_key_delete() argument
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()
593 ath_hw_keysetmac(common, hw_key_idx, NULL); in ath_key_delete()
595 ath_hw_keyreset(common, hw_key_idx); 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()
610 ath_hw_keyreset(common, hw_key_idx + 32); 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()