drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/table.c- Extension
.c- Size
- 12646 bytes
- Lines
- 498
- 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.
- 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
internal.h
Detected Declarations
function mlx5hws_table_get_idfunction hws_table_init_next_ft_attrfunction hws_table_set_cap_attrfunction hws_table_up_default_fdb_miss_tblfunction hws_table_down_default_fdb_miss_tblfunction hws_table_connect_to_default_miss_tblfunction mlx5hws_table_create_default_ftfunction mlx5hws_table_destroy_default_ftfunction hws_table_init_check_hws_supportfunction hws_table_initfunction hws_table_uninitfunction mlx5hws_table_destroyfunction hws_table_get_last_ftfunction mlx5hws_table_ft_set_default_next_ftfunction mlx5hws_table_ft_set_next_rtcfunction mlx5hws_table_ft_set_next_ftfunction mlx5hws_table_update_connected_miss_tablesfunction list_for_each_entryfunction mlx5hws_table_connect_to_miss_tablefunction hws_table_set_default_miss_not_validfunction mlx5hws_table_set_default_miss
Annotated Snippet
if (ret) {
mlx5hws_err(tbl->ctx, "Failed to get default fdb miss\n");
goto free_ft_obj;
}
ret = hws_table_connect_to_default_miss_tbl(tbl, *ft_id);
if (ret) {
mlx5hws_err(tbl->ctx, "Failed connecting to default miss tbl\n");
goto down_miss_tbl;
}
}
return 0;
down_miss_tbl:
hws_table_down_default_fdb_miss_tbl(tbl);
free_ft_obj:
mlx5hws_cmd_flow_table_destroy(mdev, ft_attr.type, *ft_id);
return ret;
}
void mlx5hws_table_destroy_default_ft(struct mlx5hws_table *tbl,
u32 ft_id)
{
mlx5hws_cmd_flow_table_destroy(tbl->ctx->mdev, tbl->fw_ft_type, ft_id);
hws_table_down_default_fdb_miss_tbl(tbl);
}
static int hws_table_init_check_hws_support(struct mlx5hws_context *ctx,
struct mlx5hws_table *tbl)
{
if (!(ctx->flags & MLX5HWS_CONTEXT_FLAG_HWS_SUPPORT)) {
mlx5hws_err(ctx, "HWS not supported, cannot create mlx5hws_table\n");
return -EOPNOTSUPP;
}
return 0;
}
static int hws_table_init(struct mlx5hws_table *tbl)
{
struct mlx5hws_context *ctx = tbl->ctx;
int ret;
ret = hws_table_init_check_hws_support(ctx, tbl);
if (ret)
return ret;
if (mlx5hws_table_get_fw_ft_type(tbl->type, (u8 *)&tbl->fw_ft_type)) {
pr_warn("HWS: invalid table type %d\n", tbl->type);
return -EOPNOTSUPP;
}
mutex_lock(&ctx->ctrl_lock);
ret = mlx5hws_table_create_default_ft(tbl->ctx->mdev,
tbl,
tbl->uid,
&tbl->ft_id);
if (ret) {
mlx5hws_err(tbl->ctx, "Failed to create flow table object\n");
mutex_unlock(&ctx->ctrl_lock);
return ret;
}
ret = mlx5hws_action_get_default_stc(ctx, tbl->type);
if (ret)
goto tbl_destroy;
INIT_LIST_HEAD(&tbl->matchers_list);
INIT_LIST_HEAD(&tbl->default_miss.head);
mutex_unlock(&ctx->ctrl_lock);
return 0;
tbl_destroy:
mlx5hws_table_destroy_default_ft(tbl, tbl->ft_id);
mutex_unlock(&ctx->ctrl_lock);
return ret;
}
static void hws_table_uninit(struct mlx5hws_table *tbl)
{
mutex_lock(&tbl->ctx->ctrl_lock);
mlx5hws_action_put_default_stc(tbl->ctx, tbl->type);
mlx5hws_table_destroy_default_ft(tbl, tbl->ft_id);
mutex_unlock(&tbl->ctx->ctrl_lock);
}
struct mlx5hws_table *mlx5hws_table_create(struct mlx5hws_context *ctx,
struct mlx5hws_table_attr *attr)
Annotation
- Immediate include surface: `internal.h`.
- Detected declarations: `function mlx5hws_table_get_id`, `function hws_table_init_next_ft_attr`, `function hws_table_set_cap_attr`, `function hws_table_up_default_fdb_miss_tbl`, `function hws_table_down_default_fdb_miss_tbl`, `function hws_table_connect_to_default_miss_tbl`, `function mlx5hws_table_create_default_ft`, `function mlx5hws_table_destroy_default_ft`, `function hws_table_init_check_hws_support`, `function hws_table_init`.
- 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.