drivers/net/ethernet/qlogic/qed/qed_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qed/qed_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qed/qed_main.c- Extension
.c- Size
- 83854 bytes
- Lines
- 3206
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/stddef.hlinux/pci.hlinux/kernel.hlinux/slab.hlinux/delay.hasm/byteorder.hlinux/dma-mapping.hlinux/string.hlinux/module.hlinux/interrupt.hlinux/workqueue.hlinux/ethtool.hlinux/etherdevice.hlinux/vmalloc.hlinux/crash_dump.hlinux/crc32.hlinux/qed/qed_if.hlinux/qed/qed_ll2_if.hnet/devlink.hlinux/phylink.hqed.hqed_sriov.hqed_sp.hqed_dev_api.hqed_ll2.hqed_fcoe.hqed_iscsi.hqed_mcp.hqed_reg_addr.hqed_hw.hqed_selftest.hqed_debug.h
Detected Declarations
struct qed_mfw_speed_mapfunction qed_mfw_speed_map_populatefunction qed_mfw_speed_maps_initfunction qed_initfunction qed_exitfunction qed_free_pcifunction qed_init_pcifunction qed_fill_dev_infofunction qed_free_cdevfunction qed_set_power_statefunction qed_removefunction qed_disable_msixfunction qed_enable_msixfunction qed_set_int_modefunction qed_simd_handler_configfunction qed_simd_handler_cleanfunction qed_msix_sp_intfunction qed_single_intfunction qed_slowpath_irq_reqfunction qed_slowpath_tasklet_flushfunction qed_slowpath_irq_syncfunction qed_slowpath_irq_freefunction qed_nic_stopfunction qed_nic_setupfunction qed_set_int_fpfunction qed_get_int_fpfunction qed_slowpath_setup_intfunction qed_slowpath_vf_setup_intfunction qed_unzip_datafunction qed_alloc_stream_memfunction for_each_hwfnfunction qed_free_stream_memfunction for_each_hwfnfunction qed_update_pf_paramsfunction qed_slowpath_delayed_workfunction qed_periodic_db_rec_startfunction qed_slowpath_wq_stopfunction for_each_hwfnfunction qed_slowpath_taskfunction qed_slowpath_wq_startfunction for_each_hwfnfunction qed_slowpath_startfunction qed_slowpath_stopfunction qed_set_namefunction qed_sb_initfunction qed_sb_releasefunction qed_can_link_changefunction qed_set_ext_speed_params
Annotated Snippet
module_init(qed_init);
static void __exit qed_exit(void)
{
/* To prevent marking this module as "permanent" */
}
module_exit(qed_exit);
static void qed_free_pci(struct qed_dev *cdev)
{
struct pci_dev *pdev = cdev->pdev;
if (cdev->doorbells && cdev->db_size)
iounmap(cdev->doorbells);
if (cdev->regview)
iounmap(cdev->regview);
if (atomic_read(&pdev->enable_cnt) == 1)
pci_release_regions(pdev);
pci_disable_device(pdev);
}
#define PCI_REVISION_ID_ERROR_VAL 0xff
/* Performs PCI initializations as well as initializing PCI-related parameters
* in the device structrue. Returns 0 in case of success.
*/
static int qed_init_pci(struct qed_dev *cdev, struct pci_dev *pdev)
{
u8 rev_id;
int rc;
cdev->pdev = pdev;
rc = pci_enable_device(pdev);
if (rc) {
DP_NOTICE(cdev, "Cannot enable PCI device\n");
goto err0;
}
if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
DP_NOTICE(cdev, "No memory region found in bar #0\n");
rc = -EIO;
goto err1;
}
if (IS_PF(cdev) && !(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) {
DP_NOTICE(cdev, "No memory region found in bar #2\n");
rc = -EIO;
goto err1;
}
if (atomic_read(&pdev->enable_cnt) == 1) {
rc = pci_request_regions(pdev, "qed");
if (rc) {
DP_NOTICE(cdev,
"Failed to request PCI memory resources\n");
goto err1;
}
pci_set_master(pdev);
pci_save_state(pdev);
}
pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
if (rev_id == PCI_REVISION_ID_ERROR_VAL) {
DP_NOTICE(cdev,
"Detected PCI device error [rev_id 0x%x]. Probably due to prior indication. Aborting.\n",
rev_id);
rc = -ENODEV;
goto err2;
}
if (!pci_is_pcie(pdev)) {
DP_NOTICE(cdev, "The bus is not PCI Express\n");
rc = -EIO;
goto err2;
}
if (IS_PF(cdev) && !pdev->pm_cap)
DP_NOTICE(cdev, "Cannot find power management capability\n");
rc = dma_set_mask_and_coherent(&cdev->pdev->dev, DMA_BIT_MASK(64));
if (rc) {
DP_NOTICE(cdev, "Can't request DMA addresses\n");
rc = -EIO;
goto err2;
}
cdev->pci_params.mem_start = pci_resource_start(pdev, 0);
cdev->pci_params.mem_end = pci_resource_end(pdev, 0);
cdev->pci_params.irq = pdev->irq;
Annotation
- Immediate include surface: `linux/stddef.h`, `linux/pci.h`, `linux/kernel.h`, `linux/slab.h`, `linux/delay.h`, `asm/byteorder.h`, `linux/dma-mapping.h`, `linux/string.h`.
- Detected declarations: `struct qed_mfw_speed_map`, `function qed_mfw_speed_map_populate`, `function qed_mfw_speed_maps_init`, `function qed_init`, `function qed_exit`, `function qed_free_pci`, `function qed_init_pci`, `function qed_fill_dev_info`, `function qed_free_cdev`, `function qed_set_power_state`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.