drivers/net/ethernet/engleder/tsnep_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/engleder/tsnep_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/engleder/tsnep_ethtool.c- Extension
.c- Size
- 13601 bytes
- Lines
- 486
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
tsnep.h
Detected Declarations
struct tsnep_statsstruct tsnep_rx_queue_statsstruct tsnep_tx_queue_statsfunction tsnep_ethtool_get_regs_lenfunction tsnep_ethtool_get_regsfunction tsnep_ethtool_get_msglevelfunction tsnep_ethtool_set_msglevelfunction tsnep_ethtool_get_stringsfunction tsnep_ethtool_get_ethtool_statsfunction tsnep_ethtool_get_sset_countfunction tsnep_ethtool_get_rx_ring_countfunction tsnep_ethtool_get_rxnfcfunction tsnep_ethtool_set_rxnfcfunction tsnep_ethtool_get_channelsfunction tsnep_ethtool_get_ts_infofunction tsnep_ethtool_get_coalescefunction tsnep_ethtool_set_coalescefunction tsnep_ethtool_get_per_queue_coalescefunction tsnep_ethtool_set_per_queue_coalesce
Annotated Snippet
struct tsnep_stats {
u64 rx_packets;
u64 rx_bytes;
u64 rx_dropped;
u64 rx_multicast;
u64 rx_alloc_failed;
u64 rx_phy_errors;
u64 rx_forwarded_phy_errors;
u64 rx_invalid_frame_errors;
u64 tx_packets;
u64 tx_bytes;
u64 tx_dropped;
};
#define TSNEP_STATS_COUNT (sizeof(struct tsnep_stats) / sizeof(u64))
static const char tsnep_rx_queue_stats_strings[][ETH_GSTRING_LEN] = {
"rx_%d_packets",
"rx_%d_bytes",
"rx_%d_dropped",
"rx_%d_multicast",
"rx_%d_alloc_failed",
"rx_%d_no_descriptor_errors",
"rx_%d_buffer_too_small_errors",
"rx_%d_fifo_overflow_errors",
"rx_%d_invalid_frame_errors",
};
struct tsnep_rx_queue_stats {
u64 rx_packets;
u64 rx_bytes;
u64 rx_dropped;
u64 rx_multicast;
u64 rx_alloc_failed;
u64 rx_no_descriptor_errors;
u64 rx_buffer_too_small_errors;
u64 rx_fifo_overflow_errors;
u64 rx_invalid_frame_errors;
};
#define TSNEP_RX_QUEUE_STATS_COUNT (sizeof(struct tsnep_rx_queue_stats) / \
sizeof(u64))
static const char tsnep_tx_queue_stats_strings[][ETH_GSTRING_LEN] = {
"tx_%d_packets",
"tx_%d_bytes",
"tx_%d_dropped",
};
struct tsnep_tx_queue_stats {
u64 tx_packets;
u64 tx_bytes;
u64 tx_dropped;
};
#define TSNEP_TX_QUEUE_STATS_COUNT (sizeof(struct tsnep_tx_queue_stats) / \
sizeof(u64))
static void tsnep_ethtool_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo)
{
struct tsnep_adapter *adapter = netdev_priv(netdev);
strscpy(drvinfo->driver, TSNEP, sizeof(drvinfo->driver));
strscpy(drvinfo->bus_info, dev_name(&adapter->pdev->dev),
sizeof(drvinfo->bus_info));
}
static int tsnep_ethtool_get_regs_len(struct net_device *netdev)
{
struct tsnep_adapter *adapter = netdev_priv(netdev);
int len;
int num_additional_queues;
len = TSNEP_MAC_SIZE;
/* first queue pair is within TSNEP_MAC_SIZE, only queues additional to
* the first queue pair extend the register length by TSNEP_QUEUE_SIZE
*/
num_additional_queues =
max(adapter->num_tx_queues, adapter->num_rx_queues) - 1;
len += TSNEP_QUEUE_SIZE * num_additional_queues;
return len;
}
static void tsnep_ethtool_get_regs(struct net_device *netdev,
struct ethtool_regs *regs,
void *p)
{
Annotation
- Immediate include surface: `tsnep.h`.
- Detected declarations: `struct tsnep_stats`, `struct tsnep_rx_queue_stats`, `struct tsnep_tx_queue_stats`, `function tsnep_ethtool_get_regs_len`, `function tsnep_ethtool_get_regs`, `function tsnep_ethtool_get_msglevel`, `function tsnep_ethtool_set_msglevel`, `function tsnep_ethtool_get_strings`, `function tsnep_ethtool_get_ethtool_stats`, `function tsnep_ethtool_get_sset_count`.
- 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.