drivers/net/ethernet/mellanox/mlx5/core/steering/sws/fs_dr.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/fs_dr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/fs_dr.c- Extension
.c- Size
- 25263 bytes
- Lines
- 884
- 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.
- 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.hmlx5dr.hfs_dr.hdr_types.h
Detected Declarations
function mlx5_cmd_dr_update_root_ftfunction set_miss_actionfunction mlx5_cmd_dr_create_flow_tablefunction mlx5_cmd_dr_destroy_flow_tablefunction mlx5_cmd_dr_modify_flow_tablefunction mlx5_cmd_dr_create_flow_groupfunction mlx5_cmd_dr_destroy_flow_groupfunction contain_vport_reformat_actionfunction mlx5_cmd_dr_create_ftefunction list_for_each_entryfunction mlx5_cmd_dr_packet_reformat_allocfunction mlx5_cmd_dr_packet_reformat_deallocfunction mlx5_cmd_dr_modify_header_allocfunction mlx5_cmd_dr_modify_header_deallocfunction mlx5_cmd_dr_destroy_match_definerfunction mlx5_cmd_dr_create_match_definerfunction mlx5_cmd_dr_delete_ftefunction mlx5_cmd_dr_update_ftefunction mlx5_cmd_dr_set_peerfunction mlx5_cmd_dr_create_nsfunction mlx5_cmd_dr_destroy_nsfunction mlx5_cmd_dr_get_capabilitiesfunction mlx5_fs_dr_action_get_pkt_reformat_idfunction mlx5_fs_dr_is_supported
Annotated Snippet
if (err) {
mlx5dr_table_destroy(tbl);
ft->fs_dr_table.dr_table = NULL;
return err;
}
}
ft->max_fte = INT_MAX;
return 0;
}
static int mlx5_cmd_dr_destroy_flow_table(struct mlx5_flow_root_namespace *ns,
struct mlx5_flow_table *ft)
{
struct mlx5dr_action *action = ft->fs_dr_table.miss_action;
int err;
if (mlx5_fs_cmd_is_fw_term_table(ft))
return mlx5_fs_cmd_get_fw_cmds()->destroy_flow_table(ns, ft);
err = mlx5dr_table_destroy(ft->fs_dr_table.dr_table);
if (err) {
mlx5_core_err(ns->dev, "Failed to destroy flow_table (%d)\n",
err);
return err;
}
if (action) {
err = mlx5dr_action_destroy(action);
if (err) {
mlx5_core_err(ns->dev, "Failed to destroy action(%d)\n",
err);
return err;
}
}
return err;
}
static int mlx5_cmd_dr_modify_flow_table(struct mlx5_flow_root_namespace *ns,
struct mlx5_flow_table *ft,
struct mlx5_flow_table *next_ft)
{
if (mlx5_fs_cmd_is_fw_term_table(ft))
return mlx5_fs_cmd_get_fw_cmds()->modify_flow_table(ns, ft, next_ft);
return set_miss_action(ns, ft, next_ft);
}
static int mlx5_cmd_dr_create_flow_group(struct mlx5_flow_root_namespace *ns,
struct mlx5_flow_table *ft,
u32 *in,
struct mlx5_flow_group *fg)
{
struct mlx5dr_matcher *matcher;
u32 priority = MLX5_GET(create_flow_group_in, in,
start_flow_index);
u8 match_criteria_enable = MLX5_GET(create_flow_group_in,
in,
match_criteria_enable);
struct mlx5dr_match_parameters mask;
if (mlx5_fs_cmd_is_fw_term_table(ft))
return mlx5_fs_cmd_get_fw_cmds()->create_flow_group(ns, ft, in,
fg);
mask.match_buf = MLX5_ADDR_OF(create_flow_group_in,
in, match_criteria);
mask.match_sz = sizeof(fg->mask.match_criteria);
matcher = mlx5dr_matcher_create(ft->fs_dr_table.dr_table,
priority,
match_criteria_enable,
&mask);
if (!matcher) {
mlx5_core_err(ns->dev, "Failed creating matcher\n");
return -EINVAL;
}
fg->fs_dr_matcher.dr_matcher = matcher;
return 0;
}
static int mlx5_cmd_dr_destroy_flow_group(struct mlx5_flow_root_namespace *ns,
struct mlx5_flow_table *ft,
struct mlx5_flow_group *fg)
{
if (mlx5_fs_cmd_is_fw_term_table(ft))
return mlx5_fs_cmd_get_fw_cmds()->destroy_flow_group(ns, ft, fg);
Annotation
- Immediate include surface: `linux/mlx5/vport.h`, `mlx5_core.h`, `fs_core.h`, `fs_cmd.h`, `mlx5dr.h`, `fs_dr.h`, `dr_types.h`.
- Detected declarations: `function mlx5_cmd_dr_update_root_ft`, `function set_miss_action`, `function mlx5_cmd_dr_create_flow_table`, `function mlx5_cmd_dr_destroy_flow_table`, `function mlx5_cmd_dr_modify_flow_table`, `function mlx5_cmd_dr_create_flow_group`, `function mlx5_cmd_dr_destroy_flow_group`, `function contain_vport_reformat_action`, `function mlx5_cmd_dr_create_fte`, `function list_for_each_entry`.
- 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.