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_zalloc_consistent(hw->pdev, qsz, &q->pstart); in csio_wr_alloc_q()
236 if (!q->vstart) { in csio_wr_alloc_q()
243 q->type = type; in csio_wr_alloc_q()
244 q->owner = owner; in csio_wr_alloc_q()
245 q->pidx = q->cidx = q->inc_idx = 0; in csio_wr_alloc_q()
246 q->size = qsz; in csio_wr_alloc_q()
247 q->wr_sz = wrsize; /* If using fixed size WRs */ in csio_wr_alloc_q()
253 q->un.iq.genbit = 1; in csio_wr_alloc_q()
259 q->credits = (qsz - q->wr_sz) / q->wr_sz; in csio_wr_alloc_q()
260 q->vwrap = (void *)((uintptr_t)(q->vstart) + qsz in csio_wr_alloc_q()
261 - q->wr_sz); in csio_wr_alloc_q()
276 q->un.iq.flq_idx = flq_idx; in csio_wr_alloc_q()
278 flq = wrm->q_arr[q->un.iq.flq_idx]; in csio_wr_alloc_q()
304 q->un.iq.flq_idx = -1; in csio_wr_alloc_q()
308 q->un.iq.iq_intx_handler = iq_intx_handler; in csio_wr_alloc_q()
313 q->credits = (qsz - csio_wr_qstat_pgsz(hw)) / CSIO_QCREDIT_SZ; in csio_wr_alloc_q()
314 q->vwrap = (void *)((uintptr_t)(q->vstart) + qsz in csio_wr_alloc_q()
318 q->credits = (qsz - csio_wr_qstat_pgsz(hw)) / sizeof(__be64); in csio_wr_alloc_q()
319 q->vwrap = (void *)((uintptr_t)(q->vstart) + qsz in csio_wr_alloc_q()
743 struct csio_q *q = csio_hw_to_wrm(hw)->q_arr[qidx]; in csio_wr_cleanup_eq_stpg() local
744 struct csio_qstatus_page *stp = (struct csio_qstatus_page *)q->vwrap; in csio_wr_cleanup_eq_stpg()
761 struct csio_q *q = wrm->q_arr[qidx]; in csio_wr_cleanup_iq_ftr() local
767 q->un.iq.genbit = 1; in csio_wr_cleanup_iq_ftr()
769 for (i = 0; i < q->credits; i++) { in csio_wr_cleanup_iq_ftr()
771 wr = (void *)((uintptr_t)q->vstart + in csio_wr_cleanup_iq_ftr()
772 (i * q->wr_sz)); in csio_wr_cleanup_iq_ftr()
775 (q->wr_sz - sizeof(*ftr))); in csio_wr_cleanup_iq_ftr()
785 struct csio_q *q; in csio_wr_destroy_queues() local
790 q = wrm->q_arr[i]; in csio_wr_destroy_queues()
792 switch (q->type) { in csio_wr_destroy_queues()
861 struct csio_q *q = wrm->q_arr[qidx]; in csio_wr_get() local
862 void *cwr = (void *)((uintptr_t)(q->vstart) + in csio_wr_get()
863 (q->pidx * CSIO_QCREDIT_SZ)); in csio_wr_get()
864 struct csio_qstatus_page *stp = (struct csio_qstatus_page *)q->vwrap; in csio_wr_get()
865 uint16_t cidx = q->cidx = ntohs(stp->cidx); in csio_wr_get()
866 uint16_t pidx = q->pidx; in csio_wr_get()
871 CSIO_DB_ASSERT(q->owner != NULL); in csio_wr_get()
873 CSIO_DB_ASSERT(cidx <= q->credits); in csio_wr_get()
877 credits = q->credits - (pidx - cidx) - 1; in csio_wr_get()
882 credits = q->credits; in csio_wr_get()
883 CSIO_INC_STATS(q, n_qempty); in csio_wr_get()
891 CSIO_INC_STATS(q, n_qfull); in csio_wr_get()
903 if (unlikely(((uintptr_t)cwr + req_sz) > (uintptr_t)(q->vwrap))) { in csio_wr_get()
905 wrp->size1 = (uint32_t)((uintptr_t)q->vwrap - (uintptr_t)cwr); in csio_wr_get()
906 wrp->addr2 = q->vstart; in csio_wr_get()
908 q->pidx = (uint16_t)(ALIGN(wrp->size2, CSIO_QCREDIT_SZ) / in csio_wr_get()
910 CSIO_INC_STATS(q, n_qwrap); in csio_wr_get()
911 CSIO_INC_STATS(q, n_eq_wr_split); in csio_wr_get()
917 q->pidx += (uint16_t)req_credits; in csio_wr_get()
920 if (unlikely(q->pidx == q->credits)) { in csio_wr_get()
921 q->pidx = 0; in csio_wr_get()
922 CSIO_INC_STATS(q, n_qwrap); in csio_wr_get()
926 q->inc_idx = (uint16_t)req_credits; in csio_wr_get()
928 CSIO_INC_STATS(q, n_tot_reqs); in csio_wr_get()
979 struct csio_q *q = wrm->q_arr[qidx]; in csio_wr_issue() local
985 csio_wr_reg32(hw, DBPRIO_V(prio) | QID_V(q->un.eq.physeqid) | in csio_wr_issue()
986 PIDX_T5_V(q->inc_idx) | DBTYPE_F, in csio_wr_issue()
988 q->inc_idx = 0; in csio_wr_issue()
994 csio_wr_avail_qcredits(struct csio_q *q) in csio_wr_avail_qcredits() argument
996 if (q->pidx > q->cidx) in csio_wr_avail_qcredits()
997 return q->pidx - q->cidx; in csio_wr_avail_qcredits()
998 else if (q->cidx > q->pidx) in csio_wr_avail_qcredits()
999 return q->credits - (q->cidx - q->pidx); in csio_wr_avail_qcredits()
1036 csio_wr_process_fl(struct csio_hw *hw, struct csio_q *q, in csio_wr_process_fl() argument
1049 struct csio_q *flq = hw->wrm.q_arr[q->un.iq.flq_idx]; in csio_wr_process_fl()
1087 iq_handler(hw, wr, q->wr_sz - sizeof(struct csio_iqwr_footer), in csio_wr_process_fl()
1106 csio_is_new_iqwr(struct csio_q *q, struct csio_iqwr_footer *ftr) in csio_is_new_iqwr() argument
1108 return (q->un.iq.genbit == (ftr->u.type_gen >> IQWRF_GEN_SHIFT)); in csio_is_new_iqwr()
1123 csio_wr_process_iq(struct csio_hw *hw, struct csio_q *q, in csio_wr_process_iq() argument
1130 void *wr = (void *)((uintptr_t)q->vstart + (q->cidx * q->wr_sz)); in csio_wr_process_iq()
1134 struct csio_q *flq = csio_iq_has_fl(q) ? in csio_wr_process_iq()
1135 wrm->q_arr[q->un.iq.flq_idx] : NULL; in csio_wr_process_iq()
1140 (q->wr_sz - sizeof(*ftr))); in csio_wr_process_iq()
1146 while (csio_is_new_iqwr(q, ftr)) { in csio_wr_process_iq()
1148 CSIO_DB_ASSERT(((uintptr_t)wr + q->wr_sz) <= in csio_wr_process_iq()
1149 (uintptr_t)q->vwrap); in csio_wr_process_iq()
1156 iq_handler(hw, wr, q->wr_sz - sizeof(*ftr), NULL, priv); in csio_wr_process_iq()
1159 csio_wr_process_fl(hw, q, wr, in csio_wr_process_iq()
1189 CSIO_INC_STATS(q, n_rsp_unknown); in csio_wr_process_iq()
1198 if (((uintptr_t)wr + q->wr_sz) == (uintptr_t)q->vwrap) { in csio_wr_process_iq()
1201 q->cidx = 0; in csio_wr_process_iq()
1202 wr = q->vstart; in csio_wr_process_iq()
1205 q->un.iq.genbit ^= 0x1; in csio_wr_process_iq()
1207 CSIO_INC_STATS(q, n_qwrap); in csio_wr_process_iq()
1209 q->cidx++; in csio_wr_process_iq()
1210 wr = (void *)((uintptr_t)(q->vstart) + in csio_wr_process_iq()
1211 (q->cidx * q->wr_sz)); in csio_wr_process_iq()
1215 (q->wr_sz - sizeof(*ftr))); in csio_wr_process_iq()
1216 q->inc_idx++; in csio_wr_process_iq()
1224 if (unlikely(!q->inc_idx)) { in csio_wr_process_iq()
1225 CSIO_INC_STATS(q, n_stray_comp); in csio_wr_process_iq()
1245 csio_wr_reg32(hw, CIDXINC_V(q->inc_idx) | in csio_wr_process_iq()
1246 INGRESSQID_V(q->un.iq.physiqid) | in csio_wr_process_iq()
1249 q->stats.n_tot_rsps += q->inc_idx; in csio_wr_process_iq()
1251 q->inc_idx = 0; in csio_wr_process_iq()
1616 struct csio_q *q; in csio_wrm_exit() local
1620 q = wrm->q_arr[i]; in csio_wrm_exit()
1623 if (q->type == CSIO_FREELIST) { in csio_wrm_exit()
1624 if (!q->un.fl.bufs) in csio_wrm_exit()
1626 for (j = 0; j < q->credits; j++) { in csio_wrm_exit()
1627 buf = &q->un.fl.bufs[j]; in csio_wrm_exit()
1634 kfree(q->un.fl.bufs); in csio_wrm_exit()
1636 pci_free_consistent(hw->pdev, q->size, in csio_wrm_exit()
1637 q->vstart, q->pstart); in csio_wrm_exit()
1639 kfree(q); in csio_wrm_exit()