scsi: lpfc: Increase SCSI CQ and WQ sizes.
authorJames Smart <jsmart2021@gmail.com>
Sat, 9 Dec 2017 01:18:06 +0000 (17:18 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 21 Dec 2017 02:11:46 +0000 (21:11 -0500)
Increased the sizes of the SCSI WQ's and CQ's so that SCSI operation is
similar to that used by NVME. However, size increase restricted only to
those newer adapters that can support the larger WQE size, thus bigger
queue sizes.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_nvme.h
drivers/scsi/lpfc/lpfc_sli4.h

index 44a98bc..f539c55 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",
@@ -8011,12 +8011,18 @@ static int
 lpfc_alloc_fcp_wq_cq(struct lpfc_hba *phba, int wqidx)
 {
        struct lpfc_queue *qdesc;
-       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->fcp_embed_io)
+               /* 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 +8031,15 @@ 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->fcp_embed_io)
+               /* Increase the WQ size when WQEs contain an embedded cdb */
+               qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE,
+                                             LPFC_WQE128_SIZE,
+                                             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",
@@ -12216,7 +12227,6 @@ int
 lpfc_fof_queue_create(struct lpfc_hba *phba)
 {
        struct lpfc_queue *qdesc;
-       uint32_t wqesize;
 
        /* Create FOF EQ */
        qdesc = lpfc_sli4_queue_alloc(phba, LPFC_DEFAULT_PAGE_SIZE,
@@ -12230,21 +12240,32 @@ 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->fcp_embed_io)
+                       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) ?
-                               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->fcp_embed_io)
+                       qdesc = lpfc_sli4_queue_alloc(phba,
+                                                     LPFC_EXPANDED_PAGE_SIZE,
+                                                     LPFC_WQE128_SIZE,
+                                                     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;
 
index c0833e4..03b0e84 100644 (file)
@@ -22,8 +22,6 @@
  ********************************************************************/
 
 #define LPFC_NVME_DEFAULT_SEGS         (64 + 1)        /* 256K IOs */
-#define LPFC_NVME_WQSIZE               1024
-#define LPFC_NVME_CQSIZE               4096
 
 #define LPFC_NVME_ERSP_LEN             0x20
 
index da302bf..81fb58e 100644 (file)
@@ -170,7 +170,7 @@ struct lpfc_queue {
        uint32_t q_mode;
        uint16_t page_count;    /* Number of pages allocated for this queue */
        uint16_t page_size;     /* size of page allocated for this queue */
-#define LPFC_NVME_PAGE_SIZE    16384
+#define LPFC_EXPANDED_PAGE_SIZE        16384
 #define LPFC_DEFAULT_PAGE_SIZE 4096
        uint16_t chann;         /* IO channel this queue is associated with */
        uint16_t db_format;
@@ -370,9 +370,9 @@ struct lpfc_bmbx {
 
 #define LPFC_EQE_DEF_COUNT     1024
 #define LPFC_CQE_DEF_COUNT      1024
+#define LPFC_CQE_EXP_COUNT      4096
 #define LPFC_WQE_DEF_COUNT      256
-#define LPFC_WQE128_DEF_COUNT   128
-#define LPFC_WQE128_MAX_COUNT   256
+#define LPFC_WQE_EXP_COUNT      1024
 #define LPFC_MQE_DEF_COUNT      16
 #define LPFC_RQE_DEF_COUNT     512