drivers/net/ethernet/aquantia/atlantic/aq_filters.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/aquantia/atlantic/aq_filters.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/aquantia/atlantic/aq_filters.c- Extension
.c- Size
- 23697 bytes
- Lines
- 916
- 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.
- 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
aq_filters.h
Detected Declarations
function aq_rule_is_approvefunction aq_match_filterfunction aq_rule_already_existsfunction hlist_for_each_entry_safefunction aq_check_approve_fl3l4function aq_check_approve_fl2function aq_check_approve_fvlanfunction aq_is_ipv6_flow_typefunction aq_check_filterfunction aq_rule_is_not_supportfunction aq_rule_is_not_correctfunction aq_check_rulefunction aq_set_data_fl2function aq_add_del_fetherfunction aq_fvlan_is_busyfunction aq_fvlan_rebuildfunction aq_set_data_fvlanfunction aq_del_fvlan_by_vlanfunction hlist_for_each_entry_safefunction be16_to_cpufunction aq_add_del_fvlanfunction aq_set_data_fl3l4function aq_set_fl3l4function aq_add_del_fl3l4function aq_add_del_rulefunction aq_update_table_filtersfunction hlist_for_each_entry_safefunction aq_get_rxnfc_count_all_rulesfunction aq_add_rxnfc_rulefunction aq_del_rxnfc_rulefunction hlist_for_each_entry_safefunction aq_get_rxnfc_rulefunction aq_get_rxnfc_all_rulesfunction hlist_for_each_entry_safefunction aq_clear_rxnfc_all_rulesfunction hlist_for_each_entry_safefunction aq_reapply_rxnfc_all_rulesfunction hlist_for_each_entry_safefunction aq_filters_vlans_updatefunction aq_filters_vlan_offload_off
Annotated Snippet
switch (fsp->h_u.usr_ip4_spec.proto) {
case IPPROTO_TCP:
case IPPROTO_UDP:
case IPPROTO_SCTP:
case IPPROTO_IP:
return true;
default:
return false;
}
case IPV6_USER_FLOW:
switch (fsp->h_u.usr_ip6_spec.l4_proto) {
case IPPROTO_TCP:
case IPPROTO_UDP:
case IPPROTO_SCTP:
case IPPROTO_IP:
return true;
default:
return false;
}
default:
return false;
}
return false;
}
static bool __must_check
aq_match_filter(struct ethtool_rx_flow_spec *fsp1,
struct ethtool_rx_flow_spec *fsp2)
{
if (fsp1->flow_type != fsp2->flow_type ||
memcmp(&fsp1->h_u, &fsp2->h_u, sizeof(fsp2->h_u)) ||
memcmp(&fsp1->h_ext, &fsp2->h_ext, sizeof(fsp2->h_ext)) ||
memcmp(&fsp1->m_u, &fsp2->m_u, sizeof(fsp2->m_u)) ||
memcmp(&fsp1->m_ext, &fsp2->m_ext, sizeof(fsp2->m_ext)))
return false;
return true;
}
static bool __must_check
aq_rule_already_exists(struct aq_nic_s *aq_nic,
struct ethtool_rx_flow_spec *fsp)
{
struct aq_rx_filter *rule;
struct hlist_node *aq_node2;
struct aq_hw_rx_fltrs_s *rx_fltrs = aq_get_hw_rx_fltrs(aq_nic);
hlist_for_each_entry_safe(rule, aq_node2,
&rx_fltrs->filter_list, aq_node) {
if (rule->aq_fsp.location == fsp->location)
continue;
if (aq_match_filter(&rule->aq_fsp, fsp)) {
netdev_err(aq_nic->ndev,
"ethtool: This filter is already set\n");
return true;
}
}
return false;
}
static int aq_check_approve_fl3l4(struct aq_nic_s *aq_nic,
struct aq_hw_rx_fltrs_s *rx_fltrs,
struct ethtool_rx_flow_spec *fsp)
{
u32 last_location = AQ_RX_LAST_LOC_FL3L4 -
aq_nic->aq_hw_rx_fltrs.fl3l4.reserved_count;
if (fsp->location < AQ_RX_FIRST_LOC_FL3L4 ||
fsp->location > last_location) {
netdev_err(aq_nic->ndev,
"ethtool: location must be in range [%d, %d]",
AQ_RX_FIRST_LOC_FL3L4, last_location);
return -EINVAL;
}
if (rx_fltrs->fl3l4.is_ipv6 && rx_fltrs->fl3l4.active_ipv4) {
rx_fltrs->fl3l4.is_ipv6 = false;
netdev_err(aq_nic->ndev,
"ethtool: mixing ipv4 and ipv6 is not allowed");
return -EINVAL;
} else if (!rx_fltrs->fl3l4.is_ipv6 && rx_fltrs->fl3l4.active_ipv6) {
rx_fltrs->fl3l4.is_ipv6 = true;
netdev_err(aq_nic->ndev,
"ethtool: mixing ipv4 and ipv6 is not allowed");
return -EINVAL;
} else if (rx_fltrs->fl3l4.is_ipv6 &&
fsp->location != AQ_RX_FIRST_LOC_FL3L4 + 4 &&
fsp->location != AQ_RX_FIRST_LOC_FL3L4) {
netdev_err(aq_nic->ndev,
Annotation
- Immediate include surface: `aq_filters.h`.
- Detected declarations: `function aq_rule_is_approve`, `function aq_match_filter`, `function aq_rule_already_exists`, `function hlist_for_each_entry_safe`, `function aq_check_approve_fl3l4`, `function aq_check_approve_fl2`, `function aq_check_approve_fvlan`, `function aq_is_ipv6_flow_type`, `function aq_check_filter`, `function aq_rule_is_not_support`.
- 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.