Lines Matching refs:phba

48 lpfc_mem_alloc_active_rrq_pool_s4(struct lpfc_hba *phba) {  in lpfc_mem_alloc_active_rrq_pool_s4()  argument
50 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_mem_alloc_active_rrq_pool_s4()
56 phba->cfg_rrq_xri_bitmap_sz = bytes; in lpfc_mem_alloc_active_rrq_pool_s4()
57 phba->active_rrq_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE, in lpfc_mem_alloc_active_rrq_pool_s4()
59 if (!phba->active_rrq_pool) in lpfc_mem_alloc_active_rrq_pool_s4()
81 lpfc_mem_alloc(struct lpfc_hba *phba, int align) in lpfc_mem_alloc() argument
83 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; in lpfc_mem_alloc()
86 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_mem_alloc()
88 if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) in lpfc_mem_alloc()
89 i = phba->cfg_sg_dma_buf_size; in lpfc_mem_alloc()
93 phba->lpfc_scsi_dma_buf_pool = in lpfc_mem_alloc()
95 phba->pcidev, in lpfc_mem_alloc()
96 phba->cfg_sg_dma_buf_size, in lpfc_mem_alloc()
100 phba->lpfc_scsi_dma_buf_pool = in lpfc_mem_alloc()
102 phba->pcidev, phba->cfg_sg_dma_buf_size, in lpfc_mem_alloc()
106 if (!phba->lpfc_scsi_dma_buf_pool) in lpfc_mem_alloc()
109 phba->lpfc_mbuf_pool = pci_pool_create("lpfc_mbuf_pool", phba->pcidev, in lpfc_mem_alloc()
112 if (!phba->lpfc_mbuf_pool) in lpfc_mem_alloc()
123 pool->elements[i].virt = pci_pool_alloc(phba->lpfc_mbuf_pool, in lpfc_mem_alloc()
131 phba->mbox_mem_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE, in lpfc_mem_alloc()
133 if (!phba->mbox_mem_pool) in lpfc_mem_alloc()
136 phba->nlp_mem_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE, in lpfc_mem_alloc()
138 if (!phba->nlp_mem_pool) in lpfc_mem_alloc()
141 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_mem_alloc()
142 phba->rrq_pool = in lpfc_mem_alloc()
145 if (!phba->rrq_pool) in lpfc_mem_alloc()
147 phba->lpfc_hrb_pool = pci_pool_create("lpfc_hrb_pool", in lpfc_mem_alloc()
148 phba->pcidev, in lpfc_mem_alloc()
150 if (!phba->lpfc_hrb_pool) in lpfc_mem_alloc()
153 phba->lpfc_drb_pool = pci_pool_create("lpfc_drb_pool", in lpfc_mem_alloc()
154 phba->pcidev, in lpfc_mem_alloc()
156 if (!phba->lpfc_drb_pool) in lpfc_mem_alloc()
158 phba->lpfc_hbq_pool = NULL; in lpfc_mem_alloc()
160 phba->lpfc_hbq_pool = pci_pool_create("lpfc_hbq_pool", in lpfc_mem_alloc()
161 phba->pcidev, LPFC_BPL_SIZE, align, 0); in lpfc_mem_alloc()
162 if (!phba->lpfc_hbq_pool) in lpfc_mem_alloc()
164 phba->lpfc_hrb_pool = NULL; in lpfc_mem_alloc()
165 phba->lpfc_drb_pool = NULL; in lpfc_mem_alloc()
168 if (phba->cfg_EnableXLane) { in lpfc_mem_alloc()
169 phba->device_data_mem_pool = mempool_create_kmalloc_pool( in lpfc_mem_alloc()
172 if (!phba->device_data_mem_pool) in lpfc_mem_alloc()
175 phba->device_data_mem_pool = NULL; in lpfc_mem_alloc()
180 pci_pool_destroy(phba->lpfc_hrb_pool); in lpfc_mem_alloc()
181 phba->lpfc_hrb_pool = NULL; in lpfc_mem_alloc()
183 mempool_destroy(phba->rrq_pool); in lpfc_mem_alloc()
184 phba->rrq_pool = NULL; in lpfc_mem_alloc()
186 mempool_destroy(phba->nlp_mem_pool); in lpfc_mem_alloc()
187 phba->nlp_mem_pool = NULL; in lpfc_mem_alloc()
189 mempool_destroy(phba->mbox_mem_pool); in lpfc_mem_alloc()
190 phba->mbox_mem_pool = NULL; in lpfc_mem_alloc()
193 pci_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt, in lpfc_mem_alloc()
197 pci_pool_destroy(phba->lpfc_mbuf_pool); in lpfc_mem_alloc()
198 phba->lpfc_mbuf_pool = NULL; in lpfc_mem_alloc()
200 pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); in lpfc_mem_alloc()
201 phba->lpfc_scsi_dma_buf_pool = NULL; in lpfc_mem_alloc()
216 lpfc_mem_free(struct lpfc_hba *phba) in lpfc_mem_free() argument
219 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; in lpfc_mem_free()
223 lpfc_sli_hbqbuf_free_all(phba); in lpfc_mem_free()
224 if (phba->lpfc_drb_pool) in lpfc_mem_free()
225 pci_pool_destroy(phba->lpfc_drb_pool); in lpfc_mem_free()
226 phba->lpfc_drb_pool = NULL; in lpfc_mem_free()
227 if (phba->lpfc_hrb_pool) in lpfc_mem_free()
228 pci_pool_destroy(phba->lpfc_hrb_pool); in lpfc_mem_free()
229 phba->lpfc_hrb_pool = NULL; in lpfc_mem_free()
231 if (phba->lpfc_hbq_pool) in lpfc_mem_free()
232 pci_pool_destroy(phba->lpfc_hbq_pool); in lpfc_mem_free()
233 phba->lpfc_hbq_pool = NULL; in lpfc_mem_free()
235 if (phba->rrq_pool) in lpfc_mem_free()
236 mempool_destroy(phba->rrq_pool); in lpfc_mem_free()
237 phba->rrq_pool = NULL; in lpfc_mem_free()
240 mempool_destroy(phba->nlp_mem_pool); in lpfc_mem_free()
241 phba->nlp_mem_pool = NULL; in lpfc_mem_free()
242 if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) { in lpfc_mem_free()
243 mempool_destroy(phba->active_rrq_pool); in lpfc_mem_free()
244 phba->active_rrq_pool = NULL; in lpfc_mem_free()
248 mempool_destroy(phba->mbox_mem_pool); in lpfc_mem_free()
249 phba->mbox_mem_pool = NULL; in lpfc_mem_free()
253 pci_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt, in lpfc_mem_free()
257 pci_pool_destroy(phba->lpfc_mbuf_pool); in lpfc_mem_free()
258 phba->lpfc_mbuf_pool = NULL; in lpfc_mem_free()
261 pci_pool_destroy(phba->lpfc_scsi_dma_buf_pool); in lpfc_mem_free()
262 phba->lpfc_scsi_dma_buf_pool = NULL; in lpfc_mem_free()
265 if (phba->device_data_mem_pool) { in lpfc_mem_free()
267 while (!list_empty(&phba->luns)) { in lpfc_mem_free()
268 device_data = list_first_entry(&phba->luns, in lpfc_mem_free()
272 mempool_free(device_data, phba->device_data_mem_pool); in lpfc_mem_free()
274 mempool_destroy(phba->device_data_mem_pool); in lpfc_mem_free()
276 phba->device_data_mem_pool = NULL; in lpfc_mem_free()
292 lpfc_mem_free_all(struct lpfc_hba *phba) in lpfc_mem_free_all() argument
294 struct lpfc_sli *psli = &phba->sli; in lpfc_mem_free_all()
302 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_mem_free_all()
306 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mem_free_all()
312 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_mem_free_all()
316 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mem_free_all()
319 spin_lock_irq(&phba->hbalock); in lpfc_mem_free_all()
321 spin_unlock_irq(&phba->hbalock); in lpfc_mem_free_all()
326 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_mem_free_all()
329 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mem_free_all()
334 lpfc_mem_free(phba); in lpfc_mem_free_all()
362 lpfc_mbuf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle) in lpfc_mbuf_alloc() argument
364 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; in lpfc_mbuf_alloc()
368 ret = pci_pool_alloc(phba->lpfc_mbuf_pool, GFP_KERNEL, handle); in lpfc_mbuf_alloc()
370 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_mbuf_alloc()
376 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_mbuf_alloc()
395 __lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) in __lpfc_mbuf_free() argument
397 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; in __lpfc_mbuf_free()
404 pci_pool_free(phba->lpfc_mbuf_pool, virt, dma); in __lpfc_mbuf_free()
423 lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) in lpfc_mbuf_free() argument
427 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_mbuf_free()
428 __lpfc_mbuf_free(phba, virt, dma); in lpfc_mbuf_free()
429 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_mbuf_free()
447 lpfc_els_hbq_alloc(struct lpfc_hba *phba) in lpfc_els_hbq_alloc() argument
455 hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL, in lpfc_els_hbq_alloc()
478 lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp) in lpfc_els_hbq_free() argument
480 pci_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys); in lpfc_els_hbq_free()
499 lpfc_sli4_rb_alloc(struct lpfc_hba *phba) in lpfc_sli4_rb_alloc() argument
507 dma_buf->hbuf.virt = pci_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL, in lpfc_sli4_rb_alloc()
513 dma_buf->dbuf.virt = pci_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL, in lpfc_sli4_rb_alloc()
516 pci_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, in lpfc_sli4_rb_alloc()
538 lpfc_sli4_rb_free(struct lpfc_hba *phba, struct hbq_dmabuf *dmab) in lpfc_sli4_rb_free() argument
540 pci_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys); in lpfc_sli4_rb_free()
541 pci_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys); in lpfc_sli4_rb_free()
559 lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) in lpfc_in_buf_free() argument
567 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { in lpfc_in_buf_free()
569 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_in_buf_free()
570 if (!phba->hbq_in_use) { in lpfc_in_buf_free()
571 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_in_buf_free()
577 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer) in lpfc_in_buf_free()
578 (phba, hbq_entry); in lpfc_in_buf_free()
580 lpfc_sli_free_hbq(phba, hbq_entry); in lpfc_in_buf_free()
582 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_in_buf_free()
584 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_in_buf_free()