Lines Matching refs:cq
703 static inline void write_gts(struct t4_cq *cq, u32 val) in write_gts() argument
705 if (cq->bar2_va) in write_gts()
706 writel(val | INGRESSQID_V(cq->bar2_qid), in write_gts()
707 cq->bar2_va + SGE_UDB_GTS); in write_gts()
709 writel(val | INGRESSQID_V(cq->cqid), cq->gts); in write_gts()
712 static inline int t4_clear_cq_armed(struct t4_cq *cq) in t4_clear_cq_armed() argument
714 return test_and_clear_bit(CQ_ARMED, &cq->flags); in t4_clear_cq_armed()
717 static inline int t4_arm_cq(struct t4_cq *cq, int se) in t4_arm_cq() argument
721 set_bit(CQ_ARMED, &cq->flags); in t4_arm_cq()
722 while (cq->cidx_inc > CIDXINC_M) { in t4_arm_cq()
724 write_gts(cq, val); in t4_arm_cq()
725 cq->cidx_inc -= CIDXINC_M; in t4_arm_cq()
727 val = SEINTARM_V(se) | CIDXINC_V(cq->cidx_inc) | TIMERREG_V(6); in t4_arm_cq()
728 write_gts(cq, val); in t4_arm_cq()
729 cq->cidx_inc = 0; in t4_arm_cq()
733 static inline void t4_swcq_produce(struct t4_cq *cq) in t4_swcq_produce() argument
735 cq->sw_in_use++; in t4_swcq_produce()
736 if (cq->sw_in_use == cq->size) { in t4_swcq_produce()
738 __func__, cq->cqid); in t4_swcq_produce()
739 cq->error = 1; in t4_swcq_produce()
740 cq->sw_in_use--; in t4_swcq_produce()
743 if (++cq->sw_pidx == cq->size) in t4_swcq_produce()
744 cq->sw_pidx = 0; in t4_swcq_produce()
747 static inline void t4_swcq_consume(struct t4_cq *cq) in t4_swcq_consume() argument
749 cq->sw_in_use--; in t4_swcq_consume()
750 if (++cq->sw_cidx == cq->size) in t4_swcq_consume()
751 cq->sw_cidx = 0; in t4_swcq_consume()
754 static inline void t4_hwcq_consume(struct t4_cq *cq) in t4_hwcq_consume() argument
756 cq->bits_type_ts = cq->queue[cq->cidx].bits_type_ts; in t4_hwcq_consume()
757 if (++cq->cidx_inc == (cq->size >> 4) || cq->cidx_inc == CIDXINC_M) { in t4_hwcq_consume()
760 val = SEINTARM_V(0) | CIDXINC_V(cq->cidx_inc) | TIMERREG_V(7); in t4_hwcq_consume()
761 write_gts(cq, val); in t4_hwcq_consume()
762 cq->cidx_inc = 0; in t4_hwcq_consume()
764 if (++cq->cidx == cq->size) { in t4_hwcq_consume()
765 cq->cidx = 0; in t4_hwcq_consume()
766 cq->gen ^= 1; in t4_hwcq_consume()
770 static inline int t4_valid_cqe(struct t4_cq *cq, struct t4_cqe *cqe) in t4_valid_cqe() argument
772 return (CQE_GENBIT(cqe) == cq->gen); in t4_valid_cqe()
775 static inline int t4_cq_notempty(struct t4_cq *cq) in t4_cq_notempty() argument
777 return cq->sw_in_use || t4_valid_cqe(cq, &cq->queue[cq->cidx]); in t4_cq_notempty()
780 static inline int t4_next_hw_cqe(struct t4_cq *cq, struct t4_cqe **cqe) in t4_next_hw_cqe() argument
785 if (cq->cidx == 0) in t4_next_hw_cqe()
786 prev_cidx = cq->size - 1; in t4_next_hw_cqe()
788 prev_cidx = cq->cidx - 1; in t4_next_hw_cqe()
790 if (cq->queue[prev_cidx].bits_type_ts != cq->bits_type_ts) { in t4_next_hw_cqe()
792 cq->error = 1; in t4_next_hw_cqe()
793 pr_err("cq overflow cqid %u\n", cq->cqid); in t4_next_hw_cqe()
794 } else if (t4_valid_cqe(cq, &cq->queue[cq->cidx])) { in t4_next_hw_cqe()
798 *cqe = &cq->queue[cq->cidx]; in t4_next_hw_cqe()
805 static inline int t4_next_cqe(struct t4_cq *cq, struct t4_cqe **cqe) in t4_next_cqe() argument
809 if (cq->error) in t4_next_cqe()
811 else if (cq->sw_in_use) in t4_next_cqe()
812 *cqe = &cq->sw_queue[cq->sw_cidx]; in t4_next_cqe()
814 ret = t4_next_hw_cqe(cq, cqe); in t4_next_cqe()
818 static inline void t4_set_cq_in_error(struct t4_cq *cq) in t4_set_cq_in_error() argument
820 *cq->qp_errp = 1; in t4_set_cq_in_error()