Lines Matching refs:srq

1116 	if (!attrs->srq && (attrs->cap.max_recv_wr > dev->attr.max_rqe)) {  in ocrdma_check_qp_params()
1171 int dpp_credit_lmt, int srq) in ocrdma_copy_qp_uresp() argument
1188 if (!srq) { in ocrdma_copy_qp_uresp()
1215 if (!srq) { in ocrdma_copy_qp_uresp()
1340 (attrs->srq != NULL)); in ocrdma_create_qp()
1541 static void ocrdma_srq_toggle_bit(struct ocrdma_srq *srq, unsigned int idx) in ocrdma_srq_toggle_bit() argument
1546 srq->idx_bit_fields[i] ^= mask; in ocrdma_srq_toggle_bit()
1608 if (is_hw_sq_empty(qp) && (!qp->srq && is_hw_rq_empty(qp))) in ocrdma_discard_cqes()
1625 if (qp->srq) { in ocrdma_discard_cqes()
1628 qp->srq->rq.max_wqe_idx; in ocrdma_discard_cqes()
1630 spin_lock_irqsave(&qp->srq->q_lock, flags); in ocrdma_discard_cqes()
1631 ocrdma_hwq_inc_tail(&qp->srq->rq); in ocrdma_discard_cqes()
1632 ocrdma_srq_toggle_bit(qp->srq, wqe_idx - 1); in ocrdma_discard_cqes()
1633 spin_unlock_irqrestore(&qp->srq->q_lock, flags); in ocrdma_discard_cqes()
1661 if (!qp->srq) { in ocrdma_del_flush_qp()
1719 if (!qp->srq) in ocrdma_destroy_qp()
1731 static int ocrdma_copy_srq_uresp(struct ocrdma_dev *dev, struct ocrdma_srq *srq, in ocrdma_copy_srq_uresp() argument
1738 uresp.rq_dbid = srq->rq.dbid; in ocrdma_copy_srq_uresp()
1740 uresp.rq_page_addr[0] = virt_to_phys(srq->rq.va); in ocrdma_copy_srq_uresp()
1741 uresp.rq_page_size = srq->rq.len; in ocrdma_copy_srq_uresp()
1743 (srq->pd->id * dev->nic_info.db_page_size); in ocrdma_copy_srq_uresp()
1745 uresp.num_rqe_allocated = srq->rq.max_cnt; in ocrdma_copy_srq_uresp()
1757 status = ocrdma_add_mmap(srq->pd->uctx, uresp.rq_page_addr[0], in ocrdma_copy_srq_uresp()
1770 struct ocrdma_srq *srq = get_ocrdma_srq(ibsrq); in ocrdma_create_srq() local
1780 spin_lock_init(&srq->q_lock); in ocrdma_create_srq()
1781 srq->pd = pd; in ocrdma_create_srq()
1782 srq->db = dev->nic_info.db + (pd->id * dev->nic_info.db_page_size); in ocrdma_create_srq()
1783 status = ocrdma_mbx_create_srq(dev, srq, init_attr, pd); in ocrdma_create_srq()
1788 srq->rqe_wr_id_tbl = kcalloc(srq->rq.max_cnt, sizeof(u64), in ocrdma_create_srq()
1790 if (!srq->rqe_wr_id_tbl) { in ocrdma_create_srq()
1795 srq->bit_fields_len = (srq->rq.max_cnt / 32) + in ocrdma_create_srq()
1796 (srq->rq.max_cnt % 32 ? 1 : 0); in ocrdma_create_srq()
1797 srq->idx_bit_fields = in ocrdma_create_srq()
1798 kmalloc_array(srq->bit_fields_len, sizeof(u32), in ocrdma_create_srq()
1800 if (!srq->idx_bit_fields) { in ocrdma_create_srq()
1804 memset(srq->idx_bit_fields, 0xff, in ocrdma_create_srq()
1805 srq->bit_fields_len * sizeof(u32)); in ocrdma_create_srq()
1809 status = ocrdma_mbx_modify_srq(srq, &init_attr->attr); in ocrdma_create_srq()
1815 status = ocrdma_copy_srq_uresp(dev, srq, udata); in ocrdma_create_srq()
1823 ocrdma_mbx_destroy_srq(dev, srq); in ocrdma_create_srq()
1824 kfree(srq->rqe_wr_id_tbl); in ocrdma_create_srq()
1825 kfree(srq->idx_bit_fields); in ocrdma_create_srq()
1835 struct ocrdma_srq *srq; in ocrdma_modify_srq() local
1837 srq = get_ocrdma_srq(ibsrq); in ocrdma_modify_srq()
1841 status = ocrdma_mbx_modify_srq(srq, srq_attr); in ocrdma_modify_srq()
1848 struct ocrdma_srq *srq; in ocrdma_query_srq() local
1850 srq = get_ocrdma_srq(ibsrq); in ocrdma_query_srq()
1851 status = 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()
2266 static int ocrdma_srq_get_idx(struct ocrdma_srq *srq) in ocrdma_srq_get_idx() argument
2271 for (row = 0; row < srq->bit_fields_len; row++) { in ocrdma_srq_get_idx()
2272 if (srq->idx_bit_fields[row]) { in ocrdma_srq_get_idx()
2273 indx = ffs(srq->idx_bit_fields[row]); in ocrdma_srq_get_idx()
2275 BUG_ON(indx >= srq->rq.max_cnt); in ocrdma_srq_get_idx()
2276 ocrdma_srq_toggle_bit(srq, indx); in ocrdma_srq_get_idx()
2281 BUG_ON(row == srq->bit_fields_len); in ocrdma_srq_get_idx()
2285 static void ocrdma_ring_srq_db(struct ocrdma_srq *srq) in ocrdma_ring_srq_db() argument
2287 u32 val = srq->rq.dbid | (1 << 16); in ocrdma_ring_srq_db()
2289 iowrite32(val, srq->db + OCRDMA_DB_GEN2_SRQ_OFFSET); in ocrdma_ring_srq_db()
2297 struct ocrdma_srq *srq; in ocrdma_post_srq_recv() local
2301 srq = get_ocrdma_srq(ibsrq); in ocrdma_post_srq_recv()
2303 spin_lock_irqsave(&srq->q_lock, flags); in ocrdma_post_srq_recv()
2305 if (ocrdma_hwq_free_cnt(&srq->rq) == 0 || in ocrdma_post_srq_recv()
2306 wr->num_sge > srq->rq.max_sges) { in ocrdma_post_srq_recv()
2311 tag = ocrdma_srq_get_idx(srq); in ocrdma_post_srq_recv()
2312 rqe = ocrdma_hwq_head(&srq->rq); in ocrdma_post_srq_recv()
2315 srq->rqe_wr_id_tbl[tag] = wr->wr_id; in ocrdma_post_srq_recv()
2319 ocrdma_ring_srq_db(srq); in ocrdma_post_srq_recv()
2321 ocrdma_hwq_inc_head(&srq->rq); in ocrdma_post_srq_recv()
2324 spin_unlock_irqrestore(&srq->q_lock, flags); in ocrdma_post_srq_recv()
2533 if (!qp->srq && (qp->sq_cq == qp->rq_cq)) { in ocrdma_poll_err_scqe()
2633 struct ocrdma_srq *srq; in ocrdma_update_free_srq_cqe() local
2636 srq = get_ocrdma_srq(qp->ibqp.srq); in ocrdma_update_free_srq_cqe()
2638 OCRDMA_CQE_BUFTAG_SHIFT) & srq->rq.max_wqe_idx; in ocrdma_update_free_srq_cqe()
2641 ibwc->wr_id = srq->rqe_wr_id_tbl[wqe_idx]; in ocrdma_update_free_srq_cqe()
2642 spin_lock_irqsave(&srq->q_lock, flags); in ocrdma_update_free_srq_cqe()
2643 ocrdma_srq_toggle_bit(srq, wqe_idx - 1); in ocrdma_update_free_srq_cqe()
2644 spin_unlock_irqrestore(&srq->q_lock, flags); in ocrdma_update_free_srq_cqe()
2645 ocrdma_hwq_inc_tail(&srq->rq); in ocrdma_update_free_srq_cqe()
2662 if (!qp->srq && (qp->sq_cq == qp->rq_cq)) { in ocrdma_poll_err_rcqe()
2709 if (qp->ibqp.srq) { in ocrdma_poll_success_rcqe()