drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c- Extension
.c- Size
- 40773 bytes
- Lines
- 1625
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/module.hlinux/kmod.hlinux/mdio.hlinux/phy.hlinux/of.hlinux/bitops.hlinux/jiffies.hxgbe.hxgbe-common.h
Detected Declarations
function Copyrightfunction xgbe_phy_module_infofunction xgbe_an37_clear_interruptsfunction xgbe_an37_disable_interruptsfunction xgbe_an37_enable_interruptsfunction xgbe_an73_clear_interruptsfunction xgbe_an73_disable_interruptsfunction xgbe_an73_enable_interruptsfunction xgbe_an_enable_interruptsfunction xgbe_an_clear_interrupts_allfunction xgbe_kr_modefunction xgbe_kx_2500_modefunction xgbe_kx_1000_modefunction xgbe_sfi_modefunction xgbe_x_modefunction xgbe_sgmii_1000_modefunction xgbe_sgmii_10_modefunction xgbe_sgmii_100_modefunction xgbe_cur_modefunction xgbe_in_kr_modefunction xgbe_change_modefunction xgbe_switch_modefunction xgbe_set_modefunction xgbe_use_modefunction xgbe_an37_setfunction xgbe_an37_restartfunction xgbe_an37_disablefunction xgbe_an73_setfunction xgbe_an73_restartfunction xgbe_an73_disablefunction xgbe_an_restartfunction xgbe_an_disablefunction xgbe_an_disable_allfunction xgbe_an73_tx_trainingfunction xgbe_an73_tx_xnpfunction xgbe_an73_rx_bpafunction xgbe_an73_rx_xnpfunction xgbe_an73_page_receivedfunction xgbe_an73_incompat_linkfunction xgbe_an37_isrfunction xgbe_an73_isrfunction xgbe_an_isr_bh_workfunction xgbe_an_isrfunction xgbe_an_combined_isrfunction xgbe_an_irq_workfunction xgbe_an37_state_machinefunction xgbe_an73_state_machinefunction xgbe_an_state_machine
Annotated Snippet
if (time_after(jiffies, an_timeout)) {
/* Auto-negotiation timed out, reset state */
pdata->kr_state = XGBE_RX_BPA;
pdata->kx_state = XGBE_RX_BPA;
pdata->an_start = jiffies;
netif_dbg(pdata, link, pdata->netdev,
"CL73 AN timed out, resetting state\n");
}
}
state = xgbe_in_kr_mode(pdata) ? &pdata->kr_state
: &pdata->kx_state;
switch (*state) {
case XGBE_RX_BPA:
ret = xgbe_an73_rx_bpa(pdata, state);
break;
case XGBE_RX_XNP:
ret = xgbe_an73_rx_xnp(pdata, state);
break;
default:
ret = XGBE_AN_ERROR;
}
return ret;
}
static enum xgbe_an xgbe_an73_incompat_link(struct xgbe_prv_data *pdata)
{
struct ethtool_link_ksettings *lks = &pdata->phy.lks;
/* Be sure we aren't looping trying to negotiate */
if (xgbe_in_kr_mode(pdata)) {
pdata->kr_state = XGBE_RX_ERROR;
if (!XGBE_ADV(lks, 1000baseKX_Full) &&
!XGBE_ADV(lks, 2500baseX_Full))
return XGBE_AN_NO_LINK;
if (pdata->kx_state != XGBE_RX_BPA)
return XGBE_AN_NO_LINK;
} else {
pdata->kx_state = XGBE_RX_ERROR;
if (!XGBE_ADV(lks, 10000baseKR_Full))
return XGBE_AN_NO_LINK;
if (pdata->kr_state != XGBE_RX_BPA)
return XGBE_AN_NO_LINK;
}
xgbe_an_disable(pdata);
xgbe_switch_mode(pdata);
pdata->an_result = XGBE_AN_READY;
xgbe_an_restart(pdata);
return XGBE_AN_INCOMPAT_LINK;
}
static void xgbe_an37_isr(struct xgbe_prv_data *pdata)
{
unsigned int reg;
/* Disable AN interrupts */
xgbe_an37_disable_interrupts(pdata);
/* Save the interrupt(s) that fired */
reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_VEND2_AN_STAT);
pdata->an_int = reg & XGBE_AN_CL37_INT_MASK;
pdata->an_status = reg & ~XGBE_AN_CL37_INT_MASK;
if (pdata->an_int) {
/* Clear the interrupt(s) that fired and process them */
reg &= ~XGBE_AN_CL37_INT_MASK;
XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_VEND2_AN_STAT, reg);
queue_work(pdata->an_workqueue, &pdata->an_irq_work);
} else {
/* Enable AN interrupts */
xgbe_an37_enable_interrupts(pdata);
/* Reissue interrupt if status is not clear */
if (pdata->vdata->irq_reissue_support)
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/module.h`, `linux/kmod.h`, `linux/mdio.h`, `linux/phy.h`, `linux/of.h`, `linux/bitops.h`, `linux/jiffies.h`.
- Detected declarations: `function Copyright`, `function xgbe_phy_module_info`, `function xgbe_an37_clear_interrupts`, `function xgbe_an37_disable_interrupts`, `function xgbe_an37_enable_interrupts`, `function xgbe_an73_clear_interrupts`, `function xgbe_an73_disable_interrupts`, `function xgbe_an73_enable_interrupts`, `function xgbe_an_enable_interrupts`, `function xgbe_an_clear_interrupts_all`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.