Lines Matching refs:phba

54 lpfc_mem_alloc_active_rrq_pool_s4(struct lpfc_hba *phba) {  in lpfc_mem_alloc_active_rrq_pool_s4()  argument
56 int max_xri = phba->sli4_hba.max_cfg_param.max_xri; in lpfc_mem_alloc_active_rrq_pool_s4()
62 phba->cfg_rrq_xri_bitmap_sz = bytes; in lpfc_mem_alloc_active_rrq_pool_s4()
63 phba->active_rrq_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE, in lpfc_mem_alloc_active_rrq_pool_s4()
65 if (!phba->active_rrq_pool) in lpfc_mem_alloc_active_rrq_pool_s4()
87 lpfc_mem_alloc(struct lpfc_hba *phba, int align) in lpfc_mem_alloc() argument
89 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; in lpfc_mem_alloc()
92 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_mem_alloc()
94 if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) in lpfc_mem_alloc()
95 i = phba->cfg_sg_dma_buf_size; in lpfc_mem_alloc()
99 phba->lpfc_sg_dma_buf_pool = in lpfc_mem_alloc()
101 &phba->pcidev->dev, in lpfc_mem_alloc()
102 phba->cfg_sg_dma_buf_size, in lpfc_mem_alloc()
104 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_mem_alloc()
108 phba->lpfc_sg_dma_buf_pool = in lpfc_mem_alloc()
110 &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, in lpfc_mem_alloc()
113 if (!phba->lpfc_sg_dma_buf_pool) in lpfc_mem_alloc()
117 phba->lpfc_mbuf_pool = dma_pool_create("lpfc_mbuf_pool", &phba->pcidev->dev, in lpfc_mem_alloc()
120 if (!phba->lpfc_mbuf_pool) in lpfc_mem_alloc()
132 pool->elements[i].virt = dma_pool_alloc(phba->lpfc_mbuf_pool, in lpfc_mem_alloc()
140 phba->mbox_mem_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE, in lpfc_mem_alloc()
142 if (!phba->mbox_mem_pool) in lpfc_mem_alloc()
145 phba->nlp_mem_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE, in lpfc_mem_alloc()
147 if (!phba->nlp_mem_pool) in lpfc_mem_alloc()
150 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_mem_alloc()
151 phba->rrq_pool = in lpfc_mem_alloc()
154 if (!phba->rrq_pool) in lpfc_mem_alloc()
156 phba->lpfc_hrb_pool = dma_pool_create("lpfc_hrb_pool", in lpfc_mem_alloc()
157 &phba->pcidev->dev, in lpfc_mem_alloc()
159 if (!phba->lpfc_hrb_pool) in lpfc_mem_alloc()
162 phba->lpfc_drb_pool = dma_pool_create("lpfc_drb_pool", in lpfc_mem_alloc()
163 &phba->pcidev->dev, in lpfc_mem_alloc()
165 if (!phba->lpfc_drb_pool) in lpfc_mem_alloc()
167 phba->lpfc_hbq_pool = NULL; in lpfc_mem_alloc()
169 phba->lpfc_hbq_pool = dma_pool_create("lpfc_hbq_pool", in lpfc_mem_alloc()
170 &phba->pcidev->dev, LPFC_BPL_SIZE, align, 0); in lpfc_mem_alloc()
171 if (!phba->lpfc_hbq_pool) in lpfc_mem_alloc()
173 phba->lpfc_hrb_pool = NULL; in lpfc_mem_alloc()
174 phba->lpfc_drb_pool = NULL; in lpfc_mem_alloc()
177 if (phba->cfg_EnableXLane) { in lpfc_mem_alloc()
178 phba->device_data_mem_pool = mempool_create_kmalloc_pool( in lpfc_mem_alloc()
181 if (!phba->device_data_mem_pool) in lpfc_mem_alloc()
184 phba->device_data_mem_pool = NULL; in lpfc_mem_alloc()
189 dma_pool_destroy(phba->lpfc_drb_pool); in lpfc_mem_alloc()
190 phba->lpfc_drb_pool = NULL; in lpfc_mem_alloc()
192 dma_pool_destroy(phba->lpfc_hrb_pool); in lpfc_mem_alloc()
193 phba->lpfc_hrb_pool = NULL; in lpfc_mem_alloc()
195 mempool_destroy(phba->rrq_pool); in lpfc_mem_alloc()
196 phba->rrq_pool = NULL; in lpfc_mem_alloc()
198 mempool_destroy(phba->nlp_mem_pool); in lpfc_mem_alloc()
199 phba->nlp_mem_pool = NULL; in lpfc_mem_alloc()
201 mempool_destroy(phba->mbox_mem_pool); in lpfc_mem_alloc()
202 phba->mbox_mem_pool = NULL; in lpfc_mem_alloc()
205 dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt, in lpfc_mem_alloc()
209 dma_pool_destroy(phba->lpfc_mbuf_pool); in lpfc_mem_alloc()
210 phba->lpfc_mbuf_pool = NULL; in lpfc_mem_alloc()
212 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_mem_alloc()
213 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_mem_alloc()
219 lpfc_nvmet_mem_alloc(struct lpfc_hba *phba) in lpfc_nvmet_mem_alloc() argument
221 phba->lpfc_nvmet_drb_pool = in lpfc_nvmet_mem_alloc()
223 &phba->pcidev->dev, LPFC_NVMET_DATA_BUF_SIZE, in lpfc_nvmet_mem_alloc()
225 if (!phba->lpfc_nvmet_drb_pool) { in lpfc_nvmet_mem_alloc()
226 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_nvmet_mem_alloc()
243 lpfc_mem_free(struct lpfc_hba *phba) in lpfc_mem_free() argument
246 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; in lpfc_mem_free()
250 lpfc_sli_hbqbuf_free_all(phba); in lpfc_mem_free()
251 if (phba->lpfc_nvmet_drb_pool) in lpfc_mem_free()
252 dma_pool_destroy(phba->lpfc_nvmet_drb_pool); in lpfc_mem_free()
253 phba->lpfc_nvmet_drb_pool = NULL; in lpfc_mem_free()
254 if (phba->lpfc_drb_pool) in lpfc_mem_free()
255 dma_pool_destroy(phba->lpfc_drb_pool); in lpfc_mem_free()
256 phba->lpfc_drb_pool = NULL; in lpfc_mem_free()
257 if (phba->lpfc_hrb_pool) in lpfc_mem_free()
258 dma_pool_destroy(phba->lpfc_hrb_pool); in lpfc_mem_free()
259 phba->lpfc_hrb_pool = NULL; in lpfc_mem_free()
260 if (phba->txrdy_payload_pool) in lpfc_mem_free()
261 dma_pool_destroy(phba->txrdy_payload_pool); in lpfc_mem_free()
262 phba->txrdy_payload_pool = NULL; in lpfc_mem_free()
264 if (phba->lpfc_hbq_pool) in lpfc_mem_free()
265 dma_pool_destroy(phba->lpfc_hbq_pool); in lpfc_mem_free()
266 phba->lpfc_hbq_pool = NULL; in lpfc_mem_free()
268 if (phba->rrq_pool) in lpfc_mem_free()
269 mempool_destroy(phba->rrq_pool); in lpfc_mem_free()
270 phba->rrq_pool = NULL; in lpfc_mem_free()
273 mempool_destroy(phba->nlp_mem_pool); in lpfc_mem_free()
274 phba->nlp_mem_pool = NULL; in lpfc_mem_free()
275 if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) { in lpfc_mem_free()
276 mempool_destroy(phba->active_rrq_pool); in lpfc_mem_free()
277 phba->active_rrq_pool = NULL; in lpfc_mem_free()
281 mempool_destroy(phba->mbox_mem_pool); in lpfc_mem_free()
282 phba->mbox_mem_pool = NULL; in lpfc_mem_free()
286 dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt, in lpfc_mem_free()
290 dma_pool_destroy(phba->lpfc_mbuf_pool); in lpfc_mem_free()
291 phba->lpfc_mbuf_pool = NULL; in lpfc_mem_free()
294 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool); in lpfc_mem_free()
295 phba->lpfc_sg_dma_buf_pool = NULL; in lpfc_mem_free()
298 if (phba->device_data_mem_pool) { in lpfc_mem_free()
300 while (!list_empty(&phba->luns)) { in lpfc_mem_free()
301 device_data = list_first_entry(&phba->luns, in lpfc_mem_free()
305 mempool_free(device_data, phba->device_data_mem_pool); in lpfc_mem_free()
307 mempool_destroy(phba->device_data_mem_pool); in lpfc_mem_free()
309 phba->device_data_mem_pool = NULL; in lpfc_mem_free()
325 lpfc_mem_free_all(struct lpfc_hba *phba) in lpfc_mem_free_all() argument
327 struct lpfc_sli *psli = &phba->sli; in lpfc_mem_free_all()
335 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_mem_free_all()
339 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mem_free_all()
345 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_mem_free_all()
349 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mem_free_all()
352 spin_lock_irq(&phba->hbalock); in lpfc_mem_free_all()
354 spin_unlock_irq(&phba->hbalock); in lpfc_mem_free_all()
359 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_mem_free_all()
362 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_mem_free_all()
367 lpfc_mem_free(phba); in lpfc_mem_free_all()
395 lpfc_mbuf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle) in lpfc_mbuf_alloc() argument
397 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; in lpfc_mbuf_alloc()
401 ret = dma_pool_alloc(phba->lpfc_mbuf_pool, GFP_KERNEL, handle); in lpfc_mbuf_alloc()
403 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_mbuf_alloc()
409 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_mbuf_alloc()
428 __lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) in __lpfc_mbuf_free() argument
430 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool; in __lpfc_mbuf_free()
437 dma_pool_free(phba->lpfc_mbuf_pool, virt, dma); in __lpfc_mbuf_free()
456 lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) in lpfc_mbuf_free() argument
460 spin_lock_irqsave(&phba->hbalock, iflags); in lpfc_mbuf_free()
461 __lpfc_mbuf_free(phba, virt, dma); in lpfc_mbuf_free()
462 spin_unlock_irqrestore(&phba->hbalock, iflags); in lpfc_mbuf_free()
481 lpfc_nvmet_buf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle) in lpfc_nvmet_buf_alloc() argument
485 ret = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool, GFP_KERNEL, handle); in lpfc_nvmet_buf_alloc()
499 lpfc_nvmet_buf_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma) in lpfc_nvmet_buf_free() argument
501 dma_pool_free(phba->lpfc_sg_dma_buf_pool, virt, dma); in lpfc_nvmet_buf_free()
518 lpfc_els_hbq_alloc(struct lpfc_hba *phba) in lpfc_els_hbq_alloc() argument
526 hbqbp->dbuf.virt = dma_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL, in lpfc_els_hbq_alloc()
549 lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp) in lpfc_els_hbq_free() argument
551 dma_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys); in lpfc_els_hbq_free()
570 lpfc_sli4_rb_alloc(struct lpfc_hba *phba) in lpfc_sli4_rb_alloc() argument
578 dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL, in lpfc_sli4_rb_alloc()
584 dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL, in lpfc_sli4_rb_alloc()
587 dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, in lpfc_sli4_rb_alloc()
609 lpfc_sli4_rb_free(struct lpfc_hba *phba, struct hbq_dmabuf *dmab) in lpfc_sli4_rb_free() argument
611 dma_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys); in lpfc_sli4_rb_free()
612 dma_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys); in lpfc_sli4_rb_free()
630 lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) in lpfc_sli4_nvmet_alloc() argument
638 dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL, in lpfc_sli4_nvmet_alloc()
644 dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_nvmet_drb_pool, in lpfc_sli4_nvmet_alloc()
647 dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt, in lpfc_sli4_nvmet_alloc()
669 lpfc_sli4_nvmet_free(struct lpfc_hba *phba, struct rqb_dmabuf *dmab) in lpfc_sli4_nvmet_free() argument
671 dma_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys); in lpfc_sli4_nvmet_free()
672 dma_pool_free(phba->lpfc_nvmet_drb_pool, in lpfc_sli4_nvmet_free()
690 lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) in lpfc_in_buf_free() argument
698 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { in lpfc_in_buf_free()
701 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_in_buf_free()
702 if (!phba->hbq_in_use) { in lpfc_in_buf_free()
703 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_in_buf_free()
708 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer) in lpfc_in_buf_free()
709 (phba, hbq_entry); in lpfc_in_buf_free()
711 lpfc_sli_free_hbq(phba, hbq_entry); in lpfc_in_buf_free()
713 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_in_buf_free()
715 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_in_buf_free()
734 lpfc_rq_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp) in lpfc_rq_buf_free() argument
749 spin_lock_irqsave(&phba->hbalock, flags); in lpfc_rq_buf_free()
757 (rqbp->rqb_free_buffer)(phba, rqb_entry); in lpfc_rq_buf_free()
758 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, in lpfc_rq_buf_free()
772 spin_unlock_irqrestore(&phba->hbalock, flags); in lpfc_rq_buf_free()