Lines Matching refs:pbl

1268 static int pbl_chunk_list_create(struct efa_dev *dev, struct pbl_context *pbl)  in pbl_chunk_list_create()  argument
1270 struct pbl_chunk_list *chunk_list = &pbl->phys.indirect.chunk_list; in pbl_chunk_list_create()
1271 int page_cnt = pbl->phys.indirect.pbl_buf_size_in_pages; in pbl_chunk_list_create()
1272 struct scatterlist *pages_sgl = pbl->phys.indirect.sgl; in pbl_chunk_list_create()
1274 int sg_dma_cnt = pbl->phys.indirect.sg_dma_cnt; in pbl_chunk_list_create()
1368 static void pbl_chunk_list_destroy(struct efa_dev *dev, struct pbl_context *pbl) in pbl_chunk_list_destroy() argument
1370 struct pbl_chunk_list *chunk_list = &pbl->phys.indirect.chunk_list; in pbl_chunk_list_destroy()
1384 struct pbl_context *pbl) in pbl_continuous_initialize() argument
1388 dma_addr = dma_map_single(&dev->pdev->dev, pbl->pbl_buf, in pbl_continuous_initialize()
1389 pbl->pbl_buf_size_in_bytes, DMA_TO_DEVICE); in pbl_continuous_initialize()
1395 pbl->phys.continuous.dma_addr = dma_addr; in pbl_continuous_initialize()
1398 &dma_addr, pbl->pbl_buf_size_in_bytes); in pbl_continuous_initialize()
1408 static int pbl_indirect_initialize(struct efa_dev *dev, struct pbl_context *pbl) in pbl_indirect_initialize() argument
1410 u32 size_in_pages = DIV_ROUND_UP(pbl->pbl_buf_size_in_bytes, EFA_CHUNK_PAYLOAD_SIZE); in pbl_indirect_initialize()
1415 sgl = efa_vmalloc_buf_to_sg(pbl->pbl_buf, size_in_pages); in pbl_indirect_initialize()
1425 pbl->phys.indirect.pbl_buf_size_in_pages = size_in_pages; in pbl_indirect_initialize()
1426 pbl->phys.indirect.sgl = sgl; in pbl_indirect_initialize()
1427 pbl->phys.indirect.sg_dma_cnt = sg_dma_cnt; in pbl_indirect_initialize()
1428 err = pbl_chunk_list_create(dev, pbl); in pbl_indirect_initialize()
1437 pbl->pbl_buf_size_in_bytes, in pbl_indirect_initialize()
1438 pbl->phys.indirect.chunk_list.size); in pbl_indirect_initialize()
1449 static void pbl_indirect_terminate(struct efa_dev *dev, struct pbl_context *pbl) in pbl_indirect_terminate() argument
1451 pbl_chunk_list_destroy(dev, pbl); in pbl_indirect_terminate()
1452 dma_unmap_sg(&dev->pdev->dev, pbl->phys.indirect.sgl, in pbl_indirect_terminate()
1453 pbl->phys.indirect.pbl_buf_size_in_pages, DMA_TO_DEVICE); in pbl_indirect_terminate()
1454 kfree(pbl->phys.indirect.sgl); in pbl_indirect_terminate()
1459 struct pbl_context *pbl, in pbl_create() argument
1466 pbl->pbl_buf_size_in_bytes = hp_cnt * EFA_CHUNK_PAYLOAD_PTR_SIZE; in pbl_create()
1467 pbl->pbl_buf = kvzalloc(pbl->pbl_buf_size_in_bytes, GFP_KERNEL); in pbl_create()
1468 if (!pbl->pbl_buf) in pbl_create()
1471 if (is_vmalloc_addr(pbl->pbl_buf)) { in pbl_create()
1472 pbl->physically_continuous = 0; in pbl_create()
1473 err = umem_to_page_list(dev, umem, pbl->pbl_buf, hp_cnt, in pbl_create()
1478 err = pbl_indirect_initialize(dev, pbl); in pbl_create()
1482 pbl->physically_continuous = 1; in pbl_create()
1483 err = umem_to_page_list(dev, umem, pbl->pbl_buf, hp_cnt, in pbl_create()
1488 err = pbl_continuous_initialize(dev, pbl); in pbl_create()
1495 hp_cnt, pbl->physically_continuous); in pbl_create()
1500 kvfree(pbl->pbl_buf); in pbl_create()
1504 static void pbl_destroy(struct efa_dev *dev, struct pbl_context *pbl) in pbl_destroy() argument
1506 if (pbl->physically_continuous) in pbl_destroy()
1507 dma_unmap_single(&dev->pdev->dev, pbl->phys.continuous.dma_addr, in pbl_destroy()
1508 pbl->pbl_buf_size_in_bytes, DMA_TO_DEVICE); in pbl_destroy()
1510 pbl_indirect_terminate(dev, pbl); in pbl_destroy()
1512 kvfree(pbl->pbl_buf); in pbl_destroy()
1521 err = umem_to_page_list(dev, mr->umem, params->pbl.inline_pbl_array, in efa_create_inline_pbl()
1533 struct pbl_context *pbl, in efa_create_pbl() argument
1539 err = pbl_create(dev, pbl, mr->umem, params->page_num, in efa_create_pbl()
1547 params->indirect = !pbl->physically_continuous; in efa_create_pbl()
1548 if (pbl->physically_continuous) { in efa_create_pbl()
1549 params->pbl.pbl.length = pbl->pbl_buf_size_in_bytes; in efa_create_pbl()
1551 efa_com_set_dma_addr(pbl->phys.continuous.dma_addr, in efa_create_pbl()
1552 &params->pbl.pbl.address.mem_addr_high, in efa_create_pbl()
1553 &params->pbl.pbl.address.mem_addr_low); in efa_create_pbl()
1555 params->pbl.pbl.length = in efa_create_pbl()
1556 pbl->phys.indirect.chunk_list.chunks[0].length; in efa_create_pbl()
1558 efa_com_set_dma_addr(pbl->phys.indirect.chunk_list.chunks[0].dma_addr, in efa_create_pbl()
1559 &params->pbl.pbl.address.mem_addr_high, in efa_create_pbl()
1560 &params->pbl.pbl.address.mem_addr_low); in efa_create_pbl()
1606 struct pbl_context pbl; in efa_register_mr() local
1632 inline_size = ARRAY_SIZE(params.pbl.inline_pbl_array); in efa_register_mr()
1642 err = efa_create_pbl(dev, &pbl, mr, &params); in efa_register_mr()
1647 pbl_destroy(dev, &pbl); in efa_register_mr()