drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c- Extension
.c- Size
- 56438 bytes
- Lines
- 1954
- 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
linux/kernel.hlinux/slab.hlinux/errno.hlinux/bitops.hlinux/list.hlinux/rhashtable.hlinux/netdevice.hlinux/mutex.hlinux/refcount.hlinux/idr.hnet/devlink.htrace/events/mlxsw.hreg.hcore.hresources.hspectrum.hspectrum_acl_tcam.hcore_acl_flex_keys.h
Detected Declarations
struct mlxsw_sp_acl_tcam_patternstruct mlxsw_sp_acl_tcam_groupstruct mlxsw_sp_acl_tcam_vgroupstruct mlxsw_sp_acl_tcam_rehash_ctxstruct mlxsw_sp_acl_tcam_vregionstruct mlxsw_sp_acl_tcam_vchunkstruct mlxsw_sp_acl_tcam_chunkstruct mlxsw_sp_acl_tcam_vchunkstruct mlxsw_sp_acl_tcam_entrystruct mlxsw_sp_acl_tcam_ventrystruct mlxsw_sp_acl_tcam_flower_rulesetstruct mlxsw_sp_acl_tcam_flower_rulestruct mlxsw_sp_acl_tcam_mr_rulesetstruct mlxsw_sp_acl_tcam_mr_rulefunction mlxsw_sp_acl_tcam_priv_sizefunction mlxsw_sp_acl_tcam_priority_getfunction mlxsw_sp_acl_tcam_region_id_getfunction mlxsw_sp_acl_tcam_region_id_putfunction mlxsw_sp_acl_tcam_group_id_getfunction mlxsw_sp_acl_tcam_group_id_putfunction mlxsw_sp_acl_tcam_group_updatefunction mlxsw_sp_acl_tcam_group_addfunction mlxsw_sp_acl_tcam_group_delfunction mlxsw_sp_acl_tcam_vgroup_addfunction mlxsw_sp_acl_tcam_vgroup_delfunction mlxsw_sp_acl_tcam_group_bindfunction mlxsw_sp_acl_tcam_group_unbindfunction mlxsw_sp_acl_tcam_group_idfunction mlxsw_sp_acl_tcam_vregion_priofunction mlxsw_sp_acl_tcam_vregion_max_priofunction mlxsw_sp_acl_tcam_vgroup_prio_updatefunction mlxsw_sp_acl_tcam_group_region_attachfunction list_for_eachfunction mlxsw_sp_acl_tcam_group_region_detachfunction mlxsw_sp_acl_tcam_vgroup_vregion_attachfunction mlxsw_sp_acl_tcam_vgroup_vregion_detachfunction mlxsw_sp_acl_tcam_vgroup_vregion_findfunction list_for_eachfunction mlxsw_sp_acl_tcam_vgroup_use_patternsfunction mlxsw_sp_acl_tcam_region_allocfunction mlxsw_sp_acl_tcam_region_freefunction mlxsw_sp_acl_tcam_region_enablefunction mlxsw_sp_acl_tcam_region_disablefunction mlxsw_sp_acl_tcam_region_createfunction mlxsw_sp_acl_tcam_region_destroyfunction mlxsw_sp_acl_tcam_vregion_rehash_work_schedulefunction mlxsw_sp_acl_tcam_vregion_rehash_workfunction mlxsw_sp_acl_tcam_rehash_ctx_vchunk_reset
Annotated Snippet
struct mlxsw_sp_acl_tcam_pattern {
const enum mlxsw_afk_element *elements;
unsigned int elements_count;
};
struct mlxsw_sp_acl_tcam_group {
struct mlxsw_sp_acl_tcam *tcam;
u16 id;
struct mutex lock; /* guards region list updates */
struct list_head region_list;
unsigned int region_count;
};
struct mlxsw_sp_acl_tcam_vgroup {
struct mlxsw_sp_acl_tcam_group group;
struct list_head vregion_list;
struct rhashtable vchunk_ht;
const struct mlxsw_sp_acl_tcam_pattern *patterns;
unsigned int patterns_count;
bool tmplt_elusage_set;
struct mlxsw_afk_element_usage tmplt_elusage;
bool vregion_rehash_enabled;
unsigned int *p_min_prio;
unsigned int *p_max_prio;
};
struct mlxsw_sp_acl_tcam_rehash_ctx {
void *hints_priv;
bool this_is_rollback;
struct mlxsw_sp_acl_tcam_vchunk *current_vchunk; /* vchunk being
* currently migrated.
*/
struct mlxsw_sp_acl_tcam_ventry *start_ventry; /* ventry to start
* migration from in
* a vchunk being
* currently migrated.
*/
struct mlxsw_sp_acl_tcam_ventry *stop_ventry; /* ventry to stop
* migration at
* a vchunk being
* currently migrated.
*/
};
struct mlxsw_sp_acl_tcam_vregion {
struct mutex lock; /* Protects consistency of region, region2 pointers
* and vchunk_list.
*/
struct mlxsw_sp_acl_tcam_region *region;
struct mlxsw_sp_acl_tcam_region *region2; /* Used during migration */
struct list_head list; /* Member of a TCAM group */
struct list_head tlist; /* Member of a TCAM */
struct list_head vchunk_list; /* List of vchunks under this vregion */
struct mlxsw_afk_key_info *key_info;
struct mlxsw_sp_acl_tcam *tcam;
struct mlxsw_sp_acl_tcam_vgroup *vgroup;
struct {
struct delayed_work dw;
struct mlxsw_sp_acl_tcam_rehash_ctx ctx;
} rehash;
struct mlxsw_sp *mlxsw_sp;
refcount_t ref_count;
};
struct mlxsw_sp_acl_tcam_vchunk;
struct mlxsw_sp_acl_tcam_chunk {
struct mlxsw_sp_acl_tcam_vchunk *vchunk;
struct mlxsw_sp_acl_tcam_region *region;
unsigned long priv[];
/* priv has to be always the last item */
};
struct mlxsw_sp_acl_tcam_vchunk {
struct mlxsw_sp_acl_tcam_chunk *chunk;
struct mlxsw_sp_acl_tcam_chunk *chunk2; /* Used during migration */
struct list_head list; /* Member of a TCAM vregion */
struct rhash_head ht_node; /* Member of a chunk HT */
struct list_head ventry_list;
unsigned int priority; /* Priority within the vregion and group */
struct mlxsw_sp_acl_tcam_vgroup *vgroup;
struct mlxsw_sp_acl_tcam_vregion *vregion;
refcount_t ref_count;
};
struct mlxsw_sp_acl_tcam_entry {
struct mlxsw_sp_acl_tcam_ventry *ventry;
struct mlxsw_sp_acl_tcam_chunk *chunk;
unsigned long priv[];
/* priv has to be always the last item */
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/errno.h`, `linux/bitops.h`, `linux/list.h`, `linux/rhashtable.h`, `linux/netdevice.h`, `linux/mutex.h`.
- Detected declarations: `struct mlxsw_sp_acl_tcam_pattern`, `struct mlxsw_sp_acl_tcam_group`, `struct mlxsw_sp_acl_tcam_vgroup`, `struct mlxsw_sp_acl_tcam_rehash_ctx`, `struct mlxsw_sp_acl_tcam_vregion`, `struct mlxsw_sp_acl_tcam_vchunk`, `struct mlxsw_sp_acl_tcam_chunk`, `struct mlxsw_sp_acl_tcam_vchunk`, `struct mlxsw_sp_acl_tcam_entry`, `struct mlxsw_sp_acl_tcam_ventry`.
- 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.