drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v0.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_ste_v0.c- Extension
.c- Size
- 66942 bytes
- Lines
- 1965
- 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.hlinux/crc32.hdr_ste.h
Detected Declarations
enum dr_ste_v0_entry_typeenum dr_ste_v0_action_tunlenum dr_ste_v0_action_typeenum dr_ste_v0_action_mdfy_opfunction dr_ste_v0_set_entry_typefunction dr_ste_v0_get_entry_typefunction dr_ste_v0_set_miss_addrfunction dr_ste_v0_get_miss_addrfunction dr_ste_v0_set_byte_maskfunction dr_ste_v0_get_byte_maskfunction dr_ste_v0_set_lu_typefunction dr_ste_v0_set_next_lu_typefunction dr_ste_v0_get_next_lu_typefunction dr_ste_v0_set_hit_gvmifunction dr_ste_v0_set_hit_addrfunction dr_ste_v0_init_fullfunction dr_ste_v0_initfunction dr_ste_v0_rx_set_flow_tagfunction dr_ste_v0_set_counter_idfunction dr_ste_v0_set_go_back_bitfunction dr_ste_v0_set_tx_push_vlanfunction dr_ste_v0_set_tx_encapfunction dr_ste_v0_set_rx_decapfunction dr_ste_v0_set_rx_pop_vlanfunction dr_ste_v0_set_rx_decap_l3function dr_ste_v0_set_rewrite_actionsfunction dr_ste_v0_arr_init_nextfunction dr_ste_v0_set_actions_txfunction dr_ste_v0_set_actions_rxfunction dr_ste_v0_set_action_setfunction dr_ste_v0_set_action_addfunction dr_ste_v0_set_action_copyfunction dr_ste_v0_set_action_decap_l3_listfunction dr_ste_v0_build_eth_l2_src_dst_bit_maskfunction dr_ste_v0_build_eth_l2_src_dst_tagfunction dr_ste_v0_build_eth_l2_src_dst_initfunction dr_ste_v0_build_eth_l3_ipv6_dst_tagfunction dr_ste_v0_build_eth_l3_ipv6_dst_initfunction dr_ste_v0_build_eth_l3_ipv6_src_tagfunction dr_ste_v0_build_eth_l3_ipv6_src_initfunction dr_ste_v0_build_eth_l3_ipv4_5_tuple_tagfunction dr_ste_v0_build_eth_l3_ipv4_5_tuple_initfunction dr_ste_v0_build_eth_l2_src_or_dst_bit_maskfunction dr_ste_v0_build_eth_l2_src_or_dst_tagfunction dr_ste_v0_build_eth_l2_src_bit_maskfunction dr_ste_v0_build_eth_l2_src_tagfunction dr_ste_v0_build_eth_l2_src_initfunction dr_ste_v0_build_eth_l2_dst_bit_mask
Annotated Snippet
if (spec->ip_version == IP_VERSION_IPV4) {
MLX5_SET(ste_eth_l2_src_dst, tag, l3_type, STE_IPV4);
spec->ip_version = 0;
} else if (spec->ip_version == IP_VERSION_IPV6) {
MLX5_SET(ste_eth_l2_src_dst, tag, l3_type, STE_IPV6);
spec->ip_version = 0;
} else {
return -EINVAL;
}
}
DR_STE_SET_TAG(eth_l2_src_dst, tag, first_vlan_id, spec, first_vid);
DR_STE_SET_TAG(eth_l2_src_dst, tag, first_cfi, spec, first_cfi);
DR_STE_SET_TAG(eth_l2_src_dst, tag, first_priority, spec, first_prio);
if (spec->cvlan_tag) {
MLX5_SET(ste_eth_l2_src_dst, tag, first_vlan_qualifier, DR_STE_CVLAN);
spec->cvlan_tag = 0;
} else if (spec->svlan_tag) {
MLX5_SET(ste_eth_l2_src_dst, tag, first_vlan_qualifier, DR_STE_SVLAN);
spec->svlan_tag = 0;
}
return 0;
}
static void
dr_ste_v0_build_eth_l2_src_dst_init(struct mlx5dr_ste_build *sb,
struct mlx5dr_match_param *mask)
{
dr_ste_v0_build_eth_l2_src_dst_bit_mask(mask, sb->inner, sb->bit_mask);
sb->lu_type = DR_STE_CALC_LU_TYPE(ETHL2_SRC_DST, sb->rx, sb->inner);
sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask);
sb->ste_build_tag_func = &dr_ste_v0_build_eth_l2_src_dst_tag;
}
static int
dr_ste_v0_build_eth_l3_ipv6_dst_tag(struct mlx5dr_match_param *value,
struct mlx5dr_ste_build *sb,
u8 *tag)
{
struct mlx5dr_match_spec *spec = sb->inner ? &value->inner : &value->outer;
DR_STE_SET_TAG(eth_l3_ipv6_dst, tag, dst_ip_127_96, spec, dst_ip_127_96);
DR_STE_SET_TAG(eth_l3_ipv6_dst, tag, dst_ip_95_64, spec, dst_ip_95_64);
DR_STE_SET_TAG(eth_l3_ipv6_dst, tag, dst_ip_63_32, spec, dst_ip_63_32);
DR_STE_SET_TAG(eth_l3_ipv6_dst, tag, dst_ip_31_0, spec, dst_ip_31_0);
return 0;
}
static void
dr_ste_v0_build_eth_l3_ipv6_dst_init(struct mlx5dr_ste_build *sb,
struct mlx5dr_match_param *mask)
{
dr_ste_v0_build_eth_l3_ipv6_dst_tag(mask, sb, sb->bit_mask);
sb->lu_type = DR_STE_CALC_LU_TYPE(ETHL3_IPV6_DST, sb->rx, sb->inner);
sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask);
sb->ste_build_tag_func = &dr_ste_v0_build_eth_l3_ipv6_dst_tag;
}
static int
dr_ste_v0_build_eth_l3_ipv6_src_tag(struct mlx5dr_match_param *value,
struct mlx5dr_ste_build *sb,
u8 *tag)
{
struct mlx5dr_match_spec *spec = sb->inner ? &value->inner : &value->outer;
DR_STE_SET_TAG(eth_l3_ipv6_src, tag, src_ip_127_96, spec, src_ip_127_96);
DR_STE_SET_TAG(eth_l3_ipv6_src, tag, src_ip_95_64, spec, src_ip_95_64);
DR_STE_SET_TAG(eth_l3_ipv6_src, tag, src_ip_63_32, spec, src_ip_63_32);
DR_STE_SET_TAG(eth_l3_ipv6_src, tag, src_ip_31_0, spec, src_ip_31_0);
return 0;
}
static void
dr_ste_v0_build_eth_l3_ipv6_src_init(struct mlx5dr_ste_build *sb,
struct mlx5dr_match_param *mask)
{
dr_ste_v0_build_eth_l3_ipv6_src_tag(mask, sb, sb->bit_mask);
sb->lu_type = DR_STE_CALC_LU_TYPE(ETHL3_IPV6_SRC, sb->rx, sb->inner);
sb->byte_mask = mlx5dr_ste_conv_bit_to_byte_mask(sb->bit_mask);
sb->ste_build_tag_func = &dr_ste_v0_build_eth_l3_ipv6_src_tag;
}
static int
dr_ste_v0_build_eth_l3_ipv4_5_tuple_tag(struct mlx5dr_match_param *value,
Annotation
- Immediate include surface: `linux/types.h`, `linux/crc32.h`, `dr_ste.h`.
- Detected declarations: `enum dr_ste_v0_entry_type`, `enum dr_ste_v0_action_tunl`, `enum dr_ste_v0_action_type`, `enum dr_ste_v0_action_mdfy_op`, `function dr_ste_v0_set_entry_type`, `function dr_ste_v0_get_entry_type`, `function dr_ste_v0_set_miss_addr`, `function dr_ste_v0_get_miss_addr`, `function dr_ste_v0_set_byte_mask`, `function dr_ste_v0_get_byte_mask`.
- 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.