drivers/net/ethernet/mellanox/mlxsw/core.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/core.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/core.h- Extension
.h- Size
- 22222 bytes
- Lines
- 687
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/device.hlinux/slab.hlinux/gfp.hlinux/types.hlinux/skbuff.hlinux/workqueue.hlinux/net_namespace.hlinux/auxiliary_bus.hnet/devlink.htrap.hreg.hcmd.hresources.h../mlxfw/mlxfw.h
Detected Declarations
struct mlxsw_corestruct mlxsw_core_portstruct mlxsw_driverstruct mlxsw_busstruct mlxsw_bus_infostruct mlxsw_fw_revstruct mlxsw_tx_infostruct mlxsw_txhdr_infostruct mlxsw_rx_md_infostruct mlxsw_rx_listenerstruct mlxsw_event_listenerstruct mlxsw_listenerstruct mlxsw_rx_infostruct mlxsw_swid_configstruct mlxsw_config_profilestruct mlxsw_driverstruct mlxsw_busstruct mlxsw_fw_revstruct mlxsw_bus_infostruct mlxsw_hwmonstruct mlxsw_thermalstruct mlxsw_cqe_tsstruct mlxsw_skb_cbstruct mlxsw_linecardsstruct mlxsw_linecard_bdevstruct mlxsw_linecard_device_infostruct mlxsw_linecardstruct mlxsw_linecard_types_infostruct mlxsw_linecardsstruct mlxsw_linecards_event_opsenum mlxsw_core_resource_idenum mlxsw_devlink_param_idenum mlxsw_linecard_status_event_typefunction mlxsw_hwmon_initfunction mlxsw_hwmon_finifunction mlxsw_thermal_initfunction mlxsw_thermal_finifunction mlxsw_linecard_get
Annotated Snippet
struct mlxsw_tx_info {
u16 local_port;
bool is_emad;
};
struct mlxsw_txhdr_info {
struct mlxsw_tx_info tx_info;
bool data;
u16 max_fid; /* Used for PTP packets which are sent as data. */
};
struct mlxsw_rx_md_info {
struct napi_struct *napi;
u32 cookie_index;
u32 latency;
u32 tx_congestion;
union {
/* Valid when 'tx_port_valid' is set. */
u16 tx_sys_port;
u16 tx_lag_id;
};
u16 tx_lag_port_index; /* Valid when 'tx_port_is_lag' is set. */
u8 tx_tc;
u8 latency_valid:1,
tx_congestion_valid:1,
tx_tc_valid:1,
tx_port_valid:1,
tx_port_is_lag:1,
unused:3;
};
bool mlxsw_core_skb_transmit_busy(struct mlxsw_core *mlxsw_core,
const struct mlxsw_tx_info *tx_info);
int mlxsw_core_skb_transmit(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
const struct mlxsw_txhdr_info *txhdr_info);
void mlxsw_core_ptp_transmitted(struct mlxsw_core *mlxsw_core,
struct sk_buff *skb, u16 local_port);
struct mlxsw_rx_listener {
void (*func)(struct sk_buff *skb, u16 local_port, void *priv);
u16 local_port;
u8 mirror_reason;
u16 trap_id;
};
struct mlxsw_event_listener {
void (*func)(const struct mlxsw_reg_info *reg,
char *payload, void *priv);
enum mlxsw_event_trap_id trap_id;
};
struct mlxsw_listener {
u16 trap_id;
union {
struct mlxsw_rx_listener rx_listener;
struct mlxsw_event_listener event_listener;
};
enum mlxsw_reg_hpkt_action en_action; /* Action when enabled */
enum mlxsw_reg_hpkt_action dis_action; /* Action when disabled */
u8 en_trap_group; /* Trap group when enabled */
u8 dis_trap_group; /* Trap group when disabled */
u8 is_ctrl:1, /* should go via control buffer or not */
is_event:1,
enabled_on_register:1; /* Trap should be enabled when listener
* is registered.
*/
};
#define __MLXSW_RXL(_func, _trap_id, _en_action, _is_ctrl, _en_trap_group, \
_dis_action, _enabled_on_register, _dis_trap_group, \
_mirror_reason) \
{ \
.trap_id = MLXSW_TRAP_ID_##_trap_id, \
.rx_listener = \
{ \
.func = _func, \
.local_port = MLXSW_PORT_DONT_CARE, \
.mirror_reason = _mirror_reason, \
.trap_id = MLXSW_TRAP_ID_##_trap_id, \
}, \
.en_action = MLXSW_REG_HPKT_ACTION_##_en_action, \
.dis_action = MLXSW_REG_HPKT_ACTION_##_dis_action, \
.en_trap_group = MLXSW_REG_HTGT_TRAP_GROUP_##_en_trap_group, \
.dis_trap_group = MLXSW_REG_HTGT_TRAP_GROUP_##_dis_trap_group, \
.is_ctrl = _is_ctrl, \
.enabled_on_register = _enabled_on_register, \
}
#define MLXSW_RXL(_func, _trap_id, _en_action, _is_ctrl, _trap_group, \
_dis_action) \
Annotation
- Immediate include surface: `linux/module.h`, `linux/device.h`, `linux/slab.h`, `linux/gfp.h`, `linux/types.h`, `linux/skbuff.h`, `linux/workqueue.h`, `linux/net_namespace.h`.
- Detected declarations: `struct mlxsw_core`, `struct mlxsw_core_port`, `struct mlxsw_driver`, `struct mlxsw_bus`, `struct mlxsw_bus_info`, `struct mlxsw_fw_rev`, `struct mlxsw_tx_info`, `struct mlxsw_txhdr_info`, `struct mlxsw_rx_md_info`, `struct mlxsw_rx_listener`.
- 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.