drivers/net/ethernet/intel/idpf/idpf_lib.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/idpf/idpf_lib.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/idpf/idpf_lib.c- Extension
.c- Size
- 74189 bytes
- Lines
- 2683
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
idpf.hidpf_virtchnl.hidpf_ptp.hxdp.hxsk.h
Detected Declarations
function idpf_init_vector_stackfunction idpf_deinit_vector_stackfunction idpf_mb_intr_rel_irqfunction idpf_intr_relfunction idpf_mb_intr_cleanfunction idpf_mb_irq_enablefunction idpf_mb_intr_req_irqfunction idpf_mb_intr_initfunction idpf_vector_lifo_pushfunction idpf_vector_lifo_popfunction idpf_vector_stashfunction idpf_req_rel_vector_indexesfunction idpf_intr_reqfunction idpf_del_all_flow_steer_filtersfunction list_for_each_entryfunction __idpf_del_mac_filterfunction idpf_del_mac_filterfunction __idpf_add_mac_filterfunction idpf_add_mac_filterfunction idpf_del_all_mac_filtersfunction list_for_each_entry_safefunction idpf_restore_mac_filtersfunction idpf_remove_mac_filtersfunction idpf_deinit_mac_addrfunction idpf_init_mac_addrfunction idpf_detach_and_closefunction idpf_attach_and_openfunction idpf_cfg_netdevfunction idpf_get_free_slotfunction idpf_remove_featuresfunction idpf_vport_stopfunction idpf_stopfunction idpf_decfg_netdevfunction idpf_vport_relfunction idpf_vport_deallocfunction idpf_is_hsplit_supportedfunction idpf_vport_get_hsplitfunction idpf_vport_set_hsplitfunction idpf_get_stats64function idpf_statistics_taskfunction idpf_mbx_taskfunction idpf_service_taskfunction idpf_restore_featuresfunction idpf_set_real_num_queuesfunction idpf_up_completefunction idpf_rx_init_buf_tailfunction idpf_vport_openfunction idpf_init_task
Annotated Snippet
static const struct net_device_ops idpf_netdev_ops;
/**
* idpf_init_vector_stack - Fill the MSIX vector stack with vector index
* @adapter: private data struct
*
* Return 0 on success, error on failure
*/
static int idpf_init_vector_stack(struct idpf_adapter *adapter)
{
struct idpf_vector_lifo *stack;
u16 min_vec;
u32 i;
mutex_lock(&adapter->vector_lock);
min_vec = adapter->num_msix_entries - adapter->num_avail_msix;
stack = &adapter->vector_stack;
stack->size = adapter->num_msix_entries;
/* set the base and top to point at start of the 'free pool' to
* distribute the unused vectors on-demand basis
*/
stack->base = min_vec;
stack->top = min_vec;
stack->vec_idx = kcalloc(stack->size, sizeof(u16), GFP_KERNEL);
if (!stack->vec_idx) {
mutex_unlock(&adapter->vector_lock);
return -ENOMEM;
}
for (i = 0; i < stack->size; i++)
stack->vec_idx[i] = i;
mutex_unlock(&adapter->vector_lock);
return 0;
}
/**
* idpf_deinit_vector_stack - zero out the MSIX vector stack
* @adapter: private data struct
*/
static void idpf_deinit_vector_stack(struct idpf_adapter *adapter)
{
struct idpf_vector_lifo *stack;
mutex_lock(&adapter->vector_lock);
stack = &adapter->vector_stack;
kfree(stack->vec_idx);
stack->vec_idx = NULL;
mutex_unlock(&adapter->vector_lock);
}
/**
* idpf_mb_intr_rel_irq - Free the IRQ association with the OS
* @adapter: adapter structure
*
* This will also disable interrupt mode and queue up mailbox task. Mailbox
* task will reschedule itself if not in interrupt mode.
*/
static void idpf_mb_intr_rel_irq(struct idpf_adapter *adapter)
{
clear_bit(IDPF_MB_INTR_MODE, adapter->flags);
kfree(free_irq(adapter->msix_entries[0].vector, adapter));
queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task, 0);
}
/**
* idpf_intr_rel - Release interrupt capabilities and free memory
* @adapter: adapter to disable interrupts on
*/
void idpf_intr_rel(struct idpf_adapter *adapter)
{
if (!adapter->msix_entries)
return;
idpf_mb_intr_rel_irq(adapter);
pci_free_irq_vectors(adapter->pdev);
idpf_send_dealloc_vectors_msg(adapter);
idpf_deinit_vector_stack(adapter);
kfree(adapter->msix_entries);
adapter->msix_entries = NULL;
kfree(adapter->rdma_msix_entries);
adapter->rdma_msix_entries = NULL;
}
/**
* idpf_mb_intr_clean - Interrupt handler for the mailbox
* @irq: interrupt number
Annotation
- Immediate include surface: `idpf.h`, `idpf_virtchnl.h`, `idpf_ptp.h`, `xdp.h`, `xsk.h`.
- Detected declarations: `function idpf_init_vector_stack`, `function idpf_deinit_vector_stack`, `function idpf_mb_intr_rel_irq`, `function idpf_intr_rel`, `function idpf_mb_intr_clean`, `function idpf_mb_irq_enable`, `function idpf_mb_intr_req_irq`, `function idpf_mb_intr_init`, `function idpf_vector_lifo_push`, `function idpf_vector_lifo_pop`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.