drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c- Extension
.c- Size
- 29166 bytes
- Lines
- 1045
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/page.hlinux/io.hlinux/wait.hrdma/ib_addr.hrdma/ib_smi.hrdma/ib_user_verbs.hrdma/uverbs_ioctl.hpvrdma.h
Detected Declarations
function get_cqsfunction pvrdma_lock_cqsfunction pvrdma_unlock_cqsfunction pvrdma_reset_qpfunction pvrdma_set_rq_sizefunction pvrdma_set_sq_sizefunction pvrdma_create_qpfunction _pvrdma_free_qpfunction pvrdma_free_qpfunction _pvrdma_destroy_qp_workfunction pvrdma_destroy_qpfunction __pvrdma_destroy_qpfunction pvrdma_modify_qpfunction set_reg_segfunction pvrdma_post_sendfunction pvrdma_post_recvfunction pvrdma_query_qp
Annotated Snippet
if (!qp->is_kernel) {
dev_dbg(&dev->pdev->dev,
"create queuepair from user space\n");
ret = ib_copy_validate_udata_in(udata, ucmd, qp_addr);
if (ret)
goto err_qp;
/* Userspace supports qpn and qp handles? */
if (dev->dsr_version >= PVRDMA_QPHANDLE_VERSION &&
udata->outlen < sizeof(qp_resp)) {
dev_warn(&dev->pdev->dev,
"create queuepair not supported\n");
ret = -EOPNOTSUPP;
goto err_qp;
}
if (!is_srq) {
/* set qp->sq.wqe_cnt, shift, buf_size.. */
qp->rumem = ib_umem_get_va(ibqp->device,
ucmd.rbuf_addr,
ucmd.rbuf_size, 0);
if (IS_ERR(qp->rumem)) {
ret = PTR_ERR(qp->rumem);
goto err_qp;
}
qp->srq = NULL;
} else {
qp->rumem = NULL;
qp->srq = to_vsrq(init_attr->srq);
}
qp->sumem = ib_umem_get_va(ibqp->device, ucmd.sbuf_addr,
ucmd.sbuf_size, 0);
if (IS_ERR(qp->sumem)) {
if (!is_srq)
ib_umem_release(qp->rumem);
ret = PTR_ERR(qp->sumem);
goto err_qp;
}
qp->npages_send =
ib_umem_num_dma_blocks(qp->sumem, PAGE_SIZE);
if (!is_srq)
qp->npages_recv = ib_umem_num_dma_blocks(
qp->rumem, PAGE_SIZE);
else
qp->npages_recv = 0;
qp->npages = qp->npages_send + qp->npages_recv;
} else {
ret = pvrdma_set_sq_size(to_vdev(ibqp->device),
&init_attr->cap, qp);
if (ret)
goto err_qp;
ret = pvrdma_set_rq_size(to_vdev(ibqp->device),
&init_attr->cap, qp);
if (ret)
goto err_qp;
qp->npages = qp->npages_send + qp->npages_recv;
/* Skip header page. */
qp->sq.offset = PVRDMA_QP_NUM_HEADER_PAGES * PAGE_SIZE;
/* Recv queue pages are after send pages. */
qp->rq.offset = qp->npages_send * PAGE_SIZE;
}
if (qp->npages < 0 || qp->npages > PVRDMA_PAGE_DIR_MAX_PAGES) {
dev_warn(&dev->pdev->dev,
"overflow pages in queuepair\n");
ret = -EINVAL;
goto err_umem;
}
ret = pvrdma_page_dir_init(dev, &qp->pdir, qp->npages,
qp->is_kernel);
if (ret) {
dev_warn(&dev->pdev->dev,
"could not allocate page directory\n");
goto err_umem;
}
if (!qp->is_kernel) {
pvrdma_page_dir_insert_umem(&qp->pdir, qp->sumem, 0);
if (!is_srq)
pvrdma_page_dir_insert_umem(&qp->pdir,
qp->rumem,
qp->npages_send);
Annotation
- Immediate include surface: `asm/page.h`, `linux/io.h`, `linux/wait.h`, `rdma/ib_addr.h`, `rdma/ib_smi.h`, `rdma/ib_user_verbs.h`, `rdma/uverbs_ioctl.h`, `pvrdma.h`.
- Detected declarations: `function get_cqs`, `function pvrdma_lock_cqs`, `function pvrdma_unlock_cqs`, `function pvrdma_reset_qp`, `function pvrdma_set_rq_size`, `function pvrdma_set_sq_size`, `function pvrdma_create_qp`, `function _pvrdma_free_qp`, `function pvrdma_free_qp`, `function _pvrdma_destroy_qp_work`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.