diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mem.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mem.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 3594c469494f..43c3b8a0d76a 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c | |||
@@ -231,21 +231,34 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) | |||
231 | return; | 231 | return; |
232 | } | 232 | } |
233 | 233 | ||
234 | void * | 234 | struct hbq_dmabuf * |
235 | lpfc_hbq_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle) | 235 | lpfc_els_hbq_alloc(struct lpfc_hba *phba) |
236 | { | 236 | { |
237 | void *ret; | 237 | struct hbq_dmabuf *hbqbp; |
238 | ret = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_ATOMIC, handle); | 238 | |
239 | return ret; | 239 | hbqbp = kmalloc(sizeof(struct hbq_dmabuf), GFP_KERNEL); |
240 | if (!hbqbp) | ||
241 | return NULL; | ||
242 | |||
243 | hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL, | ||
244 | &hbqbp->dbuf.phys); | ||
245 | if (!hbqbp->dbuf.virt) { | ||
246 | kfree(hbqbp); | ||
247 | return NULL; | ||
248 | } | ||
249 | hbqbp->size = LPFC_BPL_SIZE; | ||
250 | return hbqbp; | ||
240 | } | 251 | } |
241 | 252 | ||
242 | void | 253 | void |
243 | lpfc_hbq_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma) | 254 | lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp) |
244 | { | 255 | { |
245 | pci_pool_free(phba->lpfc_hbq_pool, virt, dma); | 256 | pci_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys); |
257 | kfree(hbqbp); | ||
246 | return; | 258 | return; |
247 | } | 259 | } |
248 | 260 | ||
261 | /* This is ONLY called for the LPFC_ELS_HBQ */ | ||
249 | void | 262 | void |
250 | lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) | 263 | lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) |
251 | { | 264 | { |
@@ -254,9 +267,8 @@ lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) | |||
254 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { | 267 | if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { |
255 | hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf); | 268 | hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf); |
256 | if (hbq_entry->tag == -1) { | 269 | if (hbq_entry->tag == -1) { |
257 | lpfc_hbq_free(phba, hbq_entry->dbuf.virt, | 270 | (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer) |
258 | hbq_entry->dbuf.phys); | 271 | (phba, hbq_entry); |
259 | kfree(hbq_entry); | ||
260 | } else { | 272 | } else { |
261 | lpfc_sli_free_hbq(phba, hbq_entry); | 273 | lpfc_sli_free_hbq(phba, hbq_entry); |
262 | } | 274 | } |