drivers/net/ethernet/toshiba/tc35815.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/toshiba/tc35815.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/toshiba/tc35815.c- Extension
.c- Size
- 64196 bytes
- Lines
- 2161
- 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/types.hlinux/fcntl.hlinux/interrupt.hlinux/ioport.hlinux/in.hlinux/if_vlan.hlinux/slab.hlinux/string.hlinux/spinlock.hlinux/errno.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/delay.hlinux/pci.hlinux/phy.hlinux/workqueue.hlinux/platform_device.hlinux/prefetch.hasm/io.hasm/byteorder.h
Detected Declarations
struct tc35815_regsstruct FDescstruct BDescstruct TxFDstruct RxFDstruct FrFDstruct tc35815_localenum tc35815_chiptypefunction fd_virt_to_busfunction free_rxbuf_skbfunction tc_mdio_readfunction tc_mdio_writefunction tc_handle_link_changefunction tc_mii_probefunction tc_mii_initfunction tc35815_mac_matchfunction tc35815_read_plat_dev_addrfunction tc35815_read_plat_dev_addrfunction tc35815_init_dev_addrfunction tc35815_init_onefunction tc35815_remove_onefunction tc35815_init_queuesfunction tc35815_clear_queuesfunction tc35815_free_queuesfunction dump_txfdfunction dump_rxfdfunction dump_frfdfunction panic_queuesfunction print_ethfunction tc35815_tx_fullfunction tc35815_restartfunction tc35815_restart_workfunction tc35815_schedule_restartfunction tc35815_tx_timeoutfunction tc35815_openfunction tc35815_send_packetfunction tc35815_fatal_error_interruptfunction tc35815_do_interruptfunction tc35815_interruptfunction tc35815_poll_controllerfunction tc35815_rxfunction tc35815_pollfunction tc35815_check_tx_statfunction tc35815_txdonefunction tc35815_closefunction tc35815_set_cam_entryfunction tc35815_set_multicast_listfunction netdev_mc_count
Annotated Snippet
static const struct net_device_ops tc35815_netdev_ops = {
.ndo_open = tc35815_open,
.ndo_stop = tc35815_close,
.ndo_start_xmit = tc35815_send_packet,
.ndo_get_stats = tc35815_get_stats,
.ndo_set_rx_mode = tc35815_set_multicast_list,
.ndo_tx_timeout = tc35815_tx_timeout,
.ndo_eth_ioctl = phy_do_ioctl_running,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = tc35815_poll_controller,
#endif
};
static int tc35815_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
void __iomem *ioaddr = NULL;
struct net_device *dev;
struct tc35815_local *lp;
int rc;
static int printed_version;
if (!printed_version++) {
printk(version);
dev_printk(KERN_DEBUG, &pdev->dev,
"speed:%d duplex:%d\n",
options.speed, options.duplex);
}
if (!pdev->irq) {
dev_warn(&pdev->dev, "no IRQ assigned.\n");
return -ENODEV;
}
/* dev zeroed in alloc_etherdev */
dev = alloc_etherdev(sizeof(*lp));
if (dev == NULL)
return -ENOMEM;
SET_NETDEV_DEV(dev, &pdev->dev);
lp = netdev_priv(dev);
lp->dev = dev;
/* enable device (incl. PCI PM wakeup), and bus-mastering */
rc = pcim_enable_device(pdev);
if (rc)
goto err_out;
rc = pcim_iomap_regions(pdev, 1 << 1, MODNAME);
if (rc)
goto err_out;
pci_set_master(pdev);
ioaddr = pcim_iomap_table(pdev)[1];
/* Initialize the device structure. */
dev->netdev_ops = &tc35815_netdev_ops;
dev->ethtool_ops = &tc35815_ethtool_ops;
dev->watchdog_timeo = TC35815_TX_TIMEOUT;
netif_napi_add_weight(dev, &lp->napi, tc35815_poll, NAPI_WEIGHT);
dev->irq = pdev->irq;
dev->base_addr = (unsigned long)ioaddr;
INIT_WORK(&lp->restart_work, tc35815_restart_work);
spin_lock_init(&lp->lock);
spin_lock_init(&lp->rx_lock);
lp->pci_dev = pdev;
lp->chiptype = ent->driver_data;
lp->msg_enable = NETIF_MSG_TX_ERR | NETIF_MSG_HW | NETIF_MSG_DRV | NETIF_MSG_LINK;
pci_set_drvdata(pdev, dev);
/* Soft reset the chip. */
tc35815_chip_reset(dev);
/* Retrieve the ethernet address. */
if (tc35815_init_dev_addr(dev)) {
dev_warn(&pdev->dev, "not valid ether addr\n");
eth_hw_addr_random(dev);
}
rc = register_netdev(dev);
if (rc)
goto err_out;
printk(KERN_INFO "%s: %s at 0x%lx, %pM, IRQ %d\n",
dev->name,
chip_info[ent->driver_data].name,
dev->base_addr,
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/types.h`, `linux/fcntl.h`, `linux/interrupt.h`, `linux/ioport.h`, `linux/in.h`, `linux/if_vlan.h`.
- Detected declarations: `struct tc35815_regs`, `struct FDesc`, `struct BDesc`, `struct TxFD`, `struct RxFD`, `struct FrFD`, `struct tc35815_local`, `enum tc35815_chiptype`, `function fd_virt_to_bus`, `function free_rxbuf_skb`.
- 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.