Lines Matching refs:assoc
37 struct nvmet_fc_tgt_assoc *assoc; member
130 struct nvmet_fc_tgt_assoc *assoc; member
178 nvmet_fc_makeconnid(struct nvmet_fc_tgt_assoc *assoc, u16 qid) in nvmet_fc_makeconnid() argument
180 return (assoc->association_id | qid); in nvmet_fc_makeconnid()
221 static void nvmet_fc_tgt_a_put(struct nvmet_fc_tgt_assoc *assoc);
222 static int nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc);
229 static void nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc);
581 nvmet_fc_alloc_target_queue(struct nvmet_fc_tgt_assoc *assoc, in nvmet_fc_alloc_target_queue() argument
595 if (!nvmet_fc_tgt_a_get(assoc)) in nvmet_fc_alloc_target_queue()
599 assoc->tgtport->fc_target_port.port_num, in nvmet_fc_alloc_target_queue()
600 assoc->a_id, qid); in nvmet_fc_alloc_target_queue()
606 queue->assoc = assoc; in nvmet_fc_alloc_target_queue()
617 nvmet_fc_prep_fcp_iodlist(assoc->tgtport, queue); in nvmet_fc_alloc_target_queue()
623 WARN_ON(assoc->queues[qid]); in nvmet_fc_alloc_target_queue()
624 spin_lock_irqsave(&assoc->tgtport->lock, flags); in nvmet_fc_alloc_target_queue()
625 assoc->queues[qid] = queue; in nvmet_fc_alloc_target_queue()
626 spin_unlock_irqrestore(&assoc->tgtport->lock, flags); in nvmet_fc_alloc_target_queue()
631 nvmet_fc_destroy_fcp_iodlist(assoc->tgtport, queue); in nvmet_fc_alloc_target_queue()
634 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_alloc_target_queue()
648 spin_lock_irqsave(&queue->assoc->tgtport->lock, flags); in nvmet_fc_tgt_queue_free()
649 queue->assoc->queues[queue->qid] = NULL; in nvmet_fc_tgt_queue_free()
650 spin_unlock_irqrestore(&queue->assoc->tgtport->lock, flags); in nvmet_fc_tgt_queue_free()
652 nvmet_fc_destroy_fcp_iodlist(queue->assoc->tgtport, queue); in nvmet_fc_tgt_queue_free()
654 nvmet_fc_tgt_a_put(queue->assoc); in nvmet_fc_tgt_queue_free()
677 struct nvmet_fc_tgtport *tgtport = queue->assoc->tgtport; in nvmet_fc_delete_target_queue()
755 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_find_target_queue() local
765 list_for_each_entry(assoc, &tgtport->assoc_list, a_list) { in nvmet_fc_find_target_queue()
766 if (association_id == assoc->association_id) { in nvmet_fc_find_target_queue()
767 queue = assoc->queues[qid]; in nvmet_fc_find_target_queue()
783 struct nvmet_fc_tgt_assoc *assoc = in nvmet_fc_delete_assoc() local
786 nvmet_fc_delete_target_assoc(assoc); in nvmet_fc_delete_assoc()
787 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_delete_assoc()
793 struct nvmet_fc_tgt_assoc *assoc, *tmpassoc; in nvmet_fc_alloc_target_assoc() local
799 assoc = kzalloc(sizeof(*assoc), GFP_KERNEL); in nvmet_fc_alloc_target_assoc()
800 if (!assoc) in nvmet_fc_alloc_target_assoc()
810 assoc->tgtport = tgtport; in nvmet_fc_alloc_target_assoc()
811 assoc->a_id = idx; in nvmet_fc_alloc_target_assoc()
812 INIT_LIST_HEAD(&assoc->a_list); in nvmet_fc_alloc_target_assoc()
813 kref_init(&assoc->ref); in nvmet_fc_alloc_target_assoc()
814 INIT_WORK(&assoc->del_work, nvmet_fc_delete_assoc); in nvmet_fc_alloc_target_assoc()
828 assoc->association_id = ran; in nvmet_fc_alloc_target_assoc()
829 list_add_tail(&assoc->a_list, &tgtport->assoc_list); in nvmet_fc_alloc_target_assoc()
834 return assoc; in nvmet_fc_alloc_target_assoc()
839 kfree(assoc); in nvmet_fc_alloc_target_assoc()
846 struct nvmet_fc_tgt_assoc *assoc = in nvmet_fc_target_assoc_free() local
848 struct nvmet_fc_tgtport *tgtport = assoc->tgtport; in nvmet_fc_target_assoc_free()
852 list_del(&assoc->a_list); in nvmet_fc_target_assoc_free()
854 ida_simple_remove(&tgtport->assoc_cnt, assoc->a_id); in nvmet_fc_target_assoc_free()
855 kfree(assoc); in nvmet_fc_target_assoc_free()
860 nvmet_fc_tgt_a_put(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_tgt_a_put() argument
862 kref_put(&assoc->ref, nvmet_fc_target_assoc_free); in nvmet_fc_tgt_a_put()
866 nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_tgt_a_get() argument
868 return kref_get_unless_zero(&assoc->ref); in nvmet_fc_tgt_a_get()
872 nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_delete_target_assoc() argument
874 struct nvmet_fc_tgtport *tgtport = assoc->tgtport; in nvmet_fc_delete_target_assoc()
881 queue = assoc->queues[i]; in nvmet_fc_delete_target_assoc()
893 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_delete_target_assoc()
900 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_find_target_assoc() local
905 list_for_each_entry(assoc, &tgtport->assoc_list, a_list) { in nvmet_fc_find_target_assoc()
906 if (association_id == assoc->association_id) { in nvmet_fc_find_target_assoc()
907 ret = assoc; in nvmet_fc_find_target_assoc()
908 nvmet_fc_tgt_a_get(assoc); in nvmet_fc_find_target_assoc()
1135 struct nvmet_fc_tgt_assoc *assoc, *next; in __nvmet_fc_free_assocs() local
1139 list_for_each_entry_safe(assoc, next, in __nvmet_fc_free_assocs()
1141 if (!nvmet_fc_tgt_a_get(assoc)) in __nvmet_fc_free_assocs()
1143 if (!schedule_work(&assoc->del_work)) in __nvmet_fc_free_assocs()
1144 nvmet_fc_tgt_a_put(assoc); in __nvmet_fc_free_assocs()
1156 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_delete_ctrl() local
1170 list_for_each_entry(assoc, &tgtport->assoc_list, a_list) { in nvmet_fc_delete_ctrl()
1171 queue = assoc->queues[0]; in nvmet_fc_delete_ctrl()
1173 if (nvmet_fc_tgt_a_get(assoc)) in nvmet_fc_delete_ctrl()
1183 if (!schedule_work(&assoc->del_work)) in nvmet_fc_delete_ctrl()
1184 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_delete_ctrl()
1359 iod->assoc = nvmet_fc_alloc_target_assoc(tgtport); in nvmet_fc_ls_create_association()
1360 if (!iod->assoc) in nvmet_fc_ls_create_association()
1363 queue = nvmet_fc_alloc_target_queue(iod->assoc, 0, in nvmet_fc_ls_create_association()
1398 cpu_to_be64(nvmet_fc_makeconnid(iod->assoc, 0)); in nvmet_fc_ls_create_association()
1445 iod->assoc = nvmet_fc_find_target_assoc(tgtport, in nvmet_fc_ls_create_connection()
1447 if (!iod->assoc) in nvmet_fc_ls_create_connection()
1450 queue = nvmet_fc_alloc_target_queue(iod->assoc, in nvmet_fc_ls_create_connection()
1457 nvmet_fc_tgt_a_put(iod->assoc); in nvmet_fc_ls_create_connection()
1490 cpu_to_be64(nvmet_fc_makeconnid(iod->assoc, in nvmet_fc_ls_create_connection()
1502 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_ls_disconnect() local
1531 assoc = nvmet_fc_find_target_assoc(tgtport, in nvmet_fc_ls_disconnect()
1533 iod->assoc = assoc; in nvmet_fc_ls_disconnect()
1534 if (!assoc) in nvmet_fc_ls_disconnect()
1563 nvmet_fc_tgt_a_put(iod->assoc); in nvmet_fc_ls_disconnect()
1565 nvmet_fc_delete_target_assoc(iod->assoc); in nvmet_fc_ls_disconnect()
1619 iod->assoc = NULL; in nvmet_fc_handle_ls_rqst()