Lines Matching refs:srq
55 static void bnxt_qplib_arm_srq(struct bnxt_qplib_srq *srq, u32 arm_type);
80 if (!qp->srq) { in __bnxt_qplib_add_flush_qp()
128 if (!qp->srq) { in __bnxt_qplib_del_flush_qp()
482 static void bnxt_qplib_arm_srq(struct bnxt_qplib_srq *srq, u32 arm_type) in bnxt_qplib_arm_srq() argument
484 struct bnxt_qplib_hwq *srq_hwq = &srq->hwq; in bnxt_qplib_arm_srq()
490 sw_prod = (arm_type == DBR_DBR_TYPE_SRQ_ARM) ? srq->threshold : in bnxt_qplib_arm_srq()
494 db_msg.type_xid = cpu_to_le32(((srq->id << DBR_DBR_XID_SFT) & in bnxt_qplib_arm_srq()
497 srq->dbr_base : srq->dpi->dbr; in bnxt_qplib_arm_srq()
503 struct bnxt_qplib_srq *srq) in bnxt_qplib_destroy_srq() argument
514 req.srq_cid = cpu_to_le32(srq->id); in bnxt_qplib_destroy_srq()
521 bnxt_qplib_free_hwq(res->pdev, &srq->hwq); in bnxt_qplib_destroy_srq()
522 kfree(srq->swq); in bnxt_qplib_destroy_srq()
527 struct bnxt_qplib_srq *srq) in bnxt_qplib_create_srq() argument
536 srq->hwq.max_elements = srq->max_wqe; in bnxt_qplib_create_srq()
537 rc = bnxt_qplib_alloc_init_hwq(res->pdev, &srq->hwq, srq->sglist, in bnxt_qplib_create_srq()
538 srq->nmap, &srq->hwq.max_elements, in bnxt_qplib_create_srq()
544 srq->swq = kcalloc(srq->hwq.max_elements, sizeof(*srq->swq), in bnxt_qplib_create_srq()
546 if (!srq->swq) { in bnxt_qplib_create_srq()
554 req.dpi = cpu_to_le32(srq->dpi->dpi); in bnxt_qplib_create_srq()
555 req.srq_handle = cpu_to_le64((uintptr_t)srq); in bnxt_qplib_create_srq()
557 req.srq_size = cpu_to_le16((u16)srq->hwq.max_elements); in bnxt_qplib_create_srq()
558 pbl = &srq->hwq.pbl[PBL_LVL_0]; in bnxt_qplib_create_srq()
559 req.pg_size_lvl = cpu_to_le16((((u16)srq->hwq.level & in bnxt_qplib_create_srq()
576 req.pd_id = cpu_to_le32(srq->pd->id); in bnxt_qplib_create_srq()
577 req.eventq_id = cpu_to_le16(srq->eventq_hw_ring_id); in bnxt_qplib_create_srq()
584 spin_lock_init(&srq->lock); in bnxt_qplib_create_srq()
585 srq->start_idx = 0; in bnxt_qplib_create_srq()
586 srq->last_idx = srq->hwq.max_elements - 1; in bnxt_qplib_create_srq()
587 for (idx = 0; idx < srq->hwq.max_elements; idx++) in bnxt_qplib_create_srq()
588 srq->swq[idx].next_idx = idx + 1; in bnxt_qplib_create_srq()
589 srq->swq[srq->last_idx].next_idx = -1; in bnxt_qplib_create_srq()
591 srq->id = le32_to_cpu(resp.xid); in bnxt_qplib_create_srq()
592 srq->dbr_base = res->dpi_tbl.dbr_bar_reg_iomem; in bnxt_qplib_create_srq()
593 if (srq->threshold) in bnxt_qplib_create_srq()
594 bnxt_qplib_arm_srq(srq, DBR_DBR_TYPE_SRQ_ARMENA); in bnxt_qplib_create_srq()
595 srq->arm_req = false; in bnxt_qplib_create_srq()
599 bnxt_qplib_free_hwq(res->pdev, &srq->hwq); in bnxt_qplib_create_srq()
600 kfree(srq->swq); in bnxt_qplib_create_srq()
606 struct bnxt_qplib_srq *srq) in bnxt_qplib_modify_srq() argument
608 struct bnxt_qplib_hwq *srq_hwq = &srq->hwq; in bnxt_qplib_modify_srq()
616 if (count > srq->threshold) { in bnxt_qplib_modify_srq()
617 srq->arm_req = false; in bnxt_qplib_modify_srq()
618 bnxt_qplib_arm_srq(srq, DBR_DBR_TYPE_SRQ_ARM); in bnxt_qplib_modify_srq()
621 srq->arm_req = true; in bnxt_qplib_modify_srq()
628 struct bnxt_qplib_srq *srq) in bnxt_qplib_query_srq() argument
639 req.srq_cid = cpu_to_le32(srq->id); in bnxt_qplib_query_srq()
648 srq->threshold = le16_to_cpu(sb->srq_limit); in bnxt_qplib_query_srq()
654 int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq, in bnxt_qplib_post_srq_recv() argument
657 struct bnxt_qplib_hwq *srq_hwq = &srq->hwq; in bnxt_qplib_post_srq_recv()
664 if (srq->start_idx == srq->last_idx) { in bnxt_qplib_post_srq_recv()
666 srq->id); in bnxt_qplib_post_srq_recv()
671 next = srq->start_idx; in bnxt_qplib_post_srq_recv()
672 srq->start_idx = srq->swq[next].next_idx; in bnxt_qplib_post_srq_recv()
691 srq->swq[next].wr_id = wqe->wr_id; in bnxt_qplib_post_srq_recv()
706 bnxt_qplib_arm_srq(srq, DBR_DBR_TYPE_SRQ); in bnxt_qplib_post_srq_recv()
707 if (srq->arm_req == true && count > srq->threshold) { in bnxt_qplib_post_srq_recv()
708 srq->arm_req = false; in bnxt_qplib_post_srq_recv()
709 bnxt_qplib_arm_srq(srq, DBR_DBR_TYPE_SRQ_ARM); in bnxt_qplib_post_srq_recv()
985 if (qp->srq) { in bnxt_qplib_create_qp()
987 req.srq_cid = cpu_to_le32(qp->srq->id); in bnxt_qplib_create_qp()
2308 static void bnxt_qplib_release_srqe(struct bnxt_qplib_srq *srq, u32 tag) in bnxt_qplib_release_srqe() argument
2310 spin_lock(&srq->hwq.lock); in bnxt_qplib_release_srqe()
2311 srq->swq[srq->last_idx].next_idx = (int)tag; in bnxt_qplib_release_srqe()
2312 srq->last_idx = (int)tag; in bnxt_qplib_release_srqe()
2313 srq->swq[srq->last_idx].next_idx = -1; in bnxt_qplib_release_srqe()
2314 srq->hwq.cons++; /* Support for SRQE counter */ in bnxt_qplib_release_srqe()
2315 spin_unlock(&srq->hwq.lock); in bnxt_qplib_release_srqe()
2325 struct bnxt_qplib_srq *srq; in bnxt_qplib_cq_process_res_rc() local
2354 srq = qp->srq; in bnxt_qplib_cq_process_res_rc()
2355 if (!srq) in bnxt_qplib_cq_process_res_rc()
2357 if (wr_id_idx >= srq->hwq.max_elements) { in bnxt_qplib_cq_process_res_rc()
2362 wr_id_idx, srq->hwq.max_elements); in bnxt_qplib_cq_process_res_rc()
2365 cqe->wr_id = srq->swq[wr_id_idx].wr_id; in bnxt_qplib_cq_process_res_rc()
2366 bnxt_qplib_release_srqe(srq, wr_id_idx); in bnxt_qplib_cq_process_res_rc()
2404 struct bnxt_qplib_srq *srq; in bnxt_qplib_cq_process_res_ud() local
2436 srq = qp->srq; in bnxt_qplib_cq_process_res_ud()
2437 if (!srq) in bnxt_qplib_cq_process_res_ud()
2440 if (wr_id_idx >= srq->hwq.max_elements) { in bnxt_qplib_cq_process_res_ud()
2445 wr_id_idx, srq->hwq.max_elements); in bnxt_qplib_cq_process_res_ud()
2448 cqe->wr_id = srq->swq[wr_id_idx].wr_id; in bnxt_qplib_cq_process_res_ud()
2449 bnxt_qplib_release_srqe(srq, wr_id_idx); in bnxt_qplib_cq_process_res_ud()
2503 struct bnxt_qplib_srq *srq; in bnxt_qplib_cq_process_res_raweth_qp1() local
2543 srq = qp->srq; in bnxt_qplib_cq_process_res_raweth_qp1()
2544 if (!srq) { in bnxt_qplib_cq_process_res_raweth_qp1()
2549 if (wr_id_idx >= srq->hwq.max_elements) { in bnxt_qplib_cq_process_res_raweth_qp1()
2554 wr_id_idx, srq->hwq.max_elements); in bnxt_qplib_cq_process_res_raweth_qp1()
2557 cqe->wr_id = srq->swq[wr_id_idx].wr_id; in bnxt_qplib_cq_process_res_raweth_qp1()
2558 bnxt_qplib_release_srqe(srq, wr_id_idx); in bnxt_qplib_cq_process_res_raweth_qp1()