drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c- Extension
.c- Size
- 18563 bytes
- Lines
- 719
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
otx2_common.hotx2_reg.hotx2_struct.hcn10k.h
Detected Declarations
function Copyrightfunction cn20k_vfaf_mbox_intr_handlerfunction cn20k_enable_pfvf_mbox_intrfunction cn20k_disable_pfvf_mbox_intrfunction cn20k_pfvf_mbox_intr_handlerfunction cn20k_register_pfvf_mbox_intrfunction cn20k_aura_bpid_idxfunction cn20k_tc_get_entry_indexfunction list_for_each_entryfunction cn20k_tc_free_mcam_entryfunction cn20k_tc_check_entry_shiftablefunction cn20k_tc_update_mcam_table_del_reqfunction list_for_each_entry_safefunction cn20k_tc_update_mcam_table_add_reqfunction __cn20k_tc_alloc_entryfunction cn20k_tc_alloc_entryfunction cn20k_aura_aq_initfunction cn20k_pool_aq_initfunction cn20k_sq_aq_initfunction cn20k_initexport cn20k_init
Annotated Snippet
switch (intr_vec) {
case RVU_MBOX_PF_INT_VEC_VFPF_MBOX0:
irq_data[vec].intr_status =
RVU_MBOX_PF_VFPF_INTX(0);
irq_data[vec].start = 0;
irq_data[vec].mdevs = 64;
break;
case RVU_MBOX_PF_INT_VEC_VFPF_MBOX1:
irq_data[vec].intr_status =
RVU_MBOX_PF_VFPF_INTX(1);
irq_data[vec].start = 64;
irq_data[vec].mdevs = 96;
break;
case RVU_MBOX_PF_INT_VEC_VFPF1_MBOX0:
irq_data[vec].intr_status =
RVU_MBOX_PF_VFPF1_INTX(0);
irq_data[vec].start = 0;
irq_data[vec].mdevs = 64;
break;
case RVU_MBOX_PF_INT_VEC_VFPF1_MBOX1:
irq_data[vec].intr_status =
RVU_MBOX_PF_VFPF1_INTX(1);
irq_data[vec].start = 64;
irq_data[vec].mdevs = 96;
break;
}
irq_data[vec].pf_queue_work_hdlr = otx2_queue_vf_work;
irq_data[vec].vec_num = intr_vec;
irq_data[vec].pf = pf;
/* Register mailbox interrupt handler */
irq_name = &hw->irq_name[intr_vec * NAME_SIZE];
if (pf->pcifunc)
snprintf(irq_name, NAME_SIZE,
"RVUPF%d_VF%d Mbox%d", rvu_get_pf(pf->pdev,
pf->pcifunc), vec / 2, vec % 2);
else
snprintf(irq_name, NAME_SIZE, "RVUPF_VF%d Mbox%d",
vec / 2, vec % 2);
hw->pfvf_irq_devid[vec] = &irq_data[vec];
ret = request_irq(pci_irq_vector(pf->pdev, intr_vec),
pf->hw_ops->pfvf_mbox_intr_handler, 0,
irq_name,
&irq_data[vec]);
if (ret) {
dev_err(pf->dev,
"RVUPF: IRQ registration failed for PFVF mbox0 irq\n");
return ret;
}
}
cn20k_enable_pfvf_mbox_intr(pf, numvfs);
return 0;
}
#define RQ_BP_LVL_AURA (255 - ((85 * 256) / 100)) /* BP when 85% is full */
static u8 cn20k_aura_bpid_idx(struct otx2_nic *pfvf, int aura_id)
{
#ifdef CONFIG_DCB
return pfvf->queue_to_pfc_map[aura_id];
#else
return 0;
#endif
}
static int cn20k_tc_get_entry_index(struct otx2_flow_config *flow_cfg,
struct otx2_tc_flow *node)
{
struct otx2_tc_flow *tmp;
int index = 0;
list_for_each_entry(tmp, &flow_cfg->flow_list_tc, list) {
if (tmp == node)
return index;
index++;
}
return -1;
}
int cn20k_tc_free_mcam_entry(struct otx2_nic *nic, u16 entry)
{
struct npc_mcam_free_entry_req *req;
int err;
mutex_lock(&nic->mbox.lock);
Annotation
- Immediate include surface: `otx2_common.h`, `otx2_reg.h`, `otx2_struct.h`, `cn10k.h`.
- Detected declarations: `function Copyright`, `function cn20k_vfaf_mbox_intr_handler`, `function cn20k_enable_pfvf_mbox_intr`, `function cn20k_disable_pfvf_mbox_intr`, `function cn20k_pfvf_mbox_intr_handler`, `function cn20k_register_pfvf_mbox_intr`, `function cn20k_aura_bpid_idx`, `function cn20k_tc_get_entry_index`, `function list_for_each_entry`, `function cn20k_tc_free_mcam_entry`.
- 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.