Lines Matching refs:sq
94 static void dealloc_oc_sq(struct c4iw_rdev *rdev, struct t4_sq *sq) in dealloc_oc_sq() argument
96 c4iw_ocqp_pool_free(rdev, sq->dma_addr, sq->memsize); in dealloc_oc_sq()
99 static void dealloc_host_sq(struct c4iw_rdev *rdev, struct t4_sq *sq) in dealloc_host_sq() argument
101 dma_free_coherent(&(rdev->lldi.pdev->dev), sq->memsize, sq->queue, in dealloc_host_sq()
102 pci_unmap_addr(sq, mapping)); in dealloc_host_sq()
105 static void dealloc_sq(struct c4iw_rdev *rdev, struct t4_sq *sq) in dealloc_sq() argument
107 if (t4_sq_onchip(sq)) in dealloc_sq()
108 dealloc_oc_sq(rdev, sq); in dealloc_sq()
110 dealloc_host_sq(rdev, sq); in dealloc_sq()
113 static int alloc_oc_sq(struct c4iw_rdev *rdev, struct t4_sq *sq) in alloc_oc_sq() argument
117 sq->dma_addr = c4iw_ocqp_pool_alloc(rdev, sq->memsize); in alloc_oc_sq()
118 if (!sq->dma_addr) in alloc_oc_sq()
120 sq->phys_addr = rdev->oc_mw_pa + sq->dma_addr - in alloc_oc_sq()
122 sq->queue = (__force union t4_wr *)(rdev->oc_mw_kva + sq->dma_addr - in alloc_oc_sq()
124 sq->flags |= T4_SQ_ONCHIP; in alloc_oc_sq()
128 static int alloc_host_sq(struct c4iw_rdev *rdev, struct t4_sq *sq) in alloc_host_sq() argument
130 sq->queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev), sq->memsize, in alloc_host_sq()
131 &(sq->dma_addr), GFP_KERNEL); in alloc_host_sq()
132 if (!sq->queue) in alloc_host_sq()
134 sq->phys_addr = virt_to_phys(sq->queue); in alloc_host_sq()
135 pci_unmap_addr_set(sq, mapping, sq->dma_addr); in alloc_host_sq()
139 static int alloc_sq(struct c4iw_rdev *rdev, struct t4_sq *sq, int user) in alloc_sq() argument
143 ret = alloc_oc_sq(rdev, sq); in alloc_sq()
145 ret = alloc_host_sq(rdev, sq); in alloc_sq()
159 dealloc_sq(rdev, &wq->sq); in destroy_qp()
162 kfree(wq->sq.sw_sq); in destroy_qp()
164 c4iw_put_qpid(rdev, wq->sq.qid, uctx); in destroy_qp()
208 wq->sq.qid = c4iw_get_qpid(rdev, uctx); in create_qp()
209 if (!wq->sq.qid) in create_qp()
219 wq->sq.sw_sq = kzalloc(wq->sq.size * sizeof *wq->sq.sw_sq, in create_qp()
221 if (!wq->sq.sw_sq) { in create_qp()
244 ret = alloc_sq(rdev, &wq->sq, user); in create_qp()
247 memset(wq->sq.queue, 0, wq->sq.memsize); in create_qp()
248 dma_unmap_addr_set(&wq->sq, mapping, wq->sq.dma_addr); in create_qp()
258 __func__, wq->sq.queue, in create_qp()
259 (unsigned long long)virt_to_phys(wq->sq.queue), in create_qp()
267 wq->sq.bar2_va = c4iw_bar2_addrs(rdev, wq->sq.qid, T4_BAR2_QTYPE_EGRESS, in create_qp()
268 &wq->sq.bar2_qid, in create_qp()
269 user ? &wq->sq.bar2_pa : NULL); in create_qp()
277 if (user && (!wq->sq.bar2_pa || !wq->rq.bar2_pa)) { in create_qp()
279 pci_name(rdev->lldi.pdev), wq->sq.qid, wq->rq.qid); in create_qp()
312 eqsize = wq->sq.size * T4_SQ_NUM_SLOTS + in create_qp()
319 (t4_sq_onchip(&wq->sq) ? FW_RI_RES_WR_ONCHIP_F : 0) | in create_qp()
329 res->u.sqrq.eqid = cpu_to_be32(wq->sq.qid); in create_qp()
330 res->u.sqrq.eqaddr = cpu_to_be64(wq->sq.dma_addr); in create_qp()
361 ret = c4iw_wait_for_reply(rdev, &wr_wait, 0, wq->sq.qid, __func__); in create_qp()
366 __func__, wq->sq.qid, wq->rq.qid, wq->db, in create_qp()
367 wq->sq.bar2_va, wq->rq.bar2_va); in create_qp()
375 dealloc_sq(rdev, &wq->sq); in create_qp()
381 kfree(wq->sq.sw_sq); in create_qp()
385 c4iw_put_qpid(rdev, wq->sq.qid, uctx); in create_qp()
389 static int build_immd(struct t4_sq *sq, struct fw_ri_immd *immdp, in build_immd() argument
405 if (dstp == (u8 *)&sq->queue[sq->size]) in build_immd()
406 dstp = (u8 *)sq->queue; in build_immd()
407 if (rem <= (u8 *)&sq->queue[sq->size] - dstp) in build_immd()
410 len = (u8 *)&sq->queue[sq->size] - dstp; in build_immd()
459 static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, in build_rdma_send() argument
497 ret = build_immd(sq, wqe->send.u.immd_src, wr, in build_rdma_send()
504 ret = build_isgl((__be64 *)sq->queue, in build_rdma_send()
505 (__be64 *)&sq->queue[sq->size], in build_rdma_send()
526 static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe, in build_rdma_write() argument
540 ret = build_immd(sq, wqe->write.u.immd_src, wr, in build_rdma_write()
547 ret = build_isgl((__be64 *)sq->queue, in build_rdma_write()
548 (__be64 *)&sq->queue[sq->size], in build_rdma_write()
613 static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, in build_memreg() argument
662 if (++p == (__be64 *)&sq->queue[sq->size]) in build_memreg()
663 p = (__be64 *)sq->queue; in build_memreg()
669 if (++p == (__be64 *)&sq->queue[sq->size]) in build_memreg()
670 p = (__be64 *)sq->queue; in build_memreg()
716 qhp->wq.sq.wq_pidx_inc += inc; in ring_kernel_sq_db()
771 wqe = (union t4_wr *)((u8 *)qhp->wq.sq.queue + in c4iw_post_send()
772 qhp->wq.sq.wq_pidx * T4_EQ_ENTRY_SIZE); in c4iw_post_send()
779 swsqe = &qhp->wq.sq.sw_sq[qhp->wq.sq.pidx]; in c4iw_post_send()
790 err = build_rdma_send(&qhp->wq.sq, wqe, wr, &len16); in c4iw_post_send()
795 err = build_rdma_write(&qhp->wq.sq, wqe, wr, &len16); in c4iw_post_send()
809 if (!qhp->wq.sq.oldest_read) in c4iw_post_send()
810 qhp->wq.sq.oldest_read = swsqe; in c4iw_post_send()
815 err = build_memreg(&qhp->wq.sq, wqe, reg_wr(wr), &len16, in c4iw_post_send()
836 swsqe->idx = qhp->wq.sq.pidx; in c4iw_post_send()
848 init_wr_hdr(wqe, qhp->wq.sq.pidx, fw_opcode, fw_flags, len16); in c4iw_post_send()
851 __func__, (unsigned long long)wr->wr_id, qhp->wq.sq.pidx, in c4iw_post_send()
1089 PDBG("%s qhp %p qid 0x%x tid %u\n", __func__, qhp, qhp->wq.sq.qid, in post_terminate()
1216 PDBG("%s qhp %p qid 0x%x tid %u\n", __func__, qhp, qhp->wq.sq.qid, in rdma_fini()
1240 qhp->wq.sq.qid, __func__); in rdma_fini()
1278 qhp->wq.sq.qid, qhp->ep->hwtid, qhp->ep->ird, qhp->ep->ord); in rdma_init()
1324 wqe->u.init.qpid = cpu_to_be32(qhp->wq.sq.qid); in rdma_init()
1325 wqe->u.init.sq_eqid = cpu_to_be32(qhp->wq.sq.qid); in rdma_init()
1344 qhp->ep->hwtid, qhp->wq.sq.qid, __func__); in rdma_init()
1368 qhp, qhp->wq.sq.qid, qhp->wq.rq.qid, qhp->ep, qhp->attr.state, in c4iw_modify_qp()
1551 qhp->wq.sq.qid); in c4iw_modify_qp()
1608 remove_handle(rhp, &rhp->qpidr, qhp->wq.sq.qid); in c4iw_destroy_qp()
1623 PDBG("%s ib_qp %p qpid 0x%0x\n", __func__, ib_qp, qhp->wq.sq.qid); in c4iw_destroy_qp()
1674 qhp->wq.sq.size = sqsize; in c4iw_create_qp()
1675 qhp->wq.sq.memsize = in c4iw_create_qp()
1677 sizeof(*qhp->wq.sq.queue) + 16 * sizeof(__be64); in c4iw_create_qp()
1678 qhp->wq.sq.flush_cidx = -1; in c4iw_create_qp()
1685 qhp->wq.sq.memsize = roundup(qhp->wq.sq.memsize, PAGE_SIZE); in c4iw_create_qp()
1720 ret = insert_handle(rhp, &rhp->qpidr, qhp, qhp->wq.sq.qid); in c4iw_create_qp()
1745 if (t4_sq_onchip(&qhp->wq.sq)) { in c4iw_create_qp()
1755 uresp.sqid = qhp->wq.sq.qid; in c4iw_create_qp()
1756 uresp.sq_size = qhp->wq.sq.size; in c4iw_create_qp()
1757 uresp.sq_memsize = qhp->wq.sq.memsize; in c4iw_create_qp()
1781 mm1->addr = qhp->wq.sq.phys_addr; in c4iw_create_qp()
1782 mm1->len = PAGE_ALIGN(qhp->wq.sq.memsize); in c4iw_create_qp()
1789 mm3->addr = (__force unsigned long)qhp->wq.sq.bar2_pa; in c4iw_create_qp()
1804 qhp->ibqp.qp_num = qhp->wq.sq.qid; in c4iw_create_qp()
1809 qhp->wq.sq.qid, qhp->wq.sq.size, qhp->wq.sq.memsize, in c4iw_create_qp()
1824 remove_handle(rhp, &rhp->qpidr, qhp->wq.sq.qid); in c4iw_create_qp()