drivers/net/ethernet/cavium/liquidio/octeon_device.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cavium/liquidio/octeon_device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cavium/liquidio/octeon_device.c- Extension
.c- Size
- 39694 bytes
- Lines
- 1474
- 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/netdevice.hlinux/vmalloc.hliquidio_common.hocteon_droq.hocteon_iq.hresponse_manager.hocteon_device.hocteon_main.hocteon_network.hcn66xx_regs.hcn66xx_device.hcn23xx_pf_device.hcn23xx_vf_device.h
Detected Declarations
function oct_set_config_infofunction octeon_init_device_listfunction __verify_octeon_config_infofunction octeon_free_device_memfunction octeon_register_devicefunction octeon_deregister_devicefunction octeon_allocate_ioq_vectorfunction octeon_free_ioq_vectorfunction octeon_setup_instr_queuesfunction octeon_setup_output_queuesfunction octeon_set_io_queues_offfunction octeon_set_droq_pkt_opfunction octeon_init_dispatch_listfunction octeon_delete_dispatch_listfunction list_for_each_safefunction octeon_get_dispatchfunction list_for_eachfunction octeon_register_dispatch_fnfunction octeon_core_drv_initfunction octeon_get_tx_qsizefunction octeon_get_rx_qsizefunction lio_pci_readqfunction lio_pci_writeqfunction octeon_mem_access_okfunction octeon_wait_for_ddr_initfunction lio_enable_irqexport octeon_init_device_listexport lio_get_state_stringexport octeon_free_device_memexport octeon_allocate_deviceexport octeon_register_deviceexport octeon_deregister_deviceexport octeon_allocate_ioq_vectorexport octeon_free_ioq_vectorexport octeon_setup_instr_queuesexport octeon_setup_output_queuesexport octeon_set_io_queues_offexport octeon_init_dispatch_listexport octeon_delete_dispatch_listexport octeon_register_dispatch_fnexport octeon_core_drv_initexport octeon_get_tx_qsizeexport octeon_get_rx_qsizeexport octeon_get_confexport lio_get_deviceexport lio_pci_readqexport lio_pci_writeqexport octeon_mem_access_ok
Annotated Snippet
if (oct->chip_id == OCTEON_CN66XX) {
ret = &default_cn66xx_conf;
} else if ((oct->chip_id == OCTEON_CN68XX) &&
(card_type == LIO_210NV)) {
ret = &default_cn68xx_210nv_conf;
} else if ((oct->chip_id == OCTEON_CN68XX) &&
(card_type == LIO_410NV)) {
ret = &default_cn68xx_conf;
} else if (oct->chip_id == OCTEON_CN23XX_PF_VID) {
ret = &default_cn23xx_conf;
} else if (oct->chip_id == OCTEON_CN23XX_VF_VID) {
ret = &default_cn23xx_conf;
}
break;
default:
break;
}
return ret;
}
static int __verify_octeon_config_info(struct octeon_device *oct, void *conf)
{
switch (oct->chip_id) {
case OCTEON_CN66XX:
case OCTEON_CN68XX:
return lio_validate_cn6xxx_config_info(oct, conf);
case OCTEON_CN23XX_PF_VID:
case OCTEON_CN23XX_VF_VID:
return 0;
default:
break;
}
return 1;
}
void *oct_get_config_info(struct octeon_device *oct, u16 card_type)
{
void *conf = NULL;
conf = __retrieve_octeon_config_info(oct, card_type);
if (!conf)
return NULL;
if (__verify_octeon_config_info(oct, conf)) {
dev_err(&oct->pci_dev->dev, "Configuration verification failed\n");
return NULL;
}
return conf;
}
char *lio_get_state_string(atomic_t *state_ptr)
{
s32 istate = (s32)atomic_read(state_ptr);
if (istate > OCT_DEV_STATES || istate < 0)
return oct_dev_state_str[OCT_DEV_STATE_INVALID];
return oct_dev_state_str[istate];
}
EXPORT_SYMBOL_GPL(lio_get_state_string);
static char *get_oct_app_string(u32 app_mode)
{
if (app_mode <= CVM_DRV_APP_END)
return oct_dev_app_str[app_mode - CVM_DRV_APP_START];
return oct_dev_app_str[CVM_DRV_INVALID_APP - CVM_DRV_APP_START];
}
void octeon_free_device_mem(struct octeon_device *oct)
{
int i;
for (i = 0; i < MAX_OCTEON_OUTPUT_QUEUES(oct); i++) {
if (oct->io_qmask.oq & BIT_ULL(i))
vfree(oct->droq[i]);
}
for (i = 0; i < MAX_OCTEON_INSTR_QUEUES(oct); i++) {
if (oct->io_qmask.iq & BIT_ULL(i))
vfree(oct->instr_queue[i]);
}
i = oct->octeon_id;
vfree(oct);
octeon_device[i] = NULL;
octeon_device_count--;
}
EXPORT_SYMBOL_GPL(octeon_free_device_mem);
Annotation
- Immediate include surface: `linux/pci.h`, `linux/netdevice.h`, `linux/vmalloc.h`, `liquidio_common.h`, `octeon_droq.h`, `octeon_iq.h`, `response_manager.h`, `octeon_device.h`.
- Detected declarations: `function oct_set_config_info`, `function octeon_init_device_list`, `function __verify_octeon_config_info`, `function octeon_free_device_mem`, `function octeon_register_device`, `function octeon_deregister_device`, `function octeon_allocate_ioq_vector`, `function octeon_free_ioq_vector`, `function octeon_setup_instr_queues`, `function octeon_setup_output_queues`.
- 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.