scsi: lpfc: Make PBDE optimizations configurable
authorJames Smart <jsmart2021@gmail.com>
Tue, 26 Jun 2018 15:24:26 +0000 (08:24 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 11 Jul 2018 02:15:09 +0000 (22:15 -0400)
The PBDE optimizations aren't supported in all firmware revs.

Make optimizations configurable in case there's a side effect on old
firmware.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_attr.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_nvme.c
drivers/scsi/lpfc/lpfc_nvmet.c
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_sli.c

index 20b249a649dd67626303b3be9370222a572df6d0..fc580a9b2baefcf5660643f2c0b3bb48c60c0eeb 100644 (file)
@@ -840,8 +840,7 @@ struct lpfc_hba {
 #define LPFC_ENABLE_FCP  1
 #define LPFC_ENABLE_NVME 2
 #define LPFC_ENABLE_BOTH 3
-       uint32_t nvme_embed_pbde;
-       uint32_t fcp_embed_pbde;
+       uint32_t cfg_enable_pbde;
        uint32_t io_channel_irqs;       /* number of irqs for io channels */
        struct nvmet_fc_target_port *targetport;
        lpfc_vpd_t vpd;         /* vital product data */
index c06593e5aa3279ee4744ba4e5b113bdd273918cf..23a5a298d60e0424be8eabd55216f58684b2940d 100644 (file)
@@ -5387,6 +5387,14 @@ LPFC_BBCR_ATTR_RW(enable_bbcr, 1, 0, 1, "Enable BBC Recovery");
  */
 LPFC_ATTR_RW(enable_dpp, 1, 0, 1, "Enable Direct Packet Push");
 
+/*
+ * lpfc_enable_pbde: Enable PBDE on PRISM - G7
+ *       0  = PBDE on G7 disabled
+ *       1  = PBDE on G7 enabled (default)
+ * Value range is [0,1]. Default value is 1
+ */
+LPFC_ATTR_R(enable_pbde, 1, 0, 1, "Enable PBDE support on PRISM");
+
 struct device_attribute *lpfc_hba_attrs[] = {
        &dev_attr_nvme_info,
        &dev_attr_bg_info,
@@ -5498,6 +5506,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
        &dev_attr_lpfc_enable_mds_diags,
        &dev_attr_lpfc_enable_bbcr,
        &dev_attr_lpfc_enable_dpp,
+       &dev_attr_lpfc_enable_pbde,
        NULL,
 };
 
@@ -6514,6 +6523,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
        lpfc_nvme_io_channel_init(phba, lpfc_nvme_io_channel);
        lpfc_enable_bbcr_init(phba, lpfc_enable_bbcr);
        lpfc_enable_dpp_init(phba, lpfc_enable_dpp);
+       lpfc_enable_pbde_init(phba, lpfc_enable_pbde);
 
        if (phba->sli_rev != LPFC_SLI_REV4) {
                /* NVME only supported on SLI4 */
index 150562b79eaaeb2df40ba62170bd81b109fafff4..f2f3b27d0b84302ce8eb7871bff322158bc3ab7e 100644 (file)
@@ -10673,18 +10673,10 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
                phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP;
        }
 
-       /* Only embed PBDE for if_type 6 */
-       if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) ==
-           LPFC_SLI_INTF_IF_TYPE_6) {
-               phba->fcp_embed_pbde = 1;
-               phba->nvme_embed_pbde = 1;
-       }
-
-       /* PBDE support requires xib be set */
-       if (!bf_get(cfg_xib, mbx_sli4_parameters)) {
-               phba->fcp_embed_pbde = 0;
-               phba->nvme_embed_pbde = 0;
-       }
+       /* Only embed PBDE for if_type 6, PBDE support requires xib be set */
+       if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
+           LPFC_SLI_INTF_IF_TYPE_6) || (!bf_get(cfg_xib, mbx_sli4_parameters)))
+               phba->cfg_enable_pbde = 0;
 
        /*
         * To support Suppress Response feature we must satisfy 3 conditions.
@@ -10718,10 +10710,10 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
                phba->fcp_embed_io = 0;
 
        lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME,
-                       "6422 XIB %d: FCP %d %d NVME %d %d %d %d\n",
+                       "6422 XIB %d PBDE %d: FCP %d NVME %d %d %d\n",
                        bf_get(cfg_xib, mbx_sli4_parameters),
-                       phba->fcp_embed_pbde, phba->fcp_embed_io,
-                       phba->nvme_support, phba->nvme_embed_pbde,
+                       phba->cfg_enable_pbde,
+                       phba->fcp_embed_io, phba->nvme_support,
                        phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp);
 
        if ((bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) ==
index ada5a2aaee82bfba9385c1474f2407891748d487..4cc6783b6a9fbc902e7480ce8f2ccab2df7ab132 100644 (file)
@@ -1279,6 +1279,8 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport,
        /* Word 9 */
        bf_set(wqe_reqtag, &wqe->generic.wqe_com, pwqeq->iotag);
 
+       /* Words 13 14 15 are for PBDE support */
+
        pwqeq->vport = vport;
        return 0;
 }
@@ -1378,7 +1380,7 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
                        data_sg = sg_next(data_sg);
                        sgl++;
                }
