drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c- Extension
.c- Size
- 78452 bytes
- Lines
- 2652
- 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_action_get_typefunction hws_action_get_shared_stc_nicfunction hws_action_get_shared_stcfunction hws_action_put_shared_stcfunction hws_action_print_combofunction mlx5hws_action_check_combofunction hws_action_fixup_stc_attrfunction mlx5hws_action_alloc_single_stcfunction mlx5hws_action_free_single_stcfunction hws_action_get_mh_stc_typefunction hws_action_fill_stc_attrfunction hws_action_create_stcsfunction hws_action_destroy_stcsfunction hws_action_is_flag_hws_fdbfunction hws_action_validate_hws_actionfunction hws_action_create_generic_bulkfunction hws_action_create_genericfunction mlx5hws_action_create_dest_table_numfunction mlx5hws_action_create_dest_tablefunction mlx5hws_action_create_dest_dropfunction mlx5hws_action_create_default_missfunction mlx5hws_action_create_tagfunction hws_action_create_asofunction mlx5hws_action_create_aso_meterfunction mlx5hws_action_create_counterfunction mlx5hws_action_create_dest_vportfunction mlx5hws_action_create_push_vlanfunction mlx5hws_action_create_pop_vlanfunction hws_action_handle_insert_with_ptrfunction hws_action_handle_l2_to_tunnel_l3function hws_action_prepare_decap_l3_actionsfunction hws_action_handle_tunnel_l3_to_l2function hws_action_create_reformat_hwsfunction mlx5hws_action_create_reformatfunction hws_action_create_modify_header_hwsfunction mlx5hws_action_create_modify_headerfunction mlx5hws_action_create_dest_arrayfunction mlx5hws_action_create_insert_headerfunction mlx5hws_action_create_remove_headerfunction hws_action_create_dest_match_range_definerfunction hws_action_create_dest_match_range_tablefunction hws_action_destroy_dest_match_range_tablefunction hws_action_create_dest_match_range_fill_tablefunction mlx5hws_action_create_dest_match_rangefunction mlx5hws_action_create_lastfunction mlx5hws_action_create_flow_samplerfunction hws_action_destroy_hwsfunction mlx5hws_action_destroy
Annotated Snippet
if (is_mirror && stc_attr->ste_table.ignore_tx) {
fixup_stc_attr->action_type = MLX5_IFC_STC_ACTION_TYPE_DROP;
fixup_stc_attr->action_offset = MLX5HWS_ACTION_OFFSET_HIT;
fixup_stc_attr->stc_offset = stc_attr->stc_offset;
use_fixup = true;
break;
}
pool = stc_attr->ste_table.ste_pool;
if (!is_mirror)
base_id = mlx5hws_pool_get_base_id(pool);
else
base_id = mlx5hws_pool_get_base_mirror_id(pool);
*fixup_stc_attr = *stc_attr;
fixup_stc_attr->ste_table.ste_obj_id = base_id;
use_fixup = true;
break;
case MLX5_IFC_STC_ACTION_TYPE_TAG:
if (fw_tbl_type == FS_FT_FDB_TX) {
fixup_stc_attr->action_type = MLX5_IFC_STC_ACTION_TYPE_NOP;
fixup_stc_attr->action_offset = MLX5HWS_ACTION_OFFSET_DW5;
fixup_stc_attr->stc_offset = stc_attr->stc_offset;
use_fixup = true;
}
break;
case MLX5_IFC_STC_ACTION_TYPE_ALLOW:
if (fw_tbl_type == FS_FT_FDB_TX || fw_tbl_type == FS_FT_FDB_RX) {
fixup_stc_attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT;
fixup_stc_attr->action_offset = stc_attr->action_offset;
fixup_stc_attr->stc_offset = stc_attr->stc_offset;
fixup_stc_attr->vport.esw_owner_vhca_id = ctx->caps->vhca_id;
fixup_stc_attr->vport.vport_num = ctx->caps->eswitch_manager_vport_number;
fixup_stc_attr->vport.eswitch_owner_vhca_id_valid =
ctx->caps->merged_eswitch;
use_fixup = true;
}
break;
case MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_VPORT:
if (stc_attr->vport.vport_num != MLX5_VPORT_UPLINK)
break;
if (fw_tbl_type == FS_FT_FDB_TX || fw_tbl_type == FS_FT_FDB_RX) {
/* The FW doesn't allow to go to wire in the TX/RX by JUMP_TO_VPORT */
fixup_stc_attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_UPLINK;
fixup_stc_attr->action_offset = stc_attr->action_offset;
fixup_stc_attr->stc_offset = stc_attr->stc_offset;
fixup_stc_attr->vport.vport_num = 0;
fixup_stc_attr->vport.esw_owner_vhca_id = stc_attr->vport.esw_owner_vhca_id;
fixup_stc_attr->vport.eswitch_owner_vhca_id_valid =
stc_attr->vport.eswitch_owner_vhca_id_valid;
}
use_fixup = true;
break;
default:
break;
}
return use_fixup;
}
int mlx5hws_action_alloc_single_stc(struct mlx5hws_context *ctx,
struct mlx5hws_cmd_stc_modify_attr *stc_attr,
u32 table_type,
struct mlx5hws_pool_chunk *stc)
__must_hold(&ctx->ctrl_lock)
{
struct mlx5hws_cmd_stc_modify_attr cleanup_stc_attr = {0};
struct mlx5hws_cmd_stc_modify_attr fixup_stc_attr = {0};
struct mlx5hws_pool *stc_pool = ctx->stc_pool;
bool use_fixup;
u32 obj_0_id;
int ret;
ret = mlx5hws_pool_chunk_alloc(stc_pool, stc);
if (ret) {
mlx5hws_err(ctx, "Failed to allocate single action STC\n");
return ret;
}
stc_attr->stc_offset = stc->offset;
/* Dynamic reparse not supported, overwrite and use default */
if (!mlx5hws_context_cap_dynamic_reparse(ctx))
stc_attr->reparse_mode = MLX5_IFC_STC_REPARSE_IGNORE;
obj_0_id = mlx5hws_pool_get_base_id(stc_pool);
Annotation
- Immediate include surface: `internal.h`.
- Detected declarations: `function mlx5hws_action_get_type`, `function hws_action_get_shared_stc_nic`, `function hws_action_get_shared_stc`, `function hws_action_put_shared_stc`, `function hws_action_print_combo`, `function mlx5hws_action_check_combo`, `function hws_action_fixup_stc_attr`, `function mlx5hws_action_alloc_single_stc`, `function mlx5hws_action_free_single_stc`, `function hws_action_get_mh_stc_type`.
- 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.