Lines Matching refs:slot
76 unsigned int slot; in blk_crypto_profile_init() local
98 for (slot = 0; slot < num_slots; slot++) { in blk_crypto_profile_init()
99 profile->slots[slot].profile = profile; in blk_crypto_profile_init()
100 list_add_tail(&profile->slots[slot].idle_slot_node, in blk_crypto_profile_init()
171 blk_crypto_remove_slot_from_lru_list(struct blk_crypto_keyslot *slot) in blk_crypto_remove_slot_from_lru_list() argument
173 struct blk_crypto_profile *profile = slot->profile; in blk_crypto_remove_slot_from_lru_list()
177 list_del(&slot->idle_slot_node); in blk_crypto_remove_slot_from_lru_list()
200 struct blk_crypto_keyslot *slot; in blk_crypto_find_and_grab_keyslot() local
202 slot = blk_crypto_find_keyslot(profile, key); in blk_crypto_find_and_grab_keyslot()
203 if (!slot) in blk_crypto_find_and_grab_keyslot()
205 if (atomic_inc_return(&slot->slot_refs) == 1) { in blk_crypto_find_and_grab_keyslot()
207 blk_crypto_remove_slot_from_lru_list(slot); in blk_crypto_find_and_grab_keyslot()
209 return slot; in blk_crypto_find_and_grab_keyslot()
218 unsigned int blk_crypto_keyslot_index(struct blk_crypto_keyslot *slot) in blk_crypto_keyslot_index() argument
220 return slot - slot->profile->slots; in blk_crypto_keyslot_index()
245 struct blk_crypto_keyslot *slot; in blk_crypto_get_keyslot() local
259 slot = blk_crypto_find_and_grab_keyslot(profile, key); in blk_crypto_get_keyslot()
261 if (slot) in blk_crypto_get_keyslot()
266 slot = blk_crypto_find_and_grab_keyslot(profile, key); in blk_crypto_get_keyslot()
267 if (slot) { in blk_crypto_get_keyslot()
284 slot = list_first_entry(&profile->idle_slots, struct blk_crypto_keyslot, in blk_crypto_get_keyslot()
286 slot_idx = blk_crypto_keyslot_index(slot); in blk_crypto_get_keyslot()
296 if (slot->key) in blk_crypto_get_keyslot()
297 hlist_del(&slot->hash_node); in blk_crypto_get_keyslot()
298 slot->key = key; in blk_crypto_get_keyslot()
299 hlist_add_head(&slot->hash_node, in blk_crypto_get_keyslot()
302 atomic_set(&slot->slot_refs, 1); in blk_crypto_get_keyslot()
304 blk_crypto_remove_slot_from_lru_list(slot); in blk_crypto_get_keyslot()
308 *slot_ptr = slot; in blk_crypto_get_keyslot()
318 void blk_crypto_put_keyslot(struct blk_crypto_keyslot *slot) in blk_crypto_put_keyslot() argument
323 if (!slot) in blk_crypto_put_keyslot()
326 profile = slot->profile; in blk_crypto_put_keyslot()
328 if (atomic_dec_and_lock_irqsave(&slot->slot_refs, in blk_crypto_put_keyslot()
330 list_add_tail(&slot->idle_slot_node, &profile->idle_slots); in blk_crypto_put_keyslot()
376 struct blk_crypto_keyslot *slot; in __blk_crypto_evict_key() local
390 slot = blk_crypto_find_keyslot(profile, key); in __blk_crypto_evict_key()
391 if (!slot) in __blk_crypto_evict_key()
394 if (WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)) { in __blk_crypto_evict_key()
399 blk_crypto_keyslot_index(slot)); in __blk_crypto_evict_key()
403 hlist_del(&slot->hash_node); in __blk_crypto_evict_key()
404 slot->key = NULL; in __blk_crypto_evict_key()
422 unsigned int slot; in blk_crypto_reprogram_all_keys() local
429 for (slot = 0; slot < profile->num_slots; slot++) { in blk_crypto_reprogram_all_keys()
430 const struct blk_crypto_key *key = profile->slots[slot].key; in blk_crypto_reprogram_all_keys()
436 err = profile->ll_ops.keyslot_program(profile, key, slot); in blk_crypto_reprogram_all_keys()