drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c- Extension
.c- Size
- 17507 bytes
- Lines
- 491
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/netdevice.hlinux/etherdevice.hoctep_vf_config.hoctep_vf_main.hoctep_vf_regs_cn9k.h
Detected Declarations
function Copyrightfunction cn93_vf_reset_iqfunction cn93_vf_reset_oqfunction octep_vf_reset_io_queues_cn93function octep_vf_init_config_cn93_vffunction octep_vf_setup_iq_regs_cn93function octep_vf_setup_oq_regs_cn93function octep_vf_setup_mbox_regs_cn93function cn93_handle_vf_mbox_intrfunction octep_vf_ioq_intr_handler_cn93function octep_vf_reinit_regs_cn93function octep_vf_enable_interrupts_cn93function octep_vf_disable_interrupts_cn93function octep_vf_update_iq_read_index_cn93function octep_vf_enable_iq_cn93function octep_vf_enable_oq_cn93function octep_vf_enable_io_queues_cn93function octep_vf_disable_iq_cn93function octep_vf_disable_oq_cn93function octep_vf_disable_io_queues_cn93function octep_vf_dump_registers_cn93function octep_vf_device_setup_cn93
Annotated Snippet
if (reg_val & CN93_VF_SDP_R_MBOX_PF_VF_INT_STATUS) {
cn93_handle_vf_mbox_intr(oct);
octep_vf_write_csr64(oct, CN93_VF_SDP_R_MBOX_PF_VF_INT(0), reg_val);
}
}
napi_schedule_irqoff(oq->napi);
return IRQ_HANDLED;
}
/* Re-initialize Octeon hardware registers */
static void octep_vf_reinit_regs_cn93(struct octep_vf_device *oct)
{
u32 i;
for (i = 0; i < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); i++)
oct->hw_ops.setup_iq_regs(oct, i);
for (i = 0; i < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); i++)
oct->hw_ops.setup_oq_regs(oct, i);
oct->hw_ops.enable_interrupts(oct);
oct->hw_ops.enable_io_queues(oct);
for (i = 0; i < CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf); i++)
writel(oct->oq[i]->max_count, oct->oq[i]->pkts_credit_reg);
}
/* Enable all interrupts */
static void octep_vf_enable_interrupts_cn93(struct octep_vf_device *oct)
{
int num_rings, q;
u64 reg_val;
num_rings = CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf);
for (q = 0; q < num_rings; q++) {
reg_val = octep_vf_read_csr64(oct, CN93_VF_SDP_R_IN_INT_LEVELS(q));
reg_val |= BIT_ULL_MASK(62);
octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_INT_LEVELS(q), reg_val);
reg_val = octep_vf_read_csr64(oct, CN93_VF_SDP_R_OUT_INT_LEVELS(q));
reg_val |= BIT_ULL_MASK(62);
octep_vf_write_csr64(oct, CN93_VF_SDP_R_OUT_INT_LEVELS(q), reg_val);
}
/* Enable PF to VF mbox interrupt by setting 2nd bit*/
octep_vf_write_csr64(oct, CN93_VF_SDP_R_MBOX_PF_VF_INT(0),
CN93_VF_SDP_R_MBOX_PF_VF_INT_ENAB);
}
/* Disable all interrupts */
static void octep_vf_disable_interrupts_cn93(struct octep_vf_device *oct)
{
int num_rings, q;
u64 reg_val;
/* Disable PF to VF mbox interrupt by setting 2nd bit*/
if (oct->mbox)
octep_vf_write_csr64(oct, CN93_VF_SDP_R_MBOX_PF_VF_INT(0), 0x0);
num_rings = CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf);
for (q = 0; q < num_rings; q++) {
reg_val = octep_vf_read_csr64(oct, CN93_VF_SDP_R_IN_INT_LEVELS(q));
reg_val &= ~BIT_ULL_MASK(62);
octep_vf_write_csr64(oct, CN93_VF_SDP_R_IN_INT_LEVELS(q), reg_val);
reg_val = octep_vf_read_csr64(oct, CN93_VF_SDP_R_OUT_INT_LEVELS(q));
reg_val &= ~BIT_ULL_MASK(62);
octep_vf_write_csr64(oct, CN93_VF_SDP_R_OUT_INT_LEVELS(q), reg_val);
}
}
/* Get new Octeon Read Index: index of descriptor that Octeon reads next. */
static u32 octep_vf_update_iq_read_index_cn93(struct octep_vf_iq *iq)
{
u32 pkt_in_done = readl(iq->inst_cnt_reg);
u32 last_done, new_idx;
last_done = pkt_in_done - iq->pkt_in_done;
iq->pkt_in_done = pkt_in_done;
new_idx = (iq->octep_vf_read_index + last_done) % iq->max_count;
return new_idx;
}
/* Enable a hardware Tx Queue */
static void octep_vf_enable_iq_cn93(struct octep_vf_device *oct, int iq_no)
{
u64 loop = HZ;
u64 reg_val;
Annotation
- Immediate include surface: `linux/pci.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `octep_vf_config.h`, `octep_vf_main.h`, `octep_vf_regs_cn9k.h`.
- Detected declarations: `function Copyright`, `function cn93_vf_reset_iq`, `function cn93_vf_reset_oq`, `function octep_vf_reset_io_queues_cn93`, `function octep_vf_init_config_cn93_vf`, `function octep_vf_setup_iq_regs_cn93`, `function octep_vf_setup_oq_regs_cn93`, `function octep_vf_setup_mbox_regs_cn93`, `function cn93_handle_vf_mbox_intr`, `function octep_vf_ioq_intr_handler_cn93`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.