drivers/net/ethernet/synopsys/dwc-xlgmac-ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/synopsys/dwc-xlgmac-ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/synopsys/dwc-xlgmac-ethtool.c- Extension
.c- Size
- 8901 bytes
- Lines
- 269
- 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
linux/ethtool.hlinux/kernel.hlinux/netdevice.hdwc-xlgmac.hdwc-xlgmac-reg.h
Detected Declarations
struct xlgmac_stats_descfunction xlgmac_ethtool_get_drvinfofunction xlgmac_ethtool_get_msglevelfunction xlgmac_ethtool_set_msglevelfunction xlgmac_ethtool_get_channelsfunction xlgmac_ethtool_get_coalescefunction xlgmac_ethtool_set_coalescefunction xlgmac_ethtool_get_stringsfunction xlgmac_ethtool_get_sset_countfunction xlgmac_ethtool_get_ethtool_stats
Annotated Snippet
struct xlgmac_stats_desc {
char stat_string[ETH_GSTRING_LEN];
int stat_offset;
};
#define XLGMAC_STAT(str, var) \
{ \
str, \
offsetof(struct xlgmac_pdata, stats.var), \
}
static const struct xlgmac_stats_desc xlgmac_gstring_stats[] = {
/* MMC TX counters */
XLGMAC_STAT("tx_bytes", txoctetcount_gb),
XLGMAC_STAT("tx_bytes_good", txoctetcount_g),
XLGMAC_STAT("tx_packets", txframecount_gb),
XLGMAC_STAT("tx_packets_good", txframecount_g),
XLGMAC_STAT("tx_unicast_packets", txunicastframes_gb),
XLGMAC_STAT("tx_broadcast_packets", txbroadcastframes_gb),
XLGMAC_STAT("tx_broadcast_packets_good", txbroadcastframes_g),
XLGMAC_STAT("tx_multicast_packets", txmulticastframes_gb),
XLGMAC_STAT("tx_multicast_packets_good", txmulticastframes_g),
XLGMAC_STAT("tx_vlan_packets_good", txvlanframes_g),
XLGMAC_STAT("tx_64_byte_packets", tx64octets_gb),
XLGMAC_STAT("tx_65_to_127_byte_packets", tx65to127octets_gb),
XLGMAC_STAT("tx_128_to_255_byte_packets", tx128to255octets_gb),
XLGMAC_STAT("tx_256_to_511_byte_packets", tx256to511octets_gb),
XLGMAC_STAT("tx_512_to_1023_byte_packets", tx512to1023octets_gb),
XLGMAC_STAT("tx_1024_to_max_byte_packets", tx1024tomaxoctets_gb),
XLGMAC_STAT("tx_underflow_errors", txunderflowerror),
XLGMAC_STAT("tx_pause_frames", txpauseframes),
/* MMC RX counters */
XLGMAC_STAT("rx_bytes", rxoctetcount_gb),
XLGMAC_STAT("rx_bytes_good", rxoctetcount_g),
XLGMAC_STAT("rx_packets", rxframecount_gb),
XLGMAC_STAT("rx_unicast_packets_good", rxunicastframes_g),
XLGMAC_STAT("rx_broadcast_packets_good", rxbroadcastframes_g),
XLGMAC_STAT("rx_multicast_packets_good", rxmulticastframes_g),
XLGMAC_STAT("rx_vlan_packets", rxvlanframes_gb),
XLGMAC_STAT("rx_64_byte_packets", rx64octets_gb),
XLGMAC_STAT("rx_65_to_127_byte_packets", rx65to127octets_gb),
XLGMAC_STAT("rx_128_to_255_byte_packets", rx128to255octets_gb),
XLGMAC_STAT("rx_256_to_511_byte_packets", rx256to511octets_gb),
XLGMAC_STAT("rx_512_to_1023_byte_packets", rx512to1023octets_gb),
XLGMAC_STAT("rx_1024_to_max_byte_packets", rx1024tomaxoctets_gb),
XLGMAC_STAT("rx_undersize_packets_good", rxundersize_g),
XLGMAC_STAT("rx_oversize_packets_good", rxoversize_g),
XLGMAC_STAT("rx_crc_errors", rxcrcerror),
XLGMAC_STAT("rx_crc_errors_small_packets", rxrunterror),
XLGMAC_STAT("rx_crc_errors_giant_packets", rxjabbererror),
XLGMAC_STAT("rx_length_errors", rxlengtherror),
XLGMAC_STAT("rx_out_of_range_errors", rxoutofrangetype),
XLGMAC_STAT("rx_fifo_overflow_errors", rxfifooverflow),
XLGMAC_STAT("rx_watchdog_errors", rxwatchdogerror),
XLGMAC_STAT("rx_pause_frames", rxpauseframes),
/* Extra counters */
XLGMAC_STAT("tx_tso_packets", tx_tso_packets),
XLGMAC_STAT("rx_split_header_packets", rx_split_header_packets),
XLGMAC_STAT("tx_process_stopped", tx_process_stopped),
XLGMAC_STAT("rx_process_stopped", rx_process_stopped),
XLGMAC_STAT("tx_buffer_unavailable", tx_buffer_unavailable),
XLGMAC_STAT("rx_buffer_unavailable", rx_buffer_unavailable),
XLGMAC_STAT("fatal_bus_error", fatal_bus_error),
XLGMAC_STAT("tx_vlan_packets", tx_vlan_packets),
XLGMAC_STAT("rx_vlan_packets", rx_vlan_packets),
XLGMAC_STAT("napi_poll_isr", napi_poll_isr),
XLGMAC_STAT("napi_poll_txtimer", napi_poll_txtimer),
};
#define XLGMAC_STATS_COUNT ARRAY_SIZE(xlgmac_gstring_stats)
static void xlgmac_ethtool_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *drvinfo)
{
struct xlgmac_pdata *pdata = netdev_priv(netdev);
u32 ver = pdata->hw_feat.version;
u32 snpsver, devid, userver;
strscpy(drvinfo->driver, pdata->drv_name, sizeof(drvinfo->driver));
strscpy(drvinfo->version, pdata->drv_ver, sizeof(drvinfo->version));
strscpy(drvinfo->bus_info, dev_name(pdata->dev),
sizeof(drvinfo->bus_info));
/* S|SNPSVER: Synopsys-defined Version
* D|DEVID: Indicates the Device family
* U|USERVER: User-defined Version
*/
snpsver = XLGMAC_GET_REG_BITS(ver, MAC_VR_SNPSVER_POS,
MAC_VR_SNPSVER_LEN);
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/kernel.h`, `linux/netdevice.h`, `dwc-xlgmac.h`, `dwc-xlgmac-reg.h`.
- Detected declarations: `struct xlgmac_stats_desc`, `function xlgmac_ethtool_get_drvinfo`, `function xlgmac_ethtool_get_msglevel`, `function xlgmac_ethtool_set_msglevel`, `function xlgmac_ethtool_get_channels`, `function xlgmac_ethtool_get_coalesce`, `function xlgmac_ethtool_set_coalesce`, `function xlgmac_ethtool_get_strings`, `function xlgmac_ethtool_get_sset_count`, `function xlgmac_ethtool_get_ethtool_stats`.
- 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.