Lines Matching refs:comp_ctx
173 struct ena_comp_ctx *comp_ctx) in comp_ctxt_release() argument
175 comp_ctx->occupied = false; in comp_ctxt_release()
189 if (unlikely(!admin_queue->comp_ctx)) { in get_comp_ctxt()
195 if (unlikely(admin_queue->comp_ctx[command_id].occupied && capture)) { in get_comp_ctxt()
203 admin_queue->comp_ctx[command_id].occupied = true; in get_comp_ctxt()
206 return &admin_queue->comp_ctx[command_id]; in get_comp_ctxt()
215 struct ena_comp_ctx *comp_ctx; in __ena_com_submit_admin_cmd() local
241 comp_ctx = get_comp_ctxt(admin_queue, cmd_id, true); in __ena_com_submit_admin_cmd()
242 if (unlikely(!comp_ctx)) in __ena_com_submit_admin_cmd()
245 comp_ctx->status = ENA_CMD_SUBMITTED; in __ena_com_submit_admin_cmd()
246 comp_ctx->comp_size = (u32)comp_size_in_bytes; in __ena_com_submit_admin_cmd()
247 comp_ctx->user_cqe = comp; in __ena_com_submit_admin_cmd()
248 comp_ctx->cmd_opcode = cmd->aq_common_descriptor.opcode; in __ena_com_submit_admin_cmd()
250 reinit_completion(&comp_ctx->wait_event); in __ena_com_submit_admin_cmd()
265 return comp_ctx; in __ena_com_submit_admin_cmd()
272 struct ena_comp_ctx *comp_ctx; in ena_com_init_comp_ctxt() local
275 admin_queue->comp_ctx = in ena_com_init_comp_ctxt()
277 if (unlikely(!admin_queue->comp_ctx)) { in ena_com_init_comp_ctxt()
283 comp_ctx = get_comp_ctxt(admin_queue, i, false); in ena_com_init_comp_ctxt()
284 if (comp_ctx) in ena_com_init_comp_ctxt()
285 init_completion(&comp_ctx->wait_event); in ena_com_init_comp_ctxt()
298 struct ena_comp_ctx *comp_ctx; in ena_com_submit_admin_cmd() local
305 comp_ctx = __ena_com_submit_admin_cmd(admin_queue, cmd, in ena_com_submit_admin_cmd()
309 if (IS_ERR(comp_ctx)) in ena_com_submit_admin_cmd()
313 return comp_ctx; in ena_com_submit_admin_cmd()
450 struct ena_comp_ctx *comp_ctx; in ena_com_handle_single_admin_completion() local
456 comp_ctx = get_comp_ctxt(admin_queue, cmd_id, false); in ena_com_handle_single_admin_completion()
457 if (unlikely(!comp_ctx)) { in ena_com_handle_single_admin_completion()
464 comp_ctx->status = ENA_CMD_COMPLETED; in ena_com_handle_single_admin_completion()
465 comp_ctx->comp_status = cqe->acq_common_descriptor.status; in ena_com_handle_single_admin_completion()
467 if (comp_ctx->user_cqe) in ena_com_handle_single_admin_completion()
468 memcpy(comp_ctx->user_cqe, (void *)cqe, comp_ctx->comp_size); in ena_com_handle_single_admin_completion()
471 complete(&comp_ctx->wait_event); in ena_com_handle_single_admin_completion()
544 static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_ctx, in ena_com_wait_and_process_admin_cq_polling() argument
559 if (comp_ctx->status != ENA_CMD_SUBMITTED) in ena_com_wait_and_process_admin_cq_polling()
579 if (unlikely(comp_ctx->status == ENA_CMD_ABORTED)) { in ena_com_wait_and_process_admin_cq_polling()
589 WARN(comp_ctx->status != ENA_CMD_COMPLETED, "Invalid comp status %d\n", in ena_com_wait_and_process_admin_cq_polling()
590 comp_ctx->status); in ena_com_wait_and_process_admin_cq_polling()
592 ret = ena_com_comp_status_to_errno(admin_queue, comp_ctx->comp_status); in ena_com_wait_and_process_admin_cq_polling()
594 comp_ctxt_release(admin_queue, comp_ctx); in ena_com_wait_and_process_admin_cq_polling()
773 static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *comp_ctx, in ena_com_wait_and_process_admin_cq_interrupts() argument
779 wait_for_completion_timeout(&comp_ctx->wait_event, in ena_com_wait_and_process_admin_cq_interrupts()
788 if (unlikely(comp_ctx->status == ENA_CMD_SUBMITTED)) { in ena_com_wait_and_process_admin_cq_interrupts()
794 if (comp_ctx->status == ENA_CMD_COMPLETED) { in ena_com_wait_and_process_admin_cq_interrupts()
797 comp_ctx->cmd_opcode, in ena_com_wait_and_process_admin_cq_interrupts()
805 comp_ctx->cmd_opcode, comp_ctx->status); in ena_com_wait_and_process_admin_cq_interrupts()
818 ret = ena_com_comp_status_to_errno(admin_queue, comp_ctx->comp_status); in ena_com_wait_and_process_admin_cq_interrupts()
820 comp_ctxt_release(admin_queue, comp_ctx); in ena_com_wait_and_process_admin_cq_interrupts()
893 static int ena_com_wait_and_process_admin_cq(struct ena_comp_ctx *comp_ctx, in ena_com_wait_and_process_admin_cq() argument
897 return ena_com_wait_and_process_admin_cq_polling(comp_ctx, in ena_com_wait_and_process_admin_cq()
900 return ena_com_wait_and_process_admin_cq_interrupts(comp_ctx, in ena_com_wait_and_process_admin_cq()
1357 struct ena_comp_ctx *comp_ctx; in ena_com_execute_admin_command() local
1360 comp_ctx = ena_com_submit_admin_cmd(admin_queue, cmd, cmd_size, in ena_com_execute_admin_command()
1362 if (IS_ERR(comp_ctx)) { in ena_com_execute_admin_command()
1363 ret = PTR_ERR(comp_ctx); in ena_com_execute_admin_command()
1374 ret = ena_com_wait_and_process_admin_cq(comp_ctx, admin_queue); in ena_com_execute_admin_command()
1466 struct ena_comp_ctx *comp_ctx; in ena_com_abort_admin_commands() local
1469 if (!admin_queue->comp_ctx) in ena_com_abort_admin_commands()
1473 comp_ctx = get_comp_ctxt(admin_queue, i, false); in ena_com_abort_admin_commands()
1474 if (unlikely(!comp_ctx)) in ena_com_abort_admin_commands()
1477 comp_ctx->status = ENA_CMD_ABORTED; in ena_com_abort_admin_commands()
1479 complete(&comp_ctx->wait_event); in ena_com_abort_admin_commands()
1674 if (!admin_queue->comp_ctx) in ena_com_free_ena_admin_queue_comp_ctx()
1677 devm_kfree(ena_dev->dmadev, admin_queue->comp_ctx); in ena_com_free_ena_admin_queue_comp_ctx()
1679 admin_queue->comp_ctx = NULL; in ena_com_free_ena_admin_queue_comp_ctx()