Lines Matching refs:hwq
156 struct bnxt_qplib_hwq *hwq) in bnxt_qplib_free_hwq() argument
160 if (!hwq->max_elements) in bnxt_qplib_free_hwq()
162 if (hwq->level >= PBL_LVL_MAX) in bnxt_qplib_free_hwq()
165 for (i = 0; i < hwq->level + 1; i++) { in bnxt_qplib_free_hwq()
166 if (i == hwq->level) in bnxt_qplib_free_hwq()
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()
172 hwq->level = PBL_LVL_MAX; in bnxt_qplib_free_hwq()
173 hwq->max_elements = 0; in bnxt_qplib_free_hwq()
174 hwq->element_size = 0; in bnxt_qplib_free_hwq()
175 hwq->prod = 0; in bnxt_qplib_free_hwq()
176 hwq->cons = 0; in bnxt_qplib_free_hwq()
177 hwq->cp_bit = 0; in bnxt_qplib_free_hwq()
182 int bnxt_qplib_alloc_init_hwq(struct bnxt_qplib_hwq *hwq, in bnxt_qplib_alloc_init_hwq() argument
196 hwq->level = PBL_LVL_MAX; in bnxt_qplib_alloc_init_hwq()
209 hwq->is_user = false; in bnxt_qplib_alloc_init_hwq()
220 hwq->is_user = true; in bnxt_qplib_alloc_init_hwq()
232 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], hwq_attr->sginfo); in bnxt_qplib_alloc_init_hwq()
235 hwq->level = PBL_LVL_0; in bnxt_qplib_alloc_init_hwq()
252 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); in bnxt_qplib_alloc_init_hwq()
257 rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_1], &sginfo); 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()
285 hwq->level = 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()
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()
325 hwq->level = PBL_LVL_1; 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()
348 hwq->prod = 0; in bnxt_qplib_alloc_init_hwq()
349 hwq->cons = 0; in bnxt_qplib_alloc_init_hwq()
350 hwq->pdev = pdev; in bnxt_qplib_alloc_init_hwq()
351 hwq->depth = hwq_attr->depth; in bnxt_qplib_alloc_init_hwq()
352 hwq->max_elements = depth; in bnxt_qplib_alloc_init_hwq()
353 hwq->element_size = stride; in bnxt_qplib_alloc_init_hwq()
354 hwq->qe_ppg = pg_size / stride; in bnxt_qplib_alloc_init_hwq()
356 lvl = hwq->level; in bnxt_qplib_alloc_init_hwq()
357 if (hwq_attr->sginfo->nopte && hwq->level) in bnxt_qplib_alloc_init_hwq()
358 lvl = hwq->level - 1; 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()
361 spin_lock_init(&hwq->lock); in bnxt_qplib_alloc_init_hwq()
365 bnxt_qplib_free_hwq(res, hwq); in bnxt_qplib_alloc_init_hwq()