drivers/net/ethernet/cavium/liquidio/cn66xx_device.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cavium/liquidio/cn66xx_device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cavium/liquidio/cn66xx_device.c- Extension
.c- Size
- 22306 bytes
- Lines
- 739
- 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
linux/pci.hlinux/netdevice.hliquidio_common.hocteon_droq.hocteon_iq.hresponse_manager.hocteon_device.hocteon_main.hcn66xx_regs.hcn66xx_device.h
Detected Declarations
function lio_cn6xxx_soft_resetfunction lio_cn6xxx_enable_error_reportingfunction lio_cn6xxx_setup_pcie_mpsfunction lio_cn6xxx_setup_pcie_mrrsfunction lio_cn6xxx_coprocessor_clockfunction lio_cn6xxx_get_oq_ticksfunction lio_cn6xxx_setup_global_input_regsfunction lio_cn66xx_setup_pkt_ctl_regsfunction lio_cn6xxx_setup_global_output_regsfunction lio_cn6xxx_setup_device_regsfunction lio_cn6xxx_setup_iq_regsfunction lio_cn66xx_setup_iq_regsfunction lio_cn6xxx_setup_oq_regsfunction lio_cn6xxx_enable_io_queuesfunction lio_cn6xxx_disable_io_queuesfunction lio_cn6xxx_bar1_idx_setupfunction lio_cn6xxx_bar1_idx_writefunction lio_cn6xxx_bar1_idx_readfunction lio_cn6xxx_update_read_indexfunction lio_cn6xxx_enable_interruptfunction lio_cn6xxx_disable_interruptfunction lio_cn6xxx_get_pcie_qlmportfunction lio_cn6xxx_process_pcie_error_intrfunction lio_cn6xxx_process_droq_intr_regsfunction lio_cn6xxx_process_interrupt_regsfunction lio_cn6xxx_setup_reg_addressfunction lio_setup_cn66xx_octeon_devicefunction lio_validate_cn6xxx_config_infoexport lio_setup_cn66xx_octeon_device
Annotated Snippet
if (pkt_count) {
oct->droq_intr |= BIT_ULL(oq_no);
if (droq->ops.poll_mode) {
u32 value;
u32 reg;
struct octeon_cn6xxx *cn6xxx =
(struct octeon_cn6xxx *)oct->chip;
/* disable interrupts for this droq */
spin_lock
(&cn6xxx->lock_for_droq_int_enb_reg);
reg = CN6XXX_SLI_PKT_TIME_INT_ENB;
value = octeon_read_csr(oct, reg);
value &= ~(1 << oq_no);
octeon_write_csr(oct, reg, value);
reg = CN6XXX_SLI_PKT_CNT_INT_ENB;
value = octeon_read_csr(oct, reg);
value &= ~(1 << oq_no);
octeon_write_csr(oct, reg, value);
spin_unlock(&cn6xxx->lock_for_droq_int_enb_reg);
}
}
}
droq_time_mask &= oct->io_qmask.oq;
droq_cnt_mask &= oct->io_qmask.oq;
/* Reset the PKT_CNT/TIME_INT registers. */
if (droq_time_mask)
octeon_write_csr(oct, CN6XXX_SLI_PKT_TIME_INT, droq_time_mask);
if (droq_cnt_mask) /* reset PKT_CNT register:66xx */
octeon_write_csr(oct, CN6XXX_SLI_PKT_CNT_INT, droq_cnt_mask);
return 0;
}
irqreturn_t lio_cn6xxx_process_interrupt_regs(void *dev)
{
struct octeon_device *oct = (struct octeon_device *)dev;
struct octeon_cn6xxx *cn6xxx = (struct octeon_cn6xxx *)oct->chip;
u64 intr64;
intr64 = readq(cn6xxx->intr_sum_reg64);
/* If our device has interrupted, then proceed.
* Also check for all f's if interrupt was triggered on an error
* and the PCI read fails.
*/
if (!intr64 || (intr64 == 0xFFFFFFFFFFFFFFFFULL))
return IRQ_NONE;
oct->int_status = 0;
if (intr64 & CN6XXX_INTR_ERR)
lio_cn6xxx_process_pcie_error_intr(oct, intr64);
if (intr64 & CN6XXX_INTR_PKT_DATA) {
lio_cn6xxx_process_droq_intr_regs(oct);
oct->int_status |= OCT_DEV_INTR_PKT_DATA;
}
if (intr64 & CN6XXX_INTR_DMA0_FORCE)
oct->int_status |= OCT_DEV_INTR_DMA0_FORCE;
if (intr64 & CN6XXX_INTR_DMA1_FORCE)
oct->int_status |= OCT_DEV_INTR_DMA1_FORCE;
/* Clear the current interrupts */
writeq(intr64, cn6xxx->intr_sum_reg64);
return IRQ_HANDLED;
}
void lio_cn6xxx_setup_reg_address(struct octeon_device *oct,
void *chip,
struct octeon_reg_list *reg_list)
{
u8 __iomem *bar0_pciaddr = oct->mmio[0].hw_addr;
struct octeon_cn6xxx *cn6xxx = (struct octeon_cn6xxx *)chip;
reg_list->pci_win_wr_addr_hi =
(u32 __iomem *)(bar0_pciaddr + CN6XXX_WIN_WR_ADDR_HI);
reg_list->pci_win_wr_addr_lo =
(u32 __iomem *)(bar0_pciaddr + CN6XXX_WIN_WR_ADDR_LO);
reg_list->pci_win_wr_addr =
(u64 __iomem *)(bar0_pciaddr + CN6XXX_WIN_WR_ADDR64);
Annotation
- Immediate include surface: `linux/pci.h`, `linux/netdevice.h`, `liquidio_common.h`, `octeon_droq.h`, `octeon_iq.h`, `response_manager.h`, `octeon_device.h`, `octeon_main.h`.
- Detected declarations: `function lio_cn6xxx_soft_reset`, `function lio_cn6xxx_enable_error_reporting`, `function lio_cn6xxx_setup_pcie_mps`, `function lio_cn6xxx_setup_pcie_mrrs`, `function lio_cn6xxx_coprocessor_clock`, `function lio_cn6xxx_get_oq_ticks`, `function lio_cn6xxx_setup_global_input_regs`, `function lio_cn66xx_setup_pkt_ctl_regs`, `function lio_cn6xxx_setup_global_output_regs`, `function lio_cn6xxx_setup_device_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.