Lines Matching refs:snic

66 	struct snic *snic = shost_priv(sdev->host);  in snic_slave_configure()  local
75 if (snic->fwinfo.io_tmo > 1) in snic_slave_configure()
76 tmo = snic->fwinfo.io_tmo * HZ; in snic_slave_configure()
87 struct snic *snic = shost_priv(sdev->host); in snic_change_queue_depth() local
92 atomic64_inc(&snic->s_stats.misc.qsz_rampdown); in snic_change_queue_depth()
94 atomic64_inc(&snic->s_stats.misc.qsz_rampup); in snic_change_queue_depth()
96 atomic64_set(&snic->s_stats.misc.last_qsz, sdev->queue_depth); in snic_change_queue_depth()
128 snic_handle_link_event(struct snic *snic) in snic_handle_link_event() argument
132 spin_lock_irqsave(&snic->snic_lock, flags); in snic_handle_link_event()
133 if (snic->stop_link_events) { in snic_handle_link_event()
134 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_handle_link_event()
138 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_handle_link_event()
140 queue_work(snic_glob->event_q, &snic->link_work); in snic_handle_link_event()
150 snic_notify_set(struct snic *snic) in snic_notify_set() argument
155 intr_mode = svnic_dev_get_intr_mode(snic->vdev); in snic_notify_set()
158 ret = svnic_dev_notify_set(snic->vdev, SNIC_MSIX_ERR_NOTIFY); in snic_notify_set()
160 SNIC_HOST_ERR(snic->shost, in snic_notify_set()
214 snic_cleanup(struct snic *snic) in snic_cleanup() argument
219 svnic_dev_disable(snic->vdev); in snic_cleanup()
220 for (i = 0; i < snic->intr_count; i++) in snic_cleanup()
221 svnic_intr_mask(&snic->intr[i]); in snic_cleanup()
223 for (i = 0; i < snic->wq_count; i++) { in snic_cleanup()
224 ret = svnic_wq_disable(&snic->wq[i]); in snic_cleanup()
230 snic_fwcq_cmpl_handler(snic, -1); in snic_cleanup()
232 snic_wq_cmpl_handler(snic, -1); in snic_cleanup()
235 for (i = 0; i < snic->wq_count; i++) in snic_cleanup()
236 svnic_wq_clean(&snic->wq[i], snic_free_wq_buf); in snic_cleanup()
238 for (i = 0; i < snic->cq_count; i++) in snic_cleanup()
239 svnic_cq_clean(&snic->cq[i]); in snic_cleanup()
241 for (i = 0; i < snic->intr_count; i++) in snic_cleanup()
242 svnic_intr_clean(&snic->intr[i]); in snic_cleanup()
245 snic_free_all_untagged_reqs(snic); in snic_cleanup()
248 snic_shutdown_scsi_cleanup(snic); in snic_cleanup()
251 mempool_destroy(snic->req_pool[i]); in snic_cleanup()
258 snic_iounmap(struct snic *snic) in snic_iounmap() argument
260 if (snic->bar0.vaddr) in snic_iounmap()
261 iounmap(snic->bar0.vaddr); in snic_iounmap()
270 struct snic *snic = svnic_dev_priv(vdev); in snic_vdev_open_done() local
279 SNIC_HOST_INFO(snic->shost, "VNIC_DEV_OPEN Timedout.\n"); in snic_vdev_open_done()
326 snic_get_state(struct snic *snic) in snic_get_state() argument
328 return atomic_read(&snic->state); in snic_get_state()
332 snic_set_state(struct snic *snic, enum snic_state state) in snic_set_state() argument
334 SNIC_HOST_INFO(snic->shost, "snic state change from %s to %s\n", in snic_set_state()
335 snic_state_to_str(snic_get_state(snic)), in snic_set_state()
338 atomic_set(&snic->state, state); in snic_set_state()
348 struct snic *snic; in snic_probe() local
366 shost = scsi_host_alloc(&snic_host_template, sizeof(struct snic)); in snic_probe()
373 snic = shost_priv(shost); in snic_probe()
374 snic->shost = shost; in snic_probe()
376 snprintf(snic->name, sizeof(snic->name) - 1, "%s%d", SNIC_DRV_NAME, in snic_probe()
381 shost->host_no, snic, shost, pdev->bus->number, in snic_probe()
385 snic_stats_debugfs_init(snic); in snic_probe()
389 pci_set_drvdata(pdev, snic); in snic_probe()
390 snic->pdev = pdev; in snic_probe()
436 snic->bar0.vaddr = pci_iomap(pdev, 0, 0); in snic_probe()
437 if (!snic->bar0.vaddr) { in snic_probe()
445 snic->bar0.bus_addr = pci_resource_start(pdev, 0); in snic_probe()
446 snic->bar0.len = pci_resource_len(pdev, 0); in snic_probe()
447 SNIC_BUG_ON(snic->bar0.bus_addr == 0); in snic_probe()
450 snic->vdev = svnic_dev_alloc_discover(NULL, snic, pdev, &snic->bar0, 1); in snic_probe()
451 if (!snic->vdev) { in snic_probe()
458 ret = svnic_dev_cmd_init(snic->vdev, 0); in snic_probe()
465 ret = snic_dev_wait(snic->vdev, svnic_dev_open, snic_vdev_open_done, 0); in snic_probe()
474 ret = svnic_dev_init(snic->vdev, 0); in snic_probe()
484 ret = snic_get_vnic_config(snic); in snic_probe()
494 max_ios = snic->config.io_throttle_count; in snic_probe()
499 snic->max_tag_id = shost->can_queue; in snic_probe()
501 shost->max_lun = snic->config.luns_per_tgt; in snic_probe()
506 snic_get_res_counts(snic); in snic_probe()
511 ret = snic_set_intr_mode(snic); in snic_probe()
520 ret = snic_alloc_vnic_res(snic); in snic_probe()
530 INIT_LIST_HEAD(&snic->list); in snic_probe()
536 INIT_LIST_HEAD(&snic->spl_cmd_list); in snic_probe()
537 spin_lock_init(&snic->spl_cmd_lock); in snic_probe()
540 spin_lock_init(&snic->snic_lock); in snic_probe()
543 spin_lock_init(&snic->wq_lock[i]); in snic_probe()
546 spin_lock_init(&snic->io_req_lock[i]); in snic_probe()
557 snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL] = pool; in snic_probe()
568 snic->req_pool[SNIC_REQ_CACHE_MAX_SGL] = pool; in snic_probe()
579 snic->req_pool[SNIC_REQ_TM_CACHE] = pool; in snic_probe()
582 atomic_set(&snic->state, SNIC_INIT); in snic_probe()
584 atomic_set(&snic->ios_inflight, 0); in snic_probe()
587 ret = snic_notify_set(snic); in snic_probe()
597 list_add_tail(&snic->list, &snic_glob->snic_list); in snic_probe()
600 snic_disc_init(&snic->disc); in snic_probe()
601 INIT_WORK(&snic->tgt_work, snic_handle_tgt_disc); in snic_probe()
602 INIT_WORK(&snic->disc_work, snic_handle_disc); in snic_probe()
603 INIT_WORK(&snic->link_work, snic_handle_link); in snic_probe()
606 for (i = 0; i < snic->wq_count; i++) in snic_probe()
607 svnic_wq_enable(&snic->wq[i]); in snic_probe()
609 ret = svnic_dev_enable_wait(snic->vdev); in snic_probe()
618 ret = snic_request_intr(snic); in snic_probe()
625 for (i = 0; i < snic->intr_count; i++) in snic_probe()
626 svnic_intr_unmask(&snic->intr[i]); in snic_probe()
629 ret = snic_get_conf(snic); in snic_probe()
651 snic_set_state(snic, SNIC_ONLINE); in snic_probe()
653 ret = snic_disc_start(snic); in snic_probe()
666 snic_free_all_untagged_reqs(snic); in snic_probe()
668 for (i = 0; i < snic->intr_count; i++) in snic_probe()
669 svnic_intr_mask(&snic->intr[i]); in snic_probe()
671 snic_free_intr(snic); in snic_probe()
674 svnic_dev_disable(snic->vdev); in snic_probe()
677 svnic_dev_notify_unset(snic->vdev); in snic_probe()
679 for (i = 0; i < snic->wq_count; i++) { in snic_probe()
682 rc = svnic_wq_disable(&snic->wq[i]); in snic_probe()
690 snic_del_host(snic->shost); in snic_probe()
693 mempool_destroy(snic->req_pool[SNIC_REQ_TM_CACHE]); in snic_probe()
696 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_MAX_SGL]); in snic_probe()
699 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL]); in snic_probe()
702 snic_free_vnic_res(snic); in snic_probe()
705 snic_clear_intr_mode(snic); in snic_probe()
708 svnic_dev_close(snic->vdev); in snic_probe()
711 svnic_dev_unregister(snic->vdev); in snic_probe()
714 snic_iounmap(snic); in snic_probe()
724 snic_stats_debugfs_remove(snic); in snic_probe()
745 struct snic *snic = pci_get_drvdata(pdev); in snic_remove() local
748 if (!snic) { in snic_remove()
762 snic_set_state(snic, SNIC_OFFLINE); in snic_remove()
763 spin_lock_irqsave(&snic->snic_lock, flags); in snic_remove()
764 snic->stop_link_events = 1; in snic_remove()
765 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_remove()
768 snic_disc_term(snic); in snic_remove()
770 spin_lock_irqsave(&snic->snic_lock, flags); in snic_remove()
771 snic->in_remove = 1; in snic_remove()
772 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_remove()
779 snic_cleanup(snic); in snic_remove()
782 list_del(&snic->list); in snic_remove()
785 snic_tgt_del_all(snic); in snic_remove()
787 snic_stats_debugfs_remove(snic); in snic_remove()
789 snic_del_host(snic->shost); in snic_remove()
791 svnic_dev_notify_unset(snic->vdev); in snic_remove()
792 snic_free_intr(snic); in snic_remove()
793 snic_free_vnic_res(snic); in snic_remove()
794 snic_clear_intr_mode(snic); in snic_remove()
795 svnic_dev_close(snic->vdev); in snic_remove()
796 svnic_dev_unregister(snic->vdev); in snic_remove()
797 snic_iounmap(snic); in snic_remove()
803 scsi_host_put(snic->shost); in snic_remove()