Commit 771db5c0 authored by Romain Perier's avatar Romain Perier Committed by Martin K. Petersen

scsi: lpfc: Replace PCI pool old API

The PCI pool API is deprecated. This commit replaces the PCI pool old
API by the appropriate function with the DMA pool API. It also updates
some comments, accordingly.
Signed-off-by: default avatarRomain Perier <romain.perier@collabora.com>
Reviewed-by: default avatarPeter Senna Tschudin <peter.senna@collabora.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent decab9a6
...@@ -946,14 +946,14 @@ struct lpfc_hba { ...@@ -946,14 +946,14 @@ struct lpfc_hba {
struct list_head active_rrq_list; struct list_head active_rrq_list;
spinlock_t hbalock; spinlock_t hbalock;
/* pci_mem_pools */ /* dma_mem_pools */
struct pci_pool *lpfc_sg_dma_buf_pool; struct dma_pool *lpfc_sg_dma_buf_pool;
struct pci_pool *lpfc_mbuf_pool; struct dma_pool *lpfc_mbuf_pool;
struct pci_pool *lpfc_hrb_pool; /* header receive buffer pool */ struct dma_pool *lpfc_hrb_pool; /* header receive buffer pool */
struct pci_pool *lpfc_drb_pool; /* data receive buffer pool */ struct dma_pool *lpfc_drb_pool; /* data receive buffer pool */
struct pci_pool *lpfc_nvmet_drb_pool; /* data receive buffer pool */ struct dma_pool *lpfc_nvmet_drb_pool; /* data receive buffer pool */
struct pci_pool *lpfc_hbq_pool; /* SLI3 hbq buffer pool */ struct dma_pool *lpfc_hbq_pool; /* SLI3 hbq buffer pool */
struct pci_pool *txrdy_payload_pool; struct dma_pool *txrdy_payload_pool;
struct lpfc_dma_pool lpfc_mbuf_safety_pool; struct lpfc_dma_pool lpfc_mbuf_safety_pool;
mempool_t *mbox_mem_pool; mempool_t *mbox_mem_pool;
......
...@@ -3275,7 +3275,7 @@ lpfc_scsi_free(struct lpfc_hba *phba) ...@@ -3275,7 +3275,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put, list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_put,
list) { list) {
list_del(&sb->list); list_del(&sb->list);
pci_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
sb->dma_handle); sb->dma_handle);
kfree(sb); kfree(sb);
phba->total_scsi_bufs--; phba->total_scsi_bufs--;
...@@ -3286,7 +3286,7 @@ lpfc_scsi_free(struct lpfc_hba *phba) ...@@ -3286,7 +3286,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get, list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list_get,
list) { list) {
list_del(&sb->list); list_del(&sb->list);
pci_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data, dma_pool_free(phba->lpfc_sg_dma_buf_pool, sb->data,
sb->dma_handle); sb->dma_handle);
kfree(sb); kfree(sb);
phba->total_scsi_bufs--; phba->total_scsi_bufs--;
...@@ -3317,7 +3317,7 @@ lpfc_nvme_free(struct lpfc_hba *phba) ...@@ -3317,7 +3317,7 @@ lpfc_nvme_free(struct lpfc_hba *phba)
list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next, list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next,
&phba->lpfc_nvme_buf_list_put, list) { &phba->lpfc_nvme_buf_list_put, list) {
list_del(&lpfc_ncmd->list); list_del(&lpfc_ncmd->list);
pci_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data, dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
lpfc_ncmd->dma_handle); lpfc_ncmd->dma_handle);
kfree(lpfc_ncmd); kfree(lpfc_ncmd);
phba->total_nvme_bufs--; phba->total_nvme_bufs--;
...@@ -3328,7 +3328,7 @@ lpfc_nvme_free(struct lpfc_hba *phba) ...@@ -3328,7 +3328,7 @@ lpfc_nvme_free(struct lpfc_hba *phba)
list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next, list_for_each_entry_safe(lpfc_ncmd, lpfc_ncmd_next,
&phba->lpfc_nvme_buf_list_get, list) { &phba->lpfc_nvme_buf_list_get, list) {
list_del(&lpfc_ncmd->list); list_del(&lpfc_ncmd->list);
pci_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data, dma_pool_free(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data,
lpfc_ncmd->dma_handle); lpfc_ncmd->dma_handle);
kfree(lpfc_ncmd); kfree(lpfc_ncmd);
phba->total_nvme_bufs--; phba->total_nvme_bufs--;
...@@ -3640,7 +3640,7 @@ lpfc_sli4_scsi_sgl_update(struct lpfc_hba *phba) ...@@ -3640,7 +3640,7 @@ lpfc_sli4_scsi_sgl_update(struct lpfc_hba *phba)
list_remove_head(&scsi_sgl_list, psb, list_remove_head(&scsi_sgl_list, psb,
struct lpfc_scsi_buf, list); struct lpfc_scsi_buf, list);
if (psb) { if (psb) {
pci_pool_free(phba->lpfc_sg_dma_buf_pool, dma_pool_free(phba->lpfc_sg_dma_buf_pool,
psb->data, psb->dma_handle); psb->data, psb->dma_handle);
kfree(psb); kfree(psb);
} }
...@@ -3774,7 +3774,7 @@ lpfc_sli4_nvme_sgl_update(struct lpfc_hba *phba) ...@@ -3774,7 +3774,7 @@ lpfc_sli4_nvme_sgl_update(struct lpfc_hba *phba)
list_remove_head(&nvme_sgl_list, lpfc_ncmd, list_remove_head(&nvme_sgl_list, lpfc_ncmd,
struct lpfc_nvme_buf, list); struct lpfc_nvme_buf, list);
if (lpfc_ncmd) { if (lpfc_ncmd) {
pci_pool_free(phba->lpfc_sg_dma_buf_pool, dma_pool_free(phba->lpfc_sg_dma_buf_pool,
lpfc_ncmd->data, lpfc_ncmd->data,
lpfc_ncmd->dma_handle); lpfc_ncmd->dma_handle);
kfree(lpfc_ncmd); kfree(lpfc_ncmd);
...@@ -6846,8 +6846,8 @@ lpfc_create_shost(struct lpfc_hba *phba) ...@@ -6846,8 +6846,8 @@ lpfc_create_shost(struct lpfc_hba *phba)
if (phba->nvmet_support) { if (phba->nvmet_support) {
/* Only 1 vport (pport) will support NVME target */ /* Only 1 vport (pport) will support NVME target */
if (phba->txrdy_payload_pool == NULL) { if (phba->txrdy_payload_pool == NULL) {
phba->txrdy_payload_pool = pci_pool_create( phba->txrdy_payload_pool = dma_pool_create(
"txrdy_pool", phba->pcidev, "txrdy_pool", &phba->pcidev->dev,
TXRDY_PAYLOAD_LEN, 16, 0); TXRDY_PAYLOAD_LEN, 16, 0);
if (phba->txrdy_payload_pool) { if (phba->txrdy_payload_pool) {
phba->targetport = NULL; phba->targetport = NULL;
......
This diff is collapsed.
...@@ -1939,7 +1939,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc) ...@@ -1939,7 +1939,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
* pci bus space for an I/O. The DMA buffer includes the * pci bus space for an I/O. The DMA buffer includes the
* number of SGE's necessary to support the sg_tablesize. * number of SGE's necessary to support the sg_tablesize.
*/ */
lpfc_ncmd->data = pci_pool_alloc(phba->lpfc_sg_dma_buf_pool, lpfc_ncmd->data = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool,
GFP_KERNEL, GFP_KERNEL,
&lpfc_ncmd->dma_handle); &lpfc_ncmd->dma_handle);
if (!lpfc_ncmd->data) { if (!lpfc_ncmd->data) {
...@@ -1950,7 +1950,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc) ...@@ -1950,7 +1950,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
lxri = lpfc_sli4_next_xritag(phba); lxri = lpfc_sli4_next_xritag(phba);
if (lxri == NO_XRI) { if (lxri == NO_XRI) {
pci_pool_free(phba->lpfc_sg_dma_buf_pool, dma_pool_free(phba->lpfc_sg_dma_buf_pool,
lpfc_ncmd->data, lpfc_ncmd->dma_handle); lpfc_ncmd->data, lpfc_ncmd->dma_handle);
kfree(lpfc_ncmd); kfree(lpfc_ncmd);
break; break;
...@@ -1961,7 +1961,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc) ...@@ -1961,7 +1961,7 @@ lpfc_new_nvme_buf(struct lpfc_vport *vport, int num_to_alloc)
/* Allocate iotag for lpfc_ncmd->cur_iocbq. */ /* Allocate iotag for lpfc_ncmd->cur_iocbq. */
iotag = lpfc_sli_next_iotag(phba, pwqeq); iotag = lpfc_sli_next_iotag(phba, pwqeq);
if (iotag == 0) { if (iotag == 0) {
pci_pool_free(phba->lpfc_sg_dma_buf_pool, dma_pool_free(phba->lpfc_sg_dma_buf_pool,
lpfc_ncmd->data, lpfc_ncmd->dma_handle); lpfc_ncmd->data, lpfc_ncmd->dma_handle);
kfree(lpfc_ncmd); kfree(lpfc_ncmd);
lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR, lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
......
...@@ -175,7 +175,7 @@ lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba, struct lpfc_nvmet_ctxbuf *ctx_buf) ...@@ -175,7 +175,7 @@ lpfc_nvmet_ctxbuf_post(struct lpfc_hba *phba, struct lpfc_nvmet_ctxbuf *ctx_buf)
unsigned long iflag; unsigned long iflag;
if (ctxp->txrdy) { if (ctxp->txrdy) {
pci_pool_free(phba->txrdy_payload_pool, ctxp->txrdy, dma_pool_free(phba->txrdy_payload_pool, ctxp->txrdy,
ctxp->txrdy_phys); ctxp->txrdy_phys);
ctxp->txrdy = NULL; ctxp->txrdy = NULL;
ctxp->txrdy_phys = 0; ctxp->txrdy_phys = 0;
...@@ -1909,7 +1909,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, ...@@ -1909,7 +1909,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
case NVMET_FCOP_WRITEDATA: case NVMET_FCOP_WRITEDATA:
/* Words 0 - 2 : The first sg segment */ /* Words 0 - 2 : The first sg segment */
txrdy = pci_pool_alloc(phba->txrdy_payload_pool, txrdy = dma_pool_alloc(phba->txrdy_payload_pool,
GFP_KERNEL, &physaddr); GFP_KERNEL, &physaddr);
if (!txrdy) { if (!txrdy) {
lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR, lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
......
...@@ -416,7 +416,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc) ...@@ -416,7 +416,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc)
* struct fcp_cmnd, struct fcp_rsp and the number of bde's * struct fcp_cmnd, struct fcp_rsp and the number of bde's
* necessary to support the sg_tablesize. * necessary to support the sg_tablesize.
*/ */
psb->data = pci_pool_zalloc(phba->lpfc_sg_dma_buf_pool, psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
GFP_KERNEL, &psb->dma_handle); GFP_KERNEL, &psb->dma_handle);
if (!psb->data) { if (!psb->data) {
kfree(psb); kfree(psb);
...@@ -427,7 +427,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc) ...@@ -427,7 +427,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc)
/* Allocate iotag for psb->cur_iocbq. */ /* Allocate iotag for psb->cur_iocbq. */
iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq); iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq);
if (iotag == 0) { if (iotag == 0) {
pci_pool_free(phba->lpfc_sg_dma_buf_pool, dma_pool_free(phba->lpfc_sg_dma_buf_pool,
psb->data, psb->dma_handle); psb->data, psb->dma_handle);
kfree(psb); kfree(psb);
break; break;
...@@ -826,7 +826,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc) ...@@ -826,7 +826,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
* for the struct fcp_cmnd, struct fcp_rsp and the number * for the struct fcp_cmnd, struct fcp_rsp and the number
* of bde's necessary to support the sg_tablesize. * of bde's necessary to support the sg_tablesize.
*/ */
psb->data = pci_pool_zalloc(phba->lpfc_sg_dma_buf_pool, psb->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool,
GFP_KERNEL, &psb->dma_handle); GFP_KERNEL, &psb->dma_handle);
if (!psb->data) { if (!psb->data) {
kfree(psb); kfree(psb);
...@@ -839,7 +839,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc) ...@@ -839,7 +839,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
*/ */
if (phba->cfg_enable_bg && (((unsigned long)(psb->data) & if (phba->cfg_enable_bg && (((unsigned long)(psb->data) &
(unsigned long)(SLI4_PAGE_SIZE - 1)) != 0)) { (unsigned long)(SLI4_PAGE_SIZE - 1)) != 0)) {
pci_pool_free(phba->lpfc_sg_dma_buf_pool, dma_pool_free(phba->lpfc_sg_dma_buf_pool,
psb->data, psb->dma_handle); psb->data, psb->dma_handle);
kfree(psb); kfree(psb);
break; break;
...@@ -848,7 +848,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc) ...@@ -848,7 +848,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
lxri = lpfc_sli4_next_xritag(phba); lxri = lpfc_sli4_next_xritag(phba);
if (lxri == NO_XRI) { if (lxri == NO_XRI) {
pci_pool_free(phba->lpfc_sg_dma_buf_pool, dma_pool_free(phba->lpfc_sg_dma_buf_pool,
psb->data, psb->dma_handle); psb->data, psb->dma_handle);
kfree(psb); kfree(psb);
break; break;
...@@ -857,7 +857,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc) ...@@ -857,7 +857,7 @@ lpfc_new_scsi_buf_s4(struct lpfc_vport *vport, int num_to_alloc)
/* Allocate iotag for psb->cur_iocbq. */ /* Allocate iotag for psb->cur_iocbq. */
iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq); iotag = lpfc_sli_next_iotag(phba, &psb->cur_iocbq);
if (iotag == 0) { if (iotag == 0) {
pci_pool_free(phba->lpfc_sg_dma_buf_pool, dma_pool_free(phba->lpfc_sg_dma_buf_pool,
psb->data, psb->dma_handle); psb->data, psb->dma_handle);
kfree(psb); kfree(psb);
lpfc_printf_log(phba, KERN_ERR, LOG_FCP, lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
......
...@@ -17051,7 +17051,7 @@ lpfc_sli4_mds_loopback_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -17051,7 +17051,7 @@ lpfc_sli4_mds_loopback_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
struct lpfc_dmabuf *pcmd = cmdiocb->context2; struct lpfc_dmabuf *pcmd = cmdiocb->context2;
if (pcmd && pcmd->virt) if (pcmd && pcmd->virt)
pci_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys); dma_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys);
kfree(pcmd); kfree(pcmd);
lpfc_sli_release_iocbq(phba, cmdiocb); lpfc_sli_release_iocbq(phba, cmdiocb);
} }
...@@ -17079,7 +17079,7 @@ lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vport, ...@@ -17079,7 +17079,7 @@ lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vport,
/* Allocate buffer for command payload */ /* Allocate buffer for command payload */
pcmd = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL); pcmd = kmalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
if (pcmd) if (pcmd)
pcmd->virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL, pcmd->virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
&pcmd->phys); &pcmd->phys);
if (!pcmd || !pcmd->virt) if (!pcmd || !pcmd->virt)
goto exit; goto exit;
...@@ -17128,7 +17128,7 @@ lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vport, ...@@ -17128,7 +17128,7 @@ lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vport,
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
"2023 Unable to process MDS loopback frame\n"); "2023 Unable to process MDS loopback frame\n");
if (pcmd && pcmd->virt) if (pcmd && pcmd->virt)
pci_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys); dma_pool_free(phba->lpfc_drb_pool, pcmd->virt, pcmd->phys);
kfree(pcmd); kfree(pcmd);
lpfc_sli_release_iocbq(phba, iocbq); lpfc_sli_release_iocbq(phba, iocbq);
lpfc_in_buf_free(phba, &dmabuf->dbuf); lpfc_in_buf_free(phba, &dmabuf->dbuf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment