Lines Matching refs:comp_ctx
266 struct efa_comp_ctx *comp_ctx) in efa_com_put_comp_ctx() argument
268 u16 cmd_id = EFA_GET(&comp_ctx->user_cqe->acq_common_descriptor.command, in efa_com_put_comp_ctx()
273 comp_ctx->occupied = 0; in efa_com_put_comp_ctx()
282 if (aq->comp_ctx[ctx_id].occupied && capture) { in efa_com_get_comp_ctx()
291 aq->comp_ctx[ctx_id].occupied = 1; in efa_com_get_comp_ctx()
296 return &aq->comp_ctx[ctx_id]; in efa_com_get_comp_ctx()
306 struct efa_comp_ctx *comp_ctx; in __efa_com_submit_admin_cmd() local
326 comp_ctx = efa_com_get_comp_ctx(aq, cmd_id, true); in __efa_com_submit_admin_cmd()
327 if (!comp_ctx) { in __efa_com_submit_admin_cmd()
332 comp_ctx->status = EFA_CMD_SUBMITTED; in __efa_com_submit_admin_cmd()
333 comp_ctx->comp_size = comp_size_in_bytes; in __efa_com_submit_admin_cmd()
334 comp_ctx->user_cqe = comp; in __efa_com_submit_admin_cmd()
335 comp_ctx->cmd_opcode = cmd->aq_common_descriptor.opcode; in __efa_com_submit_admin_cmd()
337 reinit_completion(&comp_ctx->wait_event); in __efa_com_submit_admin_cmd()
352 return comp_ctx; in __efa_com_submit_admin_cmd()
359 struct efa_comp_ctx *comp_ctx; in efa_com_init_comp_ctxt() local
362 aq->comp_ctx = devm_kzalloc(aq->dmadev, size, GFP_KERNEL); in efa_com_init_comp_ctxt()
364 if (!aq->comp_ctx || !aq->comp_ctx_pool) { in efa_com_init_comp_ctxt()
366 devm_kfree(aq->dmadev, aq->comp_ctx); in efa_com_init_comp_ctxt()
371 comp_ctx = efa_com_get_comp_ctx(aq, i, false); in efa_com_init_comp_ctxt()
372 if (comp_ctx) in efa_com_init_comp_ctxt()
373 init_completion(&comp_ctx->wait_event); in efa_com_init_comp_ctxt()
391 struct efa_comp_ctx *comp_ctx; in efa_com_submit_admin_cmd() local
400 comp_ctx = __efa_com_submit_admin_cmd(aq, cmd, cmd_size_in_bytes, comp, in efa_com_submit_admin_cmd()
403 if (IS_ERR(comp_ctx)) in efa_com_submit_admin_cmd()
406 return comp_ctx; in efa_com_submit_admin_cmd()
412 struct efa_comp_ctx *comp_ctx; in efa_com_handle_single_admin_completion() local
418 comp_ctx = efa_com_get_comp_ctx(aq, cmd_id, false); in efa_com_handle_single_admin_completion()
419 if (comp_ctx->status != EFA_CMD_SUBMITTED) { in efa_com_handle_single_admin_completion()
426 comp_ctx->status = EFA_CMD_COMPLETED; in efa_com_handle_single_admin_completion()
427 memcpy(comp_ctx->user_cqe, cqe, comp_ctx->comp_size); in efa_com_handle_single_admin_completion()
430 complete(&comp_ctx->wait_event); in efa_com_handle_single_admin_completion()
497 static int efa_com_wait_and_process_admin_cq_polling(struct efa_comp_ctx *comp_ctx, in efa_com_wait_and_process_admin_cq_polling() argument
511 if (comp_ctx->status != EFA_CMD_SUBMITTED) in efa_com_wait_and_process_admin_cq_polling()
529 err = efa_com_comp_status_to_errno(comp_ctx->user_cqe->acq_common_descriptor.status); in efa_com_wait_and_process_admin_cq_polling()
531 efa_com_put_comp_ctx(aq, comp_ctx); in efa_com_wait_and_process_admin_cq_polling()
535 static int efa_com_wait_and_process_admin_cq_interrupts(struct efa_comp_ctx *comp_ctx, in efa_com_wait_and_process_admin_cq_interrupts() argument
541 wait_for_completion_timeout(&comp_ctx->wait_event, in efa_com_wait_and_process_admin_cq_interrupts()
550 if (comp_ctx->status == EFA_CMD_SUBMITTED) { in efa_com_wait_and_process_admin_cq_interrupts()
557 if (comp_ctx->status == EFA_CMD_COMPLETED) in efa_com_wait_and_process_admin_cq_interrupts()
561 efa_com_cmd_str(comp_ctx->cmd_opcode), in efa_com_wait_and_process_admin_cq_interrupts()
562 comp_ctx->cmd_opcode, comp_ctx->status, in efa_com_wait_and_process_admin_cq_interrupts()
563 comp_ctx, aq->sq.pc, aq->sq.cc, aq->cq.cc); in efa_com_wait_and_process_admin_cq_interrupts()
568 efa_com_cmd_str(comp_ctx->cmd_opcode), in efa_com_wait_and_process_admin_cq_interrupts()
569 comp_ctx->cmd_opcode, comp_ctx->status, in efa_com_wait_and_process_admin_cq_interrupts()
570 comp_ctx, aq->sq.pc, aq->sq.cc, aq->cq.cc); in efa_com_wait_and_process_admin_cq_interrupts()
577 err = efa_com_comp_status_to_errno(comp_ctx->user_cqe->acq_common_descriptor.status); in efa_com_wait_and_process_admin_cq_interrupts()
579 efa_com_put_comp_ctx(aq, comp_ctx); in efa_com_wait_and_process_admin_cq_interrupts()
591 static int efa_com_wait_and_process_admin_cq(struct efa_comp_ctx *comp_ctx, in efa_com_wait_and_process_admin_cq() argument
595 return efa_com_wait_and_process_admin_cq_polling(comp_ctx, aq); in efa_com_wait_and_process_admin_cq()
597 return efa_com_wait_and_process_admin_cq_interrupts(comp_ctx, aq); in efa_com_wait_and_process_admin_cq()
619 struct efa_comp_ctx *comp_ctx; in efa_com_cmd_exec() local
630 comp_ctx = efa_com_submit_admin_cmd(aq, cmd, cmd_size, comp, comp_size); in efa_com_cmd_exec()
631 if (IS_ERR(comp_ctx)) { in efa_com_cmd_exec()
636 cmd->aq_common_descriptor.opcode, PTR_ERR(comp_ctx)); in efa_com_cmd_exec()
640 return PTR_ERR(comp_ctx); in efa_com_cmd_exec()
643 err = efa_com_wait_and_process_admin_cq(comp_ctx, aq); in efa_com_cmd_exec()
650 comp_ctx->user_cqe->acq_common_descriptor.status, err); in efa_com_cmd_exec()
674 devm_kfree(edev->dmadev, aq->comp_ctx); in efa_com_admin_destroy()
791 devm_kfree(edev->dmadev, aq->comp_ctx); in efa_com_admin_init()