drivers/net/ethernet/qlogic/qed/qed_sriov.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qed/qed_sriov.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qed/qed_sriov.c- Extension
.c- Size
- 145640 bytes
- Lines
- 5306
- 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
linux/etherdevice.hlinux/crc32.hlinux/vmalloc.hlinux/crash_dump.hlinux/qed/qed_iov_if.hqed_cxt.hqed_hsi.hqed_iro_hsi.hqed_hw.hqed_init_ops.hqed_int.hqed_mcp.hqed_reg_addr.hqed_sp.hqed_sriov.hqed_vf.h
Detected Declarations
enum qed_iov_validate_q_modefunction qed_vf_from_entity_idfunction qed_vf_calculate_legacyfunction qed_sp_vf_startfunction qed_sp_vf_stopfunction qed_iov_is_valid_vfidfunction qed_iov_get_vf_rx_queue_cidfunction qed_iov_validate_queue_modefunction qed_iov_validate_rxqfunction qed_iov_validate_txqfunction qed_iov_validate_sbfunction qed_iov_validate_active_rxqfunction qed_iov_validate_active_txqfunction qed_iov_post_vf_bulletinfunction qed_iov_pci_cfg_infofunction qed_iov_setup_vfdbfunction qed_iov_allocate_vfdbfunction qed_iov_free_vfdbfunction qed_iov_allocfunction qed_iov_setupfunction qed_iov_freefunction qed_iov_free_hw_infofunction qed_iov_hw_infofunction thatfunction _qed_iov_pf_sanity_checkfunction qed_iov_pf_sanity_checkfunction qed_iov_set_vf_to_disablefunction for_each_hwfnfunction qed_iov_set_vfs_to_disablefunction qed_iov_vf_pglue_clear_errfunction qed_iov_vf_igu_resetfunction qed_iov_vf_igu_set_intfunction qed_iov_enable_vf_access_msixfunction qed_for_each_vffunction qed_iov_enable_vf_accessfunction qed_iov_config_perm_tablefunction qed_iov_enable_vf_trafficfunction qed_iov_alloc_vf_igu_sbsfunction qed_iov_free_vf_igu_sbsfunction qed_iov_set_linkfunction qed_iov_init_hw_for_vffunction qed_iov_release_hw_for_vffunction qed_iov_tlv_supportedfunction qed_dp_tlv_listfunction qed_iov_send_responsefunction qed_iov_vport_to_tlvfunction qed_iov_prep_vp_update_resp_tlvsfunction qed_iov_prepare_resp
Annotated Snippet
qed_for_each_vf(p_hwfn, i) {
struct qed_vf_info *p_vf;
p_vf = qed_iov_get_vf_info(p_hwfn, (u16)i, true);
if (!p_vf)
continue;
current_max = max_t(u8, current_max, p_vf->num_sbs);
}
}
if (num_sbs > current_max)
return qed_mcp_config_vf_msix(p_hwfn, p_ptt,
abs_vf_id, num_sbs);
return 0;
}
static int qed_iov_enable_vf_access(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf)
{
u32 igu_vf_conf = IGU_VF_CONF_FUNC_EN;
int rc;
/* It's possible VF was previously considered malicious -
* clear the indication even if we're only going to disable VF.
*/
vf->b_malicious = false;
if (vf->to_disable)
return 0;
DP_VERBOSE(p_hwfn,
QED_MSG_IOV,
"Enable internal access for vf %x [abs %x]\n",
vf->abs_vf_id, QED_VF_ABS_ID(p_hwfn, vf));
qed_iov_vf_pglue_clear_err(p_hwfn, p_ptt, QED_VF_ABS_ID(p_hwfn, vf));
qed_iov_vf_igu_reset(p_hwfn, p_ptt, vf);
rc = qed_iov_enable_vf_access_msix(p_hwfn, p_ptt,
vf->abs_vf_id, vf->num_sbs);
if (rc)
return rc;
qed_fid_pretend(p_hwfn, p_ptt, (u16)vf->concrete_fid);
SET_FIELD(igu_vf_conf, IGU_VF_CONF_PARENT, p_hwfn->rel_pf_id);
STORE_RT_REG(p_hwfn, IGU_REG_VF_CONFIGURATION_RT_OFFSET, igu_vf_conf);
qed_init_run(p_hwfn, p_ptt, PHASE_VF, vf->abs_vf_id,
p_hwfn->hw_info.hw_mode);
/* unpretend */
qed_fid_pretend(p_hwfn, p_ptt, (u16)p_hwfn->hw_info.concrete_fid);
vf->state = VF_FREE;
return rc;
}
/**
* qed_iov_config_perm_table() - Configure the permission zone table.
*
* @p_hwfn: HW device data.
* @p_ptt: PTT window for writing the registers.
* @vf: VF info data.
* @enable: The actual permission for this VF.
*
* In E4, queue zone permission table size is 320x9. There
* are 320 VF queues for single engine device (256 for dual
* engine device), and each entry has the following format:
* {Valid, VF[7:0]}
*/
static void qed_iov_config_perm_table(struct qed_hwfn *p_hwfn,
struct qed_ptt *p_ptt,
struct qed_vf_info *vf, u8 enable)
{
u32 reg_addr, val;
u16 qzone_id = 0;
int qid;
for (qid = 0; qid < vf->num_rxqs; qid++) {
qed_fw_l2_queue(p_hwfn, vf->vf_queues[qid].fw_rx_qid,
&qzone_id);
reg_addr = PSWHST_REG_ZONE_PERMISSION_TABLE + qzone_id * 4;
val = enable ? (vf->abs_vf_id | BIT(8)) : 0;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/crc32.h`, `linux/vmalloc.h`, `linux/crash_dump.h`, `linux/qed/qed_iov_if.h`, `qed_cxt.h`, `qed_hsi.h`, `qed_iro_hsi.h`.
- Detected declarations: `enum qed_iov_validate_q_mode`, `function qed_vf_from_entity_id`, `function qed_vf_calculate_legacy`, `function qed_sp_vf_start`, `function qed_sp_vf_stop`, `function qed_iov_is_valid_vfid`, `function qed_iov_get_vf_rx_queue_cid`, `function qed_iov_validate_queue_mode`, `function qed_iov_validate_rxq`, `function qed_iov_validate_txq`.
- 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.