drivers/net/ethernet/sfc/falcon/ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/falcon/ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/falcon/ethtool.c- Extension
.c- Size
- 40726 bytes
- Lines
- 1364
- 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
linux/netdevice.hlinux/ethtool.hlinux/rtnetlink.hlinux/in.hnet_driver.hworkarounds.hselftest.hefx.hfilter.hnic.h
Detected Declarations
struct ef4_sw_stat_descfunction offsetoffunction ef4_get_atomic_statfunction ef4_ethtool_phys_idfunction ef4_ethtool_get_link_ksettingsfunction ef4_ethtool_set_link_ksettingsfunction ef4_ethtool_get_drvinfofunction ef4_ethtool_get_regs_lenfunction ef4_ethtool_get_regsfunction ef4_ethtool_get_msglevelfunction ef4_ethtool_set_msglevelfunction ef4_fill_testfunction ef4_fill_loopback_testfunction ef4_for_each_channel_tx_queuefunction stringsfunction ef4_describe_per_queue_statsfunction ef4_for_each_channelfunction ef4_ethtool_get_sset_countfunction ef4_ethtool_get_stringsfunction ef4_ethtool_get_statsfunction ef4_for_each_channelfunction ef4_for_each_channelfunction ef4_for_each_channel_tx_queuefunction ef4_for_each_channel_rx_queuefunction ef4_ethtool_self_testfunction ef4_ethtool_nway_resetfunction completionfunction ef4_ethtool_set_coalescefunction ef4_ethtool_get_ringparamfunction ef4_ethtool_set_ringparamfunction ef4_ethtool_set_pauseparamfunction ef4_ethtool_get_pauseparamfunction ef4_ethtool_get_wolfunction ef4_ethtool_set_wolfunction ef4_ethtool_resetfunction ip6_fill_maskfunction ef4_ethtool_get_class_rulefunction ef4_ethtool_get_rxfh_fieldsfunction ef4_ethtool_get_rx_ring_countfunction ef4_ethtool_get_rxnfcfunction ip6_mask_is_fullfunction ip6_mask_is_emptyfunction ef4_ethtool_set_class_rulefunction ef4_ethtool_set_rxnfcfunction ef4_ethtool_get_rxfh_indir_sizefunction ef4_ethtool_get_rxfhfunction ef4_ethtool_set_rxfhfunction ef4_ethtool_get_module_eeprom
Annotated Snippet
struct ef4_sw_stat_desc {
const char *name;
enum {
EF4_ETHTOOL_STAT_SOURCE_nic,
EF4_ETHTOOL_STAT_SOURCE_channel,
EF4_ETHTOOL_STAT_SOURCE_tx_queue
} source;
unsigned offset;
u64(*get_stat) (void *field); /* Reader function */
};
/* Initialiser for a struct ef4_sw_stat_desc with type-checking */
#define EF4_ETHTOOL_STAT(stat_name, source_name, field, field_type, \
get_stat_function) { \
.name = #stat_name, \
.source = EF4_ETHTOOL_STAT_SOURCE_##source_name, \
.offset = ((((field_type *) 0) == \
&((struct ef4_##source_name *)0)->field) ? \
offsetof(struct ef4_##source_name, field) : \
offsetof(struct ef4_##source_name, field)), \
.get_stat = get_stat_function, \
}
static u64 ef4_get_uint_stat(void *field)
{
return *(unsigned int *)field;
}
static u64 ef4_get_atomic_stat(void *field)
{
return atomic_read((atomic_t *) field);
}
#define EF4_ETHTOOL_ATOMIC_NIC_ERROR_STAT(field) \
EF4_ETHTOOL_STAT(field, nic, field, \
atomic_t, ef4_get_atomic_stat)
#define EF4_ETHTOOL_UINT_CHANNEL_STAT(field) \
EF4_ETHTOOL_STAT(field, channel, n_##field, \
unsigned int, ef4_get_uint_stat)
#define EF4_ETHTOOL_UINT_TXQ_STAT(field) \
EF4_ETHTOOL_STAT(tx_##field, tx_queue, field, \
unsigned int, ef4_get_uint_stat)
static const struct ef4_sw_stat_desc ef4_sw_stat_desc[] = {
EF4_ETHTOOL_UINT_TXQ_STAT(merge_events),
EF4_ETHTOOL_UINT_TXQ_STAT(pushes),
EF4_ETHTOOL_UINT_TXQ_STAT(cb_packets),
EF4_ETHTOOL_ATOMIC_NIC_ERROR_STAT(rx_reset),
EF4_ETHTOOL_UINT_CHANNEL_STAT(rx_tobe_disc),
EF4_ETHTOOL_UINT_CHANNEL_STAT(rx_ip_hdr_chksum_err),
EF4_ETHTOOL_UINT_CHANNEL_STAT(rx_tcp_udp_chksum_err),
EF4_ETHTOOL_UINT_CHANNEL_STAT(rx_mcast_mismatch),
EF4_ETHTOOL_UINT_CHANNEL_STAT(rx_frm_trunc),
EF4_ETHTOOL_UINT_CHANNEL_STAT(rx_merge_events),
EF4_ETHTOOL_UINT_CHANNEL_STAT(rx_merge_packets),
};
#define EF4_ETHTOOL_SW_STAT_COUNT ARRAY_SIZE(ef4_sw_stat_desc)
#define EF4_ETHTOOL_EEPROM_MAGIC 0xEFAB
/**************************************************************************
*
* Ethtool operations
*
**************************************************************************
*/
/* Identify device by flashing LEDs */
static int ef4_ethtool_phys_id(struct net_device *net_dev,
enum ethtool_phys_id_state state)
{
struct ef4_nic *efx = netdev_priv(net_dev);
enum ef4_led_mode mode = EF4_LED_DEFAULT;
switch (state) {
case ETHTOOL_ID_ON:
mode = EF4_LED_ON;
break;
case ETHTOOL_ID_OFF:
mode = EF4_LED_OFF;
break;
case ETHTOOL_ID_INACTIVE:
mode = EF4_LED_DEFAULT;
break;
case ETHTOOL_ID_ACTIVE:
return 1; /* cycle on/off once per second */
}
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/ethtool.h`, `linux/rtnetlink.h`, `linux/in.h`, `net_driver.h`, `workarounds.h`, `selftest.h`, `efx.h`.
- Detected declarations: `struct ef4_sw_stat_desc`, `function offsetof`, `function ef4_get_atomic_stat`, `function ef4_ethtool_phys_id`, `function ef4_ethtool_get_link_ksettings`, `function ef4_ethtool_set_link_ksettings`, `function ef4_ethtool_get_drvinfo`, `function ef4_ethtool_get_regs_len`, `function ef4_ethtool_get_regs`, `function ef4_ethtool_get_msglevel`.
- 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.