drivers/net/ethernet/intel/ice/ice_controlq.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_controlq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_controlq.c- Extension
.c- Size
- 35559 bytes
- Lines
- 1262
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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
ice_common.h
Detected Declarations
function ice_adminq_init_regsfunction ice_mailbox_init_regsfunction ice_sb_init_regsfunction ice_check_sq_alivefunction ice_alloc_ctrlq_sq_ringfunction ice_alloc_ctrlq_rq_ringfunction ice_free_cq_ringfunction ice_alloc_rq_bufsfunction ice_alloc_sq_bufsfunction ice_cfg_cq_regsfunction ice_cfg_sq_regsfunction receivefunction ice_init_sqfunction ice_init_rqfunction ice_shutdown_sqfunction ice_aq_ver_checkfunction ice_shutdown_rqfunction ice_init_check_adminqfunction ice_init_ctrlqfunction ice_is_sbq_supportedfunction ice_shutdown_ctrlqfunction ice_shutdown_all_ctrlqfunction ice_init_all_ctrlqfunction ice_init_ctrlq_locksfunction ice_create_all_ctrlqfunction ice_destroy_ctrlq_locksfunction ice_destroy_all_ctrlqfunction ice_clean_sqfunction ice_debug_cqfunction ice_sq_donefunction ice_sq_send_cmdfunction ice_fill_dflt_direct_cmd_descfunction ice_clean_rq_elem
Annotated Snippet
if ((qi)->ring.r.ring##_bi[i].pa) { \
dmam_free_coherent(ice_hw_to_dev(hw), \
(qi)->ring.r.ring##_bi[i].size, \
(qi)->ring.r.ring##_bi[i].va, \
(qi)->ring.r.ring##_bi[i].pa); \
(qi)->ring.r.ring##_bi[i].va = NULL;\
(qi)->ring.r.ring##_bi[i].pa = 0;\
(qi)->ring.r.ring##_bi[i].size = 0;\
} \
} \
/* free DMA head */ \
devm_kfree(ice_hw_to_dev(hw), (qi)->ring.dma_head); \
} while (0)
/**
* ice_init_sq - main initialization routine for Control ATQ
* @hw: pointer to the hardware structure
* @cq: pointer to the specific Control queue
*
* This is the main initialization routine for the Control Send Queue
* Prior to calling this function, the driver *MUST* set the following fields
* in the cq->structure:
* - cq->num_sq_entries
* - cq->sq_buf_size
*
* Do *NOT* hold the lock when calling this as the memory allocation routines
* called are not going to be atomic context safe
*/
static int ice_init_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
{
int ret_code;
if (cq->sq.count > 0) {
/* queue already initialized */
ret_code = -EBUSY;
goto init_ctrlq_exit;
}
/* verify input for valid configuration */
if (!cq->num_sq_entries || !cq->sq_buf_size) {
ret_code = -EIO;
goto init_ctrlq_exit;
}
cq->sq.next_to_use = 0;
cq->sq.next_to_clean = 0;
/* allocate the ring memory */
ret_code = ice_alloc_ctrlq_sq_ring(hw, cq);
if (ret_code)
goto init_ctrlq_exit;
/* allocate buffers in the rings */
ret_code = ice_alloc_sq_bufs(hw, cq);
if (ret_code)
goto init_ctrlq_free_rings;
/* initialize base registers */
ret_code = ice_cfg_sq_regs(hw, cq);
if (ret_code)
goto init_ctrlq_free_rings;
/* success! */
cq->sq.count = cq->num_sq_entries;
goto init_ctrlq_exit;
init_ctrlq_free_rings:
ICE_FREE_CQ_BUFS(hw, cq, sq);
ice_free_cq_ring(hw, &cq->sq);
init_ctrlq_exit:
return ret_code;
}
/**
* ice_init_rq - initialize receive side of a control queue
* @hw: pointer to the hardware structure
* @cq: pointer to the specific Control queue
*
* The main initialization routine for Receive side of a control queue.
* Prior to calling this function, the driver *MUST* set the following fields
* in the cq->structure:
* - cq->num_rq_entries
* - cq->rq_buf_size
*
* Do *NOT* hold the lock when calling this as the memory allocation routines
* called are not going to be atomic context safe
*/
static int ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
{
Annotation
- Immediate include surface: `ice_common.h`.
- Detected declarations: `function ice_adminq_init_regs`, `function ice_mailbox_init_regs`, `function ice_sb_init_regs`, `function ice_check_sq_alive`, `function ice_alloc_ctrlq_sq_ring`, `function ice_alloc_ctrlq_rq_ring`, `function ice_free_cq_ring`, `function ice_alloc_rq_bufs`, `function ice_alloc_sq_bufs`, `function ice_cfg_cq_regs`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.