Lines Matching full:cmdq

230 				    struct nitrox_cmdq *cmdq)  in backlog_list_add()  argument
234 spin_lock_bh(&cmdq->backlog_qlock); in backlog_list_add()
235 list_add_tail(&sr->backlog, &cmdq->backlog_head); in backlog_list_add()
236 atomic_inc(&cmdq->backlog_count); in backlog_list_add()
238 spin_unlock_bh(&cmdq->backlog_qlock); in backlog_list_add()
242 struct nitrox_cmdq *cmdq) in response_list_add() argument
246 spin_lock_bh(&cmdq->resp_qlock); in response_list_add()
247 list_add_tail(&sr->response, &cmdq->response_head); in response_list_add()
248 spin_unlock_bh(&cmdq->resp_qlock); in response_list_add()
252 struct nitrox_cmdq *cmdq) in response_list_del() argument
254 spin_lock_bh(&cmdq->resp_qlock); in response_list_del()
256 spin_unlock_bh(&cmdq->resp_qlock); in response_list_del()
260 get_first_response_entry(struct nitrox_cmdq *cmdq) in get_first_response_entry() argument
262 return list_first_entry_or_null(&cmdq->response_head, in get_first_response_entry()
266 static inline bool cmdq_full(struct nitrox_cmdq *cmdq, int qlen) in cmdq_full() argument
268 if (atomic_inc_return(&cmdq->pending_count) > qlen) { in cmdq_full()
269 atomic_dec(&cmdq->pending_count); in cmdq_full()
282 * @cmdq: Command queue structure
288 struct nitrox_cmdq *cmdq) in post_se_instr() argument
294 spin_lock_bh(&cmdq->cmd_qlock); in post_se_instr()
296 idx = cmdq->write_idx; in post_se_instr()
298 ent = cmdq->base + (idx * cmdq->instr_size); in post_se_instr()
299 memcpy(ent, &sr->instr, cmdq->instr_size); in post_se_instr()
302 response_list_add(sr, cmdq); in post_se_instr()
308 writeq(1, cmdq->dbell_csr_addr); in post_se_instr()
310 cmdq->write_idx = incr_index(idx, 1, ndev->qlen); in post_se_instr()
312 spin_unlock_bh(&cmdq->cmd_qlock); in post_se_instr()
318 static int post_backlog_cmds(struct nitrox_cmdq *cmdq) in post_backlog_cmds() argument
320 struct nitrox_device *ndev = cmdq->ndev; in post_backlog_cmds()
324 if (!atomic_read(&cmdq->backlog_count)) in post_backlog_cmds()
327 spin_lock_bh(&cmdq->backlog_qlock); in post_backlog_cmds()
329 list_for_each_entry_safe(sr, tmp, &cmdq->backlog_head, backlog) { in post_backlog_cmds()
331 if (unlikely(cmdq_full(cmdq, ndev->qlen))) { in post_backlog_cmds()
337 atomic_dec(&cmdq->backlog_count); in post_backlog_cmds()
342 post_se_instr(sr, cmdq); in post_backlog_cmds()
344 spin_unlock_bh(&cmdq->backlog_qlock); in post_backlog_cmds()
351 struct nitrox_cmdq *cmdq = sr->cmdq; in nitrox_enqueue_request() local
355 post_backlog_cmds(cmdq); in nitrox_enqueue_request()
357 if (unlikely(cmdq_full(cmdq, ndev->qlen))) { in nitrox_enqueue_request()
364 backlog_list_add(sr, cmdq); in nitrox_enqueue_request()
367 post_se_instr(sr, cmdq); in nitrox_enqueue_request()
427 sr->cmdq = &ndev->pkt_inq[qno]; in nitrox_process_se_request()
507 struct nitrox_cmdq *cmdq; in backlog_qflush_work() local
509 cmdq = container_of(work, struct nitrox_cmdq, backlog_qflush); in backlog_qflush_work()
510 post_backlog_cmds(cmdq); in backlog_qflush_work()
533 * @cmdq: Command queue structure
537 static void process_response_list(struct nitrox_cmdq *cmdq) in process_response_list() argument
539 struct nitrox_device *ndev = cmdq->ndev; in process_response_list()
546 budget = atomic_read(&cmdq->pending_count); in process_response_list()
549 sr = get_first_response_entry(cmdq); in process_response_list()
565 atomic_dec(&cmdq->pending_count); in process_response_list()
570 response_list_del(sr, cmdq); in process_response_list()
589 struct nitrox_cmdq *cmdq = qvec->cmdq; in pkt_slc_resp_tasklet() local
593 slc_cnts.value = readq(cmdq->compl_cnt_csr_addr); in pkt_slc_resp_tasklet()
597 process_response_list(cmdq); in pkt_slc_resp_tasklet()
603 writeq(slc_cnts.value, cmdq->compl_cnt_csr_addr); in pkt_slc_resp_tasklet()
605 if (atomic_read(&cmdq->backlog_count)) in pkt_slc_resp_tasklet()
606 schedule_work(&cmdq->backlog_qflush); in pkt_slc_resp_tasklet()