drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c- Extension
.c- Size
- 48740 bytes
- Lines
- 1641
- 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
linux/mlx5/vport.hmlx5_core.hfs_core.hfs_cmd.hfs_hws_pools.hmlx5hws.h
Detected Declarations
function mlx5_fs_init_hws_actions_poolfunction mlx5_fs_cleanup_hws_actions_poolfunction mlx5_cmd_hws_create_nsfunction mlx5_cmd_hws_destroy_nsfunction mlx5_cmd_hws_set_peerfunction mlx5_fs_set_ft_default_missfunction mlx5_fs_add_flow_table_dest_actionfunction mlx5_fs_del_flow_table_dest_actionfunction mlx5_cmd_hws_create_flow_tablefunction mlx5_cmd_hws_destroy_flow_tablefunction mlx5_cmd_hws_modify_flow_tablefunction mlx5_cmd_hws_update_root_ftfunction mlx5_cmd_hws_create_flow_groupfunction mlx5_cmd_hws_destroy_flow_groupfunction mlx5_fs_get_dest_action_ftfunction mlx5_fs_get_dest_action_table_numfunction mlx5_fs_create_dest_action_table_numfunction mlx5_fs_get_dest_action_vportfunction mlx5_fs_create_dest_action_rangefunction mlx5_fs_get_cached_hws_datafunction mlx5_fs_get_action_aso_meterfunction mlx5_fs_put_action_aso_meterfunction mlx5_fs_get_dest_action_samplerfunction mlx5_fs_put_dest_action_samplerfunction mlx5_fs_create_action_dest_arrayfunction mlx5_fs_get_action_push_vlanfunction mlx5_fs_calc_vlan_hdrfunction mlx5_fs_get_action_pop_vlanfunction mlx5_fs_get_action_decap_tnl_l2_to_l2function mlx5_fs_get_dest_action_dropfunction mlx5_fs_get_action_tagfunction mlx5_fs_create_action_lastfunction mlx5_fs_create_hws_actionfunction mlx5_fs_get_hws_actionfunction mlx5_fs_put_hws_actionfunction mlx5_fs_destroy_fs_actionfunction mlx5_fs_destroy_fs_actionsfunction mlx5_fs_fte_get_hws_actionsfunction mlx5_cmd_hws_create_ftefunction mlx5_cmd_hws_delete_ftefunction mlx5_cmd_hws_update_ftefunction mlx5_fs_create_action_remove_header_vlanfunction mlx5_fs_get_action_remove_header_vlanfunction mlx5_fs_verify_insert_header_paramsfunction mlx5_fs_verify_encap_decap_paramsfunction mlx5_fs_get_pr_encap_poolfunction mlx5_fs_destroy_pr_poolfunction mlx5_cmd_hws_packet_reformat_alloc
Annotated Snippet
if (!fs_hws_data) {
xa_unlock(cache_xa);
return NULL;
}
refcount_set(&fs_hws_data->hws_action_refcount, 0);
mutex_init(&fs_hws_data->lock);
err = __xa_insert(cache_xa, index, fs_hws_data, GFP_ATOMIC);
if (err) {
kfree(fs_hws_data);
xa_unlock(cache_xa);
return NULL;
}
}
xa_unlock(cache_xa);
return fs_hws_data;
}
static struct mlx5hws_action *
mlx5_fs_get_action_aso_meter(struct mlx5_fs_hws_context *fs_ctx,
struct mlx5_exe_aso *exe_aso)
{
struct mlx5_fs_hws_create_action_ctx create_ctx;
struct mlx5hws_context *ctx = fs_ctx->hws_ctx;
struct mlx5_fs_hws_data *meter_hws_data;
u32 id = exe_aso->base_id;
struct xarray *meters_xa;
meters_xa = &fs_ctx->hws_pool.aso_meters;
meter_hws_data = mlx5_fs_get_cached_hws_data(meters_xa, id);
if (!meter_hws_data)
return NULL;
create_ctx.hws_ctx = ctx;
create_ctx.actions_type = MLX5HWS_ACTION_TYP_ASO_METER;
create_ctx.id = id;
create_ctx.return_reg_id = exe_aso->return_reg_id;
return mlx5_fs_get_hws_action(meter_hws_data, &create_ctx);
}
static void mlx5_fs_put_action_aso_meter(struct mlx5_fs_hws_context *fs_ctx,
struct mlx5_exe_aso *exe_aso)
{
struct mlx5_fs_hws_data *meter_hws_data;
struct xarray *meters_xa;
meters_xa = &fs_ctx->hws_pool.aso_meters;
meter_hws_data = xa_load(meters_xa, exe_aso->base_id);
if (!meter_hws_data)
return;
return mlx5_fs_put_hws_action(meter_hws_data);
}
static struct mlx5hws_action *
mlx5_fs_get_dest_action_sampler(struct mlx5_fs_hws_context *fs_ctx,
struct mlx5_flow_rule *dst)
{
struct mlx5_fs_hws_create_action_ctx create_ctx;
struct mlx5hws_context *ctx = fs_ctx->hws_ctx;
struct mlx5_fs_hws_data *sampler_hws_data;
u32 id = dst->dest_attr.sampler_id;
struct xarray *sampler_xa;
sampler_xa = &fs_ctx->hws_pool.sample_dests;
sampler_hws_data = mlx5_fs_get_cached_hws_data(sampler_xa, id);
if (!sampler_hws_data)
return NULL;
create_ctx.hws_ctx = ctx;
create_ctx.actions_type = MLX5HWS_ACTION_TYP_SAMPLER;
create_ctx.id = id;
return mlx5_fs_get_hws_action(sampler_hws_data, &create_ctx);
}
static void mlx5_fs_put_dest_action_sampler(struct mlx5_fs_hws_context *fs_ctx,
u32 sampler_id)
{
struct mlx5_fs_hws_data *sampler_hws_data;
struct xarray *sampler_xa;
sampler_xa = &fs_ctx->hws_pool.sample_dests;
sampler_hws_data = xa_load(sampler_xa, sampler_id);
if (!sampler_hws_data)
return;
mlx5_fs_put_hws_action(sampler_hws_data);
}
Annotation
- Immediate include surface: `linux/mlx5/vport.h`, `mlx5_core.h`, `fs_core.h`, `fs_cmd.h`, `fs_hws_pools.h`, `mlx5hws.h`.
- Detected declarations: `function mlx5_fs_init_hws_actions_pool`, `function mlx5_fs_cleanup_hws_actions_pool`, `function mlx5_cmd_hws_create_ns`, `function mlx5_cmd_hws_destroy_ns`, `function mlx5_cmd_hws_set_peer`, `function mlx5_fs_set_ft_default_miss`, `function mlx5_fs_add_flow_table_dest_action`, `function mlx5_fs_del_flow_table_dest_action`, `function mlx5_cmd_hws_create_flow_table`, `function mlx5_cmd_hws_destroy_flow_table`.
- 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.