drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c- Extension
.c- Size
- 51059 bytes
- Lines
- 2047
- 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.h
Detected Declarations
struct qlcnic_sriov_cmd_handlerstruct qlcnic_sriov_fw_cmd_handlerfunction qlcnic_sriov_pf_set_vport_infofunction qlcnic_sriov_pf_cal_res_limitfunction qlcnic_sriov_pf_set_ff_max_resfunction qlcnic_sriov_set_vf_max_vlanfunction qlcnic_sriov_get_pf_infofunction qlcnic_sriov_pf_reset_vport_handlefunction qlcnic_sriov_pf_set_vport_handlefunction qlcnic_sriov_pf_get_vport_handlefunction qlcnic_sriov_pf_config_vportfunction qlcnic_sriov_pf_cfg_vlan_filteringfunction qlcnic_sriov_pf_cfg_floodfunction qlcnic_sriov_pf_cfg_eswitchfunction qlcnic_sriov_pf_del_flr_queuefunction qlcnic_sriov_pf_create_flr_queuefunction qlcnic_sriov_pf_cleanupfunction qlcnic_sriov_pf_disablefunction qlcnic_pci_sriov_disablefunction qlcnic_sriov_pf_initfunction qlcnic_sriov_pf_enablefunction __qlcnic_pci_sriov_enablefunction qlcnic_pci_sriov_enablefunction qlcnic_pci_sriov_configurefunction qlcnic_sriov_set_vf_aclfunction qlcnic_sriov_set_vf_vport_infofunction qlcnic_sriov_pf_channel_cfg_cmdfunction qlcnic_sriov_cfg_vf_def_macfunction qlcnic_sriov_validate_create_rx_ctxfunction qlcnic_83xx_cfg_default_mac_vlanfunction qlcnic_sriov_pf_create_rx_ctx_cmdfunction qlcnic_sriov_pf_mac_address_cmdfunction qlcnic_sriov_validate_create_tx_ctxfunction qlcnic_sriov_pf_create_tx_ctx_cmdfunction qlcnic_sriov_validate_del_rx_ctxfunction qlcnic_sriov_pf_del_rx_ctx_cmdfunction qlcnic_sriov_validate_del_tx_ctxfunction qlcnic_sriov_pf_del_tx_ctx_cmdfunction qlcnic_sriov_validate_cfg_lrofunction qlcnic_sriov_pf_cfg_lro_cmdfunction qlcnic_sriov_pf_cfg_ip_cmdfunction qlcnic_sriov_validate_cfg_intrptfunction qlcnic_sriov_pf_cfg_intrpt_cmdfunction qlcnic_sriov_validate_mtufunction qlcnic_sriov_pf_set_mtu_cmdfunction qlcnic_sriov_validate_get_nic_infofunction qlcnic_sriov_pf_get_nic_info_cmdfunction qlcnic_sriov_validate_cfg_rss
Annotated Snippet
struct qlcnic_sriov_cmd_handler {
int (*fn) (struct qlcnic_bc_trans *, struct qlcnic_cmd_args *);
};
struct qlcnic_sriov_fw_cmd_handler {
u32 cmd;
int (*fn) (struct qlcnic_bc_trans *, struct qlcnic_cmd_args *);
};
static int qlcnic_sriov_pf_set_vport_info(struct qlcnic_adapter *adapter,
struct qlcnic_info *npar_info,
u16 vport_id)
{
struct qlcnic_cmd_args cmd;
int err;
if (qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_SET_NIC_INFO))
return -ENOMEM;
cmd.req.arg[1] = (vport_id << 16) | 0x1;
cmd.req.arg[2] = npar_info->bit_offsets;
cmd.req.arg[2] |= npar_info->min_tx_bw << 16;
cmd.req.arg[3] = npar_info->max_tx_bw | (npar_info->max_tx_ques << 16);
cmd.req.arg[4] = npar_info->max_tx_mac_filters;
cmd.req.arg[4] |= npar_info->max_rx_mcast_mac_filters << 16;
cmd.req.arg[5] = npar_info->max_rx_ucast_mac_filters |
(npar_info->max_rx_ip_addr << 16);
cmd.req.arg[6] = npar_info->max_rx_lro_flow |
(npar_info->max_rx_status_rings << 16);
cmd.req.arg[7] = npar_info->max_rx_buf_rings |
(npar_info->max_rx_ques << 16);
cmd.req.arg[8] = npar_info->max_tx_vlan_keys;
cmd.req.arg[8] |= npar_info->max_local_ipv6_addrs << 16;
cmd.req.arg[9] = npar_info->max_remote_ipv6_addrs;
err = qlcnic_issue_cmd(adapter, &cmd);
if (err)
dev_err(&adapter->pdev->dev,
"Failed to set vport info, err=%d\n", err);
qlcnic_free_mbx_args(&cmd);
return err;
}
static int qlcnic_sriov_pf_cal_res_limit(struct qlcnic_adapter *adapter,
struct qlcnic_info *info, u16 func)
{
struct qlcnic_sriov *sriov = adapter->ahw->sriov;
struct qlcnic_resources *res = &sriov->ff_max;
u16 num_macs = sriov->num_allowed_vlans + 1;
int ret = -EIO, vpid, id;
struct qlcnic_vport *vp;
u32 num_vfs, max, temp;
vpid = qlcnic_sriov_pf_get_vport_handle(adapter, func);
if (vpid < 0)
return -EINVAL;
num_vfs = sriov->num_vfs;
max = num_vfs + 1;
info->bit_offsets = 0xffff;
info->max_tx_ques = res->num_tx_queues / max;
if (qlcnic_83xx_pf_check(adapter))
num_macs = QLCNIC_83XX_SRIOV_VF_MAX_MAC;
info->max_rx_mcast_mac_filters = res->num_rx_mcast_mac_filters;
if (adapter->ahw->pci_func == func) {
info->min_tx_bw = 0;
info->max_tx_bw = MAX_BW;
temp = res->num_rx_ucast_mac_filters - num_macs * num_vfs;
info->max_rx_ucast_mac_filters = temp;
temp = res->num_tx_mac_filters - num_macs * num_vfs;
info->max_tx_mac_filters = temp;
temp = num_macs * num_vfs * QLCNIC_SRIOV_VF_MAX_MAC;
temp = res->num_rx_mcast_mac_filters - temp;
info->max_rx_mcast_mac_filters = temp;
info->max_tx_ques = res->num_tx_queues - sriov->num_vfs;
} else {
id = qlcnic_sriov_func_to_index(adapter, func);
if (id < 0)
return id;
vp = sriov->vf_info[id].vp;
info->min_tx_bw = vp->min_tx_bw;
info->max_tx_bw = vp->max_tx_bw;
info->max_rx_ucast_mac_filters = num_macs;
Annotation
- Immediate include surface: `linux/types.h`, `qlcnic_sriov.h`, `qlcnic.h`.
- Detected declarations: `struct qlcnic_sriov_cmd_handler`, `struct qlcnic_sriov_fw_cmd_handler`, `function qlcnic_sriov_pf_set_vport_info`, `function qlcnic_sriov_pf_cal_res_limit`, `function qlcnic_sriov_pf_set_ff_max_res`, `function qlcnic_sriov_set_vf_max_vlan`, `function qlcnic_sriov_get_pf_info`, `function qlcnic_sriov_pf_reset_vport_handle`, `function qlcnic_sriov_pf_set_vport_handle`, `function qlcnic_sriov_pf_get_vport_handle`.
- 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.