Lines Matching refs:slot
11 * with a slot number to specify the key to use for en/decryption.
16 * program just one slot with that key and use that slot for all requests.
26 * key into some slot in the inline encryption hardware.
77 unsigned int slot;
97 for (slot = 0; slot < num_slots; slot++) {
98 ksm->slots[slot].ksm = ksm;
99 list_add_tail(&ksm->slots[slot].idle_slot_node,
137 static void blk_ksm_remove_slot_from_lru_list(struct blk_ksm_keyslot *slot)
139 struct blk_keyslot_manager *ksm = slot->ksm;
143 list_del(&slot->idle_slot_node);
165 struct blk_ksm_keyslot *slot;
167 slot = blk_ksm_find_keyslot(ksm, key);
168 if (!slot)
170 if (atomic_inc_return(&slot->slot_refs) == 1) {
171 /* Took first reference to this slot; remove it from LRU list */
172 blk_ksm_remove_slot_from_lru_list(slot);
174 return slot;
177 unsigned int blk_ksm_get_slot_idx(struct blk_ksm_keyslot *slot)
179 return slot - slot->ksm->slots;
203 struct blk_ksm_keyslot *slot;
209 slot = blk_ksm_find_and_grab_keyslot(ksm, key);
211 if (slot)
216 slot = blk_ksm_find_and_grab_keyslot(ksm, key);
217 if (slot) {
223 * If we're here, that means there wasn't a slot that was
234 slot = list_first_entry(&ksm->idle_slots, struct blk_ksm_keyslot,
236 slot_idx = blk_ksm_get_slot_idx(slot);
245 /* Move this slot to the hash list for the new key. */
246 if (slot->key)
247 hlist_del(&slot->hash_node);
248 slot->key = key;
249 hlist_add_head(&slot->hash_node, blk_ksm_hash_bucket_for_key(ksm, key));
251 atomic_set(&slot->slot_refs, 1);
253 blk_ksm_remove_slot_from_lru_list(slot);
257 *slot_ptr = slot;
262 * blk_ksm_put_slot() - Release a reference to a slot
263 * @slot: The keyslot to release the reference of.
267 void blk_ksm_put_slot(struct blk_ksm_keyslot *slot)
272 if (!slot)
275 ksm = slot->ksm;
277 if (atomic_dec_and_lock_irqsave(&slot->slot_refs,
279 list_add_tail(&slot->idle_slot_node, &ksm->idle_slots);
316 struct blk_ksm_keyslot *slot;
320 slot = blk_ksm_find_keyslot(ksm, key);
321 if (!slot) {
330 if (WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)) {
336 blk_ksm_get_slot_idx(slot));
340 * table and clear slot->key even on error.
342 hlist_del(&slot->hash_node);
343 slot->key = NULL;
360 unsigned int slot;
364 for (slot = 0; slot < ksm->num_slots; slot++) {
365 const struct blk_crypto_key *key = ksm->slots[slot].key;
371 err = ksm->ksm_ll_ops.keyslot_program(ksm, key, slot);