Lines Matching refs:assoc

49 	struct nvmet_fc_tgt_assoc	*assoc;  member
138 struct nvmet_fc_tgt_assoc *assoc; member
186 nvmet_fc_makeconnid(struct nvmet_fc_tgt_assoc *assoc, u16 qid) in nvmet_fc_makeconnid() argument
188 return (assoc->association_id | qid); in nvmet_fc_makeconnid()
230 static void nvmet_fc_tgt_a_put(struct nvmet_fc_tgt_assoc *assoc);
231 static int nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc);
238 static void nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc);
619 nvmet_fc_alloc_target_queue(struct nvmet_fc_tgt_assoc *assoc, in nvmet_fc_alloc_target_queue() argument
635 if (!nvmet_fc_tgt_a_get(assoc)) in nvmet_fc_alloc_target_queue()
639 assoc->tgtport->fc_target_port.port_num, in nvmet_fc_alloc_target_queue()
640 assoc->a_id, qid); in nvmet_fc_alloc_target_queue()
647 queue->assoc = assoc; in nvmet_fc_alloc_target_queue()
648 queue->port = assoc->tgtport->port; in nvmet_fc_alloc_target_queue()
649 queue->cpu = nvmet_fc_queue_to_cpu(assoc->tgtport, qid); in nvmet_fc_alloc_target_queue()
660 nvmet_fc_prep_fcp_iodlist(assoc->tgtport, queue); in nvmet_fc_alloc_target_queue()
666 WARN_ON(assoc->queues[qid]); in nvmet_fc_alloc_target_queue()
667 spin_lock_irqsave(&assoc->tgtport->lock, flags); in nvmet_fc_alloc_target_queue()
668 assoc->queues[qid] = queue; in nvmet_fc_alloc_target_queue()
669 spin_unlock_irqrestore(&assoc->tgtport->lock, flags); in nvmet_fc_alloc_target_queue()
674 nvmet_fc_destroy_fcp_iodlist(assoc->tgtport, queue); in nvmet_fc_alloc_target_queue()
677 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_alloc_target_queue()
691 spin_lock_irqsave(&queue->assoc->tgtport->lock, flags); in nvmet_fc_tgt_queue_free()
692 queue->assoc->queues[queue->qid] = NULL; in nvmet_fc_tgt_queue_free()
693 spin_unlock_irqrestore(&queue->assoc->tgtport->lock, flags); in nvmet_fc_tgt_queue_free()
695 nvmet_fc_destroy_fcp_iodlist(queue->assoc->tgtport, queue); in nvmet_fc_tgt_queue_free()
697 nvmet_fc_tgt_a_put(queue->assoc); in nvmet_fc_tgt_queue_free()
720 struct nvmet_fc_tgtport *tgtport = queue->assoc->tgtport; in nvmet_fc_delete_target_queue()
798 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_find_target_queue() local
808 list_for_each_entry(assoc, &tgtport->assoc_list, a_list) { in nvmet_fc_find_target_queue()
809 if (association_id == assoc->association_id) { in nvmet_fc_find_target_queue()
810 queue = assoc->queues[qid]; in nvmet_fc_find_target_queue()
826 struct nvmet_fc_tgt_assoc *assoc = in nvmet_fc_delete_assoc() local
829 nvmet_fc_delete_target_assoc(assoc); in nvmet_fc_delete_assoc()
830 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_delete_assoc()
836 struct nvmet_fc_tgt_assoc *assoc, *tmpassoc; in nvmet_fc_alloc_target_assoc() local
842 assoc = kzalloc(sizeof(*assoc), GFP_KERNEL); in nvmet_fc_alloc_target_assoc()
843 if (!assoc) in nvmet_fc_alloc_target_assoc()
853 assoc->tgtport = tgtport; in nvmet_fc_alloc_target_assoc()
854 assoc->a_id = idx; in nvmet_fc_alloc_target_assoc()
855 INIT_LIST_HEAD(&assoc->a_list); in nvmet_fc_alloc_target_assoc()
856 kref_init(&assoc->ref); in nvmet_fc_alloc_target_assoc()
857 INIT_WORK(&assoc->del_work, nvmet_fc_delete_assoc); in nvmet_fc_alloc_target_assoc()
871 assoc->association_id = ran; in nvmet_fc_alloc_target_assoc()
872 list_add_tail(&assoc->a_list, &tgtport->assoc_list); in nvmet_fc_alloc_target_assoc()
877 return assoc; in nvmet_fc_alloc_target_assoc()
882 kfree(assoc); in nvmet_fc_alloc_target_assoc()
889 struct nvmet_fc_tgt_assoc *assoc = in nvmet_fc_target_assoc_free() local
891 struct nvmet_fc_tgtport *tgtport = assoc->tgtport; in nvmet_fc_target_assoc_free()
895 list_del(&assoc->a_list); in nvmet_fc_target_assoc_free()
897 ida_simple_remove(&tgtport->assoc_cnt, assoc->a_id); in nvmet_fc_target_assoc_free()
898 kfree(assoc); in nvmet_fc_target_assoc_free()
903 nvmet_fc_tgt_a_put(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_tgt_a_put() argument
905 kref_put(&assoc->ref, nvmet_fc_target_assoc_free); in nvmet_fc_tgt_a_put()
909 nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_tgt_a_get() argument
911 return kref_get_unless_zero(&assoc->ref); in nvmet_fc_tgt_a_get()
915 nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_delete_target_assoc() argument
917 struct nvmet_fc_tgtport *tgtport = assoc->tgtport; in nvmet_fc_delete_target_assoc()
924 queue = assoc->queues[i]; in nvmet_fc_delete_target_assoc()
936 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_delete_target_assoc()
943 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_find_target_assoc() local
948 list_for_each_entry(assoc, &tgtport->assoc_list, a_list) { in nvmet_fc_find_target_assoc()
949 if (association_id == assoc->association_id) { in nvmet_fc_find_target_assoc()
950 ret = assoc; in nvmet_fc_find_target_assoc()
951 nvmet_fc_tgt_a_get(assoc); in nvmet_fc_find_target_assoc()
1099 struct nvmet_fc_tgt_assoc *assoc, *next; in __nvmet_fc_free_assocs() local
1103 list_for_each_entry_safe(assoc, next, in __nvmet_fc_free_assocs()
1105 if (!nvmet_fc_tgt_a_get(assoc)) in __nvmet_fc_free_assocs()
1108 nvmet_fc_delete_target_assoc(assoc); in __nvmet_fc_free_assocs()
1109 nvmet_fc_tgt_a_put(assoc); in __nvmet_fc_free_assocs()
1122 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_delete_ctrl() local
1136 list_for_each_entry(assoc, &tgtport->assoc_list, a_list) { in nvmet_fc_delete_ctrl()
1137 queue = assoc->queues[0]; in nvmet_fc_delete_ctrl()
1139 if (nvmet_fc_tgt_a_get(assoc)) in nvmet_fc_delete_ctrl()
1149 schedule_work(&assoc->del_work); in nvmet_fc_delete_ctrl()
1322 iod->assoc = nvmet_fc_alloc_target_assoc(tgtport); in nvmet_fc_ls_create_association()
1323 if (!iod->assoc) in nvmet_fc_ls_create_association()
1326 queue = nvmet_fc_alloc_target_queue(iod->assoc, 0, in nvmet_fc_ls_create_association()
1361 cpu_to_be64(nvmet_fc_makeconnid(iod->assoc, 0)); in nvmet_fc_ls_create_association()
1408 iod->assoc = nvmet_fc_find_target_assoc(tgtport, in nvmet_fc_ls_create_connection()
1410 if (!iod->assoc) in nvmet_fc_ls_create_connection()
1413 queue = nvmet_fc_alloc_target_queue(iod->assoc, in nvmet_fc_ls_create_connection()
1420 nvmet_fc_tgt_a_put(iod->assoc); in nvmet_fc_ls_create_connection()
1453 cpu_to_be64(nvmet_fc_makeconnid(iod->assoc, in nvmet_fc_ls_create_connection()
1466 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_ls_disconnect() local
1496 assoc = nvmet_fc_find_target_assoc(tgtport, in nvmet_fc_ls_disconnect()
1498 iod->assoc = assoc; in nvmet_fc_ls_disconnect()
1499 if (assoc) { in nvmet_fc_ls_disconnect()
1506 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_ls_disconnect()
1554 nvmet_fc_tgt_a_put(iod->assoc); in nvmet_fc_ls_disconnect()
1557 nvmet_fc_delete_target_assoc(iod->assoc); in nvmet_fc_ls_disconnect()
1611 iod->assoc = NULL; in nvmet_fc_handle_ls_rqst()