drivers/net/ethernet/mellanox/mlxsw/minimal.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/minimal.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/minimal.c- Extension
.c- Size
- 20301 bytes
- Lines
- 758
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/netdevice.hlinux/etherdevice.hlinux/ethtool.hlinux/i2c.hlinux/kernel.hlinux/module.hlinux/mod_devicetable.hlinux/types.hcore.hcore_env.hi2c.h
Detected Declarations
struct mlxsw_m_portstruct mlxsw_m_line_cardstruct mlxsw_mstruct mlxsw_m_portfunction mlxsw_m_base_mac_getfunction mlxsw_m_port_openfunction mlxsw_m_port_stopfunction mlxsw_m_module_get_drvinfofunction mlxsw_m_get_module_infofunction mlxsw_m_get_module_eepromfunction mlxsw_m_get_module_eeprom_by_pagefunction mlxsw_m_set_module_eeprom_by_pagefunction mlxsw_m_resetfunction mlxsw_m_get_module_power_modefunction mlxsw_m_set_module_power_modefunction mlxsw_m_port_module_info_getfunction mlxsw_m_port_dev_addr_getfunction mlxsw_m_port_createdfunction mlxsw_m_port_createfunction mlxsw_m_port_removefunction mlxsw_m_port_mapping_getfunction mlxsw_m_port_module_mapfunction mlxsw_m_port_module_unmapfunction mlxsw_m_linecards_initfunction mlxsw_m_linecards_finifunction mlxsw_m_linecard_port_module_unmapfunction mlxsw_m_linecard_ports_createfunction mlxsw_m_linecard_ports_removefunction mlxsw_m_ports_module_mapfunction mlxsw_m_ports_createfunction mlxsw_m_ports_removefunction mlxsw_m_ports_remove_selectedfunction mlxsw_m_fw_rev_validatefunction mlxsw_m_got_activefunction mlxsw_m_got_inactivefunction mlxsw_m_initfunction mlxsw_m_finifunction mlxsw_m_module_initfunction mlxsw_m_module_exitmodule init mlxsw_m_module_init
Annotated Snippet
static const struct net_device_ops mlxsw_m_port_netdev_ops = {
.ndo_open = mlxsw_m_port_open,
.ndo_stop = mlxsw_m_port_stop,
};
static void mlxsw_m_module_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo)
{
struct mlxsw_m_port *mlxsw_m_port = netdev_priv(dev);
struct mlxsw_m *mlxsw_m = mlxsw_m_port->mlxsw_m;
strscpy(drvinfo->driver, mlxsw_m->bus_info->device_kind,
sizeof(drvinfo->driver));
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
"%d.%d.%d",
mlxsw_m->bus_info->fw_rev.major,
mlxsw_m->bus_info->fw_rev.minor,
mlxsw_m->bus_info->fw_rev.subminor);
strscpy(drvinfo->bus_info, mlxsw_m->bus_info->device_name,
sizeof(drvinfo->bus_info));
}
static int mlxsw_m_get_module_info(struct net_device *netdev,
struct ethtool_modinfo *modinfo)
{
struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core;
return mlxsw_env_get_module_info(netdev, core,
mlxsw_m_port->slot_index,
mlxsw_m_port->module, modinfo);
}
static int
mlxsw_m_get_module_eeprom(struct net_device *netdev, struct ethtool_eeprom *ee,
u8 *data)
{
struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core;
return mlxsw_env_get_module_eeprom(netdev, core,
mlxsw_m_port->slot_index,
mlxsw_m_port->module, ee, data);
}
static int
mlxsw_m_get_module_eeprom_by_page(struct net_device *netdev,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack)
{
struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core;
return mlxsw_env_get_module_eeprom_by_page(core,
mlxsw_m_port->slot_index,
mlxsw_m_port->module,
page, extack);
}
static int
mlxsw_m_set_module_eeprom_by_page(struct net_device *netdev,
const struct ethtool_module_eeprom *page,
struct netlink_ext_ack *extack)
{
struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core;
return mlxsw_env_set_module_eeprom_by_page(core,
mlxsw_m_port->slot_index,
mlxsw_m_port->module,
page, extack);
}
static int mlxsw_m_reset(struct net_device *netdev, u32 *flags)
{
struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core;
return mlxsw_env_reset_module(netdev, core, mlxsw_m_port->slot_index,
mlxsw_m_port->module,
flags);
}
static int
mlxsw_m_get_module_power_mode(struct net_device *netdev,
struct ethtool_module_power_mode_params *params,
struct netlink_ext_ack *extack)
{
struct mlxsw_m_port *mlxsw_m_port = netdev_priv(netdev);
struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core;
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/types.h`.
- Detected declarations: `struct mlxsw_m_port`, `struct mlxsw_m_line_card`, `struct mlxsw_m`, `struct mlxsw_m_port`, `function mlxsw_m_base_mac_get`, `function mlxsw_m_port_open`, `function mlxsw_m_port_stop`, `function mlxsw_m_module_get_drvinfo`, `function mlxsw_m_get_module_info`, `function mlxsw_m_get_module_eeprom`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.