]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/scsi/lpfc/lpfc_init.c
scsi: lpfc: move placement of target destroy on driver detach
[mirror_ubuntu-bionic-kernel.git] / drivers / scsi / lpfc / lpfc_init.c
index 44a98bc913f5e5d543dd1e8c056b8d5b59367386..bff5c95cf5df4e5f95584e495ba8126d09d88da0 100644 (file)
@@ -7983,9 +7983,9 @@ lpfc_alloc_nvme_wq_cq(struct lpfc_hba *phba, int wqidx)
 {
        struct lpfc_queue *qdesc;
 
-       qdesc = lpfc_sli4_queue_alloc(phba, LPFC_NVME_PAGE_SIZE,
+       qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE,
                                      phba->sli4_hba.cq_esize,
-                                     LPFC_NVME_CQSIZE);
+                                     LPFC_CQE_EXP_COUNT);
        if (!qdesc) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                "0508 Failed allocate fast-path NVME CQ (%d)\n",
@@ -7994,8 +7994,8 @@ lpfc_alloc_nvme_wq_cq(struct lpfc_hba *phba, int wqidx)
        }
        phba->sli4_hba.nvme_cq[wqidx] = qdesc;
 
-       qdesc = lpfc_sli4_queue_alloc(phba, LPFC_NVME_PAGE_SIZE,
-                                     LPFC_WQE128_SIZE, LPFC_NVME_WQSIZE);
+       qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE,
+                                     LPFC_WQE128_SIZE, LPFC_WQE_EXP_COUNT);
        if (!qdesc) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                "0509 Failed allocate fast-path NVME WQ (%d)\n",
@@ -8014,9 +8014,16 @@ lpfc_alloc_fcp_wq_cq(struct lpfc_hba *phba, int wqidx)
        uint32_t wqesize;
 
        /* Create Fast Path FCP CQs */
-       qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE,
-                                     phba->sli4_hba.cq_esize,
-                                     phba->sli4_hba.cq_ecount);
+       if (phba->enab_exp_wqcq_pages)
+               /* Increase the CQ size when WQEs contain an embedded cdb */
+               qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE,
+                                             phba->sli4_hba.cq_esize,
+                                             LPFC_CQE_EXP_COUNT);
+
+       else
+               qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE,
+                                             phba->sli4_hba.cq_esize,
+                                             phba->sli4_hba.cq_ecount);
        if (!qdesc) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                        "0499 Failed allocate fast-path FCP CQ (%d)\n", wqidx);
@@ -8025,10 +8032,18 @@ lpfc_alloc_fcp_wq_cq(struct lpfc_hba *phba, int wqidx)
        phba->sli4_hba.fcp_cq[wqidx] = qdesc;
 
        /* Create Fast Path FCP WQs */
-       wqesize = (phba->fcp_embed_io) ?
-               LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize;
-       qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE,
-                                     wqesize, phba->sli4_hba.wq_ecount);
+       if (phba->enab_exp_wqcq_pages) {
+               /* Increase the WQ size when WQEs contain an embedded cdb */
+               wqesize = (phba->fcp_embed_io) ?
+                       LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize;
+               qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE,
+                                             wqesize,
+                                             LPFC_WQE_EXP_COUNT);
+       } else
+               qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE,
+                                             phba->sli4_hba.wq_esize,
+                                             phba->sli4_hba.wq_ecount);
+
        if (!qdesc) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                "0503 Failed allocate fast-path FCP WQ (%d)\n",
@@ -10465,15 +10480,21 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
                sli4_params->sge_supp_len = LPFC_MAX_SGE_SIZE;
 
        /*
-        * Issue IOs with CDB embedded in WQE to minimized the number
-        * of DMAs the firmware has to do. Setting this to 1 also forces
-        * the driver to use 128 bytes WQEs for FCP IOs.
+        * Check whether the adapter supports an embedded copy of the
+        * FCP CMD IU within the WQE for FCP_Ixxx commands. In order
+        * to use this option, 128-byte WQEs must be used.
         */
        if (bf_get(cfg_ext_embed_cb, mbx_sli4_parameters))
                phba->fcp_embed_io = 1;
        else
                phba->fcp_embed_io = 0;
 
