drivers/infiniband/hw/qedr/verbs.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/qedr/verbs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/qedr/verbs.c- Extension
.c- Size
- 121641 bytes
- Lines
- 4460
- 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
linux/dma-mapping.hlinux/crc32.hnet/ip.hnet/ipv6.hnet/udp.hlinux/iommu.hrdma/ib_verbs.hrdma/ib_user_verbs.hrdma/iw_cm.hrdma/ib_addr.hrdma/ib_cache.hrdma/iter.hrdma/uverbs_ioctl.hlinux/qed/common_hsi.hqedr_hsi_rdma.hlinux/qed/qed_if.hqedr.hverbs.hrdma/qedr-abi.hqedr_roce_cm.hqedr_iw_cm.h
Detected Declarations
function qedr_query_pkeyfunction qedr_iw_query_gidfunction qedr_query_srqfunction qedr_query_devicefunction get_link_speed_and_widthfunction qedr_query_portfunction qedr_alloc_ucontextfunction qedr_dealloc_ucontextfunction qedr_mmap_freefunction qedr_mmapfunction qedr_alloc_pdfunction qedr_dealloc_pdfunction qedr_alloc_xrcdfunction qedr_dealloc_xrcdfunction qedr_free_pblfunction qedr_prepare_pbl_tblfunction qedr_populate_pblsfunction rdma_umem_for_each_dma_blockfunction qedr_db_recovery_addfunction qedr_db_recovery_delfunction qedr_copy_cq_urespfunction consume_cqefunction qedr_align_cq_entriesfunction qedr_init_user_db_recfunction qedr_init_user_queuefunction qedr_init_cq_paramsfunction doorbell_cqfunction qedr_arm_cqfunction qedr_create_cqfunction qedr_destroy_cqfunction get_gid_info_from_tablefunction qedr_check_qp_attrsfunction qedr_copy_srq_urespfunction qedr_copy_rq_urespfunction qedr_copy_sq_urespfunction qedr_copy_qp_urespfunction qedr_reset_qp_hwq_infofunction qedr_set_common_qp_paramsfunction qedr_set_roce_db_infofunction qedr_check_srq_paramsfunction qedr_free_srq_user_paramsfunction qedr_free_srq_kernel_paramsfunction qedr_init_srq_user_paramsfunction qedr_alloc_srq_kernel_paramsfunction qedr_create_srqfunction qedr_destroy_srqfunction qedr_modify_srqfunction qedr_ib_to_qed_qp_type
Annotated Snippet
if (rc) {
dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd_id);
return rc;
}
pd->uctx = context;
pd->uctx->pd = pd;
}
return 0;
}
int qedr_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
{
struct qedr_dev *dev = get_qedr_dev(ibpd->device);
struct qedr_pd *pd = get_qedr_pd(ibpd);
DP_DEBUG(dev, QEDR_MSG_INIT, "Deallocating PD %d\n", pd->pd_id);
dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd->pd_id);
return 0;
}
int qedr_alloc_xrcd(struct ib_xrcd *ibxrcd, struct ib_udata *udata)
{
struct qedr_dev *dev = get_qedr_dev(ibxrcd->device);
struct qedr_xrcd *xrcd = get_qedr_xrcd(ibxrcd);
return dev->ops->rdma_alloc_xrcd(dev->rdma_ctx, &xrcd->xrcd_id);
}
int qedr_dealloc_xrcd(struct ib_xrcd *ibxrcd, struct ib_udata *udata)
{
struct qedr_dev *dev = get_qedr_dev(ibxrcd->device);
u16 xrcd_id = get_qedr_xrcd(ibxrcd)->xrcd_id;
dev->ops->rdma_dealloc_xrcd(dev->rdma_ctx, xrcd_id);
return 0;
}
static void qedr_free_pbl(struct qedr_dev *dev,
struct qedr_pbl_info *pbl_info, struct qedr_pbl *pbl)
{
struct pci_dev *pdev = dev->pdev;
int i;
for (i = 0; i < pbl_info->num_pbls; i++) {
if (!pbl[i].va)
continue;
dma_free_coherent(&pdev->dev, pbl_info->pbl_size,
pbl[i].va, pbl[i].pa);
}
kfree(pbl);
}
#define MIN_FW_PBL_PAGE_SIZE (4 * 1024)
#define MAX_FW_PBL_PAGE_SIZE (64 * 1024)
#define NUM_PBES_ON_PAGE(_page_size) (_page_size / sizeof(u64))
#define MAX_PBES_ON_PAGE NUM_PBES_ON_PAGE(MAX_FW_PBL_PAGE_SIZE)
#define MAX_PBES_TWO_LAYER (MAX_PBES_ON_PAGE * MAX_PBES_ON_PAGE)
static struct qedr_pbl *qedr_alloc_pbl_tbl(struct qedr_dev *dev,
struct qedr_pbl_info *pbl_info,
gfp_t flags)
{
struct pci_dev *pdev = dev->pdev;
struct qedr_pbl *pbl_table;
dma_addr_t *pbl_main_tbl;
dma_addr_t pa;
void *va;
int i;
pbl_table = kzalloc_objs(*pbl_table, pbl_info->num_pbls, flags);
if (!pbl_table)
return ERR_PTR(-ENOMEM);
for (i = 0; i < pbl_info->num_pbls; i++) {
va = dma_alloc_coherent(&pdev->dev, pbl_info->pbl_size, &pa,
flags);
if (!va)
goto err;
pbl_table[i].va = va;
pbl_table[i].pa = pa;
}
/* Two-Layer PBLs, if we have more than one pbl we need to initialize
* the first one with physical pointers to all of the rest
*/
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/crc32.h`, `net/ip.h`, `net/ipv6.h`, `net/udp.h`, `linux/iommu.h`, `rdma/ib_verbs.h`, `rdma/ib_user_verbs.h`.
- Detected declarations: `function qedr_query_pkey`, `function qedr_iw_query_gid`, `function qedr_query_srq`, `function qedr_query_device`, `function get_link_speed_and_width`, `function qedr_query_port`, `function qedr_alloc_ucontext`, `function qedr_dealloc_ucontext`, `function qedr_mmap_free`, `function qedr_mmap`.
- 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.