drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c- Extension
.c- Size
- 37838 bytes
- Lines
- 1402
- 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/ethtool.hlinux/module.hlinux/pci.hlinux/netdevice.hlinux/if_vlan.hlinux/interrupt.hlinux/etherdevice.hnet/dcbnl.hlinux/bnxt/hsi.hlinux/bnxt/ulp.hbnxt.hbnxt_hwrm.hbnxt_sriov.hbnxt_vfr.hbnxt_ethtool.h
Detected Declarations
function bnxt_hwrm_fwd_async_event_cmplfunction bnxt_vf_ndo_prepfunction bnxt_set_vf_spoofchkfunction bnxt_hwrm_func_qcfg_flagsfunction bnxt_is_trusted_vffunction bnxt_hwrm_set_trusted_vffunction bnxt_set_vf_trustfunction bnxt_get_vf_configfunction bnxt_set_vf_macfunction bnxt_set_vf_vlanfunction bnxt_set_vf_bwfunction bnxt_set_vf_link_admin_statefunction bnxt_set_vf_link_statefunction bnxt_set_vf_attrfunction bnxt_hwrm_func_vf_resource_freefunction bnxt_free_vf_resourcesfunction bnxt_alloc_vf_resourcesfunction bnxt_hwrm_func_buf_rgtrfunction __bnxt_set_vf_paramsfunction bnxt_hwrm_roce_sriov_cfgfunction bnxt_hwrm_func_vf_resc_cfgfunction bnxt_hwrm_func_cfgfunction bnxt_func_cfgfunction bnxt_cfg_hw_sriovfunction bnxt_sriov_enablefunction __bnxt_sriov_disablefunction bnxt_sriov_disablefunction bnxt_sriov_configurefunction bnxt_hwrm_fwd_respfunction bnxt_hwrm_fwd_err_respfunction bnxt_hwrm_exec_fwd_respfunction bnxt_vf_configure_macfunction bnxt_vf_validate_set_macfunction bnxt_vf_set_linkfunction bnxt_vf_req_validate_sndfunction bnxt_hwrm_exec_fwd_reqfunction bnxt_approve_macfunction bnxt_update_vf_macfunction ndo_set_mac_addressfunction bnxt_cfg_hw_sriovfunction __bnxt_sriov_disablefunction bnxt_update_vf_mac
Annotated Snippet
if (!rc) {
if (setting)
vf->flags |= BNXT_VF_SPOOFCHK;
else
vf->flags &= ~BNXT_VF_SPOOFCHK;
}
}
return rc;
}
static int bnxt_hwrm_func_qcfg_flags(struct bnxt *bp, struct bnxt_vf_info *vf)
{
struct hwrm_func_qcfg_output *resp;
struct hwrm_func_qcfg_input *req;
int rc;
rc = hwrm_req_init(bp, req, HWRM_FUNC_QCFG);
if (rc)
return rc;
req->fid = cpu_to_le16(BNXT_PF(bp) ? vf->fw_fid : 0xffff);
resp = hwrm_req_hold(bp, req);
rc = hwrm_req_send(bp, req);
if (!rc)
vf->func_qcfg_flags = le16_to_cpu(resp->flags);
hwrm_req_drop(bp, req);
return rc;
}
bool bnxt_is_trusted_vf(struct bnxt *bp, struct bnxt_vf_info *vf)
{
if (BNXT_PF(bp) && !(bp->fw_cap & BNXT_FW_CAP_TRUSTED_VF))
return !!(vf->flags & BNXT_VF_TRUST);
bnxt_hwrm_func_qcfg_flags(bp, vf);
return !!(vf->func_qcfg_flags & FUNC_QCFG_RESP_FLAGS_TRUSTED_VF);
}
static int bnxt_hwrm_set_trusted_vf(struct bnxt *bp, struct bnxt_vf_info *vf)
{
struct hwrm_func_cfg_input *req;
int rc;
if (!(bp->fw_cap & BNXT_FW_CAP_TRUSTED_VF))
return 0;
rc = bnxt_hwrm_func_cfg_short_req_init(bp, &req);
if (rc)
return rc;
req->fid = cpu_to_le16(vf->fw_fid);
if (vf->flags & BNXT_VF_TRUST)
req->flags = cpu_to_le32(FUNC_CFG_REQ_FLAGS_TRUSTED_VF_ENABLE);
else
req->flags = cpu_to_le32(FUNC_CFG_REQ_FLAGS_TRUSTED_VF_DISABLE);
return hwrm_req_send(bp, req);
}
int bnxt_set_vf_trust(struct net_device *dev, int vf_id, bool trusted)
{
struct bnxt *bp = netdev_priv(dev);
struct bnxt_vf_info *vf;
if (bnxt_vf_ndo_prep(bp, vf_id))
return -EINVAL;
vf = &bp->pf.vf[vf_id];
if (trusted)
vf->flags |= BNXT_VF_TRUST;
else
vf->flags &= ~BNXT_VF_TRUST;
bnxt_hwrm_set_trusted_vf(bp, vf);
return 0;
}
int bnxt_get_vf_config(struct net_device *dev, int vf_id,
struct ifla_vf_info *ivi)
{
struct bnxt *bp = netdev_priv(dev);
struct bnxt_vf_info *vf;
int rc;
rc = bnxt_vf_ndo_prep(bp, vf_id);
if (rc)
return rc;
ivi->vf = vf_id;
vf = &bp->pf.vf[vf_id];
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/module.h`, `linux/pci.h`, `linux/netdevice.h`, `linux/if_vlan.h`, `linux/interrupt.h`, `linux/etherdevice.h`, `net/dcbnl.h`.
- Detected declarations: `function bnxt_hwrm_fwd_async_event_cmpl`, `function bnxt_vf_ndo_prep`, `function bnxt_set_vf_spoofchk`, `function bnxt_hwrm_func_qcfg_flags`, `function bnxt_is_trusted_vf`, `function bnxt_hwrm_set_trusted_vf`, `function bnxt_set_vf_trust`, `function bnxt_get_vf_config`, `function bnxt_set_vf_mac`, `function bnxt_set_vf_vlan`.
- 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.