drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c- Extension
.c- Size
- 58128 bytes
- Lines
- 2236
- 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/types.hqlcnic_sriov.hqlcnic.hqlcnic_83xx_hw.h
Detected Declarations
function qlcnic_sriov_bc_msg_checkfunction qlcnic_sriov_channel_free_checkfunction qlcnic_sriov_flr_checkfunction qlcnic_sriov_target_func_idfunction qlcnic_sriov_virtid_fnfunction qlcnic_sriov_initfunction qlcnic_sriov_cleanup_listfunction __qlcnic_sriov_cleanupfunction qlcnic_sriov_vf_cleanupfunction qlcnic_sriov_cleanupfunction qlcnic_sriov_post_bc_msgfunction qlcnic_sriov_vf_cfg_buff_descfunction qlcnic_sriov_get_vf_vport_infofunction qlcnic_sriov_set_pvid_modefunction qlcnic_sriov_set_guest_vlan_modefunction qlcnic_sriov_get_vf_aclfunction qlcnic_sriov_vf_init_driverfunction qlcnic_sriov_setup_vffunction qlcnic_sriov_check_dev_readyfunction qlcnic_sriov_vf_initfunction qlcnic_sriov_vf_set_opsfunction qlcnic_sriov_vf_register_mapfunction qlcnic_sriov_get_bc_paysizefunction qlcnic_sriov_func_to_indexfunction qlcnic_sriov_alloc_bc_transfunction qlcnic_sriov_alloc_bc_msgfunction qlcnic_sriov_alloc_bc_mbx_argsfunction qlcnic_sriov_prepare_bc_hdrfunction qlcnic_sriov_cleanup_transactionfunction qlcnic_sriov_clear_transfunction qlcnic_sriov_schedule_bc_cmdfunction qlcnic_sriov_wait_for_respfunction qlcnic_sriov_handle_multi_fragsfunction qlcnic_sriov_wait_for_channel_freefunction qlcnic_sriov_pull_bc_msgfunction __qlcnic_sriov_issue_bc_postfunction qlcnic_sriov_issue_bc_postfunction __qlcnic_sriov_send_bc_msgfunction qlcnic_sriov_send_bc_cmdfunction __qlcnic_sriov_process_bc_cmdfunction qlcnic_sriov_process_bc_cmdfunction qlcnic_sriov_handle_bc_respfunction __qlcnic_sriov_add_act_listfunction qlcnic_sriov_add_act_listfunction qlcnic_sriov_handle_pending_transfunction list_for_eachfunction qlcnic_sriov_handle_bc_cmdfunction qlcnic_sriov_handle_msg_event
Annotated Snippet
if (qlcnic_sriov_pf_check(adapter)) {
vp = kzalloc_obj(struct qlcnic_vport);
if (!vp) {
err = -ENOMEM;
goto qlcnic_destroy_async_wq;
}
sriov->vf_info[i].vp = vp;
vp->vlan_mode = QLC_GUEST_VLAN_MODE;
vp->max_tx_bw = MAX_BW;
vp->min_tx_bw = MIN_BW;
vp->spoofchk = false;
eth_random_addr(vp->mac);
dev_info(&adapter->pdev->dev,
"MAC Address %pM is configured for VF %d\n",
vp->mac, i);
}
}
return 0;
qlcnic_destroy_async_wq:
while (i--)
kfree(sriov->vf_info[i].vp);
destroy_workqueue(bc->bc_async_wq);
qlcnic_destroy_trans_wq:
destroy_workqueue(bc->bc_trans_wq);
qlcnic_free_vf_info:
kfree(sriov->vf_info);
qlcnic_free_sriov:
kfree(adapter->ahw->sriov);
return err;
}
void qlcnic_sriov_cleanup_list(struct qlcnic_trans_list *t_list)
{
struct qlcnic_bc_trans *trans;
struct qlcnic_cmd_args cmd;
unsigned long flags;
spin_lock_irqsave(&t_list->lock, flags);
while (!list_empty(&t_list->wait_list)) {
trans = list_first_entry(&t_list->wait_list,
struct qlcnic_bc_trans, list);
list_del(&trans->list);
t_list->count--;
cmd.req.arg = (u32 *)trans->req_pay;
cmd.rsp.arg = (u32 *)trans->rsp_pay;
qlcnic_free_mbx_args(&cmd);
qlcnic_sriov_cleanup_transaction(trans);
}
spin_unlock_irqrestore(&t_list->lock, flags);
}
void __qlcnic_sriov_cleanup(struct qlcnic_adapter *adapter)
{
struct qlcnic_sriov *sriov = adapter->ahw->sriov;
struct qlcnic_back_channel *bc = &sriov->bc;
struct qlcnic_vf_info *vf;
int i;
if (!qlcnic_sriov_enable_check(adapter))
return;
qlcnic_sriov_cleanup_async_list(bc);
destroy_workqueue(bc->bc_async_wq);
for (i = 0; i < sriov->num_vfs; i++) {
vf = &sriov->vf_info[i];
qlcnic_sriov_cleanup_list(&vf->rcv_pend);
cancel_work_sync(&vf->trans_work);
qlcnic_sriov_cleanup_list(&vf->rcv_act);
}
destroy_workqueue(bc->bc_trans_wq);
for (i = 0; i < sriov->num_vfs; i++)
kfree(sriov->vf_info[i].vp);
kfree(sriov->vf_info);
kfree(adapter->ahw->sriov);
}
static void qlcnic_sriov_vf_cleanup(struct qlcnic_adapter *adapter)
{
qlcnic_sriov_channel_cfg_cmd(adapter, QLCNIC_BC_CMD_CHANNEL_TERM);
Annotation
- Immediate include surface: `linux/types.h`, `qlcnic_sriov.h`, `qlcnic.h`, `qlcnic_83xx_hw.h`.
- Detected declarations: `function qlcnic_sriov_bc_msg_check`, `function qlcnic_sriov_channel_free_check`, `function qlcnic_sriov_flr_check`, `function qlcnic_sriov_target_func_id`, `function qlcnic_sriov_virtid_fn`, `function qlcnic_sriov_init`, `function qlcnic_sriov_cleanup_list`, `function __qlcnic_sriov_cleanup`, `function qlcnic_sriov_vf_cleanup`, `function qlcnic_sriov_cleanup`.
- 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.