drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c- Extension
.c- Size
- 38271 bytes
- Lines
- 1307
- 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.
- 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/pci.hlinux/vmalloc.hlinux/etherdevice.hliquidio_common.hocteon_droq.hocteon_iq.hresponse_manager.hocteon_device.hcn23xx_pf_device.hocteon_main.hocteon_mailbox.h
Detected Declarations
function cn23xx_pf_soft_resetfunction cn23xx_enable_error_reportingfunction cn23xx_coprocessor_clockfunction cn23xx_pf_get_oq_ticksfunction cn23xx_setup_global_mac_regsfunction cn23xx_reset_io_queuesfunction cn23xx_pf_setup_global_input_regsfunction cn23xx_pf_setup_global_output_regsfunction cn23xx_setup_pf_device_regsfunction cn23xx_setup_iq_regsfunction cn23xx_setup_oq_regsfunction cn23xx_pf_mbox_threadfunction cn23xx_setup_pf_mboxfunction cn23xx_free_pf_mboxfunction cn23xx_enable_io_queuesfunction cn23xx_disable_io_queuesfunction cn23xx_pf_msix_interrupt_handlerfunction cn23xx_handle_pf_mbox_intrfunction cn23xx_interrupt_handlerfunction cn23xx_bar1_idx_setupfunction cn23xx_bar1_idx_writefunction cn23xx_bar1_idx_readfunction cn23xx_update_read_indexfunction cn23xx_enable_pf_interruptfunction cn23xx_disable_pf_interruptfunction cn23xx_get_pcie_qlmportfunction cn23xx_get_pf_numfunction cn23xx_setup_reg_addressfunction cn23xx_sriov_configfunction setup_cn23xx_octeon_pf_devicefunction cn23xx_fw_loadedfunction cn23xx_tell_vf_its_macaddr_changedfunction cn23xx_get_vf_stats_callbackfunction cn23xx_get_vf_statsexport setup_cn23xx_octeon_pf_deviceexport cn23xx_fw_loadedexport cn23xx_tell_vf_its_macaddr_changedexport cn23xx_get_vf_stats
Annotated Snippet
if (!loop) {
dev_err(&oct->pci_dev->dev,
"clearing the reset reg failed or setting the quiet reg failed for qno: %u\n",
q_no);
return -1;
}
WRITE_ONCE(reg_val, READ_ONCE(reg_val) &
~CN23XX_PKT_INPUT_CTL_RST);
octeon_write_csr64(oct, CN23XX_SLI_IQ_PKT_CONTROL64(q_no),
READ_ONCE(reg_val));
WRITE_ONCE(reg_val, octeon_read_csr64(
oct, CN23XX_SLI_IQ_PKT_CONTROL64(q_no)));
if (READ_ONCE(reg_val) & CN23XX_PKT_INPUT_CTL_RST) {
dev_err(&oct->pci_dev->dev,
"clearing the reset failed for qno: %u\n",
q_no);
ret_val = -1;
}
}
return ret_val;
}
static int cn23xx_pf_setup_global_input_regs(struct octeon_device *oct)
{
struct octeon_cn23xx_pf *cn23xx = (struct octeon_cn23xx_pf *)oct->chip;
struct octeon_instr_queue *iq;
u64 intr_threshold, reg_val;
u32 q_no, ern, srn;
u64 pf_num;
u64 vf_num;
pf_num = oct->pf_num;
srn = oct->sriov_info.pf_srn;
ern = srn + oct->sriov_info.num_pf_rings;
if (cn23xx_reset_io_queues(oct))
return -1;
/* Set the MAC_NUM and PVF_NUM in IQ_PKT_CONTROL reg
* for all queues. Only PF can set these bits.
* bits 29:30 indicate the MAC num.
* bits 32:47 indicate the PVF num.
*/
for (q_no = 0; q_no < ern; q_no++) {
reg_val = (u64)oct->pcie_port << CN23XX_PKT_INPUT_CTL_MAC_NUM_POS;
/* For VF assigned queues. */
if (q_no < oct->sriov_info.pf_srn) {
vf_num = q_no / oct->sriov_info.rings_per_vf;
vf_num += 1; /* VF1, VF2,........ */
} else {
vf_num = 0;
}
reg_val |= vf_num << CN23XX_PKT_INPUT_CTL_VF_NUM_POS;
reg_val |= pf_num << CN23XX_PKT_INPUT_CTL_PF_NUM_POS;
octeon_write_csr64(oct, CN23XX_SLI_IQ_PKT_CONTROL64(q_no),
reg_val);
}
/* Select ES, RO, NS, RDSIZE,DPTR Format#0 for
* pf queues
*/
for (q_no = srn; q_no < ern; q_no++) {
void __iomem *inst_cnt_reg;
iq = oct->instr_queue[q_no];
if (iq)
inst_cnt_reg = iq->inst_cnt_reg;
else
inst_cnt_reg = (u8 *)oct->mmio[0].hw_addr +
CN23XX_SLI_IQ_INSTR_COUNT64(q_no);
reg_val =
octeon_read_csr64(oct, CN23XX_SLI_IQ_PKT_CONTROL64(q_no));
reg_val |= CN23XX_PKT_INPUT_CTL_MASK;
octeon_write_csr64(oct, CN23XX_SLI_IQ_PKT_CONTROL64(q_no),
reg_val);
/* Set WMARK level to trigger PI_INT */
/* intr_threshold = CN23XX_DEF_IQ_INTR_THRESHOLD & */
intr_threshold = CFG_GET_IQ_INTR_PKT(cn23xx->conf) &
CN23XX_PKT_IN_DONE_WMARK_MASK;
Annotation
- Immediate include surface: `linux/pci.h`, `linux/vmalloc.h`, `linux/etherdevice.h`, `liquidio_common.h`, `octeon_droq.h`, `octeon_iq.h`, `response_manager.h`, `octeon_device.h`.
- Detected declarations: `function cn23xx_pf_soft_reset`, `function cn23xx_enable_error_reporting`, `function cn23xx_coprocessor_clock`, `function cn23xx_pf_get_oq_ticks`, `function cn23xx_setup_global_mac_regs`, `function cn23xx_reset_io_queues`, `function cn23xx_pf_setup_global_input_regs`, `function cn23xx_pf_setup_global_output_regs`, `function cn23xx_setup_pf_device_regs`, `function cn23xx_setup_iq_regs`.
- 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.