drivers/net/ethernet/sgi/meth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sgi/meth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sgi/meth.c- Extension
.c- Size
- 24602 bytes
- Lines
- 879
- 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/dma-mapping.hlinux/kernel.hlinux/module.hlinux/platform_device.hlinux/slab.hlinux/errno.hlinux/types.hlinux/interrupt.hlinux/in.hlinux/in6.hlinux/device.hlinux/netdevice.hlinux/etherdevice.hlinux/ip.hlinux/tcp.hlinux/skbuff.hlinux/mii.hlinux/crc32.hasm/ip32/mace.hasm/ip32/ip32_ints.hasm/io.hmeth.h
Detected Declarations
struct meth_privatefunction load_eaddrfunction mdio_readfunction mdio_probefunction meth_check_linkfunction meth_init_tx_ringfunction meth_init_rx_ringfunction meth_free_tx_ringfunction meth_free_rx_ringfunction meth_resetfunction meth_openfunction meth_releasefunction meth_rxfunction meth_tx_fullfunction meth_tx_cleanupfunction meth_errorfunction meth_interruptfunction descriptorfunction meth_tx_1page_preparefunction meth_tx_2page_preparefunction meth_add_to_tx_ringfunction PAGE_ALIGNfunction packetfunction meth_tx_timeoutfunction meth_ioctlfunction meth_set_rx_modefunction meth_probefunction meth_remove
Annotated Snippet
static const struct net_device_ops meth_netdev_ops = {
.ndo_open = meth_open,
.ndo_stop = meth_release,
.ndo_start_xmit = meth_tx,
.ndo_eth_ioctl = meth_ioctl,
.ndo_tx_timeout = meth_tx_timeout,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
.ndo_set_rx_mode = meth_set_rx_mode,
};
/*
* The init function.
*/
static int meth_probe(struct platform_device *pdev)
{
struct net_device *dev;
struct meth_private *priv;
int err;
dev = alloc_etherdev(sizeof(struct meth_private));
if (!dev)
return -ENOMEM;
dev->netdev_ops = &meth_netdev_ops;
dev->watchdog_timeo = timeout;
dev->irq = MACE_ETHERNET_IRQ;
dev->base_addr = (unsigned long)&mace->eth;
eth_hw_addr_set(dev, o2meth_eaddr);
priv = netdev_priv(dev);
priv->pdev = pdev;
spin_lock_init(&priv->meth_lock);
SET_NETDEV_DEV(dev, &pdev->dev);
err = register_netdev(dev);
if (err) {
free_netdev(dev);
return err;
}
printk(KERN_INFO "%s: SGI MACE Ethernet rev. %d\n",
dev->name, (unsigned int)(mace->eth.mac_ctrl >> 29));
return 0;
}
static void meth_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
unregister_netdev(dev);
free_netdev(dev);
}
static struct platform_driver meth_driver = {
.probe = meth_probe,
.remove = meth_remove,
.driver = {
.name = "meth",
}
};
module_platform_driver(meth_driver);
MODULE_AUTHOR("Ilya Volynets <ilya@theIlya.com>");
MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:meth");
Annotation
- Immediate include surface: `linux/delay.h`, `linux/dma-mapping.h`, `linux/kernel.h`, `linux/module.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/errno.h`, `linux/types.h`.
- Detected declarations: `struct meth_private`, `function load_eaddr`, `function mdio_read`, `function mdio_probe`, `function meth_check_link`, `function meth_init_tx_ring`, `function meth_init_rx_ring`, `function meth_free_tx_ring`, `function meth_free_rx_ring`, `function meth_reset`.
- 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.