drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v1.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v1.c- Extension
.c- Size
- 78998 bytes
- Lines
- 2213
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hmlx5_ifc_dr_ste_v1.hdr_ste_v1.h
Detected Declarations
function dr_ste_v1_set_entry_typefunction dr_ste_v1_is_miss_addr_setfunction dr_ste_v1_set_miss_addrfunction dr_ste_v1_get_miss_addrfunction dr_ste_v1_set_byte_maskfunction dr_ste_v1_get_byte_maskfunction dr_ste_v1_set_lu_typefunction dr_ste_v1_set_next_lu_typefunction dr_ste_v1_get_next_lu_typefunction dr_ste_v1_set_hit_gvmifunction dr_ste_v1_set_hit_addrfunction dr_ste_v1_initfunction dr_ste_v1_prepare_for_postsendfunction dr_ste_v1_set_rx_flow_tagfunction dr_ste_v1_set_counter_idfunction dr_ste_v1_set_reparsefunction dr_ste_v1_set_encapfunction dr_ste_v1_set_insert_hdrfunction dr_ste_v1_set_remove_hdrfunction dr_ste_v1_set_push_vlanfunction dr_ste_v1_set_pop_vlanfunction dr_ste_v1_set_encap_l3function dr_ste_v1_set_rx_decapfunction dr_ste_v1_set_accelerated_rewrite_actionsfunction dr_ste_v1_set_basic_rewrite_actionsfunction dr_ste_v1_set_rewrite_actionsfunction dr_ste_v1_set_aso_flow_meterfunction dr_ste_v1_set_match_range_pkt_lenfunction dr_ste_v1_arr_init_next_matchfunction dr_ste_v1_arr_init_next_match_rangefunction dr_ste_v1_set_actions_txfunction dr_ste_v1_set_actions_rxfunction dr_ste_v1_set_action_setfunction dr_ste_v1_set_action_addfunction dr_ste_v1_set_action_copyfunction dr_ste_v1_set_action_decap_l3_listfunction dr_ste_v1_build_eth_l2_src_dst_bit_maskfunction dr_ste_v1_build_eth_l2_src_dst_tagfunction dr_ste_v1_build_eth_l2_src_dst_initfunction dr_ste_v1_build_eth_l3_ipv6_dst_tagfunction dr_ste_v1_build_eth_l3_ipv6_dst_initfunction dr_ste_v1_build_eth_l3_ipv6_src_tagfunction dr_ste_v1_build_eth_l3_ipv6_src_initfunction dr_ste_v1_build_eth_l3_ipv4_5_tuple_tagfunction dr_ste_v1_build_eth_l3_ipv4_5_tuple_initfunction dr_ste_v1_build_eth_l2_src_or_dst_bit_maskfunction dr_ste_v1_build_eth_l2_src_or_dst_tagfunction dr_ste_v1_build_eth_l2_src_bit_mask
Annotated Snippet
if (action_sz < DR_STE_ACTION_SINGLE_SZ) {
dr_ste_v1_arr_init_next_match(&last_ste, added_stes,
attr->gvmi);
action = MLX5_ADDR_OF(ste_mask_and_match_v1,
last_ste, action);
action_sz = DR_STE_ACTION_TRIPLE_SZ;
}
ste_ctx->set_pop_vlan(last_ste, action, attr->vlans.count);
action_sz -= DR_STE_ACTION_SINGLE_SZ;
action += DR_STE_ACTION_SINGLE_SZ;
/* Check if vlan_pop and modify_hdr on same STE is supported */
if (!(actions_caps & DR_STE_CTX_ACTION_CAP_POP_MDFY))
allow_modify_hdr = false;
}
if (action_type_set[DR_ACTION_TYP_MODIFY_HDR]) {
if (!allow_modify_hdr || action_sz < DR_STE_ACTION_DOUBLE_SZ) {
dr_ste_v1_arr_init_next_match(&last_ste, added_stes,
attr->gvmi);
action = MLX5_ADDR_OF(ste_mask_and_match_v1,
last_ste, action);
action_sz = DR_STE_ACTION_TRIPLE_SZ;
}
dr_ste_v1_set_rewrite_actions(last_ste, action,
attr->modify_actions,
attr->modify_pat_idx,
attr->modify_index,
attr->single_modify_action);
action_sz -= DR_STE_ACTION_DOUBLE_SZ;
action += DR_STE_ACTION_DOUBLE_SZ;
allow_encap = false;
}
if (action_type_set[DR_ACTION_TYP_PUSH_VLAN]) {
int i;
for (i = 0; i < attr->vlans.count; i++) {
if (action_sz < DR_STE_ACTION_DOUBLE_SZ || !allow_encap) {
dr_ste_v1_arr_init_next_match(&last_ste, added_stes, attr->gvmi);
action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action);
action_sz = DR_STE_ACTION_TRIPLE_SZ;
allow_encap = true;
}
ste_ctx->set_push_vlan(last_ste, action,
attr->vlans.headers[i]);
action_sz -= DR_STE_ACTION_DOUBLE_SZ;
action += DR_STE_ACTION_DOUBLE_SZ;
}
}
if (action_type_set[DR_ACTION_TYP_L2_TO_TNL_L2]) {
if (!allow_encap || action_sz < DR_STE_ACTION_DOUBLE_SZ) {
dr_ste_v1_arr_init_next_match(&last_ste, added_stes, attr->gvmi);
action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action);
action_sz = DR_STE_ACTION_TRIPLE_SZ;
allow_encap = true;
}
ste_ctx->set_encap(last_ste, action,
attr->reformat.id,
attr->reformat.size);
action_sz -= DR_STE_ACTION_DOUBLE_SZ;
action += DR_STE_ACTION_DOUBLE_SZ;
} else if (action_type_set[DR_ACTION_TYP_L2_TO_TNL_L3]) {
u8 *d_action;
if (action_sz < DR_STE_ACTION_TRIPLE_SZ) {
dr_ste_v1_arr_init_next_match(&last_ste, added_stes, attr->gvmi);
action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action);
action_sz = DR_STE_ACTION_TRIPLE_SZ;
}
d_action = action + DR_STE_ACTION_SINGLE_SZ;
ste_ctx->set_encap_l3(last_ste,
action, d_action,
attr->reformat.id,
attr->reformat.size);
action_sz -= DR_STE_ACTION_TRIPLE_SZ;
action += DR_STE_ACTION_TRIPLE_SZ;
} else if (action_type_set[DR_ACTION_TYP_INSERT_HDR]) {
if (!allow_encap || action_sz < DR_STE_ACTION_DOUBLE_SZ) {
dr_ste_v1_arr_init_next_match(&last_ste, added_stes, attr->gvmi);
action = MLX5_ADDR_OF(ste_mask_and_match_v1, last_ste, action);
action_sz = DR_STE_ACTION_TRIPLE_SZ;
}
ste_ctx->set_insert_hdr(last_ste, action,
attr->reformat.id,
attr->reformat.param_0,
attr->reformat.param_1,
attr->reformat.size);
Annotation
- Immediate include surface: `linux/types.h`, `mlx5_ifc_dr_ste_v1.h`, `dr_ste_v1.h`.
- Detected declarations: `function dr_ste_v1_set_entry_type`, `function dr_ste_v1_is_miss_addr_set`, `function dr_ste_v1_set_miss_addr`, `function dr_ste_v1_get_miss_addr`, `function dr_ste_v1_set_byte_mask`, `function dr_ste_v1_get_byte_mask`, `function dr_ste_v1_set_lu_type`, `function dr_ste_v1_set_next_lu_type`, `function dr_ste_v1_get_next_lu_type`, `function dr_ste_v1_set_hit_gvmi`.
- 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.