+       if ((bf_get(cfg_cqpsize, mbx_sli4_parameters) & LPFC_CQ_16K_PAGE_SZ) &&
+           (bf_get(cfg_wqpsize, mbx_sli4_parameters) & LPFC_WQ_16K_PAGE_SZ) &&
+           (sli4_params->wqsize & LPFC_WQ_SZ128_SUPPORT))
+               phba->enab_exp_wqcq_pages = 1;
+       else
+               phba->enab_exp_wqcq_pages = 0;
        /*
         * Check if the SLI port supports MDS Diagnostics
         */
@@ -11482,13 +11503,6 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev)
        /* Remove FC host and then SCSI host with the physical port */
        fc_remove_host(shost);
        scsi_remove_host(shost);
-       /*
-        * Bring down the SLI Layer. This step disables all interrupts,
-        * clears the rings, discards all mailbox commands, and resets
-        * the HBA FCoE function.
-        */
-       lpfc_debugfs_terminate(vport);
-       lpfc_sli4_hba_unset(phba);
 
        /* Perform ndlp cleanup on the physical port.  The nvme and nvmet
         * localports are destroyed after to cleanup all transport memory.
@@ -11497,6 +11511,13 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev)
        lpfc_nvmet_destroy_targetport(phba);
        lpfc_nvme_destroy_localport(vport);
 
+       /*
+        * Bring down the SLI Layer. This step disables all interrupts,
+        * clears the rings, discards all mailbox commands, and resets
+        * the HBA FCoE function.
+        */
+       lpfc_debugfs_terminate(vport);
+       lpfc_sli4_hba_unset(phba);
 
        lpfc_stop_hba_timers(phba);
        spin_lock_irq(&phba->hbalock);
@@ -12230,20 +12251,34 @@ lpfc_fof_queue_create(struct lpfc_hba *phba)
        if (phba->cfg_fof) {
 
                /* Create OAS CQ */
-               qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE,
-                                             phba->sli4_hba.cq_esize,
-                                             phba->sli4_hba.cq_ecount);
+               if (phba->enab_exp_wqcq_pages)
+                       qdesc = lpfc_sli4_queue_alloc(phba,
+                                                     LPFC_EXPANDED_PAGE_SIZE,
+                                                     phba->sli4_hba.cq_esize,
+                                                     LPFC_CQE_EXP_COUNT);
+               else
+                       qdesc = lpfc_sli4_queue_alloc(phba,
+                                                     LPFC_DEFAULT_PAGE_SIZE,
+                                                     phba->sli4_hba.cq_esize,
+                                                     phba->sli4_hba.cq_ecount);
                if (!qdesc)
                        goto out_error;
 
                phba->sli4_hba.oas_cq = qdesc;
 
                /* Create OAS WQ */
-               wqesize = (phba->fcp_embed_io) ?
+               if (phba->enab_exp_wqcq_pages) {
+                       wqesize = (phba->fcp_embed_io) ?
                                LPFC_WQE128_SIZE : phba->sli4_hba.wq_esize;
-               qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE,
-                                             wqesize,
-                                             phba->sli4_hba.wq_ecount);
+                       qdesc = lpfc_sli4_queue_alloc(phba,
+                                                     LPFC_EXPANDED_PAGE_SIZE,
+                                                     wqesize,
+                                                     LPFC_WQE_EXP_COUNT);
+               } else
+                       qdesc = lpfc_sli4_queue_alloc(phba,
+                                                     LPFC_DEFAULT_PAGE_SIZE,
+                                                     phba->sli4_hba.wq_esize,
+                                                     phba->sli4_hba.wq_ecount);
 
                if (!qdesc)
                        goto out_error;