drivers/infiniband/hw/mthca/mthca_provider.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/mthca/mthca_provider.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/mthca/mthca_provider.c- Extension
.c- Size
- 30627 bytes
- Lines
- 1208
- 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
rdma/ib_smi.hrdma/ib_user_verbs.hrdma/iter.hrdma/uverbs_ioctl.hlinux/sched.hlinux/slab.hlinux/stat.hlinux/mm.hlinux/export.hmthca_dev.hmthca_cmd.hrdma/mthca-abi.hmthca_memfree.h
Detected Declarations
function Copyrightfunction mthca_query_portfunction mthca_modify_devicefunction mthca_modify_portfunction mthca_query_pkeyfunction mthca_query_gidfunction mthca_alloc_ucontextfunction mthca_dealloc_ucontextfunction mthca_mmap_uarfunction mthca_alloc_pdfunction mthca_dealloc_pdfunction mthca_ah_createfunction mthca_ah_destroyfunction mthca_create_srqfunction mthca_destroy_srqfunction mthca_create_qpfunction mthca_destroy_qpfunction mthca_create_cqfunction mthca_alloc_resize_buffunction mthca_resize_cqfunction mthca_destroy_cqfunction convert_accessfunction rdma_umem_for_each_dma_blockfunction mthca_dereg_mrfunction hw_rev_showfunction hca_type_showfunction board_id_showfunction mthca_init_node_datafunction mthca_port_immutablefunction get_dev_fw_strfunction mthca_register_devicefunction mthca_unregister_device
Annotated Snippet
if (err) {
mthca_pd_free(to_mdev(ibdev), pd);
return err;
}
}
return 0;
}
static int mthca_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata)
{
mthca_pd_free(to_mdev(pd->device), to_mpd(pd));
return 0;
}
static int mthca_ah_create(struct ib_ah *ibah,
struct rdma_ah_init_attr *init_attr,
struct ib_udata *udata)
{
struct mthca_ah *ah = to_mah(ibah);
return mthca_create_ah(to_mdev(ibah->device), to_mpd(ibah->pd),
init_attr->ah_attr, ah);
}
static int mthca_ah_destroy(struct ib_ah *ah, u32 flags)
{
mthca_destroy_ah(to_mdev(ah->device), to_mah(ah));
return 0;
}
static int mthca_create_srq(struct ib_srq *ibsrq,
struct ib_srq_init_attr *init_attr,
struct ib_udata *udata)
{
struct mthca_create_srq ucmd;
struct mthca_ucontext *context = rdma_udata_to_drv_context(
udata, struct mthca_ucontext, ibucontext);
struct mthca_srq *srq = to_msrq(ibsrq);
int err;
if (init_attr->srq_type != IB_SRQT_BASIC)
return -EOPNOTSUPP;
if (udata) {
err = ib_copy_validate_udata_in(udata, ucmd, db_page);
if (err)
return err;
err = mthca_map_user_db(to_mdev(ibsrq->device), &context->uar,
context->db_tab, ucmd.db_index,
ucmd.db_page);
if (err)
return err;
srq->mr.ibmr.lkey = ucmd.lkey;
srq->db_index = ucmd.db_index;
}
err = mthca_alloc_srq(to_mdev(ibsrq->device), to_mpd(ibsrq->pd),
&init_attr->attr, srq, udata);
if (err && udata)
mthca_unmap_user_db(to_mdev(ibsrq->device), &context->uar,
context->db_tab, ucmd.db_index);
if (err)
return err;
if (context) {
struct mthca_create_srq_resp uresp = { .srqn = srq->srqn };
err = ib_respond_udata(udata, uresp);
if (err) {
mthca_free_srq(to_mdev(ibsrq->device), srq);
mthca_unmap_user_db(to_mdev(ibsrq->device),
&context->uar, context->db_tab,
ucmd.db_index);
return err;
}
}
return 0;
}
static int mthca_destroy_srq(struct ib_srq *srq, struct ib_udata *udata)
{
mthca_free_srq(to_mdev(srq->device), to_msrq(srq));
Annotation
- Immediate include surface: `rdma/ib_smi.h`, `rdma/ib_user_verbs.h`, `rdma/iter.h`, `rdma/uverbs_ioctl.h`, `linux/sched.h`, `linux/slab.h`, `linux/stat.h`, `linux/mm.h`.
- Detected declarations: `function Copyright`, `function mthca_query_port`, `function mthca_modify_device`, `function mthca_modify_port`, `function mthca_query_pkey`, `function mthca_query_gid`, `function mthca_alloc_ucontext`, `function mthca_dealloc_ucontext`, `function mthca_mmap_uar`, `function mthca_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.
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.