drivers/net/ethernet/cavium/liquidio/cn68xx_device.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cavium/liquidio/cn68xx_device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cavium/liquidio/cn68xx_device.c- Extension
.c- Size
- 5735 bytes
- Lines
- 185
- 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.
- 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.hcn68xx_device.hcn68xx_regs.h
Detected Declarations
function lio_cn68xx_set_dpi_regsfunction lio_cn68xx_soft_resetfunction lio_cn68xx_setup_pkt_ctl_regsfunction lio_cn68xx_setup_device_regsfunction lio_cn68xx_vendor_message_fixfunction lio_is_210nvfunction lio_setup_cn68xx_octeon_deviceexport lio_setup_cn68xx_octeon_device
Annotated Snippet
#include <linux/pci.h>
#include <linux/netdevice.h>
#include "liquidio_common.h"
#include "octeon_droq.h"
#include "octeon_iq.h"
#include "response_manager.h"
#include "octeon_device.h"
#include "octeon_main.h"
#include "cn66xx_regs.h"
#include "cn66xx_device.h"
#include "cn68xx_device.h"
#include "cn68xx_regs.h"
static void lio_cn68xx_set_dpi_regs(struct octeon_device *oct)
{
u32 i;
u32 fifo_sizes[6] = { 3, 3, 1, 1, 1, 8 };
lio_pci_writeq(oct, CN6XXX_DPI_DMA_CTL_MASK, CN6XXX_DPI_DMA_CONTROL);
dev_dbg(&oct->pci_dev->dev, "DPI_DMA_CONTROL: 0x%016llx\n",
lio_pci_readq(oct, CN6XXX_DPI_DMA_CONTROL));
for (i = 0; i < 6; i++) {
/* Prevent service of instruction queue for all DMA engines
* Engine 5 will remain 0. Engines 0 - 4 will be setup by
* core.
*/
lio_pci_writeq(oct, 0, CN6XXX_DPI_DMA_ENG_ENB(i));
lio_pci_writeq(oct, fifo_sizes[i], CN6XXX_DPI_DMA_ENG_BUF(i));
dev_dbg(&oct->pci_dev->dev, "DPI_ENG_BUF%d: 0x%016llx\n", i,
lio_pci_readq(oct, CN6XXX_DPI_DMA_ENG_BUF(i)));
}
/* DPI_SLI_PRT_CFG has MPS and MRRS settings that will be set
* separately.
*/
lio_pci_writeq(oct, 1, CN6XXX_DPI_CTL);
dev_dbg(&oct->pci_dev->dev, "DPI_CTL: 0x%016llx\n",
lio_pci_readq(oct, CN6XXX_DPI_CTL));
}
static int lio_cn68xx_soft_reset(struct octeon_device *oct)
{
lio_cn6xxx_soft_reset(oct);
lio_cn68xx_set_dpi_regs(oct);
return 0;
}
static void lio_cn68xx_setup_pkt_ctl_regs(struct octeon_device *oct)
{
struct octeon_cn6xxx *cn68xx = (struct octeon_cn6xxx *)oct->chip;
u64 pktctl, tx_pipe, max_oqs;
pktctl = octeon_read_csr64(oct, CN6XXX_SLI_PKT_CTL);
/* 68XX specific */
max_oqs = CFG_GET_OQ_MAX_Q(CHIP_CONF(oct, cn6xxx));
tx_pipe = octeon_read_csr64(oct, CN68XX_SLI_TX_PIPE);
tx_pipe &= 0xffffffffff00ffffULL; /* clear out NUMP field */
tx_pipe |= max_oqs << 16; /* put max_oqs in NUMP field */
octeon_write_csr64(oct, CN68XX_SLI_TX_PIPE, tx_pipe);
if (CFG_GET_IS_SLI_BP_ON(cn68xx->conf))
pktctl |= 0xF;
else
/* Disable per-port backpressure. */
pktctl &= ~0xF;
octeon_write_csr64(oct, CN6XXX_SLI_PKT_CTL, pktctl);
}
static int lio_cn68xx_setup_device_regs(struct octeon_device *oct)
{
lio_cn6xxx_setup_pcie_mps(oct, PCIE_MPS_DEFAULT);
lio_cn6xxx_setup_pcie_mrrs(oct, PCIE_MRRS_256B);
lio_cn6xxx_enable_error_reporting(oct);
lio_cn6xxx_setup_global_input_regs(oct);
lio_cn68xx_setup_pkt_ctl_regs(oct);
lio_cn6xxx_setup_global_output_regs(oct);
/* Default error timeout value should be 0x200000 to avoid host hang
* when reads invalid register
*/
octeon_write_csr64(oct, CN6XXX_SLI_WINDOW_CTL, 0x200000ULL);
return 0;
}
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_cn68xx_set_dpi_regs`, `function lio_cn68xx_soft_reset`, `function lio_cn68xx_setup_pkt_ctl_regs`, `function lio_cn68xx_setup_device_regs`, `function lio_cn68xx_vendor_message_fix`, `function lio_is_210nv`, `function lio_setup_cn68xx_octeon_device`, `export lio_setup_cn68xx_octeon_device`.
- 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.
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.