These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / scsi / lpfc / lpfc_init.c
index e8c8c1e..db9446c 100644 (file)
@@ -699,7 +699,9 @@ lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology,
            ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) &&
             !(phba->lmt & LMT_10Gb)) ||
            ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) &&
-            !(phba->lmt & LMT_16Gb))) {
+            !(phba->lmt & LMT_16Gb)) ||
+           ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_32G) &&
+            !(phba->lmt & LMT_32Gb))) {
                /* Reset link speed to auto */
                lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
                        "1302 Invalid speed for this board:%d "
@@ -2035,7 +2037,9 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
                && descp && descp[0] != '\0')
                return;
 
-       if (phba->lmt & LMT_16Gb)
+       if (phba->lmt & LMT_32Gb)
+               max_speed = 32;
+       else if (phba->lmt & LMT_16Gb)
                max_speed = 16;
        else if (phba->lmt & LMT_10Gb)
                max_speed = 10;
@@ -2229,6 +2233,9 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
                m = (typeof(m)){"OCe15100", "PCIe",
                                "Obsolete, Unsupported FCoE"};
                break;
+       case PCI_DEVICE_ID_LANCER_G6_FC:
+               m = (typeof(m)){"LPe32000", "PCIe", "Fibre Channel Adapter"};
+               break;
        case PCI_DEVICE_ID_SKYHAWK:
        case PCI_DEVICE_ID_SKYHAWK_VF:
                oneConnect = 1;
@@ -2253,7 +2260,7 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
                                phba->Port);
                else if (max_speed == 0)
                        snprintf(descp, 255,
-                               "Emulex %s %s %s ",
+                               "Emulex %s %s %s",
                                m.name, m.bus, m.function);
                else
                        snprintf(descp, 255,
@@ -3303,6 +3310,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
        shost->max_lun = vport->cfg_max_luns;
        shost->this_id = -1;
        shost->max_cmd_len = 16;
+       shost->nr_hw_queues = phba->cfg_fcp_io_channel;
        if (phba->sli_rev == LPFC_SLI_REV4) {
                shost->dma_boundary =
                        phba->sli4_hba.pc_sli4_params.sge_supp_len-1;
@@ -3490,6 +3498,8 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost)
                                 sizeof fc_host_symbolic_name(shost));
 
        fc_host_supported_speeds(shost) = 0;
+       if (phba->lmt & LMT_32Gb)
+               fc_host_supported_speeds(shost) |= FC_PORTSPEED_32GBIT;
        if (phba->lmt & LMT_16Gb)
                fc_host_supported_speeds(shost) |= FC_PORTSPEED_16GBIT;
        if (phba->lmt & LMT_10Gb)
@@ -3853,6 +3863,9 @@ lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code,
                case LPFC_FC_LA_SPEED_16G:
                        port_speed = 16000;
                        break;
+               case LPFC_FC_LA_SPEED_32G:
+                       port_speed = 32000;
+                       break;
                default:
                        port_speed = 0;
                }
@@ -4483,7 +4496,13 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
                        lpfc_destroy_vport_work_array(phba, vports);
                }
 
