drivers/net/ethernet/cavium/liquidio/request_manager.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cavium/liquidio/request_manager.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cavium/liquidio/request_manager.c- Extension
.c- Size
- 24456 bytes
- Lines
- 942
- 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.
- 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_device.hcn23xx_pf_device.hcn23xx_vf_device.h
Detected Declarations
struct iq_post_statusfunction octeon_init_instr_queuefunction octeon_delete_instr_queuefunction octeon_setup_iqfunction lio_wait_for_instr_fetchfunction ring_doorbellfunction octeon_ring_doorbell_lockedfunction __copy_cmd_into_iqfunction __post_command2function octeon_register_reqtype_free_fnfunction __add_to_request_listfunction lio_process_iq_request_listfunction octeon_flush_iqfunction __check_db_timeoutfunction check_db_timeoutfunction octeon_send_commandfunction octeon_prepare_soft_commandfunction octeon_send_soft_commandfunction octeon_setup_sc_buffer_poolfunction octeon_free_sc_done_listfunction list_for_each_safefunction octeon_free_sc_zombie_listfunction list_for_each_safefunction octeon_free_sc_buffer_poolfunction list_for_each_safefunction octeon_free_soft_commandexport octeon_delete_instr_queueexport lio_wait_for_instr_fetchexport octeon_ring_doorbell_lockedexport octeon_register_reqtype_free_fnexport lio_process_iq_request_listexport octeon_send_commandexport octeon_prepare_soft_commandexport octeon_send_soft_commandexport octeon_setup_sc_buffer_poolexport octeon_free_sc_done_listexport octeon_free_sc_zombie_listexport octeon_free_sc_buffer_poolexport octeon_alloc_soft_commandexport octeon_free_soft_command
Annotated Snippet
struct iq_post_status {
int status;
int index;
};
static void check_db_timeout(struct work_struct *work);
static void __check_db_timeout(struct octeon_device *oct, u64 iq_no);
static void (*reqtype_free_fn[MAX_OCTEON_DEVICES][REQTYPE_LAST + 1]) (void *);
/* Define this to return the request status comaptible to old code */
/*#define OCTEON_USE_OLD_REQ_STATUS*/
/* Return 0 on success, 1 on failure */
int octeon_init_instr_queue(struct octeon_device *oct,
union oct_txpciq txpciq,
u32 num_descs)
{
struct octeon_instr_queue *iq;
struct octeon_iq_config *conf = NULL;
u32 iq_no = (u32)txpciq.s.q_no;
u32 q_size;
struct cavium_wq *db_wq;
int numa_node = dev_to_node(&oct->pci_dev->dev);
if (OCTEON_CN6XXX(oct))
conf = &(CFG_GET_IQ_CFG(CHIP_CONF(oct, cn6xxx)));
else if (OCTEON_CN23XX_PF(oct))
conf = &(CFG_GET_IQ_CFG(CHIP_CONF(oct, cn23xx_pf)));
else if (OCTEON_CN23XX_VF(oct))
conf = &(CFG_GET_IQ_CFG(CHIP_CONF(oct, cn23xx_vf)));
if (!conf) {
dev_err(&oct->pci_dev->dev, "Unsupported Chip %x\n",
oct->chip_id);
return 1;
}
q_size = (u32)conf->instr_type * num_descs;
iq = oct->instr_queue[iq_no];
iq->oct_dev = oct;
iq->base_addr = lio_dma_alloc(oct, q_size, &iq->base_addr_dma);
if (!iq->base_addr) {
dev_err(&oct->pci_dev->dev, "Cannot allocate memory for instr queue %d\n",
iq_no);
return 1;
}
iq->max_count = num_descs;
/* Initialize a list to holds requests that have been posted to Octeon
* but has yet to be fetched by octeon
*/
iq->request_list = vzalloc_node(array_size(num_descs, sizeof(*iq->request_list)),
numa_node);
if (!iq->request_list)
iq->request_list = vzalloc(array_size(num_descs, sizeof(*iq->request_list)));
if (!iq->request_list) {
lio_dma_free(oct, q_size, iq->base_addr, iq->base_addr_dma);
dev_err(&oct->pci_dev->dev, "Alloc failed for IQ[%d] nr free list\n",
iq_no);
return 1;
}
dev_dbg(&oct->pci_dev->dev, "IQ[%d]: base: %p basedma: %pad count: %d\n",
iq_no, iq->base_addr, &iq->base_addr_dma, iq->max_count);
iq->txpciq.u64 = txpciq.u64;
iq->fill_threshold = (u32)conf->db_min;
iq->fill_cnt = 0;
iq->host_write_index = 0;
iq->octeon_read_index = 0;
iq->flush_index = 0;
iq->last_db_time = 0;
iq->do_auto_flush = 1;
iq->db_timeout = (u32)conf->db_timeout;
atomic_set(&iq->instr_pending, 0);
iq->pkts_processed = 0;
/* Initialize the spinlock for this instruction queue */
spin_lock_init(&iq->lock);
if (iq_no == 0) {
iq->allow_soft_cmds = true;
spin_lock_init(&iq->post_lock);
} else {
iq->allow_soft_cmds = false;
}
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: `struct iq_post_status`, `function octeon_init_instr_queue`, `function octeon_delete_instr_queue`, `function octeon_setup_iq`, `function lio_wait_for_instr_fetch`, `function ring_doorbell`, `function octeon_ring_doorbell_locked`, `function __copy_cmd_into_iq`, `function __post_command2`, `function octeon_register_reqtype_free_fn`.
- 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.