drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c- Extension
.c- Size
- 84930 bytes
- Lines
- 2953
- 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
linux/net/intel/libie/rx.hiavf.hiavf_ptp.hiavf_prototype.h
Detected Declarations
function iavf_send_pf_msgfunction iavf_send_api_verfunction iavf_poll_virtchnl_msgfunction iavf_verify_api_verfunction iavf_send_vf_config_msgfunction iavf_send_vf_offload_vlan_v2_msgfunction iavf_send_vf_supported_rxdids_msgfunction iavf_send_vf_ptp_caps_msgfunction iavf_validate_num_queuesfunction iavf_get_vf_configfunction iavf_get_vf_vlan_v2_capsfunction iavf_get_vf_supported_rxdidsfunction iavf_get_vf_ptp_capsfunction ourfunction iavf_enable_queuesfunction iavf_disable_queuesfunction iavf_map_queuesfunction iavf_set_mac_addr_typefunction iavf_add_ether_addrsfunction list_for_each_entryfunction iavf_del_ether_addrsfunction list_for_each_entryfunction iavf_mac_add_okfunction iavf_mac_add_rejectfunction iavf_vlan_add_rejectfunction iavf_add_vlansfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction iavf_del_vlansfunction list_for_each_entry_safefunction list_for_each_entryfunction list_for_each_entryfunction iavf_set_promiscuousfunction iavf_request_statsfunction iavf_get_rss_hashcfgfunction iavf_set_rss_hashcfgfunction iavf_set_rss_keyfunction iavf_set_rss_lutfunction iavf_set_rss_hfuncfunction iavf_enable_vlan_strippingfunction iavf_disable_vlan_strippingfunction iavf_tpid_to_vc_ethertypefunction iavf_set_vc_offload_ethertypefunction iavf_clear_offload_v2_aq_requiredfunction iavf_send_vlan_offload_v2function iavf_enable_vlan_stripping_v2function iavf_disable_vlan_stripping_v2
Annotated Snippet
if (received_op == VIRTCHNL_OP_EVENT) {
struct iavf_adapter *adapter = hw->back;
struct virtchnl_pf_event *vpe =
(struct virtchnl_pf_event *)event->msg_buf;
if (vpe->event != VIRTCHNL_EVENT_RESET_IMPENDING)
continue;
dev_info(&adapter->pdev->dev, "Reset indication received from the PF\n");
if (!(adapter->flags & IAVF_FLAG_RESET_PENDING))
iavf_schedule_reset(adapter,
IAVF_FLAG_RESET_PENDING);
return -EIO;
}
if (op_to_poll == received_op)
break;
}
v_retval = le32_to_cpu(event->desc.cookie_low);
return virtchnl_status_to_errno((enum virtchnl_status_code)v_retval);
}
/**
* iavf_verify_api_ver
* @adapter: adapter structure
*
* Compare API versions with the PF. Must be called after admin queue is
* initialized. Returns 0 if API versions match, -EIO if they do not,
* IAVF_ERR_ADMIN_QUEUE_NO_WORK if the admin queue is empty, and any errors
* from the firmware are propagated.
**/
int iavf_verify_api_ver(struct iavf_adapter *adapter)
{
struct iavf_arq_event_info event;
int err;
event.buf_len = IAVF_MAX_AQ_BUF_SIZE;
event.msg_buf = kzalloc(IAVF_MAX_AQ_BUF_SIZE, GFP_KERNEL);
if (!event.msg_buf)
return -ENOMEM;
err = iavf_poll_virtchnl_msg(&adapter->hw, &event, VIRTCHNL_OP_VERSION);
if (!err) {
struct virtchnl_version_info *pf_vvi =
(struct virtchnl_version_info *)event.msg_buf;
adapter->pf_version = *pf_vvi;
if (pf_vvi->major > VIRTCHNL_VERSION_MAJOR ||
(pf_vvi->major == VIRTCHNL_VERSION_MAJOR &&
pf_vvi->minor > VIRTCHNL_VERSION_MINOR))
err = -EIO;
}
kfree(event.msg_buf);
return err;
}
/**
* iavf_send_vf_config_msg
* @adapter: adapter structure
*
* Send VF configuration request admin queue message to the PF. The reply
* is not checked in this function. Returns 0 if the message was
* successfully sent, or one of the IAVF_ADMIN_QUEUE_ERROR_ statuses if not.
**/
int iavf_send_vf_config_msg(struct iavf_adapter *adapter)
{
u32 caps;
caps = VIRTCHNL_VF_OFFLOAD_L2 |
VIRTCHNL_VF_OFFLOAD_RSS_PF |
VIRTCHNL_VF_OFFLOAD_RSS_AQ |
VIRTCHNL_VF_OFFLOAD_RSS_REG |
VIRTCHNL_VF_OFFLOAD_VLAN |
VIRTCHNL_VF_OFFLOAD_WB_ON_ITR |
VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2 |
VIRTCHNL_VF_OFFLOAD_ENCAP |
VIRTCHNL_VF_OFFLOAD_TC_U32 |
VIRTCHNL_VF_OFFLOAD_VLAN_V2 |
VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC |
VIRTCHNL_VF_OFFLOAD_CRC |
VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM |
VIRTCHNL_VF_OFFLOAD_REQ_QUEUES |
VIRTCHNL_VF_CAP_PTP |
VIRTCHNL_VF_OFFLOAD_ADQ |
VIRTCHNL_VF_OFFLOAD_USO |
VIRTCHNL_VF_OFFLOAD_FDIR_PF |
Annotation
- Immediate include surface: `linux/net/intel/libie/rx.h`, `iavf.h`, `iavf_ptp.h`, `iavf_prototype.h`.
- Detected declarations: `function iavf_send_pf_msg`, `function iavf_send_api_ver`, `function iavf_poll_virtchnl_msg`, `function iavf_verify_api_ver`, `function iavf_send_vf_config_msg`, `function iavf_send_vf_offload_vlan_v2_msg`, `function iavf_send_vf_supported_rxdids_msg`, `function iavf_send_vf_ptp_caps_msg`, `function iavf_validate_num_queues`, `function iavf_get_vf_config`.
- 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.