drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/wangxun/libwx/wx_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/wangxun/libwx/wx_ethtool.c- Extension
.c- Size
- 20951 bytes
- Lines
- 796
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/phy.hlinux/ethtool.hwx_type.hwx_ethtool.hwx_hw.hwx_lib.h
Detected Declarations
struct wx_statsfunction wx_get_sset_countfunction wx_get_stringsfunction wx_get_ethtool_statsfunction wx_get_mac_statsfunction wx_get_pause_statsfunction wx_get_drvinfofunction wx_nway_resetfunction wx_get_link_ksettingsfunction wx_set_link_ksettingsfunction wx_get_wolfunction wx_set_wolfunction wx_get_pauseparamfunction wx_set_pauseparamfunction wx_get_ringparamfunction wx_get_coalescefunction wx_update_rscfunction wx_set_coalescefunction wx_max_channelsfunction wx_get_channelsfunction wx_set_channelsfunction wx_rss_indir_sizefunction wx_get_rxfh_key_sizefunction wx_get_retafunction wx_get_rxfhfunction wx_set_rxfhfunction wx_get_rxfh_fieldsfunction wx_set_rxfh_fieldsfunction wx_get_msglevelfunction wx_set_msglevelfunction wx_get_ts_infofunction wx_get_ptp_statsfunction wx_get_link_ksettings_vffunction wx_set_ethtool_ops_vfexport wx_get_sset_countexport wx_get_stringsexport wx_get_ethtool_statsexport wx_get_mac_statsexport wx_get_pause_statsexport wx_get_drvinfoexport wx_nway_resetexport wx_get_link_ksettingsexport wx_set_link_ksettingsexport wx_get_wolexport wx_set_wolexport wx_get_pauseparamexport wx_set_pauseparamexport wx_get_ringparam
Annotated Snippet
struct wx_stats {
char stat_string[ETH_GSTRING_LEN];
size_t sizeof_stat;
off_t stat_offset;
};
#define WX_STAT(str, m) { \
.stat_string = str, \
.sizeof_stat = sizeof(((struct wx *)0)->m), \
.stat_offset = offsetof(struct wx, m) }
static const struct wx_stats wx_gstrings_stats[] = {
WX_STAT("rx_dma_pkts", stats.gprc),
WX_STAT("tx_dma_pkts", stats.gptc),
WX_STAT("rx_dma_bytes", stats.gorc),
WX_STAT("tx_dma_bytes", stats.gotc),
WX_STAT("rx_total_pkts", stats.tpr),
WX_STAT("tx_total_pkts", stats.tpt),
WX_STAT("rx_long_length_count", stats.roc),
WX_STAT("rx_short_length_count", stats.ruc),
WX_STAT("os2bmc_rx_by_bmc", stats.o2bgptc),
WX_STAT("os2bmc_tx_by_bmc", stats.b2ospc),
WX_STAT("os2bmc_tx_by_host", stats.o2bspc),
WX_STAT("os2bmc_rx_by_host", stats.b2ogprc),
WX_STAT("rx_no_dma_resources", stats.rdmdrop),
WX_STAT("tx_busy", tx_busy),
WX_STAT("non_eop_descs", non_eop_descs),
WX_STAT("tx_restart_queue", restart_queue),
WX_STAT("rx_csum_offload_good_count", hw_csum_rx_good),
WX_STAT("rx_csum_offload_errors", hw_csum_rx_error),
WX_STAT("alloc_rx_buff_failed", alloc_rx_buff_failed),
WX_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts),
WX_STAT("tx_hwtstamp_skipped", tx_hwtstamp_skipped),
WX_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared),
};
static const struct wx_stats wx_gstrings_fdir_stats[] = {
WX_STAT("fdir_match", stats.fdirmatch),
WX_STAT("fdir_miss", stats.fdirmiss),
};
static const struct wx_stats wx_gstrings_rsc_stats[] = {
WX_STAT("rsc_aggregated", rsc_count),
WX_STAT("rsc_flushed", rsc_flush),
};
/* drivers allocates num_tx_queues and num_rx_queues symmetrically so
* we set the num_rx_queues to evaluate to num_tx_queues. This is
* used because we do not have a good way to get the max number of
* rx queues with CONFIG_RPS disabled.
*/
#define WX_NUM_RX_QUEUES netdev->num_tx_queues
#define WX_NUM_TX_QUEUES netdev->num_tx_queues
#define WX_QUEUE_STATS_LEN ( \
(WX_NUM_TX_QUEUES + WX_NUM_RX_QUEUES) * \
(sizeof(struct wx_queue_stats) / sizeof(u64)))
#define WX_GLOBAL_STATS_LEN ARRAY_SIZE(wx_gstrings_stats)
#define WX_FDIR_STATS_LEN ARRAY_SIZE(wx_gstrings_fdir_stats)
#define WX_RSC_STATS_LEN ARRAY_SIZE(wx_gstrings_rsc_stats)
#define WX_STATS_LEN (WX_GLOBAL_STATS_LEN + WX_QUEUE_STATS_LEN)
int wx_get_sset_count(struct net_device *netdev, int sset)
{
struct wx *wx = netdev_priv(netdev);
int len = WX_STATS_LEN;
switch (sset) {
case ETH_SS_STATS:
if (test_bit(WX_FLAG_FDIR_CAPABLE, wx->flags))
len += WX_FDIR_STATS_LEN;
if (test_bit(WX_FLAG_RSC_CAPABLE, wx->flags))
len += WX_RSC_STATS_LEN;
return len;
default:
return -EOPNOTSUPP;
}
}
EXPORT_SYMBOL(wx_get_sset_count);
void wx_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
{
struct wx *wx = netdev_priv(netdev);
u8 *p = data;
int i;
switch (stringset) {
case ETH_SS_STATS:
for (i = 0; i < WX_GLOBAL_STATS_LEN; i++)
ethtool_puts(&p, wx_gstrings_stats[i].stat_string);
Annotation
- Immediate include surface: `linux/pci.h`, `linux/phy.h`, `linux/ethtool.h`, `wx_type.h`, `wx_ethtool.h`, `wx_hw.h`, `wx_lib.h`.
- Detected declarations: `struct wx_stats`, `function wx_get_sset_count`, `function wx_get_strings`, `function wx_get_ethtool_stats`, `function wx_get_mac_stats`, `function wx_get_pause_stats`, `function wx_get_drvinfo`, `function wx_nway_reset`, `function wx_get_link_ksettings`, `function wx_set_link_ksettings`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.