Lines Matching refs:snic

80 	struct snic *snic = shost_priv(sdev->host);  in snic_slave_configure()  local
89 if (snic->fwinfo.io_tmo > 1) in snic_slave_configure()
90 tmo = snic->fwinfo.io_tmo * HZ; in snic_slave_configure()
101 struct snic *snic = shost_priv(sdev->host); in snic_change_queue_depth() local
106 atomic64_inc(&snic->s_stats.misc.qsz_rampdown); in snic_change_queue_depth()
108 atomic64_inc(&snic->s_stats.misc.qsz_rampup); in snic_change_queue_depth()
110 atomic64_set(&snic->s_stats.misc.last_qsz, sdev->queue_depth); in snic_change_queue_depth()
142 snic_handle_link_event(struct snic *snic) in snic_handle_link_event() argument
146 spin_lock_irqsave(&snic->snic_lock, flags); in snic_handle_link_event()
147 if (snic->stop_link_events) { in snic_handle_link_event()
148 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_handle_link_event()
152 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_handle_link_event()
154 queue_work(snic_glob->event_q, &snic->link_work); in snic_handle_link_event()
164 snic_notify_set(struct snic *snic) in snic_notify_set() argument
169 intr_mode = svnic_dev_get_intr_mode(snic->vdev); in snic_notify_set()
172 ret = svnic_dev_notify_set(snic->vdev, SNIC_MSIX_ERR_NOTIFY); in snic_notify_set()
174 SNIC_HOST_ERR(snic->shost, in snic_notify_set()
228 snic_cleanup(struct snic *snic) in snic_cleanup() argument
233 svnic_dev_disable(snic->vdev); in snic_cleanup()
234 for (i = 0; i < snic->intr_count; i++) in snic_cleanup()
235 svnic_intr_mask(&snic->intr[i]); in snic_cleanup()
237 for (i = 0; i < snic->wq_count; i++) { in snic_cleanup()
238 ret = svnic_wq_disable(&snic->wq[i]); in snic_cleanup()
244 snic_fwcq_cmpl_handler(snic, -1); in snic_cleanup()
246 snic_wq_cmpl_handler(snic, -1); in snic_cleanup()
249 for (i = 0; i < snic->wq_count; i++) in snic_cleanup()
250 svnic_wq_clean(&snic->wq[i], snic_free_wq_buf); in snic_cleanup()
252 for (i = 0; i < snic->cq_count; i++) in snic_cleanup()
253 svnic_cq_clean(&snic->cq[i]); in snic_cleanup()
255 for (i = 0; i < snic->intr_count; i++) in snic_cleanup()
256 svnic_intr_clean(&snic->intr[i]); in snic_cleanup()
259 snic_free_all_untagged_reqs(snic); in snic_cleanup()
262 snic_shutdown_scsi_cleanup(snic); in snic_cleanup()
265 mempool_destroy(snic->req_pool[i]); in snic_cleanup()
272 snic_iounmap(struct snic *snic) in snic_iounmap() argument
274 if (snic->bar0.vaddr) in snic_iounmap()
275 iounmap(snic->bar0.vaddr); in snic_iounmap()
284 struct snic *snic = svnic_dev_priv(vdev); in snic_vdev_open_done() local
293 SNIC_HOST_INFO(snic->shost, "VNIC_DEV_OPEN Timedout.\n"); in snic_vdev_open_done()
341 snic_get_state(struct snic *snic) in snic_get_state() argument
343 return atomic_read(&snic->state); in snic_get_state()
347 snic_set_state(struct snic *snic, enum snic_state state) in snic_set_state() argument
349 SNIC_HOST_INFO(snic->shost, "snic state change from %s to %s\n", in snic_set_state()
350 snic_state_to_str(snic_get_state(snic)), in snic_set_state()
353 atomic_set(&snic->state, state); in snic_set_state()
363 struct snic *snic; in snic_probe() local
381 shost = scsi_host_alloc(&snic_host_template, sizeof(struct snic)); in snic_probe()
388 snic = shost_priv(shost); in snic_probe()
389 snic->shost = shost; in snic_probe()
391 snprintf(snic->name, sizeof(snic->name) - 1, "%s%d", SNIC_DRV_NAME, in snic_probe()
396 shost->host_no, snic, shost, pdev->bus->number, in snic_probe()
400 snic_stats_debugfs_init(snic); in snic_probe()
404 pci_set_drvdata(pdev, snic); in snic_probe()
405 snic->pdev = pdev; in snic_probe()
451 snic->bar0.vaddr = pci_iomap(pdev, 0, 0); in snic_probe()
452 if (!snic->bar0.vaddr) { in snic_probe()
460 snic->bar0.bus_addr = pci_resource_start(pdev, 0); in snic_probe()
461 snic->bar0.len = pci_resource_len(pdev, 0); in snic_probe()
462 SNIC_BUG_ON(snic->bar0.bus_addr == 0); in snic_probe()
465 snic->vdev = svnic_dev_alloc_discover(NULL, snic, pdev, &snic->bar0, 1); in snic_probe()
466 if (!snic->vdev) { in snic_probe()
473 ret = svnic_dev_cmd_init(snic->vdev, 0); in snic_probe()
480 ret = snic_dev_wait(snic->vdev, svnic_dev_open, snic_vdev_open_done, 0); in snic_probe()
489 ret = svnic_dev_init(snic->vdev, 0); in snic_probe()
499 ret = snic_get_vnic_config(snic); in snic_probe()
509 max_ios = snic->config.io_throttle_count; in snic_probe()
514 snic->max_tag_id = shost->can_queue; in snic_probe()
516 shost->max_lun = snic->config.luns_per_tgt; in snic_probe()
521 snic_get_res_counts(snic); in snic_probe()
526 ret = snic_set_intr_mode(snic); in snic_probe()
535 ret = snic_alloc_vnic_res(snic); in snic_probe()
545 INIT_LIST_HEAD(&snic->list); in snic_probe()
551 INIT_LIST_HEAD(&snic->spl_cmd_list); in snic_probe()
552 spin_lock_init(&snic->spl_cmd_lock); in snic_probe()
555 spin_lock_init(&snic->snic_lock); in snic_probe()
558 spin_lock_init(&snic->wq_lock[i]); in snic_probe()
561 spin_lock_init(&snic->io_req_lock[i]); in snic_probe()
572 snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL] = pool; in snic_probe()
583 snic->req_pool[SNIC_REQ_CACHE_MAX_SGL] = pool; in snic_probe()
594 snic->req_pool[SNIC_REQ_TM_CACHE] = pool; in snic_probe()
597 atomic_set(&snic->state, SNIC_INIT); in snic_probe()
599 atomic_set(&snic->ios_inflight, 0); in snic_probe()
602 ret = snic_notify_set(snic); in snic_probe()
612 list_add_tail(&snic->list, &snic_glob->snic_list); in snic_probe()
615 snic_disc_init(&snic->disc); in snic_probe()
616 INIT_WORK(&snic->tgt_work, snic_handle_tgt_disc); in snic_probe()
617 INIT_WORK(&snic->disc_work, snic_handle_disc); in snic_probe()
618 INIT_WORK(&snic->link_work, snic_handle_link); in snic_probe()
621 for (i = 0; i < snic->wq_count; i++) in snic_probe()
622 svnic_wq_enable(&snic->wq[i]); in snic_probe()
624 ret = svnic_dev_enable_wait(snic->vdev); in snic_probe()
633 ret = snic_request_intr(snic); in snic_probe()
640 for (i = 0; i < snic->intr_count; i++) in snic_probe()
641 svnic_intr_unmask(&snic->intr[i]); in snic_probe()
644 ret = snic_get_conf(snic); in snic_probe()
666 snic_set_state(snic, SNIC_ONLINE); in snic_probe()
668 ret = snic_disc_start(snic); in snic_probe()
681 snic_free_all_untagged_reqs(snic); in snic_probe()
683 for (i = 0; i < snic->intr_count; i++) in snic_probe()
684 svnic_intr_mask(&snic->intr[i]); in snic_probe()
686 snic_free_intr(snic); in snic_probe()
689 svnic_dev_disable(snic->vdev); in snic_probe()
692 svnic_dev_notify_unset(snic->vdev); in snic_probe()
694 for (i = 0; i < snic->wq_count; i++) { in snic_probe()
697 rc = svnic_wq_disable(&snic->wq[i]); in snic_probe()
705 snic_del_host(snic->shost); in snic_probe()
708 mempool_destroy(snic->req_pool[SNIC_REQ_TM_CACHE]); in snic_probe()
711 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_MAX_SGL]); in snic_probe()
714 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL]); in snic_probe()
717 snic_free_vnic_res(snic); in snic_probe()
720 snic_clear_intr_mode(snic); in snic_probe()
723 svnic_dev_close(snic->vdev); in snic_probe()
726 svnic_dev_unregister(snic->vdev); in snic_probe()
729 snic_iounmap(snic); in snic_probe()
739 snic_stats_debugfs_remove(snic); in snic_probe()
760 struct snic *snic = pci_get_drvdata(pdev); in snic_remove() local
763 if (!snic) { in snic_remove()
777 snic_set_state(snic, SNIC_OFFLINE); in snic_remove()
778 spin_lock_irqsave(&snic->snic_lock, flags); in snic_remove()
779 snic->stop_link_events = 1; in snic_remove()
780 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_remove()
783 snic_disc_term(snic); in snic_remove()
785 spin_lock_irqsave(&snic->snic_lock, flags); in snic_remove()
786 snic->in_remove = 1; in snic_remove()
787 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_remove()
794 snic_cleanup(snic); in snic_remove()
797 list_del(&snic->list); in snic_remove()
800 snic_tgt_del_all(snic); in snic_remove()
802 snic_stats_debugfs_remove(snic); in snic_remove()
804 snic_del_host(snic->shost); in snic_remove()
806 svnic_dev_notify_unset(snic->vdev); in snic_remove()
807 snic_free_intr(snic); in snic_remove()
808 snic_free_vnic_res(snic); in snic_remove()
809 snic_clear_intr_mode(snic); in snic_remove()
810 svnic_dev_close(snic->vdev); in snic_remove()
811 svnic_dev_unregister(snic->vdev); in snic_remove()
812 snic_iounmap(snic); in snic_remove()
818 scsi_host_put(snic->shost); in snic_remove()