drivers/net/ethernet/qlogic/qed/qed_vf.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qed/qed_vf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qed/qed_vf.c- Extension
.c- Size
- 47885 bytes
- Lines
- 1708
- 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/crc32.hlinux/etherdevice.hqed.hqed_sriov.hqed_vf.h
Detected Declarations
function Copyrightfunction qed_vf_pf_req_endfunction qed_send_msg2pffunction qed_vf_pf_add_qidfunction _qed_vf_pf_releasefunction qed_vf_pf_releasefunction qed_vf_pf_acquire_reduce_rescfunction qed_vf_pf_acquirefunction qed_vf_hw_bar_sizefunction qed_vf_hw_preparefunction __qed_vf_prep_tunn_req_tlvfunction qed_vf_prep_tunn_req_tlvfunction qed_vf_set_vf_start_tunn_update_paramfunction __qed_vf_update_tunn_paramfunction qed_vf_update_tunn_paramfunction qed_vf_pf_tunnel_param_updatefunction qed_vf_pf_rxq_startfunction qed_vf_pf_rxq_stopfunction qed_vf_pf_txq_startfunction qed_vf_pf_txq_stopfunction qed_vf_pf_vport_startfunction qed_vf_pf_vport_stopfunction qed_vf_handle_vp_update_is_neededfunction qed_vf_handle_vp_update_tlvs_respfunction qed_vf_pf_vport_updatefunction qed_vf_pf_resetfunction qed_vf_pf_filter_mcastfunction qed_vf_pf_filter_ucastfunction qed_vf_pf_int_cleanupfunction qed_vf_pf_get_coalescefunction qed_vf_pf_bulletin_update_macfunction qed_vf_pf_set_coalescefunction qed_vf_get_igu_sb_idfunction qed_vf_set_sb_infofunction qed_vf_read_bulletinfunction __qed_vf_get_link_paramsfunction qed_vf_get_link_paramsfunction __qed_vf_get_link_statefunction qed_vf_get_link_statefunction __qed_vf_get_link_capsfunction qed_vf_get_link_capsfunction qed_vf_get_num_rxqsfunction qed_vf_get_num_txqsfunction qed_vf_get_num_cidsfunction qed_vf_get_port_macfunction qed_vf_get_num_vlan_filtersfunction qed_vf_get_num_mac_filtersfunction qed_vf_check_mac
Annotated Snippet
if (retry_cnt && rc == -EBUSY) {
DP_VERBOSE(p_hwfn, QED_MSG_IOV,
"VF retrying to acquire due to VPC timeout\n");
retry_cnt--;
continue;
}
if (rc)
goto exit;
/* copy acquire response from buffer to p_hwfn */
memcpy(&p_iov->acquire_resp, resp, sizeof(p_iov->acquire_resp));
attempts++;
if (resp->hdr.status == PFVF_STATUS_SUCCESS) {
/* PF agrees to allocate our resources */
if (!(resp->pfdev_info.capabilities &
PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE)) {
/* It's possible legacy PF mistakenly accepted;
* but we don't care - simply mark it as
* legacy and continue.
*/
req->vfdev_info.capabilities |=
VFPF_ACQUIRE_CAP_PRE_FP_HSI;
}
DP_VERBOSE(p_hwfn, QED_MSG_IOV, "resources acquired\n");
resources_acquired = true;
} else if (resp->hdr.status == PFVF_STATUS_NO_RESOURCE &&
attempts < VF_ACQUIRE_THRESH) {
qed_vf_pf_acquire_reduce_resc(p_hwfn, p_resc,
&resp->resc);
} else if (resp->hdr.status == PFVF_STATUS_NOT_SUPPORTED) {
if (pfdev_info->major_fp_hsi &&
(pfdev_info->major_fp_hsi != ETH_HSI_VER_MAJOR)) {
DP_NOTICE(p_hwfn,
"PF uses an incompatible fastpath HSI %02x.%02x [VF requires %02x.%02x]. Please change to a VF driver using %02x.xx.\n",
pfdev_info->major_fp_hsi,
pfdev_info->minor_fp_hsi,
ETH_HSI_VER_MAJOR,
ETH_HSI_VER_MINOR,
pfdev_info->major_fp_hsi);
rc = -EINVAL;
goto exit;
}
if (!pfdev_info->major_fp_hsi) {
if (req->vfdev_info.capabilities &
VFPF_ACQUIRE_CAP_PRE_FP_HSI) {
DP_NOTICE(p_hwfn,
"PF uses very old drivers. Please change to a VF driver using no later than 8.8.x.x.\n");
rc = -EINVAL;
goto exit;
} else {
DP_INFO(p_hwfn,
"PF is old - try re-acquire to see if it supports FW-version override\n");
req->vfdev_info.capabilities |=
VFPF_ACQUIRE_CAP_PRE_FP_HSI;
continue;
}
}
/* If PF/VF are using same Major, PF must have had
* it's reasons. Simply fail.
*/
DP_NOTICE(p_hwfn, "PF rejected acquisition by VF\n");
rc = -EINVAL;
goto exit;
} else {
DP_ERR(p_hwfn,
"PF returned error %d to VF acquisition request\n",
resp->hdr.status);
rc = -EAGAIN;
goto exit;
}
}
/* Mark the PF as legacy, if needed */
if (req->vfdev_info.capabilities & VFPF_ACQUIRE_CAP_PRE_FP_HSI)
p_iov->b_pre_fp_hsi = true;
/* In case PF doesn't support multi-queue Tx, update the number of
* CIDs to reflect the number of queues [older PFs didn't fill that
* field].
*/
if (!(resp->pfdev_info.capabilities & PFVF_ACQUIRE_CAP_QUEUE_QIDS))
resp->resc.num_cids = resp->resc.num_rxqs + resp->resc.num_txqs;
/* Update bulletin board size with response from PF */
p_iov->bulletin.size = resp->bulletin_size;
Annotation
- Immediate include surface: `linux/crc32.h`, `linux/etherdevice.h`, `qed.h`, `qed_sriov.h`, `qed_vf.h`.
- Detected declarations: `function Copyright`, `function qed_vf_pf_req_end`, `function qed_send_msg2pf`, `function qed_vf_pf_add_qid`, `function _qed_vf_pf_release`, `function qed_vf_pf_release`, `function qed_vf_pf_acquire_reduce_resc`, `function qed_vf_pf_acquire`, `function qed_vf_hw_bar_size`, `function qed_vf_hw_prepare`.
- 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.