drivers/net/ethernet/intel/e1000/e1000_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/e1000/e1000_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/e1000/e1000_main.c- Extension
.c- Size
- 149162 bytes
- Lines
- 5329
- 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
e1000.hnet/ip6_checksum.hlinux/io.hlinux/prefetch.hlinux/bitops.hlinux/if_vlan.h
Detected Declarations
struct my_ustruct my_uenum latency_rangefunction e1000_alloc_dummy_rx_buffersfunction e1000_init_modulefunction e1000_exit_modulefunction e1000_request_irqfunction e1000_free_irqfunction e1000_irq_disablefunction e1000_irq_enablefunction e1000_update_mng_vlanfunction e1000_init_manageabilityfunction e1000_release_manageabilityfunction e1000_configurefunction e1000_upfunction enabledfunction e1000_power_down_phyfunction e1000_down_and_stopfunction e1000_downfunction e1000_reinit_lockedfunction e1000_resetfunction e1000_dump_eepromfunction e1000_is_need_ioportfunction e1000_fix_featuresfunction e1000_set_featuresfunction initfunction e1000_probefunction e1000_removefunction e1000_sw_initfunction e1000_alloc_queuesfunction systemfunction e1000_closefunction OSfunction e1000_check_64k_boundfunction e1000_setup_tx_resourcesfunction e1000_setup_all_tx_resourcesfunction e1000_configure_txfunction e1000_setup_rx_resourcesfunction e1000_setup_all_rx_resourcesfunction e1000_setup_rctlfunction e1000_configure_rxfunction e1000_free_tx_resourcesfunction e1000_free_all_tx_resourcesfunction e1000_unmap_and_free_tx_resourcefunction e1000_clean_tx_ringfunction e1000_clean_all_tx_ringsfunction e1000_free_rx_resourcesfunction e1000_free_all_rx_resources
Annotated Snippet
static struct pci_driver e1000_driver = {
.name = e1000_driver_name,
.id_table = e1000_pci_tbl,
.probe = e1000_probe,
.remove = e1000_remove,
.driver.pm = pm_sleep_ptr(&e1000_pm_ops),
.shutdown = e1000_shutdown,
.err_handler = &e1000_err_handler
};
MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver");
MODULE_LICENSE("GPL v2");
#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK)
static int debug = -1;
module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
/**
* e1000_get_hw_dev - helper function for getting netdev
* @hw: pointer to HW struct
*
* return device used by hardware layer to print debugging information
*
**/
struct net_device *e1000_get_hw_dev(struct e1000_hw *hw)
{
struct e1000_adapter *adapter = hw->back;
return adapter->netdev;
}
/**
* e1000_init_module - Driver Registration Routine
*
* e1000_init_module is the first routine called when the driver is
* loaded. All it does is register with the PCI subsystem.
**/
static int __init e1000_init_module(void)
{
int ret;
pr_info("%s\n", e1000_driver_string);
pr_info("%s\n", e1000_copyright);
ret = pci_register_driver(&e1000_driver);
if (copybreak != COPYBREAK_DEFAULT) {
if (copybreak == 0)
pr_info("copybreak disabled\n");
else
pr_info("copybreak enabled for "
"packets <= %u bytes\n", copybreak);
}
return ret;
}
module_init(e1000_init_module);
/**
* e1000_exit_module - Driver Exit Cleanup Routine
*
* e1000_exit_module is called just before the driver is removed
* from memory.
**/
static void __exit e1000_exit_module(void)
{
pci_unregister_driver(&e1000_driver);
}
module_exit(e1000_exit_module);
static int e1000_request_irq(struct e1000_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
irq_handler_t handler = e1000_intr;
int irq_flags = IRQF_SHARED;
int err;
err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name,
netdev);
if (err) {
e_err(probe, "Unable to allocate interrupt Error: %d\n", err);
}
return err;
}
static void e1000_free_irq(struct e1000_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
Annotation
- Immediate include surface: `e1000.h`, `net/ip6_checksum.h`, `linux/io.h`, `linux/prefetch.h`, `linux/bitops.h`, `linux/if_vlan.h`.
- Detected declarations: `struct my_u`, `struct my_u`, `enum latency_range`, `function e1000_alloc_dummy_rx_buffers`, `function e1000_init_module`, `function e1000_exit_module`, `function e1000_request_irq`, `function e1000_free_irq`, `function e1000_irq_disable`, `function e1000_irq_enable`.
- 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.