drivers/vdpa/mlx5/core/resources.c
Source file repositories/reference/linux-study-clean/drivers/vdpa/mlx5/core/resources.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/vdpa/mlx5/core/resources.c- Extension
.c- Size
- 10229 bytes
- Lines
- 394
- Domain
- Driver Families
- Bucket
- drivers/vdpa
- 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
linux/iova.hlinux/mlx5/driver.hmlx5_vdpa.h
Detected Declarations
function alloc_pdfunction dealloc_pdfunction get_null_mkeyfunction create_uctxfunction destroy_uctxfunction mlx5_vdpa_create_tisfunction mlx5_vdpa_destroy_tisfunction mlx5_vdpa_create_rqtfunction mlx5_vdpa_modify_rqtfunction mlx5_vdpa_destroy_rqtfunction mlx5_vdpa_create_tirfunction mlx5_vdpa_destroy_tirfunction mlx5_vdpa_alloc_transport_domainfunction mlx5_vdpa_dealloc_transport_domainfunction mlx5_vdpa_create_mkeyfunction mlx5_vdpa_destroy_mkeyfunction init_ctrl_vqfunction cleanup_ctrl_vqfunction mlx5_vdpa_alloc_resourcesfunction mlx5_vdpa_free_resourcesfunction virtqueue_cmd_callbackfunction issue_async_cmdfunction mlx5_vdpa_exec_async_cmds
Annotated Snippet
if (*completed < issued) {
/* Throttled by own commands: wait for oldest completion. */
wait_for_completion(&cmds[*completed].cmd_done);
(*completed)++;
goto retry;
} else {
/* Throttled by external commands: switch to sync api. */
err = mlx5_cmd_exec(mvdev->mdev,
cmd->in, cmd->inlen,
cmd->out, cmd->outlen);
if (!err)
(*completed)++;
}
}
return err;
}
int mlx5_vdpa_exec_async_cmds(struct mlx5_vdpa_dev *mvdev,
struct mlx5_vdpa_async_cmd *cmds,
int num_cmds)
{
int completed = 0;
int issued = 0;
int err = 0;
for (int i = 0; i < num_cmds; i++)
init_completion(&cmds[i].cmd_done);
while (issued < num_cmds) {
err = issue_async_cmd(mvdev, cmds, issued, &completed);
if (err) {
mlx5_vdpa_err(mvdev, "error issuing command %d of %d: %d\n",
issued, num_cmds, err);
break;
}
issued++;
}
while (completed < issued)
wait_for_completion(&cmds[completed++].cmd_done);
return err;
}
Annotation
- Immediate include surface: `linux/iova.h`, `linux/mlx5/driver.h`, `mlx5_vdpa.h`.
- Detected declarations: `function alloc_pd`, `function dealloc_pd`, `function get_null_mkey`, `function create_uctx`, `function destroy_uctx`, `function mlx5_vdpa_create_tis`, `function mlx5_vdpa_destroy_tis`, `function mlx5_vdpa_create_rqt`, `function mlx5_vdpa_modify_rqt`, `function mlx5_vdpa_destroy_rqt`.
- Atlas domain: Driver Families / drivers/vdpa.
- 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.