drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c- Extension
.c- Size
- 64197 bytes
- Lines
- 2126
- 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
reg.hcore.hspectrum.hcore_env.h
Detected Declarations
struct mlxsw_sp_ethtool_link_ext_state_opcode_mappingstruct mlxsw_sp_port_hw_statsstruct mlxsw_sp_port_statsstruct mlxsw_sp1_port_link_modestruct mlxsw_sp2_port_link_modefunction mlxsw_sp_port_get_drvinfofunction mlxsw_sp_port_set_link_ext_statefunction mlxsw_sp_port_get_link_ext_statefunction mlxsw_sp_port_get_pauseparamfunction mlxsw_sp_port_pause_setfunction mlxsw_sp_port_set_pauseparamfunction mlxsw_sp_port_get_transceiver_overheat_statsfunction mlxsw_sp_port_get_prio_stringsfunction mlxsw_sp_port_get_tc_stringsfunction mlxsw_sp_port_get_stringsfunction mlxsw_sp_port_set_phys_idfunction mlxsw_sp_get_hw_stats_by_groupfunction __mlxsw_sp_port_get_statsfunction __mlxsw_sp_port_get_env_statsfunction mlxsw_sp_port_get_statsfunction mlxsw_sp_port_get_sset_countfunction mlxsw_sp_port_get_link_supportedfunction mlxsw_sp_port_get_link_advertisefunction mlxsw_sp_port_connector_portfunction mlxsw_sp_port_ptys_queryfunction mlxsw_sp_port_get_link_ksettingsfunction mlxsw_sp_port_set_link_ksettingsfunction mlxsw_sp_get_module_infofunction mlxsw_sp_get_module_eepromfunction mlxsw_sp_get_module_eeprom_by_pagefunction mlxsw_sp_set_module_eeprom_by_pagefunction mlxsw_sp_get_ts_infofunction mlxsw_sp_get_eth_phy_statsfunction mlxsw_sp_get_eth_mac_statsfunction mlxsw_sp_get_eth_ctrl_statsfunction mlxsw_sp_get_rmon_statsfunction mlxsw_sp_resetfunction mlxsw_sp_get_module_power_modefunction mlxsw_sp_set_module_power_modefunction mlxsw_sp1_from_ptys_supported_portfunction mlxsw_sp1_from_ptys_linkfunction mlxsw_sp1_from_ptys_speedfunction mlxsw_sp1_from_ptys_link_modefunction mlxsw_sp1_ptys_max_speedfunction mlxsw_sp1_to_ptys_advert_linkfunction mlxsw_sp1_to_ptys_speed_lanesfunction mlxsw_sp1_reg_ptys_eth_packfunction mlxsw_sp1_reg_ptys_eth_unpack
Annotated Snippet
struct mlxsw_sp_ethtool_link_ext_state_opcode_mapping {
u32 status_opcode;
enum ethtool_link_ext_state link_ext_state;
u8 link_ext_substate;
};
static const struct mlxsw_sp_ethtool_link_ext_state_opcode_mapping
mlxsw_sp_link_ext_state_opcode_map[] = {
{2, ETHTOOL_LINK_EXT_STATE_AUTONEG,
ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED},
{3, ETHTOOL_LINK_EXT_STATE_AUTONEG,
ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED},
{4, ETHTOOL_LINK_EXT_STATE_AUTONEG,
ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED},
{36, ETHTOOL_LINK_EXT_STATE_AUTONEG,
ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE},
{38, ETHTOOL_LINK_EXT_STATE_AUTONEG,
ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE},
{39, ETHTOOL_LINK_EXT_STATE_AUTONEG,
ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD},
{5, ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE,
ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED},
{6, ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE,
ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT},
{7, ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE,
ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY},
{8, ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE, 0},
{14, ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE,
ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT},
{9, ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH,
ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK},
{10, ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH,
ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK},
{11, ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH,
ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS},
{12, ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH,
ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED},
{13, ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH,
ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED},
{15, ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY, 0},
{17, ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY,
ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS},
{42, ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY,
ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE},
{1024, ETHTOOL_LINK_EXT_STATE_NO_CABLE, 0},
{16, ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE,
ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE},
{20, ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE,
ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE},
{29, ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE,
ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE},
{1025, ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE,
ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE},
{1029, ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE,
ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE},
{1031, ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE, 0},
{1027, ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE, 0},
{23, ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE, 0},
{1032, ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED, 0},
{1030, ETHTOOL_LINK_EXT_STATE_OVERHEAT, 0},
{1042, ETHTOOL_LINK_EXT_STATE_MODULE,
ETHTOOL_LINK_EXT_SUBSTATE_MODULE_CMIS_NOT_READY},
};
static void
mlxsw_sp_port_set_link_ext_state(struct mlxsw_sp_ethtool_link_ext_state_opcode_mapping
link_ext_state_mapping,
struct ethtool_link_ext_state_info *link_ext_state_info)
{
switch (link_ext_state_mapping.link_ext_state) {
case ETHTOOL_LINK_EXT_STATE_AUTONEG:
link_ext_state_info->autoneg =
link_ext_state_mapping.link_ext_substate;
break;
case ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE:
link_ext_state_info->link_training =
link_ext_state_mapping.link_ext_substate;
break;
case ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH:
link_ext_state_info->link_logical_mismatch =
Annotation
- Immediate include surface: `reg.h`, `core.h`, `spectrum.h`, `core_env.h`.
- Detected declarations: `struct mlxsw_sp_ethtool_link_ext_state_opcode_mapping`, `struct mlxsw_sp_port_hw_stats`, `struct mlxsw_sp_port_stats`, `struct mlxsw_sp1_port_link_mode`, `struct mlxsw_sp2_port_link_mode`, `function mlxsw_sp_port_get_drvinfo`, `function mlxsw_sp_port_set_link_ext_state`, `function mlxsw_sp_port_get_link_ext_state`, `function mlxsw_sp_port_get_pauseparam`, `function mlxsw_sp_port_pause_set`.
- 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.