Lines Matching refs:assoc

35 	struct nvmet_fc_tgt_assoc	*assoc;  member
142 struct nvmet_fc_tgt_assoc *assoc; member
203 nvmet_fc_makeconnid(struct nvmet_fc_tgt_assoc *assoc, u16 qid) in nvmet_fc_makeconnid() argument
205 return (assoc->association_id | qid); in nvmet_fc_makeconnid()
246 static void nvmet_fc_tgt_a_put(struct nvmet_fc_tgt_assoc *assoc);
247 static int nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc);
254 static void nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc);
477 nvmet_fc_xmt_disconnect_assoc(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_xmt_disconnect_assoc() argument
479 struct nvmet_fc_tgtport *tgtport = assoc->tgtport; in nvmet_fc_xmt_disconnect_assoc()
491 if (!tgtport->ops->ls_req || !assoc->hostport || in nvmet_fc_xmt_disconnect_assoc()
492 assoc->hostport->invalid) in nvmet_fc_xmt_disconnect_assoc()
501 tgtport->fc_target_port.port_num, assoc->a_id); in nvmet_fc_xmt_disconnect_assoc()
514 lsop->hosthandle = assoc->hostport->hosthandle; in nvmet_fc_xmt_disconnect_assoc()
517 assoc->association_id); in nvmet_fc_xmt_disconnect_assoc()
524 tgtport->fc_target_port.port_num, assoc->a_id, ret); in nvmet_fc_xmt_disconnect_assoc()
791 nvmet_fc_alloc_target_queue(struct nvmet_fc_tgt_assoc *assoc, in nvmet_fc_alloc_target_queue() argument
804 if (!nvmet_fc_tgt_a_get(assoc)) in nvmet_fc_alloc_target_queue()
808 assoc->tgtport->fc_target_port.port_num, in nvmet_fc_alloc_target_queue()
809 assoc->a_id, qid); in nvmet_fc_alloc_target_queue()
815 queue->assoc = assoc; in nvmet_fc_alloc_target_queue()
826 nvmet_fc_prep_fcp_iodlist(assoc->tgtport, queue); in nvmet_fc_alloc_target_queue()
832 WARN_ON(assoc->queues[qid]); in nvmet_fc_alloc_target_queue()
833 rcu_assign_pointer(assoc->queues[qid], queue); in nvmet_fc_alloc_target_queue()
838 nvmet_fc_destroy_fcp_iodlist(assoc->tgtport, queue); in nvmet_fc_alloc_target_queue()
841 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_alloc_target_queue()
854 rcu_assign_pointer(queue->assoc->queues[queue->qid], NULL); in nvmet_fc_tgt_queue_free()
856 nvmet_fc_destroy_fcp_iodlist(queue->assoc->tgtport, queue); in nvmet_fc_tgt_queue_free()
858 nvmet_fc_tgt_a_put(queue->assoc); in nvmet_fc_tgt_queue_free()
881 struct nvmet_fc_tgtport *tgtport = queue->assoc->tgtport; in nvmet_fc_delete_target_queue()
960 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_find_target_queue() local
969 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) { in nvmet_fc_find_target_queue()
970 if (association_id == assoc->association_id) { in nvmet_fc_find_target_queue()
971 queue = rcu_dereference(assoc->queues[qid]); in nvmet_fc_find_target_queue()
1098 struct nvmet_fc_tgt_assoc *assoc = in nvmet_fc_delete_assoc() local
1101 nvmet_fc_delete_target_assoc(assoc); in nvmet_fc_delete_assoc()
1102 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_delete_assoc()
1108 struct nvmet_fc_tgt_assoc *assoc, *tmpassoc; in nvmet_fc_alloc_target_assoc() local
1114 assoc = kzalloc(sizeof(*assoc), GFP_KERNEL); in nvmet_fc_alloc_target_assoc()
1115 if (!assoc) in nvmet_fc_alloc_target_assoc()
1125 assoc->hostport = nvmet_fc_alloc_hostport(tgtport, hosthandle); in nvmet_fc_alloc_target_assoc()
1126 if (IS_ERR(assoc->hostport)) in nvmet_fc_alloc_target_assoc()
1129 assoc->tgtport = tgtport; in nvmet_fc_alloc_target_assoc()
1130 assoc->a_id = idx; in nvmet_fc_alloc_target_assoc()
1131 INIT_LIST_HEAD(&assoc->a_list); in nvmet_fc_alloc_target_assoc()
1132 kref_init(&assoc->ref); in nvmet_fc_alloc_target_assoc()
1133 INIT_WORK(&assoc->del_work, nvmet_fc_delete_assoc); in nvmet_fc_alloc_target_assoc()
1134 atomic_set(&assoc->terminating, 0); in nvmet_fc_alloc_target_assoc()
1149 assoc->association_id = ran; in nvmet_fc_alloc_target_assoc()
1150 list_add_tail_rcu(&assoc->a_list, &tgtport->assoc_list); in nvmet_fc_alloc_target_assoc()
1155 return assoc; in nvmet_fc_alloc_target_assoc()
1162 kfree(assoc); in nvmet_fc_alloc_target_assoc()
1169 struct nvmet_fc_tgt_assoc *assoc = in nvmet_fc_target_assoc_free() local
1171 struct nvmet_fc_tgtport *tgtport = assoc->tgtport; in nvmet_fc_target_assoc_free()
1176 nvmet_fc_xmt_disconnect_assoc(assoc); in nvmet_fc_target_assoc_free()
1178 nvmet_fc_free_hostport(assoc->hostport); in nvmet_fc_target_assoc_free()
1180 list_del_rcu(&assoc->a_list); in nvmet_fc_target_assoc_free()
1181 oldls = assoc->rcv_disconn; in nvmet_fc_target_assoc_free()
1186 ida_free(&tgtport->assoc_cnt, assoc->a_id); in nvmet_fc_target_assoc_free()
1189 tgtport->fc_target_port.port_num, assoc->a_id); in nvmet_fc_target_assoc_free()
1190 kfree_rcu(assoc, rcu); in nvmet_fc_target_assoc_free()
1195 nvmet_fc_tgt_a_put(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_tgt_a_put() argument
1197 kref_put(&assoc->ref, nvmet_fc_target_assoc_free); in nvmet_fc_tgt_a_put()
1201 nvmet_fc_tgt_a_get(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_tgt_a_get() argument
1203 return kref_get_unless_zero(&assoc->ref); in nvmet_fc_tgt_a_get()
1207 nvmet_fc_delete_target_assoc(struct nvmet_fc_tgt_assoc *assoc) in nvmet_fc_delete_target_assoc() argument
1209 struct nvmet_fc_tgtport *tgtport = assoc->tgtport; in nvmet_fc_delete_target_assoc()
1213 terminating = atomic_xchg(&assoc->terminating, 1); in nvmet_fc_delete_target_assoc()
1222 queue = rcu_dereference(assoc->queues[i]); in nvmet_fc_delete_target_assoc()
1239 tgtport->fc_target_port.port_num, assoc->a_id); in nvmet_fc_delete_target_assoc()
1241 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_delete_target_assoc()
1248 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_find_target_assoc() local
1252 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) { in nvmet_fc_find_target_assoc()
1253 if (association_id == assoc->association_id) { in nvmet_fc_find_target_assoc()
1254 ret = assoc; in nvmet_fc_find_target_assoc()
1255 if (!nvmet_fc_tgt_a_get(assoc)) in nvmet_fc_find_target_assoc()
1488 struct nvmet_fc_tgt_assoc *assoc; in __nvmet_fc_free_assocs() local
1491 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) { in __nvmet_fc_free_assocs()
1492 if (!nvmet_fc_tgt_a_get(assoc)) in __nvmet_fc_free_assocs()
1494 if (!queue_work(nvmet_wq, &assoc->del_work)) in __nvmet_fc_free_assocs()
1496 nvmet_fc_tgt_a_put(assoc); in __nvmet_fc_free_assocs()
1535 struct nvmet_fc_tgt_assoc *assoc, *next; in nvmet_fc_invalidate_host() local
1540 list_for_each_entry_safe(assoc, next, in nvmet_fc_invalidate_host()
1542 if (!assoc->hostport || in nvmet_fc_invalidate_host()
1543 assoc->hostport->hosthandle != hosthandle) in nvmet_fc_invalidate_host()
1545 if (!nvmet_fc_tgt_a_get(assoc)) in nvmet_fc_invalidate_host()
1547 assoc->hostport->invalid = 1; in nvmet_fc_invalidate_host()
1549 if (!queue_work(nvmet_wq, &assoc->del_work)) in nvmet_fc_invalidate_host()
1551 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_invalidate_host()
1568 struct nvmet_fc_tgt_assoc *assoc; in nvmet_fc_delete_ctrl() local
1582 list_for_each_entry_rcu(assoc, &tgtport->assoc_list, a_list) { in nvmet_fc_delete_ctrl()
1583 queue = rcu_dereference(assoc->queues[0]); in nvmet_fc_delete_ctrl()
1585 if (nvmet_fc_tgt_a_get(assoc)) in nvmet_fc_delete_ctrl()
1595 if (!queue_work(nvmet_wq, &assoc->del_work)) in nvmet_fc_delete_ctrl()
1597 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_delete_ctrl()
1681 iod->assoc = nvmet_fc_alloc_target_assoc( in nvmet_fc_ls_create_association()
1683 if (!iod->assoc) in nvmet_fc_ls_create_association()
1686 queue = nvmet_fc_alloc_target_queue(iod->assoc, 0, in nvmet_fc_ls_create_association()
1690 nvmet_fc_tgt_a_put(iod->assoc); in nvmet_fc_ls_create_association()
1712 tgtport->fc_target_port.port_num, iod->assoc->a_id); in nvmet_fc_ls_create_association()
1727 cpu_to_be64(nvmet_fc_makeconnid(iod->assoc, 0)); in nvmet_fc_ls_create_association()
1772 iod->assoc = nvmet_fc_find_target_assoc(tgtport, in nvmet_fc_ls_create_connection()
1774 if (!iod->assoc) in nvmet_fc_ls_create_connection()
1777 queue = nvmet_fc_alloc_target_queue(iod->assoc, in nvmet_fc_ls_create_connection()
1784 nvmet_fc_tgt_a_put(iod->assoc); in nvmet_fc_ls_create_connection()
1817 cpu_to_be64(nvmet_fc_makeconnid(iod->assoc, in nvmet_fc_ls_create_connection()
1833 struct nvmet_fc_tgt_assoc *assoc = NULL; in nvmet_fc_ls_disconnect() local
1843 assoc = nvmet_fc_find_target_assoc(tgtport, in nvmet_fc_ls_disconnect()
1845 iod->assoc = assoc; in nvmet_fc_ls_disconnect()
1846 if (!assoc) in nvmet_fc_ls_disconnect()
1850 if (ret || !assoc) { in nvmet_fc_ls_disconnect()
1873 nvmet_fc_tgt_a_put(assoc); in nvmet_fc_ls_disconnect()
1885 oldls = assoc->rcv_disconn; in nvmet_fc_ls_disconnect()
1886 assoc->rcv_disconn = iod; in nvmet_fc_ls_disconnect()
1889 nvmet_fc_delete_target_assoc(assoc); in nvmet_fc_ls_disconnect()
1895 tgtport->fc_target_port.port_num, assoc->a_id); in nvmet_fc_ls_disconnect()
1960 iod->assoc = NULL; in nvmet_fc_handle_ls_rqst()