drivers/net/ethernet/dec/tulip/de2104x.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/dec/tulip/de2104x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/dec/tulip/de2104x.c- Extension
.c- Size
- 54346 bytes
- Lines
- 2196
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/netdevice.hlinux/etherdevice.hlinux/init.hlinux/interrupt.hlinux/pci.hlinux/delay.hlinux/ethtool.hlinux/compiler.hlinux/rtnetlink.hlinux/crc32.hlinux/slab.hasm/io.hasm/irq.hlinux/uaccess.hlinux/unaligned.h
Detected Declarations
struct de_srom_media_blockstruct de_srom_info_leafstruct de_descstruct media_infostruct ring_infostruct de_privatefunction de_rx_err_acctfunction de_rxfunction de_interruptfunction de_txfunction de_start_xmitfunction build_setup_frame_hashfunction build_setup_frame_perfectfunction __de_set_rx_modefunction de_set_rx_modefunction de_rx_missedfunction __de_get_statsfunction de_is_runningfunction de_stop_rxtxfunction de_start_rxtxfunction de_stop_hwfunction de_link_upfunction de_link_downfunction de_set_mediafunction de_next_mediafunction de21040_media_timerfunction de_ok_to_advertisefunction de21041_media_timerfunction de_media_interruptfunction de_reset_macfunction de_adapter_wakefunction de_adapter_sleepfunction de_init_hwfunction de_refill_rxfunction de_init_ringsfunction de_alloc_ringsfunction de_clean_ringsfunction de_free_ringsfunction de_openfunction de_closefunction de_tx_timeoutfunction __de_get_regsfunction __de_get_link_ksettingsfunction __de_set_link_ksettingsfunction de_get_drvinfofunction de_get_regs_lenfunction de_get_link_ksettingsfunction de_set_link_ksettings
Annotated Snippet
static const struct net_device_ops de_netdev_ops = {
.ndo_open = de_open,
.ndo_stop = de_close,
.ndo_set_rx_mode = de_set_rx_mode,
.ndo_start_xmit = de_start_xmit,
.ndo_get_stats = de_get_stats,
.ndo_tx_timeout = de_tx_timeout,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
};
static int de_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct net_device *dev;
struct de_private *de;
int rc;
void __iomem *regs;
unsigned long pciaddr;
static int board_idx = -1;
board_idx++;
/* allocate a new ethernet device structure, and fill in defaults */
dev = alloc_etherdev(sizeof(struct de_private));
if (!dev)
return -ENOMEM;
dev->netdev_ops = &de_netdev_ops;
SET_NETDEV_DEV(dev, &pdev->dev);
dev->ethtool_ops = &de_ethtool_ops;
dev->watchdog_timeo = TX_TIMEOUT;
de = netdev_priv(dev);
de->de21040 = ent->driver_data == 0 ? 1 : 0;
de->pdev = pdev;
de->dev = dev;
de->msg_enable = (debug < 0 ? DE_DEF_MSG_ENABLE : debug);
de->board_idx = board_idx;
spin_lock_init (&de->lock);
timer_setup(&de->media_timer,
de->de21040 ? de21040_media_timer : de21041_media_timer,
0);
netif_carrier_off(dev);
/* wake up device, assign resources */
rc = pci_enable_device(pdev);
if (rc)
goto err_out_free;
/* reserve PCI resources to ensure driver atomicity */
rc = pci_request_regions(pdev, DRV_NAME);
if (rc)
goto err_out_disable;
/* check for invalid IRQ value */
if (pdev->irq < 2) {
rc = -EIO;
pr_err("invalid irq (%d) for pci dev %s\n",
pdev->irq, pci_name(pdev));
goto err_out_res;
}
/* obtain and check validity of PCI I/O address */
pciaddr = pci_resource_start(pdev, 1);
if (!pciaddr) {
rc = -EIO;
pr_err("no MMIO resource for pci dev %s\n", pci_name(pdev));
goto err_out_res;
}
if (pci_resource_len(pdev, 1) < DE_REGS_SIZE) {
rc = -EIO;
pr_err("MMIO resource (%llx) too small on pci dev %s\n",
(unsigned long long)pci_resource_len(pdev, 1),
pci_name(pdev));
goto err_out_res;
}
/* remap CSR registers */
regs = ioremap(pciaddr, DE_REGS_SIZE);
if (!regs) {
rc = -EIO;
pr_err("Cannot map PCI MMIO (%llx@%lx) on pci dev %s\n",
(unsigned long long)pci_resource_len(pdev, 1),
pciaddr, pci_name(pdev));
goto err_out_res;
}
de->regs = regs;
de_adapter_wake(de);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/init.h`, `linux/interrupt.h`, `linux/pci.h`, `linux/delay.h`.
- Detected declarations: `struct de_srom_media_block`, `struct de_srom_info_leaf`, `struct de_desc`, `struct media_info`, `struct ring_info`, `struct de_private`, `function de_rx_err_acct`, `function de_rx`, `function de_interrupt`, `function de_tx`.
- 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.