Lines Matching refs: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()
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(pages * sizeof(void *)); in __alloc_pbl()
122 if (!pbl->pg_arr) in __alloc_pbl()
125 pbl->pg_map_arr = vmalloc(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()
233 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], hwq_attr->sginfo); in bnxt_qplib_alloc_init_hwq()
254 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); in bnxt_qplib_alloc_init_hwq()
259 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_1], &sginfo); in bnxt_qplib_alloc_init_hwq()
264 (dma_addr_t **)hwq->pbl[PBL_LVL_0].pg_arr; in bnxt_qplib_alloc_init_hwq()
265 src_phys_ptr = hwq->pbl[PBL_LVL_1].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
271 for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_alloc_init_hwq()
276 for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_alloc_init_hwq()
283 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_2], in bnxt_qplib_alloc_init_hwq()
292 (dma_addr_t **)hwq->pbl[PBL_LVL_1].pg_arr; in bnxt_qplib_alloc_init_hwq()
293 src_phys_ptr = hwq->pbl[PBL_LVL_2].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
294 for (i = 0; i < hwq->pbl[PBL_LVL_2].pg_count; i++) { in bnxt_qplib_alloc_init_hwq()
300 i = hwq->pbl[PBL_LVL_2].pg_count; in bnxt_qplib_alloc_init_hwq()
319 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); in bnxt_qplib_alloc_init_hwq()
323 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_1], in bnxt_qplib_alloc_init_hwq()
332 (dma_addr_t **)hwq->pbl[PBL_LVL_0].pg_arr; in bnxt_qplib_alloc_init_hwq()
333 src_phys_ptr = hwq->pbl[PBL_LVL_1].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
334 for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; i++) in bnxt_qplib_alloc_init_hwq()
339 i = hwq->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_alloc_init_hwq()
361 hwq->pbl_ptr = hwq->pbl[lvl].pg_arr; in bnxt_qplib_alloc_init_hwq()
362 hwq->pbl_dma_ptr = hwq->pbl[lvl].pg_map_arr; in bnxt_qplib_alloc_init_hwq()
448 pg_count = tbl->pbl[PBL_LVL_1].pg_count; in bnxt_qplib_map_tqm_pgtbl()
451 dma_ptr = &tbl->pbl[PBL_LVL_1].pg_map_arr[k]; in bnxt_qplib_map_tqm_pgtbl()
459 *ptr = cpu_to_le64(tbl->pbl[PBL_LVL_0].pg_map_arr[0] | in bnxt_qplib_map_tqm_pgtbl()