drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c- Extension
.c- Size
- 42492 bytes
- Lines
- 1634
- 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/debugfs.hlinux/list.hlinux/ip.hlinux/ipv6.hlinux/tcp.hlinux/mlx5/fs.hlinux/mlx5/mpfs.hen_tc.hlib/mpfs.hen/ptp.hen/fs_ethtool.h
Detected Declarations
struct mlx5e_flow_steeringstruct mlx5e_l2_hash_nodestruct mlx5e_vlan_tableenum mlx5e_vlan_rule_typefunction mlx5e_hash_l2function mlx5e_add_l2_to_hashfunction hlist_for_each_entryfunction mlx5e_del_l2_from_hashfunction mlx5e_vport_context_update_vlansfunction __mlx5e_add_vlan_rulefunction mlx5e_add_vlan_rulefunction mlx5e_fs_del_vlan_rulefunction mlx5e_fs_del_any_vid_rulesfunction mlx5e_fs_add_any_vid_rulesfunction mlx5e_add_trap_rulefunction mlx5e_add_vlan_trapfunction mlx5e_remove_vlan_trapfunction mlx5e_add_mac_trapfunction mlx5e_remove_mac_trapfunction mlx5e_enable_cvlan_filterfunction mlx5e_disable_cvlan_filterfunction mlx5e_vlan_rx_add_cvidfunction mlx5e_vlan_rx_add_svidfunction mlx5e_fs_vlan_rx_add_vidfunction mlx5e_fs_vlan_rx_kill_vidfunction mlx5e_fs_add_vlan_rulesfunction for_each_set_bitfunction mlx5e_del_vlan_rulesfunction for_each_set_bitfunction hlist_for_each_entry_safefunction mlx5e_sync_netdev_addrfunction mlx5e_fill_addr_arrayfunction mlx5e_for_each_hash_nodefunction mlx5e_vport_context_update_addr_listfunction mlx5e_vport_context_updatefunction mlx5e_apply_netdev_addrfunction mlx5e_handle_netdev_addrfunction mlx5e_add_promisc_rulefunction mlx5e_create_promisc_tablefunction mlx5e_del_promisc_rulefunction mlx5e_destroy_promisc_tablefunction mlx5e_fs_set_rx_mode_workfunction mlx5e_destroy_groupsfunction mlx5e_fs_init_l2_addrfunction mlx5e_destroy_flow_tablefunction mlx5e_set_inner_ttc_paramsfunction mlx5e_ipsec_rss_supportedfunction mlx5e_set_ttc_params
Annotated Snippet
struct mlx5e_flow_steering {
struct work_struct set_rx_mode_work;
bool state_destroy;
bool vlan_strip_disable;
struct mlx5_core_dev *mdev;
struct mlx5_flow_namespace *ns;
struct mlx5_flow_namespace *egress_ns;
#ifdef CONFIG_MLX5_EN_RXNFC
struct mlx5e_ethtool_steering *ethtool;
#endif
struct mlx5e_tc_table *tc;
struct mlx5e_promisc_table promisc;
struct mlx5e_vlan_table *vlan;
struct mlx5e_l2_table l2;
struct mlx5_ttc_table *ttc;
struct mlx5_ttc_table *inner_ttc;
#ifdef CONFIG_MLX5_EN_ARFS
struct mlx5e_arfs_tables *arfs;
#endif
#ifdef CONFIG_MLX5_EN_TLS
struct mlx5e_accel_fs_tcp *accel_tcp;
#endif
struct mlx5e_fs_udp *udp;
struct mlx5e_fs_any *any;
struct mlx5e_ptp_fs *ptp_fs;
struct dentry *dfs_root;
};
static int mlx5e_add_l2_flow_rule(struct mlx5e_flow_steering *fs,
struct mlx5e_l2_rule *ai, int type);
static void mlx5e_del_l2_flow_rule(struct mlx5e_flow_steering *fs,
struct mlx5e_l2_rule *ai);
enum {
MLX5E_FULLMATCH = 0,
MLX5E_ALLMULTI = 1,
};
enum {
MLX5E_UC = 0,
MLX5E_MC_IPV4 = 1,
MLX5E_MC_IPV6 = 2,
MLX5E_MC_OTHER = 3,
};
enum {
MLX5E_ACTION_NONE = 0,
MLX5E_ACTION_ADD = 1,
MLX5E_ACTION_DEL = 2,
};
struct mlx5e_l2_hash_node {
struct hlist_node hlist;
u8 action;
struct mlx5e_l2_rule ai;
bool mpfs;
};
static inline int mlx5e_hash_l2(const u8 *addr)
{
return addr[5];
}
struct dentry *mlx5e_fs_get_debugfs_root(struct mlx5e_flow_steering *fs)
{
return fs->dfs_root;
}
static void mlx5e_add_l2_to_hash(struct hlist_head *hash, const u8 *addr)
{
struct mlx5e_l2_hash_node *hn;
int ix = mlx5e_hash_l2(addr);
int found = 0;
hlist_for_each_entry(hn, &hash[ix], hlist)
if (ether_addr_equal_64bits(hn->ai.addr, addr)) {
found = 1;
break;
}
if (found) {
hn->action = MLX5E_ACTION_NONE;
return;
}
hn = kzalloc_obj(*hn, GFP_ATOMIC);
if (!hn)
return;
ether_addr_copy(hn->ai.addr, addr);
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/list.h`, `linux/ip.h`, `linux/ipv6.h`, `linux/tcp.h`, `linux/mlx5/fs.h`, `linux/mlx5/mpfs.h`, `en_tc.h`.
- Detected declarations: `struct mlx5e_flow_steering`, `struct mlx5e_l2_hash_node`, `struct mlx5e_vlan_table`, `enum mlx5e_vlan_rule_type`, `function mlx5e_hash_l2`, `function mlx5e_add_l2_to_hash`, `function hlist_for_each_entry`, `function mlx5e_del_l2_from_hash`, `function mlx5e_vport_context_update_vlans`, `function __mlx5e_add_vlan_rule`.
- 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.