Lines Matching refs:ceq
2509 struct irdma_sc_ceq *ceq; in irdma_sc_cq_create() local
2519 ceq = cq->dev->ceq[cq->ceq_id]; in irdma_sc_cq_create()
2520 if (ceq && ceq->reg_cq) in irdma_sc_cq_create()
2521 ret_code = irdma_sc_add_cq_ctx(ceq, cq); in irdma_sc_cq_create()
2528 if (ceq && ceq->reg_cq) in irdma_sc_cq_create()
2529 irdma_sc_remove_cq_ctx(ceq, cq); in irdma_sc_cq_create()
2582 struct irdma_sc_ceq *ceq; in irdma_sc_cq_destroy() local
2589 ceq = cq->dev->ceq[cq->ceq_id]; in irdma_sc_cq_destroy()
2590 if (ceq && ceq->reg_cq) in irdma_sc_cq_destroy()
2591 irdma_sc_remove_cq_ctx(ceq, cq); in irdma_sc_cq_destroy()
3010 static u32 irdma_sc_find_reg_cq(struct irdma_sc_ceq *ceq, in irdma_sc_find_reg_cq() argument
3015 for (i = 0; i < ceq->reg_cq_size; i++) { in irdma_sc_find_reg_cq()
3016 if (cq == ceq->reg_cq[i]) in irdma_sc_find_reg_cq()
3028 enum irdma_status_code irdma_sc_add_cq_ctx(struct irdma_sc_ceq *ceq, in irdma_sc_add_cq_ctx() argument
3033 spin_lock_irqsave(&ceq->req_cq_lock, flags); in irdma_sc_add_cq_ctx()
3035 if (ceq->reg_cq_size == ceq->elem_cnt) { in irdma_sc_add_cq_ctx()
3036 spin_unlock_irqrestore(&ceq->req_cq_lock, flags); in irdma_sc_add_cq_ctx()
3040 ceq->reg_cq[ceq->reg_cq_size++] = cq; in irdma_sc_add_cq_ctx()
3042 spin_unlock_irqrestore(&ceq->req_cq_lock, flags); in irdma_sc_add_cq_ctx()
3052 void irdma_sc_remove_cq_ctx(struct irdma_sc_ceq *ceq, struct irdma_sc_cq *cq) in irdma_sc_remove_cq_ctx() argument
3057 spin_lock_irqsave(&ceq->req_cq_lock, flags); in irdma_sc_remove_cq_ctx()
3058 cq_ctx_idx = irdma_sc_find_reg_cq(ceq, cq); in irdma_sc_remove_cq_ctx()
3062 ceq->reg_cq_size--; in irdma_sc_remove_cq_ctx()
3063 if (cq_ctx_idx != ceq->reg_cq_size) in irdma_sc_remove_cq_ctx()
3064 ceq->reg_cq[cq_ctx_idx] = ceq->reg_cq[ceq->reg_cq_size]; in irdma_sc_remove_cq_ctx()
3065 ceq->reg_cq[ceq->reg_cq_size] = NULL; in irdma_sc_remove_cq_ctx()
3068 spin_unlock_irqrestore(&ceq->req_cq_lock, flags); in irdma_sc_remove_cq_ctx()
3609 enum irdma_status_code irdma_sc_ceq_init(struct irdma_sc_ceq *ceq, in irdma_sc_ceq_init() argument
3625 ceq->size = sizeof(*ceq); in irdma_sc_ceq_init()
3626 ceq->ceqe_base = (struct irdma_ceqe *)info->ceqe_base; in irdma_sc_ceq_init()
3627 ceq->ceq_id = info->ceq_id; in irdma_sc_ceq_init()
3628 ceq->dev = info->dev; in irdma_sc_ceq_init()
3629 ceq->elem_cnt = info->elem_cnt; in irdma_sc_ceq_init()
3630 ceq->ceq_elem_pa = info->ceqe_pa; in irdma_sc_ceq_init()
3631 ceq->virtual_map = info->virtual_map; in irdma_sc_ceq_init()
3632 ceq->itr_no_expire = info->itr_no_expire; in irdma_sc_ceq_init()
3633 ceq->reg_cq = info->reg_cq; in irdma_sc_ceq_init()
3634 ceq->reg_cq_size = 0; in irdma_sc_ceq_init()
3635 spin_lock_init(&ceq->req_cq_lock); in irdma_sc_ceq_init()
3636 ceq->pbl_chunk_size = (ceq->virtual_map ? info->pbl_chunk_size : 0); in irdma_sc_ceq_init()
3637 ceq->first_pm_pbl_idx = (ceq->virtual_map ? info->first_pm_pbl_idx : 0); in irdma_sc_ceq_init()
3638 ceq->pbl_list = (ceq->virtual_map ? info->pbl_list : NULL); in irdma_sc_ceq_init()
3639 ceq->tph_en = info->tph_en; in irdma_sc_ceq_init()
3640 ceq->tph_val = info->tph_val; in irdma_sc_ceq_init()
3641 ceq->vsi = info->vsi; in irdma_sc_ceq_init()
3642 ceq->polarity = 1; in irdma_sc_ceq_init()
3643 IRDMA_RING_INIT(ceq->ceq_ring, ceq->elem_cnt); in irdma_sc_ceq_init()
3644 ceq->dev->ceq[info->ceq_id] = ceq; in irdma_sc_ceq_init()
3656 static enum irdma_status_code irdma_sc_ceq_create(struct irdma_sc_ceq *ceq, u64 scratch, in irdma_sc_ceq_create() argument
3663 cqp = ceq->dev->cqp; in irdma_sc_ceq_create()
3667 set_64bit_val(wqe, 16, ceq->elem_cnt); in irdma_sc_ceq_create()
3669 (ceq->virtual_map ? 0 : ceq->ceq_elem_pa)); in irdma_sc_ceq_create()
3671 (ceq->virtual_map ? ceq->first_pm_pbl_idx : 0)); in irdma_sc_ceq_create()
3673 FIELD_PREP(IRDMA_CQPSQ_TPHVAL, ceq->tph_val) | in irdma_sc_ceq_create()
3674 FIELD_PREP(IRDMA_CQPSQ_VSIIDX, ceq->vsi->vsi_idx)); in irdma_sc_ceq_create()
3675 hdr = FIELD_PREP(IRDMA_CQPSQ_CEQ_CEQID, ceq->ceq_id) | in irdma_sc_ceq_create()
3677 FIELD_PREP(IRDMA_CQPSQ_CEQ_LPBLSIZE, ceq->pbl_chunk_size) | in irdma_sc_ceq_create()
3678 FIELD_PREP(IRDMA_CQPSQ_CEQ_VMAP, ceq->virtual_map) | in irdma_sc_ceq_create()
3679 FIELD_PREP(IRDMA_CQPSQ_CEQ_ITRNOEXPIRE, ceq->itr_no_expire) | in irdma_sc_ceq_create()
3680 FIELD_PREP(IRDMA_CQPSQ_TPHEN, ceq->tph_en) | in irdma_sc_ceq_create()
3699 irdma_sc_cceq_create_done(struct irdma_sc_ceq *ceq) in irdma_sc_cceq_create_done() argument
3703 cqp = ceq->dev->cqp; in irdma_sc_cceq_create_done()
3712 enum irdma_status_code irdma_sc_cceq_destroy_done(struct irdma_sc_ceq *ceq) in irdma_sc_cceq_destroy_done() argument
3716 if (ceq->reg_cq) in irdma_sc_cceq_destroy_done()
3717 irdma_sc_remove_cq_ctx(ceq, ceq->dev->ccq); in irdma_sc_cceq_destroy_done()
3719 cqp = ceq->dev->cqp; in irdma_sc_cceq_destroy_done()
3731 enum irdma_status_code irdma_sc_cceq_create(struct irdma_sc_ceq *ceq, u64 scratch) in irdma_sc_cceq_create() argument
3734 struct irdma_sc_dev *dev = ceq->dev; in irdma_sc_cceq_create()
3736 dev->ccq->vsi = ceq->vsi; in irdma_sc_cceq_create()
3737 if (ceq->reg_cq) { in irdma_sc_cceq_create()
3738 ret_code = irdma_sc_add_cq_ctx(ceq, ceq->dev->ccq); in irdma_sc_cceq_create()
3743 ret_code = irdma_sc_ceq_create(ceq, scratch, true); in irdma_sc_cceq_create()
3745 return irdma_sc_cceq_create_done(ceq); in irdma_sc_cceq_create()
3756 enum irdma_status_code irdma_sc_ceq_destroy(struct irdma_sc_ceq *ceq, u64 scratch, in irdma_sc_ceq_destroy() argument
3763 cqp = ceq->dev->cqp; in irdma_sc_ceq_destroy()
3768 set_64bit_val(wqe, 16, ceq->elem_cnt); in irdma_sc_ceq_destroy()
3769 set_64bit_val(wqe, 48, ceq->first_pm_pbl_idx); in irdma_sc_ceq_destroy()
3770 hdr = ceq->ceq_id | in irdma_sc_ceq_destroy()
3772 FIELD_PREP(IRDMA_CQPSQ_CEQ_LPBLSIZE, ceq->pbl_chunk_size) | in irdma_sc_ceq_destroy()
3773 FIELD_PREP(IRDMA_CQPSQ_CEQ_VMAP, ceq->virtual_map) | in irdma_sc_ceq_destroy()
3774 FIELD_PREP(IRDMA_CQPSQ_TPHEN, ceq->tph_en) | in irdma_sc_ceq_destroy()
3796 void *irdma_sc_process_ceq(struct irdma_sc_dev *dev, struct irdma_sc_ceq *ceq) in irdma_sc_process_ceq() argument
3808 ceqe = IRDMA_GET_CURRENT_CEQ_ELEM(ceq); in irdma_sc_process_ceq()
3811 if (polarity != ceq->polarity) in irdma_sc_process_ceq()
3817 IRDMA_RING_MOVE_TAIL(ceq->ceq_ring); in irdma_sc_process_ceq()
3819 if (!IRDMA_RING_CURRENT_TAIL(ceq->ceq_ring)) in irdma_sc_process_ceq()
3820 ceq->polarity ^= 1; in irdma_sc_process_ceq()
3825 if (ceq->reg_cq) { in irdma_sc_process_ceq()
3826 spin_lock_irqsave(&ceq->req_cq_lock, flags); in irdma_sc_process_ceq()
3827 cq_idx = irdma_sc_find_reg_cq(ceq, cq); in irdma_sc_process_ceq()
3828 spin_unlock_irqrestore(&ceq->req_cq_lock, flags); in irdma_sc_process_ceq()
3831 IRDMA_RING_MOVE_TAIL(ceq->ceq_ring); in irdma_sc_process_ceq()
3832 if (!IRDMA_RING_CURRENT_TAIL(ceq->ceq_ring)) in irdma_sc_process_ceq()
3833 ceq->polarity ^= 1; in irdma_sc_process_ceq()
3850 void irdma_sc_cleanup_ceqes(struct irdma_sc_cq *cq, struct irdma_sc_ceq *ceq) in irdma_sc_cleanup_ceqes() argument
3853 u8 ceq_polarity = ceq->polarity; in irdma_sc_cleanup_ceqes()
3860 next = IRDMA_RING_GET_NEXT_TAIL(ceq->ceq_ring, 0); in irdma_sc_cleanup_ceqes()
3862 for (i = 1; i <= IRDMA_RING_SIZE(*ceq); i++) { in irdma_sc_cleanup_ceqes()
3863 ceqe = IRDMA_GET_CEQ_ELEM_AT_POS(ceq, next); in irdma_sc_cleanup_ceqes()
3874 next = IRDMA_RING_GET_NEXT_TAIL(ceq->ceq_ring, i); in irdma_sc_cleanup_ceqes()
4991 status = irdma_sc_ceq_destroy(pcmdinfo->in.u.ceq_destroy.ceq, in irdma_exec_cqp_cmd()
5002 status = irdma_sc_ceq_create(pcmdinfo->in.u.ceq_create.ceq, in irdma_exec_cqp_cmd()