drivers/net/ethernet/seeq/sgiseeq.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/seeq/sgiseeq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/seeq/sgiseeq.c- Extension
.c- Size
- 22757 bytes
- Lines
- 847
- 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/dma-mapping.hlinux/kernel.hlinux/module.hlinux/slab.hlinux/errno.hlinux/types.hlinux/interrupt.hlinux/string.hlinux/delay.hlinux/netdevice.hlinux/platform_device.hlinux/etherdevice.hlinux/skbuff.hasm/sgi/hpc3.hasm/sgi/ip22.hasm/sgi/seeq.hsgiseeq.h
Detected Declarations
struct sgiseeq_rx_descstruct sgiseeq_tx_descstruct sgiseeq_init_blockstruct sgiseeq_privatefunction dma_sync_desc_cpufunction dma_sync_desc_devfunction hpc3_eth_resetfunction reset_hpc3_and_seeqfunction seeq_gofunction __sgiseeq_set_mac_addressfunction sgiseeq_set_mac_addressfunction seeq_init_ringfunction seeq_purge_ringfunction sgiseeq_dump_ringsfunction init_seeqfunction record_rx_errorsfunction rx_maybe_restartfunction sgiseeq_rxfunction tx_maybe_reset_collisionsfunction kick_txfunction sgiseeq_txfunction sgiseeq_interruptfunction sgiseeq_openfunction sgiseeq_closefunction sgiseeq_resetfunction sgiseeq_start_xmitfunction timeoutfunction sgiseeq_set_multicastfunction setup_tx_ringfunction setup_rx_ringfunction sgiseeq_probefunction sgiseeq_remove
Annotated Snippet
static const struct net_device_ops sgiseeq_netdev_ops = {
.ndo_open = sgiseeq_open,
.ndo_stop = sgiseeq_close,
.ndo_start_xmit = sgiseeq_start_xmit,
.ndo_tx_timeout = timeout,
.ndo_set_rx_mode = sgiseeq_set_multicast,
.ndo_set_mac_address = sgiseeq_set_mac_address,
.ndo_validate_addr = eth_validate_addr,
};
static int sgiseeq_probe(struct platform_device *pdev)
{
struct sgiseeq_platform_data *pd = dev_get_platdata(&pdev->dev);
struct hpc3_regs *hpcregs = pd->hpc;
struct sgiseeq_init_block *sr;
unsigned int irq = pd->irq;
struct sgiseeq_private *sp;
struct net_device *dev;
int err;
dev = alloc_etherdev(sizeof (struct sgiseeq_private));
if (!dev) {
err = -ENOMEM;
goto err_out;
}
platform_set_drvdata(pdev, dev);
SET_NETDEV_DEV(dev, &pdev->dev);
sp = netdev_priv(dev);
/* Make private data page aligned */
sr = dma_alloc_noncoherent(&pdev->dev, sizeof(*sp->srings),
&sp->srings_dma, DMA_BIDIRECTIONAL, GFP_KERNEL);
if (!sr) {
printk(KERN_ERR "Sgiseeq: Page alloc failed, aborting.\n");
err = -ENOMEM;
goto err_out_free_dev;
}
sp->srings = sr;
sp->rx_desc = sp->srings->rxvector;
sp->tx_desc = sp->srings->txvector;
spin_lock_init(&sp->tx_lock);
/* A couple calculations now, saves many cycles later. */
setup_rx_ring(dev, sp->rx_desc, SEEQ_RX_BUFFERS);
setup_tx_ring(dev, sp->tx_desc, SEEQ_TX_BUFFERS);
eth_hw_addr_set(dev, pd->mac);
#ifdef DEBUG
gpriv = sp;
gdev = dev;
#endif
sp->sregs = (struct sgiseeq_regs *) &hpcregs->eth_ext[0];
sp->hregs = &hpcregs->ethregs;
sp->name = sgiseeqstr;
sp->mode = SEEQ_RCMD_RBCAST;
/* Setup PIO and DMA transfer timing */
sp->hregs->pconfig = 0x161;
sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP |
HPC3_EDCFG_FRXDC | HPC3_EDCFG_PTO | 0x026;
/* Setup PIO and DMA transfer timing */
sp->hregs->pconfig = 0x161;
sp->hregs->dconfig = HPC3_EDCFG_FIRQ | HPC3_EDCFG_FEOP |
HPC3_EDCFG_FRXDC | HPC3_EDCFG_PTO | 0x026;
/* Reset the chip. */
hpc3_eth_reset(sp->hregs);
sp->is_edlc = !(sp->sregs->rw.rregs.collision_tx[0] & 0xff);
if (sp->is_edlc)
sp->control = SEEQ_CTRL_XCNT | SEEQ_CTRL_ACCNT |
SEEQ_CTRL_SFLAG | SEEQ_CTRL_ESHORT |
SEEQ_CTRL_ENCARR;
dev->netdev_ops = &sgiseeq_netdev_ops;
dev->watchdog_timeo = (200 * HZ) / 1000;
dev->irq = irq;
if (register_netdev(dev)) {
printk(KERN_ERR "Sgiseeq: Cannot register net device, "
"aborting.\n");
err = -ENODEV;
goto err_out_free_attrs;
}
printk(KERN_INFO "%s: %s %pM\n", dev->name, sgiseeqstr, dev->dev_addr);
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/errno.h`, `linux/types.h`, `linux/interrupt.h`, `linux/string.h`.
- Detected declarations: `struct sgiseeq_rx_desc`, `struct sgiseeq_tx_desc`, `struct sgiseeq_init_block`, `struct sgiseeq_private`, `function dma_sync_desc_cpu`, `function dma_sync_desc_dev`, `function hpc3_eth_reset`, `function reset_hpc3_and_seeq`, `function seeq_go`, `function __sgiseeq_set_mac_address`.
- 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.