drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pool.h- Extension
.h- Size
- 3173 bytes
- Lines
- 133
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
struct mlx5hws_pool_chunkstruct mlx5hws_pool_resourcestruct mlx5hws_pool_attrstruct mlx5hws_pool_dbstruct mlx5hws_poolenum mlx5hws_pool_typeenum mlx5hws_pool_flagsenum mlx5hws_pool_optimizeenum mlx5hws_db_typefunction mlx5hws_pool_get_base_idfunction mlx5hws_pool_get_base_mirror_idfunction mlx5hws_pool_emptyfunction mlx5hws_pool_full
Annotated Snippet
struct mlx5hws_pool_chunk {
int offset;
int order;
};
struct mlx5hws_pool_resource {
struct mlx5hws_pool *pool;
u32 base_id;
u32 range;
};
enum mlx5hws_pool_flags {
/* Managed by a buddy allocator. If this is not set only allocations of
* order 0 are supported.
*/
MLX5HWS_POOL_FLAG_BUDDY = BIT(0),
};
enum mlx5hws_pool_optimize {
MLX5HWS_POOL_OPTIMIZE_NONE = 0x0,
MLX5HWS_POOL_OPTIMIZE_ORIG = 0x1,
MLX5HWS_POOL_OPTIMIZE_MIRROR = 0x2,
MLX5HWS_POOL_OPTIMIZE_MAX = 0x3,
};
struct mlx5hws_pool_attr {
enum mlx5hws_pool_type pool_type;
enum mlx5hws_table_type table_type;
enum mlx5hws_pool_flags flags;
enum mlx5hws_pool_optimize opt_type;
/* Allocation size once memory is depleted */
size_t alloc_log_sz;
};
enum mlx5hws_db_type {
/* Uses a bitmap, supports only allocations of order 0. */
MLX5HWS_POOL_DB_TYPE_BITMAP,
/* Entries are managed using a buddy mechanism. */
MLX5HWS_POOL_DB_TYPE_BUDDY,
};
struct mlx5hws_pool_db {
enum mlx5hws_db_type type;
union {
unsigned long *bitmap;
struct mlx5hws_buddy_mem *buddy;
};
};
typedef int (*mlx5hws_pool_db_get_chunk)(struct mlx5hws_pool *pool,
struct mlx5hws_pool_chunk *chunk);
typedef void (*mlx5hws_pool_db_put_chunk)(struct mlx5hws_pool *pool,
struct mlx5hws_pool_chunk *chunk);
typedef void (*mlx5hws_pool_unint_db)(struct mlx5hws_pool *pool);
struct mlx5hws_pool {
struct mlx5hws_context *ctx;
enum mlx5hws_pool_type type;
enum mlx5hws_pool_flags flags;
struct mutex lock; /* protect the pool */
size_t alloc_log_sz;
size_t available_elems;
enum mlx5hws_table_type tbl_type;
enum mlx5hws_pool_optimize opt_type;
struct mlx5hws_pool_resource *resource;
struct mlx5hws_pool_resource *mirror_resource;
struct mlx5hws_pool_db db;
/* Functions */
mlx5hws_pool_unint_db p_db_uninit;
mlx5hws_pool_db_get_chunk p_get_chunk;
mlx5hws_pool_db_put_chunk p_put_chunk;
};
struct mlx5hws_pool *
mlx5hws_pool_create(struct mlx5hws_context *ctx,
struct mlx5hws_pool_attr *pool_attr);
void mlx5hws_pool_destroy(struct mlx5hws_pool *pool);
int mlx5hws_pool_chunk_alloc(struct mlx5hws_pool *pool,
struct mlx5hws_pool_chunk *chunk);
void mlx5hws_pool_chunk_free(struct mlx5hws_pool *pool,
struct mlx5hws_pool_chunk *chunk);
static inline u32 mlx5hws_pool_get_base_id(struct mlx5hws_pool *pool)
{
return pool->resource->base_id;
}
Annotation
- Detected declarations: `struct mlx5hws_pool_chunk`, `struct mlx5hws_pool_resource`, `struct mlx5hws_pool_attr`, `struct mlx5hws_pool_db`, `struct mlx5hws_pool`, `enum mlx5hws_pool_type`, `enum mlx5hws_pool_flags`, `enum mlx5hws_pool_optimize`, `enum mlx5hws_db_type`, `function mlx5hws_pool_get_base_id`.
- Atlas domain: Driver Families / drivers/net.
- 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.