Lines Matching refs:comp_ctx
171 struct ena_comp_ctx *comp_ctx) in comp_ctxt_release() argument
173 comp_ctx->occupied = false; in comp_ctxt_release()
187 if (unlikely(!admin_queue->comp_ctx)) { in get_comp_ctxt()
192 if (unlikely(admin_queue->comp_ctx[command_id].occupied && capture)) { in get_comp_ctxt()
199 admin_queue->comp_ctx[command_id].occupied = true; in get_comp_ctxt()
202 return &admin_queue->comp_ctx[command_id]; in get_comp_ctxt()
211 struct ena_comp_ctx *comp_ctx; in __ena_com_submit_admin_cmd() local
236 comp_ctx = get_comp_ctxt(admin_queue, cmd_id, true); in __ena_com_submit_admin_cmd()
237 if (unlikely(!comp_ctx)) in __ena_com_submit_admin_cmd()
240 comp_ctx->status = ENA_CMD_SUBMITTED; in __ena_com_submit_admin_cmd()
241 comp_ctx->comp_size = (u32)comp_size_in_bytes; in __ena_com_submit_admin_cmd()
242 comp_ctx->user_cqe = comp; in __ena_com_submit_admin_cmd()
243 comp_ctx->cmd_opcode = cmd->aq_common_descriptor.opcode; in __ena_com_submit_admin_cmd()
245 reinit_completion(&comp_ctx->wait_event); in __ena_com_submit_admin_cmd()
260 return comp_ctx; in __ena_com_submit_admin_cmd()
267 struct ena_comp_ctx *comp_ctx; in ena_com_init_comp_ctxt() local
270 admin_queue->comp_ctx = devm_kzalloc(admin_queue->q_dmadev, size, GFP_KERNEL); in ena_com_init_comp_ctxt()
271 if (unlikely(!admin_queue->comp_ctx)) { in ena_com_init_comp_ctxt()
277 comp_ctx = get_comp_ctxt(admin_queue, i, false); in ena_com_init_comp_ctxt()
278 if (comp_ctx) in ena_com_init_comp_ctxt()
279 init_completion(&comp_ctx->wait_event); in ena_com_init_comp_ctxt()
292 struct ena_comp_ctx *comp_ctx; in ena_com_submit_admin_cmd() local
299 comp_ctx = __ena_com_submit_admin_cmd(admin_queue, cmd, in ena_com_submit_admin_cmd()
303 if (IS_ERR(comp_ctx)) in ena_com_submit_admin_cmd()
307 return comp_ctx; in ena_com_submit_admin_cmd()
426 struct ena_comp_ctx *comp_ctx; in ena_com_handle_single_admin_completion() local
432 comp_ctx = get_comp_ctxt(admin_queue, cmd_id, false); in ena_com_handle_single_admin_completion()
433 if (unlikely(!comp_ctx)) { in ena_com_handle_single_admin_completion()
440 comp_ctx->status = ENA_CMD_COMPLETED; in ena_com_handle_single_admin_completion()
441 comp_ctx->comp_status = cqe->acq_common_descriptor.status; in ena_com_handle_single_admin_completion()
443 if (comp_ctx->user_cqe) in ena_com_handle_single_admin_completion()
444 memcpy(comp_ctx->user_cqe, (void *)cqe, comp_ctx->comp_size); in ena_com_handle_single_admin_completion()
447 complete(&comp_ctx->wait_event); in ena_com_handle_single_admin_completion()
521 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
536 if (comp_ctx->status != ENA_CMD_SUBMITTED) in ena_com_wait_and_process_admin_cq_polling()
556 if (unlikely(comp_ctx->status == ENA_CMD_ABORTED)) { in ena_com_wait_and_process_admin_cq_polling()
565 WARN(comp_ctx->status != ENA_CMD_COMPLETED, "Invalid comp status %d\n", comp_ctx->status); in ena_com_wait_and_process_admin_cq_polling()
567 ret = ena_com_comp_status_to_errno(admin_queue, comp_ctx->comp_status); in ena_com_wait_and_process_admin_cq_polling()
569 comp_ctxt_release(admin_queue, comp_ctx); in ena_com_wait_and_process_admin_cq_polling()
744 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
750 wait_for_completion_timeout(&comp_ctx->wait_event, in ena_com_wait_and_process_admin_cq_interrupts()
758 if (unlikely(comp_ctx->status == ENA_CMD_SUBMITTED)) { in ena_com_wait_and_process_admin_cq_interrupts()
764 if (comp_ctx->status == ENA_CMD_COMPLETED) { in ena_com_wait_and_process_admin_cq_interrupts()
767 comp_ctx->cmd_opcode, admin_queue->auto_polling ? "ON" : "OFF"); in ena_com_wait_and_process_admin_cq_interrupts()
774 comp_ctx->cmd_opcode, comp_ctx->status); in ena_com_wait_and_process_admin_cq_interrupts()
787 ret = ena_com_comp_status_to_errno(admin_queue, comp_ctx->comp_status); in ena_com_wait_and_process_admin_cq_interrupts()
789 comp_ctxt_release(admin_queue, comp_ctx); in ena_com_wait_and_process_admin_cq_interrupts()
860 static int ena_com_wait_and_process_admin_cq(struct ena_comp_ctx *comp_ctx, in ena_com_wait_and_process_admin_cq() argument
864 return ena_com_wait_and_process_admin_cq_polling(comp_ctx, in ena_com_wait_and_process_admin_cq()
867 return ena_com_wait_and_process_admin_cq_interrupts(comp_ctx, in ena_com_wait_and_process_admin_cq()
1306 struct ena_comp_ctx *comp_ctx; in ena_com_execute_admin_command() local
1309 comp_ctx = ena_com_submit_admin_cmd(admin_queue, cmd, cmd_size, in ena_com_execute_admin_command()
1311 if (IS_ERR(comp_ctx)) { in ena_com_execute_admin_command()
1312 ret = PTR_ERR(comp_ctx); in ena_com_execute_admin_command()
1323 ret = ena_com_wait_and_process_admin_cq(comp_ctx, admin_queue); in ena_com_execute_admin_command()
1407 struct ena_comp_ctx *comp_ctx; in ena_com_abort_admin_commands() local
1410 if (!admin_queue->comp_ctx) in ena_com_abort_admin_commands()
1414 comp_ctx = get_comp_ctxt(admin_queue, i, false); in ena_com_abort_admin_commands()
1415 if (unlikely(!comp_ctx)) in ena_com_abort_admin_commands()
1418 comp_ctx->status = ENA_CMD_ABORTED; in ena_com_abort_admin_commands()
1420 complete(&comp_ctx->wait_event); in ena_com_abort_admin_commands()
1608 if (!admin_queue->comp_ctx) in ena_com_free_ena_admin_queue_comp_ctx()
1611 devm_kfree(ena_dev->dmadev, admin_queue->comp_ctx); in ena_com_free_ena_admin_queue_comp_ctx()
1613 admin_queue->comp_ctx = NULL; in ena_com_free_ena_admin_queue_comp_ctx()