-               if (active_vlink_present) {
+               /*
+                * Don't re-instantiate if vport is marked for deletion.
+                * If we are here first then vport_delete is going to wait
+                * for discovery to complete.
+                */
+               if (!(vport->load_flag & FC_UNLOADING) &&
+                                       active_vlink_present) {
                        /*
                         * If there are other active VLinks present,
                         * re-instantiate the Vlink using FDISC.
@@ -4975,8 +4994,7 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)
        }
 
        if (!phba->sli.ring)
-               phba->sli.ring = (struct lpfc_sli_ring *)
-                       kzalloc(LPFC_SLI3_MAX_RING *
+               phba->sli.ring = kzalloc(LPFC_SLI3_MAX_RING *
                        sizeof(struct lpfc_sli_ring), GFP_KERNEL);
        if (!phba->sli.ring)
                return -ENOMEM;
@@ -4988,7 +5006,7 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)
 
        /* Initialize the host templates the configured values. */
        lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;
-       lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;
+       lpfc_template_s3.sg_tablesize = phba->cfg_sg_seg_cnt;
 
        /* There are going to be 2 reserved BDEs: 1 FCP cmnd + 1 FCP rsp */
        if (phba->cfg_enable_bg) {
@@ -7500,6 +7518,8 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba)
                        mboxq->u.mqe.un.query_fw_cfg.rsp.function_mode;
        phba->sli4_hba.ulp0_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp0_mode;
        phba->sli4_hba.ulp1_mode = mboxq->u.mqe.un.query_fw_cfg.rsp.ulp1_mode;
+       phba->sli4_hba.physical_port =
+                       mboxq->u.mqe.un.query_fw_cfg.rsp.physical_port;
        lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
                        "3251 QUERY_FW_CFG: func_mode:x%x, ulp0_mode:x%x, "
                        "ulp1_mode:x%x\n", phba->sli4_hba.fw_func_mode,
@@ -8367,7 +8387,7 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
 
        /* vector-0 is associated to slow-path handler */
        rc = request_irq(phba->msix_entries[0].vector,
-                        &lpfc_sli_sp_intr_handler, IRQF_SHARED,
+                        &lpfc_sli_sp_intr_handler, 0,
                         LPFC_SP_DRIVER_HANDLER_NAME, phba);
        if (rc) {
                lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
@@ -8378,7 +8398,7 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba)
 
        /* vector-1 is associated to fast-path handler */
        rc = request_irq(phba->msix_entries[1].vector,
-                        &lpfc_sli_fp_intr_handler, IRQF_SHARED,
+                        &lpfc_sli_fp_intr_handler, 0,
                         LPFC_FP_DRIVER_HANDLER_NAME, phba);
 
        if (rc) {
@@ -8487,7 +8507,7 @@ lpfc_sli_enable_msi(struct lpfc_hba *phba)
        }
 
        rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler,
-                        IRQF_SHARED, LPFC_DRIVER_NAME, phba);
+                        0, LPFC_DRIVER_NAME, phba);
        if (rc) {
                pci_disable_msi(phba->pcidev);
                lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
@@ -8670,7 +8690,6 @@ lpfc_sli4_set_affinity(struct lpfc_hba *phba, int vectors)
 #ifdef CONFIG_X86
        struct cpuinfo_x86 *cpuinfo;
 #endif
-       struct cpumask *mask;
        uint8_t chann[LPFC_FCP_IO_CHAN_MAX+1];
 
        /* If there is no mapping, just return */
@@ -8764,11 +8783,8 @@ found:
                        first_cpu = cpu;
 
                /* Now affinitize to the selected CPU */
-               mask = &cpup->maskbits;
-               cpumask_clear(mask);
-               cpumask_set_cpu(cpu, mask);
                i = irq_set_affinity_hint(phba->sli4_hba.msix_entries[idx].
-                                         vector, mask);
+                                         vector, get_cpu_mask(cpu));
 
                lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
                                "3330 Set Affinity: CPU %d channel %d "
@@ -8944,13 +8960,13 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
                if (phba->cfg_fof && (index == (vectors - 1)))
                        rc = request_irq(
                                phba->sli4_hba.msix_entries[index].vector,
-                                &lpfc_sli4_fof_intr_handler, IRQF_SHARED,
+                                &lpfc_sli4_fof_intr_handler, 0,
                                 (char *)&phba->sli4_hba.handler_name[index],
                                 &phba->sli4_hba.fcp_eq_hdl[index]);
                else
                        rc = request_irq(
                                phba->sli4_hba.msix_entries[index].vector,
-                                &lpfc_sli4_hba_intr_handler, IRQF_SHARED,
+                                &lpfc_sli4_hba_intr_handler, 0,
                                 (char *)&phba->sli4_hba.handler_name[index],
                                 &phba->sli4_hba.fcp_eq_hdl[index]);
                if (rc) {
@@ -8972,7 +8988,8 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba)
                phba->cfg_fcp_io_channel = vectors;
        }
 
-       lpfc_sli4_set_affinity(phba, vectors);
+       if (!shost_use_blk_mq(lpfc_shost_from_vport(phba->pport)))
+               lpfc_sli4_set_affinity(phba, vectors);
        return rc;
 
 cfg_fail_out:
@@ -9050,7 +9067,7 @@ lpfc_sli4_enable_msi(struct lpfc_hba *phba)
        }
 
        rc = request_irq(phba->pcidev->irq, lpfc_sli4_intr_handler,
-                        IRQF_SHARED, LPFC_DRIVER_NAME, phba);
+                        0, LPFC_DRIVER_NAME, phba);
        if (rc) {
                pci_disable_msi(phba->pcidev);
                lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
@@ -10277,7 +10294,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
        struct lpfc_hba   *phba;
        struct lpfc_vport *vport = NULL;
        struct Scsi_Host  *shost = NULL;
-       int error, ret;
+       int error;
        uint32_t cfg_mode, intr_mode;
        int adjusted_fcp_io_channel;
 
@@ -10401,7 +10418,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
 
        /* check for firmware upgrade or downgrade */
        if (phba->cfg_request_firmware_upgrade)
-               ret = lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE);
+               lpfc_sli4_request_firmware_update(phba, INT_FW_UPGRADE);
 
        /* Check if there are static vports to be created. */
        lpfc_create_static_vport(phba);
@@ -11344,6 +11361,8 @@ static struct pci_device_id lpfc_id_table[] = {
                PCI_ANY_ID, PCI_ANY_ID, },
        {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_FCOE_VF,
                PCI_ANY_ID, PCI_ANY_ID, },
+       {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_G6_FC,
+               PCI_ANY_ID, PCI_ANY_ID, },
        {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SKYHAWK,
                PCI_ANY_ID, PCI_ANY_ID, },
        {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SKYHAWK_VF,
@@ -11467,6 +11486,7 @@ lpfc_exit(void)
                free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order);
        }
        kfree(lpfc_used_cpu);
+       idr_destroy(&lpfc_hba_index);
 }
 
 module_init(lpfc_init);