Lines Matching refs:hr_cmd
218 struct hns_roce_cmdq *hr_cmd = &hr_dev->cmd; in hns_roce_cmd_use_events() local
221 hr_cmd->context = kmalloc_array(hr_cmd->max_cmds, in hns_roce_cmd_use_events()
222 sizeof(*hr_cmd->context), in hns_roce_cmd_use_events()
224 if (!hr_cmd->context) in hns_roce_cmd_use_events()
227 for (i = 0; i < hr_cmd->max_cmds; ++i) { in hns_roce_cmd_use_events()
228 hr_cmd->context[i].token = i; in hns_roce_cmd_use_events()
229 hr_cmd->context[i].next = i + 1; in hns_roce_cmd_use_events()
232 hr_cmd->context[hr_cmd->max_cmds - 1].next = -1; in hns_roce_cmd_use_events()
233 hr_cmd->free_head = 0; in hns_roce_cmd_use_events()
235 sema_init(&hr_cmd->event_sem, hr_cmd->max_cmds); in hns_roce_cmd_use_events()
236 spin_lock_init(&hr_cmd->context_lock); in hns_roce_cmd_use_events()
238 hr_cmd->token_mask = CMD_TOKEN_MASK; in hns_roce_cmd_use_events()
239 hr_cmd->use_events = 1; in hns_roce_cmd_use_events()
241 down(&hr_cmd->poll_sem); in hns_roce_cmd_use_events()
248 struct hns_roce_cmdq *hr_cmd = &hr_dev->cmd; in hns_roce_cmd_use_polling() local
251 hr_cmd->use_events = 0; in hns_roce_cmd_use_polling()
253 for (i = 0; i < hr_cmd->max_cmds; ++i) in hns_roce_cmd_use_polling()
254 down(&hr_cmd->event_sem); in hns_roce_cmd_use_polling()
256 kfree(hr_cmd->context); in hns_roce_cmd_use_polling()
257 up(&hr_cmd->poll_sem); in hns_roce_cmd_use_polling()