wqs 3050 drivers/infiniband/core/uverbs_cmd.c struct ib_wq **wqs = NULL; wqs 3083 drivers/infiniband/core/uverbs_cmd.c wqs = kcalloc(num_wq_handles, sizeof(*wqs), GFP_KERNEL); wqs 3084 drivers/infiniband/core/uverbs_cmd.c if (!wqs) { wqs 3098 drivers/infiniband/core/uverbs_cmd.c wqs[num_read_wqs] = wq; wqs 3108 drivers/infiniband/core/uverbs_cmd.c init_attr.ind_tbl = wqs; wqs 3118 drivers/infiniband/core/uverbs_cmd.c rwq_ind_tbl->ind_tbl = wqs; wqs 3126 drivers/infiniband/core/uverbs_cmd.c atomic_inc(&wqs[i]->usecnt); wqs 3139 drivers/infiniband/core/uverbs_cmd.c uobj_put_obj_read(wqs[j]); wqs 3149 drivers/infiniband/core/uverbs_cmd.c uobj_put_obj_read(wqs[j]); wqs 3152 drivers/infiniband/core/uverbs_cmd.c kfree(wqs); wqs 280 drivers/net/ethernet/huawei/hinic/hinic_hw_io.c err = hinic_wq_allocate(&func_to_io->wqs, &func_to_io->sq_wq[q_id], wqs 288 drivers/net/ethernet/huawei/hinic/hinic_hw_io.c err = hinic_wq_allocate(&func_to_io->wqs, &func_to_io->rq_wq[q_id], wqs 330 drivers/net/ethernet/huawei/hinic/hinic_hw_io.c hinic_wq_free(&func_to_io->wqs, &func_to_io->rq_wq[q_id]); wqs 333 drivers/net/ethernet/huawei/hinic/hinic_hw_io.c hinic_wq_free(&func_to_io->wqs, &func_to_io->sq_wq[q_id]); wqs 352 drivers/net/ethernet/huawei/hinic/hinic_hw_io.c hinic_wq_free(&func_to_io->wqs, &func_to_io->rq_wq[q_id]); wqs 353 drivers/net/ethernet/huawei/hinic/hinic_hw_io.c hinic_wq_free(&func_to_io->wqs, &func_to_io->sq_wq[q_id]); wqs 518 drivers/net/ethernet/huawei/hinic/hinic_hw_io.c err = hinic_wqs_alloc(&func_to_io->wqs, 2 * max_qps, hwif); wqs 561 drivers/net/ethernet/huawei/hinic/hinic_hw_io.c hinic_wqs_free(&func_to_io->wqs); wqs 582 drivers/net/ethernet/huawei/hinic/hinic_hw_io.c hinic_wqs_free(&func_to_io->wqs); wqs 53 drivers/net/ethernet/huawei/hinic/hinic_hw_io.h struct hinic_wqs wqs; wqs 31 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c #define WQS_FREE_BLOCKS_SIZE(wqs) (WQS_MAX_NUM_BLOCKS * \ wqs 32 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c sizeof((wqs)->free_blocks[0])) wqs 44 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c #define WQ_BASE_VADDR(wqs, wq) \ wqs 45 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c ((void *)((wqs)->page_vaddr[(wq)->page_idx]) \ wqs 48 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c #define WQ_BASE_PADDR(wqs, wq) \ wqs 49 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c ((wqs)->page_paddr[(wq)->page_idx] \ wqs 52 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c #define WQ_BASE_ADDR(wqs, wq) \ wqs 53 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c ((void *)((wqs)->shadow_page_vaddr[(wq)->page_idx]) \ wqs 136 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c static int wqs_allocate_page(struct hinic_wqs *wqs, int page_idx) wqs 138 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c return queue_alloc_page(wqs->hwif, &wqs->page_vaddr[page_idx], wqs 139 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c &wqs->page_paddr[page_idx], wqs 140 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c &wqs->shadow_page_vaddr[page_idx], wqs 149 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c static void wqs_free_page(struct hinic_wqs *wqs, int page_idx) wqs 151 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c struct hinic_hwif *hwif = wqs->hwif; wqs 155 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->page_vaddr[page_idx], wqs 156 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c (dma_addr_t)wqs->page_paddr[page_idx]); wqs 157 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c vfree(wqs->shadow_page_vaddr[page_idx]); wqs 191 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c static int alloc_page_arrays(struct hinic_wqs *wqs) wqs 193 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c struct hinic_hwif *hwif = wqs->hwif; wqs 197 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c size = wqs->num_pages * sizeof(*wqs->page_paddr); wqs 198 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->page_paddr = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); wqs 199 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c if (!wqs->page_paddr) wqs 202 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c size = wqs->num_pages * sizeof(*wqs->page_vaddr); wqs 203 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->page_vaddr = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); wqs 204 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c if (!wqs->page_vaddr) wqs 207 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c size = wqs->num_pages * sizeof(*wqs->shadow_page_vaddr); wqs 208 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->shadow_page_vaddr = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); wqs 209 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c if (!wqs->shadow_page_vaddr) wqs 215 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c devm_kfree(&pdev->dev, wqs->page_vaddr); wqs 218 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c devm_kfree(&pdev->dev, wqs->page_paddr); wqs 222 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c static void free_page_arrays(struct hinic_wqs *wqs) wqs 224 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c struct hinic_hwif *hwif = wqs->hwif; wqs 227 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c devm_kfree(&pdev->dev, wqs->shadow_page_vaddr); wqs 228 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c devm_kfree(&pdev->dev, wqs->page_vaddr); wqs 229 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c devm_kfree(&pdev->dev, wqs->page_paddr); wqs 232 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c static int wqs_next_block(struct hinic_wqs *wqs, int *page_idx, wqs 237 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c down(&wqs->alloc_blocks_lock); wqs 239 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->num_free_blks--; wqs 241 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c if (wqs->num_free_blks < 0) { wqs 242 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->num_free_blks++; wqs 243 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c up(&wqs->alloc_blocks_lock); wqs 247 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c pos = wqs->alloc_blk_pos++; wqs 250 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c *page_idx = wqs->free_blocks[pos].page_idx; wqs 251 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c *block_idx = wqs->free_blocks[pos].block_idx; wqs 253 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->free_blocks[pos].page_idx = -1; wqs 254 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->free_blocks[pos].block_idx = -1; wqs 256 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c up(&wqs->alloc_blocks_lock); wqs 260 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c static void wqs_return_block(struct hinic_wqs *wqs, int page_idx, wqs 265 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c down(&wqs->alloc_blocks_lock); wqs 267 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c pos = wqs->return_blk_pos++; wqs 270 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->free_blocks[pos].page_idx = page_idx; wqs 271 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->free_blocks[pos].block_idx = block_idx; wqs 273 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->num_free_blks++; wqs 275 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c up(&wqs->alloc_blocks_lock); wqs 278 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c static void init_wqs_blocks_arr(struct hinic_wqs *wqs) wqs 282 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c for (page_idx = 0; page_idx < wqs->num_pages; page_idx++) { wqs 284 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->free_blocks[pos].page_idx = page_idx; wqs 285 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->free_blocks[pos].block_idx = blk_idx; wqs 290 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->alloc_blk_pos = 0; wqs 291 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->return_blk_pos = pos; wqs 292 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->num_free_blks = pos; wqs 294 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c sema_init(&wqs->alloc_blocks_lock, 1); wqs 305 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c int hinic_wqs_alloc(struct hinic_wqs *wqs, int max_wqs, wqs 317 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->hwif = hwif; wqs 318 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->num_pages = max_wqs / WQS_BLOCKS_PER_PAGE; wqs 320 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c if (alloc_page_arrays(wqs)) { wqs 326 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c for (page_idx = 0; page_idx < wqs->num_pages; page_idx++) { wqs 327 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c err = wqs_allocate_page(wqs, page_idx); wqs 334 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs->free_blocks = devm_kzalloc(&pdev->dev, WQS_FREE_BLOCKS_SIZE(wqs), wqs 336 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c if (!wqs->free_blocks) { wqs 341 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c init_wqs_blocks_arr(wqs); wqs 347 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs_free_page(wqs, i); wqs 349 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c free_page_arrays(wqs); wqs 357 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c void hinic_wqs_free(struct hinic_wqs *wqs) wqs 359 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c struct hinic_hwif *hwif = wqs->hwif; wqs 363 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c devm_kfree(&pdev->dev, wqs->free_blocks); wqs 365 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c for (page_idx = 0; page_idx < wqs->num_pages; page_idx++) wqs 366 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs_free_page(wqs, page_idx); wqs 368 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c free_page_arrays(wqs); wqs 505 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c int hinic_wq_allocate(struct hinic_wqs *wqs, struct hinic_wq *wq, wqs 509 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c struct hinic_hwif *hwif = wqs->hwif; wqs 541 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c err = wqs_next_block(wqs, &wq->page_idx, &wq->block_idx); wqs 554 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wq->block_vaddr = WQ_BASE_VADDR(wqs, wq); wqs 555 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wq->shadow_block_vaddr = WQ_BASE_ADDR(wqs, wq); wqs 556 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wq->block_paddr = WQ_BASE_PADDR(wqs, wq); wqs 558 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c err = alloc_wq_pages(wq, wqs->hwif, WQ_MAX_PAGES); wqs 572 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs_return_block(wqs, wq->page_idx, wq->block_idx); wqs 581 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c void hinic_wq_free(struct hinic_wqs *wqs, struct hinic_wq *wq) wqs 583 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c free_wq_pages(wq, wqs->hwif, wq->num_q_pages); wqs 585 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c wqs_return_block(wqs, wq->page_idx, wq->block_idx); wqs 85 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.h int hinic_wqs_alloc(struct hinic_wqs *wqs, int num_wqs, wqs 88 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.h void hinic_wqs_free(struct hinic_wqs *wqs); wqs 90 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.h int hinic_wq_allocate(struct hinic_wqs *wqs, struct hinic_wq *wq, wqs 94 drivers/net/ethernet/huawei/hinic/hinic_hw_wq.h void hinic_wq_free(struct hinic_wqs *wqs, struct hinic_wq *wq);