drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c- Extension
.c- Size
- 32054 bytes
- Lines
- 1239
- 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.
- 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/types.hlinux/module.hlinux/pci.hlinux/aer.hlinux/netdevice.hlinux/etherdevice.hlinux/rtnetlink.hlinux/vmalloc.hnet/netdev_queues.hoctep_vf_config.hoctep_vf_main.h
Detected Declarations
function octep_vf_alloc_ioq_vectorsfunction octep_vf_free_ioq_vectorsfunction octep_vf_enable_msix_rangefunction octep_vf_disable_msixfunction octep_vf_ioq_intr_handlerfunction octep_vf_request_irqsfunction octep_vf_free_irqsfunction octep_vf_setup_irqsfunction octep_vf_clean_irqsfunction octep_vf_update_pktfunction octep_vf_enable_ioq_irqfunction octep_vf_napi_pollfunction octep_vf_napi_addfunction octep_vf_napi_deletefunction octep_vf_napi_enablefunction octep_vf_napi_disablefunction octep_vf_link_upfunction octep_vf_set_rx_statefunction octep_vf_get_link_statusfunction octep_vf_set_link_statusfunction octep_vf_openfunction octep_vf_stopfunction octep_vf_iq_full_checkfunction octep_vf_start_xmitfunction octep_vf_get_if_statsfunction octep_vf_get_link_infofunction octep_vf_get_stats64function octep_vf_tx_timeout_taskfunction octep_vf_tx_timeoutfunction octep_vf_set_macfunction octep_vf_change_mtufunction octep_vf_set_featuresfunction octep_vf_device_setupfunction octep_vf_device_cleanupfunction octep_vf_get_mac_addrfunction octep_vf_probefunction octep_vf_removefunction octep_vf_init_modulefunction octep_vf_exit_modulemodule init octep_vf_init_module
Annotated Snippet
static const struct net_device_ops octep_vf_netdev_ops = {
.ndo_open = octep_vf_open,
.ndo_stop = octep_vf_stop,
.ndo_start_xmit = octep_vf_start_xmit,
.ndo_get_stats64 = octep_vf_get_stats64,
.ndo_tx_timeout = octep_vf_tx_timeout,
.ndo_set_mac_address = octep_vf_set_mac,
.ndo_change_mtu = octep_vf_change_mtu,
.ndo_set_features = octep_vf_set_features,
};
static const char *octep_vf_devid_to_str(struct octep_vf_device *oct)
{
switch (oct->chip_id) {
case OCTEP_PCI_DEVICE_ID_CN93_VF:
return "CN93XX";
case OCTEP_PCI_DEVICE_ID_CNF95N_VF:
return "CNF95N";
case OCTEP_PCI_DEVICE_ID_CN10KA_VF:
return "CN10KA";
case OCTEP_PCI_DEVICE_ID_CNF10KA_VF:
return "CNF10KA";
case OCTEP_PCI_DEVICE_ID_CNF10KB_VF:
return "CNF10KB";
case OCTEP_PCI_DEVICE_ID_CN10KB_VF:
return "CN10KB";
default:
return "Unsupported";
}
}
/**
* octep_vf_device_setup() - Setup Octeon Device.
*
* @oct: Octeon device private data structure.
*
* Setup Octeon device hardware operations, configuration, etc ...
*/
int octep_vf_device_setup(struct octep_vf_device *oct)
{
struct pci_dev *pdev = oct->pdev;
/* allocate memory for oct->conf */
oct->conf = kzalloc_obj(*oct->conf);
if (!oct->conf)
return -ENOMEM;
/* Map BAR region 0 */
oct->mmio.hw_addr = ioremap(pci_resource_start(oct->pdev, 0),
pci_resource_len(oct->pdev, 0));
if (!oct->mmio.hw_addr) {
dev_err(&pdev->dev,
"Failed to remap BAR0; start=0x%llx len=0x%llx\n",
pci_resource_start(oct->pdev, 0),
pci_resource_len(oct->pdev, 0));
goto ioremap_err;
}
oct->mmio.mapped = 1;
oct->chip_id = pdev->device;
oct->rev_id = pdev->revision;
dev_info(&pdev->dev, "chip_id = 0x%x\n", pdev->device);
switch (oct->chip_id) {
case OCTEP_PCI_DEVICE_ID_CN93_VF:
case OCTEP_PCI_DEVICE_ID_CNF95N_VF:
case OCTEP_PCI_DEVICE_ID_CN98_VF:
dev_info(&pdev->dev, "Setting up OCTEON %s VF PASS%d.%d\n",
octep_vf_devid_to_str(oct), OCTEP_VF_MAJOR_REV(oct),
OCTEP_VF_MINOR_REV(oct));
octep_vf_device_setup_cn93(oct);
break;
case OCTEP_PCI_DEVICE_ID_CNF10KA_VF:
case OCTEP_PCI_DEVICE_ID_CN10KA_VF:
case OCTEP_PCI_DEVICE_ID_CNF10KB_VF:
case OCTEP_PCI_DEVICE_ID_CN10KB_VF:
dev_info(&pdev->dev, "Setting up OCTEON %s VF PASS%d.%d\n",
octep_vf_devid_to_str(oct), OCTEP_VF_MAJOR_REV(oct),
OCTEP_VF_MINOR_REV(oct));
octep_vf_device_setup_cnxk(oct);
break;
default:
dev_err(&pdev->dev, "Unsupported device\n");
goto unsupported_dev;
}
return 0;
unsupported_dev:
iounmap(oct->mmio.hw_addr);
Annotation
- Immediate include surface: `linux/types.h`, `linux/module.h`, `linux/pci.h`, `linux/aer.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/rtnetlink.h`, `linux/vmalloc.h`.
- Detected declarations: `function octep_vf_alloc_ioq_vectors`, `function octep_vf_free_ioq_vectors`, `function octep_vf_enable_msix_range`, `function octep_vf_disable_msix`, `function octep_vf_ioq_intr_handler`, `function octep_vf_request_irqs`, `function octep_vf_free_irqs`, `function octep_vf_setup_irqs`, `function octep_vf_clean_irqs`, `function octep_vf_update_pkt`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- 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.