drivers/net/ethernet/sfc/ef100_nic.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/ef100_nic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/ef100_nic.c- Extension
.c- Size
- 41428 bytes
- Lines
- 1387
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
ef100_nic.hefx_common.hefx_channels.hio.hselftest.hef100_regs.hmcdi.hmcdi_pcol.hmcdi_port_common.hmcdi_functions.hmcdi_filters.hef100_rx.hef100_tx.hef100_sriov.hef100_netdev.htc.hmae.hrx_common.h
Detected Declarations
struct ef100_tlv_stateenum ef100_tlv_state_machinefunction ef100_get_warm_boot_countfunction ef100_mcdi_requestfunction ef100_mcdi_poll_responsefunction ef100_mcdi_read_responsefunction ef100_mcdi_poll_rebootfunction ef100_mcdi_reboot_detectedfunction efx_ef100_init_datapath_capsfunction ef100_ev_probefunction ef100_ev_initfunction ef100_ev_read_ackfunction ef100_ev_processfunction ef100_msi_interruptfunction ef100_phy_probefunction ef100_filter_table_probefunction ef100_filter_table_upfunction ef100_filter_table_downfunction ef100_reconfigure_macfunction ef100_map_reset_reasonfunction ef100_map_reset_flagsfunction ef100_resetfunction ef100_common_stat_maskfunction ef100_ethtool_stat_maskfunction ef100_describe_statsfunction ef100_update_stats_commonfunction ef100_update_statsfunction efx_ef100_get_phys_port_idfunction efx_ef100_irq_test_generatefunction efx_ef100_ev_test_generatefunction ef100_check_capsfunction efx_ef100_recycle_ring_sizefunction efx_ef100_get_base_mportfunction compare_versionsfunction ef100_tlv_feedfunction ef100_process_design_paramfunction ef100_check_design_paramsfunction ef100_probe_mainfunction efx_ef100_lookup_client_idfunction ef100_probe_netdev_pffunction ef100_probe_vffunction ef100_remove
Annotated Snippet
struct ef100_tlv_state {
enum ef100_tlv_state_machine state;
u64 value;
u32 value_offset;
u16 type;
u8 len;
};
static int ef100_tlv_feed(struct ef100_tlv_state *state, u8 byte)
{
switch (state->state) {
case EF100_TLV_TYPE:
state->type = byte & 0x7f;
state->state = (byte & 0x80) ? EF100_TLV_TYPE_CONT
: EF100_TLV_LENGTH;
/* Clear ready to read in a new entry */
state->value = 0;
state->value_offset = 0;
return 0;
case EF100_TLV_TYPE_CONT:
state->type |= byte << 7;
state->state = EF100_TLV_LENGTH;
return 0;
case EF100_TLV_LENGTH:
state->len = byte;
/* We only handle TLVs that fit in a u64 */
if (state->len > sizeof(state->value))
return -EOPNOTSUPP;
/* len may be zero, implying a value of zero */
state->state = state->len ? EF100_TLV_VALUE : EF100_TLV_TYPE;
return 0;
case EF100_TLV_VALUE:
state->value |= ((u64)byte) << (state->value_offset * 8);
state->value_offset++;
if (state->value_offset >= state->len)
state->state = EF100_TLV_TYPE;
return 0;
default: /* state machine error, can't happen */
WARN_ON_ONCE(1);
return -EIO;
}
}
static int ef100_process_design_param(struct efx_nic *efx,
const struct ef100_tlv_state *reader)
{
struct ef100_nic_data *nic_data = efx->nic_data;
switch (reader->type) {
case ESE_EF100_DP_GZ_PAD: /* padding, skip it */
return 0;
case ESE_EF100_DP_GZ_PARTIAL_TSTAMP_SUB_NANO_BITS:
/* Driver doesn't support timestamping yet, so we don't care */
return 0;
case ESE_EF100_DP_GZ_EVQ_UNSOL_CREDIT_SEQ_BITS:
/* Driver doesn't support unsolicited-event credits yet, so
* we don't care
*/
return 0;
case ESE_EF100_DP_GZ_NMMU_GROUP_SIZE:
/* Driver doesn't manage the NMMU (so we don't care) */
return 0;
case ESE_EF100_DP_GZ_RX_L4_CSUM_PROTOCOLS:
/* Driver uses CHECKSUM_COMPLETE, so we don't care about
* protocol checksum validation
*/
return 0;
case ESE_EF100_DP_GZ_TSO_MAX_HDR_LEN:
nic_data->tso_max_hdr_len = min_t(u64, reader->value, 0xffff);
return 0;
case ESE_EF100_DP_GZ_TSO_MAX_HDR_NUM_SEGS:
/* We always put HDR_NUM_SEGS=1 in our TSO descriptors */
if (!reader->value) {
pci_err(efx->pci_dev, "TSO_MAX_HDR_NUM_SEGS < 1\n");
return -EOPNOTSUPP;
}
return 0;
case ESE_EF100_DP_GZ_RXQ_SIZE_GRANULARITY:
case ESE_EF100_DP_GZ_TXQ_SIZE_GRANULARITY:
/* Our TXQ and RXQ sizes are always power-of-two and thus divisible by
* EFX_MIN_DMAQ_SIZE, so we just need to check that
* EFX_MIN_DMAQ_SIZE is divisible by GRANULARITY.
* This is very unlikely to fail.
*/
if (!reader->value || reader->value > EFX_MIN_DMAQ_SIZE ||
EFX_MIN_DMAQ_SIZE % (u32)reader->value) {
pci_err(efx->pci_dev,
"%s size granularity is %llu, can't guarantee safety\n",
reader->type == ESE_EF100_DP_GZ_RXQ_SIZE_GRANULARITY ? "RXQ" : "TXQ",
reader->value);
Annotation
- Immediate include surface: `ef100_nic.h`, `efx_common.h`, `efx_channels.h`, `io.h`, `selftest.h`, `ef100_regs.h`, `mcdi.h`, `mcdi_pcol.h`.
- Detected declarations: `struct ef100_tlv_state`, `enum ef100_tlv_state_machine`, `function ef100_get_warm_boot_count`, `function ef100_mcdi_request`, `function ef100_mcdi_poll_response`, `function ef100_mcdi_read_response`, `function ef100_mcdi_poll_reboot`, `function ef100_mcdi_reboot_detected`, `function efx_ef100_init_datapath_caps`, `function ef100_ev_probe`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.