Lines Matching refs:context
79 struct hns_roce_cmd_context *context = in hns_roce_cmd_event() local
80 &hr_dev->cmd.context[token % hr_dev->cmd.max_cmds]; in hns_roce_cmd_event()
82 if (unlikely(token != context->token)) { in hns_roce_cmd_event()
85 token, context->token); in hns_roce_cmd_event()
89 context->result = (status == HNS_ROCE_CMD_SUCCESS) ? 0 : (-EIO); in hns_roce_cmd_event()
90 context->out_param = out_param; in hns_roce_cmd_event()
91 complete(&context->done); in hns_roce_cmd_event()
98 struct hns_roce_cmd_context *context; in __hns_roce_cmd_mbox_wait() local
105 context = &cmd->context[cmd->free_head]; in __hns_roce_cmd_mbox_wait()
106 cmd->free_head = context->next; in __hns_roce_cmd_mbox_wait()
107 } while (context->busy); in __hns_roce_cmd_mbox_wait()
109 context->busy = 1; in __hns_roce_cmd_mbox_wait()
110 context->token += cmd->max_cmds; in __hns_roce_cmd_mbox_wait()
114 reinit_completion(&context->done); in __hns_roce_cmd_mbox_wait()
116 mbox_msg->token = context->token; in __hns_roce_cmd_mbox_wait()
125 if (!wait_for_completion_timeout(&context->done, in __hns_roce_cmd_mbox_wait()
128 context->token, mbox_msg->cmd); in __hns_roce_cmd_mbox_wait()
133 ret = context->result; in __hns_roce_cmd_mbox_wait()
136 context->token, mbox_msg->cmd, ret); in __hns_roce_cmd_mbox_wait()
139 context->busy = 0; in __hns_roce_cmd_mbox_wait()
206 hr_cmd->context = in hns_roce_cmd_use_events()
207 kcalloc(hr_cmd->max_cmds, sizeof(*hr_cmd->context), GFP_KERNEL); in hns_roce_cmd_use_events()
208 if (!hr_cmd->context) { in hns_roce_cmd_use_events()
214 hr_cmd->context[i].token = i; in hns_roce_cmd_use_events()
215 hr_cmd->context[i].next = i + 1; in hns_roce_cmd_use_events()
216 init_completion(&hr_cmd->context[i].done); in hns_roce_cmd_use_events()
218 hr_cmd->context[hr_cmd->max_cmds - 1].next = 0; in hns_roce_cmd_use_events()
233 kfree(hr_cmd->context); in hns_roce_cmd_use_polling()