drivers/net/ethernet/sfc/mae.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/mae.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/mae.c- Extension
.c- Size
- 79042 bytes
- Lines
- 2337
- 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
linux/rhashtable.hef100_nic.hmae.hmcdi.hmcdi_pcol.hmcdi_pcol_mae.htc_encap_actions.htc_conntrack.h
Detected Declarations
enum mask_typefunction efx_mae_allocate_mportfunction efx_mae_free_mportfunction efx_mae_mport_wirefunction efx_mae_mport_uplinkfunction efx_mae_mport_mportfunction efx_mae_fw_lookup_mportfunction efx_mae_start_countersfunction efx_mae_counters_flushedfunction efx_mae_stop_countersfunction efx_mae_counters_grant_creditsfunction efx_mae_table_get_descfunction efx_mae_table_hook_findfunction efx_mae_table_hook_ctfunction efx_mae_table_free_descfunction efx_mae_check_table_existsfunction efx_mae_get_tablesfunction efx_mae_free_tablesfunction efx_mae_get_basic_capsfunction efx_mae_get_rule_fieldsfunction efx_mae_get_capsfunction classify_maskfunction efx_mae_match_check_cap_typfunction efx_mae_match_check_capsfunction regularfunction efx_mae_check_encap_match_capsfunction efx_mae_check_encap_type_supportedfunction efx_mae_allocate_counterfunction efx_mae_free_counterfunction efx_mae_encap_type_to_mae_typefunction efx_mae_allocate_encap_mdfunction efx_mae_update_encap_mdfunction efx_mae_free_encap_mdfunction efx_mae_lookup_mportfunction efx_mae_asl_idfunction efx_mae_add_mportfunction efx_mae_remove_mportfunction efx_mae_process_mportfunction efx_mae_enumerate_mportsfunction efx_mae_allocate_pedit_macfunction efx_mae_free_pedit_macfunction efx_mae_alloc_action_setfunction efx_mae_free_action_setfunction efx_mae_alloc_action_set_listfunction efx_mae_free_action_set_listfunction efx_mae_register_encap_matchfunction efx_mae_unregister_encap_matchfunction efx_mae_populate_lhs_match_criteria
Annotated Snippet
if (outlen < MC_CMD_TABLE_DESCRIPTOR_OUT_LEN(i + 1)) {
offset += i;
goto more;
}
if (i + offset < desc->n_keys)
field = desc->keys + i + offset;
else
field = desc->resps + (i + offset - desc->n_keys);
fdesc = MCDI_ARRAY_STRUCT_PTR(outbuf,
TABLE_DESCRIPTOR_OUT_FIELDS, i);
field->field_id = MCDI_STRUCT_WORD(fdesc,
TABLE_FIELD_DESCR_FIELD_ID);
field->lbn = MCDI_STRUCT_WORD(fdesc, TABLE_FIELD_DESCR_LBN);
field->width = MCDI_STRUCT_WORD(fdesc, TABLE_FIELD_DESCR_WIDTH);
field->masking = MCDI_STRUCT_BYTE(fdesc, TABLE_FIELD_DESCR_MASK_TYPE);
field->scheme = MCDI_STRUCT_BYTE(fdesc, TABLE_FIELD_DESCR_SCHEME);
}
return 0;
fail:
kfree(desc->keys);
kfree(desc->resps);
return rc;
}
static int efx_mae_table_hook_find(u16 n_fields,
struct efx_tc_table_field_fmt *fields,
u16 field_id)
{
unsigned int i;
for (i = 0; i < n_fields; i++) {
if (fields[i].field_id == field_id)
return i;
}
return -EPROTO;
}
#define TABLE_FIND_KEY(_desc, _id) \
efx_mae_table_hook_find((_desc)->n_keys, (_desc)->keys, _id)
#define TABLE_FIND_RESP(_desc, _id) \
efx_mae_table_hook_find((_desc)->n_resps, (_desc)->resps, _id)
#define TABLE_HOOK_KEY(_meta, _name, _mcdi_name) ({ \
int _rc = TABLE_FIND_KEY(&_meta->desc, TABLE_FIELD_ID_##_mcdi_name); \
\
if (_rc > U8_MAX) \
_rc = -EOPNOTSUPP; \
if (_rc >= 0) { \
_meta->keys._name##_idx = _rc; \
_rc = 0; \
} \
_rc; \
})
#define TABLE_HOOK_RESP(_meta, _name, _mcdi_name) ({ \
int _rc = TABLE_FIND_RESP(&_meta->desc, TABLE_FIELD_ID_##_mcdi_name); \
\
if (_rc > U8_MAX) \
_rc = -EOPNOTSUPP; \
if (_rc >= 0) { \
_meta->resps._name##_idx = _rc; \
_rc = 0; \
} \
_rc; \
})
static int efx_mae_table_hook_ct(struct efx_nic *efx,
struct efx_tc_table_ct *meta_ct)
{
int rc;
rc = TABLE_HOOK_KEY(meta_ct, eth_proto, ETHER_TYPE);
if (rc)
return rc;
rc = TABLE_HOOK_KEY(meta_ct, ip_proto, IP_PROTO);
if (rc)
return rc;
rc = TABLE_HOOK_KEY(meta_ct, src_ip, SRC_IP);
if (rc)
return rc;
rc = TABLE_HOOK_KEY(meta_ct, dst_ip, DST_IP);
if (rc)
return rc;
rc = TABLE_HOOK_KEY(meta_ct, l4_sport, SRC_PORT);
if (rc)
return rc;
rc = TABLE_HOOK_KEY(meta_ct, l4_dport, DST_PORT);
if (rc)
return rc;
rc = TABLE_HOOK_KEY(meta_ct, zone, DOMAIN);
Annotation
- Immediate include surface: `linux/rhashtable.h`, `ef100_nic.h`, `mae.h`, `mcdi.h`, `mcdi_pcol.h`, `mcdi_pcol_mae.h`, `tc_encap_actions.h`, `tc_conntrack.h`.
- Detected declarations: `enum mask_type`, `function efx_mae_allocate_mport`, `function efx_mae_free_mport`, `function efx_mae_mport_wire`, `function efx_mae_mport_uplink`, `function efx_mae_mport_mport`, `function efx_mae_fw_lookup_mport`, `function efx_mae_start_counters`, `function efx_mae_counters_flushed`, `function efx_mae_stop_counters`.
- 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.