drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_ethtool.c- Extension
.c- Size
- 14760 bytes
- Lines
- 516
- 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.
- 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
pch_gbe.hpch_gbe_phy.h
Detected Declarations
struct pch_gbe_statsfunction pch_gbe_get_link_ksettingsfunction pch_gbe_set_link_ksettingsfunction get_settingsfunction pch_gbe_get_regs_lenfunction pch_gbe_get_drvinfofunction pch_gbe_get_regsfunction pch_gbe_get_wolfunction pch_gbe_set_wolfunction pch_gbe_nway_resetfunction pch_gbe_get_ringparamfunction pch_gbe_set_ringparamfunction pch_gbe_get_pauseparamfunction pch_gbe_set_pauseparamfunction pch_gbe_get_stringsfunction pch_gbe_get_ethtool_statsfunction pch_gbe_get_sset_countfunction pch_gbe_set_ethtool_ops
Annotated Snippet
struct pch_gbe_stats {
char string[ETH_GSTRING_LEN];
size_t size;
size_t offset;
};
#define PCH_GBE_STAT(m) \
{ \
.string = #m, \
.size = sizeof_field(struct pch_gbe_hw_stats, m), \
.offset = offsetof(struct pch_gbe_hw_stats, m), \
}
/*
* pch_gbe_gstrings_stats - ethtool information status name list
*/
static const struct pch_gbe_stats pch_gbe_gstrings_stats[] = {
PCH_GBE_STAT(rx_packets),
PCH_GBE_STAT(tx_packets),
PCH_GBE_STAT(rx_bytes),
PCH_GBE_STAT(tx_bytes),
PCH_GBE_STAT(rx_errors),
PCH_GBE_STAT(tx_errors),
PCH_GBE_STAT(rx_dropped),
PCH_GBE_STAT(tx_dropped),
PCH_GBE_STAT(multicast),
PCH_GBE_STAT(collisions),
PCH_GBE_STAT(rx_crc_errors),
PCH_GBE_STAT(rx_frame_errors),
PCH_GBE_STAT(rx_alloc_buff_failed),
PCH_GBE_STAT(tx_length_errors),
PCH_GBE_STAT(tx_aborted_errors),
PCH_GBE_STAT(tx_carrier_errors),
PCH_GBE_STAT(tx_timeout_count),
PCH_GBE_STAT(tx_restart_count),
PCH_GBE_STAT(intr_rx_dsc_empty_count),
PCH_GBE_STAT(intr_rx_frame_err_count),
PCH_GBE_STAT(intr_rx_fifo_err_count),
PCH_GBE_STAT(intr_rx_dma_err_count),
PCH_GBE_STAT(intr_tx_fifo_err_count),
PCH_GBE_STAT(intr_tx_dma_err_count),
PCH_GBE_STAT(intr_tcpip_err_count)
};
#define PCH_GBE_QUEUE_STATS_LEN 0
#define PCH_GBE_GLOBAL_STATS_LEN ARRAY_SIZE(pch_gbe_gstrings_stats)
#define PCH_GBE_STATS_LEN (PCH_GBE_GLOBAL_STATS_LEN + PCH_GBE_QUEUE_STATS_LEN)
#define PCH_GBE_MAC_REGS_LEN (sizeof(struct pch_gbe_regs) / 4)
#define PCH_GBE_REGS_LEN (PCH_GBE_MAC_REGS_LEN + PCH_GBE_PHY_REGS_LEN)
/**
* pch_gbe_get_link_ksettings - Get device-specific settings
* @netdev: Network interface device structure
* @ecmd: Ethtool command
* Returns:
* 0: Successful.
* Negative value: Failed.
*/
static int pch_gbe_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *ecmd)
{
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
u32 supported, advertising;
mii_ethtool_get_link_ksettings(&adapter->mii, ecmd);
ethtool_convert_link_mode_to_legacy_u32(&supported,
ecmd->link_modes.supported);
ethtool_convert_link_mode_to_legacy_u32(&advertising,
ecmd->link_modes.advertising);
supported &= ~(SUPPORTED_TP | SUPPORTED_1000baseT_Half);
advertising &= ~(ADVERTISED_TP | ADVERTISED_1000baseT_Half);
ethtool_convert_legacy_u32_to_link_mode(ecmd->link_modes.supported,
supported);
ethtool_convert_legacy_u32_to_link_mode(ecmd->link_modes.advertising,
advertising);
if (!netif_carrier_ok(adapter->netdev))
ecmd->base.speed = SPEED_UNKNOWN;
return 0;
}
/**
* pch_gbe_set_link_ksettings - Set device-specific settings
* @netdev: Network interface device structure
* @ecmd: Ethtool command
* Returns:
Annotation
- Immediate include surface: `pch_gbe.h`, `pch_gbe_phy.h`.
- Detected declarations: `struct pch_gbe_stats`, `function pch_gbe_get_link_ksettings`, `function pch_gbe_set_link_ksettings`, `function get_settings`, `function pch_gbe_get_regs_len`, `function pch_gbe_get_drvinfo`, `function pch_gbe_get_regs`, `function pch_gbe_get_wol`, `function pch_gbe_set_wol`, `function pch_gbe_nway_reset`.
- 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.