drivers/net/ethernet/sfc/siena/mcdi_port_common.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/siena/mcdi_port_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/siena/mcdi_port_common.c- Extension
.c- Size
- 37555 bytes
- Lines
- 1283
- 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.
- 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
mcdi_port_common.hefx_common.hnic.h
Detected Declarations
enum efx_stats_actionfunction efx_mcdi_get_phy_cfgfunction efx_siena_link_set_advertisingfunction efx_mcdi_set_linkfunction efx_mcdi_loopback_modesfunction mcdi_to_ethtool_linksetfunction ethtool_linkset_to_mcdi_capfunction efx_get_mcdi_phy_flagsfunction mcdi_to_ethtool_mediafunction efx_mcdi_phy_decode_linkfunction BASERfunction mcdi_fec_caps_to_ethtoolfunction efx_mcdi_phy_check_fcntlfunction efx_siena_mcdi_phy_pollfunction efx_siena_mcdi_phy_probefunction efx_siena_mcdi_phy_removefunction efx_siena_mcdi_phy_get_link_ksettingsfunction efx_siena_mcdi_phy_set_link_ksettingsfunction efx_siena_mcdi_phy_get_fecparamfunction ethtool_fec_supportedfunction efx_siena_mcdi_phy_set_fecparamfunction efx_siena_mcdi_phy_test_alivefunction efx_siena_mcdi_port_reconfigurefunction efx_mcdi_bistfunction efx_siena_mcdi_phy_run_testsfunction efx_mcdi_phy_get_module_eeprom_pagefunction efx_mcdi_phy_get_module_eeprom_bytefunction efx_mcdi_phy_diag_typefunction efx_mcdi_phy_sff_8472_levelfunction efx_mcdi_phy_module_typefunction efx_siena_mcdi_phy_get_module_eepromfunction efx_siena_mcdi_phy_get_module_infofunction efx_calc_mac_mtufunction efx_siena_mcdi_set_macfunction efx_mcdi_mac_statsfunction efx_siena_mcdi_mac_start_statsfunction efx_siena_mcdi_mac_stop_statsfunction efx_siena_mcdi_mac_pull_statsfunction efx_siena_mcdi_mac_init_statsfunction efx_siena_mcdi_mac_fini_statsfunction efx_siena_mcdi_process_link_change
Annotated Snippet
if (cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN)) {
SET_BIT(1000baseT_Full);
SET_BIT(1000baseX_Full);
}
if (cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN)) {
SET_BIT(10000baseCR_Full);
SET_BIT(10000baseLR_Full);
SET_BIT(10000baseSR_Full);
}
if (cap & (1 << MC_CMD_PHY_CAP_40000FDX_LBN)) {
SET_BIT(40000baseCR4_Full);
SET_BIT(40000baseSR4_Full);
}
if (cap & (1 << MC_CMD_PHY_CAP_100000FDX_LBN)) {
SET_BIT(100000baseCR4_Full);
SET_BIT(100000baseSR4_Full);
}
if (cap & (1 << MC_CMD_PHY_CAP_25000FDX_LBN)) {
SET_BIT(25000baseCR_Full);
SET_BIT(25000baseSR_Full);
}
if (cap & (1 << MC_CMD_PHY_CAP_50000FDX_LBN))
SET_BIT(50000baseCR2_Full);
break;
case MC_CMD_MEDIA_BASE_T:
SET_BIT(TP);
if (cap & (1 << MC_CMD_PHY_CAP_10HDX_LBN))
SET_BIT(10baseT_Half);
if (cap & (1 << MC_CMD_PHY_CAP_10FDX_LBN))
SET_BIT(10baseT_Full);
if (cap & (1 << MC_CMD_PHY_CAP_100HDX_LBN))
SET_BIT(100baseT_Half);
if (cap & (1 << MC_CMD_PHY_CAP_100FDX_LBN))
SET_BIT(100baseT_Full);
if (cap & (1 << MC_CMD_PHY_CAP_1000HDX_LBN))
SET_BIT(1000baseT_Half);
if (cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN))
SET_BIT(1000baseT_Full);
if (cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN))
SET_BIT(10000baseT_Full);
break;
}
if (cap & (1 << MC_CMD_PHY_CAP_PAUSE_LBN))
SET_BIT(Pause);
if (cap & (1 << MC_CMD_PHY_CAP_ASYM_LBN))
SET_BIT(Asym_Pause);
if (cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
SET_BIT(Autoneg);
#undef SET_BIT
}
static u32 ethtool_linkset_to_mcdi_cap(const unsigned long *linkset)
{
u32 result = 0;
#define TEST_BIT(name) test_bit(ETHTOOL_LINK_MODE_ ## name ## _BIT, \
linkset)
if (TEST_BIT(10baseT_Half))
result |= (1 << MC_CMD_PHY_CAP_10HDX_LBN);
if (TEST_BIT(10baseT_Full))
result |= (1 << MC_CMD_PHY_CAP_10FDX_LBN);
if (TEST_BIT(100baseT_Half))
result |= (1 << MC_CMD_PHY_CAP_100HDX_LBN);
if (TEST_BIT(100baseT_Full))
result |= (1 << MC_CMD_PHY_CAP_100FDX_LBN);
if (TEST_BIT(1000baseT_Half))
result |= (1 << MC_CMD_PHY_CAP_1000HDX_LBN);
if (TEST_BIT(1000baseT_Full) || TEST_BIT(1000baseKX_Full) ||
TEST_BIT(1000baseX_Full))
result |= (1 << MC_CMD_PHY_CAP_1000FDX_LBN);
if (TEST_BIT(10000baseT_Full) || TEST_BIT(10000baseKX4_Full) ||
TEST_BIT(10000baseCR_Full) || TEST_BIT(10000baseLR_Full) ||
TEST_BIT(10000baseSR_Full))
result |= (1 << MC_CMD_PHY_CAP_10000FDX_LBN);
if (TEST_BIT(40000baseCR4_Full) || TEST_BIT(40000baseKR4_Full) ||
TEST_BIT(40000baseSR4_Full))
result |= (1 << MC_CMD_PHY_CAP_40000FDX_LBN);
if (TEST_BIT(100000baseCR4_Full) || TEST_BIT(100000baseSR4_Full))
result |= (1 << MC_CMD_PHY_CAP_100000FDX_LBN);
if (TEST_BIT(25000baseCR_Full) || TEST_BIT(25000baseSR_Full))
result |= (1 << MC_CMD_PHY_CAP_25000FDX_LBN);
if (TEST_BIT(50000baseCR2_Full))
result |= (1 << MC_CMD_PHY_CAP_50000FDX_LBN);
if (TEST_BIT(Pause))
result |= (1 << MC_CMD_PHY_CAP_PAUSE_LBN);
if (TEST_BIT(Asym_Pause))
Annotation
- Immediate include surface: `mcdi_port_common.h`, `efx_common.h`, `nic.h`.
- Detected declarations: `enum efx_stats_action`, `function efx_mcdi_get_phy_cfg`, `function efx_siena_link_set_advertising`, `function efx_mcdi_set_link`, `function efx_mcdi_loopback_modes`, `function mcdi_to_ethtool_linkset`, `function ethtool_linkset_to_mcdi_cap`, `function efx_get_mcdi_phy_flags`, `function mcdi_to_ethtool_media`, `function efx_mcdi_phy_decode_link`.
- 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.