drivers/infiniband/sw/rdmavt/mad.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/sw/rdmavt/mad.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/sw/rdmavt/mad.c- Extension
.c- Size
- 3302 bytes
- Lines
- 131
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
rdma/ib_mad.hmad.hvt.h
Detected Declarations
function Copyrightfunction rvt_send_mad_handlerfunction rvt_create_mad_agentsfunction rvt_free_mad_agents
Annotated Snippet
if (IS_ERR(agent)) {
ret = PTR_ERR(agent);
goto err;
}
rvp->send_agent = agent;
if (rdi->driver_f.notify_create_mad_agent)
rdi->driver_f.notify_create_mad_agent(rdi, p);
}
return 0;
err:
for (p = 0; p < rdi->dparms.nports; p++) {
rvp = rdi->ports[p];
if (rvp->send_agent) {
agent = rvp->send_agent;
rvp->send_agent = NULL;
ib_unregister_mad_agent(agent);
if (rdi->driver_f.notify_free_mad_agent)
rdi->driver_f.notify_free_mad_agent(rdi, p);
}
}
return ret;
}
/**
* rvt_free_mad_agents - free up mad agents
* @rdi: rvt dev struct
*
* If driver needs notification of mad agent removal make the call back
*/
void rvt_free_mad_agents(struct rvt_dev_info *rdi)
{
struct ib_mad_agent *agent;
struct rvt_ibport *rvp;
int p;
for (p = 0; p < rdi->dparms.nports; p++) {
rvp = rdi->ports[p];
if (rvp->send_agent) {
agent = rvp->send_agent;
rvp->send_agent = NULL;
ib_unregister_mad_agent(agent);
}
if (rvp->sm_ah) {
rdma_destroy_ah(&rvp->sm_ah->ibah,
RDMA_DESTROY_AH_SLEEPABLE);
rvp->sm_ah = NULL;
}
if (rdi->driver_f.notify_free_mad_agent)
rdi->driver_f.notify_free_mad_agent(rdi, p);
}
}
Annotation
- Immediate include surface: `rdma/ib_mad.h`, `mad.h`, `vt.h`.
- Detected declarations: `function Copyright`, `function rvt_send_mad_handler`, `function rvt_create_mad_agents`, `function rvt_free_mad_agents`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: source implementation candidate.
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.