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()
327 snic_get_state(struct snic *snic) in snic_get_state() argument
329 return atomic_read(&snic->state); in snic_get_state()
333 snic_set_state(struct snic *snic, enum snic_state state) in snic_set_state() argument
335 SNIC_HOST_INFO(snic->shost, "snic state change from %s to %s\n", in snic_set_state()
336 snic_state_to_str(snic_get_state(snic)), in snic_set_state()
339 atomic_set(&snic->state, state); in snic_set_state()
349 struct snic *snic; in snic_probe() local
367 shost = scsi_host_alloc(&snic_host_template, sizeof(struct snic)); in snic_probe()
374 snic = shost_priv(shost); in snic_probe()
375 snic->shost = shost; in snic_probe()
377 snprintf(snic->name, sizeof(snic->name) - 1, "%s%d", SNIC_DRV_NAME, in snic_probe()
382 shost->host_no, snic, shost, pdev->bus->number, in snic_probe()
386 snic_stats_debugfs_init(snic); in snic_probe()
390 pci_set_drvdata(pdev, snic); in snic_probe()
391 snic->pdev = pdev; in snic_probe()
437 snic->bar0.vaddr = pci_iomap(pdev, 0, 0); in snic_probe()
438 if (!snic->bar0.vaddr) { in snic_probe()
446 snic->bar0.bus_addr = pci_resource_start(pdev, 0); in snic_probe()
447 snic->bar0.len = pci_resource_len(pdev, 0); in snic_probe()
448 SNIC_BUG_ON(snic->bar0.bus_addr == 0); in snic_probe()
451 snic->vdev = svnic_dev_alloc_discover(NULL, snic, pdev, &snic->bar0, 1); in snic_probe()
452 if (!snic->vdev) { in snic_probe()
459 ret = svnic_dev_cmd_init(snic->vdev, 0); in snic_probe()
466 ret = snic_dev_wait(snic->vdev, svnic_dev_open, snic_vdev_open_done, 0); in snic_probe()
475 ret = svnic_dev_init(snic->vdev, 0); in snic_probe()
485 ret = snic_get_vnic_config(snic); in snic_probe()
495 max_ios = snic->config.io_throttle_count; in snic_probe()
500 snic->max_tag_id = shost->can_queue; in snic_probe()
502 shost->max_lun = snic->config.luns_per_tgt; in snic_probe()
507 snic_get_res_counts(snic); in snic_probe()
512 ret = snic_set_intr_mode(snic); in snic_probe()
521 ret = snic_alloc_vnic_res(snic); in snic_probe()
531 INIT_LIST_HEAD(&snic->list); in snic_probe()
537 INIT_LIST_HEAD(&snic->spl_cmd_list); in snic_probe()
538 spin_lock_init(&snic->spl_cmd_lock); in snic_probe()
541 spin_lock_init(&snic->snic_lock); in snic_probe()
544 spin_lock_init(&snic->wq_lock[i]); in snic_probe()
547 spin_lock_init(&snic->io_req_lock[i]); in snic_probe()
558 snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL] = pool; in snic_probe()
569 snic->req_pool[SNIC_REQ_CACHE_MAX_SGL] = pool; in snic_probe()
580 snic->req_pool[SNIC_REQ_TM_CACHE] = pool; in snic_probe()
583 atomic_set(&snic->state, SNIC_INIT); in snic_probe()
585 atomic_set(&snic->ios_inflight, 0); in snic_probe()
588 ret = snic_notify_set(snic); in snic_probe()
598 list_add_tail(&snic->list, &snic_glob->snic_list); in snic_probe()
601 snic_disc_init(&snic->disc); in snic_probe()
602 INIT_WORK(&snic->tgt_work, snic_handle_tgt_disc); in snic_probe()
603 INIT_WORK(&snic->disc_work, snic_handle_disc); in snic_probe()
604 INIT_WORK(&snic->link_work, snic_handle_link); in snic_probe()
607 for (i = 0; i < snic->wq_count; i++) in snic_probe()
608 svnic_wq_enable(&snic->wq[i]); in snic_probe()
610 ret = svnic_dev_enable_wait(snic->vdev); in snic_probe()
619 ret = snic_request_intr(snic); in snic_probe()
626 for (i = 0; i < snic->intr_count; i++) in snic_probe()
627 svnic_intr_unmask(&snic->intr[i]); in snic_probe()
630 ret = snic_get_conf(snic); in snic_probe()
652 snic_set_state(snic, SNIC_ONLINE); in snic_probe()
654 ret = snic_disc_start(snic); in snic_probe()
667 snic_free_all_untagged_reqs(snic); in snic_probe()
669 for (i = 0; i < snic->intr_count; i++) in snic_probe()
670 svnic_intr_mask(&snic->intr[i]); in snic_probe()
672 snic_free_intr(snic); in snic_probe()
675 svnic_dev_disable(snic->vdev); in snic_probe()
678 svnic_dev_notify_unset(snic->vdev); in snic_probe()
680 for (i = 0; i < snic->wq_count; i++) { in snic_probe()
683 rc = svnic_wq_disable(&snic->wq[i]); in snic_probe()
691 snic_del_host(snic->shost); in snic_probe()
694 mempool_destroy(snic->req_pool[SNIC_REQ_TM_CACHE]); in snic_probe()
697 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_MAX_SGL]); in snic_probe()
700 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL]); in snic_probe()
703 snic_free_vnic_res(snic); in snic_probe()
706 snic_clear_intr_mode(snic); in snic_probe()
709 svnic_dev_close(snic->vdev); in snic_probe()
712 svnic_dev_unregister(snic->vdev); in snic_probe()
715 snic_iounmap(snic); in snic_probe()
725 snic_stats_debugfs_remove(snic); in snic_probe()
746 struct snic *snic = pci_get_drvdata(pdev); in snic_remove() local
749 if (!snic) { in snic_remove()
763 snic_set_state(snic, SNIC_OFFLINE); in snic_remove()
764 spin_lock_irqsave(&snic->snic_lock, flags); in snic_remove()
765 snic->stop_link_events = 1; in snic_remove()
766 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_remove()
769 snic_disc_term(snic); in snic_remove()
771 spin_lock_irqsave(&snic->snic_lock, flags); in snic_remove()
772 snic->in_remove = 1; in snic_remove()
773 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_remove()
780 snic_cleanup(snic); in snic_remove()
783 list_del(&snic->list); in snic_remove()
786 snic_tgt_del_all(snic); in snic_remove()
788 snic_stats_debugfs_remove(snic); in snic_remove()
790 snic_del_host(snic->shost); in snic_remove()
792 svnic_dev_notify_unset(snic->vdev); in snic_remove()
793 snic_free_intr(snic); in snic_remove()
794 snic_free_vnic_res(snic); in snic_remove()
795 snic_clear_intr_mode(snic); in snic_remove()
796 svnic_dev_close(snic->vdev); in snic_remove()
797 svnic_dev_unregister(snic->vdev); in snic_remove()
798 snic_iounmap(snic); in snic_remove()
804 scsi_host_put(snic->shost); in snic_remove()