drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_actions.c- Extension
.c- Size
- 62230 bytes
- Lines
- 2259
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/types.hlinux/slab.hlinux/errno.hlinux/rhashtable.hlinux/list.hlinux/idr.hlinux/refcount.hnet/flow_offload.hitem.htrap.hcore_acl_flex_actions.h
Detected Declarations
struct mlxsw_afastruct mlxsw_afa_set_ht_keystruct mlxsw_afa_setstruct mlxsw_afa_fwd_entry_ht_keystruct mlxsw_afa_fwd_entrystruct mlxsw_afa_cookiestruct mlxsw_afa_policerstruct mlxsw_afa_blockstruct mlxsw_afa_resourcestruct mlxsw_afa_fwd_entry_refstruct mlxsw_afa_counterstruct mlxsw_afa_cookie_refstruct mlxsw_afa_policer_refstruct mlxsw_afa_mirrorstruct mlxsw_afa_samplerenum mlxsw_afa_set_typeenum mlxsw_afa_set_goto_binding_cmdenum mlxsw_afa_action_typeenum mlxsw_afa_vlan_vlan_tag_cmdenum mlxsw_afa_vlan_cmdenum mlxsw_afa_trap_trap_actionenum mlxsw_afa_trap_forward_actionenum mlxsw_afa_qos_ecn_cmdenum mlxsw_afa_qos_dscp_cmdenum mlxsw_afa_qos_switch_prio_cmdenum mlxsw_afa_qos_dscp_rwenum mlxsw_afa_forward_typeenum mlxsw_afa_polcnt_counter_set_typeenum mlxsw_afa_virfwd_fid_cmdenum mlxsw_afa_mcrouter_rpf_actionenum mlxsw_afa_mrouter_vrmidenum mlxsw_afa_ip_s_denum mlxsw_afa_ip_m_lenum mlxsw_afa_l4port_s_dfunction mlxsw_afa_cookie_hashfunction mlxsw_afa_cookie_key_hashfnfunction mlxsw_afa_cookie_obj_hashfnfunction mlxsw_afa_cookie_obj_cmpfnfunction mlxsw_afa_destroyfunction mlxsw_afa_set_goto_setfunction mlxsw_afa_set_next_setfunction mlxsw_afa_set_destroyfunction mlxsw_afa_set_sharefunction mlxsw_afa_set_unsharefunction mlxsw_afa_set_putfunction mlxsw_afa_resource_addfunction mlxsw_afa_resource_delfunction mlxsw_afa_resources_destroy
Annotated Snippet
struct mlxsw_afa {
unsigned int max_acts_per_set;
const struct mlxsw_afa_ops *ops;
void *ops_priv;
struct rhashtable set_ht;
struct rhashtable fwd_entry_ht;
struct rhashtable cookie_ht;
struct rhashtable policer_ht;
struct idr cookie_idr;
struct list_head policer_list;
};
#define MLXSW_AFA_SET_LEN 0xA8
struct mlxsw_afa_set_ht_key {
char enc_actions[MLXSW_AFA_SET_LEN]; /* Encoded set */
bool is_first;
};
/* Set structure holds one action set record. It contains up to three
* actions (depends on size of particular actions). The set is either
* put directly to a rule, or it is stored in KVD linear area.
* To prevent duplicate entries in KVD linear area, a hashtable is
* used to track sets that were previously inserted and may be shared.
*/
struct mlxsw_afa_set {
struct rhash_head ht_node;
struct mlxsw_afa_set_ht_key ht_key;
u32 kvdl_index;
u8 shared:1, /* Inserted in hashtable (doesn't mean that
* kvdl_index is valid).
*/
has_trap:1,
has_police:1;
refcount_t ref_count;
struct mlxsw_afa_set *next; /* Pointer to the next set. */
struct mlxsw_afa_set *prev; /* Pointer to the previous set,
* note that set may have multiple
* sets from multiple blocks
* pointing at it. This is only
* usable until commit.
*/
};
static const struct rhashtable_params mlxsw_afa_set_ht_params = {
.key_len = sizeof(struct mlxsw_afa_set_ht_key),
.key_offset = offsetof(struct mlxsw_afa_set, ht_key),
.head_offset = offsetof(struct mlxsw_afa_set, ht_node),
.automatic_shrinking = true,
};
struct mlxsw_afa_fwd_entry_ht_key {
u16 local_port;
};
struct mlxsw_afa_fwd_entry {
struct rhash_head ht_node;
struct mlxsw_afa_fwd_entry_ht_key ht_key;
u32 kvdl_index;
refcount_t ref_count;
};
static const struct rhashtable_params mlxsw_afa_fwd_entry_ht_params = {
.key_len = sizeof(struct mlxsw_afa_fwd_entry_ht_key),
.key_offset = offsetof(struct mlxsw_afa_fwd_entry, ht_key),
.head_offset = offsetof(struct mlxsw_afa_fwd_entry, ht_node),
.automatic_shrinking = true,
};
struct mlxsw_afa_cookie {
struct rhash_head ht_node;
refcount_t ref_count;
struct rcu_head rcu;
u32 cookie_index;
struct flow_action_cookie fa_cookie;
};
static u32 mlxsw_afa_cookie_hash(const struct flow_action_cookie *fa_cookie,
u32 seed)
{
return jhash2((u32 *) fa_cookie->cookie,
fa_cookie->cookie_len / sizeof(u32), seed);
}
static u32 mlxsw_afa_cookie_key_hashfn(const void *data, u32 len, u32 seed)
{
const struct flow_action_cookie *fa_cookie = data;
return mlxsw_afa_cookie_hash(fa_cookie, seed);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/slab.h`, `linux/errno.h`, `linux/rhashtable.h`, `linux/list.h`, `linux/idr.h`, `linux/refcount.h`.
- Detected declarations: `struct mlxsw_afa`, `struct mlxsw_afa_set_ht_key`, `struct mlxsw_afa_set`, `struct mlxsw_afa_fwd_entry_ht_key`, `struct mlxsw_afa_fwd_entry`, `struct mlxsw_afa_cookie`, `struct mlxsw_afa_policer`, `struct mlxsw_afa_block`, `struct mlxsw_afa_resource`, `struct mlxsw_afa_fwd_entry_ref`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.