diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mem.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mem.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 3aa1dff15446..435dc2ec9357 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c | |||
@@ -82,8 +82,16 @@ lpfc_mem_alloc(struct lpfc_hba * phba) | |||
82 | if (!phba->nlp_mem_pool) | 82 | if (!phba->nlp_mem_pool) |
83 | goto fail_free_mbox_pool; | 83 | goto fail_free_mbox_pool; |
84 | 84 | ||
85 | phba->lpfc_hbq_pool = pci_pool_create("lpfc_hbq_pool",phba->pcidev, | ||
86 | LPFC_BPL_SIZE, 8, 0); | ||
87 | if (!phba->lpfc_hbq_pool) | ||
88 | goto fail_free_nlp_mem_pool; | ||
89 | |||
85 | return 0; | 90 | return 0; |
86 | 91 | ||
92 | fail_free_nlp_mem_pool: | ||
93 | mempool_destroy(phba->nlp_mem_pool); | ||
94 | phba->nlp_mem_pool = NULL; | ||
87 | fail_free_mbox_pool: | 95 | fail_free_mbox_pool: |
88 | mempool_destroy(phba->mbox_mem_pool); | 96 | mempool_destroy(phba->mbox_mem_pool); |
89 | phba->mbox_mem_pool = NULL; | 97 | phba->mbox_mem_pool = NULL; |
@@ -111,6 +119,8 @@ lpfc_mem_free(struct lpfc_hba * phba) | |||
111 | struct lpfc_dmabuf *mp; | 119 | struct lpfc_dmabuf *mp; |
112 | int i; | 120 | int i; |
113 | 121 | ||
122 | lpfc_sli_hbqbuf_free_all(phba); | ||
123 | |||
114 | spin_lock_irq(&phba->hbalock); | 124 | spin_lock_irq(&phba->hbalock); |
115 | list_for_each_entry_safe(mbox, next_mbox, &psli->mboxq, list) { | 125 | list_for_each_entry_safe(mbox, next_mbox, &psli->mboxq, list) { |
116 | mp = (struct lpfc_dmabuf *) (mbox->context1); | 126 | mp = (struct lpfc_dmabuf *) (mbox->context1); |
@@ -140,12 +150,14 @@ lpfc_mem_free(struct lpfc_hba * phba) | |||
140 | pool->elements[i].phys); | 150 | pool->elements[i].phys); |
141 | kfree(pool->elements); | 151 | kfree(pool->elements); |
142 | 152 | ||
153 | pci_pool_destroy(phba->lpfc_hbq_pool); | ||
143 | mempool_destroy(phba->nlp_mem_pool); | 154 | mempool_destroy(phba->nlp_mem_pool); |
144 | mempool_destroy(phba->mbox_mem_pool); | 155 | mempool_destroy(phba->mbox_mem_pool); |
145 | 156 | ||
146 | pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); | 157 | pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); |
147 | pci_pool_destroy(phba->lpfc_mbuf_pool); | 158 | pci_pool_destroy(phba->lpfc_mbuf_pool); |
148 | 159 | ||
160 | phba->lpfc_hbq_pool = NULL; | ||
149 | phba->nlp_mem_pool = NULL; | 161 | phba->nlp_mem_pool = NULL; |
150 | phba->mbox_mem_pool = NULL; | 162 | phba->mbox_mem_pool = NULL; |
151 | phba->lpfc_scsi_dma_buf_pool = NULL; | 163 | phba->lpfc_scsi_dma_buf_pool = NULL; |
@@ -201,3 +213,20 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) | |||
201 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 213 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
202 | return; | 214 | return; |
203 | } | 215 | } |
216 | |||
217 | |||
218 | void * | ||
219 | lpfc_hbq_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle) | ||
220 | { | ||
221 | void *ret; | ||
222 | ret = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_ATOMIC, handle); | ||
223 | return ret; | ||
224 | } | ||
225 | |||
226 | void | ||
227 | lpfc_hbq_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma) | ||
228 | { | ||
229 | pci_pool_free(phba->lpfc_hbq_pool, virt, dma); | ||
230 | return; | ||
231 | } | ||
232 | |||