drivers/net/ethernet/adaptec/starfire.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/adaptec/starfire.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/adaptec/starfire.c- Extension
.c- Size
- 62815 bytes
- Lines
- 2067
- 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/interrupt.hlinux/module.hlinux/kernel.hlinux/pci.hlinux/netdevice.hlinux/etherdevice.hlinux/init.hlinux/delay.hlinux/crc32.hlinux/ethtool.hlinux/mii.hlinux/if_vlan.hlinux/mm.hlinux/firmware.hasm/processor.hlinux/uaccess.hasm/io.h
Detected Declarations
struct starfire_rx_descstruct csum_rx_done_descstruct full_rx_done_descstruct starfire_tx_desc_1struct starfire_tx_desc_2struct tx_done_descstruct rx_ring_infostruct tx_ring_infostruct netdev_privateenum chip_capability_flagsenum chipsetenum register_offsetsenum intr_status_bitsenum rx_mode_bitsenum tx_mode_bitsenum tx_ctrl_bitsenum rx_ctrl_bitsenum rx_dmactrl_bitsenum rx_compl_bitsenum tx_compl_bitsenum gen_ctrl_bitsenum intr_ctrl_bitsenum rx_desc_bitsenum rx_done_bitsenum tx_desc_bitsfunction netdev_vlan_rx_add_vidfunction netdev_vlan_rx_kill_vidfunction starfire_init_onefunction mdio_readfunction mdio_writefunction netdev_openfunction check_duplexfunction tx_timeoutfunction init_ringfunction start_txfunction intr_handlerfunction __netdev_rxfunction netdev_pollfunction refill_rx_ringfunction netdev_media_changefunction netdev_errorfunction set_vlan_modefunction for_each_set_bitfunction set_rx_modefunction netdev_for_each_mc_addrfunction netdev_for_each_mc_addrfunction check_if_runningfunction get_drvinfo
Annotated Snippet
static const struct net_device_ops netdev_ops = {
.ndo_open = netdev_open,
.ndo_stop = netdev_close,
.ndo_start_xmit = start_tx,
.ndo_tx_timeout = tx_timeout,
.ndo_get_stats = get_stats,
.ndo_set_rx_mode = set_rx_mode,
.ndo_eth_ioctl = netdev_ioctl,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef VLAN_SUPPORT
.ndo_vlan_rx_add_vid = netdev_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = netdev_vlan_rx_kill_vid,
#endif
};
static int starfire_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct device *d = &pdev->dev;
struct netdev_private *np;
int i, irq, chip_idx = ent->driver_data;
struct net_device *dev;
u8 addr[ETH_ALEN];
long ioaddr;
void __iomem *base;
int drv_flags, io_size;
int boguscnt;
if (pci_enable_device (pdev))
return -EIO;
ioaddr = pci_resource_start(pdev, 0);
io_size = pci_resource_len(pdev, 0);
if (!ioaddr || ((pci_resource_flags(pdev, 0) & IORESOURCE_MEM) == 0)) {
dev_err(d, "no PCI MEM resources, aborting\n");
return -ENODEV;
}
dev = alloc_etherdev(sizeof(*np));
if (!dev)
return -ENOMEM;
SET_NETDEV_DEV(dev, &pdev->dev);
irq = pdev->irq;
if (pci_request_regions (pdev, DRV_NAME)) {
dev_err(d, "cannot reserve PCI resources, aborting\n");
goto err_out_free_netdev;
}
base = ioremap(ioaddr, io_size);
if (!base) {
dev_err(d, "cannot remap %#x @ %#lx, aborting\n",
io_size, ioaddr);
goto err_out_free_res;
}
pci_set_master(pdev);
/* enable MWI -- it vastly improves Rx performance on sparc64 */
pci_try_set_mwi(pdev);
#ifdef ZEROCOPY
/* Starfire can do TCP/UDP checksumming */
if (enable_hw_cksum)
dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
#endif /* ZEROCOPY */
#ifdef VLAN_SUPPORT
dev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER;
#endif /* VLAN_RX_KILL_VID */
#ifdef ADDR_64BITS
dev->features |= NETIF_F_HIGHDMA;
#endif /* ADDR_64BITS */
/* Serial EEPROM reads are hidden by the hardware. */
for (i = 0; i < 6; i++)
addr[i] = readb(base + EEPROMCtrl + 20 - i);
eth_hw_addr_set(dev, addr);
#if ! defined(final_version) /* Dump the EEPROM contents during development. */
if (debug > 4)
for (i = 0; i < 0x20; i++)
printk("%2.2x%s",
(unsigned int)readb(base + EEPROMCtrl + i),
i % 16 != 15 ? " " : "\n");
#endif
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/module.h`, `linux/kernel.h`, `linux/pci.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/init.h`, `linux/delay.h`.
- Detected declarations: `struct starfire_rx_desc`, `struct csum_rx_done_desc`, `struct full_rx_done_desc`, `struct starfire_tx_desc_1`, `struct starfire_tx_desc_2`, `struct tx_done_desc`, `struct rx_ring_info`, `struct tx_ring_info`, `struct netdev_private`, `enum chip_capability_flags`.
- 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.