Lines Matching defs:ceq

2522 	struct irdma_sc_ceq *ceq;
2532 ceq = cq->dev->ceq[cq->ceq_id];
2533 if (ceq && ceq->reg_cq)
2534 ret_code = irdma_sc_add_cq_ctx(ceq, cq);
2541 if (ceq && ceq->reg_cq)
2542 irdma_sc_remove_cq_ctx(ceq, cq);
2594 struct irdma_sc_ceq *ceq;
2601 ceq = cq->dev->ceq[cq->ceq_id];
2602 if (ceq && ceq->reg_cq)
2603 irdma_sc_remove_cq_ctx(ceq, cq);
3018 * @ceq: ceq sc structure
3021 static u32 irdma_sc_find_reg_cq(struct irdma_sc_ceq *ceq,
3026 for (i = 0; i < ceq->reg_cq_size; i++) {
3027 if (cq == ceq->reg_cq[i])
3035 * irdma_sc_add_cq_ctx - add cq ctx tracking for ceq
3036 * @ceq: ceq sc structure
3039 int irdma_sc_add_cq_ctx(struct irdma_sc_ceq *ceq, struct irdma_sc_cq *cq)
3043 spin_lock_irqsave(&ceq->req_cq_lock, flags);
3045 if (ceq->reg_cq_size == ceq->elem_cnt) {
3046 spin_unlock_irqrestore(&ceq->req_cq_lock, flags);
3050 ceq->reg_cq[ceq->reg_cq_size++] = cq;
3052 spin_unlock_irqrestore(&ceq->req_cq_lock, flags);
3058 * irdma_sc_remove_cq_ctx - remove cq ctx tracking for ceq
3059 * @ceq: ceq sc structure
3062 void irdma_sc_remove_cq_ctx(struct irdma_sc_ceq *ceq, struct irdma_sc_cq *cq)
3067 spin_lock_irqsave(&ceq->req_cq_lock, flags);
3068 cq_ctx_idx = irdma_sc_find_reg_cq(ceq, cq);
3072 ceq->reg_cq_size--;
3073 if (cq_ctx_idx != ceq->reg_cq_size)
3074 ceq->reg_cq[cq_ctx_idx] = ceq->reg_cq[ceq->reg_cq_size];
3075 ceq->reg_cq[ceq->reg_cq_size] = NULL;
3078 spin_unlock_irqrestore(&ceq->req_cq_lock, flags);
3614 * irdma_sc_ceq_init - initialize ceq
3615 * @ceq: ceq sc structure
3616 * @info: ceq initialization info
3618 int irdma_sc_ceq_init(struct irdma_sc_ceq *ceq,
3634 ceq->size = sizeof(*ceq);
3635 ceq->ceqe_base = (struct irdma_ceqe *)info->ceqe_base;
3636 ceq->ceq_id = info->ceq_id;
3637 ceq->dev = info->dev;
3638 ceq->elem_cnt = info->elem_cnt;
3639 ceq->ceq_elem_pa = info->ceqe_pa;
3640 ceq->virtual_map = info->virtual_map;
3641 ceq->itr_no_expire = info->itr_no_expire;
3642 ceq->reg_cq = info->reg_cq;
3643 ceq->reg_cq_size = 0;
3644 spin_lock_init(&ceq->req_cq_lock);
3645 ceq->pbl_chunk_size = (ceq->virtual_map ? info->pbl_chunk_size : 0);
3646 ceq->first_pm_pbl_idx = (ceq->virtual_map ? info->first_pm_pbl_idx : 0);
3647 ceq->pbl_list = (ceq->virtual_map ? info->pbl_list : NULL);
3648 ceq->tph_en = info->tph_en;
3649 ceq->tph_val = info->tph_val;
3650 ceq->vsi = info->vsi;
3651 ceq->polarity = 1;
3652 IRDMA_RING_INIT(ceq->ceq_ring, ceq->elem_cnt);
3653 ceq->dev->ceq[info->ceq_id] = ceq;
3659 * irdma_sc_ceq_create - create ceq wqe
3660 * @ceq: ceq sc structure
3665 static int irdma_sc_ceq_create(struct irdma_sc_ceq *ceq, u64 scratch,
3672 cqp = ceq->dev->cqp;
3676 set_64bit_val(wqe, 16, ceq->elem_cnt);
3678 (ceq->virtual_map ? 0 : ceq->ceq_elem_pa));
3680 (ceq->virtual_map ? ceq->first_pm_pbl_idx : 0));
3682 FIELD_PREP(IRDMA_CQPSQ_TPHVAL, ceq->tph_val) |
3683 FIELD_PREP(IRDMA_CQPSQ_VSIIDX, ceq->vsi->vsi_idx));
3684 hdr = FIELD_PREP(IRDMA_CQPSQ_CEQ_CEQID, ceq->ceq_id) |
3686 FIELD_PREP(IRDMA_CQPSQ_CEQ_LPBLSIZE, ceq->pbl_chunk_size) |
3687 FIELD_PREP(IRDMA_CQPSQ_CEQ_VMAP, ceq->virtual_map) |
3688 FIELD_PREP(IRDMA_CQPSQ_CEQ_ITRNOEXPIRE, ceq->itr_no_expire) |
3689 FIELD_PREP(IRDMA_CQPSQ_TPHEN, ceq->tph_en) |
3704 * irdma_sc_cceq_create_done - poll for control ceq wqe to complete
3705 * @ceq: ceq sc structure
3707 static int irdma_sc_cceq_create_done(struct irdma_sc_ceq *ceq)
3711 cqp = ceq->dev->cqp;
3718 * @ceq: ceq sc structure
3720 int irdma_sc_cceq_destroy_done(struct irdma_sc_ceq *ceq)
3724 if (ceq->reg_cq)
3725 irdma_sc_remove_cq_ctx(ceq, ceq->dev->ccq);
3727 cqp = ceq->dev->cqp;
3736 * @ceq: ceq sc structure
3739 int irdma_sc_cceq_create(struct irdma_sc_ceq *ceq, u64 scratch)
3742 struct irdma_sc_dev *dev = ceq->dev;
3744 dev->ccq->vsi = ceq->vsi;
3745 if (ceq->reg_cq) {
3746 ret_code = irdma_sc_add_cq_ctx(ceq, ceq->dev->ccq);
3751 ret_code = irdma_sc_ceq_create(ceq, scratch, true);
3753 return irdma_sc_cceq_create_done(ceq);
3759 * irdma_sc_ceq_destroy - destroy ceq
3760 * @ceq: ceq sc structure
3764 int irdma_sc_ceq_destroy(struct irdma_sc_ceq *ceq, u64 scratch, bool post_sq)
3770 cqp = ceq->dev->cqp;
3775 set_64bit_val(wqe, 16, ceq->elem_cnt);
3776 set_64bit_val(wqe, 48, ceq->first_pm_pbl_idx);
3777 hdr = ceq->ceq_id |
3779 FIELD_PREP(IRDMA_CQPSQ_CEQ_LPBLSIZE, ceq->pbl_chunk_size) |
3780 FIELD_PREP(IRDMA_CQPSQ_CEQ_VMAP, ceq->virtual_map) |
3781 FIELD_PREP(IRDMA_CQPSQ_TPHEN, ceq->tph_en) |
3796 * irdma_sc_process_ceq - process ceq
3798 * @ceq: ceq sc structure
3801 * because these functions manipulate the same ceq
3803 void *irdma_sc_process_ceq(struct irdma_sc_dev *dev, struct irdma_sc_ceq *ceq)
3815 ceqe = IRDMA_GET_CURRENT_CEQ_ELEM(ceq);
3818 if (polarity != ceq->polarity)
3824 IRDMA_RING_MOVE_TAIL(ceq->ceq_ring);
3826 if (!IRDMA_RING_CURRENT_TAIL(ceq->ceq_ring))
3827 ceq->polarity ^= 1;
3832 if (ceq->reg_cq) {
3833 spin_lock_irqsave(&ceq->req_cq_lock, flags);
3834 cq_idx = irdma_sc_find_reg_cq(ceq, cq);
3835 spin_unlock_irqrestore(&ceq->req_cq_lock, flags);
3838 IRDMA_RING_MOVE_TAIL(ceq->ceq_ring);
3839 if (!IRDMA_RING_CURRENT_TAIL(ceq->ceq_ring))
3840 ceq->polarity ^= 1;
3851 * @ceq: ceq ptr
3857 void irdma_sc_cleanup_ceqes(struct irdma_sc_cq *cq, struct irdma_sc_ceq *ceq)
3860 u8 ceq_polarity = ceq->polarity;
3867 next = IRDMA_RING_GET_NEXT_TAIL(ceq->ceq_ring, 0);
3869 for (i = 1; i <= IRDMA_RING_SIZE(*ceq); i++) {
3870 ceqe = IRDMA_GET_CEQ_ELEM_AT_POS(ceq, next);
3881 next = IRDMA_RING_GET_NEXT_TAIL(ceq->ceq_ring, i);
4991 status = irdma_sc_ceq_destroy(pcmdinfo->in.u.ceq_destroy.ceq,
5002 status = irdma_sc_ceq_create(pcmdinfo->in.u.ceq_create.ceq,