diff options
author | James Smart <james.smart@emulex.com> | 2013-04-17 20:16:05 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-05-02 15:44:43 -0400 |
commit | 09294d4623a3149ae2f5d35acf9d119bd957ddd8 (patch) | |
tree | 1f9fa31e9228f58e0cbbd16a3a89f53c1a79ae3c /drivers/scsi/lpfc | |
parent | e74c03c8a8e73c9a0648e1950f8798db0e43a07e (diff) |
[SCSI] lpfc 8.3.39: Fix driver issues with large lpfc_sg_seg_cnt values
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 3 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 31 |
2 files changed, 16 insertions, 18 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 4c9f94bd6729..1f2f1f4530dd 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -48,6 +48,9 @@ struct lpfc_sli2_slim; | |||
48 | downloads using bsg */ | 48 | downloads using bsg */ |
49 | #define LPFC_DEFAULT_PROT_SG_SEG_CNT 4096 /* sg protection elements count */ | 49 | #define LPFC_DEFAULT_PROT_SG_SEG_CNT 4096 /* sg protection elements count */ |
50 | #define LPFC_MAX_SG_SEG_CNT 4096 /* sg element count per scsi cmnd */ | 50 | #define LPFC_MAX_SG_SEG_CNT 4096 /* sg element count per scsi cmnd */ |
51 | #define LPFC_MAX_SGL_SEG_CNT 512 /* SGL element count per scsi cmnd */ | ||
52 | #define LPFC_MAX_BPL_SEG_CNT 4096 /* BPL element count per scsi cmnd */ | ||
53 | |||
51 | #define LPFC_MAX_SGE_SIZE 0x80000000 /* Maximum data allowed in a SGE */ | 54 | #define LPFC_MAX_SGE_SIZE 0x80000000 /* Maximum data allowed in a SGE */ |
52 | #define LPFC_MAX_PROT_SG_SEG_CNT 4096 /* prot sg element count per scsi cmd*/ | 55 | #define LPFC_MAX_PROT_SG_SEG_CNT 4096 /* prot sg element count per scsi cmd*/ |
53 | #define LPFC_IOCB_LIST_CNT 2250 /* list of IOCBs for fast-path usage. */ | 56 | #define LPFC_IOCB_LIST_CNT 2250 /* list of IOCBs for fast-path usage. */ |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index ac210d7fc96a..b2227fc17c9c 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -4739,7 +4739,7 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba) | |||
4739 | ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64)); | 4739 | ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64)); |
4740 | 4740 | ||
4741 | if (phba->cfg_enable_bg) { | 4741 | if (phba->cfg_enable_bg) { |
4742 | phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT; | 4742 | phba->cfg_sg_seg_cnt = LPFC_MAX_BPL_SEG_CNT; |
4743 | phba->cfg_sg_dma_buf_size += | 4743 | phba->cfg_sg_dma_buf_size += |
4744 | phba->cfg_prot_sg_seg_cnt * sizeof(struct ulp_bde64); | 4744 | phba->cfg_prot_sg_seg_cnt * sizeof(struct ulp_bde64); |
4745 | } | 4745 | } |
@@ -4817,7 +4817,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
4817 | int rc, i, hbq_count, buf_size, dma_buf_size, max_buf_size; | 4817 | int rc, i, hbq_count, buf_size, dma_buf_size, max_buf_size; |
4818 | uint8_t pn_page[LPFC_MAX_SUPPORTED_PAGES] = {0}; | 4818 | uint8_t pn_page[LPFC_MAX_SUPPORTED_PAGES] = {0}; |
4819 | struct lpfc_mqe *mqe; | 4819 | struct lpfc_mqe *mqe; |
4820 | int longs, sli_family; | 4820 | int longs; |
4821 | int sges_per_segment; | 4821 | int sges_per_segment; |
4822 | 4822 | ||
4823 | /* Before proceed, wait for POST done and device ready */ | 4823 | /* Before proceed, wait for POST done and device ready */ |
@@ -4901,6 +4901,17 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
4901 | sizeof(struct lpfc_sli_ring), GFP_KERNEL); | 4901 | sizeof(struct lpfc_sli_ring), GFP_KERNEL); |
4902 | if (!phba->sli.ring) | 4902 | if (!phba->sli.ring) |
4903 | return -ENOMEM; | 4903 | return -ENOMEM; |
4904 | |||
4905 | /* | ||
4906 | * It doesn't matter what family our adapter is in, we are | ||
4907 | * limited to 2 Pages, 512 SGEs, for our SGL. | ||
4908 | * There are going to be 2 reserved SGEs: 1 FCP cmnd + 1 FCP rsp | ||
4909 | */ | ||
4910 | max_buf_size = (2 * SLI4_PAGE_SIZE); | ||
4911 | if (phba->cfg_sg_seg_cnt > LPFC_MAX_SGL_SEG_CNT - 2) | ||
4912 | phba->cfg_sg_seg_cnt = LPFC_MAX_SGL_SEG_CNT - 2; | ||
4913 | max_buf_size += (sizeof(struct fcp_cmnd) + sizeof(struct fcp_rsp)); | ||
4914 | |||
4904 | /* | 4915 | /* |
4905 | * Since the sg_tablesize is module parameter, the sg_dma_buf_size | 4916 | * Since the sg_tablesize is module parameter, the sg_dma_buf_size |
4906 | * used to create the sg_dma_buf_pool must be dynamically calculated. | 4917 | * used to create the sg_dma_buf_pool must be dynamically calculated. |
@@ -4912,22 +4923,6 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
4912 | (((phba->cfg_sg_seg_cnt * sges_per_segment) + 2) * | 4923 | (((phba->cfg_sg_seg_cnt * sges_per_segment) + 2) * |
4913 | sizeof(struct sli4_sge))); | 4924 | sizeof(struct sli4_sge))); |
4914 | 4925 | ||
4915 | sli_family = bf_get(lpfc_sli_intf_sli_family, &phba->sli4_hba.sli_intf); | ||
4916 | max_buf_size = LPFC_SLI4_MAX_BUF_SIZE; | ||
4917 | switch (sli_family) { | ||
4918 | case LPFC_SLI_INTF_FAMILY_BE2: | ||
4919 | case LPFC_SLI_INTF_FAMILY_BE3: | ||
4920 | /* There is a single hint for BE - 2 pages per BPL. */ | ||
4921 | if (bf_get(lpfc_sli_intf_sli_hint1, &phba->sli4_hba.sli_intf) == | ||
4922 | LPFC_SLI_INTF_SLI_HINT1_1) | ||
4923 | max_buf_size = LPFC_SLI4_FL1_MAX_BUF_SIZE; | ||
4924 | break; | ||
4925 | case LPFC_SLI_INTF_FAMILY_LNCR_A0: | ||
4926 | case LPFC_SLI_INTF_FAMILY_LNCR_B0: | ||
4927 | default: | ||
4928 | break; | ||
4929 | } | ||
4930 | |||
4931 | for (dma_buf_size = LPFC_SLI4_MIN_BUF_SIZE; | 4926 | for (dma_buf_size = LPFC_SLI4_MIN_BUF_SIZE; |
4932 | dma_buf_size < max_buf_size && buf_size > dma_buf_size; | 4927 | dma_buf_size < max_buf_size && buf_size > dma_buf_size; |
4933 | dma_buf_size = dma_buf_size << 1) | 4928 | dma_buf_size = dma_buf_size << 1) |