drivers/net/ethernet/agere/et131x.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/agere/et131x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/agere/et131x.c- Extension
.c- Size
- 120536 bytes
- Lines
- 4102
- 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.
- 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.
- 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/pci.hlinux/module.hlinux/types.hlinux/kernel.hlinux/sched.hlinux/ptrace.hlinux/slab.hlinux/ctype.hlinux/string.hlinux/timer.hlinux/interrupt.hlinux/in.hlinux/delay.hlinux/bitops.hlinux/io.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/if_arp.hlinux/ioport.hlinux/crc32.hlinux/random.hlinux/phy.het131x.h
Detected Declarations
struct fbr_descstruct pkt_stat_descstruct rx_status_blockstruct fbr_lookupstruct rx_ringstruct tx_descstruct tcbstruct tx_ringstruct rfdstruct ce_statsstruct et131x_adapterfunction eeprom_wait_readyfunction eeprom_writefunction eeprom_readfunction et131x_init_eepromfunction et131x_rx_dma_enablefunction et131x_rx_dma_disablefunction et131x_tx_dma_enablefunction add_10bitfunction add_12bitfunction et1310_config_mac_regs1function et1310_config_mac_regs2function et1310_in_phy_comafunction et1310_setup_device_for_multicastfunction et1310_setup_device_for_unicastfunction et1310_config_rxmac_regsfunction et1310_config_txmac_regsfunction et1310_config_macstat_regsfunction et131x_phy_mii_readfunction et131x_mii_readfunction et131x_mii_writefunction et1310_phy_read_mii_bitfunction et1310_config_flow_controlfunction et1310_update_macstat_host_countersfunction et1310_handle_macstat_interruptfunction et131x_mdio_readfunction et131x_mdio_writefunction et1310_phy_power_switchfunction et131x_xcvr_initfunction et131x_configure_global_regsfunction et131x_config_rx_dma_regsfunction et131x_config_tx_dma_regsfunction et131x_adapter_setupfunction et131x_soft_resetfunction et131x_enable_interruptsfunction et131x_disable_interruptsfunction et131x_tx_dma_disablefunction et131x_enable_txrx
Annotated Snippet
static const struct net_device_ops et131x_netdev_ops = {
.ndo_open = et131x_open,
.ndo_stop = et131x_close,
.ndo_start_xmit = et131x_tx,
.ndo_set_rx_mode = et131x_multicast,
.ndo_tx_timeout = et131x_tx_timeout,
.ndo_change_mtu = et131x_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_get_stats = et131x_stats,
.ndo_eth_ioctl = phy_do_ioctl,
};
static int et131x_pci_setup(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct net_device *netdev;
struct et131x_adapter *adapter;
int rc;
rc = pci_enable_device(pdev);
if (rc < 0) {
dev_err(&pdev->dev, "pci_enable_device() failed\n");
goto out;
}
/* Perform some basic PCI checks */
if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
dev_err(&pdev->dev, "Can't find PCI device's base address\n");
rc = -ENODEV;
goto err_disable;
}
rc = pci_request_regions(pdev, DRIVER_NAME);
if (rc < 0) {
dev_err(&pdev->dev, "Can't get PCI resources\n");
goto err_disable;
}
pci_set_master(pdev);
/* Check the DMA addressing support of this device */
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (rc) {
dev_err(&pdev->dev, "No usable DMA addressing method\n");
goto err_release_res;
}
netdev = alloc_etherdev(sizeof(struct et131x_adapter));
if (!netdev) {
dev_err(&pdev->dev, "Couldn't alloc netdev struct\n");
rc = -ENOMEM;
goto err_release_res;
}
netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
netdev->netdev_ops = &et131x_netdev_ops;
netdev->min_mtu = ET131X_MIN_MTU;
netdev->max_mtu = ET131X_MAX_MTU;
SET_NETDEV_DEV(netdev, &pdev->dev);
netdev->ethtool_ops = &et131x_ethtool_ops;
adapter = et131x_adapter_init(netdev, pdev);
rc = et131x_pci_init(adapter, pdev);
if (rc < 0)
goto err_free_dev;
/* Map the bus-relative registers to system virtual memory */
adapter->regs = pci_ioremap_bar(pdev, 0);
if (!adapter->regs) {
dev_err(&pdev->dev, "Cannot map device registers\n");
rc = -ENOMEM;
goto err_free_dev;
}
/* If Phy COMA mode was enabled when we went down, disable it here. */
writel(ET_PMCSR_INIT, &adapter->regs->global.pm_csr);
et131x_soft_reset(adapter);
et131x_disable_interrupts(adapter);
rc = et131x_adapter_memory_alloc(adapter);
if (rc < 0) {
dev_err(&pdev->dev, "Could not alloc adapter memory (DMA)\n");
goto err_iounmap;
}
et131x_init_send(adapter);
Annotation
- Immediate include surface: `linux/pci.h`, `linux/module.h`, `linux/types.h`, `linux/kernel.h`, `linux/sched.h`, `linux/ptrace.h`, `linux/slab.h`, `linux/ctype.h`.
- Detected declarations: `struct fbr_desc`, `struct pkt_stat_desc`, `struct rx_status_block`, `struct fbr_lookup`, `struct rx_ring`, `struct tx_desc`, `struct tcb`, `struct tx_ring`, `struct rfd`, `struct ce_stats`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.