drivers/net/ethernet/nvidia/forcedeth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/nvidia/forcedeth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/nvidia/forcedeth.c- Extension
.c- Size
- 195580 bytes
- Lines
- 6492
- 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/types.hlinux/pci.hlinux/interrupt.hlinux/netdevice.hlinux/etherdevice.hlinux/delay.hlinux/sched.hlinux/spinlock.hlinux/ethtool.hlinux/timer.hlinux/skbuff.hlinux/mii.hlinux/random.hlinux/if_vlan.hlinux/dma-mapping.hlinux/slab.hlinux/uaccess.hlinux/prefetch.hlinux/u64_stats_sync.hlinux/io.hasm/irq.h
Detected Declarations
struct ring_descstruct ring_desc_exstruct nv_ethtool_strstruct nv_ethtool_statsstruct register_teststruct nv_skb_mapstruct nv_txrx_statsstruct fe_privfunction pci_pushfunction nv_descr_getlengthfunction nv_descr_getlength_exfunction nv_optimizedfunction reg_delayfunction dma_lowfunction dma_highfunction setup_hw_ringsfunction free_ringsfunction using_multi_irqsfunction nv_txrx_gatefunction nv_enable_irqfunction nv_disable_irqfunction nv_enable_hw_interruptsfunction nv_disable_hw_interruptsfunction mii_rwfunction phy_resetfunction init_realtek_8211bfunction init_realtek_8211cfunction init_realtek_8201function init_realtek_8201_crossfunction init_cicadafunction init_vitessefunction phy_initfunction nv_start_rxfunction nv_stop_rxfunction nv_start_txfunction nv_stop_txfunction nv_start_rxtxfunction nv_stop_rxtxfunction nv_txrx_resetfunction nv_mac_resetfunction nv_update_statsfunction nv_get_statsfunction rcu_read_lockfunction nv_alloc_rxfunction nv_alloc_rx_optimizedfunction nv_do_rx_refillfunction nv_init_rxfunction nv_init_tx
Annotated Snippet
static const struct net_device_ops nv_netdev_ops = {
.ndo_open = nv_open,
.ndo_stop = nv_close,
.ndo_get_stats64 = nv_get_stats64,
.ndo_start_xmit = nv_start_xmit,
.ndo_tx_timeout = nv_tx_timeout,
.ndo_change_mtu = nv_change_mtu,
.ndo_fix_features = nv_fix_features,
.ndo_set_features = nv_set_features,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = nv_set_mac_address,
.ndo_set_rx_mode = nv_set_multicast,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = nv_poll_controller,
#endif
};
static const struct net_device_ops nv_netdev_ops_optimized = {
.ndo_open = nv_open,
.ndo_stop = nv_close,
.ndo_get_stats64 = nv_get_stats64,
.ndo_start_xmit = nv_start_xmit_optimized,
.ndo_tx_timeout = nv_tx_timeout,
.ndo_change_mtu = nv_change_mtu,
.ndo_fix_features = nv_fix_features,
.ndo_set_features = nv_set_features,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = nv_set_mac_address,
.ndo_set_rx_mode = nv_set_multicast,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = nv_poll_controller,
#endif
};
static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
{
struct net_device *dev;
struct fe_priv *np;
unsigned long addr;
u8 __iomem *base;
int err, i;
u32 powerstate, txreg;
u32 phystate_orig = 0, phystate;
int phyinitialized = 0;
static int printed_version;
u8 mac[ETH_ALEN];
if (!printed_version++)
pr_info("Reverse Engineered nForce ethernet driver. Version %s.\n",
FORCEDETH_VERSION);
dev = alloc_etherdev(sizeof(struct fe_priv));
err = -ENOMEM;
if (!dev)
goto out;
np = netdev_priv(dev);
np->dev = dev;
np->pci_dev = pci_dev;
spin_lock_init(&np->lock);
spin_lock_init(&np->hwstats_lock);
SET_NETDEV_DEV(dev, &pci_dev->dev);
u64_stats_init(&np->swstats_rx_syncp);
u64_stats_init(&np->swstats_tx_syncp);
np->txrx_stats = alloc_percpu(struct nv_txrx_stats);
if (!np->txrx_stats) {
pr_err("np->txrx_stats, alloc memory error.\n");
err = -ENOMEM;
goto out_alloc_percpu;
}
timer_setup(&np->oom_kick, nv_do_rx_refill, 0);
timer_setup(&np->nic_poll, nv_do_nic_poll, 0);
timer_setup(&np->stats_poll, nv_do_stats_poll, TIMER_DEFERRABLE);
err = pci_enable_device(pci_dev);
if (err)
goto out_free;
pci_set_master(pci_dev);
err = pci_request_regions(pci_dev, DRV_NAME);
if (err < 0)
goto out_disable;
if (id->driver_data & (DEV_HAS_VLAN|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_STATISTICS_V2|DEV_HAS_STATISTICS_V3))
np->register_size = NV_PCI_REGSZ_VER3;
else if (id->driver_data & DEV_HAS_STATISTICS_V1)
np->register_size = NV_PCI_REGSZ_VER2;
else
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `linux/pci.h`, `linux/interrupt.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/delay.h`, `linux/sched.h`.
- Detected declarations: `struct ring_desc`, `struct ring_desc_ex`, `struct nv_ethtool_str`, `struct nv_ethtool_stats`, `struct register_test`, `struct nv_skb_map`, `struct nv_txrx_stats`, `struct fe_priv`, `function pci_push`, `function nv_descr_getlength`.
- 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.