Lines Matching defs:phba

53  * @phba: HBA to free memory for
60 lpfc_mem_free_sli_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
66 if (phba->sli_rev == LPFC_SLI_REV4 &&
68 lpfc_sli4_mbox_cmd_free(phba, mbox);
70 lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED);
75 lpfc_mem_alloc_active_rrq_pool_s4(struct lpfc_hba *phba) {
77 int max_xri = phba->sli4_hba.max_cfg_param.max_xri;
83 phba->cfg_rrq_xri_bitmap_sz = bytes;
84 phba->active_rrq_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE,
86 if (!phba->active_rrq_pool)
94 * @phba: HBA to allocate pools for
109 lpfc_mem_alloc(struct lpfc_hba *phba, int align)
111 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool;
115 phba->lpfc_mbuf_pool = dma_pool_create("lpfc_mbuf_pool", &phba->pcidev->dev,
118 if (!phba->lpfc_mbuf_pool)
130 pool->elements[i].virt = dma_pool_alloc(phba->lpfc_mbuf_pool,
138 phba->mbox_mem_pool = mempool_create_kmalloc_pool(LPFC_MBX_POOL_SIZE,
140 if (!phba->mbox_mem_pool)
143 phba->nlp_mem_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE,
145 if (!phba->nlp_mem_pool)
148 if (phba->sli_rev == LPFC_SLI_REV4) {
149 phba->rrq_pool =
152 if (!phba->rrq_pool)
154 phba->lpfc_hrb_pool = dma_pool_create("lpfc_hrb_pool",
155 &phba->pcidev->dev,
157 if (!phba->lpfc_hrb_pool)
160 phba->lpfc_drb_pool = dma_pool_create("lpfc_drb_pool",
161 &phba->pcidev->dev,
163 if (!phba->lpfc_drb_pool)
165 phba->lpfc_hbq_pool = NULL;
167 phba->lpfc_hbq_pool = dma_pool_create("lpfc_hbq_pool",
168 &phba->pcidev->dev, LPFC_BPL_SIZE, align, 0);
169 if (!phba->lpfc_hbq_pool)
171 phba->lpfc_hrb_pool = NULL;
172 phba->lpfc_drb_pool = NULL;
175 if (phba->cfg_EnableXLane) {
176 phba->device_data_mem_pool = mempool_create_kmalloc_pool(
179 if (!phba->device_data_mem_pool)
182 phba->device_data_mem_pool = NULL;
187 dma_pool_destroy(phba->lpfc_drb_pool);
188 phba->lpfc_drb_pool = NULL;
190 dma_pool_destroy(phba->lpfc_hrb_pool);
191 phba->lpfc_hrb_pool = NULL;
193 mempool_destroy(phba->rrq_pool);
194 phba->rrq_pool = NULL;
196 mempool_destroy(phba->nlp_mem_pool);
197 phba->nlp_mem_pool = NULL;
199 mempool_destroy(phba->mbox_mem_pool);
200 phba->mbox_mem_pool = NULL;
203 dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
207 dma_pool_destroy(phba->lpfc_mbuf_pool);
208 phba->lpfc_mbuf_pool = NULL;
214 lpfc_nvmet_mem_alloc(struct lpfc_hba *phba)
216 phba->lpfc_nvmet_drb_pool =
218 &phba->pcidev->dev, LPFC_NVMET_DATA_BUF_SIZE,
220 if (!phba->lpfc_nvmet_drb_pool) {
221 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
230 * @phba: HBA to free memory for
238 lpfc_mem_free(struct lpfc_hba *phba)
241 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool;
245 lpfc_sli_hbqbuf_free_all(phba);
246 dma_pool_destroy(phba->lpfc_nvmet_drb_pool);
247 phba->lpfc_nvmet_drb_pool = NULL;
249 dma_pool_destroy(phba->lpfc_drb_pool);
250 phba->lpfc_drb_pool = NULL;
252 dma_pool_destroy(phba->lpfc_hrb_pool);
253 phba->lpfc_hrb_pool = NULL;
255 dma_pool_destroy(phba->lpfc_hbq_pool);
256 phba->lpfc_hbq_pool = NULL;
258 mempool_destroy(phba->rrq_pool);
259 phba->rrq_pool = NULL;
262 mempool_destroy(phba->nlp_mem_pool);
263 phba->nlp_mem_pool = NULL;
264 if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) {
265 mempool_destroy(phba->active_rrq_pool);
266 phba->active_rrq_pool = NULL;
270 mempool_destroy(phba->mbox_mem_pool);
271 phba->mbox_mem_pool = NULL;
275 dma_pool_free(phba->lpfc_mbuf_pool, pool->elements[i].virt,
279 dma_pool_destroy(phba->lpfc_mbuf_pool);
280 phba->lpfc_mbuf_pool = NULL;
283 if (phba->device_data_mem_pool) {
285 while (!list_empty(&phba->luns)) {
286 device_data = list_first_entry(&phba->luns,
290 mempool_free(device_data, phba->device_data_mem_pool);
292 mempool_destroy(phba->device_data_mem_pool);
294 phba->device_data_mem_pool = NULL;
300 * @phba: HBA to free memory for
310 lpfc_mem_free_all(struct lpfc_hba *phba)
312 struct lpfc_sli *psli = &phba->sli;
318 lpfc_mem_free_sli_mbox(phba, mbox);
323 lpfc_mem_free_sli_mbox(phba, mbox);
326 spin_lock_irq(&phba->hbalock);
328 spin_unlock_irq(&phba->hbalock);
331 lpfc_mem_free_sli_mbox(phba, mbox);
336 lpfc_mem_free(phba);
339 dma_pool_destroy(phba->lpfc_sg_dma_buf_pool);
340 phba->lpfc_sg_dma_buf_pool = NULL;
342 dma_pool_destroy(phba->lpfc_cmd_rsp_buf_pool);
343 phba->lpfc_cmd_rsp_buf_pool = NULL;
346 if (phba->cgn_i) {
347 dma_free_coherent(&phba->pcidev->dev,
349 phba->cgn_i->virt, phba->cgn_i->phys);
350 kfree(phba->cgn_i);
351 phba->cgn_i = NULL;
355 if (phba->rx_monitor) {
356 lpfc_rx_monitor_destroy_ring(phba->rx_monitor);
357 kfree(phba->rx_monitor);
358 phba->rx_monitor = NULL;
370 * @phba: HBA which owns the pool to allocate from
380 * phba->hbalock.
387 lpfc_mbuf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
389 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool;
393 ret = dma_pool_alloc(phba->lpfc_mbuf_pool, GFP_KERNEL, handle);
395 spin_lock_irqsave(&phba->hbalock, iflags);
401 spin_unlock_irqrestore(&phba->hbalock, iflags);
407 * @phba: HBA which owns the pool to return to
414 * Notes: Must be called with phba->hbalock held to synchronize access to
420 __lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
422 struct lpfc_dma_pool *pool = &phba->lpfc_mbuf_safety_pool;
429 dma_pool_free(phba->lpfc_mbuf_pool, virt, dma);
436 * @phba: HBA which owns the pool to return to
443 * Notes: Takes phba->hbalock. Can be called with or without other locks held.
448 lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
452 spin_lock_irqsave(&phba->hbalock, iflags);
453 __lpfc_mbuf_free(phba, virt, dma);
454 spin_unlock_irqrestore(&phba->hbalock, iflags);
461 * @phba: HBA which owns the pool to allocate from
473 lpfc_nvmet_buf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
477 ret = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool, GFP_KERNEL, handle);
484 * @phba: HBA which owns the pool to return to
491 lpfc_nvmet_buf_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma)
493 dma_pool_free(phba->lpfc_sg_dma_buf_pool, virt, dma);
498 * @phba: HBA to allocate HBQ buffer for
510 lpfc_els_hbq_alloc(struct lpfc_hba *phba)
518 hbqbp->dbuf.virt = dma_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
530 * @phba: HBA buffer was allocated for
541 lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp)
543 dma_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys);
550 * @phba: HBA to allocate a receive buffer for
562 lpfc_sli4_rb_alloc(struct lpfc_hba *phba)
570 dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
576 dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_drb_pool, GFP_KERNEL,
579 dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
590 * @phba: HBA buffer was allocated for
601 lpfc_sli4_rb_free(struct lpfc_hba *phba, struct hbq_dmabuf *dmab)
603 dma_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
604 dma_pool_free(phba->lpfc_drb_pool, dmab->dbuf.virt, dmab->dbuf.phys);
610 * @phba: HBA to allocate a receive buffer for
620 lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba)
628 dma_buf->hbuf.virt = dma_pool_alloc(phba->lpfc_hrb_pool, GFP_KERNEL,
634 dma_buf->dbuf.virt = dma_pool_alloc(phba->lpfc_nvmet_drb_pool,
637 dma_pool_free(phba->lpfc_hrb_pool, dma_buf->hbuf.virt,
648 * @phba: HBA buffer was allocated for
659 lpfc_sli4_nvmet_free(struct lpfc_hba *phba, struct rqb_dmabuf *dmab)
661 dma_pool_free(phba->lpfc_hrb_pool, dmab->hbuf.virt, dmab->hbuf.phys);
662 dma_pool_free(phba->lpfc_nvmet_drb_pool,
669 * @phba: HBA buffer is associated with
675 * Notes: Takes phba->hbalock. Can be called with or without other locks held.
680 lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp)
688 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
691 spin_lock_irqsave(&phba->hbalock, flags);
692 if (!phba->hbq_in_use) {
693 spin_unlock_irqrestore(&phba->hbalock, flags);
698 (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer)
699 (phba, hbq_entry);
701 lpfc_sli_free_hbq(phba, hbq_entry);
703 spin_unlock_irqrestore(&phba->hbalock, flags);
705 lpfc_mbuf_free(phba, mp->virt, mp->phys);
713 * @phba: HBA buffer is associated with
719 * Notes: Takes phba->hbalock. Can be called with or without other locks held.
724 lpfc_rq_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp)
739 spin_lock_irqsave(&phba->hbalock, flags);
747 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
756 (rqbp->rqb_free_buffer)(phba, rqb_entry);
762 spin_unlock_irqrestore(&phba->hbalock, flags);