drivers/net/ethernet/sgi/ioc3-eth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sgi/ioc3-eth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sgi/ioc3-eth.c- Extension
.c- Size
- 33876 bytes
- Lines
- 1287
- 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/delay.hlinux/kernel.hlinux/mm.hlinux/errno.hlinux/module.hlinux/init.hlinux/crc16.hlinux/crc32.hlinux/mii.hlinux/in.hlinux/io.hlinux/ip.hlinux/tcp.hlinux/udp.hlinux/gfp.hlinux/netdevice.hlinux/etherdevice.hlinux/ethtool.hlinux/skbuff.hlinux/dma-mapping.hlinux/platform_device.hlinux/nvmem-consumer.hnet/ip.hasm/sn/ioc3.hasm/pci/bridge.h
Detected Declarations
struct ioc3_privatefunction aligned_rx_skb_addrfunction ioc3_alloc_skbfunction ioc3_mapfunction ioc3_mapfunction ioc3eth_nvmem_matchfunction ioc3eth_get_mac_addrfunction __ioc3_set_mac_addressfunction ioc3_set_mac_addressfunction ioc3_mdio_readfunction ioc3_mdio_writefunction ioc3_tcpudp_checksumfunction ioc3_rxfunction ioc3_txfunction ioc3_errorfunction ioc3_interruptfunction ioc3_setup_duplexfunction ioc3_timerfunction ioc3_mii_initfunction ioc3_mii_startfunction ioc3_tx_unmapfunction ioc3_clean_tx_ringfunction ioc3_free_rx_bufsfunction ioc3_alloc_rx_bufsfunction ioc3_ssram_discfunction ioc3_initfunction ioc3_startfunction ioc3_stopfunction ioc3_openfunction ioc3_closefunction ioc3eth_probefunction ioc3eth_removefunction ioc3_start_xmitfunction ioc3_timeoutfunction ioc3_hashfunction ioc3_get_drvinfofunction ioc3_get_link_ksettingsfunction ioc3_set_link_ksettingsfunction ioc3_nway_resetfunction ioc3_get_linkfunction ioc3_ioctlfunction ioc3_set_multicast_listfunction netdev_for_each_mc_addr
Annotated Snippet
static const struct net_device_ops ioc3_netdev_ops = {
.ndo_open = ioc3_open,
.ndo_stop = ioc3_close,
.ndo_start_xmit = ioc3_start_xmit,
.ndo_tx_timeout = ioc3_timeout,
.ndo_get_stats = ioc3_get_stats,
.ndo_set_rx_mode = ioc3_set_multicast_list,
.ndo_eth_ioctl = ioc3_ioctl,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = ioc3_set_mac_address,
};
static int ioc3eth_probe(struct platform_device *pdev)
{
u32 sw_physid1, sw_physid2, vendor, model, rev;
struct ioc3_private *ip;
struct net_device *dev;
struct resource *regs;
u8 mac_addr[6];
int err;
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs) {
dev_err(&pdev->dev, "Invalid resource\n");
return -EINVAL;
}
/* get mac addr from one wire prom */
if (ioc3eth_get_mac_addr(regs, mac_addr))
return -EPROBE_DEFER; /* not available yet */
dev = alloc_etherdev(sizeof(struct ioc3_private));
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, &pdev->dev);
ip = netdev_priv(dev);
ip->dma_dev = pdev->dev.parent;
ip->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ip->regs)) {
err = PTR_ERR(ip->regs);
goto out_free;
}
ip->ssram = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(ip->ssram)) {
err = PTR_ERR(ip->ssram);
goto out_free;
}
dev->irq = platform_get_irq(pdev, 0);
if (dev->irq < 0) {
err = dev->irq;
goto out_free;
}
if (devm_request_irq(&pdev->dev, dev->irq, ioc3_interrupt,
IRQF_SHARED, "ioc3-eth", dev)) {
dev_err(&pdev->dev, "Can't get irq %d\n", dev->irq);
err = -ENODEV;
goto out_free;
}
spin_lock_init(&ip->ioc3_lock);
timer_setup(&ip->ioc3_timer, ioc3_timer, 0);
ioc3_stop(ip);
/* Allocate rx ring. 4kb = 512 entries, must be 4kb aligned */
ip->rxr = dma_alloc_coherent(ip->dma_dev, RX_RING_SIZE, &ip->rxr_dma,
GFP_KERNEL);
if (!ip->rxr) {
pr_err("ioc3-eth: rx ring allocation failed\n");
err = -ENOMEM;
goto out_stop;
}
/* Allocate tx rings. 16kb = 128 bufs, must be 16kb aligned */
ip->tx_ring = dma_alloc_coherent(ip->dma_dev, TX_RING_SIZE + SZ_16K - 1,
&ip->txr_dma, GFP_KERNEL);
if (!ip->tx_ring) {
pr_err("ioc3-eth: tx ring allocation failed\n");
err = -ENOMEM;
goto out_stop;
}
/* Align TX ring */
ip->txr = PTR_ALIGN(ip->tx_ring, SZ_16K);
ip->txr_dma = ALIGN(ip->txr_dma, SZ_16K);
ioc3_init(dev);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/kernel.h`, `linux/mm.h`, `linux/errno.h`, `linux/module.h`, `linux/init.h`, `linux/crc16.h`, `linux/crc32.h`.
- Detected declarations: `struct ioc3_private`, `function aligned_rx_skb_addr`, `function ioc3_alloc_skb`, `function ioc3_map`, `function ioc3_map`, `function ioc3eth_nvmem_match`, `function ioc3eth_get_mac_addr`, `function __ioc3_set_mac_address`, `function ioc3_set_mac_address`, `function ioc3_mdio_read`.
- 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.