drivers/net/ethernet/marvell/octeon_ep/octep_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeon_ep/octep_main.c- Extension
.c- Size
- 44331 bytes
- Lines
- 1709
- 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/types.hlinux/module.hlinux/pci.hlinux/netdevice.hlinux/etherdevice.hlinux/rtnetlink.hlinux/vmalloc.hoctep_config.hoctep_main.hoctep_ctrl_net.hoctep_pfvf_mbox.h
Detected Declarations
function octep_alloc_ioq_vectorsfunction octep_free_ioq_vectorsfunction octep_enable_msix_rangefunction octep_disable_msixfunction octep_mbox_intr_handlerfunction octep_oei_intr_handlerfunction octep_ire_intr_handlerfunction octep_ore_intr_handlerfunction octep_vfire_intr_handlerfunction octep_vfore_intr_handlerfunction octep_dma_intr_handlerfunction octep_dma_vf_intr_handlerfunction octep_pp_vf_intr_handlerfunction octep_misc_intr_handlerfunction octep_rsvd_intr_handlerfunction octep_ioq_intr_handlerfunction octep_request_irqsfunction strlenfunction strlenfunction strlenfunction strlenfunction strlenfunction strlenfunction strlenfunction strlenfunction strlenfunction octep_free_irqsfunction octep_setup_irqsfunction octep_clean_irqsfunction octep_update_pktfunction octep_enable_ioq_irqfunction octep_napi_pollfunction octep_napi_addfunction octep_napi_deletefunction octep_napi_enablefunction octep_napi_disablefunction octep_link_upfunction octep_openfunction octep_stopfunction octep_iq_full_checkfunction octep_start_xmitfunction octep_get_stats64function octep_tx_timeout_taskfunction octep_tx_timeoutfunction octep_set_macfunction octep_change_mtufunction octep_set_featuresfunction octep_is_vf_valid
Annotated Snippet
static const struct net_device_ops octep_netdev_ops = {
.ndo_open = octep_open,
.ndo_stop = octep_stop,
.ndo_start_xmit = octep_start_xmit,
.ndo_get_stats64 = octep_get_stats64,
.ndo_tx_timeout = octep_tx_timeout,
.ndo_set_mac_address = octep_set_mac,
.ndo_change_mtu = octep_change_mtu,
.ndo_set_features = octep_set_features,
.ndo_get_vf_config = octep_get_vf_config,
.ndo_set_vf_mac = octep_set_vf_mac
};
/**
* octep_intr_poll_task - work queue task to process non-ioq interrupts.
*
* @work: pointer to mbox work_struct
*
* Process non-ioq interrupts to handle control mailbox, pfvf mailbox.
**/
static void octep_intr_poll_task(struct work_struct *work)
{
struct octep_device *oct = container_of(work, struct octep_device,
intr_poll_task.work);
if (!oct->poll_non_ioq_intr) {
dev_info(&oct->pdev->dev, "Interrupt poll task stopped.\n");
return;
}
oct->hw_ops.poll_non_ioq_interrupts(oct);
queue_delayed_work(octep_wq, &oct->intr_poll_task,
msecs_to_jiffies(OCTEP_INTR_POLL_TIME_MSECS));
}
/**
* octep_hb_timeout_task - work queue task to check firmware heartbeat.
*
* @work: pointer to hb work_struct
*
* Check for heartbeat miss count. Uninitialize oct device if miss count
* exceeds configured max heartbeat miss count.
*
**/
static void octep_hb_timeout_task(struct work_struct *work)
{
struct octep_device *oct = container_of(work, struct octep_device,
hb_task.work);
int miss_cnt;
miss_cnt = atomic_inc_return(&oct->hb_miss_cnt);
if (miss_cnt < oct->conf->fw_info.hb_miss_count) {
queue_delayed_work(octep_wq, &oct->hb_task,
msecs_to_jiffies(oct->conf->fw_info.hb_interval));
return;
}
dev_err(&oct->pdev->dev, "Missed %u heartbeats. Uninitializing\n",
miss_cnt);
rtnl_lock();
if (netif_running(oct->netdev))
dev_close(oct->netdev);
rtnl_unlock();
}
/**
* octep_ctrl_mbox_task - work queue task to handle ctrl mbox messages.
*
* @work: pointer to ctrl mbox work_struct
*
* Poll ctrl mbox message queue and handle control messages from firmware.
**/
static void octep_ctrl_mbox_task(struct work_struct *work)
{
struct octep_device *oct = container_of(work, struct octep_device,
ctrl_mbox_task);
octep_ctrl_net_recv_fw_messages(oct);
}
static const char *octep_devid_to_str(struct octep_device *oct)
{
switch (oct->chip_id) {
case OCTEP_PCI_DEVICE_ID_CN98_PF:
return "CN98XX";
case OCTEP_PCI_DEVICE_ID_CN93_PF:
return "CN93XX";
case OCTEP_PCI_DEVICE_ID_CNF95N_PF:
return "CNF95N";
Annotation
- Immediate include surface: `linux/types.h`, `linux/module.h`, `linux/pci.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/rtnetlink.h`, `linux/vmalloc.h`, `octep_config.h`.
- Detected declarations: `function octep_alloc_ioq_vectors`, `function octep_free_ioq_vectors`, `function octep_enable_msix_range`, `function octep_disable_msix`, `function octep_mbox_intr_handler`, `function octep_oei_intr_handler`, `function octep_ire_intr_handler`, `function octep_ore_intr_handler`, `function octep_vfire_intr_handler`, `function octep_vfore_intr_handler`.
- 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.