drivers/net/ethernet/marvell/prestera/prestera_acl.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/prestera/prestera_acl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/prestera/prestera_acl.c- Extension
.c- Size
- 22670 bytes
- Lines
- 928
- 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/rhashtable.hprestera_acl.hprestera_flow.hprestera_hw.hprestera.h
Detected Declarations
struct prestera_aclstruct prestera_acl_ruleset_ht_keystruct prestera_acl_rule_entrystruct prestera_acl_rulesetstruct prestera_acl_vtcamfunction prestera_acl_chain_to_clientfunction prestera_acl_chain_is_supportedfunction prestera_acl_ruleset_createfunction prestera_acl_ruleset_keymask_setfunction prestera_acl_ruleset_offloadfunction prestera_acl_ruleset_destroyfunction __prestera_acl_ruleset_lookupfunction prestera_acl_ruleset_lookupfunction prestera_acl_ruleset_getfunction prestera_acl_ruleset_putfunction prestera_acl_ruleset_bindfunction prestera_acl_ruleset_unbindfunction prestera_acl_ruleset_block_bindfunction prestera_acl_ruleset_block_unbindfunction prestera_acl_ruleset_prio_refreshfunction list_for_each_entryfunction prestera_acl_rule_keymask_pcl_id_setfunction prestera_acl_rule_lookupfunction prestera_acl_ruleset_index_getfunction prestera_acl_ruleset_prio_getfunction prestera_acl_ruleset_is_offloadfunction prestera_acl_rule_createfunction prestera_acl_rule_priority_setfunction prestera_acl_rule_destroyfunction prestera_acl_ruleset_prio_updatefunction prestera_acl_rule_addfunction prestera_acl_rule_delfunction prestera_acl_rule_get_statsfunction prestera_acl_rule_entry_findfunction __prestera_acl_rule_entry2hw_delfunction __prestera_acl_rule_entry2hw_addfunction __prestera_acl_rule_entry_act_destructfunction prestera_acl_rule_entry_destroyfunction __prestera_acl_rule_entry_act_constructfunction prestera_acl_rule_entry_createfunction __prestera_acl_vtcam_id_try_fitfunction list_for_each_entryfunction prestera_acl_vtcam_id_getfunction prestera_acl_vtcam_id_putfunction list_for_each_entryfunction prestera_acl_initfunction prestera_acl_fini
Annotated Snippet
struct prestera_acl {
struct prestera_switch *sw;
struct list_head vtcam_list;
struct list_head rules;
struct rhashtable ruleset_ht;
struct rhashtable acl_rule_entry_ht;
struct idr uid;
};
struct prestera_acl_ruleset_ht_key {
struct prestera_flow_block *block;
u32 chain_index;
};
struct prestera_acl_rule_entry {
struct rhash_head ht_node;
struct prestera_acl_rule_entry_key key;
u32 hw_id;
u32 vtcam_id;
struct {
struct {
u8 valid:1;
} accept, drop, trap;
struct {
u8 valid:1;
struct prestera_acl_action_police i;
} police;
struct {
struct prestera_acl_action_jump i;
u8 valid:1;
} jump;
struct {
u32 id;
struct prestera_counter_block *block;
} counter;
};
};
struct prestera_acl_ruleset {
struct rhash_head ht_node; /* Member of acl HT */
struct prestera_acl_ruleset_ht_key ht_key;
struct rhashtable rule_ht;
struct prestera_acl *acl;
struct {
u32 min;
u32 max;
} prio;
unsigned long rule_count;
refcount_t refcount;
void *keymask;
u32 vtcam_id;
u32 index;
u16 pcl_id;
bool offload;
bool ingress;
};
struct prestera_acl_vtcam {
struct list_head list;
__be32 keymask[__PRESTERA_ACL_RULE_MATCH_TYPE_MAX];
refcount_t refcount;
u32 id;
bool is_keymask_set;
u8 lookup;
u8 direction;
};
static const struct rhashtable_params prestera_acl_ruleset_ht_params = {
.key_len = sizeof(struct prestera_acl_ruleset_ht_key),
.key_offset = offsetof(struct prestera_acl_ruleset, ht_key),
.head_offset = offsetof(struct prestera_acl_ruleset, ht_node),
.automatic_shrinking = true,
};
static const struct rhashtable_params prestera_acl_rule_ht_params = {
.key_len = sizeof(unsigned long),
.key_offset = offsetof(struct prestera_acl_rule, cookie),
.head_offset = offsetof(struct prestera_acl_rule, ht_node),
.automatic_shrinking = true,
};
static const struct rhashtable_params __prestera_acl_rule_entry_ht_params = {
.key_offset = offsetof(struct prestera_acl_rule_entry, key),
.head_offset = offsetof(struct prestera_acl_rule_entry, ht_node),
.key_len = sizeof(struct prestera_acl_rule_entry_key),
.automatic_shrinking = true,
};
int prestera_acl_chain_to_client(u32 chain_index, bool ingress, u32 *client)
{
Annotation
- Immediate include surface: `linux/rhashtable.h`, `prestera_acl.h`, `prestera_flow.h`, `prestera_hw.h`, `prestera.h`.
- Detected declarations: `struct prestera_acl`, `struct prestera_acl_ruleset_ht_key`, `struct prestera_acl_rule_entry`, `struct prestera_acl_ruleset`, `struct prestera_acl_vtcam`, `function prestera_acl_chain_to_client`, `function prestera_acl_chain_is_supported`, `function prestera_acl_ruleset_create`, `function prestera_acl_ruleset_keymask_set`, `function prestera_acl_ruleset_offload`.
- 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.