drivers/infiniband/sw/rxe/rxe_qp.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/sw/rxe/rxe_qp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/sw/rxe/rxe_qp.c- Extension
.c- Size
- 21891 bytes
- Lines
- 926
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/skbuff.hlinux/delay.hlinux/sched.hlinux/vmalloc.hrdma/uverbs_ioctl.hrxe.hrxe_loc.hrxe_queue.hrxe_task.h
Detected Declarations
function rxe_reclassify_send_socketfunction rxe_qp_chk_capfunction rxe_qp_chk_initfunction alloc_rd_atomic_resourcesfunction free_rd_atomic_resourcesfunction free_rd_atomic_resourcefunction cleanup_rd_atomic_resourcesfunction rxe_qp_init_miscfunction rxe_init_sqfunction rxe_qp_init_reqfunction rxe_init_rqfunction rxe_qp_init_respfunction rxe_qp_from_initfunction rxe_qp_to_initfunction rxe_qp_chk_attrfunction rxe_qp_resetfunction rxe_qp_errorfunction rxe_qp_sqdfunction __qp_chk_statefunction rxe_qp_from_attrfunction rxe_qp_to_attrfunction rxe_qp_chk_destroyfunction rxe_qp_do_cleanupfunction rxe_qp_cleanup
Annotated Snippet
if (cap->max_recv_wr > rxe->attr.max_qp_wr) {
rxe_dbg_dev(rxe, "invalid recv wr = %u > %d\n",
cap->max_recv_wr, rxe->attr.max_qp_wr);
goto err1;
}
if (cap->max_recv_sge > rxe->attr.max_recv_sge) {
rxe_dbg_dev(rxe, "invalid recv sge = %u > %d\n",
cap->max_recv_sge, rxe->attr.max_recv_sge);
goto err1;
}
}
if (cap->max_inline_data > rxe->max_inline_data) {
rxe_dbg_dev(rxe, "invalid max inline data = %u > %d\n",
cap->max_inline_data, rxe->max_inline_data);
goto err1;
}
return 0;
err1:
return -EINVAL;
}
int rxe_qp_chk_init(struct rxe_dev *rxe, struct ib_qp_init_attr *init)
{
struct ib_qp_cap *cap = &init->cap;
struct rxe_port *port;
int port_num = init->port_num;
switch (init->qp_type) {
case IB_QPT_GSI:
case IB_QPT_RC:
case IB_QPT_UC:
case IB_QPT_UD:
break;
default:
return -EOPNOTSUPP;
}
if (!init->recv_cq || !init->send_cq) {
rxe_dbg_dev(rxe, "missing cq\n");
goto err1;
}
if (rxe_qp_chk_cap(rxe, cap, !!init->srq))
goto err1;
if (init->qp_type == IB_QPT_GSI) {
if (!rdma_is_port_valid(&rxe->ib_dev, port_num)) {
rxe_dbg_dev(rxe, "invalid port = %d\n", port_num);
goto err1;
}
port = &rxe->port;
if (init->qp_type == IB_QPT_GSI && port->qp_gsi_index) {
rxe_dbg_dev(rxe, "GSI QP exists for port %d\n", port_num);
goto err1;
}
}
return 0;
err1:
return -EINVAL;
}
static int alloc_rd_atomic_resources(struct rxe_qp *qp, unsigned int n)
{
qp->resp.res_head = 0;
qp->resp.res_tail = 0;
qp->resp.resources = kzalloc_objs(struct resp_res, n);
if (!qp->resp.resources)
return -ENOMEM;
return 0;
}
static void free_rd_atomic_resources(struct rxe_qp *qp)
{
if (qp->resp.resources) {
int i;
for (i = 0; i < qp->attr.max_dest_rd_atomic; i++) {
struct resp_res *res = &qp->resp.resources[i];
free_rd_atomic_resource(res);
Annotation
- Immediate include surface: `linux/skbuff.h`, `linux/delay.h`, `linux/sched.h`, `linux/vmalloc.h`, `rdma/uverbs_ioctl.h`, `rxe.h`, `rxe_loc.h`, `rxe_queue.h`.
- Detected declarations: `function rxe_reclassify_send_socket`, `function rxe_qp_chk_cap`, `function rxe_qp_chk_init`, `function alloc_rd_atomic_resources`, `function free_rd_atomic_resources`, `function free_rd_atomic_resource`, `function cleanup_rd_atomic_resources`, `function rxe_qp_init_misc`, `function rxe_init_sq`, `function rxe_qp_init_req`.
- 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.