drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_rule.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_rule.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_rule.c- Extension
.c- Size
- 37560 bytes
- Lines
- 1378
- 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
dr_types.h
Detected Declarations
function dr_rule_append_to_miss_listfunction dr_rule_set_last_ste_miss_addrfunction dr_rule_create_collision_htblfunction dr_rule_create_collision_entryfunction dr_rule_handle_one_ste_in_update_listfunction dr_rule_send_update_listfunction list_for_each_entry_safefunction dr_rule_find_ste_in_miss_listfunction dr_rule_rehash_handle_collisionfunction dr_rule_rehash_copy_ste_ctrlfunction dr_rule_rehash_copy_stefunction dr_rule_rehash_copy_miss_listfunction list_for_each_entry_safefunction dr_rule_rehash_copy_htblfunction dr_rule_rehash_htblfunction dr_rule_handle_collisionfunction dr_rule_remove_action_membersfunction list_for_each_entry_safefunction dr_rule_add_action_membersfunction mlx5dr_rule_set_last_memberfunction mlx5dr_rule_get_reverse_rule_membersfunction dr_rule_clean_rule_membersfunction dr_get_bits_per_maskfunction dr_rule_need_enlarge_hashfunction dr_rule_handle_action_stesfunction dr_rule_handle_empty_entryfunction dr_rule_handle_ste_branchfunction dr_rule_cmp_value_to_maskfunction dr_rule_verifyfunction dr_rule_destroy_rule_nicfunction dr_rule_destroy_rule_fdbfunction dr_rule_destroy_rulefunction dr_rule_get_ipvfunction dr_rule_skipfunction dr_rule_create_rule_nicfunction dr_rule_create_rule_fdbfunction dr_rule_create_rulefunction mlx5dr_rule_destroy
Annotated Snippet
if (!new_ste) {
mlx5dr_dbg(dmn, "Failed adding collision entry, index: %d\n",
new_idx);
return NULL;
}
new_htbl->ctrl.num_of_collisions++;
use_update_list = true;
}
memcpy(mlx5dr_ste_get_hw_ste(new_ste), hw_ste, DR_STE_SIZE_REDUCED);
new_htbl->ctrl.num_of_valid_entries++;
if (use_update_list) {
ste_info = mlx5dr_send_info_alloc(dmn,
nic_matcher->nic_tbl->nic_dmn->type);
if (!ste_info)
goto err_exit;
mlx5dr_send_fill_and_append_ste_send_info(new_ste, DR_STE_SIZE, 0,
hw_ste, ste_info,
update_list, true);
}
dr_rule_rehash_copy_ste_ctrl(matcher, nic_matcher, cur_ste, new_ste);
return new_ste;
err_exit:
mlx5dr_ste_free(new_ste, matcher, nic_matcher);
return NULL;
}
static int dr_rule_rehash_copy_miss_list(struct mlx5dr_matcher *matcher,
struct mlx5dr_matcher_rx_tx *nic_matcher,
struct list_head *cur_miss_list,
struct mlx5dr_ste_htbl *new_htbl,
struct list_head *update_list)
{
struct mlx5dr_ste *tmp_ste, *cur_ste, *new_ste;
if (list_empty(cur_miss_list))
return 0;
list_for_each_entry_safe(cur_ste, tmp_ste, cur_miss_list, miss_list_node) {
new_ste = dr_rule_rehash_copy_ste(matcher,
nic_matcher,
cur_ste,
new_htbl,
update_list);
if (!new_ste)
goto err_insert;
list_del(&cur_ste->miss_list_node);
mlx5dr_htbl_put(cur_ste->htbl);
}
return 0;
err_insert:
mlx5dr_err(matcher->tbl->dmn, "Fatal error during resize\n");
WARN_ON(true);
return -EINVAL;
}
static int dr_rule_rehash_copy_htbl(struct mlx5dr_matcher *matcher,
struct mlx5dr_matcher_rx_tx *nic_matcher,
struct mlx5dr_ste_htbl *cur_htbl,
struct mlx5dr_ste_htbl *new_htbl,
struct list_head *update_list)
{
struct mlx5dr_ste *cur_ste;
int cur_entries;
int err = 0;
int i;
cur_entries = mlx5dr_icm_pool_chunk_size_to_entries(cur_htbl->chunk->size);
if (cur_entries < 1) {
mlx5dr_dbg(matcher->tbl->dmn, "Invalid number of entries\n");
return -EINVAL;
}
for (i = 0; i < cur_entries; i++) {
cur_ste = &cur_htbl->chunk->ste_arr[i];
if (mlx5dr_ste_is_not_used(cur_ste)) /* Empty, nothing to copy */
continue;
err = dr_rule_rehash_copy_miss_list(matcher,
nic_matcher,
mlx5dr_ste_get_miss_list(cur_ste),
Annotation
- Immediate include surface: `dr_types.h`.
- Detected declarations: `function dr_rule_append_to_miss_list`, `function dr_rule_set_last_ste_miss_addr`, `function dr_rule_create_collision_htbl`, `function dr_rule_create_collision_entry`, `function dr_rule_handle_one_ste_in_update_list`, `function dr_rule_send_update_list`, `function list_for_each_entry_safe`, `function dr_rule_find_ste_in_miss_list`, `function dr_rule_rehash_handle_collision`, `function dr_rule_rehash_copy_ste_ctrl`.
- 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.