drivers/net/ethernet/intel/ice/ice_base.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_base.c- Extension
.c- Size
- 40559 bytes
- Lines
- 1533
- 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.
- 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
net/xdp_sock_drv.hlinux/net/intel/libie/rx.hice_base.hice_lib.hice_dcb_lib.hice_sriov.h
Detected Declarations
function __ice_vsi_get_qs_contigfunction __ice_vsi_get_qs_scfunction ice_pf_rxq_waitfunction ice_vsi_alloc_q_vectorfunction ice_free_q_vectorfunction ice_cfg_itr_granfunction ice_calc_txq_handlefunction ice_cfg_xps_tx_ringfunction ice_set_txq_ctx_vmvffunction ice_setup_tx_ctxfunction ice_setup_txtime_ctxfunction ice_calc_ts_ring_countfunction ice_setup_rx_ctxfunction ice_rxq_pp_createfunction ice_vsi_cfg_rxqfunction ice_vsi_cfg_single_rxqfunction ice_vsi_cfg_frame_sizefunction ice_vsi_cfg_rxqsfunction __ice_vsi_get_qsfunction ice_vsi_ctrl_one_rx_ringfunction ice_vsi_wait_one_rx_ringfunction ice_vsi_alloc_q_vectorsfunction ice_vsi_map_rings_to_vectorsfunction ice_vsi_free_q_vectorsfunction ice_cfg_tstampfunction ice_vsi_cfg_txqfunction ice_vsi_cfg_single_txqfunction ice_vsi_cfg_txqsfunction ice_vsi_cfg_lan_txqsfunction ice_vsi_cfg_xdp_txqsfunction ice_cfg_itrfunction ice_cfg_txq_interruptfunction ice_cfg_rxq_interruptfunction ice_trigger_sw_intrfunction ice_vsi_stop_tx_ringfunction ice_fill_txq_metafunction ice_qp_reset_statsfunction ice_qp_clean_ringsfunction ice_qp_disfunction ice_qp_ena
Annotated Snippet
if (ctrl_vsi) {
if (unlikely(!ctrl_vsi->q_vectors)) {
err = -ENOENT;
goto err_free_q_vector;
}
q_vector->irq = ctrl_vsi->q_vectors[0]->irq;
goto skip_alloc;
}
}
q_vector->irq = ice_alloc_irq(pf, vsi->irq_dyn_alloc);
if (q_vector->irq.index < 0) {
err = -ENOMEM;
goto err_free_q_vector;
}
skip_alloc:
q_vector->reg_idx = q_vector->irq.index;
q_vector->vf_reg_idx = q_vector->irq.index;
/* This will not be called in the driver load path because the netdev
* will not be created yet. All other cases with register the NAPI
* handler here (i.e. resume, reset/rebuild, etc.)
*/
if (vsi->netdev)
netif_napi_add_config(vsi->netdev, &q_vector->napi,
ice_napi_poll, v_idx);
out:
/* tie q_vector and VSI together */
vsi->q_vectors[v_idx] = q_vector;
return 0;
err_free_q_vector:
kfree(q_vector);
return err;
}
/**
* ice_free_q_vector - Free memory allocated for a specific interrupt vector
* @vsi: VSI having the memory freed
* @v_idx: index of the vector to be freed
*/
static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)
{
struct ice_q_vector *q_vector;
struct ice_pf *pf = vsi->back;
struct ice_tx_ring *tx_ring;
struct ice_rx_ring *rx_ring;
struct device *dev;
dev = ice_pf_to_dev(pf);
if (!vsi->q_vectors[v_idx]) {
dev_dbg(dev, "Queue vector at index %d not found\n", v_idx);
return;
}
q_vector = vsi->q_vectors[v_idx];
ice_for_each_tx_ring(tx_ring, vsi->q_vectors[v_idx]->tx)
tx_ring->q_vector = NULL;
ice_for_each_rx_ring(rx_ring, vsi->q_vectors[v_idx]->rx)
rx_ring->q_vector = NULL;
/* only VSI with an associated netdev is set up with NAPI */
if (vsi->netdev)
netif_napi_del(&q_vector->napi);
/* release MSIX interrupt if q_vector had interrupt allocated */
if (q_vector->irq.index < 0)
goto free_q_vector;
/* only free last VF ctrl vsi interrupt */
if (vsi->type == ICE_VSI_CTRL && vsi->vf &&
ice_get_vf_ctrl_vsi(pf, vsi))
goto free_q_vector;
ice_free_irq(pf, q_vector->irq);
free_q_vector:
kfree(q_vector);
vsi->q_vectors[v_idx] = NULL;
}
/**
* ice_cfg_itr_gran - set the ITR granularity to 2 usecs if not already set
* @hw: board specific structure
Annotation
- Immediate include surface: `net/xdp_sock_drv.h`, `linux/net/intel/libie/rx.h`, `ice_base.h`, `ice_lib.h`, `ice_dcb_lib.h`, `ice_sriov.h`.
- Detected declarations: `function __ice_vsi_get_qs_contig`, `function __ice_vsi_get_qs_sc`, `function ice_pf_rxq_wait`, `function ice_vsi_alloc_q_vector`, `function ice_free_q_vector`, `function ice_cfg_itr_gran`, `function ice_calc_txq_handle`, `function ice_cfg_xps_tx_ring`, `function ice_set_txq_ctx_vmvf`, `function ice_setup_tx_ctx`.
- 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.
- 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.