Lines Matching refs:srq
1118 if (!attrs->srq && (attrs->cap.max_recv_wr > dev->attr.max_rqe)) { in ocrdma_check_qp_params()
1173 int dpp_credit_lmt, int srq) in ocrdma_copy_qp_uresp() argument
1190 if (!srq) { in ocrdma_copy_qp_uresp()
1217 if (!srq) { in ocrdma_copy_qp_uresp()
1342 (attrs->srq != NULL)); in ocrdma_create_qp()
1543 static void ocrdma_srq_toggle_bit(struct ocrdma_srq *srq, unsigned int idx) in ocrdma_srq_toggle_bit() argument
1548 srq->idx_bit_fields[i] ^= mask; in ocrdma_srq_toggle_bit()
1610 if (is_hw_sq_empty(qp) && (!qp->srq && is_hw_rq_empty(qp))) in ocrdma_discard_cqes()
1627 if (qp->srq) { in ocrdma_discard_cqes()
1630 qp->srq->rq.max_wqe_idx; in ocrdma_discard_cqes()
1632 spin_lock_irqsave(&qp->srq->q_lock, flags); in ocrdma_discard_cqes()
1633 ocrdma_hwq_inc_tail(&qp->srq->rq); in ocrdma_discard_cqes()
1634 ocrdma_srq_toggle_bit(qp->srq, wqe_idx - 1); in ocrdma_discard_cqes()
1635 spin_unlock_irqrestore(&qp->srq->q_lock, flags); in ocrdma_discard_cqes()
1663 if (!qp->srq) { in ocrdma_del_flush_qp()
1721 if (!qp->srq) in ocrdma_destroy_qp()
1733 static int ocrdma_copy_srq_uresp(struct ocrdma_dev *dev, struct ocrdma_srq *srq, in ocrdma_copy_srq_uresp() argument
1740 uresp.rq_dbid = srq->rq.dbid; in ocrdma_copy_srq_uresp()
1742 uresp.rq_page_addr[0] = virt_to_phys(srq->rq.va); in ocrdma_copy_srq_uresp()
1743 uresp.rq_page_size = srq->rq.len; in ocrdma_copy_srq_uresp()
1745 (srq->pd->id * dev->nic_info.db_page_size); in ocrdma_copy_srq_uresp()
1747 uresp.num_rqe_allocated = srq->rq.max_cnt; in ocrdma_copy_srq_uresp()
1759 status = ocrdma_add_mmap(srq->pd->uctx, uresp.rq_page_addr[0], in ocrdma_copy_srq_uresp()
1772 struct ocrdma_srq *srq = get_ocrdma_srq(ibsrq); in ocrdma_create_srq() local
1782 spin_lock_init(&srq->q_lock); in ocrdma_create_srq()
1783 srq->pd = pd; in ocrdma_create_srq()
1784 srq->db = dev->nic_info.db + (pd->id * dev->nic_info.db_page_size); in ocrdma_create_srq()
1785 status = ocrdma_mbx_create_srq(dev, srq, init_attr, pd); in ocrdma_create_srq()
1790 srq->rqe_wr_id_tbl = kcalloc(srq->rq.max_cnt, sizeof(u64), in ocrdma_create_srq()
1792 if (!srq->rqe_wr_id_tbl) { in ocrdma_create_srq()
1797 srq->bit_fields_len = (srq->rq.max_cnt / 32) + in ocrdma_create_srq()
1798 (srq->rq.max_cnt % 32 ? 1 : 0); in ocrdma_create_srq()
1799 srq->idx_bit_fields = in ocrdma_create_srq()
1800 kmalloc_array(srq->bit_fields_len, sizeof(u32), in ocrdma_create_srq()
1802 if (!srq->idx_bit_fields) { in ocrdma_create_srq()
1806 memset(srq->idx_bit_fields, 0xff, in ocrdma_create_srq()
1807 srq->bit_fields_len * sizeof(u32)); in ocrdma_create_srq()
1811 status = ocrdma_mbx_modify_srq(srq, &init_attr->attr); in ocrdma_create_srq()
1817 status = ocrdma_copy_srq_uresp(dev, srq, udata); in ocrdma_create_srq()
1825 ocrdma_mbx_destroy_srq(dev, srq); in ocrdma_create_srq()
1826 kfree(srq->rqe_wr_id_tbl); in ocrdma_create_srq()
1827 kfree(srq->idx_bit_fields); in ocrdma_create_srq()
1837 struct ocrdma_srq *srq; in ocrdma_modify_srq() local
1839 srq = get_ocrdma_srq(ibsrq); in ocrdma_modify_srq()
1843 status = ocrdma_mbx_modify_srq(srq, srq_attr); in ocrdma_modify_srq()
1849 struct ocrdma_srq *srq; in ocrdma_query_srq() local
1851 srq = get_ocrdma_srq(ibsrq); in ocrdma_query_srq()
1852 return ocrdma_mbx_query_srq(srq, srq_attr); in ocrdma_query_srq()
1857 struct ocrdma_srq *srq; in ocrdma_destroy_srq() local
1860 srq = get_ocrdma_srq(ibsrq); in ocrdma_destroy_srq()
1862 ocrdma_mbx_destroy_srq(dev, srq); in ocrdma_destroy_srq()
1864 if (srq->pd->uctx) in ocrdma_destroy_srq()
1865 ocrdma_del_mmap(srq->pd->uctx, (u64) srq->rq.pa, in ocrdma_destroy_srq()
1866 PAGE_ALIGN(srq->rq.len)); in ocrdma_destroy_srq()
1868 kfree(srq->idx_bit_fields); in ocrdma_destroy_srq()
1869 kfree(srq->rqe_wr_id_tbl); in ocrdma_destroy_srq()
2264 static int ocrdma_srq_get_idx(struct ocrdma_srq *srq) in ocrdma_srq_get_idx() argument
2269 for (row = 0; row < srq->bit_fields_len; row++) { in ocrdma_srq_get_idx()
2270 if (srq->idx_bit_fields[row]) { in ocrdma_srq_get_idx()
2271 indx = ffs(srq->idx_bit_fields[row]); in ocrdma_srq_get_idx()
2273 BUG_ON(indx >= srq->rq.max_cnt); in ocrdma_srq_get_idx()
2274 ocrdma_srq_toggle_bit(srq, indx); in ocrdma_srq_get_idx()
2279 BUG_ON(row == srq->bit_fields_len); in ocrdma_srq_get_idx()
2283 static void ocrdma_ring_srq_db(struct ocrdma_srq *srq) in ocrdma_ring_srq_db() argument
2285 u32 val = srq->rq.dbid | (1 << 16); in ocrdma_ring_srq_db()
2287 iowrite32(val, srq->db + OCRDMA_DB_GEN2_SRQ_OFFSET); in ocrdma_ring_srq_db()
2295 struct ocrdma_srq *srq; in ocrdma_post_srq_recv() local
2299 srq = get_ocrdma_srq(ibsrq); in ocrdma_post_srq_recv()
2301 spin_lock_irqsave(&srq->q_lock, flags); in ocrdma_post_srq_recv()
2303 if (ocrdma_hwq_free_cnt(&srq->rq) == 0 || in ocrdma_post_srq_recv()
2304 wr->num_sge > srq->rq.max_sges) { in ocrdma_post_srq_recv()
2309 tag = ocrdma_srq_get_idx(srq); in ocrdma_post_srq_recv()
2310 rqe = ocrdma_hwq_head(&srq->rq); in ocrdma_post_srq_recv()
2313 srq->rqe_wr_id_tbl[tag] = wr->wr_id; in ocrdma_post_srq_recv()
2317 ocrdma_ring_srq_db(srq); in ocrdma_post_srq_recv()
2319 ocrdma_hwq_inc_head(&srq->rq); in ocrdma_post_srq_recv()
2322 spin_unlock_irqrestore(&srq->q_lock, flags); in ocrdma_post_srq_recv()
2531 if (!qp->srq && (qp->sq_cq == qp->rq_cq)) { in ocrdma_poll_err_scqe()
2631 struct ocrdma_srq *srq; in ocrdma_update_free_srq_cqe() local
2634 srq = get_ocrdma_srq(qp->ibqp.srq); in ocrdma_update_free_srq_cqe()
2636 OCRDMA_CQE_BUFTAG_SHIFT) & srq->rq.max_wqe_idx; in ocrdma_update_free_srq_cqe()
2639 ibwc->wr_id = srq->rqe_wr_id_tbl[wqe_idx]; in ocrdma_update_free_srq_cqe()
2640 spin_lock_irqsave(&srq->q_lock, flags); in ocrdma_update_free_srq_cqe()
2641 ocrdma_srq_toggle_bit(srq, wqe_idx - 1); in ocrdma_update_free_srq_cqe()
2642 spin_unlock_irqrestore(&srq->q_lock, flags); in ocrdma_update_free_srq_cqe()
2643 ocrdma_hwq_inc_tail(&srq->rq); in ocrdma_update_free_srq_cqe()
2660 if (!qp->srq && (qp->sq_cq == qp->rq_cq)) { in ocrdma_poll_err_rcqe()
2707 if (qp->ibqp.srq) { in ocrdma_poll_success_rcqe()