Lines Matching refs:fnic
183 struct fnic *fnic = *((struct fnic **) shost_priv(shost)); in fnic_get_host_speed() local
184 u32 port_speed = vnic_dev_port_speed(fnic->vdev); in fnic_get_host_speed()
185 struct fnic_stats *fnic_stats = &fnic->fnic_stats; in fnic_get_host_speed()
187 FNIC_MAIN_DBG(KERN_INFO, fnic->host, fnic->fnic_num, in fnic_get_host_speed()
237 FNIC_MAIN_DBG(KERN_INFO, fnic->host, fnic->fnic_num, in fnic_get_host_speed()
248 struct fnic *fnic = *((struct fnic **) shost_priv(host)); in fnic_get_stats() local
249 struct fc_host_statistics *stats = &fnic->fnic_stats.host_stats; in fnic_get_stats()
254 (jiffies, fnic->stats_time + HZ / FNIC_STATS_RATE_LIMIT)) in fnic_get_stats()
256 fnic->stats_time = jiffies; in fnic_get_stats()
258 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_get_stats()
259 ret = vnic_dev_stats_dump(fnic->vdev, &fnic->stats); in fnic_get_stats()
260 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_get_stats()
263 FNIC_MAIN_DBG(KERN_DEBUG, fnic->host, fnic->fnic_num, in fnic_get_stats()
267 vs = fnic->stats; in fnic_get_stats()
276 (jiffies - fnic->stats_reset_time) / HZ; in fnic_get_stats()
277 stats->fcp_input_megabytes = div_u64(fnic->fcp_input_bytes, 1000000); in fnic_get_stats()
278 stats->fcp_output_megabytes = div_u64(fnic->fcp_output_bytes, 1000000); in fnic_get_stats()
359 struct fnic *fnic = *((struct fnic **) shost_priv(host)); in fnic_reset_host_stats() local
367 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_reset_host_stats()
368 ret = vnic_dev_stats_clear(fnic->vdev); in fnic_reset_host_stats()
369 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_reset_host_stats()
372 FNIC_MAIN_DBG(KERN_DEBUG, fnic->host, fnic->fnic_num, in fnic_reset_host_stats()
377 fnic->stats_reset_time = jiffies; in fnic_reset_host_stats()
383 void fnic_log_q_error(struct fnic *fnic) in fnic_log_q_error() argument
388 for (i = 0; i < fnic->raw_wq_count; i++) { in fnic_log_q_error()
389 error_status = ioread32(&fnic->wq[i].ctrl->error_status); in fnic_log_q_error()
391 dev_err(&fnic->pdev->dev, "WQ[%d] error_status %d\n", i, error_status); in fnic_log_q_error()
394 for (i = 0; i < fnic->rq_count; i++) { in fnic_log_q_error()
395 error_status = ioread32(&fnic->rq[i].ctrl->error_status); in fnic_log_q_error()
397 dev_err(&fnic->pdev->dev, "RQ[%d] error_status %d\n", i, error_status); in fnic_log_q_error()
400 for (i = 0; i < fnic->wq_copy_count; i++) { in fnic_log_q_error()
401 error_status = ioread32(&fnic->hw_copy_wq[i].ctrl->error_status); in fnic_log_q_error()
403 dev_err(&fnic->pdev->dev, "CWQ[%d] error_status %d\n", i, error_status); in fnic_log_q_error()
407 void fnic_handle_link_event(struct fnic *fnic) in fnic_handle_link_event() argument
411 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_handle_link_event()
412 if (fnic->stop_rx_link_events) { in fnic_handle_link_event()
413 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_handle_link_event()
416 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_handle_link_event()
418 queue_work(fnic_event_queue, &fnic->link_work); in fnic_handle_link_event()
422 static int fnic_notify_set(struct fnic *fnic) in fnic_notify_set() argument
426 switch (vnic_dev_get_intr_mode(fnic->vdev)) { in fnic_notify_set()
428 err = vnic_dev_notify_set(fnic->vdev, FNIC_INTX_NOTIFY); in fnic_notify_set()
431 err = vnic_dev_notify_set(fnic->vdev, -1); in fnic_notify_set()
434 err = vnic_dev_notify_set(fnic->vdev, fnic->wq_copy_count + fnic->copy_wq_base); in fnic_notify_set()
437 dev_err(&fnic->pdev->dev, "Interrupt mode should be set up" in fnic_notify_set()
439 vnic_dev_get_intr_mode(fnic->vdev)); in fnic_notify_set()
449 struct fnic *fnic = from_timer(fnic, t, notify_timer); in fnic_notify_timer() local
451 fnic_handle_link_event(fnic); in fnic_notify_timer()
452 mod_timer(&fnic->notify_timer, in fnic_notify_timer()
456 static void fnic_notify_timer_start(struct fnic *fnic) in fnic_notify_timer_start() argument
458 switch (vnic_dev_get_intr_mode(fnic->vdev)) { in fnic_notify_timer_start()
464 mod_timer(&fnic->notify_timer, jiffies); in fnic_notify_timer_start()
508 static int fnic_cleanup(struct fnic *fnic) in fnic_cleanup() argument
514 vnic_dev_disable(fnic->vdev); in fnic_cleanup()
515 for (i = 0; i < fnic->intr_count; i++) in fnic_cleanup()
516 vnic_intr_mask(&fnic->intr[i]); in fnic_cleanup()
518 for (i = 0; i < fnic->rq_count; i++) { in fnic_cleanup()
519 err = vnic_rq_disable(&fnic->rq[i]); in fnic_cleanup()
523 for (i = 0; i < fnic->raw_wq_count; i++) { in fnic_cleanup()
524 err = vnic_wq_disable(&fnic->wq[i]); in fnic_cleanup()
528 for (i = 0; i < fnic->wq_copy_count; i++) { in fnic_cleanup()
529 err = vnic_wq_copy_disable(&fnic->hw_copy_wq[i]); in fnic_cleanup()
532 raw_wq_rq_counts = fnic->raw_wq_count + fnic->rq_count; in fnic_cleanup()
533 fnic_wq_copy_cmpl_handler(fnic, -1, i + raw_wq_rq_counts); in fnic_cleanup()
537 fnic_wq_cmpl_handler(fnic, -1); in fnic_cleanup()
538 fnic_rq_cmpl_handler(fnic, -1); in fnic_cleanup()
541 for (i = 0; i < fnic->raw_wq_count; i++) in fnic_cleanup()
542 vnic_wq_clean(&fnic->wq[i], fnic_free_wq_buf); in fnic_cleanup()
543 for (i = 0; i < fnic->rq_count; i++) in fnic_cleanup()
544 vnic_rq_clean(&fnic->rq[i], fnic_free_rq_buf); in fnic_cleanup()
545 for (i = 0; i < fnic->wq_copy_count; i++) in fnic_cleanup()
546 vnic_wq_copy_clean(&fnic->hw_copy_wq[i], in fnic_cleanup()
549 for (i = 0; i < fnic->cq_count; i++) in fnic_cleanup()
550 vnic_cq_clean(&fnic->cq[i]); in fnic_cleanup()
551 for (i = 0; i < fnic->intr_count; i++) in fnic_cleanup()
552 vnic_intr_clean(&fnic->intr[i]); in fnic_cleanup()
554 mempool_destroy(fnic->io_req_pool); in fnic_cleanup()
555 mempool_destroy(fnic->frame_pool); in fnic_cleanup()
556 mempool_destroy(fnic->frame_elem_pool); in fnic_cleanup()
558 mempool_destroy(fnic->io_sgl_pool[i]); in fnic_cleanup()
563 static void fnic_iounmap(struct fnic *fnic) in fnic_iounmap() argument
565 if (fnic->bar0.vaddr) in fnic_iounmap()
566 iounmap(fnic->bar0.vaddr); in fnic_iounmap()
569 static void fnic_set_vlan(struct fnic *fnic, u16 vlan_id) in fnic_set_vlan() argument
571 vnic_dev_set_default_vlan(fnic->vdev, vlan_id); in fnic_set_vlan()
574 static void fnic_scsi_init(struct fnic *fnic) in fnic_scsi_init() argument
576 struct Scsi_Host *host = fnic->host; in fnic_scsi_init()
578 snprintf(fnic->name, sizeof(fnic->name) - 1, "%s%d", DRV_NAME, in fnic_scsi_init()
584 static void fnic_free_ioreq_tables_mq(struct fnic *fnic) in fnic_free_ioreq_tables_mq() argument
588 for (hwq = 0; hwq < fnic->wq_copy_count; hwq++) in fnic_free_ioreq_tables_mq()
589 kfree(fnic->sw_copy_wq[hwq].io_req_table); in fnic_free_ioreq_tables_mq()
592 static int fnic_scsi_drv_init(struct fnic *fnic) in fnic_scsi_drv_init() argument
594 struct Scsi_Host *host = fnic->host; in fnic_scsi_drv_init()
596 struct pci_dev *pdev = fnic->pdev; in fnic_scsi_drv_init()
597 struct fnic_iport_s *iport = &fnic->iport; in fnic_scsi_drv_init()
601 if (fnic->config.io_throttle_count != FNIC_UCSM_DFLT_THROTTLE_CNT_BLD) in fnic_scsi_drv_init()
604 fnic->config.io_throttle_count)); in fnic_scsi_drv_init()
606 fnic->fnic_max_tag_id = host->can_queue; in fnic_scsi_drv_init()
607 host->max_lun = fnic->config.luns_per_tgt; in fnic_scsi_drv_init()
611 host->nr_hw_queues = fnic->wq_copy_count; in fnic_scsi_drv_init()
613 dev_info(&fnic->pdev->dev, "fnic: can_queue: %d max_lun: %llu", in fnic_scsi_drv_init()
616 dev_info(&fnic->pdev->dev, "fnic: max_id: %d max_cmd_len: %d nr_hw_queues: %d", in fnic_scsi_drv_init()
619 for (hwq = 0; hwq < fnic->wq_copy_count; hwq++) { in fnic_scsi_drv_init()
620 fnic->sw_copy_wq[hwq].ioreq_table_size = fnic->fnic_max_tag_id; in fnic_scsi_drv_init()
621 fnic->sw_copy_wq[hwq].io_req_table = in fnic_scsi_drv_init()
622 kzalloc((fnic->sw_copy_wq[hwq].ioreq_table_size + 1) * in fnic_scsi_drv_init()
625 if (!fnic->sw_copy_wq[hwq].io_req_table) { in fnic_scsi_drv_init()
626 fnic_free_ioreq_tables_mq(fnic); in fnic_scsi_drv_init()
631 dev_info(&fnic->pdev->dev, "fnic copy wqs: %d, Q0 ioreq table size: %d\n", in fnic_scsi_drv_init()
632 fnic->wq_copy_count, fnic->sw_copy_wq[0].ioreq_table_size); in fnic_scsi_drv_init()
634 fnic_scsi_init(fnic); in fnic_scsi_drv_init()
636 err = scsi_add_host(fnic->host, &pdev->dev); in fnic_scsi_drv_init()
638 dev_err(&fnic->pdev->dev, "fnic: scsi add host failed: aborting\n"); in fnic_scsi_drv_init()
641 fc_host_maxframe_size(fnic->host) = iport->max_payload_size; in fnic_scsi_drv_init()
642 fc_host_dev_loss_tmo(fnic->host) = in fnic_scsi_drv_init()
643 fnic->config.port_down_timeout / 1000; in fnic_scsi_drv_init()
644 sprintf(fc_host_symbolic_name(fnic->host), in fnic_scsi_drv_init()
645 DRV_NAME " v" DRV_VERSION " over %s", fnic->name); in fnic_scsi_drv_init()
646 fc_host_port_type(fnic->host) = FC_PORTTYPE_NPORT; in fnic_scsi_drv_init()
647 fc_host_node_name(fnic->host) = iport->wwnn; in fnic_scsi_drv_init()
648 fc_host_port_name(fnic->host) = iport->wwpn; in fnic_scsi_drv_init()
649 fc_host_supported_classes(fnic->host) = FC_COS_CLASS3; in fnic_scsi_drv_init()
650 memset(fc_host_supported_fc4s(fnic->host), 0, in fnic_scsi_drv_init()
651 sizeof(fc_host_supported_fc4s(fnic->host))); in fnic_scsi_drv_init()
652 fc_host_supported_fc4s(fnic->host)[2] = 1; in fnic_scsi_drv_init() local
653 fc_host_supported_fc4s(fnic->host)[7] = 1; in fnic_scsi_drv_init() local
654 fc_host_supported_speeds(fnic->host) = 0; in fnic_scsi_drv_init()
655 fc_host_supported_speeds(fnic->host) |= FC_PORTSPEED_8GBIT; in fnic_scsi_drv_init()
657 dev_info(&fnic->pdev->dev, "shost_data: 0x%p\n", fnic->host->shost_data); in fnic_scsi_drv_init()
658 if (fnic->host->shost_data != NULL) { in fnic_scsi_drv_init()
660 dev_info(&fnic->pdev->dev, "Setting target binding to NONE\n"); in fnic_scsi_drv_init()
661 fc_host_tgtid_bind_type(fnic->host) = FC_TGTID_BIND_NONE; in fnic_scsi_drv_init()
663 dev_info(&fnic->pdev->dev, "Setting target binding to WWPN\n"); in fnic_scsi_drv_init()
664 fc_host_tgtid_bind_type(fnic->host) = FC_TGTID_BIND_BY_WWPN; in fnic_scsi_drv_init()
668 fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache); in fnic_scsi_drv_init()
669 if (!fnic->io_req_pool) { in fnic_scsi_drv_init()
670 scsi_remove_host(fnic->host); in fnic_scsi_drv_init()
679 struct fnic *fnic = *((struct fnic **) shost_priv(host)); in fnic_mq_map_queues_cpus() local
680 struct pci_dev *l_pdev = fnic->pdev; in fnic_mq_map_queues_cpus()
681 int intr_mode = fnic->config.intr_mode; in fnic_mq_map_queues_cpus()
685 FNIC_MAIN_DBG(KERN_ERR, fnic->host, fnic->fnic_num, in fnic_mq_map_queues_cpus()
690 FNIC_MAIN_DBG(KERN_INFO, fnic->host, fnic->fnic_num, in fnic_mq_map_queues_cpus()
694 FNIC_MAIN_DBG(KERN_ERR, fnic->host, fnic->fnic_num, in fnic_mq_map_queues_cpus()
705 struct fnic *fnic; in fnic_probe() local
718 fnic = kzalloc(sizeof(struct fnic), GFP_KERNEL); in fnic_probe()
719 if (!fnic) { in fnic_probe()
724 iport = &fnic->iport; in fnic_probe()
733 fnic->pdev = pdev; in fnic_probe()
734 fnic->fnic_num = fnic_id; in fnic_probe()
738 dev_info(&fnic->pdev->dev, "Model: %s\n", subsys_desc); in fnic_probe()
741 fnic->subsys_desc_len = strlen(subsys_desc); in fnic_probe()
742 len = ARRAY_SIZE(fnic->subsys_desc); in fnic_probe()
743 if (fnic->subsys_desc_len > len) in fnic_probe()
744 fnic->subsys_desc_len = len; in fnic_probe()
745 memcpy(fnic->subsys_desc, subsys_desc, fnic->subsys_desc_len); in fnic_probe()
746 dev_info(&fnic->pdev->dev, "FDMI Model: %s\n", fnic->subsys_desc); in fnic_probe()
748 fnic->subsys_desc_len = 0; in fnic_probe()
749 dev_info(&fnic->pdev->dev, "Model: %s subsys_id: 0x%04x\n", "Unknown", in fnic_probe()
755 dev_err(&fnic->pdev->dev, "Cannot enable PCI device, aborting.\n"); in fnic_probe()
761 dev_err(&fnic->pdev->dev, "Cannot enable PCI resources, aborting\n"); in fnic_probe()
775 dev_err(&fnic->pdev->dev, "No usable DMA configuration " in fnic_probe()
783 dev_err(&fnic->pdev->dev, "BAR0 not memory-map'able, aborting.\n"); in fnic_probe()
788 fnic->bar0.vaddr = pci_iomap(pdev, 0, 0); in fnic_probe()
789 fnic->bar0.bus_addr = pci_resource_start(pdev, 0); in fnic_probe()
790 fnic->bar0.len = pci_resource_len(pdev, 0); in fnic_probe()
792 if (!fnic->bar0.vaddr) { in fnic_probe()
793 dev_err(&fnic->pdev->dev, "Cannot memory-map BAR0 res hdr, " in fnic_probe()
799 fnic->vdev = vnic_dev_register(NULL, fnic, pdev, &fnic->bar0); in fnic_probe()
800 if (!fnic->vdev) { in fnic_probe()
801 dev_err(&fnic->pdev->dev, "vNIC registration failed, " in fnic_probe()
807 err = vnic_dev_cmd_init(fnic->vdev); in fnic_probe()
809 dev_err(&fnic->pdev->dev, "vnic_dev_cmd_init() returns %d, aborting\n", in fnic_probe()
814 err = fnic_dev_wait(fnic->vdev, vnic_dev_open, in fnic_probe()
817 dev_err(&fnic->pdev->dev, "vNIC dev open failed, aborting.\n"); in fnic_probe()
821 err = vnic_dev_init(fnic->vdev, 0); in fnic_probe()
823 dev_err(&fnic->pdev->dev, "vNIC dev init failed, aborting.\n"); in fnic_probe()
827 err = vnic_dev_mac_addr(fnic->vdev, iport->hwmac); in fnic_probe()
829 dev_err(&fnic->pdev->dev, "vNIC get MAC addr failed\n"); in fnic_probe()
833 memcpy(fnic->data_src_addr, iport->hwmac, ETH_ALEN); in fnic_probe()
836 err = fnic_get_vnic_config(fnic); in fnic_probe()
838 dev_err(&fnic->pdev->dev, "Get vNIC configuration failed, " in fnic_probe()
843 switch (fnic->config.flags & 0xff0) { in fnic_probe()
848 sizeof(struct fnic *)); in fnic_probe()
850 dev_err(&fnic->pdev->dev, "Unable to allocate scsi host\n"); in fnic_probe()
854 *((struct fnic **) shost_priv(host)) = fnic; in fnic_probe()
856 fnic->host = host; in fnic_probe()
857 fnic->role = FNIC_ROLE_FCP_INITIATOR; in fnic_probe()
858 dev_info(&fnic->pdev->dev, "fnic: %d is scsi initiator\n", in fnic_probe()
859 fnic->fnic_num); in fnic_probe()
863 dev_info(&fnic->pdev->dev, "fnic: %d has no role defined\n", fnic->fnic_num); in fnic_probe()
869 pci_set_drvdata(pdev, fnic); in fnic_probe()
871 fnic_get_res_counts(fnic); in fnic_probe()
873 err = fnic_set_intr_mode(fnic); in fnic_probe()
875 dev_err(&fnic->pdev->dev, "Failed to set intr mode, " in fnic_probe()
880 err = fnic_alloc_vnic_resources(fnic); in fnic_probe()
882 dev_err(&fnic->pdev->dev, "Failed to alloc vNIC resources, " in fnic_probe()
886 dev_info(&fnic->pdev->dev, "fnic copy wqs: %d, Q0 ioreq table size: %d\n", in fnic_probe()
887 fnic->wq_copy_count, fnic->sw_copy_wq[0].ioreq_table_size); in fnic_probe()
890 spin_lock_init(&fnic->fnic_lock); in fnic_probe()
893 spin_lock_init(&fnic->wq_lock[i]); in fnic_probe()
896 spin_lock_init(&fnic->wq_copy_lock[i]); in fnic_probe()
897 fnic->wq_copy_desc_low[i] = DESC_CLEAN_LOW_WATERMARK; in fnic_probe()
898 fnic->fw_ack_recd[i] = 0; in fnic_probe()
899 fnic->fw_ack_index[i] = -1; in fnic_probe()
907 fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT] = pool; in fnic_probe()
914 fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX] = pool; in fnic_probe()
921 fnic->frame_pool = pool; in fnic_probe()
929 fnic->frame_elem_pool = pool; in fnic_probe()
932 fnic->vlan_hw_insert = 1; in fnic_probe()
933 fnic->vlan_id = 0; in fnic_probe()
935 if (fnic->config.flags & VFCF_FIP_CAPABLE) { in fnic_probe()
936 dev_info(&fnic->pdev->dev, "firmware supports FIP\n"); in fnic_probe()
938 vnic_dev_packet_filter(fnic->vdev, 1, 1, 0, 0, 0); in fnic_probe()
939 vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS); in fnic_probe()
940 vnic_dev_add_addr(fnic->vdev, iport->hwmac); in fnic_probe()
941 spin_lock_init(&fnic->vlans_lock); in fnic_probe()
942 INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); in fnic_probe()
943 INIT_LIST_HEAD(&fnic->fip_frame_queue); in fnic_probe()
944 INIT_LIST_HEAD(&fnic->vlan_list); in fnic_probe()
945 timer_setup(&fnic->retry_fip_timer, fnic_handle_fip_timer, 0); in fnic_probe()
946 timer_setup(&fnic->fcs_ka_timer, fnic_handle_fcs_ka_timer, 0); in fnic_probe()
947 timer_setup(&fnic->enode_ka_timer, fnic_handle_enode_ka_timer, 0); in fnic_probe()
948 timer_setup(&fnic->vn_ka_timer, fnic_handle_vn_ka_timer, 0); in fnic_probe()
949 fnic->set_vlan = fnic_set_vlan; in fnic_probe()
951 dev_info(&fnic->pdev->dev, "firmware uses non-FIP mode\n"); in fnic_probe()
953 fnic->state = FNIC_IN_FC_MODE; in fnic_probe()
955 atomic_set(&fnic->in_flight, 0); in fnic_probe()
956 fnic->state_flags = FNIC_FLAGS_NONE; in fnic_probe()
959 fnic_set_nic_config(fnic, 0, 0, 0, 0, 0, 0, 1); in fnic_probe()
962 err = fnic_notify_set(fnic); in fnic_probe()
964 dev_err(&fnic->pdev->dev, "Failed to alloc notify buffer, aborting.\n"); in fnic_probe()
969 if (vnic_dev_get_intr_mode(fnic->vdev) == VNIC_DEV_INTR_MODE_MSI) in fnic_probe()
970 timer_setup(&fnic->notify_timer, fnic_notify_timer, 0); in fnic_probe()
973 for (i = 0; i < fnic->rq_count; i++) { in fnic_probe()
974 err = vnic_rq_fill(&fnic->rq[i], fnic_alloc_rq_frame); in fnic_probe()
976 dev_err(&fnic->pdev->dev, "fnic_alloc_rq_frame can't alloc " in fnic_probe()
982 init_completion(&fnic->reset_completion_wait); in fnic_probe()
985 iport->max_flogi_retries = fnic->config.flogi_retries; in fnic_probe()
986 iport->max_plogi_retries = fnic->config.plogi_retries; in fnic_probe()
987 iport->plogi_timeout = fnic->config.plogi_timeout; in fnic_probe()
991 if (fnic->config.flags & VFCF_FCP_SEQ_LVL_ERR) in fnic_probe()
995 iport->e_d_tov = fnic->config.ed_tov; in fnic_probe()
996 iport->r_a_tov = fnic->config.ra_tov; in fnic_probe()
998 iport->wwpn = fnic->config.port_wwn; in fnic_probe()
999 iport->wwnn = fnic->config.node_wwn; in fnic_probe()
1001 iport->max_payload_size = fnic->config.maxdatafieldsize; in fnic_probe()
1014 fnic->stats_reset_time = jiffies; in fnic_probe()
1016 INIT_WORK(&fnic->link_work, fnic_handle_link); in fnic_probe()
1017 INIT_WORK(&fnic->frame_work, fnic_handle_frame); in fnic_probe()
1018 INIT_WORK(&fnic->tport_work, fnic_tport_event_handler); in fnic_probe()
1019 INIT_WORK(&fnic->flush_work, fnic_flush_tx); in fnic_probe()
1021 INIT_LIST_HEAD(&fnic->frame_queue); in fnic_probe()
1022 INIT_LIST_HEAD(&fnic->tx_queue); in fnic_probe()
1023 INIT_LIST_HEAD(&fnic->tport_event_list); in fnic_probe()
1033 for (i = 0; i < fnic->raw_wq_count; i++) in fnic_probe()
1034 vnic_wq_enable(&fnic->wq[i]); in fnic_probe()
1035 for (i = 0; i < fnic->rq_count; i++) { in fnic_probe()
1036 if (!ioread32(&fnic->rq[i].ctrl->enable)) in fnic_probe()
1037 vnic_rq_enable(&fnic->rq[i]); in fnic_probe()
1039 for (i = 0; i < fnic->wq_copy_count; i++) in fnic_probe()
1040 vnic_wq_copy_enable(&fnic->hw_copy_wq[i]); in fnic_probe()
1042 vnic_dev_enable(fnic->vdev); in fnic_probe()
1044 err = fnic_request_intr(fnic); in fnic_probe()
1046 dev_err(&fnic->pdev->dev, "Unable to request irq.\n"); in fnic_probe()
1050 fnic_notify_timer_start(fnic); in fnic_probe()
1052 fnic_fdls_init(fnic, (fnic->config.flags & VFCF_FIP_CAPABLE)); in fnic_probe()
1054 err = fnic_scsi_drv_init(fnic); in fnic_probe()
1058 err = fnic_stats_debugfs_init(fnic); in fnic_probe()
1060 dev_err(&fnic->pdev->dev, "Failed to initialize debugfs for stats\n"); in fnic_probe()
1064 for (i = 0; i < fnic->intr_count; i++) in fnic_probe()
1065 vnic_intr_unmask(&fnic->intr[i]); in fnic_probe()
1068 list_add_tail(&fnic->list, &fnic_list); in fnic_probe()
1074 fnic_stats_debugfs_remove(fnic); in fnic_probe()
1075 fnic_free_ioreq_tables_mq(fnic); in fnic_probe()
1076 scsi_remove_host(fnic->host); in fnic_probe()
1078 fnic_free_intr(fnic); in fnic_probe()
1081 for (i = 0; i < fnic->rq_count; i++) { in fnic_probe()
1082 if (ioread32(&fnic->rq[i].ctrl->enable)) in fnic_probe()
1083 vnic_rq_disable(&fnic->rq[i]); in fnic_probe()
1084 vnic_rq_clean(&fnic->rq[i], fnic_free_rq_buf); in fnic_probe()
1086 vnic_dev_notify_unset(fnic->vdev); in fnic_probe()
1088 mempool_destroy(fnic->frame_elem_pool); in fnic_probe()
1090 mempool_destroy(fnic->frame_pool); in fnic_probe()
1092 mempool_destroy(fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX]); in fnic_probe()
1094 mempool_destroy(fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT]); in fnic_probe()
1096 fnic_free_vnic_resources(fnic); in fnic_probe()
1098 fnic_clear_intr_mode(fnic); in fnic_probe()
1100 scsi_host_put(fnic->host); in fnic_probe()
1106 vnic_dev_close(fnic->vdev); in fnic_probe()
1109 vnic_dev_unregister(fnic->vdev); in fnic_probe()
1111 fnic_iounmap(fnic); in fnic_probe()
1119 ida_free(&fnic_ida, fnic->fnic_num); in fnic_probe()
1121 kfree(fnic); in fnic_probe()
1128 struct fnic *fnic = pci_get_drvdata(pdev); in fnic_remove() local
1136 if (!fnic) in fnic_remove()
1139 spin_lock_irqsave(&fnic->fnic_lock, flags); in fnic_remove()
1140 fnic->stop_rx_link_events = 1; in fnic_remove()
1141 spin_unlock_irqrestore(&fnic->fnic_lock, flags); in fnic_remove()
1149 fnic_scsi_unload(fnic); in fnic_remove()
1151 if (vnic_dev_get_intr_mode(fnic->vdev) == VNIC_DEV_INTR_MODE_MSI) in fnic_remove()
1152 del_timer_sync(&fnic->notify_timer); in fnic_remove()
1154 if (fnic->config.flags & VFCF_FIP_CAPABLE) { in fnic_remove()
1155 del_timer_sync(&fnic->retry_fip_timer); in fnic_remove()
1156 del_timer_sync(&fnic->fcs_ka_timer); in fnic_remove()
1157 del_timer_sync(&fnic->enode_ka_timer); in fnic_remove()
1158 del_timer_sync(&fnic->vn_ka_timer); in fnic_remove()
1160 fnic_free_txq(&fnic->fip_frame_queue); in fnic_remove()
1161 fnic_fcoe_reset_vlans(fnic); in fnic_remove()
1164 if ((fnic_fdmi_support == 1) && (fnic->iport.fabric.fdmi_pending > 0)) in fnic_remove()
1165 del_timer_sync(&fnic->iport.fabric.fdmi_timer); in fnic_remove()
1167 fnic_stats_debugfs_remove(fnic); in fnic_remove()
1174 fnic_cleanup(fnic); in fnic_remove()
1177 list_del(&fnic->list); in fnic_remove()
1180 fnic_free_txq(&fnic->frame_queue); in fnic_remove()
1181 fnic_free_txq(&fnic->tx_queue); in fnic_remove()
1183 vnic_dev_notify_unset(fnic->vdev); in fnic_remove()
1184 fnic_free_intr(fnic); in fnic_remove()
1185 fnic_free_vnic_resources(fnic); in fnic_remove()
1186 fnic_clear_intr_mode(fnic); in fnic_remove()
1187 vnic_dev_close(fnic->vdev); in fnic_remove()
1188 vnic_dev_unregister(fnic->vdev); in fnic_remove()
1189 fnic_iounmap(fnic); in fnic_remove()
1193 ida_free(&fnic_ida, fnic->fnic_num); in fnic_remove()
1194 fnic_scsi_unload_cleanup(fnic); in fnic_remove()
1195 scsi_host_put(fnic->host); in fnic_remove()
1196 kfree(fnic); in fnic_remove()