drivers/net/ethernet/intel/ixgbevf/ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ixgbevf/ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ixgbevf/ethtool.c- Extension
.c- Size
- 27122 bytes
- Lines
- 995
- 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/types.hlinux/module.hlinux/slab.hlinux/pci.hlinux/netdevice.hlinux/ethtool.hlinux/vmalloc.hlinux/if_vlan.hlinux/uaccess.hixgbevf.h
Detected Declarations
struct ixgbe_statsstruct ixgbevf_reg_testfunction ixgbevf_get_link_ksettingsfunction ixgbevf_get_msglevelfunction ixgbevf_set_msglevelfunction ixgbevf_get_regs_lenfunction ixgbevf_get_regsfunction ixgbevf_get_drvinfofunction ixgbevf_get_ringparamfunction ixgbevf_set_ringparamfunction ixgbevf_get_sset_countfunction ixgbevf_get_ethtool_statsfunction ixgbevf_get_stringsfunction ixgbevf_link_testfunction reg_pattern_testfunction reg_set_and_checkfunction ixgbevf_reg_testfunction ixgbevf_diag_testfunction ixgbevf_nway_resetfunction ixgbevf_get_coalescefunction ixgbevf_set_coalescefunction ixgbevf_get_rx_ring_countfunction ixgbevf_get_rxfh_indir_sizefunction ixgbevf_get_rxfh_key_sizefunction ixgbevf_get_rxfhfunction ixgbevf_get_priv_flagsfunction ixgbevf_set_priv_flagsfunction ixgbevf_set_ethtool_ops
Annotated Snippet
struct ixgbe_stats {
char stat_string[ETH_GSTRING_LEN];
int type;
int sizeof_stat;
int stat_offset;
};
#define IXGBEVF_STAT(_name, _stat) { \
.stat_string = _name, \
.type = IXGBEVF_STATS, \
.sizeof_stat = sizeof_field(struct ixgbevf_adapter, _stat), \
.stat_offset = offsetof(struct ixgbevf_adapter, _stat) \
}
#define IXGBEVF_NETDEV_STAT(_net_stat) { \
.stat_string = #_net_stat, \
.type = NETDEV_STATS, \
.sizeof_stat = sizeof_field(struct net_device_stats, _net_stat), \
.stat_offset = offsetof(struct net_device_stats, _net_stat) \
}
static struct ixgbe_stats ixgbevf_gstrings_stats[] = {
IXGBEVF_NETDEV_STAT(rx_packets),
IXGBEVF_NETDEV_STAT(tx_packets),
IXGBEVF_NETDEV_STAT(rx_bytes),
IXGBEVF_NETDEV_STAT(tx_bytes),
IXGBEVF_STAT("tx_busy", tx_busy),
IXGBEVF_STAT("tx_restart_queue", restart_queue),
IXGBEVF_STAT("tx_timeout_count", tx_timeout_count),
IXGBEVF_NETDEV_STAT(multicast),
IXGBEVF_STAT("rx_csum_offload_errors", hw_csum_rx_error),
IXGBEVF_STAT("alloc_rx_page", alloc_rx_page),
IXGBEVF_STAT("alloc_rx_page_failed", alloc_rx_page_failed),
IXGBEVF_STAT("alloc_rx_buff_failed", alloc_rx_buff_failed),
IXGBEVF_STAT("tx_ipsec", tx_ipsec),
IXGBEVF_STAT("rx_ipsec", rx_ipsec),
};
#define IXGBEVF_QUEUE_STATS_LEN ( \
(((struct ixgbevf_adapter *)netdev_priv(netdev))->num_tx_queues + \
((struct ixgbevf_adapter *)netdev_priv(netdev))->num_xdp_queues + \
((struct ixgbevf_adapter *)netdev_priv(netdev))->num_rx_queues) * \
(sizeof(struct ixgbevf_stats) / sizeof(u64)))
#define IXGBEVF_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbevf_gstrings_stats)
#define IXGBEVF_STATS_LEN (IXGBEVF_GLOBAL_STATS_LEN + IXGBEVF_QUEUE_STATS_LEN)
static const char ixgbe_gstrings_test[][ETH_GSTRING_LEN] = {
"Register test (offline)",
"Link test (on/offline)"
};
#define IXGBEVF_TEST_LEN (sizeof(ixgbe_gstrings_test) / ETH_GSTRING_LEN)
static const char ixgbevf_priv_flags_strings[][ETH_GSTRING_LEN] = {
#define IXGBEVF_PRIV_FLAGS_LEGACY_RX BIT(0)
"legacy-rx",
};
#define IXGBEVF_PRIV_FLAGS_STR_LEN ARRAY_SIZE(ixgbevf_priv_flags_strings)
static int ixgbevf_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *cmd)
{
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
ethtool_link_ksettings_zero_link_mode(cmd, supported);
ethtool_link_ksettings_add_link_mode(cmd, supported, 10000baseT_Full);
cmd->base.autoneg = AUTONEG_DISABLE;
cmd->base.port = -1;
if (adapter->link_up) {
__u32 speed = SPEED_10000;
switch (adapter->link_speed) {
case IXGBE_LINK_SPEED_10GB_FULL:
speed = SPEED_10000;
break;
case IXGBE_LINK_SPEED_1GB_FULL:
speed = SPEED_1000;
break;
case IXGBE_LINK_SPEED_100_FULL:
speed = SPEED_100;
break;
}
cmd->base.speed = speed;
cmd->base.duplex = DUPLEX_FULL;
} else {
cmd->base.speed = SPEED_UNKNOWN;
cmd->base.duplex = DUPLEX_UNKNOWN;
Annotation
- Immediate include surface: `linux/types.h`, `linux/module.h`, `linux/slab.h`, `linux/pci.h`, `linux/netdevice.h`, `linux/ethtool.h`, `linux/vmalloc.h`, `linux/if_vlan.h`.
- Detected declarations: `struct ixgbe_stats`, `struct ixgbevf_reg_test`, `function ixgbevf_get_link_ksettings`, `function ixgbevf_get_msglevel`, `function ixgbevf_set_msglevel`, `function ixgbevf_get_regs_len`, `function ixgbevf_get_regs`, `function ixgbevf_get_drvinfo`, `function ixgbevf_get_ringparam`, `function ixgbevf_set_ringparam`.
- 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.