Lines Matching full:ctrl
141 static void nvmet_async_events_failall(struct nvmet_ctrl *ctrl) in nvmet_async_events_failall() argument
145 mutex_lock(&ctrl->lock); in nvmet_async_events_failall()
146 while (ctrl->nr_async_event_cmds) { in nvmet_async_events_failall()
147 req = ctrl->async_event_cmds[--ctrl->nr_async_event_cmds]; in nvmet_async_events_failall()
148 mutex_unlock(&ctrl->lock); in nvmet_async_events_failall()
150 mutex_lock(&ctrl->lock); in nvmet_async_events_failall()
152 mutex_unlock(&ctrl->lock); in nvmet_async_events_failall()
155 static void nvmet_async_events_process(struct nvmet_ctrl *ctrl) in nvmet_async_events_process() argument
160 mutex_lock(&ctrl->lock); in nvmet_async_events_process()
161 while (ctrl->nr_async_event_cmds && !list_empty(&ctrl->async_events)) { in nvmet_async_events_process()
162 aen = list_first_entry(&ctrl->async_events, in nvmet_async_events_process()
164 req = ctrl->async_event_cmds[--ctrl->nr_async_event_cmds]; in nvmet_async_events_process()
170 mutex_unlock(&ctrl->lock); in nvmet_async_events_process()
171 trace_nvmet_async_event(ctrl, req->cqe->result.u32); in nvmet_async_events_process()
173 mutex_lock(&ctrl->lock); in nvmet_async_events_process()
175 mutex_unlock(&ctrl->lock); in nvmet_async_events_process()
178 static void nvmet_async_events_free(struct nvmet_ctrl *ctrl) in nvmet_async_events_free() argument
182 mutex_lock(&ctrl->lock); in nvmet_async_events_free()
183 list_for_each_entry_safe(aen, tmp, &ctrl->async_events, entry) { in nvmet_async_events_free()
187 mutex_unlock(&ctrl->lock); in nvmet_async_events_free()
192 struct nvmet_ctrl *ctrl = in nvmet_async_event_work() local
195 nvmet_async_events_process(ctrl); in nvmet_async_event_work()
198 void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type, in nvmet_add_async_event() argument
211 mutex_lock(&ctrl->lock); in nvmet_add_async_event()
212 list_add_tail(&aen->entry, &ctrl->async_events); in nvmet_add_async_event()
213 mutex_unlock(&ctrl->lock); in nvmet_add_async_event()
215 queue_work(nvmet_wq, &ctrl->async_event_work); in nvmet_add_async_event()
218 static void nvmet_add_to_changed_ns_log(struct nvmet_ctrl *ctrl, __le32 nsid) in nvmet_add_to_changed_ns_log() argument
222 mutex_lock(&ctrl->lock); in nvmet_add_to_changed_ns_log()
223 if (ctrl->nr_changed_ns > NVME_MAX_CHANGED_NAMESPACES) in nvmet_add_to_changed_ns_log()
226 for (i = 0; i < ctrl->nr_changed_ns; i++) { in nvmet_add_to_changed_ns_log()
227 if (ctrl->changed_ns_list[i] == nsid) in nvmet_add_to_changed_ns_log()
231 if (ctrl->nr_changed_ns == NVME_MAX_CHANGED_NAMESPACES) { in nvmet_add_to_changed_ns_log()
232 ctrl->changed_ns_list[0] = cpu_to_le32(0xffffffff); in nvmet_add_to_changed_ns_log()
233 ctrl->nr_changed_ns = U32_MAX; in nvmet_add_to_changed_ns_log()
237 ctrl->changed_ns_list[ctrl->nr_changed_ns++] = nsid; in nvmet_add_to_changed_ns_log()
239 mutex_unlock(&ctrl->lock); in nvmet_add_to_changed_ns_log()
244 struct nvmet_ctrl *ctrl; in nvmet_ns_changed() local
248 list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) { in nvmet_ns_changed()
249 nvmet_add_to_changed_ns_log(ctrl, cpu_to_le32(nsid)); in nvmet_ns_changed()
250 if (nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_NS_ATTR)) in nvmet_ns_changed()
252 nvmet_add_async_event(ctrl, NVME_AER_NOTICE, in nvmet_ns_changed()
261 struct nvmet_ctrl *ctrl; in nvmet_send_ana_event() local
264 list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) { in nvmet_send_ana_event()
265 if (port && ctrl->port != port) in nvmet_send_ana_event()
267 if (nvmet_aen_bit_disabled(ctrl, NVME_AEN_BIT_ANA_CHANGE)) in nvmet_send_ana_event()
269 nvmet_add_async_event(ctrl, NVME_AER_NOTICE, in nvmet_send_ana_event()
310 struct nvmet_ctrl *ctrl; in nvmet_port_del_ctrls() local
313 list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) { in nvmet_port_del_ctrls()
314 if (ctrl->port == port) in nvmet_port_del_ctrls()
315 ctrl->ops->delete_ctrl(ctrl); in nvmet_port_del_ctrls()
402 struct nvmet_ctrl *ctrl = container_of(to_delayed_work(work), in nvmet_keep_alive_timer() local
404 bool reset_tbkas = ctrl->reset_tbkas; in nvmet_keep_alive_timer()
406 ctrl->reset_tbkas = false; in nvmet_keep_alive_timer()
408 pr_debug("ctrl %d reschedule traffic based keep-alive timer\n", in nvmet_keep_alive_timer()
409 ctrl->cntlid); in nvmet_keep_alive_timer()
410 queue_delayed_work(nvmet_wq, &ctrl->ka_work, ctrl->kato * HZ); in nvmet_keep_alive_timer()
414 pr_err("ctrl %d keep-alive timer (%d seconds) expired!\n", in nvmet_keep_alive_timer()
415 ctrl->cntlid, ctrl->kato); in nvmet_keep_alive_timer()
417 nvmet_ctrl_fatal_error(ctrl); in nvmet_keep_alive_timer()
420 void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl) in nvmet_start_keep_alive_timer() argument
422 if (unlikely(ctrl->kato == 0)) in nvmet_start_keep_alive_timer()
425 pr_debug("ctrl %d start keep-alive timer for %d secs\n", in nvmet_start_keep_alive_timer()
426 ctrl->cntlid, ctrl->kato); in nvmet_start_keep_alive_timer()
428 queue_delayed_work(nvmet_wq, &ctrl->ka_work, ctrl->kato * HZ); in nvmet_start_keep_alive_timer()
431 void nvmet_stop_keep_alive_timer(struct nvmet_ctrl *ctrl) in nvmet_stop_keep_alive_timer() argument
433 if (unlikely(ctrl->kato == 0)) in nvmet_stop_keep_alive_timer()
436 pr_debug("ctrl %d stop keep-alive\n", ctrl->cntlid); in nvmet_stop_keep_alive_timer()
438 cancel_delayed_work_sync(&ctrl->ka_work); in nvmet_stop_keep_alive_timer()
524 * Note: ctrl->subsys->lock should be held when calling this function
526 static void nvmet_p2pmem_ns_add_p2p(struct nvmet_ctrl *ctrl, in nvmet_p2pmem_ns_add_p2p() argument
533 if (!ctrl->p2p_client || !ns->use_p2pmem) in nvmet_p2pmem_ns_add_p2p()
537 ret = pci_p2pdma_distance(ns->p2p_dev, ctrl->p2p_client, true); in nvmet_p2pmem_ns_add_p2p()
543 clients[0] = ctrl->p2p_client; in nvmet_p2pmem_ns_add_p2p()
549 dev_name(ctrl->p2p_client), ns->device_path); in nvmet_p2pmem_ns_add_p2p()
554 ret = radix_tree_insert(&ctrl->p2p_ns_map, ns->nsid, p2p_dev); in nvmet_p2pmem_ns_add_p2p()
577 struct nvmet_ctrl *ctrl; in nvmet_ns_enable() local
603 list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) in nvmet_ns_enable()
604 nvmet_p2pmem_ns_add_p2p(ctrl, ns); in nvmet_ns_enable()
626 list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) in nvmet_ns_enable()
627 pci_dev_put(radix_tree_delete(&ctrl->p2p_ns_map, ns->nsid)); in nvmet_ns_enable()
636 struct nvmet_ctrl *ctrl; in nvmet_ns_disable() local
645 list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) in nvmet_ns_disable()
646 pci_dev_put(radix_tree_delete(&ctrl->p2p_ns_map, ns->nsid)); in nvmet_ns_disable()
757 struct nvmet_ctrl *ctrl = req->sq->ctrl; in nvmet_set_error() local
763 if (!ctrl || req->error_loc == NVMET_NO_ERROR_LOC) in nvmet_set_error()
766 spin_lock_irqsave(&ctrl->error_lock, flags); in nvmet_set_error()
767 ctrl->err_counter++; in nvmet_set_error()
769 &ctrl->slots[ctrl->err_counter % NVMET_ERROR_LOG_SLOTS]; in nvmet_set_error()
771 new_error_slot->error_count = cpu_to_le64(ctrl->err_counter); in nvmet_set_error()
778 spin_unlock_irqrestore(&ctrl->error_lock, flags); in nvmet_set_error()
816 void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, in nvmet_cq_setup() argument
823 void nvmet_sq_setup(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, in nvmet_sq_setup() argument
830 ctrl->sqs[qid] = sq; in nvmet_sq_setup()
840 u16 nvmet_check_cqid(struct nvmet_ctrl *ctrl, u16 cqid) in nvmet_check_cqid() argument
842 if (!ctrl->sqs) in nvmet_check_cqid()
845 if (cqid > ctrl->subsys->max_qid) in nvmet_check_cqid()
856 if (ctrl->sqs[cqid]) in nvmet_check_cqid()
862 u16 nvmet_cq_create(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, in nvmet_cq_create() argument
867 status = nvmet_check_cqid(ctrl, qid); in nvmet_cq_create()
871 nvmet_cq_setup(ctrl, cq, qid, size); in nvmet_cq_create()
877 u16 nvmet_check_sqid(struct nvmet_ctrl *ctrl, u16 sqid, in nvmet_check_sqid() argument
880 if (!ctrl->sqs) in nvmet_check_sqid()
883 if (sqid > ctrl->subsys->max_qid) in nvmet_check_sqid()
886 if ((create && ctrl->sqs[sqid]) || in nvmet_check_sqid()
887 (!create && !ctrl->sqs[sqid])) in nvmet_check_sqid()
893 u16 nvmet_sq_create(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, in nvmet_sq_create() argument
899 if (!kref_get_unless_zero(&ctrl->ref)) in nvmet_sq_create()
902 status = nvmet_check_sqid(ctrl, sqid, true); in nvmet_sq_create()
912 nvmet_sq_setup(ctrl, sq, sqid, size); in nvmet_sq_create()
913 sq->ctrl = ctrl; in nvmet_sq_create()
918 nvmet_ctrl_put(ctrl); in nvmet_sq_create()
925 struct nvmet_ctrl *ctrl = sq->ctrl; in nvmet_sq_destroy() local
931 if (ctrl && ctrl->sqs && ctrl->sqs[0] == sq) in nvmet_sq_destroy()
932 nvmet_async_events_failall(ctrl); in nvmet_sq_destroy()
940 * we must reference the ctrl again after waiting for inflight IO in nvmet_sq_destroy()
942 * store sq->ctrl locally, but before we killed the percpu_ref. the in nvmet_sq_destroy()
943 * admin connect allocates and assigns sq->ctrl, which now needs a in nvmet_sq_destroy()
944 * final ref put, as this ctrl is going away. in nvmet_sq_destroy()
946 ctrl = sq->ctrl; in nvmet_sq_destroy()
948 if (ctrl) { in nvmet_sq_destroy()
955 ctrl->reset_tbkas = true; in nvmet_sq_destroy()
956 sq->ctrl->sqs[sq->qid] = NULL; in nvmet_sq_destroy()
957 nvmet_ctrl_put(ctrl); in nvmet_sq_destroy()
958 sq->ctrl = NULL; /* allows reusing the queue later */ in nvmet_sq_destroy()
1031 if (req->sq->ctrl->pi_support && nvmet_ns_has_pi(req->ns)) in nvmet_io_cmd_transfer_len()
1147 if (!req->sq->ctrl || !nvmet_is_pci_ctrl(req->sq->ctrl)) { in nvmet_req_init()
1155 if (unlikely(!req->sq->ctrl)) in nvmet_req_init()
1173 if (sq->ctrl) in nvmet_req_init()
1174 sq->ctrl->reset_tbkas = true; in nvmet_req_init()
1198 if (unlikely(!req->sq->ctrl)) in nvmet_req_transfer_len()
1271 !req->sq->ctrl || !req->sq->qid || !req->ns) in nvmet_req_find_p2p_dev()
1273 return radix_tree_lookup(&req->sq->ctrl->p2p_ns_map, req->ns->nsid); in nvmet_req_find_p2p_dev()
1334 static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl) in nvmet_start_ctrl() argument
1336 lockdep_assert_held(&ctrl->lock); in nvmet_start_ctrl()
1344 if (!nvmet_is_disc_subsys(ctrl->subsys) && in nvmet_start_ctrl()
1345 (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES || in nvmet_start_ctrl()
1346 nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES)) { in nvmet_start_ctrl()
1347 ctrl->csts = NVME_CSTS_CFS; in nvmet_start_ctrl()
1351 if (nvmet_cc_mps(ctrl->cc) != 0 || in nvmet_start_ctrl()
1352 nvmet_cc_ams(ctrl->cc) != 0 || in nvmet_start_ctrl()
1353 !nvmet_css_supported(nvmet_cc_css(ctrl->cc))) { in nvmet_start_ctrl()
1354 ctrl->csts = NVME_CSTS_CFS; in nvmet_start_ctrl()
1358 ctrl->csts = NVME_CSTS_RDY; in nvmet_start_ctrl()
1366 if (ctrl->kato) in nvmet_start_ctrl()
1367 mod_delayed_work(nvmet_wq, &ctrl->ka_work, ctrl->kato * HZ); in nvmet_start_ctrl()
1370 static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl) in nvmet_clear_ctrl() argument
1372 lockdep_assert_held(&ctrl->lock); in nvmet_clear_ctrl()
1375 ctrl->csts &= ~NVME_CSTS_RDY; in nvmet_clear_ctrl()
1376 ctrl->cc = 0; in nvmet_clear_ctrl()
1379 void nvmet_update_cc(struct nvmet_ctrl *ctrl, u32 new) in nvmet_update_cc() argument
1383 mutex_lock(&ctrl->lock); in nvmet_update_cc()
1384 old = ctrl->cc; in nvmet_update_cc()
1385 ctrl->cc = new; in nvmet_update_cc()
1388 nvmet_start_ctrl(ctrl); in nvmet_update_cc()
1390 nvmet_clear_ctrl(ctrl); in nvmet_update_cc()
1392 nvmet_clear_ctrl(ctrl); in nvmet_update_cc()
1393 ctrl->csts |= NVME_CSTS_SHST_CMPLT; in nvmet_update_cc()
1396 ctrl->csts &= ~NVME_CSTS_SHST_CMPLT; in nvmet_update_cc()
1397 mutex_unlock(&ctrl->lock); in nvmet_update_cc()
1401 static void nvmet_init_cap(struct nvmet_ctrl *ctrl) in nvmet_init_cap() argument
1404 ctrl->cap = (1ULL << 37); in nvmet_init_cap()
1406 ctrl->cap |= (1ULL << 43); in nvmet_init_cap()
1408 ctrl->cap |= (15ULL << 24); in nvmet_init_cap()
1410 if (ctrl->ops->get_max_queue_size) in nvmet_init_cap()
1411 ctrl->cap |= min_t(u16, ctrl->ops->get_max_queue_size(ctrl), in nvmet_init_cap()
1412 ctrl->port->max_queue_size) - 1; in nvmet_init_cap()
1414 ctrl->cap |= ctrl->port->max_queue_size - 1; in nvmet_init_cap()
1416 if (nvmet_is_passthru_subsys(ctrl->subsys)) in nvmet_init_cap()
1417 nvmet_passthrough_override_cap(ctrl); in nvmet_init_cap()
1424 struct nvmet_ctrl *ctrl = NULL; in nvmet_ctrl_find_get() local
1436 list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) { in nvmet_ctrl_find_get()
1437 if (ctrl->cntlid == cntlid) { in nvmet_ctrl_find_get()
1438 if (strncmp(hostnqn, ctrl->hostnqn, NVMF_NQN_SIZE)) { in nvmet_ctrl_find_get()
1442 if (!kref_get_unless_zero(&ctrl->ref)) in nvmet_ctrl_find_get()
1445 /* ctrl found */ in nvmet_ctrl_find_get()
1450 ctrl = NULL; /* ctrl not found */ in nvmet_ctrl_find_get()
1459 return ctrl; in nvmet_ctrl_find_get()
1464 if (unlikely(!(req->sq->ctrl->cc & NVME_CC_ENABLE))) { in nvmet_check_ctrl_status()
1470 if (unlikely(!(req->sq->ctrl->csts & NVME_CSTS_RDY))) { in nvmet_check_ctrl_status()
1504 * Note: ctrl->subsys->lock should be held when calling this function
1506 static void nvmet_setup_p2p_ns_map(struct nvmet_ctrl *ctrl, in nvmet_setup_p2p_ns_map() argument
1515 ctrl->p2p_client = get_device(p2p_client); in nvmet_setup_p2p_ns_map()
1517 nvmet_for_each_enabled_ns(&ctrl->subsys->namespaces, idx, ns) in nvmet_setup_p2p_ns_map()
1518 nvmet_p2pmem_ns_add_p2p(ctrl, ns); in nvmet_setup_p2p_ns_map()
1522 * Note: ctrl->subsys->lock should be held when calling this function
1524 static void nvmet_release_p2p_ns_map(struct nvmet_ctrl *ctrl) in nvmet_release_p2p_ns_map() argument
1529 radix_tree_for_each_slot(slot, &ctrl->p2p_ns_map, &iter, 0) in nvmet_release_p2p_ns_map()
1532 put_device(ctrl->p2p_client); in nvmet_release_p2p_ns_map()
1537 struct nvmet_ctrl *ctrl = in nvmet_fatal_error_handler() local
1540 pr_err("ctrl %d fatal error occurred!\n", ctrl->cntlid); in nvmet_fatal_error_handler()
1541 ctrl->ops->delete_ctrl(ctrl); in nvmet_fatal_error_handler()
1547 struct nvmet_ctrl *ctrl; in nvmet_alloc_ctrl() local
1575 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); in nvmet_alloc_ctrl()
1576 if (!ctrl) in nvmet_alloc_ctrl()
1578 mutex_init(&ctrl->lock); in nvmet_alloc_ctrl()
1580 ctrl->port = args->port; in nvmet_alloc_ctrl()
1581 ctrl->ops = args->ops; in nvmet_alloc_ctrl()
1585 if (ctrl->port->disc_addr.trtype == NVMF_TRTYPE_LOOP) in nvmet_alloc_ctrl()
1589 INIT_WORK(&ctrl->async_event_work, nvmet_async_event_work); in nvmet_alloc_ctrl()
1590 INIT_LIST_HEAD(&ctrl->async_events); in nvmet_alloc_ctrl()
1591 INIT_RADIX_TREE(&ctrl->p2p_ns_map, GFP_KERNEL); in nvmet_alloc_ctrl()
1592 INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler); in nvmet_alloc_ctrl()
1593 INIT_DELAYED_WORK(&ctrl->ka_work, nvmet_keep_alive_timer); in nvmet_alloc_ctrl()
1595 memcpy(ctrl->subsysnqn, args->subsysnqn, NVMF_NQN_SIZE); in nvmet_alloc_ctrl()
1596 memcpy(ctrl->hostnqn, args->hostnqn, NVMF_NQN_SIZE); in nvmet_alloc_ctrl()
1598 kref_init(&ctrl->ref); in nvmet_alloc_ctrl()
1599 ctrl->subsys = subsys; in nvmet_alloc_ctrl()
1600 ctrl->pi_support = ctrl->port->pi_enable && ctrl->subsys->pi_support; in nvmet_alloc_ctrl()
1601 nvmet_init_cap(ctrl); in nvmet_alloc_ctrl()
1602 WRITE_ONCE(ctrl->aen_enabled, NVMET_AEN_CFG_OPTIONAL); in nvmet_alloc_ctrl()
1604 ctrl->changed_ns_list = kmalloc_array(NVME_MAX_CHANGED_NAMESPACES, in nvmet_alloc_ctrl()
1606 if (!ctrl->changed_ns_list) in nvmet_alloc_ctrl()
1609 ctrl->sqs = kcalloc(subsys->max_qid + 1, in nvmet_alloc_ctrl()
1612 if (!ctrl->sqs) in nvmet_alloc_ctrl()
1622 ctrl->cntlid = ret; in nvmet_alloc_ctrl()
1628 if (nvmet_is_disc_subsys(ctrl->subsys) && !kato) in nvmet_alloc_ctrl()
1632 ctrl->kato = DIV_ROUND_UP(kato, 1000); in nvmet_alloc_ctrl()
1634 ctrl->err_counter = 0; in nvmet_alloc_ctrl()
1635 spin_lock_init(&ctrl->error_lock); in nvmet_alloc_ctrl()
1637 nvmet_start_keep_alive_timer(ctrl); in nvmet_alloc_ctrl()
1640 ret = nvmet_ctrl_init_pr(ctrl); in nvmet_alloc_ctrl()
1643 list_add_tail(&ctrl->subsys_entry, &subsys->ctrls); in nvmet_alloc_ctrl()
1644 nvmet_setup_p2p_ns_map(ctrl, args->p2p_client); in nvmet_alloc_ctrl()
1645 nvmet_debugfs_ctrl_setup(ctrl); in nvmet_alloc_ctrl()
1649 uuid_copy(&ctrl->hostid, args->hostid); in nvmet_alloc_ctrl()
1651 dhchap_status = nvmet_setup_auth(ctrl, args->sq); in nvmet_alloc_ctrl()
1655 nvmet_ctrl_put(ctrl); in nvmet_alloc_ctrl()
1667 nvmet_is_disc_subsys(ctrl->subsys) ? "discovery" : "nvm", in nvmet_alloc_ctrl()
1668 ctrl->cntlid, ctrl->subsys->subsysnqn, ctrl->hostnqn, in nvmet_alloc_ctrl()
1669 ctrl->pi_support ? " T10-PI is enabled" : "", in nvmet_alloc_ctrl()
1670 nvmet_has_auth(ctrl, args->sq) ? " with DH-HMAC-CHAP" : "", in nvmet_alloc_ctrl()
1673 return ctrl; in nvmet_alloc_ctrl()
1677 nvmet_stop_keep_alive_timer(ctrl); in nvmet_alloc_ctrl()
1678 ida_free(&cntlid_ida, ctrl->cntlid); in nvmet_alloc_ctrl()
1680 kfree(ctrl->sqs); in nvmet_alloc_ctrl()
1682 kfree(ctrl->changed_ns_list); in nvmet_alloc_ctrl()
1684 kfree(ctrl); in nvmet_alloc_ctrl()
1693 struct nvmet_ctrl *ctrl = container_of(ref, struct nvmet_ctrl, ref); in nvmet_ctrl_free() local
1694 struct nvmet_subsys *subsys = ctrl->subsys; in nvmet_ctrl_free()
1697 nvmet_ctrl_destroy_pr(ctrl); in nvmet_ctrl_free()
1698 nvmet_release_p2p_ns_map(ctrl); in nvmet_ctrl_free()
1699 list_del(&ctrl->subsys_entry); in nvmet_ctrl_free()
1702 nvmet_stop_keep_alive_timer(ctrl); in nvmet_ctrl_free()
1704 flush_work(&ctrl->async_event_work); in nvmet_ctrl_free()
1705 cancel_work_sync(&ctrl->fatal_err_work); in nvmet_ctrl_free()
1707 nvmet_destroy_auth(ctrl); in nvmet_ctrl_free()
1709 nvmet_debugfs_ctrl_free(ctrl); in nvmet_ctrl_free()
1711 ida_free(&cntlid_ida, ctrl->cntlid); in nvmet_ctrl_free()
1713 nvmet_async_events_free(ctrl); in nvmet_ctrl_free()
1714 kfree(ctrl->sqs); in nvmet_ctrl_free()
1715 kfree(ctrl->changed_ns_list); in nvmet_ctrl_free()
1716 kfree(ctrl); in nvmet_ctrl_free()
1721 void nvmet_ctrl_put(struct nvmet_ctrl *ctrl) in nvmet_ctrl_put() argument
1723 kref_put(&ctrl->ref, nvmet_ctrl_free); in nvmet_ctrl_put()
1727 void nvmet_ctrl_fatal_error(struct nvmet_ctrl *ctrl) in nvmet_ctrl_fatal_error() argument
1729 mutex_lock(&ctrl->lock); in nvmet_ctrl_fatal_error()
1730 if (!(ctrl->csts & NVME_CSTS_CFS)) { in nvmet_ctrl_fatal_error()
1731 ctrl->csts |= NVME_CSTS_CFS; in nvmet_ctrl_fatal_error()
1732 queue_work(nvmet_wq, &ctrl->fatal_err_work); in nvmet_ctrl_fatal_error()
1734 mutex_unlock(&ctrl->lock); in nvmet_ctrl_fatal_error()
1738 ssize_t nvmet_ctrl_host_traddr(struct nvmet_ctrl *ctrl, in nvmet_ctrl_host_traddr() argument
1741 if (!ctrl->ops->host_traddr) in nvmet_ctrl_host_traddr()
1743 return ctrl->ops->host_traddr(ctrl, traddr, traddr_len); in nvmet_ctrl_host_traddr()
1877 struct nvmet_ctrl *ctrl; in nvmet_subsys_del_ctrls() local
1880 list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) in nvmet_subsys_del_ctrls()
1881 ctrl->ops->delete_ctrl(ctrl); in nvmet_subsys_del_ctrls()