drivers/infiniband/hw/irdma/verbs.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/irdma/verbs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/irdma/verbs.c- Extension
.c- Size
- 156757 bytes
- Lines
- 5598
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
main.h
Detected Declarations
function irdma_query_devicefunction irdma_query_portfunction irdma_disassociate_ucontextfunction irdma_mmap_freefunction irdma_user_mmap_entry_insertfunction irdma_mmapfunction irdma_alloc_push_pagefunction irdma_alloc_ucontextfunction irdma_dealloc_ucontextfunction irdma_alloc_pdfunction irdma_dealloc_pdfunction list_for_each_entryfunction irdma_clean_cqesfunction irdma_remove_push_mmap_entriesfunction irdma_setup_push_mmap_entriesfunction irdma_destroy_qpfunction irdma_setup_virt_qpfunction irdma_setup_umode_qpfunction irdma_setup_kmode_qpfunction irdma_cqp_create_qp_cmdfunction irdma_roce_fill_and_set_qpctx_infofunction irdma_iw_fill_and_set_qpctx_infofunction irdma_validate_qp_attrsfunction irdma_flush_workerfunction irdma_setup_gsi_qp_rsrcfunction irdma_create_qpfunction irdma_get_ib_acc_flagsfunction irdma_query_qpfunction irdma_query_pkeyfunction irdma_roce_get_vlan_priofunction irdma_wait_for_suspendfunction irdma_modify_qp_rocefunction irdma_modify_qpfunction irdma_srq_free_rsrcfunction irdma_cq_free_rsrcfunction irdma_free_cqbuffunction irdma_process_resize_listfunction list_for_each_safefunction irdma_destroy_srqfunction irdma_destroy_cqfunction irdma_resize_cqfunction irdma_srq_eventfunction irdma_modify_srqfunction irdma_setup_umode_srqfunction irdma_setup_kmode_srqfunction irdma_create_srqfunction irdma_query_srqfunction cq_validate_flags
Annotated Snippet
if (ret) {
rdma_user_mmap_entry_remove(ucontext->db_mmap_entry);
return ret;
}
}
INIT_LIST_HEAD(&ucontext->cq_reg_mem_list);
spin_lock_init(&ucontext->cq_reg_mem_list_lock);
INIT_LIST_HEAD(&ucontext->qp_reg_mem_list);
spin_lock_init(&ucontext->qp_reg_mem_list_lock);
INIT_LIST_HEAD(&ucontext->srq_reg_mem_list);
spin_lock_init(&ucontext->srq_reg_mem_list_lock);
return 0;
ver_error:
ibdev_err(&iwdev->ibdev,
"Invalid userspace driver version detected. Detected version %d, should be %d\n",
req.userspace_ver, IRDMA_ABI_VER);
return -EINVAL;
}
/**
* irdma_dealloc_ucontext - deallocate the user context data structure
* @context: user context created during alloc
*/
static void irdma_dealloc_ucontext(struct ib_ucontext *context)
{
struct irdma_ucontext *ucontext = to_ucontext(context);
rdma_user_mmap_entry_remove(ucontext->db_mmap_entry);
}
/**
* irdma_alloc_pd - allocate protection domain
* @pd: PD pointer
* @udata: user data
*/
static int irdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata)
{
#define IRDMA_ALLOC_PD_MIN_RESP_LEN offsetofend(struct irdma_alloc_pd_resp, rsvd)
struct irdma_pd *iwpd = to_iwpd(pd);
struct irdma_device *iwdev = to_iwdev(pd->device);
struct irdma_sc_dev *dev = &iwdev->rf->sc_dev;
struct irdma_pci_f *rf = iwdev->rf;
struct irdma_alloc_pd_resp uresp = {};
struct irdma_sc_pd *sc_pd;
u32 pd_id = 0;
int err;
if (udata && udata->outlen < IRDMA_ALLOC_PD_MIN_RESP_LEN)
return -EINVAL;
err = irdma_alloc_rsrc(rf, rf->allocated_pds, rf->max_pd, &pd_id,
&rf->next_pd);
if (err)
return err;
sc_pd = &iwpd->sc_pd;
if (udata) {
struct irdma_ucontext *ucontext =
rdma_udata_to_drv_context(udata, struct irdma_ucontext,
ibucontext);
irdma_sc_pd_init(dev, sc_pd, pd_id, ucontext->abi_ver);
uresp.pd_id = pd_id;
err = ib_respond_udata(udata, uresp);
if (err)
goto error;
} else {
irdma_sc_pd_init(dev, sc_pd, pd_id, IRDMA_ABI_VER);
}
return 0;
error:
irdma_free_rsrc(rf, rf->allocated_pds, pd_id);
return err;
}
/**
* irdma_dealloc_pd - deallocate pd
* @ibpd: ptr of pd to be deallocated
* @udata: user data
*/
static int irdma_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
{
struct irdma_pd *iwpd = to_iwpd(ibpd);
struct irdma_device *iwdev = to_iwdev(ibpd->device);
irdma_free_rsrc(iwdev->rf, iwdev->rf->allocated_pds, iwpd->sc_pd.pd_id);
Annotation
- Immediate include surface: `main.h`.
- Detected declarations: `function irdma_query_device`, `function irdma_query_port`, `function irdma_disassociate_ucontext`, `function irdma_mmap_free`, `function irdma_user_mmap_entry_insert`, `function irdma_mmap`, `function irdma_alloc_push_page`, `function irdma_alloc_ucontext`, `function irdma_dealloc_ucontext`, `function irdma_alloc_pd`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.