drivers/net/ethernet/mellanox/mlxsw/pci.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlxsw/pci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlxsw/pci.c- Extension
.c- Size
- 70038 bytes
- Lines
- 2547
- 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/kernel.hlinux/module.hlinux/export.hlinux/err.hlinux/device.hlinux/pci.hlinux/interrupt.hlinux/types.hlinux/skbuff.hlinux/if_vlan.hlinux/log2.hlinux/string.hnet/page_pool/helpers.hpci_hw.hpci.hcore.hcmd.hport.hresources.htxheader.h
Detected Declarations
struct mlxsw_pci_mem_itemstruct mlxsw_pci_queue_elem_infostruct mlxsw_pci_queuestruct mlxsw_pci_queue_type_groupstruct mlxsw_pcistruct mlxsw_pci_queue_opsenum mlxsw_pci_queue_typeenum mlxsw_pci_cq_typefunction mlxsw_pci_napi_devs_initfunction mlxsw_pci_napi_devs_finifunction mlxsw_pci_queue_elem_info_getfunction mlxsw_pci_queue_elem_info_producer_getfunction mlxsw_pci_queue_elem_info_consumer_getfunction mlxsw_pci_elem_hw_ownedfunction mlxsw_pci_queue_type_group_getfunction __mlxsw_pci_queue_getfunction __mlxsw_pci_queue_doorbell_setfunction __mlxsw_pci_queue_doorbell_arm_setfunction mlxsw_pci_queue_doorbell_producer_ringfunction mlxsw_pci_queue_doorbell_consumer_ringfunction mlxsw_pci_queue_doorbell_arm_consumer_ringfunction __mlxsw_pci_queue_page_getfunction mlxsw_pci_sdq_initfunction mlxsw_pci_sdq_finifunction SKB_DATA_ALIGNfunction mlxsw_pci_wqe_frag_mapfunction mlxsw_pci_wqe_frag_unmapfunction mlxsw_pci_rdq_page_allocfunction mlxsw_pci_rdq_page_freefunction mlxsw_pci_num_sg_entries_getfunction mlxsw_pci_elem_info_pages_ref_storefunction mlxsw_pci_rdq_pages_allocfunction mlxsw_pci_rdq_pages_recyclefunction mlxsw_pci_rdq_initfunction mlxsw_pci_rdq_finifunction mlxsw_pci_cq_pre_initfunction mlxsw_pci_read32_offfunction mlxsw_pci_skb_cb_ts_setfunction mlxsw_pci_cqe_sdq_handlefunction mlxsw_pci_cqe_rdq_md_tx_port_initfunction mlxsw_pci_cqe_rdq_md_initfunction mlxsw_pci_cqe_rdq_handlefunction mlxsw_pci_cq_cqe_to_handlefunction mlxsw_pci_napi_poll_cq_rxfunction mlxsw_pci_napi_poll_cq_txfunction mlxsw_pci_cq_typefunction mlxsw_pci_cq_napi_setupfunction mlxsw_pci_cq_napi_teardown
Annotated Snippet
int mlxsw_pci_driver_register(struct pci_driver *pci_driver)
{
pci_driver->probe = mlxsw_pci_probe;
pci_driver->remove = mlxsw_pci_remove;
pci_driver->shutdown = mlxsw_pci_remove;
pci_driver->err_handler = &mlxsw_pci_err_handler;
return pci_register_driver(pci_driver);
}
EXPORT_SYMBOL(mlxsw_pci_driver_register);
void mlxsw_pci_driver_unregister(struct pci_driver *pci_driver)
{
pci_unregister_driver(pci_driver);
}
EXPORT_SYMBOL(mlxsw_pci_driver_unregister);
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Jiri Pirko <jiri@mellanox.com>");
MODULE_DESCRIPTION("Mellanox switch PCI interface driver");
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/export.h`, `linux/err.h`, `linux/device.h`, `linux/pci.h`, `linux/interrupt.h`, `linux/types.h`.
- Detected declarations: `struct mlxsw_pci_mem_item`, `struct mlxsw_pci_queue_elem_info`, `struct mlxsw_pci_queue`, `struct mlxsw_pci_queue_type_group`, `struct mlxsw_pci`, `struct mlxsw_pci_queue_ops`, `enum mlxsw_pci_queue_type`, `enum mlxsw_pci_cq_type`, `function mlxsw_pci_napi_devs_init`, `function mlxsw_pci_napi_devs_fini`.
- 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.