drivers/net/ethernet/intel/ice/ice_irq.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_irq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_irq.c- Extension
.c- Size
- 7514 bytes
- Lines
- 277
- 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.
- 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
ice.hice_lib.hice_irq.h
Detected Declarations
function ice_init_irq_trackerfunction ice_init_virt_irq_trackerfunction ice_deinit_irq_trackerfunction ice_deinit_virt_irq_trackerfunction ice_free_irq_resfunction ice_get_default_msix_amountfunction ice_clear_interrupt_schemefunction ice_init_interrupt_schemefunction ice_alloc_irqfunction ice_free_irqfunction ice_virt_get_irqsfunction ice_virt_free_irqs
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2023, Intel Corporation. */
#include "ice.h"
#include "ice_lib.h"
#include "ice_irq.h"
/**
* ice_init_irq_tracker - initialize interrupt tracker
* @pf: board private structure
* @max_vectors: maximum number of vectors that tracker can hold
* @num_static: number of preallocated interrupts
*/
static void
ice_init_irq_tracker(struct ice_pf *pf, unsigned int max_vectors,
unsigned int num_static)
{
pf->irq_tracker.num_entries = max_vectors;
pf->irq_tracker.num_static = num_static;
xa_init_flags(&pf->irq_tracker.entries, XA_FLAGS_ALLOC);
}
static int
ice_init_virt_irq_tracker(struct ice_pf *pf, u32 base, u32 num_entries)
{
pf->virt_irq_tracker.bm = bitmap_zalloc(num_entries, GFP_KERNEL);
if (!pf->virt_irq_tracker.bm)
return -ENOMEM;
pf->virt_irq_tracker.num_entries = num_entries;
pf->virt_irq_tracker.base = base;
return 0;
}
/**
* ice_deinit_irq_tracker - free xarray tracker
* @pf: board private structure
*/
static void ice_deinit_irq_tracker(struct ice_pf *pf)
{
xa_destroy(&pf->irq_tracker.entries);
}
static void ice_deinit_virt_irq_tracker(struct ice_pf *pf)
{
bitmap_free(pf->virt_irq_tracker.bm);
}
/**
* ice_free_irq_res - free a block of resources
* @pf: board private structure
* @index: starting index previously returned by ice_get_res
*/
static void ice_free_irq_res(struct ice_pf *pf, u16 index)
{
struct ice_irq_entry *entry;
entry = xa_erase(&pf->irq_tracker.entries, index);
kfree(entry);
}
/**
* ice_get_irq_res - get an interrupt resource
* @pf: board private structure
* @dyn_allowed: allow entry to be dynamically allocated
*
* Allocate new irq entry in the free slot of the tracker. Since xarray
* is used, always allocate new entry at the lowest possible index. Set
* proper allocation limit for maximum tracker entries.
*
* Returns allocated irq entry or NULL on failure.
*/
static struct ice_irq_entry *ice_get_irq_res(struct ice_pf *pf,
bool dyn_allowed)
{
struct xa_limit limit = { .max = pf->irq_tracker.num_entries - 1,
.min = 0 };
unsigned int num_static = pf->irq_tracker.num_static - 1;
struct ice_irq_entry *entry;
unsigned int index;
int ret;
entry = kzalloc_obj(*entry);
if (!entry)
return NULL;
/* only already allocated if the caller says so */
if (!dyn_allowed)
limit.max = num_static;
Annotation
- Immediate include surface: `ice.h`, `ice_lib.h`, `ice_irq.h`.
- Detected declarations: `function ice_init_irq_tracker`, `function ice_init_virt_irq_tracker`, `function ice_deinit_irq_tracker`, `function ice_deinit_virt_irq_tracker`, `function ice_free_irq_res`, `function ice_get_default_msix_amount`, `function ice_clear_interrupt_scheme`, `function ice_init_interrupt_scheme`, `function ice_alloc_irq`, `function ice_free_irq`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- 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.