diff options
| author | James Smart <jsmart2021@gmail.com> | 2017-05-15 18:20:44 -0400 |
|---|---|---|
| committer | Martin K. Petersen <martin.petersen@oracle.com> | 2017-05-16 21:21:17 -0400 |
| commit | 3c603be9798758dde794daa622e0f7017dbff3a7 (patch) | |
| tree | d8c62e8d8a40ea6890af968e0cb08ec3bff42a9f | |
| parent | 7869da183a7cfc8a2189f6eddd3bc558be40d5e3 (diff) | |
scsi: lpfc: Separate NVMET data buffer pool fir ELS/CT.
Using 2048 byte buffer and onle 128 bytes is needed.
Create nee LFPC_NVMET_DATA_BUF_SIZE define to use for NVMET RQ/MRQs.
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>
| -rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 1 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 1 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_hw4.h | 1 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 7 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_mem.c | 33 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 19 |
6 files changed, 50 insertions, 12 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 62571fa9c6ad..c4b38491da8e 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
| @@ -943,6 +943,7 @@ struct lpfc_hba { | |||
| 943 | struct pci_pool *lpfc_mbuf_pool; | 943 | struct pci_pool *lpfc_mbuf_pool; |
| 944 | struct pci_pool *lpfc_hrb_pool; /* header receive buffer pool */ | 944 | struct pci_pool *lpfc_hrb_pool; /* header receive buffer pool */ |
| 945 | struct pci_pool *lpfc_drb_pool; /* data receive buffer pool */ | 945 | struct pci_pool *lpfc_drb_pool; /* data receive buffer pool */ |
| 946 | struct pci_pool *lpfc_nvmet_drb_pool; /* data receive buffer pool */ | ||
| 946 | struct pci_pool *lpfc_hbq_pool; /* SLI3 hbq buffer pool */ | 947 | struct pci_pool *lpfc_hbq_pool; /* SLI3 hbq buffer pool */ |
| 947 | struct pci_pool *txrdy_payload_pool; | 948 | struct pci_pool *txrdy_payload_pool; |
| 948 | struct lpfc_dma_pool lpfc_mbuf_safety_pool; | 949 | struct lpfc_dma_pool lpfc_mbuf_safety_pool; |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 1c55408ac718..fb7fc48a1324 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
| @@ -271,6 +271,7 @@ int lpfc_sli4_fcf_rr_next_proc(struct lpfc_vport *, uint16_t); | |||
| 271 | void lpfc_sli4_clear_fcf_rr_bmask(struct lpfc_hba *); | 271 | void lpfc_sli4_clear_fcf_rr_bmask(struct lpfc_hba *); |
| 272 | 272 | ||
| 273 | int lpfc_mem_alloc(struct lpfc_hba *, int align); | 273 | int lpfc_mem_alloc(struct lpfc_hba *, int align); |
| 274 | int lpfc_nvmet_mem_alloc(struct lpfc_hba *phba); | ||
| 274 | int lpfc_mem_alloc_active_rrq_pool_s4(struct lpfc_hba *); | 275 | int lpfc_mem_alloc_active_rrq_pool_s4(struct lpfc_hba *); |
| 275 | void lpfc_mem_free(struct lpfc_hba *); | 276 | void lpfc_mem_free(struct lpfc_hba *); |
| 276 | void lpfc_mem_free_all(struct lpfc_hba *); | 277 | void lpfc_mem_free_all(struct lpfc_hba *); |
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 1d12f2be36bc..df97c6b7433b 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h | |||
| @@ -1356,6 +1356,7 @@ struct lpfc_mbx_wq_destroy { | |||
| 1356 | 1356 | ||
| 1357 | #define LPFC_HDR_BUF_SIZE 128 | 1357 | #define LPFC_HDR_BUF_SIZE 128 |
| 1358 | #define LPFC_DATA_BUF_SIZE 2048 | 1358 | #define LPFC_DATA_BUF_SIZE 2048 |
| 1359 | #define LPFC_NVMET_DATA_BUF_SIZE 128 | ||
| 1359 | struct rq_context { | 1360 | struct rq_context { |
| 1360 | uint32_t word0; | 1361 | uint32_t word0; |
| 1361 | #define lpfc_rq_context_rqe_count_SHIFT 16 /* Version 0 Only */ | 1362 | #define lpfc_rq_context_rqe_count_SHIFT 16 /* Version 0 Only */ |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 5f62e3a1dff6..26b6a843d32d 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
| @@ -5956,16 +5956,21 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) | |||
| 5956 | for (i = 0; i < lpfc_enable_nvmet_cnt; i++) { | 5956 | for (i = 0; i < lpfc_enable_nvmet_cnt; i++) { |
| 5957 | if (wwn == lpfc_enable_nvmet[i]) { | 5957 | if (wwn == lpfc_enable_nvmet[i]) { |
| 5958 | #if (IS_ENABLED(CONFIG_NVME_TARGET_FC)) | 5958 | #if (IS_ENABLED(CONFIG_NVME_TARGET_FC)) |
| 5959 | if (lpfc_nvmet_mem_alloc(phba)) | ||
| 5960 | break; | ||
| 5961 | |||
| 5962 | phba->nvmet_support = 1; /* a match */ | ||
| 5963 | |||
| 5959 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 5964 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
| 5960 | "6017 NVME Target %016llx\n", | 5965 | "6017 NVME Target %016llx\n", |
| 5961 | wwn); | 5966 | wwn); |
| 5962 | phba->nvmet_support = 1; /* a match */ | ||
| 5963 | #else | 5967 | #else |
| 5964 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 5968 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
| 5965 | "6021 Can't enable NVME Target." | 5969 | "6021 Can't enable NVME Target." |
| 5966 | " NVME_TARGET_FC infrastructure" | 5970 | " NVME_TARGET_FC infrastructure" |
| 5967 | " is not in kernel\n"); | 5971 | " is not in kernel\n"); |
| 5968 | #endif | 5972 | #endif |
| 5973 | break; | ||
| 5969 | } | 5974 | } |
| 5970 | } | 5975 | } |
| 5971 | } | 5976 | } |
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 5986c7957199..91060afc9721 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c | |||
| @@ -214,6 +214,21 @@ fail_free_drb_pool: | |||
| 214 | return -ENOMEM; | 214 | return -ENOMEM; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | int | ||
| 218 | lpfc_nvmet_mem_alloc(struct lpfc_hba *phba) | ||
| 219 | { | ||
| 220 | phba->lpfc_nvmet_drb_pool = | ||
| 221 | pci_pool_create("lpfc_nvmet_drb_pool", | ||
| 222 | phba->pcidev, LPFC_NVMET_DATA_BUF_SIZE, | ||
| 223 | SGL_ALIGN_SZ, 0); | ||
| 224 | if (!phba->lpfc_nvmet_drb_pool) { | ||
| 225 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
| 226 | "6024 Can't enable NVME Target - no memory\n"); | ||
| 227 | return -ENOMEM; | ||
| 228 | } | ||
| 229 | return 0; | ||
| 230 | } | ||
| 231 | |||
| 217 | /** | 232 | /** |
| 218 | * lpfc_mem_free - Frees memory allocated by lpfc_mem_alloc | 233 | * lpfc_mem_free - Frees memory allocated by lpfc_mem_alloc |
| 219 | * @phba: HBA to free memory for | 234 | * @phba: HBA to free memory for |
| @@ -232,6 +247,9 @@ lpfc_mem_free(struct lpfc_hba *phba) | |||
| 232 | 247 | ||
| 233 | /* Free HBQ pools */ | 248 | /* Free HBQ pools */ |
| 234 | lpfc_sli_hbqbuf_free_all(phba); | 249 | lpfc_sli_hbqbuf_free_all(phba); |
| 250 | if (phba->lpfc_nvmet_drb_pool) | ||
| 251 | pci_pool_destroy(phba->lpfc_nvmet_drb_pool); | ||
| 252 | phba->lpfc_nvmet_drb_pool = NULL; | ||
| 235 | if (phba->lpfc_drb_pool) | 253 | if (phba->lpfc_drb_pool) |
| 236 | pci_pool_destroy(phba->lpfc_drb_pool); | 254 | pci_pool_destroy(phba->lpfc_drb_pool); |
| 237 | phba->lpfc_drb_pool = NULL; | 255 | phba->lpfc_drb_pool = NULL; |
| @@ -624,20 +642,20 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) | |||
| 624 | kfree(dma_buf); | 642 | kfree(dma_buf); |
| 625 | return NULL; | 643 | return NULL; |
| 626 | } | 644 | } |
| 627 | dma_buf->dbuf.virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL, | 645 | dma_buf->dbuf.virt = pci_pool_alloc(phba->lpfc_nvmet_drb_pool, |
| 628 | &dma_buf->dbuf.phys); | 646 | GFP_KERNEL, &dma_buf->dbuf.phys); |
| 629 | if (!dma_buf->dbuf.virt) { | 647 | if (!dma_buf->dbuf.virt) { |
| 630 | pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, | 648 | pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, |
| 631 | dma_buf->hbuf.phys); | 649 | dma_buf->hbuf.phys); |
| 632 | kfree(dma_buf); | 650 | kfree(dma_buf); |
| 633 | return NULL; | 651 | return NULL; |
| 634 | } | 652 | } |
| 635 | dma_buf->total_size = LPFC_DATA_BUF_SIZE; | 653 | dma_buf->total_size = LPFC_NVMET_DATA_BUF_SIZE; |
| 636 | 654 | ||
| 637 | dma_buf->context = kzalloc(sizeof(struct lpfc_nvmet_rcv_ctx), | 655 | dma_buf->context = kzalloc(sizeof(struct lpfc_nvmet_rcv_ctx), |
| 638 | GFP_KERNEL); | 656 | GFP_KERNEL); |
| 639 | if (!dma_buf->context) { | 657 | if (!dma_buf->context) { |
| 640 | pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt, | 658 | pci_pool_free(phba->lpfc_nvmet_drb_pool, dma_buf->dbuf.virt, |
| 641 | dma_buf->dbuf.phys); | 659 | dma_buf->dbuf.phys); |
| 642 | pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, | 660 | pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, |
| 643 | dma_buf->hbuf.phys); | 661 | dma_buf->hbuf.phys); |
| @@ -648,7 +666,7 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) | |||
| 648 | dma_buf->iocbq = lpfc_sli_get_iocbq(phba); | 666 | dma_buf->iocbq = lpfc_sli_get_iocbq(phba); |
| 649 | if (!dma_buf->iocbq) { | 667 | if (!dma_buf->iocbq) { |
| 650 | kfree(dma_buf->context); | 668 | kfree(dma_buf->context); |
| 651 | pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt, | 669 | pci_pool_free(phba->lpfc_nvmet_drb_pool, dma_buf->dbuf.virt, |
| 652 | dma_buf->dbuf.phys); | 670 | dma_buf->dbuf.phys); |
| 653 | pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, | 671 | pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, |
| 654 | dma_buf->hbuf.phys); | 672 | dma_buf->hbuf.phys); |
| @@ -678,7 +696,7 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) | |||
| 678 | if (!dma_buf->sglq) { | 696 | if (!dma_buf->sglq) { |
| 679 | lpfc_sli_release_iocbq(phba, dma_buf->iocbq); | 697 | lpfc_sli_release_iocbq(phba, dma_buf->iocbq); |
| 680 | kfree(dma_buf->context); | 698 | kfree(dma_buf->context); |
| 681 | pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt, | 699 | pci_pool_free(phba->lpfc_nvmet_drb_pool, dma_buf->dbuf.virt, |
| 682 | dma_buf->dbuf.phys); | 700 | dma_buf->dbuf.phys); |
| 683 | pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, | 701 | pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, |
| 684 | dma_buf->hbuf.phys); | 702 | dma_buf->hbuf.phys); |
| @@ -718,7 +736,8 @@ lpfc_sli4_nvmet_free(struct lpfc_hba *phba, struct rqb_dmabuf *dmab) | |||
| 718 | lpfc_sli_release_iocbq(phba, dmab->iocbq); | 736 | lpfc_sli_release_iocbq(phba, dmab->iocbq); |
| 719 | kfree(dmab->context); | 737 | kfree(dmab->context); |
| 720 | pci_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys); | 738 | pci_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys); |
| 721 | pci_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys); | 739 | pci_pool_free(phba->lpfc_nvmet_drb_pool, |
| 740 | dmab->dbuf.virt, dmab->dbuf.phys); | ||
| 722 | kfree(dmab); | 741 | kfree(dmab); |
| 723 | } | 742 | } |
| 724 | 743 | ||
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index cc45e9191062..49d5c4700054 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
| @@ -15079,7 +15079,12 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq, | |||
| 15079 | if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) { | 15079 | if (phba->sli4_hba.pc_sli4_params.rqv == LPFC_Q_CREATE_VERSION_1) { |
| 15080 | bf_set(lpfc_rq_context_rqe_count_1, | 15080 | bf_set(lpfc_rq_context_rqe_count_1, |
| 15081 | &rq_create->u.request.context, hrq->entry_count); | 15081 | &rq_create->u.request.context, hrq->entry_count); |
| 15082 | rq_create->u.request.context.buffer_size = LPFC_DATA_BUF_SIZE; | 15082 | if (subtype == LPFC_NVMET) |
| 15083 | rq_create->u.request.context.buffer_size = | ||
| 15084 | LPFC_NVMET_DATA_BUF_SIZE; | ||
| 15085 | else | ||
