drivers/net/ethernet/atheros/atlx/atl2.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/atheros/atlx/atl2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/atheros/atlx/atl2.c- Extension
.c- Size
- 79684 bytes
- Lines
- 3000
- 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/atomic.hlinux/crc32.hlinux/dma-mapping.hlinux/etherdevice.hlinux/ethtool.hlinux/hardirq.hlinux/if_vlan.hlinux/in.hlinux/interrupt.hlinux/ip.hlinux/irqflags.hlinux/irqreturn.hlinux/mii.hlinux/net.hlinux/netdevice.hlinux/pci.hlinux/pci_ids.hlinux/pm.hlinux/skbuff.hlinux/slab.hlinux/spinlock.hlinux/string.hlinux/tcp.hlinux/timer.hlinux/types.hlinux/workqueue.hatl2.h
Detected Declarations
struct atl2_optionstruct atl2_opt_listfunction settingsfunction atl2_set_multifunction init_ring_ptrsfunction atl2_configurefunction atl2_setup_ring_resourcesfunction atl2_irq_enablefunction atl2_irq_disablefunction __atl2_vlan_modefunction atl2_vlan_modefunction atl2_restore_vlanfunction atl2_fix_featuresfunction atl2_set_featuresfunction atl2_intr_rxfunction atl2_intr_txfunction atl2_check_for_linkfunction atl2_clear_phy_intfunction atl2_intrfunction atl2_request_irqfunction atl2_free_ring_resourcesfunction systemfunction atl2_downfunction atl2_free_irqfunction atl2_closefunction TxsFreeUnitfunction TxdFreeBytesfunction atl2_xmit_framefunction atl2_change_mtufunction atl2_set_macfunction atl2_mii_ioctlfunction atl2_ioctlfunction atl2_tx_timeoutfunction atl2_watchdogfunction atl2_phy_configfunction atl2_upfunction atl2_reinit_lockedfunction atl2_reset_taskfunction atl2_setup_mac_ctrlfunction atl2_check_linkfunction atl2_link_chg_taskfunction atl2_setup_pcicmdfunction atl2_poll_controllerfunction atl2_probefunction dma_set_coherent_maskfunction atl2_removefunction atl2_suspendfunction atl2_resume
Annotated Snippet
static const struct net_device_ops atl2_netdev_ops = {
.ndo_open = atl2_open,
.ndo_stop = atl2_close,
.ndo_start_xmit = atl2_xmit_frame,
.ndo_set_rx_mode = atl2_set_multi,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = atl2_set_mac,
.ndo_change_mtu = atl2_change_mtu,
.ndo_fix_features = atl2_fix_features,
.ndo_set_features = atl2_set_features,
.ndo_eth_ioctl = atl2_ioctl,
.ndo_tx_timeout = atl2_tx_timeout,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = atl2_poll_controller,
#endif
};
/**
* atl2_probe - Device Initialization Routine
* @pdev: PCI device information struct
* @ent: entry in atl2_pci_tbl
*
* Returns 0 on success, negative on failure
*
* atl2_probe initializes an adapter identified by a pci_dev structure.
* The OS initialization, configuring of the adapter private structure,
* and a hardware reset occur.
*/
static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct net_device *netdev;
struct atl2_adapter *adapter;
static int cards_found = 0;
unsigned long mmio_start;
int mmio_len;
int err;
err = pci_enable_device(pdev);
if (err)
return err;
/*
* atl2 is a shared-high-32-bit device, so we're stuck with 32-bit DMA
* until the kernel has the proper infrastructure to support 64-bit DMA
* on these devices.
*/
if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)) &&
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32))) {
printk(KERN_ERR "atl2: No usable DMA configuration, aborting\n");
err = -EIO;
goto err_dma;
}
/* Mark all PCI regions associated with PCI device
* pdev as being reserved by owner atl2_driver_name */
err = pci_request_regions(pdev, atl2_driver_name);
if (err)
goto err_pci_reg;
/* Enables bus-mastering on the device and calls
* pcibios_set_master to do the needed arch specific settings */
pci_set_master(pdev);
netdev = alloc_etherdev(sizeof(struct atl2_adapter));
if (!netdev) {
err = -ENOMEM;
goto err_alloc_etherdev;
}
SET_NETDEV_DEV(netdev, &pdev->dev);
pci_set_drvdata(pdev, netdev);
adapter = netdev_priv(netdev);
adapter->netdev = netdev;
adapter->pdev = pdev;
adapter->hw.back = adapter;
mmio_start = pci_resource_start(pdev, 0x0);
mmio_len = pci_resource_len(pdev, 0x0);
adapter->hw.mem_rang = (u32)mmio_len;
adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
if (!adapter->hw.hw_addr) {
err = -EIO;
goto err_ioremap;
}
atl2_setup_pcicmd(pdev);
netdev->netdev_ops = &atl2_netdev_ops;
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/crc32.h`, `linux/dma-mapping.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/hardirq.h`, `linux/if_vlan.h`, `linux/in.h`.
- Detected declarations: `struct atl2_option`, `struct atl2_opt_list`, `function settings`, `function atl2_set_multi`, `function init_ring_ptrs`, `function atl2_configure`, `function atl2_setup_ring_resources`, `function atl2_irq_enable`, `function atl2_irq_disable`, `function __atl2_vlan_mode`.
- 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.