Lines Matching refs:q
190 struct csio_q *q, *flq; in csio_wr_alloc_q() local
233 q = wrm->q_arr[free_idx]; in csio_wr_alloc_q()
235 q->vstart = pci_alloc_consistent(hw->pdev, qsz, &q->pstart); in csio_wr_alloc_q()
236 if (!q->vstart) { in csio_wr_alloc_q()
247 memset(q->vstart, 0, qsz); in csio_wr_alloc_q()
249 q->type = type; in csio_wr_alloc_q()
250 q->owner = owner; in csio_wr_alloc_q()
251 q->pidx = q->cidx = q->inc_idx = 0; in csio_wr_alloc_q()
252 q->size = qsz; in csio_wr_alloc_q()
253 q->wr_sz = wrsize; /* If using fixed size WRs */ in csio_wr_alloc_q()
259 q->un.iq.genbit = 1; in csio_wr_alloc_q()
265 q->credits = (qsz - q->wr_sz) / q->wr_sz; in csio_wr_alloc_q()
266 q->vwrap = (void *)((uintptr_t)(q->vstart) + qsz in csio_wr_alloc_q()
267 - q->wr_sz); in csio_wr_alloc_q()
282 q->un.iq.flq_idx = flq_idx; in csio_wr_alloc_q()
284 flq = wrm->q_arr[q->un.iq.flq_idx]; in csio_wr_alloc_q()
310 q->un.iq.flq_idx = -1; in csio_wr_alloc_q()
314 q->un.iq.iq_intx_handler = iq_intx_handler; in csio_wr_alloc_q()
319 q->credits = (qsz - csio_wr_qstat_pgsz(hw)) / CSIO_QCREDIT_SZ; in csio_wr_alloc_q()
320 q->vwrap = (void *)((uintptr_t)(q->vstart) + qsz in csio_wr_alloc_q()
324 q->credits = (qsz - csio_wr_qstat_pgsz(hw)) / sizeof(__be64); in csio_wr_alloc_q()
325 q->vwrap = (void *)((uintptr_t)(q->vstart) + qsz in csio_wr_alloc_q()
749 struct csio_q *q = csio_hw_to_wrm(hw)->q_arr[qidx]; in csio_wr_cleanup_eq_stpg() local
750 struct csio_qstatus_page *stp = (struct csio_qstatus_page *)q->vwrap; in csio_wr_cleanup_eq_stpg()
767 struct csio_q *q = wrm->q_arr[qidx]; in csio_wr_cleanup_iq_ftr() local
773 q->un.iq.genbit = 1; in csio_wr_cleanup_iq_ftr()
775 for (i = 0; i < q->credits; i++) { in csio_wr_cleanup_iq_ftr()
777 wr = (void *)((uintptr_t)q->vstart + in csio_wr_cleanup_iq_ftr()
778 (i * q->wr_sz)); in csio_wr_cleanup_iq_ftr()
781 (q->wr_sz - sizeof(*ftr))); in csio_wr_cleanup_iq_ftr()
791 struct csio_q *q; in csio_wr_destroy_queues() local
796 q = wrm->q_arr[i]; in csio_wr_destroy_queues()
798 switch (q->type) { in csio_wr_destroy_queues()
867 struct csio_q *q = wrm->q_arr[qidx]; in csio_wr_get() local
868 void *cwr = (void *)((uintptr_t)(q->vstart) + in csio_wr_get()
869 (q->pidx * CSIO_QCREDIT_SZ)); in csio_wr_get()
870 struct csio_qstatus_page *stp = (struct csio_qstatus_page *)q->vwrap; in csio_wr_get()
871 uint16_t cidx = q->cidx = ntohs(stp->cidx); in csio_wr_get()
872 uint16_t pidx = q->pidx; in csio_wr_get()
877 CSIO_DB_ASSERT(q->owner != NULL); in csio_wr_get()
879 CSIO_DB_ASSERT(cidx <= q->credits); in csio_wr_get()
883 credits = q->credits - (pidx - cidx) - 1; in csio_wr_get()
888 credits = q->credits; in csio_wr_get()
889 CSIO_INC_STATS(q, n_qempty); in csio_wr_get()
897 CSIO_INC_STATS(q, n_qfull); in csio_wr_get()
909 if (unlikely(((uintptr_t)cwr + req_sz) > (uintptr_t)(q->vwrap))) { in csio_wr_get()
911 wrp->size1 = (uint32_t)((uintptr_t)q->vwrap - (uintptr_t)cwr); in csio_wr_get()
912 wrp->addr2 = q->vstart; in csio_wr_get()
914 q->pidx = (uint16_t)(ALIGN(wrp->size2, CSIO_QCREDIT_SZ) / in csio_wr_get()
916 CSIO_INC_STATS(q, n_qwrap); in csio_wr_get()
917 CSIO_INC_STATS(q, n_eq_wr_split); in csio_wr_get()
923 q->pidx += (uint16_t)req_credits; in csio_wr_get()
926 if (unlikely(q->pidx == q->credits)) { in csio_wr_get()
927 q->pidx = 0; in csio_wr_get()
928 CSIO_INC_STATS(q, n_qwrap); in csio_wr_get()
932 q->inc_idx = (uint16_t)req_credits; in csio_wr_get()
934 CSIO_INC_STATS(q, n_tot_reqs); in csio_wr_get()
985 struct csio_q *q = wrm->q_arr[qidx]; in csio_wr_issue() local
991 csio_wr_reg32(hw, DBPRIO(prio) | QID(q->un.eq.physeqid) | in csio_wr_issue()
992 CSIO_HW_PIDX(hw, q->inc_idx), in csio_wr_issue()
994 q->inc_idx = 0; in csio_wr_issue()
1000 csio_wr_avail_qcredits(struct csio_q *q) in csio_wr_avail_qcredits() argument
1002 if (q->pidx > q->cidx) in csio_wr_avail_qcredits()
1003 return q->pidx - q->cidx; in csio_wr_avail_qcredits()
1004 else if (q->cidx > q->pidx) in csio_wr_avail_qcredits()
1005 return q->credits - (q->cidx - q->pidx); in csio_wr_avail_qcredits()
1042 csio_wr_process_fl(struct csio_hw *hw, struct csio_q *q, in csio_wr_process_fl() argument
1055 struct csio_q *flq = hw->wrm.q_arr[q->un.iq.flq_idx]; in csio_wr_process_fl()
1093 iq_handler(hw, wr, q->wr_sz - sizeof(struct csio_iqwr_footer), in csio_wr_process_fl()
1112 csio_is_new_iqwr(struct csio_q *q, struct csio_iqwr_footer *ftr) in csio_is_new_iqwr() argument
1114 return (q->un.iq.genbit == (ftr->u.type_gen >> IQWRF_GEN_SHIFT)); in csio_is_new_iqwr()
1129 csio_wr_process_iq(struct csio_hw *hw, struct csio_q *q, in csio_wr_process_iq() argument
1136 void *wr = (void *)((uintptr_t)q->vstart + (q->cidx * q->wr_sz)); in csio_wr_process_iq()
1140 struct csio_q *flq = csio_iq_has_fl(q) ? in csio_wr_process_iq()
1141 wrm->q_arr[q->un.iq.flq_idx] : NULL; in csio_wr_process_iq()
1146 (q->wr_sz - sizeof(*ftr))); in csio_wr_process_iq()
1152 while (csio_is_new_iqwr(q, ftr)) { in csio_wr_process_iq()
1154 CSIO_DB_ASSERT(((uintptr_t)wr + q->wr_sz) <= in csio_wr_process_iq()
1155 (uintptr_t)q->vwrap); in csio_wr_process_iq()
1162 iq_handler(hw, wr, q->wr_sz - sizeof(*ftr), NULL, priv); in csio_wr_process_iq()
1165 csio_wr_process_fl(hw, q, wr, in csio_wr_process_iq()
1195 CSIO_INC_STATS(q, n_rsp_unknown); in csio_wr_process_iq()
1204 if (((uintptr_t)wr + q->wr_sz) == (uintptr_t)q->vwrap) { in csio_wr_process_iq()
1207 q->cidx = 0; in csio_wr_process_iq()
1208 wr = q->vstart; in csio_wr_process_iq()
1211 q->un.iq.genbit ^= 0x1; in csio_wr_process_iq()
1213 CSIO_INC_STATS(q, n_qwrap); in csio_wr_process_iq()
1215 q->cidx++; in csio_wr_process_iq()
1216 wr = (void *)((uintptr_t)(q->vstart) + in csio_wr_process_iq()
1217 (q->cidx * q->wr_sz)); in csio_wr_process_iq()
1221 (q->wr_sz - sizeof(*ftr))); in csio_wr_process_iq()
1222 q->inc_idx++; in csio_wr_process_iq()
1230 if (unlikely(!q->inc_idx)) { in csio_wr_process_iq()
1231 CSIO_INC_STATS(q, n_stray_comp); in csio_wr_process_iq()
1251 csio_wr_reg32(hw, CIDXINC(q->inc_idx) | in csio_wr_process_iq()
1252 INGRESSQID(q->un.iq.physiqid) | in csio_wr_process_iq()
1255 q->stats.n_tot_rsps += q->inc_idx; in csio_wr_process_iq()
1257 q->inc_idx = 0; in csio_wr_process_iq()
1619 struct csio_q *q; in csio_wrm_exit() local
1623 q = wrm->q_arr[i]; in csio_wrm_exit()
1626 if (q->type == CSIO_FREELIST) { in csio_wrm_exit()
1627 if (!q->un.fl.bufs) in csio_wrm_exit()
1629 for (j = 0; j < q->credits; j++) { in csio_wrm_exit()
1630 buf = &q->un.fl.bufs[j]; in csio_wrm_exit()
1637 kfree(q->un.fl.bufs); in csio_wrm_exit()
1639 pci_free_consistent(hw->pdev, q->size, in csio_wrm_exit()
1640 q->vstart, q->pstart); in csio_wrm_exit()
1642 kfree(q); in csio_wrm_exit()