drivers/net/ethernet/intel/ice/virt/allowlist.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/virt/allowlist.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/virt/allowlist.c- Extension
.c- Size
- 6169 bytes
- Lines
- 200
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
allowlist.h
Detected Declarations
struct allowlist_opcode_infofunction ice_vc_is_opcode_allowedfunction ice_vc_allowlist_opcodesfunction ice_vc_clear_allowlistfunction ice_vc_set_default_allowlistfunction ice_vc_set_working_allowlistfunction ice_vc_set_caps_allowlist
Annotated Snippet
struct allowlist_opcode_info {
const u32 *opcodes;
size_t size;
};
#define BIT_INDEX(caps) (HWEIGHT((caps) - 1))
#define ALLOW_ITEM(caps, list) \
[BIT_INDEX(caps)] = { \
.opcodes = list, \
.size = ARRAY_SIZE(list) \
}
static const struct allowlist_opcode_info allowlist_opcodes[] = {
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_L2, l2_allowlist_opcodes),
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_REQ_QUEUES, req_queues_allowlist_opcodes),
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_VLAN, vlan_allowlist_opcodes),
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_RSS_PF, rss_pf_allowlist_opcodes),
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC, rx_flex_desc_allowlist_opcodes),
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF, adv_rss_pf_allowlist_opcodes),
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_FDIR_PF, fdir_pf_allowlist_opcodes),
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_VLAN_V2, vlan_v2_allowlist_opcodes),
ALLOW_ITEM(VIRTCHNL_VF_OFFLOAD_QOS, tc_allowlist_opcodes),
ALLOW_ITEM(VIRTCHNL_VF_CAP_PTP, ptp_allowlist_opcodes),
};
/**
* ice_vc_is_opcode_allowed - check if this opcode is allowed on this VF
* @vf: pointer to VF structure
* @opcode: virtchnl opcode
*
* Return true if message is allowed on this VF
*/
bool ice_vc_is_opcode_allowed(struct ice_vf *vf, u32 opcode)
{
if (opcode >= VIRTCHNL_OP_MAX)
return false;
return test_bit(opcode, vf->opcodes_allowlist);
}
/**
* ice_vc_allowlist_opcodes - allowlist selected opcodes
* @vf: pointer to VF structure
* @opcodes: array of opocodes to allowlist
* @size: size of opcodes array
*
* Function should be called to allowlist opcodes on VF.
*/
static void
ice_vc_allowlist_opcodes(struct ice_vf *vf, const u32 *opcodes, size_t size)
{
unsigned int i;
for (i = 0; i < size; i++)
set_bit(opcodes[i], vf->opcodes_allowlist);
}
/**
* ice_vc_clear_allowlist - clear all allowlist opcodes
* @vf: pointer to VF structure
*/
static void ice_vc_clear_allowlist(struct ice_vf *vf)
{
bitmap_zero(vf->opcodes_allowlist, VIRTCHNL_OP_MAX);
}
/**
* ice_vc_set_default_allowlist - allowlist default opcodes for VF
* @vf: pointer to VF structure
*/
void ice_vc_set_default_allowlist(struct ice_vf *vf)
{
ice_vc_clear_allowlist(vf);
ice_vc_allowlist_opcodes(vf, default_allowlist_opcodes,
ARRAY_SIZE(default_allowlist_opcodes));
}
/**
* ice_vc_set_working_allowlist - allowlist opcodes needed to by VF to work
* @vf: pointer to VF structure
*
* allowlist opcodes that aren't associated with specific caps, but
* are needed by VF to work.
*/
void ice_vc_set_working_allowlist(struct ice_vf *vf)
{
ice_vc_allowlist_opcodes(vf, working_allowlist_opcodes,
ARRAY_SIZE(working_allowlist_opcodes));
}
/**
Annotation
- Immediate include surface: `allowlist.h`.
- Detected declarations: `struct allowlist_opcode_info`, `function ice_vc_is_opcode_allowed`, `function ice_vc_allowlist_opcodes`, `function ice_vc_clear_allowlist`, `function ice_vc_set_default_allowlist`, `function ice_vc_set_working_allowlist`, `function ice_vc_set_caps_allowlist`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.