drivers/net/ethernet/sun/cassini.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sun/cassini.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sun/cassini.c- Extension
.c- Size
- 140354 bytes
- Lines
- 5213
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/types.hlinux/compiler.hlinux/slab.hlinux/delay.hlinux/init.hlinux/interrupt.hlinux/vmalloc.hlinux/ioport.hlinux/pci.hlinux/mm.hlinux/highmem.hlinux/list.hlinux/dma-mapping.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/skbuff_ref.hlinux/ethtool.hlinux/crc32.hlinux/random.hlinux/mii.hlinux/ip.hlinux/tcp.hlinux/mutex.hlinux/firmware.hnet/checksum.hlinux/atomic.hasm/io.hasm/byteorder.hlinux/uaccess.h
Detected Declarations
function cas_lock_txfunction cas_unlock_txfunction cas_disable_irqfunction cas_mask_intrfunction cas_enable_irqfunction cas_unmask_intrfunction cas_entropy_gatherfunction cas_entropy_resetfunction cas_phy_readfunction cas_phy_writefunction cas_phy_powerupfunction cas_phy_powerdownfunction cas_page_freefunction cas_spare_initfunction cas_spare_freefunction cas_spare_recoverfunction list_for_each_safefunction cas_mif_pollfunction cas_begin_auto_negotiationfunction cas_reset_mii_phyfunction cas_saturn_firmware_initfunction cas_saturn_firmware_loadfunction cas_phy_initfunction cas_pcs_link_checkfunction cas_pcs_interruptfunction cas_txmac_interruptfunction cas_load_firmwarefunction cas_init_rx_dmafunction cas_rxc_initfunction cas_clean_rxdsfunction cas_clean_rxcsfunction cas_rxmac_resetfunction cas_rxmac_interruptfunction cas_mac_interruptfunction cas_mdio_link_not_upfunction cas_mii_link_checkfunction cas_mif_interruptfunction cas_pci_interruptfunction nowfunction cas_calc_tabortfunction cas_tx_ringNfunction cas_txfunction cas_rx_process_pktfunction cas_rx_flow_pktfunction cas_post_pagefunction cas_post_rxds_ringNfunction cas_rx_ringNfunction cas_post_rxcs_ringN
Annotated Snippet
static const struct net_device_ops cas_netdev_ops = {
.ndo_open = cas_open,
.ndo_stop = cas_close,
.ndo_start_xmit = cas_start_xmit,
.ndo_get_stats = cas_get_stats,
.ndo_set_rx_mode = cas_set_multicast,
.ndo_eth_ioctl = cas_ioctl,
.ndo_tx_timeout = cas_tx_timeout,
.ndo_change_mtu = cas_change_mtu,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cas_netpoll,
#endif
};
static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
static int cas_version_printed = 0;
unsigned long casreg_len;
struct net_device *dev;
struct cas *cp;
u16 pci_cmd;
int i, err;
u8 orig_cacheline_size = 0, cas_cacheline_size = 0;
if (cas_version_printed++ == 0)
pr_info("%s", version);
err = pci_enable_device(pdev);
if (err) {
dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n");
return err;
}
if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
dev_err(&pdev->dev, "Cannot find proper PCI device "
"base address, aborting\n");
err = -ENODEV;
goto err_out_disable_pdev;
}
dev = alloc_etherdev(sizeof(*cp));
if (!dev) {
err = -ENOMEM;
goto err_out_disable_pdev;
}
SET_NETDEV_DEV(dev, &pdev->dev);
err = pci_request_regions(pdev, dev->name);
if (err) {
dev_err(&pdev->dev, "Cannot obtain PCI resources, aborting\n");
goto err_out_free_netdev;
}
pci_set_master(pdev);
/* we must always turn on parity response or else parity
* doesn't get generated properly. disable SERR/PERR as well.
* in addition, we want to turn MWI on.
*/
pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd);
pci_cmd &= ~PCI_COMMAND_SERR;
pci_cmd |= PCI_COMMAND_PARITY;
pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
if (pci_try_set_mwi(pdev))
pr_warn("Could not enable MWI for %s\n", pci_name(pdev));
cas_program_bridge(pdev);
/*
* On some architectures, the default cache line size set
* by pci_try_set_mwi reduces performance. We have to increase
* it for this case. To start, we'll print some configuration
* data.
*/
#if 1
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE,
&orig_cacheline_size);
if (orig_cacheline_size < CAS_PREF_CACHELINE_SIZE) {
cas_cacheline_size =
(CAS_PREF_CACHELINE_SIZE < SMP_CACHE_BYTES) ?
CAS_PREF_CACHELINE_SIZE : SMP_CACHE_BYTES;
if (pci_write_config_byte(pdev,
PCI_CACHE_LINE_SIZE,
cas_cacheline_size)) {
dev_err(&pdev->dev, "Could not set PCI cache "
"line size\n");
goto err_out_free_res;
}
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/types.h`, `linux/compiler.h`, `linux/slab.h`, `linux/delay.h`, `linux/init.h`, `linux/interrupt.h`.
- Detected declarations: `function cas_lock_tx`, `function cas_unlock_tx`, `function cas_disable_irq`, `function cas_mask_intr`, `function cas_enable_irq`, `function cas_unmask_intr`, `function cas_entropy_gather`, `function cas_entropy_reset`, `function cas_phy_read`, `function cas_phy_write`.
- 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.