Lines Matching full:pbl
62 /* PBL */
63 static void __free_pbl(struct bnxt_qplib_res *res, struct bnxt_qplib_pbl *pbl, in __free_pbl() argument
70 for (i = 0; i < pbl->pg_count; i++) { in __free_pbl()
71 if (pbl->pg_arr[i]) in __free_pbl()
72 dma_free_coherent(&pdev->dev, pbl->pg_size, in __free_pbl()
74 pbl->pg_arr[i] & in __free_pbl()
76 pbl->pg_map_arr[i]); in __free_pbl()
79 "PBL free pg_arr[%d] empty?!\n", i); in __free_pbl()
80 pbl->pg_arr[i] = NULL; in __free_pbl()
83 vfree(pbl->pg_arr); in __free_pbl()
84 pbl->pg_arr = NULL; in __free_pbl()
85 vfree(pbl->pg_map_arr); in __free_pbl()
86 pbl->pg_map_arr = NULL; in __free_pbl()
87 pbl->pg_count = 0; in __free_pbl()
88 pbl->pg_size = 0; in __free_pbl()
91 static void bnxt_qplib_fill_user_dma_pages(struct bnxt_qplib_pbl *pbl, in bnxt_qplib_fill_user_dma_pages() argument
98 pbl->pg_map_arr[i] = rdma_block_iter_dma_address(&biter); in bnxt_qplib_fill_user_dma_pages()
99 pbl->pg_arr[i] = NULL; in bnxt_qplib_fill_user_dma_pages()
100 pbl->pg_count++; in bnxt_qplib_fill_user_dma_pages()
106 struct bnxt_qplib_pbl *pbl, in __alloc_pbl() argument
121 pbl->pg_arr = vmalloc_array(pages, sizeof(void *)); in __alloc_pbl()
122 if (!pbl->pg_arr) in __alloc_pbl()
125 pbl->pg_map_arr = vmalloc_array(pages, sizeof(dma_addr_t)); in __alloc_pbl()
126 if (!pbl->pg_map_arr) { in __alloc_pbl()
127 vfree(pbl->pg_arr); in __alloc_pbl()
128 pbl->pg_arr = NULL; in __alloc_pbl()
131 pbl->pg_count = 0; in __alloc_pbl()
132 pbl->pg_size = sginfo->pgsize; in __alloc_pbl()
136 pbl->pg_arr[i] = dma_alloc_coherent(&pdev->dev, in __alloc_pbl()
137 pbl->pg_size, in __alloc_pbl()
138 &pbl->pg_map_arr[i], in __alloc_pbl()
140 if (!pbl->pg_arr[i]) in __alloc_pbl()
142 pbl->pg_count++; in __alloc_pbl()
146 bnxt_qplib_fill_user_dma_pages(pbl, sginfo); in __alloc_pbl()
151 __free_pbl(res, pbl, is_umem); in __alloc_pbl()
168 __free_pbl(res, &hwq->pbl[i], hwq->is_user); in bnxt_qplib_free_hwq()
170 __free_pbl(res, &hwq->pbl[i], false); in bnxt_qplib_free_hwq()
225 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], hwq_attr->sginfo); in bnxt_qplib_alloc_init_hwq()
246 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); in bnxt_qplib_alloc_init_hwq()
250 /* Alloc PBL pages */ in bnxt_qplib_alloc_init_hwq()
253 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_1], &sginfo); in bnxt_qplib_alloc_init_hwq()
256 /* Fill PDL with PBL page pointers */ in bnxt_qplib_alloc_init_hwq()
258 (dma_addr_t **)hwq->pbl[PBL_LVL_0].pg_arr; in bnxt_qplib_alloc_init_hwq()
259 src_phys_ptr = hwq->pbl[PBL_LVL_1].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
260 for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; i++) in bnxt_qplib_alloc_init_hwq()
264 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_2], in bnxt_qplib_alloc_init_hwq()
273 (dma_addr_t **)hwq->pbl[PBL_LVL_1].pg_arr; in bnxt_qplib_alloc_init_hwq()
274 src_phys_ptr = hwq->pbl[PBL_LVL_2].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
275 for (i = 0; i < hwq->pbl[PBL_LVL_2].pg_count; i++) { in bnxt_qplib_alloc_init_hwq()
281 i = hwq->pbl[PBL_LVL_2].pg_count; in bnxt_qplib_alloc_init_hwq()
299 /* Alloc PBL page */ in bnxt_qplib_alloc_init_hwq()
300 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); in bnxt_qplib_alloc_init_hwq()
304 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_1], in bnxt_qplib_alloc_init_hwq()
311 /* Fill PBL with PTE pointers */ in bnxt_qplib_alloc_init_hwq()
313 (dma_addr_t **)hwq->pbl[PBL_LVL_0].pg_arr; in bnxt_qplib_alloc_init_hwq()
314 src_phys_ptr = hwq->pbl[PBL_LVL_1].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
315 for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; i++) in bnxt_qplib_alloc_init_hwq()
320 i = hwq->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_alloc_init_hwq()
342 hwq->pbl_ptr = hwq->pbl[lvl].pg_arr; in bnxt_qplib_alloc_init_hwq()
343 hwq->pbl_dma_ptr = hwq->pbl[lvl].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
429 pg_count = tbl->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_map_tqm_pgtbl()
432 dma_ptr = &tbl->pbl[PBL_LVL_1].pg_map_arr[k]; in bnxt_qplib_map_tqm_pgtbl()
440 *ptr = cpu_to_le64(tbl->pbl[PBL_LVL_0].pg_map_arr[0] | in bnxt_qplib_map_tqm_pgtbl()
478 * or a 1-to-2-stage indirection Page Directory List + 1 PBL is used