drivers/net/ethernet/tundra/tsi108_eth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/tundra/tsi108_eth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/tundra/tsi108_eth.c- Extension
.c- Size
- 46610 bytes
- Lines
- 1690
- 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/types.hlinux/interrupt.hlinux/net.hlinux/netdevice.hlinux/etherdevice.hlinux/ethtool.hlinux/skbuff.hlinux/spinlock.hlinux/delay.hlinux/crc32.hlinux/mii.hlinux/device.hlinux/pci.hlinux/rtnetlink.hlinux/timer.hlinux/platform_device.hlinux/gfp.hasm/io.hasm/tsi108.htsi108_eth.h
Detected Declarations
struct tsi108_prv_datafunction dump_eth_onefunction tsi108_read_miifunction tsi108_write_miifunction tsi108_mdio_readfunction tsi108_mdio_writefunction tsi108_write_tbifunction mii_speedfunction tsi108_check_phyfunction tsi108_stat_carry_onefunction tsi108_stat_carryfunction tsi108_read_statfunction tsi108_restart_rxfunction tsi108_restart_txfunction tsi108_complete_txfunction tsi108_send_packetfunction tsi108_complete_rxfunction tsi108_refill_rxfunction tsi108_pollfunction tsi108_rx_intfunction happensfunction calledfunction tsi108_tx_intfunction tsi108_irqfunction tsi108_stop_ethernetfunction tsi108_reset_etherfunction tsi108_get_macfunction tsi108_set_macfunction tsi108_set_rx_modefunction netdev_for_each_mc_addrfunction tsi108_init_phyfunction tsi108_kill_phyfunction tsi108_openfunction tsi108_closefunction tsi108_init_macfunction tsi108_get_link_ksettingsfunction tsi108_set_link_ksettingsfunction tsi108_do_ioctlfunction tsi108_init_onefunction tsi108_timed_checkerfunction tsi108_ether_remove
Annotated Snippet
static const struct net_device_ops tsi108_netdev_ops = {
.ndo_open = tsi108_open,
.ndo_stop = tsi108_close,
.ndo_start_xmit = tsi108_send_packet,
.ndo_set_rx_mode = tsi108_set_rx_mode,
.ndo_get_stats = tsi108_get_stats,
.ndo_eth_ioctl = tsi108_do_ioctl,
.ndo_set_mac_address = tsi108_set_mac,
.ndo_validate_addr = eth_validate_addr,
};
static int
tsi108_init_one(struct platform_device *pdev)
{
struct net_device *dev = NULL;
struct tsi108_prv_data *data = NULL;
hw_info *einfo;
int err = 0;
einfo = dev_get_platdata(&pdev->dev);
if (NULL == einfo) {
printk(KERN_ERR "tsi-eth %d: Missing additional data!\n",
pdev->id);
return -ENODEV;
}
/* Create an ethernet device instance */
dev = alloc_etherdev(sizeof(struct tsi108_prv_data));
if (!dev)
return -ENOMEM;
printk("tsi108_eth%d: probe...\n", pdev->id);
data = netdev_priv(dev);
data->dev = dev;
data->pdev = pdev;
pr_debug("tsi108_eth%d:regs:phyresgs:phy:irq_num=0x%x:0x%x:0x%x:0x%x\n",
pdev->id, einfo->regs, einfo->phyregs,
einfo->phy, einfo->irq_num);
data->regs = ioremap(einfo->regs, 0x400);
if (NULL == data->regs) {
err = -ENOMEM;
goto regs_fail;
}
data->phyregs = ioremap(einfo->phyregs, 0x400);
if (NULL == data->phyregs) {
err = -ENOMEM;
goto phyregs_fail;
}
/* MII setup */
data->mii_if.dev = dev;
data->mii_if.mdio_read = tsi108_mdio_read;
data->mii_if.mdio_write = tsi108_mdio_write;
data->mii_if.phy_id = einfo->phy;
data->mii_if.phy_id_mask = 0x1f;
data->mii_if.reg_num_mask = 0x1f;
data->phy = einfo->phy;
data->phy_type = einfo->phy_type;
data->irq_num = einfo->irq_num;
data->id = pdev->id;
netif_napi_add(dev, &data->napi, tsi108_poll);
dev->netdev_ops = &tsi108_netdev_ops;
dev->ethtool_ops = &tsi108_ethtool_ops;
/* Apparently, the Linux networking code won't use scatter-gather
* if the hardware doesn't do checksums. However, it's faster
* to checksum in place and use SG, as (among other reasons)
* the cache won't be dirtied (which then has to be flushed
* before DMA). The checksumming is done by the driver (via
* a new function skb_csum_dev() in net/core/skbuff.c).
*/
dev->features = NETIF_F_HIGHDMA;
spin_lock_init(&data->txlock);
spin_lock_init(&data->misclock);
tsi108_reset_ether(data);
tsi108_kill_phy(dev);
if ((err = tsi108_get_mac(dev)) != 0) {
printk(KERN_ERR "%s: Invalid MAC address. Please correct.\n",
dev->name);
goto register_fail;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `linux/interrupt.h`, `linux/net.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/skbuff.h`.
- Detected declarations: `struct tsi108_prv_data`, `function dump_eth_one`, `function tsi108_read_mii`, `function tsi108_write_mii`, `function tsi108_mdio_read`, `function tsi108_mdio_write`, `function tsi108_write_tbi`, `function mii_speed`, `function tsi108_check_phy`, `function tsi108_stat_carry_one`.
- 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.