drivers/net/ethernet/mellanox/mlx5/core/lib/aso.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/lib/aso.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/lib/aso.c- Extension
.c- Size
- 10269 bytes
- Lines
- 433
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- 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/mlx5/device.hlinux/mlx5/transobj.hclock.haso.hwq.h
Detected Declarations
struct mlx5_aso_cqstruct mlx5_asofunction mlx5_aso_free_cqfunction mlx5_aso_alloc_cqfunction create_aso_cqfunction mlx5_aso_destroy_cqfunction mlx5_aso_create_cqfunction mlx5_aso_alloc_sqfunction create_aso_sqfunction mlx5_aso_set_sq_rdyfunction mlx5_aso_create_sq_rdyfunction mlx5_aso_free_sqfunction mlx5_aso_destroy_sqfunction mlx5_aso_create_sqfunction mlx5_aso_destroyfunction mlx5_aso_build_wqefunction mlx5_aso_post_wqefunction mlx5_aso_poll_cq
Annotated Snippet
struct mlx5_aso_cq {
/* data path - accessed per cqe */
struct mlx5_cqwq wq;
/* data path - accessed per napi poll */
struct mlx5_core_cq mcq;
/* control */
struct mlx5_core_dev *mdev;
struct mlx5_wq_ctrl wq_ctrl;
} ____cacheline_aligned_in_smp;
struct mlx5_aso {
/* data path */
u16 cc;
u16 pc;
struct mlx5_wqe_ctrl_seg *doorbell_cseg;
struct mlx5_aso_cq cq;
/* read only */
struct mlx5_wq_cyc wq;
void __iomem *uar_map;
u32 sqn;
/* control path */
struct mlx5_wq_ctrl wq_ctrl;
} ____cacheline_aligned_in_smp;
static void mlx5_aso_free_cq(struct mlx5_aso_cq *cq)
{
mlx5_wq_destroy(&cq->wq_ctrl);
}
static int mlx5_aso_alloc_cq(struct mlx5_core_dev *mdev, int numa_node,
void *cqc_data, struct mlx5_aso_cq *cq)
{
struct mlx5_core_cq *mcq = &cq->mcq;
struct mlx5_wq_param param;
int err;
u32 i;
param.buf_numa_node = numa_node;
param.db_numa_node = numa_node;
err = mlx5_cqwq_create(mdev, ¶m, cqc_data, &cq->wq, &cq->wq_ctrl);
if (err)
return err;
mcq->cqe_sz = 64;
mcq->set_ci_db = cq->wq_ctrl.db.db;
mcq->arm_db = cq->wq_ctrl.db.db + 1;
for (i = 0; i < mlx5_cqwq_get_size(&cq->wq); i++) {
struct mlx5_cqe64 *cqe = mlx5_cqwq_get_wqe(&cq->wq, i);
cqe->op_own = 0xf1;
}
cq->mdev = mdev;
return 0;
}
static int create_aso_cq(struct mlx5_aso_cq *cq, void *cqc_data)
{
u32 out[MLX5_ST_SZ_DW(create_cq_out)];
struct mlx5_core_dev *mdev = cq->mdev;
struct mlx5_core_cq *mcq = &cq->mcq;
void *in, *cqc;
int inlen, eqn;
int err;
err = mlx5_comp_eqn_get(mdev, 0, &eqn);
if (err)
return err;
inlen = MLX5_ST_SZ_BYTES(create_cq_in) +
sizeof(u64) * cq->wq_ctrl.buf.npages;
in = kvzalloc(inlen, GFP_KERNEL);
if (!in)
return -ENOMEM;
cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context);
memcpy(cqc, cqc_data, MLX5_ST_SZ_BYTES(cqc));
mlx5_fill_page_frag_array(&cq->wq_ctrl.buf,
(__be64 *)MLX5_ADDR_OF(create_cq_in, in, pas));
Annotation
- Immediate include surface: `linux/mlx5/device.h`, `linux/mlx5/transobj.h`, `clock.h`, `aso.h`, `wq.h`.
- Detected declarations: `struct mlx5_aso_cq`, `struct mlx5_aso`, `function mlx5_aso_free_cq`, `function mlx5_aso_alloc_cq`, `function create_aso_cq`, `function mlx5_aso_destroy_cq`, `function mlx5_aso_create_cq`, `function mlx5_aso_alloc_sq`, `function create_aso_sq`, `function mlx5_aso_set_sq_rdy`.
- Atlas domain: Driver Families / drivers/net.
- 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.