Lines Matching refs:cmdq

36 bce_cmdq_wait(struct bce_queue_cmdq *cmdq, uint32_t slot,  in bce_cmdq_wait()  argument
45 mtx_lock(&cmdq->lck); in bce_cmdq_wait()
46 if (cmdq->tres[slot] == res) in bce_cmdq_wait()
47 cmdq->tres[slot] = NULL; in bce_cmdq_wait()
48 mtx_unlock(&cmdq->lck); in bce_cmdq_wait()
322 struct bce_queue_cmdq *cmdq; in bce_alloc_cmdq() local
324 cmdq = malloc(sizeof(*cmdq), M_BCE, M_WAITOK | M_ZERO); in bce_alloc_cmdq()
325 cmdq->sq = sq; in bce_alloc_cmdq()
326 mtx_init(&cmdq->lck, "bce_cmdq", NULL, MTX_DEF); in bce_alloc_cmdq()
327 cmdq->tres = malloc(sizeof(void *) * sq->el_count, M_BCE, in bce_alloc_cmdq()
332 sq->userdata = cmdq; in bce_alloc_cmdq()
334 return (cmdq); in bce_alloc_cmdq()
338 bce_free_cmdq(struct bce_queue_cmdq *cmdq) in bce_free_cmdq() argument
340 if (cmdq == NULL) in bce_free_cmdq()
342 mtx_destroy(&cmdq->lck); in bce_free_cmdq()
343 free(cmdq->tres, M_BCE); in bce_free_cmdq()
344 free(cmdq, M_BCE); in bce_free_cmdq()
353 struct bce_queue_cmdq *cmdq = sq->userdata; in bce_cmdq_completion() local
356 mtx_lock(&cmdq->lck); in bce_cmdq_completion()
361 res = cmdq->tres[sq->completion_cidx]; in bce_cmdq_completion()
366 cmdq->tres[sq->completion_cidx] = NULL; in bce_cmdq_completion()
372 mtx_unlock(&cmdq->lck); in bce_cmdq_completion()
376 bce_cmd_register_queue(struct bce_queue_cmdq *cmdq, in bce_cmd_register_queue() argument
387 if (bce_reserve_submission(cmdq->sq) != 0) { in bce_cmd_register_queue()
392 mtx_lock(&cmdq->lck); in bce_cmd_register_queue()
393 slot = cmdq->sq->tail; in bce_cmd_register_queue()
394 cmdq->tres[slot] = &res; in bce_cmd_register_queue()
395 cmd = bce_next_submission(cmdq->sq); in bce_cmd_register_queue()
411 bce_submit_to_device(sc, cmdq->sq); in bce_cmd_register_queue()
412 mtx_unlock(&cmdq->lck); in bce_cmd_register_queue()
414 error = bce_cmdq_wait(cmdq, slot, &res); in bce_cmd_register_queue()
423 bce_cmd_unregister_queue(struct bce_queue_cmdq *cmdq, in bce_cmd_unregister_queue() argument
433 if (bce_reserve_submission(cmdq->sq) != 0) { in bce_cmd_unregister_queue()
438 mtx_lock(&cmdq->lck); in bce_cmd_unregister_queue()
439 slot = cmdq->sq->tail; in bce_cmd_unregister_queue()
440 cmdq->tres[slot] = &res; in bce_cmd_unregister_queue()
441 cmd = bce_next_submission(cmdq->sq); in bce_cmd_unregister_queue()
447 bce_submit_to_device(sc, cmdq->sq); in bce_cmd_unregister_queue()
448 mtx_unlock(&cmdq->lck); in bce_cmd_unregister_queue()
450 error = bce_cmdq_wait(cmdq, slot, &res); in bce_cmd_unregister_queue()
459 bce_cmd_flush_queue(struct bce_queue_cmdq *cmdq, in bce_cmd_flush_queue() argument
469 if (bce_reserve_submission(cmdq->sq) != 0) { in bce_cmd_flush_queue()
474 mtx_lock(&cmdq->lck); in bce_cmd_flush_queue()
475 slot = cmdq->sq->tail; in bce_cmd_flush_queue()
476 cmdq->tres[slot] = &res; in bce_cmd_flush_queue()
477 cmd = bce_next_submission(cmdq->sq); in bce_cmd_flush_queue()
483 bce_submit_to_device(sc, cmdq->sq); in bce_cmd_flush_queue()
484 mtx_unlock(&cmdq->lck); in bce_cmd_flush_queue()
486 error = bce_cmdq_wait(cmdq, slot, &res); in bce_cmd_flush_queue()