drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c- Extension
.c- Size
- 134318 bytes
- Lines
- 5055
- 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
i40e.hi40e_lan_hmc.hi40e_virtchnl_pf.h
Detected Declarations
function i40e_vc_vf_broadcastfunction i40e_vc_link_speed2mbpsfunction i40e_set_vf_link_statefunction i40e_vc_notify_vf_link_statefunction i40e_vc_notify_link_statefunction i40e_vc_notify_resetfunction i40e_restore_all_vfs_msi_statefunction i40e_vc_notify_vf_resetfunction i40e_vc_reset_vffunction i40e_vc_isvalid_vsi_idfunction i40e_vc_isvalid_queue_idfunction i40e_vc_isvalid_vector_idfunction i40e_vc_get_pf_queue_idfunction i40e_get_real_pf_qidfunction i40e_config_irq_link_listfunction i40e_release_rdma_qvlistfunction i40e_config_rdma_qvlistfunction i40e_config_vsi_tx_queuefunction i40e_config_vsi_rx_queuefunction i40e_alloc_vsi_resfunction i40e_map_pf_queues_to_vsifunction i40e_map_pf_to_vf_queuesfunction i40e_enable_vf_mappingsfunction i40e_disable_vf_mappingsfunction i40e_free_vf_resfunction i40e_alloc_vf_resfunction i40e_quiesce_vf_pcifunction __i40e_getnum_vf_vsi_vlan_filtersfunction hash_for_eachfunction __i40e_getnum_vf_vsi_vlan_filtersfunction i40e_get_vlan_list_syncfunction hash_for_eachfunction i40e_set_vsi_promiscfunction i40e_config_vf_promiscuous_modefunction i40e_sync_vfr_resetfunction i40e_trigger_vf_resetfunction i40e_cleanup_reset_vffunction i40e_reset_vffunction i40e_reset_all_vfsfunction i40e_free_vfsfunction i40e_alloc_vfsfunction i40e_pci_sriov_enablefunction i40e_pci_sriov_configurefunction i40e_vc_send_msg_to_vffunction i40e_vc_send_resp_to_vffunction i40e_sync_vf_statefunction i40e_vc_get_version_msgfunction i40e_del_qch
Annotated Snippet
while ((vf_dev = pci_get_device(pdev->vendor, vf_id, vf_dev))) {
if (vf_dev->is_virtfn && vf_dev->physfn == pdev)
pci_restore_msi_state(vf_dev);
}
}
}
#endif /* CONFIG_PCI_IOV */
/**
* i40e_vc_notify_vf_reset
* @vf: pointer to the VF structure
*
* indicate a pending reset to the given VF
**/
void i40e_vc_notify_vf_reset(struct i40e_vf *vf)
{
struct virtchnl_pf_event pfe;
int abs_vf_id;
/* validate the request */
if (!vf || vf->vf_id >= vf->pf->num_alloc_vfs)
return;
/* verify if the VF is in either init or active before proceeding */
if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states) &&
!test_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states))
return;
abs_vf_id = vf->vf_id + (int)vf->pf->hw.func_caps.vf_base_id;
pfe.event = VIRTCHNL_EVENT_RESET_IMPENDING;
pfe.severity = PF_EVENT_SEVERITY_CERTAIN_DOOM;
i40e_aq_send_msg_to_vf(&vf->pf->hw, abs_vf_id, VIRTCHNL_OP_EVENT,
0, (u8 *)&pfe,
sizeof(struct virtchnl_pf_event), NULL);
}
/***********************misc routines*****************************/
/**
* i40e_vc_reset_vf
* @vf: pointer to the VF info
* @notify_vf: notify vf about reset or not
* Reset VF handler.
**/
void i40e_vc_reset_vf(struct i40e_vf *vf, bool notify_vf)
{
struct i40e_pf *pf = vf->pf;
int i;
if (notify_vf)
i40e_vc_notify_vf_reset(vf);
/* We want to ensure that an actual reset occurs initiated after this
* function was called. However, we do not want to wait forever, so
* we'll give a reasonable time and print a message if we failed to
* ensure a reset.
*/
for (i = 0; i < 20; i++) {
/* If PF is in VFs releasing state reset VF is impossible,
* so leave it.
*/
if (test_bit(__I40E_VFS_RELEASING, pf->state))
return;
if (i40e_reset_vf(vf, false))
return;
usleep_range(10000, 20000);
}
if (notify_vf)
dev_warn(&vf->pf->pdev->dev,
"Failed to initiate reset for VF %d after 200 milliseconds\n",
vf->vf_id);
else
dev_dbg(&vf->pf->pdev->dev,
"Failed to initiate reset for VF %d after 200 milliseconds\n",
vf->vf_id);
}
/**
* i40e_vc_isvalid_vsi_id
* @vf: pointer to the VF info
* @vsi_id: VF relative VSI id
*
* check for the valid VSI id
**/
static inline bool i40e_vc_isvalid_vsi_id(struct i40e_vf *vf, u16 vsi_id)
{
struct i40e_pf *pf = vf->pf;
struct i40e_vsi *vsi = i40e_find_vsi_from_id(pf, vsi_id);
Annotation
- Immediate include surface: `i40e.h`, `i40e_lan_hmc.h`, `i40e_virtchnl_pf.h`.
- Detected declarations: `function i40e_vc_vf_broadcast`, `function i40e_vc_link_speed2mbps`, `function i40e_set_vf_link_state`, `function i40e_vc_notify_vf_link_state`, `function i40e_vc_notify_link_state`, `function i40e_vc_notify_reset`, `function i40e_restore_all_vfs_msi_state`, `function i40e_vc_notify_vf_reset`, `function i40e_vc_reset_vf`, `function i40e_vc_isvalid_vsi_id`.
- 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.