drivers/net/ethernet/intel/ice/virt/fdir.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/virt/fdir.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/virt/fdir.c- Extension
.c- Size
- 66737 bytes
- Lines
- 2435
- 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.
- 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
ice.hice_base.hice_lib.hice_flow.hice_vf_lib_private.h
Detected Declarations
struct virtchnl_fdir_fltr_confstruct virtchnl_fdir_inset_mapenum ice_fdir_tunnel_typefunction ice_vc_fdir_param_checkfunction ice_vf_start_ctrl_vsifunction ice_vc_fdir_alloc_proffunction ice_vc_fdir_free_proffunction ice_vc_fdir_free_prof_allfunction ice_vc_fdir_parse_flow_fldfunction ice_vc_fdir_set_flow_fldfunction ice_vc_fdir_set_flow_hdrfunction ice_vc_fdir_rem_proffunction ice_vc_fdir_rem_prof_allfunction ice_vc_fdir_reset_cnt_allfunction ice_vc_fdir_has_prof_conflictfunction list_for_each_entryfunction ice_vc_fdir_write_flow_proffunction ice_vc_fdir_config_input_setfunction flowfunction ice_vc_fdir_parse_rawfunction ice_vc_fdir_parse_patternfunction ice_vc_fdir_parse_actionfunction ice_vc_validate_fdir_fltrfunction ice_vc_fdir_comp_rulesfunction ice_vc_fdir_is_dup_fltrfunction list_for_each_entryfunction ice_vc_fdir_insert_entryfunction ice_vc_fdir_remove_entryfunction ice_vc_fdir_lookup_entryfunction ice_vc_fdir_flush_entryfunction list_for_each_entry_safefunction ice_vc_fdir_write_fltrfunction ice_vf_fdir_timerfunction ice_vc_fdir_irq_handlerfunction ice_vf_fdir_dump_infofunction ice_vf_verify_rx_descfunction ice_fdir_is_tunnelfunction ice_vc_add_fdir_fltr_postfunction ice_vc_del_fdir_fltr_postfunction ice_flush_fdir_ctxfunction ice_vc_fdir_set_irq_ctxfunction ice_vc_fdir_clear_irq_ctxfunction ice_vc_parser_fv_check_difffunction ice_vc_parser_fv_savefunction ice_vc_add_fdir_rawfunction ice_vc_add_fdir_fltrfunction ice_vc_del_fdir_rawfunction ice_vc_del_fdir_fltr
Annotated Snippet
struct virtchnl_fdir_fltr_conf {
struct ice_fdir_fltr input;
enum ice_fdir_tunnel_type ttype;
u64 inset_flag;
u32 flow_id;
struct ice_parser_profile *prof;
bool parser_ena;
u8 *pkt_buf;
u8 pkt_len;
};
struct virtchnl_fdir_inset_map {
enum virtchnl_proto_hdr_field field;
enum ice_flow_field fld;
u64 flag;
u64 mask;
};
static const struct virtchnl_fdir_inset_map fdir_inset_map[] = {
{VIRTCHNL_PROTO_HDR_ETH_ETHERTYPE, ICE_FLOW_FIELD_IDX_ETH_TYPE, 0, 0},
{VIRTCHNL_PROTO_HDR_IPV4_SRC, ICE_FLOW_FIELD_IDX_IPV4_SA, 0, 0},
{VIRTCHNL_PROTO_HDR_IPV4_DST, ICE_FLOW_FIELD_IDX_IPV4_DA, 0, 0},
{VIRTCHNL_PROTO_HDR_IPV4_DSCP, ICE_FLOW_FIELD_IDX_IPV4_DSCP, 0, 0},
{VIRTCHNL_PROTO_HDR_IPV4_TTL, ICE_FLOW_FIELD_IDX_IPV4_TTL, 0, 0},
{VIRTCHNL_PROTO_HDR_IPV4_PROT, ICE_FLOW_FIELD_IDX_IPV4_PROT, 0, 0},
{VIRTCHNL_PROTO_HDR_IPV6_SRC, ICE_FLOW_FIELD_IDX_IPV6_SA, 0, 0},
{VIRTCHNL_PROTO_HDR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_SPI, 0, 0},
{VIRTCHNL_PROTO_HDR_L2TPV3_SESS_ID, ICE_FLOW_FIELD_IDX_L2TPV3_SESS_ID, 0, 0},
{VIRTCHNL_PROTO_HDR_PFCP_S_FIELD, ICE_FLOW_FIELD_IDX_UDP_DST_PORT, 0, 0},
};
/**
* ice_vc_fdir_param_check
* @vf: pointer to the VF structure
* @vsi_id: VF relative VSI ID
*
* Check for the valid VSI ID, PF's state and VF's state
*
* Return: 0 on success, and -EINVAL on error.
*/
static int
ice_vc_fdir_param_check(struct ice_vf *vf, u16 vsi_id)
{
struct ice_pf *pf = vf->pf;
if (!test_bit(ICE_FLAG_FD_ENA, pf->flags))
return -EINVAL;
if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states))
return -EINVAL;
if (!(vf->driver_caps & VIRTCHNL_VF_OFFLOAD_FDIR_PF))
return -EINVAL;
if (!ice_vc_isvalid_vsi_id(vf, vsi_id))
return -EINVAL;
if (!ice_get_vf_vsi(vf))
return -EINVAL;
return 0;
}
/**
* ice_vf_start_ctrl_vsi
* @vf: pointer to the VF structure
*
* Allocate ctrl_vsi for the first time and open the ctrl_vsi port for VF
*
* Return: 0 on success, and other on error.
*/
static int ice_vf_start_ctrl_vsi(struct ice_vf *vf)
{
Annotation
- Immediate include surface: `ice.h`, `ice_base.h`, `ice_lib.h`, `ice_flow.h`, `ice_vf_lib_private.h`.
- Detected declarations: `struct virtchnl_fdir_fltr_conf`, `struct virtchnl_fdir_inset_map`, `enum ice_fdir_tunnel_type`, `function ice_vc_fdir_param_check`, `function ice_vf_start_ctrl_vsi`, `function ice_vc_fdir_alloc_prof`, `function ice_vc_fdir_free_prof`, `function ice_vc_fdir_free_prof_all`, `function ice_vc_fdir_parse_flow_fld`, `function ice_vc_fdir_set_flow_fld`.
- 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.
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.