drivers/net/ethernet/sfc/mcdi_filters.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/mcdi_filters.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/mcdi_filters.c- Extension
.c- Size
- 69223 bytes
- Lines
- 2304
- 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
mcdi_filters.hmcdi.hnic.hrx_common.h
Detected Declarations
function efx_mcdi_filter_entry_specfunction efx_mcdi_filter_entry_flagsfunction efx_mcdi_filter_get_unsafe_idfunction efx_mcdi_filter_get_unsafe_prifunction efx_mcdi_filter_make_filter_idfunction efx_mcdi_filter_is_exclusivefunction efx_mcdi_filter_set_entryfunction efx_mcdi_filter_push_prep_set_match_fieldsfunction efx_mcdi_filter_push_prepfunction efx_mcdi_filter_pushfunction efx_mcdi_filter_mcdi_flags_from_specfunction efx_mcdi_filter_prifunction efx_mcdi_filter_insert_lockedfunction efx_mcdi_filter_insertfunction efx_mcdi_filter_remove_internalfunction efx_mcdi_filter_remove_oldfunction efx_mcdi_filter_remove_safefunction efx_mcdi_filter_remove_unsafefunction efx_mcdi_filter_get_safefunction efx_mcdi_filter_prifunction efx_mcdi_filter_insert_addr_listfunction efx_mcdi_filter_insert_deffunction efx_mcdi_filter_table_removefunction efx_mcdi_filter_clear_rxfunction efx_mcdi_filter_count_rx_usedfunction efx_mcdi_filter_get_rx_id_limitfunction efx_mcdi_filter_get_rx_idsfunction efx_mcdi_filter_match_flags_from_mcdifunction efx_mcdi_filter_match_supportedfunction efx_mcdi_filter_table_probe_matchesfunction efx_mcdi_filter_table_probefunction efx_mcdi_filter_match_supportedfunction efx_mcdi_filter_table_reset_mc_allocationsfunction efx_mcdi_filter_table_removefunction efx_mcdi_filter_table_downfunction efx_mcdi_filter_table_removefunction efx_mcdi_filter_mark_one_oldfunction _efx_mcdi_filter_vlan_mark_oldfunction efx_mcdi_filter_table_removefunction efx_mcdi_filter_add_vlanfunction efx_mcdi_filter_del_vlan_internalfunction efx_mcdi_filter_del_vlanfunction list_for_each_entryfunction efx_mcdi_filter_cleanup_vlansfunction efx_mcdi_filter_uc_addr_listfunction efx_mcdi_filter_mc_addr_listfunction efx_mcdi_filter_table_removefunction efx_mcdi_filter_rfs_expire_one
Annotated Snippet
switch (encap_type & EFX_ENCAP_TYPES_MASK) {
case EFX_ENCAP_TYPE_VXLAN:
vni_type = MC_CMD_FILTER_OP_EXT_IN_VNI_TYPE_VXLAN;
fallthrough;
case EFX_ENCAP_TYPE_GENEVE:
COPY_VALUE(ether_type, ETHER_TYPE);
outer_ip_proto = IPPROTO_UDP;
COPY_VALUE(outer_ip_proto, IP_PROTO);
/*
* We always need to set the type field, even
* though we're not matching on the TNI.
*/
MCDI_POPULATE_DWORD_1(inbuf,
FILTER_OP_EXT_IN_VNI_OR_VSID,
FILTER_OP_EXT_IN_VNI_TYPE,
vni_type);
break;
case EFX_ENCAP_TYPE_NVGRE:
COPY_VALUE(ether_type, ETHER_TYPE);
outer_ip_proto = IPPROTO_GRE;
COPY_VALUE(outer_ip_proto, IP_PROTO);
break;
default:
WARN_ON(1);
}
uc_match = MC_CMD_FILTER_OP_EXT_IN_MATCH_IFRM_UNKNOWN_UCAST_DST_LBN;
mc_match = MC_CMD_FILTER_OP_EXT_IN_MATCH_IFRM_UNKNOWN_MCAST_DST_LBN;
} else {
uc_match = MC_CMD_FILTER_OP_EXT_IN_MATCH_UNKNOWN_UCAST_DST_LBN;
mc_match = MC_CMD_FILTER_OP_EXT_IN_MATCH_UNKNOWN_MCAST_DST_LBN;
}
if (spec->match_flags & EFX_FILTER_MATCH_LOC_MAC_IG)
match_fields |=
is_multicast_ether_addr(spec->loc_mac) ?
1 << mc_match :
1 << uc_match;
COPY_FIELD(REM_HOST, rem_host, SRC_IP);
COPY_FIELD(LOC_HOST, loc_host, DST_IP);
COPY_FIELD(REM_MAC, rem_mac, SRC_MAC);
COPY_FIELD(REM_PORT, rem_port, SRC_PORT);
COPY_FIELD(LOC_MAC, loc_mac, DST_MAC);
COPY_FIELD(LOC_PORT, loc_port, DST_PORT);
COPY_FIELD(ETHER_TYPE, ether_type, ETHER_TYPE);
COPY_FIELD(INNER_VID, inner_vid, INNER_VLAN);
COPY_FIELD(OUTER_VID, outer_vid, OUTER_VLAN);
COPY_FIELD(IP_PROTO, ip_proto, IP_PROTO);
#undef COPY_FIELD
#undef COPY_VALUE
MCDI_SET_DWORD(inbuf, FILTER_OP_IN_MATCH_FIELDS,
match_fields);
}
static void efx_mcdi_filter_push_prep(struct efx_nic *efx,
const struct efx_filter_spec *spec,
efx_dword_t *inbuf, u64 handle,
struct efx_rss_context_priv *ctx,
bool replacing)
{
u32 flags = spec->flags;
memset(inbuf, 0, MC_CMD_FILTER_OP_EXT_IN_LEN);
/* If RSS filter, caller better have given us an RSS context */
if (flags & EFX_FILTER_FLAG_RX_RSS) {
/*
* We don't have the ability to return an error, so we'll just
* log a warning and disable RSS for the filter.
*/
if (WARN_ON_ONCE(!ctx))
flags &= ~EFX_FILTER_FLAG_RX_RSS;
else if (WARN_ON_ONCE(ctx->context_id == EFX_MCDI_RSS_CONTEXT_INVALID))
flags &= ~EFX_FILTER_FLAG_RX_RSS;
}
if (replacing) {
MCDI_SET_DWORD(inbuf, FILTER_OP_IN_OP,
MC_CMD_FILTER_OP_IN_OP_REPLACE);
MCDI_SET_QWORD(inbuf, FILTER_OP_IN_HANDLE, handle);
} else {
efx_mcdi_filter_push_prep_set_match_fields(efx, spec, inbuf);
}
if (flags & EFX_FILTER_FLAG_VPORT_ID)
MCDI_SET_DWORD(inbuf, FILTER_OP_IN_PORT_ID, spec->vport_id);
else
MCDI_SET_DWORD(inbuf, FILTER_OP_IN_PORT_ID, efx->vport_id);
MCDI_SET_DWORD(inbuf, FILTER_OP_IN_RX_DEST,
spec->dmaq_id == EFX_FILTER_RX_DMAQ_ID_DROP ?
Annotation
- Immediate include surface: `mcdi_filters.h`, `mcdi.h`, `nic.h`, `rx_common.h`.
- Detected declarations: `function efx_mcdi_filter_entry_spec`, `function efx_mcdi_filter_entry_flags`, `function efx_mcdi_filter_get_unsafe_id`, `function efx_mcdi_filter_get_unsafe_pri`, `function efx_mcdi_filter_make_filter_id`, `function efx_mcdi_filter_is_exclusive`, `function efx_mcdi_filter_set_entry`, `function efx_mcdi_filter_push_prep_set_match_fields`, `function efx_mcdi_filter_push_prep`, `function efx_mcdi_filter_push`.
- 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.