drivers/net/ethernet/intel/igbvf/ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/igbvf/ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/igbvf/ethtool.c- Extension
.c- Size
- 12801 bytes
- Lines
- 466
- 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.
- 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
linux/netdevice.hlinux/ethtool.hlinux/pci.hlinux/vmalloc.hlinux/delay.higbvf.hlinux/if_vlan.h
Detected Declarations
struct igbvf_statsfunction igbvf_get_link_ksettingsfunction igbvf_set_link_ksettingsfunction igbvf_get_pauseparamfunction igbvf_get_msglevelfunction igbvf_set_msglevelfunction igbvf_get_regs_lenfunction igbvf_get_regsfunction igbvf_get_eeprom_lenfunction igbvf_get_eepromfunction igbvf_set_eepromfunction igbvf_get_drvinfofunction igbvf_get_ringparamfunction igbvf_set_ringparamfunction igbvf_link_testfunction igbvf_diag_testfunction igbvf_get_wolfunction igbvf_set_wolfunction igbvf_get_coalescefunction igbvf_set_coalescefunction igbvf_nway_resetfunction igbvf_get_ethtool_statsfunction igbvf_get_sset_countfunction igbvf_get_stringsfunction igbvf_set_ethtool_ops
Annotated Snippet
struct igbvf_stats {
char stat_string[ETH_GSTRING_LEN];
int sizeof_stat;
int stat_offset;
int base_stat_offset;
};
#define IGBVF_STAT(current, base) \
sizeof(((struct igbvf_adapter *)0)->current), \
offsetof(struct igbvf_adapter, current), \
offsetof(struct igbvf_adapter, base)
static const struct igbvf_stats igbvf_gstrings_stats[] = {
{ "rx_packets", IGBVF_STAT(stats.gprc, stats.base_gprc) },
{ "tx_packets", IGBVF_STAT(stats.gptc, stats.base_gptc) },
{ "rx_bytes", IGBVF_STAT(stats.gorc, stats.base_gorc) },
{ "tx_bytes", IGBVF_STAT(stats.gotc, stats.base_gotc) },
{ "multicast", IGBVF_STAT(stats.mprc, stats.base_mprc) },
{ "lbrx_packets", IGBVF_STAT(stats.gprlbc, stats.base_gprlbc) },
{ "lbtx_packets", IGBVF_STAT(stats.gptlbc, stats.base_gptlbc) },
{ "lbrx_bytes", IGBVF_STAT(stats.gorlbc, stats.base_gorlbc) },
{ "lbtx_bytes", IGBVF_STAT(stats.gotlbc, stats.base_gotlbc) },
{ "tx_restart_queue", IGBVF_STAT(restart_queue, zero_base) },
{ "tx_timeout_count", IGBVF_STAT(tx_timeout_count, zero_base) },
{ "rx_csum_offload_good", IGBVF_STAT(hw_csum_good, zero_base) },
{ "rx_csum_offload_errors", IGBVF_STAT(hw_csum_err, zero_base) },
{ "rx_header_split", IGBVF_STAT(rx_hdr_split, zero_base) },
{ "alloc_rx_buff_failed", IGBVF_STAT(alloc_rx_buff_failed, zero_base) },
};
#define IGBVF_GLOBAL_STATS_LEN ARRAY_SIZE(igbvf_gstrings_stats)
static const char igbvf_gstrings_test[][ETH_GSTRING_LEN] = {
"Link test (on/offline)"
};
#define IGBVF_TEST_LEN ARRAY_SIZE(igbvf_gstrings_test)
static int igbvf_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *cmd)
{
struct igbvf_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
u32 status;
ethtool_link_ksettings_zero_link_mode(cmd, supported);
ethtool_link_ksettings_add_link_mode(cmd, supported, 1000baseT_Full);
ethtool_link_ksettings_zero_link_mode(cmd, advertising);
ethtool_link_ksettings_add_link_mode(cmd, advertising, 1000baseT_Full);
cmd->base.port = -1;
status = er32(STATUS);
if (status & E1000_STATUS_LU) {
if (status & E1000_STATUS_SPEED_1000)
cmd->base.speed = SPEED_1000;
else if (status & E1000_STATUS_SPEED_100)
cmd->base.speed = SPEED_100;
else
cmd->base.speed = SPEED_10;
if (status & E1000_STATUS_FD)
cmd->base.duplex = DUPLEX_FULL;
else
cmd->base.duplex = DUPLEX_HALF;
} else {
cmd->base.speed = SPEED_UNKNOWN;
cmd->base.duplex = DUPLEX_UNKNOWN;
}
cmd->base.autoneg = AUTONEG_DISABLE;
return 0;
}
static int igbvf_set_link_ksettings(struct net_device *netdev,
const struct ethtool_link_ksettings *cmd)
{
return -EOPNOTSUPP;
}
static void igbvf_get_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause)
{
}
static int igbvf_set_pauseparam(struct net_device *netdev,
struct ethtool_pauseparam *pause)
{
return -EOPNOTSUPP;
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/ethtool.h`, `linux/pci.h`, `linux/vmalloc.h`, `linux/delay.h`, `igbvf.h`, `linux/if_vlan.h`.
- Detected declarations: `struct igbvf_stats`, `function igbvf_get_link_ksettings`, `function igbvf_set_link_ksettings`, `function igbvf_get_pauseparam`, `function igbvf_get_msglevel`, `function igbvf_set_msglevel`, `function igbvf_get_regs_len`, `function igbvf_get_regs`, `function igbvf_get_eeprom_len`, `function igbvf_get_eeprom`.
- 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.
- 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.