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()
136 snic_handle_link_event(struct snic *snic) in snic_handle_link_event() argument
140 spin_lock_irqsave(&snic->snic_lock, flags); in snic_handle_link_event()
141 if (snic->stop_link_events) { in snic_handle_link_event()
142 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_handle_link_event()
146 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_handle_link_event()
148 queue_work(snic_glob->event_q, &snic->link_work); in snic_handle_link_event()
158 snic_notify_set(struct snic *snic) in snic_notify_set() argument
163 intr_mode = svnic_dev_get_intr_mode(snic->vdev); in snic_notify_set()
166 ret = svnic_dev_notify_set(snic->vdev, SNIC_MSIX_ERR_NOTIFY); in snic_notify_set()
168 SNIC_HOST_ERR(snic->shost, in snic_notify_set()
222 snic_cleanup(struct snic *snic) in snic_cleanup() argument
227 svnic_dev_disable(snic->vdev); in snic_cleanup()
228 for (i = 0; i < snic->intr_count; i++) in snic_cleanup()
229 svnic_intr_mask(&snic->intr[i]); in snic_cleanup()
231 for (i = 0; i < snic->wq_count; i++) { in snic_cleanup()
232 ret = svnic_wq_disable(&snic->wq[i]); in snic_cleanup()
238 snic_fwcq_cmpl_handler(snic, -1); in snic_cleanup()
240 snic_wq_cmpl_handler(snic, -1); in snic_cleanup()
243 for (i = 0; i < snic->wq_count; i++) in snic_cleanup()
244 svnic_wq_clean(&snic->wq[i], snic_free_wq_buf); in snic_cleanup()
246 for (i = 0; i < snic->cq_count; i++) in snic_cleanup()
247 svnic_cq_clean(&snic->cq[i]); in snic_cleanup()
249 for (i = 0; i < snic->intr_count; i++) in snic_cleanup()
250 svnic_intr_clean(&snic->intr[i]); in snic_cleanup()
253 snic_free_all_untagged_reqs(snic); in snic_cleanup()
256 snic_shutdown_scsi_cleanup(snic); in snic_cleanup()
259 mempool_destroy(snic->req_pool[i]); in snic_cleanup()
266 snic_iounmap(struct snic *snic) in snic_iounmap() argument
268 if (snic->bar0.vaddr) in snic_iounmap()
269 iounmap(snic->bar0.vaddr); in snic_iounmap()
278 struct snic *snic = svnic_dev_priv(vdev); in snic_vdev_open_done() local
287 SNIC_HOST_INFO(snic->shost, "VNIC_DEV_OPEN Timedout.\n"); in snic_vdev_open_done()
335 snic_get_state(struct snic *snic) in snic_get_state() argument
337 return atomic_read(&snic->state); in snic_get_state()
341 snic_set_state(struct snic *snic, enum snic_state state) in snic_set_state() argument
343 SNIC_HOST_INFO(snic->shost, "snic state change from %s to %s\n", in snic_set_state()
344 snic_state_to_str(snic_get_state(snic)), in snic_set_state()
347 atomic_set(&snic->state, state); in snic_set_state()
357 struct snic *snic; in snic_probe() local
375 shost = scsi_host_alloc(&snic_host_template, sizeof(struct snic)); in snic_probe()
382 snic = shost_priv(shost); in snic_probe()
383 snic->shost = shost; in snic_probe()
385 snprintf(snic->name, sizeof(snic->name) - 1, "%s%d", SNIC_DRV_NAME, in snic_probe()
390 shost->host_no, snic, shost, pdev->bus->number, in snic_probe()
394 ret = snic_stats_debugfs_init(snic); in snic_probe()
396 SNIC_HOST_ERR(snic->shost, in snic_probe()
398 snic_stats_debugfs_remove(snic); in snic_probe()
403 pci_set_drvdata(pdev, snic); in snic_probe()
404 snic->pdev = pdev; in snic_probe()
470 snic->bar0.vaddr = pci_iomap(pdev, 0, 0); in snic_probe()
471 if (!snic->bar0.vaddr) { in snic_probe()
479 snic->bar0.bus_addr = pci_resource_start(pdev, 0); in snic_probe()
480 snic->bar0.len = pci_resource_len(pdev, 0); in snic_probe()
481 SNIC_BUG_ON(snic->bar0.bus_addr == 0); in snic_probe()
484 snic->vdev = svnic_dev_alloc_discover(NULL, snic, pdev, &snic->bar0, 1); in snic_probe()
485 if (!snic->vdev) { in snic_probe()
492 ret = svnic_dev_cmd_init(snic->vdev, 0); in snic_probe()
499 ret = snic_dev_wait(snic->vdev, svnic_dev_open, snic_vdev_open_done, 0); in snic_probe()
508 ret = svnic_dev_init(snic->vdev, 0); in snic_probe()
518 ret = snic_get_vnic_config(snic); in snic_probe()
528 max_ios = snic->config.io_throttle_count; in snic_probe()
533 snic->max_tag_id = shost->can_queue; in snic_probe()
535 shost->max_lun = snic->config.luns_per_tgt; in snic_probe()
540 snic_get_res_counts(snic); in snic_probe()
545 ret = snic_set_intr_mode(snic); in snic_probe()
554 ret = snic_alloc_vnic_res(snic); in snic_probe()
564 INIT_LIST_HEAD(&snic->list); in snic_probe()
570 INIT_LIST_HEAD(&snic->spl_cmd_list); in snic_probe()
571 spin_lock_init(&snic->spl_cmd_lock); in snic_probe()
574 spin_lock_init(&snic->snic_lock); in snic_probe()
577 spin_lock_init(&snic->wq_lock[i]); in snic_probe()
580 spin_lock_init(&snic->io_req_lock[i]); in snic_probe()
591 snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL] = pool; in snic_probe()
602 snic->req_pool[SNIC_REQ_CACHE_MAX_SGL] = pool; in snic_probe()
613 snic->req_pool[SNIC_REQ_TM_CACHE] = pool; in snic_probe()
616 atomic_set(&snic->state, SNIC_INIT); in snic_probe()
618 atomic_set(&snic->ios_inflight, 0); in snic_probe()
621 ret = snic_notify_set(snic); in snic_probe()
644 list_add_tail(&snic->list, &snic_glob->snic_list); in snic_probe()
647 snic_disc_init(&snic->disc); in snic_probe()
648 INIT_WORK(&snic->tgt_work, snic_handle_tgt_disc); in snic_probe()
649 INIT_WORK(&snic->disc_work, snic_handle_disc); in snic_probe()
650 INIT_WORK(&snic->link_work, snic_handle_link); in snic_probe()
653 for (i = 0; i < snic->wq_count; i++) in snic_probe()
654 svnic_wq_enable(&snic->wq[i]); in snic_probe()
656 ret = svnic_dev_enable_wait(snic->vdev); in snic_probe()
665 ret = snic_request_intr(snic); in snic_probe()
672 for (i = 0; i < snic->intr_count; i++) in snic_probe()
673 svnic_intr_unmask(&snic->intr[i]); in snic_probe()
675 snic_set_state(snic, SNIC_ONLINE); in snic_probe()
678 ret = snic_get_conf(snic); in snic_probe()
687 ret = snic_disc_start(snic); in snic_probe()
700 snic_free_all_untagged_reqs(snic); in snic_probe()
702 for (i = 0; i < snic->intr_count; i++) in snic_probe()
703 svnic_intr_mask(&snic->intr[i]); in snic_probe()
705 snic_free_intr(snic); in snic_probe()
708 svnic_dev_disable(snic->vdev); in snic_probe()
711 for (i = 0; i < snic->wq_count; i++) { in snic_probe()
714 rc = svnic_wq_disable(&snic->wq[i]); in snic_probe()
722 snic_del_host(snic->shost); in snic_probe()
725 svnic_dev_notify_unset(snic->vdev); in snic_probe()
728 mempool_destroy(snic->req_pool[SNIC_REQ_TM_CACHE]); in snic_probe()
731 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_MAX_SGL]); in snic_probe()
734 mempool_destroy(snic->req_pool[SNIC_REQ_CACHE_DFLT_SGL]); in snic_probe()
737 snic_free_vnic_res(snic); in snic_probe()
740 snic_clear_intr_mode(snic); in snic_probe()
743 svnic_dev_close(snic->vdev); in snic_probe()
746 svnic_dev_unregister(snic->vdev); in snic_probe()
749 snic_iounmap(snic); in snic_probe()
759 snic_stats_debugfs_remove(snic); in snic_probe()
780 struct snic *snic = pci_get_drvdata(pdev); in snic_remove() local
783 if (!snic) { in snic_remove()
797 snic_set_state(snic, SNIC_OFFLINE); in snic_remove()
798 spin_lock_irqsave(&snic->snic_lock, flags); in snic_remove()
799 snic->stop_link_events = 1; in snic_remove()
800 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_remove()
803 snic_disc_term(snic); in snic_remove()
805 spin_lock_irqsave(&snic->snic_lock, flags); in snic_remove()
806 snic->in_remove = 1; in snic_remove()
807 spin_unlock_irqrestore(&snic->snic_lock, flags); in snic_remove()
814 snic_cleanup(snic); in snic_remove()
817 list_del(&snic->list); in snic_remove()
820 snic_tgt_del_all(snic); in snic_remove()
822 snic_stats_debugfs_remove(snic); in snic_remove()
824 snic_del_host(snic->shost); in snic_remove()
826 svnic_dev_notify_unset(snic->vdev); in snic_remove()
827 snic_free_intr(snic); in snic_remove()
828 snic_free_vnic_res(snic); in snic_remove()
829 snic_clear_intr_mode(snic); in snic_remove()
830 svnic_dev_close(snic->vdev); in snic_remove()
831 svnic_dev_unregister(snic->vdev); in snic_remove()
832 snic_iounmap(snic); in snic_remove()
838 scsi_host_put(snic->shost); in snic_remove()