Lines Matching full:pbl

61 /* PBL */
62 static void __free_pbl(struct bnxt_qplib_res *res, struct bnxt_qplib_pbl *pbl, in __free_pbl() argument
69 for (i = 0; i < pbl->pg_count; i++) { in __free_pbl()
70 if (pbl->pg_arr[i]) in __free_pbl()
71 dma_free_coherent(&pdev->dev, pbl->pg_size, in __free_pbl()
73 pbl->pg_arr[i] & in __free_pbl()
75 pbl->pg_map_arr[i]); in __free_pbl()
78 "PBL free pg_arr[%d] empty?!\n", i); in __free_pbl()
79 pbl->pg_arr[i] = NULL; in __free_pbl()
82 vfree(pbl->pg_arr); in __free_pbl()
83 pbl->pg_arr = NULL; in __free_pbl()
84 vfree(pbl->pg_map_arr); in __free_pbl()
85 pbl->pg_map_arr = NULL; in __free_pbl()
86 pbl->pg_count = 0; in __free_pbl()
87 pbl->pg_size = 0; in __free_pbl()
90 static void bnxt_qplib_fill_user_dma_pages(struct bnxt_qplib_pbl *pbl, in bnxt_qplib_fill_user_dma_pages() argument
97 pbl->pg_map_arr[i] = rdma_block_iter_dma_address(&biter); in bnxt_qplib_fill_user_dma_pages()
98 pbl->pg_arr[i] = NULL; in bnxt_qplib_fill_user_dma_pages()
99 pbl->pg_count++; in bnxt_qplib_fill_user_dma_pages()
105 struct bnxt_qplib_pbl *pbl, in __alloc_pbl() argument
120 pbl->pg_arr = vmalloc(pages * sizeof(void *)); in __alloc_pbl()
121 if (!pbl->pg_arr) in __alloc_pbl()
124 pbl->pg_map_arr = vmalloc(pages * sizeof(dma_addr_t)); in __alloc_pbl()
125 if (!pbl->pg_map_arr) { in __alloc_pbl()
126 vfree(pbl->pg_arr); in __alloc_pbl()
127 pbl->pg_arr = NULL; in __alloc_pbl()
130 pbl->pg_count = 0; in __alloc_pbl()
131 pbl->pg_size = sginfo->pgsize; in __alloc_pbl()
135 pbl->pg_arr[i] = dma_alloc_coherent(&pdev->dev, in __alloc_pbl()
136 pbl->pg_size, in __alloc_pbl()
137 &pbl->pg_map_arr[i], in __alloc_pbl()
139 if (!pbl->pg_arr[i]) in __alloc_pbl()
141 pbl->pg_count++; in __alloc_pbl()
145 bnxt_qplib_fill_user_dma_pages(pbl, sginfo); in __alloc_pbl()
150 __free_pbl(res, pbl, is_umem); in __alloc_pbl()
167 __free_pbl(res, &hwq->pbl[i], hwq->is_user); in bnxt_qplib_free_hwq()
169 __free_pbl(res, &hwq->pbl[i], false); in bnxt_qplib_free_hwq()
232 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], hwq_attr->sginfo); in bnxt_qplib_alloc_init_hwq()
252 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); in bnxt_qplib_alloc_init_hwq()
254 /* Alloc PBL pages */ in bnxt_qplib_alloc_init_hwq()
257 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_1], &sginfo); in bnxt_qplib_alloc_init_hwq()
260 /* Fill PDL with PBL page pointers */ in bnxt_qplib_alloc_init_hwq()
262 (dma_addr_t **)hwq->pbl[PBL_LVL_0].pg_arr; in bnxt_qplib_alloc_init_hwq()
263 src_phys_ptr = hwq->pbl[PBL_LVL_1].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
269 for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_alloc_init_hwq()
274 for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_alloc_init_hwq()
281 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_2], in bnxt_qplib_alloc_init_hwq()
290 (dma_addr_t **)hwq->pbl[PBL_LVL_1].pg_arr; in bnxt_qplib_alloc_init_hwq()
291 src_phys_ptr = hwq->pbl[PBL_LVL_2].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
292 for (i = 0; i < hwq->pbl[PBL_LVL_2].pg_count; i++) { in bnxt_qplib_alloc_init_hwq()
298 i = hwq->pbl[PBL_LVL_2].pg_count; in bnxt_qplib_alloc_init_hwq()
316 /* Alloc PBL page */ in bnxt_qplib_alloc_init_hwq()
317 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); in bnxt_qplib_alloc_init_hwq()
321 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_1], in bnxt_qplib_alloc_init_hwq()
328 /* Fill PBL with PTE pointers */ in bnxt_qplib_alloc_init_hwq()
330 (dma_addr_t **)hwq->pbl[PBL_LVL_0].pg_arr; in bnxt_qplib_alloc_init_hwq()
331 src_phys_ptr = hwq->pbl[PBL_LVL_1].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
332 for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; i++) in bnxt_qplib_alloc_init_hwq()
337 i = hwq->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_alloc_init_hwq()
359 hwq->pbl_ptr = hwq->pbl[lvl].pg_arr; in bnxt_qplib_alloc_init_hwq()
360 hwq->pbl_dma_ptr = hwq->pbl[lvl].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
446 pg_count = tbl->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_map_tqm_pgtbl()
449 dma_ptr = &tbl->pbl[PBL_LVL_1].pg_map_arr[k]; in bnxt_qplib_map_tqm_pgtbl()
457 *ptr = cpu_to_le64(tbl->pbl[PBL_LVL_0].pg_map_arr[0] | in bnxt_qplib_map_tqm_pgtbl()
495 * or a 1-to-2-stage indirection Page Directory List + 1 PBL is used