drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c- Extension
.c- Size
- 57751 bytes
- Lines
- 2081
- 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_lib.hice_fdir.hice_flow.h
Detected Declarations
function ice_fltr_to_ethtool_flowfunction ice_ethtool_flow_to_fltrfunction ice_is_mask_validfunction ice_get_ethtool_fdir_entryfunction ice_get_fdir_fltr_idsfunction list_for_each_entryfunction ice_fdir_remap_entriesfunction ice_fdir_rem_adq_chnlfunction ice_fdir_get_hw_proffunction ice_fdir_erase_flow_from_hwfunction ice_fdir_rem_flowfunction ice_fdir_release_flowsfunction ice_fdir_replay_flowsfunction ice_parse_rx_flow_user_datafunction ice_fdir_num_avail_fltrfunction ice_fdir_alloc_flow_proffunction ice_fdir_prof_vsi_idxfunction ice_fdir_set_hw_fltr_rulefunction ice_set_init_fdir_segfunction ice_create_init_fdir_rulefunction ice_set_fdir_ip4_segfunction ice_set_fdir_ip4_usr_segfunction ice_set_fdir_ip6_segfunction ice_set_fdir_ip6_usr_segfunction ice_fdir_vlan_validfunction ice_set_ether_flow_segfunction ice_set_fdir_vlan_segfunction ice_cfg_fdir_xtrct_seqfunction ice_update_per_q_fltrfunction ice_fdir_write_fltrfunction ice_fdir_write_all_fltrfunction ice_fdir_replay_fltrsfunction list_for_each_entryfunction ice_fdir_create_dflt_rulesfunction ice_fdir_del_all_fltrsfunction list_for_each_entry_safefunction ice_vsi_manage_fdirfunction ice_fdir_do_rem_flowfunction ice_fdir_update_list_entryfunction ice_del_fdir_ethtoolfunction ice_update_ring_dest_vsifunction list_for_each_entryfunction ice_set_fdir_input_setfunction ice_add_fdir_ethtoolfunction ice_fdir_num_avail_fltr
Annotated Snippet
if (cnt == cmd->rule_cnt) {
val = -EMSGSIZE;
goto release_lock;
}
rule_locs[cnt] = f_rule->fltr_id;
cnt++;
}
release_lock:
mutex_unlock(&hw->fdir_fltr_lock);
if (!val)
cmd->rule_cnt = cnt;
return val;
}
/**
* ice_fdir_remap_entries - update the FDir entries in profile
* @prof: FDir structure pointer
* @tun: tunneled or non-tunneled packet
* @idx: FDir entry index
*/
static void
ice_fdir_remap_entries(struct ice_fd_hw_prof *prof, int tun, int idx)
{
if (idx != prof->cnt && tun < ICE_FD_HW_SEG_MAX) {
int i;
for (i = idx; i < (prof->cnt - 1); i++) {
u64 old_entry_h;
old_entry_h = prof->entry_h[i + 1][tun];
prof->entry_h[i][tun] = old_entry_h;
prof->vsi_h[i] = prof->vsi_h[i + 1];
}
prof->entry_h[i][tun] = 0;
prof->vsi_h[i] = 0;
}
}
/**
* ice_fdir_rem_adq_chnl - remove an ADQ channel from HW filter rules
* @hw: hardware structure containing filter list
* @vsi_idx: VSI handle
*/
void ice_fdir_rem_adq_chnl(struct ice_hw *hw, u16 vsi_idx)
{
int status, flow;
if (!hw->fdir_prof)
return;
for (flow = 0; flow < ICE_FLTR_PTYPE_MAX; flow++) {
struct ice_fd_hw_prof *prof = hw->fdir_prof[flow];
int tun, i;
if (!prof || !prof->cnt)
continue;
for (tun = 0; tun < ICE_FD_HW_SEG_MAX; tun++) {
u64 prof_id = prof->prof_id[tun];
for (i = 0; i < prof->cnt; i++) {
if (prof->vsi_h[i] != vsi_idx)
continue;
prof->entry_h[i][tun] = 0;
prof->vsi_h[i] = 0;
break;
}
/* after clearing FDir entries update the remaining */
ice_fdir_remap_entries(prof, tun, i);
/* find flow profile corresponding to prof_id and clear
* vsi_idx from bitmap.
*/
status = ice_flow_rem_vsi_prof(hw, vsi_idx, prof_id);
if (status) {
dev_err(ice_hw_to_dev(hw), "ice_flow_rem_vsi_prof() failed status=%d\n",
status);
}
}
prof->cnt--;
}
}
/**
* ice_fdir_get_hw_prof - return the ice_fd_hw_proc associated with a flow
* @hw: hardware structure containing the filter list
Annotation
- Immediate include surface: `ice.h`, `ice_lib.h`, `ice_fdir.h`, `ice_flow.h`.
- Detected declarations: `function ice_fltr_to_ethtool_flow`, `function ice_ethtool_flow_to_fltr`, `function ice_is_mask_valid`, `function ice_get_ethtool_fdir_entry`, `function ice_get_fdir_fltr_ids`, `function list_for_each_entry`, `function ice_fdir_remap_entries`, `function ice_fdir_rem_adq_chnl`, `function ice_fdir_get_hw_prof`, `function ice_fdir_erase_flow_from_hw`.
- 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.