drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/matcher.c- Extension
.c- Size
- 35639 bytes
- Lines
- 1293
- 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 hws_matcher_requires_col_tblfunction hws_matcher_rules_to_tbl_depthfunction hws_matcher_destroy_end_ftfunction mlx5hws_matcher_update_end_ft_isolatedfunction hws_matcher_connect_end_ft_isolatedfunction hws_matcher_create_end_ft_isolatedfunction hws_matcher_create_end_ftfunction hws_matcher_connect_isolated_firstfunction hws_matcher_connect_isolated_lastfunction hws_matcher_connect_isolatedfunction hws_matcher_connectfunction list_for_each_entryfunction hws_matcher_disconnect_isolatedfunction hws_matcher_disconnectfunction hws_matcher_set_rtc_attr_szfunction hws_matcher_create_rtcfunction hws_matcher_destroy_rtcfunction hws_matcher_check_attr_szfunction hws_matcher_check_and_process_atfunction hws_matcher_bind_atfunction hws_matcher_set_ip_version_matchfunction hws_matcher_bind_mtfunction hws_matcher_unbind_mtfunction hws_matcher_validate_insert_modefunction hws_matcher_process_attrfunction hws_matcher_create_and_connectfunction hws_matcher_destroy_and_disconnectfunction hws_matcher_create_col_matcherfunction hws_matcher_destroy_col_matcherfunction hws_matcher_initfunction hws_matcher_uninitfunction hws_matcher_grow_at_arrayfunction mlx5hws_matcher_attach_atfunction hws_matcher_set_templatesfunction hws_matcher_unset_templatesfunction mlx5hws_matcher_createfunction mlx5hws_matcher_destroyfunction mlx5hws_match_template_createfunction mlx5hws_match_template_destroyfunction hws_matcher_resize_precheckfunction mlx5hws_matcher_resize_set_targetfunction mlx5hws_matcher_resize_rule_move
Annotated Snippet
if (tmp_matcher->attr.priority > matcher->attr.priority) {
next = tmp_matcher;
break;
}
prev = tmp_matcher;
}
if (next)
/* insert before next */
list_add_tail(&matcher->list_node, &next->list_node);
else
/* insert after prev */
list_add(&matcher->list_node, &prev->list_node);
connect:
if (next) {
/* Connect to next RTC */
ret = mlx5hws_table_ft_set_next_rtc(ctx,
matcher->end_ft_id,
tbl->fw_ft_type,
next->match_ste.rtc_0_id,
next->match_ste.rtc_1_id);
if (ret) {
mlx5hws_err(ctx, "Failed to connect new matcher to next RTC\n");
goto remove_from_list;
}
} else {
/* Connect last matcher to next miss_tbl if exists */
ret = mlx5hws_table_connect_to_miss_table(tbl, tbl->default_miss.miss_tbl);
if (ret) {
mlx5hws_err(ctx, "Failed connect new matcher to miss_tbl\n");
goto remove_from_list;
}
}
/* Connect to previous FT */
ret = mlx5hws_table_ft_set_next_rtc(ctx,
prev ? prev->end_ft_id : tbl->ft_id,
tbl->fw_ft_type,
matcher->match_ste.rtc_0_id,
matcher->match_ste.rtc_1_id);
if (ret) {
mlx5hws_err(ctx, "Failed to connect new matcher to previous FT\n");
goto remove_from_list;
}
/* Reset prev matcher FT default miss (drop refcount) */
ret = mlx5hws_table_ft_set_default_next_ft(tbl, prev ? prev->end_ft_id : tbl->ft_id);
if (ret) {
mlx5hws_err(ctx, "Failed to reset matcher ft default miss\n");
goto remove_from_list;
}
if (!prev) {
/* Update tables missing to current matcher in the table */
ret = mlx5hws_table_update_connected_miss_tables(tbl);
if (ret) {
mlx5hws_err(ctx, "Fatal error, failed to update connected miss table\n");
goto remove_from_list;
}
}
return 0;
remove_from_list:
list_del_init(&matcher->list_node);
return ret;
}
static int hws_matcher_disconnect_isolated(struct mlx5hws_matcher *matcher)
{
struct mlx5hws_matcher *first, *last, *prev, *next;
struct mlx5hws_table *tbl = matcher->tbl;
struct mlx5hws_context *ctx = tbl->ctx;
u32 end_ft_id;
int ret;
first = list_first_entry(&tbl->matchers_list,
struct mlx5hws_matcher,
list_node);
last = list_last_entry(&tbl->matchers_list,
struct mlx5hws_matcher,
list_node);
prev = list_prev_entry(matcher, list_node);
next = list_next_entry(matcher, list_node);
list_del_init(&matcher->list_node);
if (first == last) {
/* This was the only matcher in the list.
Annotation
- Immediate include surface: `internal.h`.
- Detected declarations: `function hws_matcher_requires_col_tbl`, `function hws_matcher_rules_to_tbl_depth`, `function hws_matcher_destroy_end_ft`, `function mlx5hws_matcher_update_end_ft_isolated`, `function hws_matcher_connect_end_ft_isolated`, `function hws_matcher_create_end_ft_isolated`, `function hws_matcher_create_end_ft`, `function hws_matcher_connect_isolated_first`, `function hws_matcher_connect_isolated_last`, `function hws_matcher_connect_isolated`.
- 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.