-               if (phba->nvme_embed_pbde) {
+               if (phba->cfg_enable_pbde) {
                        /* Use PBDE support for first SGL only, offset == 0 */
                        /* Words 13-15 */
                        bde = (struct ulp_bde64 *)
@@ -1394,10 +1396,8 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,
                        memset(&wqe->words[13], 0, (sizeof(uint32_t) * 3));
                        bf_set(wqe_pbde, &wqe->generic.wqe_com, 0);
                }
-       } else {
-               bf_set(wqe_pbde, &wqe->generic.wqe_com, 0);
-               memset(&wqe->words[13], 0, (sizeof(uint32_t) * 3));
 
+       } else {
                /* For this clause to be valid, the payload_length
                 * and sg_cnt must zero.
                 */
index 102c970a00e6139fd101992e00ce870e30f87f30..ccb35efef1e191aa9a8fa2e292f8338ddf0a2bca 100644 (file)
@@ -2493,7 +2493,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
                        bf_set(wqe_xc, &wqe->fcp_treceive.wqe_com, 0);
 
                /* Word 11 - set pbde later */
-               if (phba->nvme_embed_pbde) {
+               if (phba->cfg_enable_pbde) {
                        do_pbde = 1;
                } else {
                        bf_set(wqe_pbde, &wqe->fcp_treceive.wqe_com, 0);
@@ -2608,16 +2608,19 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
                        bf_set(lpfc_sli4_sge_last, sgl, 1);
                sgl->word2 = cpu_to_le32(sgl->word2);
                sgl->sge_len = cpu_to_le32(cnt);
-               if (do_pbde && i == 0) {
+               if (i == 0) {
                        bde = (struct ulp_bde64 *)&wqe->words[13];
-                       memset(bde, 0, sizeof(struct ulp_bde64));
-                       /* Words 13-15  (PBDE)*/
-                       bde->addrLow = sgl->addr_lo;
-                       bde->addrHigh = sgl->addr_hi;
-                       bde->tus.f.bdeSize =
-                               le32_to_cpu(sgl->sge_len);
-                       bde->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
-                       bde->tus.w = cpu_to_le32(bde->tus.w);
+                       if (do_pbde) {
+                               /* Words 13-15  (PBDE) */
+                               bde->addrLow = sgl->addr_lo;
+                               bde->addrHigh = sgl->addr_hi;
+                               bde->tus.f.bdeSize =
+                                       le32_to_cpu(sgl->sge_len);
+                               bde->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
+                               bde->tus.w = cpu_to_le32(bde->tus.w);
+                       } else {
+                               memset(bde, 0, sizeof(struct ulp_bde64));
+                       }
                }
                sgl++;
                ctxp->offset += cnt;
index a94fb9f8bb448efb39a18671ec6d8c868c8a6e8f..c31c43f43553ff6f1f98c7e09533a4202f7c2c27 100644 (file)
@@ -3311,12 +3311,13 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
                }
                /*
                 * Setup the first Payload BDE. For FCoE we just key off
-                * Performance Hints, for FC we utilize fcp_embed_pbde.
+                * Performance Hints, for FC we use lpfc_enable_pbde.
+                * We populate words 13-15 of IOCB/WQE.
                 */
                if ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) ||
-                   phba->fcp_embed_pbde) {
+                   phba->cfg_enable_pbde) {
                        bde = (struct ulp_bde64 *)
-                                       &(iocb_cmd->unsli3.sli3Words[5]);
+                               &(iocb_cmd->unsli3.sli3Words[5]);
                        bde->addrLow = first_data_sgl->addr_lo;
                        bde->addrHigh = first_data_sgl->addr_hi;
                        bde->tus.f.bdeSize =
@@ -3330,6 +3331,13 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
                sgl->word2 = le32_to_cpu(sgl->word2);
                bf_set(lpfc_sli4_sge_last, sgl, 1);
                sgl->word2 = cpu_to_le32(sgl->word2);
+
+               if ((phba->sli3_options & LPFC_SLI4_PERFH_ENABLED) ||
+                   phba->cfg_enable_pbde) {
+                       bde = (struct ulp_bde64 *)
+                               &(iocb_cmd->unsli3.sli3Words[5]);
+                       memset(bde, 0, (sizeof(uint32_t) * 3));
+               }
        }
 
        /*
index 89ebb07e203dc47f7451cba28f3c54731dbff329..b55873d502128a63b3ddf372900155ff9538c1cd 100644 (file)
@@ -9117,8 +9117,8 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
                }
                /* Note, word 10 is already initialized to 0 */
 
-               /* Don't set PBDE for Perf hints, just fcp_embed_pbde */
-               if (phba->fcp_embed_pbde)
+               /* Don't set PBDE for Perf hints, just lpfc_enable_pbde */
+               if (phba->cfg_enable_pbde)
                        bf_set(wqe_pbde, &wqe->fcp_iwrite.wqe_com, 1);
                else
                        bf_set(wqe_pbde, &wqe->fcp_iwrite.wqe_com, 0);
@@ -9181,8 +9181,8 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq,
                }
                /* Note, word 10 is already initialized to 0 */
 
-               /* Don't set PBDE for Perf hints, just fcp_embed_pbde */
-               if (phba->fcp_embed_pbde)
+               /* Don't set PBDE for Perf hints, just lpfc_enable_pbde */
+               if (phba->cfg_enable_pbde)
                        bf_set(wqe_pbde, &wqe->fcp_iread.wqe_com, 1);
                else
                        bf_set(wqe_pbde, &wqe->fcp_iread.wqe_com, 0);