drivers/net/ethernet/intel/ice/ice_fdir.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_fdir.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_fdir.c- Extension
.c- Size
- 44492 bytes
- Lines
- 1299
- 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
ice_common.h
Detected Declarations
function ice_set_dflt_val_fd_descfunction ice_set_fd_desc_valfunction ice_fdir_get_prgm_descfunction ice_alloc_fd_res_cntrfunction ice_free_fd_res_cntrfunction ice_alloc_fd_guar_itemfunction ice_alloc_fd_shrd_itemfunction ice_get_fdir_cnt_allfunction ice_pkt_insert_ipv6_addrfunction QFIfunction ice_pkt_insert_u8function Classfunction ice_pkt_insert_u16function ice_pkt_insert_u32function ice_pkt_insert_mac_addrfunction ice_fdir_get_gen_prgm_pktfunction ice_fdir_has_fragfunction ice_fdir_find_fltr_by_idxfunction list_for_each_entryfunction ice_fdir_list_add_fltrfunction list_for_each_entryfunction ice_fdir_update_cntrsfunction ice_cmp_ipv6_addrfunction ice_fdir_comp_rulesfunction ice_fdir_is_dup_fltrfunction list_for_each_entry
Annotated Snippet
switch (input->ip.v4.proto) {
case IPPROTO_TCP:
flow = ICE_FLTR_PTYPE_NONF_IPV4_TCP;
break;
case IPPROTO_UDP:
flow = ICE_FLTR_PTYPE_NONF_IPV4_UDP;
break;
case IPPROTO_SCTP:
flow = ICE_FLTR_PTYPE_NONF_IPV4_SCTP;
break;
default:
flow = ICE_FLTR_PTYPE_NONF_IPV4_OTHER;
break;
}
} else if (input->flow_type == ICE_FLTR_PTYPE_NONF_IPV6_OTHER) {
switch (input->ip.v6.proto) {
case IPPROTO_TCP:
flow = ICE_FLTR_PTYPE_NONF_IPV6_TCP;
break;
case IPPROTO_UDP:
flow = ICE_FLTR_PTYPE_NONF_IPV6_UDP;
break;
case IPPROTO_SCTP:
flow = ICE_FLTR_PTYPE_NONF_IPV6_SCTP;
break;
default:
flow = ICE_FLTR_PTYPE_NONF_IPV6_OTHER;
break;
}
} else {
flow = input->flow_type;
}
for (idx = 0; idx < ICE_FDIR_NUM_PKT; idx++)
if (ice_fdir_pkt[idx].flow == flow)
break;
if (idx == ICE_FDIR_NUM_PKT)
return -EINVAL;
if (!tun) {
memcpy(pkt, ice_fdir_pkt[idx].pkt, ice_fdir_pkt[idx].pkt_len);
loc = pkt;
} else {
if (!ice_get_open_tunnel_port(hw, &tnl_port, TNL_ALL))
return -ENOENT;
if (!ice_fdir_pkt[idx].tun_pkt)
return -EINVAL;
memcpy(pkt, ice_fdir_pkt[idx].tun_pkt,
ice_fdir_pkt[idx].tun_pkt_len);
ice_pkt_insert_u16(pkt, ICE_IPV4_UDP_DST_PORT_OFFSET,
htons(tnl_port));
loc = &pkt[ICE_FDIR_TUN_PKT_OFF];
}
/* Reverse the src and dst, since the HW expects them to be from Tx
* perspective. The input from user is from Rx filter perspective.
*/
switch (flow) {
case ICE_FLTR_PTYPE_NONF_ETH:
ice_pkt_insert_mac_addr(loc, input->eth.h_dest);
ice_pkt_insert_mac_addr(loc + ETH_ALEN, input->eth.h_source);
if (input->ext_data.vlan_tag || input->ext_data.vlan_type) {
ice_pkt_insert_u16(loc, ICE_ETH_TYPE_F_OFFSET,
input->ext_data.vlan_type);
ice_pkt_insert_u16(loc, ICE_ETH_VLAN_TCI_OFFSET,
input->ext_data.vlan_tag);
ice_pkt_insert_u16(loc, ICE_ETH_TYPE_VLAN_OFFSET,
input->eth.h_proto);
} else {
ice_pkt_insert_u16(loc, ICE_ETH_TYPE_F_OFFSET,
input->eth.h_proto);
}
break;
case ICE_FLTR_PTYPE_NONF_IPV4_TCP:
ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
input->ip.v4.src_ip);
ice_pkt_insert_u16(loc, ICE_IPV4_TCP_DST_PORT_OFFSET,
input->ip.v4.src_port);
ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
input->ip.v4.dst_ip);
ice_pkt_insert_u16(loc, ICE_IPV4_TCP_SRC_PORT_OFFSET,
input->ip.v4.dst_port);
ice_pkt_insert_u8(loc, ICE_IPV4_TOS_OFFSET, input->ip.v4.tos);
ice_pkt_insert_u8(loc, ICE_IPV4_TTL_OFFSET, input->ip.v4.ttl);
ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
if (frag)
loc[20] = ICE_FDIR_IPV4_PKT_FLAG_MF;
break;
case ICE_FLTR_PTYPE_NONF_IPV4_UDP:
ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
input->ip.v4.src_ip);
Annotation
- Immediate include surface: `ice_common.h`.
- Detected declarations: `function ice_set_dflt_val_fd_desc`, `function ice_set_fd_desc_val`, `function ice_fdir_get_prgm_desc`, `function ice_alloc_fd_res_cntr`, `function ice_free_fd_res_cntr`, `function ice_alloc_fd_guar_item`, `function ice_alloc_fd_shrd_item`, `function ice_get_fdir_cnt_all`, `function ice_pkt_insert_ipv6_addr`, `function QFI`.
- 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.