drivers/infiniband/sw/rdmavt/vt.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/sw/rdmavt/vt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/sw/rdmavt/vt.c- Extension
.c- Size
- 15376 bytes
- Lines
- 631
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/kernel.hlinux/dma-mapping.hrdma/uverbs_ioctl.hvt.hcq.htrace.h
Detected Declarations
function rvt_initfunction rvt_cleanupfunction rvt_alloc_devicefunction rvt_query_devicefunction rvt_get_numa_nodefunction rvt_modify_devicefunction rvt_query_portfunction rvt_modify_portfunction rvt_query_pkeyfunction rvt_query_gidfunction rvt_alloc_ucontextfunction rvt_dealloc_ucontextfunction rvt_get_port_immutablefunction check_supportfunction rvt_register_devicefunction rvt_unregister_devicefunction rvt_init_portmodule init rvt_initexport rvt_alloc_deviceexport rvt_dealloc_deviceexport rvt_register_deviceexport rvt_unregister_deviceexport rvt_init_port
Annotated Snippet
module_init(rvt_init);
static void __exit rvt_cleanup(void)
{
rvt_cq_exit();
}
module_exit(rvt_cleanup);
/**
* rvt_alloc_device - allocate rdi
* @size: how big of a structure to allocate
* @nports: number of ports to allocate array slots for
*
* Use IB core device alloc to allocate space for the rdi which is assumed to be
* inside of the ib_device. Any extra space that drivers require should be
* included in size.
*
* We also allocate a port array based on the number of ports.
*
* Return: pointer to allocated rdi
*/
struct rvt_dev_info *rvt_alloc_device(size_t size, int nports)
{
struct rvt_dev_info *rdi;
rdi = container_of(_ib_alloc_device(size, &init_net), struct rvt_dev_info, ibdev);
if (!rdi)
return rdi;
rdi->ports = kzalloc_objs(*rdi->ports, nports);
if (!rdi->ports)
ib_dealloc_device(&rdi->ibdev);
return rdi;
}
EXPORT_SYMBOL(rvt_alloc_device);
/**
* rvt_dealloc_device - deallocate rdi
* @rdi: structure to free
*
* Free a structure allocated with rvt_alloc_device()
*/
void rvt_dealloc_device(struct rvt_dev_info *rdi)
{
kfree(rdi->ports);
ib_dealloc_device(&rdi->ibdev);
}
EXPORT_SYMBOL(rvt_dealloc_device);
static int rvt_query_device(struct ib_device *ibdev,
struct ib_device_attr *props,
struct ib_udata *uhw)
{
struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
int err;
err = ib_is_udata_in_empty(uhw);
if (err)
return err;
/*
* Return rvt_dev_info.dparms.props contents
*/
*props = rdi->dparms.props;
return ib_respond_empty_udata(uhw);
}
static int rvt_get_numa_node(struct ib_device *ibdev)
{
struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
return rdi->dparms.node;
}
static int rvt_modify_device(struct ib_device *device,
int device_modify_mask,
struct ib_device_modify *device_modify)
{
/*
* There is currently no need to supply this based on qib and hfi1.
* Future drivers may need to implement this though.
*/
return -EOPNOTSUPP;
}
/**
* rvt_query_port - Passes the query port call to the driver
* @ibdev: Verbs IB dev
* @port_num: port number, 1 based from ib core
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/dma-mapping.h`, `rdma/uverbs_ioctl.h`, `vt.h`, `cq.h`, `trace.h`.
- Detected declarations: `function rvt_init`, `function rvt_cleanup`, `function rvt_alloc_device`, `function rvt_query_device`, `function rvt_get_numa_node`, `function rvt_modify_device`, `function rvt_query_port`, `function rvt_modify_port`, `function rvt_query_pkey`, `function rvt_query_gid`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: integration 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.