Lines Matching defs: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)
45 void *ah = common->ah;
47 if (entry >= common->keymax) {
48 ath_err(common, "keyreset: keycache entry %u out of range\n",
73 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) {
87 bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac)
91 void *ah = common->ah;
93 if (entry >= common->keymax) {
94 ath_err(common, "keysetmac: keycache entry %u out of range\n",
129 static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
133 void *ah = common->ah;
137 if (entry >= common->keymax) {
138 ath_err(common, "set-entry: keycache entry %u out of range\n",
148 if (!(common->crypt_caps & ATH_CRYPT_CAP_CIPHER_AESCCM)) {
149 ath_dbg(common, ANY,
157 if (entry + 64 >= common->keymax) {
158 ath_dbg(common, ANY,
165 ath_dbg(common, ANY, "WEP key length %u too small\n",
180 ath_err(common, "cipher %u not supported\n", k->kv_type);
220 (void) ath_hw_keysetmac(common, entry, mac);
222 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) {
333 (void) ath_hw_keysetmac(common, entry, mac);
339 static int ath_setkey_tkip(struct ath_common *common, u16 keyix, const u8 *key,
362 return ath_hw_set_keycache_entry(common, keyix, hk, addr);
364 if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) {
368 return ath_hw_set_keycache_entry(common, keyix, hk, addr);
375 if (!ath_hw_set_keycache_entry(common, keyix, hk, NULL)) {
377 ath_err(common, "Setting TX MIC Key Failed\n");
383 return ath_hw_set_keycache_entry(common, keyix + 32, hk, addr);
386 static int ath_reserve_key_cache_slot_tkip(struct ath_common *common)
390 for (i = IEEE80211_WEP_NKID; i < common->keymax / 2; i++) {
391 if (test_bit(i, common->keymap) ||
392 test_bit(i + 64, common->keymap))
394 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) &&
395 (test_bit(i + 32, common->keymap) ||
396 test_bit(i + 64 + 32, common->keymap)))
405 static int ath_reserve_key_cache_slot(struct ath_common *common,
411 return ath_reserve_key_cache_slot_tkip(common);
414 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) {
415 for (i = IEEE80211_WEP_NKID; i < common->keymax / 4; i++) {
416 if (!test_bit(i, common->keymap) &&
417 (test_bit(i + 32, common->keymap) ||
418 test_bit(i + 64, common->keymap) ||
419 test_bit(i + 64 + 32, common->keymap)))
421 if (!test_bit(i + 32, common->keymap) &&
422 (test_bit(i, common->keymap) ||
423 test_bit(i + 64, common->keymap) ||
424 test_bit(i + 64 + 32, common->keymap)))
426 if (!test_bit(i + 64, common->keymap) &&
427 (test_bit(i , common->keymap) ||
428 test_bit(i + 32, common->keymap) ||
429 test_bit(i + 64 + 32, common->keymap)))
431 if (!test_bit(i + 64 + 32, common->keymap) &&
432 (test_bit(i, common->keymap) ||
433 test_bit(i + 32, common->keymap) ||
434 test_bit(i + 64, common->keymap)))
438 for (i = IEEE80211_WEP_NKID; i < common->keymax / 2; i++) {
439 if (!test_bit(i, common->keymap) &&
440 test_bit(i + 64, common->keymap))
442 if (test_bit(i, common->keymap) &&
443 !test_bit(i + 64, common->keymap))
449 for (i = IEEE80211_WEP_NKID; i < common->keymax; i++) {
455 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) {
462 if (!test_bit(i, common->keymap))
473 int ath_key_config(struct ath_common *common,
514 idx = ath_reserve_key_cache_slot(common, key->cipher);
524 idx = ath_reserve_key_cache_slot(common, key->cipher);
546 idx = ath_reserve_key_cache_slot(common, key->cipher);
553 ret = ath_setkey_tkip(common, idx, key->key, &hk, mac,
556 ret = ath_hw_set_keycache_entry(common, idx, &hk, mac);
561 set_bit(idx, common->keymap);
563 set_bit(idx, common->ccmp_keymap);
566 set_bit(idx + 64, common->keymap);
567 set_bit(idx, common->tkip_keymap);
568 set_bit(idx + 64, common->tkip_keymap);
569 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) {
570 set_bit(idx + 32, common->keymap);
571 set_bit(idx + 64 + 32, common->keymap);
572 set_bit(idx + 32, common->tkip_keymap);
573 set_bit(idx + 64 + 32, common->tkip_keymap);
584 void ath_key_delete(struct ath_common *common, u8 hw_key_idx)
591 if (test_bit(hw_key_idx, common->ccmp_keymap) ||
592 test_bit(hw_key_idx, common->tkip_keymap))
593 ath_hw_keysetmac(common, hw_key_idx, NULL);
595 ath_hw_keyreset(common, hw_key_idx);
599 clear_bit(hw_key_idx, common->keymap);
600 clear_bit(hw_key_idx, common->ccmp_keymap);
601 if (!test_bit(hw_key_idx, common->tkip_keymap))
604 clear_bit(hw_key_idx + 64, common->keymap);
606 clear_bit(hw_key_idx, common->tkip_keymap);
607 clear_bit(hw_key_idx + 64, common->tkip_keymap);
609 if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) {
610 ath_hw_keyreset(common, hw_key_idx + 32);
611 clear_bit(hw_key_idx + 32, common->keymap);
612 clear_bit(hw_key_idx + 64 + 32, common->keymap);
614 clear_bit(hw_key_idx + 32, common->tkip_keymap);
615 clear_bit(hw_key_idx + 64 + 32, common->tkip_keymap);