Merge branch 'intelfb-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[firefly-linux-kernel-4.4.55.git] / drivers / scsi / lpfc / lpfc_init.c
index ef47b824cbed46f2c6667fa42316e3544bf05a95..4cdf3464267fd7decee3cfff83c9082d3050b8a8 100644 (file)
@@ -268,6 +268,8 @@ lpfc_config_port_post(struct lpfc_hba * phba)
        kfree(mp);
        pmb->context1 = NULL;
 
+       if (phba->cfg_soft_wwpn)
+               u64_to_wwn(phba->cfg_soft_wwpn, phba->fc_sparam.portName.u.wwn);
        memcpy(&phba->fc_nodename, &phba->fc_sparam.nodeName,
               sizeof (struct lpfc_name));
        memcpy(&phba->fc_portname, &phba->fc_sparam.portName,
@@ -511,6 +513,7 @@ lpfc_handle_eratt(struct lpfc_hba * phba)
 {
        struct lpfc_sli *psli = &phba->sli;
        struct lpfc_sli_ring  *pring;
+       uint32_t event_data;
 
        if (phba->work_hs & HS_FFER6) {
                /* Re-establishing Link */
@@ -555,6 +558,11 @@ lpfc_handle_eratt(struct lpfc_hba * phba)
                                phba->brd_no, phba->work_hs,
                                phba->work_status[0], phba->work_status[1]);
 
+               event_data = FC_REG_DUMP_EVENT;
+               fc_host_post_vendor_event(phba->host, fc_get_event_number(),
+                               sizeof(event_data), (char *) &event_data,
+                               SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX);
+
                psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
                lpfc_offline(phba);
                phba->hba_state = LPFC_HBA_ERROR;
@@ -1379,6 +1387,7 @@ lpfc_offline(struct lpfc_hba * phba)
        /* stop all timers associated with this hba */
        lpfc_stop_timer(phba);
        phba->work_hba_events = 0;
+       phba->work_ha = 0;
 
        lpfc_printf_log(phba,
                       KERN_WARNING,
@@ -1616,7 +1625,11 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
                goto out_free_iocbq;
        }
 
-       /* We can rely on a queue depth attribute only after SLI HBA setup */
+       /*
+        * Set initial can_queue value since 0 is no longer supported and
+        * scsi_add_host will fail. This will be adjusted later based on the
+        * max xri value determined in hba setup.
+        */
        host->can_queue = phba->cfg_hba_queue_depth - 10;
 
        /* Tell the midlayer we support 16 byte commands */
@@ -1656,6 +1669,12 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
                goto out_free_irq;
        }
 
+       /*
+        * hba setup may have changed the hba_queue_depth so we need to adjust
+        * the value of can_queue.
+        */
+       host->can_queue = phba->cfg_hba_queue_depth - 10;
+
        lpfc_discovery_wait(phba);
 
        if (phba->cfg_poll & DISABLE_FCP_RING_INT) {