drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c- Extension
.c- Size
- 19746 bytes
- Lines
- 645
- 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/kernel.hlinux/err.hlinux/errno.hlinux/gfp.hlinux/refcount.hlinux/rhashtable.htrace/events/mlxsw.hreg.hcore.hspectrum.hspectrum_acl_tcam.hcore_acl_flex_keys.h
Detected Declarations
struct mlxsw_sp_acl_atcam_lkey_id_ht_keystruct mlxsw_sp_acl_atcam_lkey_idstruct mlxsw_sp_acl_atcam_region_opsstruct mlxsw_sp_acl_atcam_region_genericstruct mlxsw_sp_acl_atcam_region_12kbfunction mlxsw_sp_acl_atcam_is_centryfunction mlxsw_sp_acl_atcam_region_generic_initfunction mlxsw_sp_acl_atcam_region_generic_finifunction mlxsw_sp_acl_atcam_generic_lkey_id_getfunction mlxsw_sp_acl_atcam_generic_lkey_id_putfunction mlxsw_sp_acl_atcam_region_12kb_initfunction mlxsw_sp_acl_atcam_region_12kb_finifunction mlxsw_sp_acl_atcam_lkey_id_createfunction mlxsw_sp_acl_atcam_lkey_id_destroyfunction mlxsw_sp_acl_atcam_12kb_lkey_id_getfunction mlxsw_sp_acl_atcam_12kb_lkey_id_putfunction mlxsw_sp_acl_atcam_region_associatefunction mlxsw_sp_acl_atcam_region_type_initfunction mlxsw_sp_acl_atcam_region_initfunction mlxsw_sp_acl_atcam_region_finifunction mlxsw_sp_acl_atcam_chunk_initfunction mlxsw_sp_acl_atcam_chunk_finifunction mlxsw_sp_acl_atcam_region_entry_insertfunction mlxsw_sp_acl_atcam_region_entry_removefunction mlxsw_sp_acl_atcam_region_entry_action_replacefunction __mlxsw_sp_acl_atcam_entry_addfunction __mlxsw_sp_acl_atcam_entry_delfunction __mlxsw_sp_acl_atcam_entry_action_replacefunction mlxsw_sp_acl_atcam_entry_addfunction mlxsw_sp_acl_atcam_entry_delfunction mlxsw_sp_acl_atcam_entry_action_replacefunction mlxsw_sp_acl_atcam_initfunction mlxsw_sp_acl_atcam_finifunction mlxsw_sp_acl_atcam_rehash_hints_getfunction mlxsw_sp_acl_atcam_rehash_hints_put
Annotated Snippet
struct mlxsw_sp_acl_atcam_lkey_id_ht_key {
char enc_key[MLXSW_REG_PTCEX_FLEX_KEY_BLOCKS_LEN]; /* MSB blocks */
u8 erp_id;
};
struct mlxsw_sp_acl_atcam_lkey_id {
struct rhash_head ht_node;
struct mlxsw_sp_acl_atcam_lkey_id_ht_key ht_key;
refcount_t refcnt;
u32 id;
};
struct mlxsw_sp_acl_atcam_region_ops {
int (*init)(struct mlxsw_sp_acl_atcam_region *aregion);
void (*fini)(struct mlxsw_sp_acl_atcam_region *aregion);
struct mlxsw_sp_acl_atcam_lkey_id *
(*lkey_id_get)(struct mlxsw_sp_acl_atcam_region *aregion,
char *enc_key, u8 erp_id);
void (*lkey_id_put)(struct mlxsw_sp_acl_atcam_region *aregion,
struct mlxsw_sp_acl_atcam_lkey_id *lkey_id);
};
struct mlxsw_sp_acl_atcam_region_generic {
struct mlxsw_sp_acl_atcam_lkey_id dummy_lkey_id;
};
struct mlxsw_sp_acl_atcam_region_12kb {
struct rhashtable lkey_ht;
unsigned int max_lkey_id;
unsigned long *used_lkey_id;
};
static const struct rhashtable_params mlxsw_sp_acl_atcam_lkey_id_ht_params = {
.key_len = sizeof(struct mlxsw_sp_acl_atcam_lkey_id_ht_key),
.key_offset = offsetof(struct mlxsw_sp_acl_atcam_lkey_id, ht_key),
.head_offset = offsetof(struct mlxsw_sp_acl_atcam_lkey_id, ht_node),
};
static const struct rhashtable_params mlxsw_sp_acl_atcam_entries_ht_params = {
.key_len = sizeof(struct mlxsw_sp_acl_atcam_entry_ht_key),
.key_offset = offsetof(struct mlxsw_sp_acl_atcam_entry, ht_key),
.head_offset = offsetof(struct mlxsw_sp_acl_atcam_entry, ht_node),
};
static bool
mlxsw_sp_acl_atcam_is_centry(const struct mlxsw_sp_acl_atcam_entry *aentry)
{
return mlxsw_sp_acl_erp_mask_is_ctcam(aentry->erp_mask);
}
static int
mlxsw_sp_acl_atcam_region_generic_init(struct mlxsw_sp_acl_atcam_region *aregion)
{
struct mlxsw_sp_acl_atcam_region_generic *region_generic;
region_generic = kzalloc_obj(*region_generic);
if (!region_generic)
return -ENOMEM;
refcount_set(®ion_generic->dummy_lkey_id.refcnt, 1);
aregion->priv = region_generic;
return 0;
}
static void
mlxsw_sp_acl_atcam_region_generic_fini(struct mlxsw_sp_acl_atcam_region *aregion)
{
kfree(aregion->priv);
}
static struct mlxsw_sp_acl_atcam_lkey_id *
mlxsw_sp_acl_atcam_generic_lkey_id_get(struct mlxsw_sp_acl_atcam_region *aregion,
char *enc_key, u8 erp_id)
{
struct mlxsw_sp_acl_atcam_region_generic *region_generic;
region_generic = aregion->priv;
return ®ion_generic->dummy_lkey_id;
}
static void
mlxsw_sp_acl_atcam_generic_lkey_id_put(struct mlxsw_sp_acl_atcam_region *aregion,
struct mlxsw_sp_acl_atcam_lkey_id *lkey_id)
{
}
static const struct mlxsw_sp_acl_atcam_region_ops
mlxsw_sp_acl_atcam_region_generic_ops = {
.init = mlxsw_sp_acl_atcam_region_generic_init,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/err.h`, `linux/errno.h`, `linux/gfp.h`, `linux/refcount.h`, `linux/rhashtable.h`, `trace/events/mlxsw.h`, `reg.h`.
- Detected declarations: `struct mlxsw_sp_acl_atcam_lkey_id_ht_key`, `struct mlxsw_sp_acl_atcam_lkey_id`, `struct mlxsw_sp_acl_atcam_region_ops`, `struct mlxsw_sp_acl_atcam_region_generic`, `struct mlxsw_sp_acl_atcam_region_12kb`, `function mlxsw_sp_acl_atcam_is_centry`, `function mlxsw_sp_acl_atcam_region_generic_init`, `function mlxsw_sp_acl_atcam_region_generic_fini`, `function mlxsw_sp_acl_atcam_generic_lkey_id_get`, `function mlxsw_sp_acl_atcam_generic_lkey_id_put`.
- 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.