drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h- Extension
.h- Size
- 38009 bytes
- Lines
- 1123
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/if_ether.hlinux/if_link.hlinux/atomic.hlinux/wait.hlinux/xarray.hnet/devlink.hlinux/mlx5/device.hlinux/mlx5/eswitch.hlinux/mlx5/vport.hlinux/mlx5/fs.hlib/mpfs.hlib/fs_chains.hsf/sf.hen/tc_ct.hen/tc/sample.h
Detected Declarations
struct mlx5_mapped_objstruct mlx5_esw_pf_infostruct vport_ingressstruct vport_egressstruct mlx5_vport_drop_statsstruct mlx5_vport_infostruct mlx5_vportstruct mlx5_devlink_portstruct mlx5_vportstruct mlx5_esw_indir_tablestruct mlx5_eswitch_fdbstruct legacy_fdbstruct offloads_fdbstruct mlx5_esw_offloadstruct esw_mc_addrstruct mlx5_host_workstruct mlx5_esw_spfstruct mlx5_esw_functionsstruct mlx5_esw_bridge_offloadsstruct dentrystruct mlx5_qos_domainstruct mlx5_eswitchstruct mlx5_flow_specstruct mlx5_esw_flow_attrstruct mlx5_termtbl_handlestruct mlx5_esw_flow_attrstruct esw_vport_tbl_namespacestruct mlx5_vport_tbl_attrstruct mlx5_esw_event_infoenum mlx5_mapped_obj_typeenum vport_egress_acl_typeenum mlx5_eswitch_vport_eventenum mlx5_flow_match_levelfunction mlx5_devlink_port_initfunction esw_vst_mode_is_steeringfunction mlx5_eswitch_vlan_actions_supportedfunction mlx5_esw_allowedfunction mlx5_esw_is_manager_vportfunction mlx5_esw_is_ownerfunction mlx5_eswitch_first_host_vport_numfunction mlx5_eswitch_is_funcs_handlerfunction mlx5_esw_vport_to_devlink_port_indexfunction mlx5_esw_devlink_port_index_to_vport_numfunction mlx5_esw_is_fdb_createdfunction mlx5_eswitch_num_vfsfunction mlx5_eswitch_get_slow_fdbfunction mlx5_eswitch_initfunction mlx5_eswitch_cleanup
Annotated Snippet
struct mlx5_mapped_obj {
enum mlx5_mapped_obj_type type;
union {
u32 chain;
u64 act_miss_cookie;
struct {
u32 group_id;
u32 rate;
u32 trunc_size;
u32 tunnel_id;
} sample;
u32 int_port_metadata;
};
};
struct mlx5_esw_pf_info {
bool pf_not_exist;
bool pf_disabled;
u16 num_of_vfs;
u16 total_vfs;
u16 host_number;
u16 pf_num;
};
#ifdef CONFIG_MLX5_ESWITCH
#define ESW_OFFLOADS_DEFAULT_NUM_GROUPS 15
#define MLX5_MAX_UC_PER_VPORT(dev) \
(1 << MLX5_CAP_GEN(dev, log_max_current_uc_list))
#define MLX5_MAX_MC_PER_VPORT(dev) \
(1 << MLX5_CAP_GEN(dev, log_max_current_mc_list))
#define mlx5_esw_has_fwd_fdb(dev) \
MLX5_CAP_ESW_FLOWTABLE(dev, fdb_multi_path_to_table)
#define esw_chains(esw) \
((esw)->fdb_table.offloads.esw_chains_priv)
enum {
MAPPING_TYPE_CHAIN,
MAPPING_TYPE_TUNNEL,
MAPPING_TYPE_TUNNEL_ENC_OPTS,
MAPPING_TYPE_LABELS,
MAPPING_TYPE_ZONE,
MAPPING_TYPE_INT_PORT,
};
struct vport_ingress {
struct mlx5_flow_table *acl;
struct mlx5_flow_handle *allow_rule;
struct {
struct mlx5_flow_group *allow_spoofchk_only_grp;
struct mlx5_flow_group *allow_untagged_spoofchk_grp;
struct mlx5_flow_group *allow_untagged_only_grp;
struct mlx5_flow_group *drop_grp;
struct mlx5_flow_handle *drop_rule;
struct mlx5_fc *drop_counter;
} legacy;
struct {
/* Optional group to add an FTE to do internal priority
* tagging on ingress packets.
*/
struct mlx5_flow_group *metadata_prio_tag_grp;
/* Group to add default match-all FTE entry to tag ingress
* packet with metadata.
*/
struct mlx5_flow_group *metadata_allmatch_grp;
/* Optional group to add a drop all rule */
struct mlx5_flow_group *drop_grp;
struct mlx5_modify_hdr *modify_metadata;
struct mlx5_flow_handle *modify_metadata_rule;
struct mlx5_flow_handle *drop_rule;
} offloads;
};
enum vport_egress_acl_type {
VPORT_EGRESS_ACL_TYPE_DEFAULT,
VPORT_EGRESS_ACL_TYPE_SHARED_FDB,
};
struct vport_egress {
struct mlx5_flow_table *acl;
enum vport_egress_acl_type type;
struct mlx5_flow_handle *allowed_vlan;
struct mlx5_flow_group *vlan_grp;
union {
struct {
struct mlx5_flow_group *drop_grp;
Annotation
- Immediate include surface: `linux/if_ether.h`, `linux/if_link.h`, `linux/atomic.h`, `linux/wait.h`, `linux/xarray.h`, `net/devlink.h`, `linux/mlx5/device.h`, `linux/mlx5/eswitch.h`.
- Detected declarations: `struct mlx5_mapped_obj`, `struct mlx5_esw_pf_info`, `struct vport_ingress`, `struct vport_egress`, `struct mlx5_vport_drop_stats`, `struct mlx5_vport_info`, `struct mlx5_vport`, `struct mlx5_devlink_port`, `struct mlx5_vport`, `struct mlx5_esw_indir_table`.
- 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.