drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c- Extension
.c- Size
- 51395 bytes
- Lines
- 1288
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ethtool.hsparx5_main_regs.hsparx5_main.hsparx5_port.h
Detected Declarations
enum sparx5_stats_entryfunction Copyrightfunction sparx5_get_queue_sys_statsfunction sparx5_get_ana_ac_stats_statsfunction sparx5_get_dev_phy_statsfunction sparx5_get_dev_mac_statsfunction sparx5_get_dev_mac_ctrl_statsfunction sparx5_get_dev_rmon_statsfunction sparx5_get_dev_misc_statsfunction sparx5_get_device_statsfunction sparx5_get_asm_phy_statsfunction sparx5_get_asm_mac_statsfunction sparx5_get_asm_mac_ctrl_statsfunction sparx5_get_asm_rmon_statsfunction sparx5_get_asm_misc_statsfunction sparx5_get_asm_statsfunction sparx5_get_eth_phy_statsfunction sparx5_get_eth_mac_statsfunction sparx5_get_eth_mac_ctrl_statsfunction sparx5_get_eth_rmon_statsfunction sparx5_get_sset_countfunction sparx5_get_sset_stringsfunction sparx5_get_sset_datafunction sparx5_get_stats64function sparx5_update_port_statsfunction sparx5_update_statsfunction sparx5_check_stats_workfunction sparx5_get_link_settingsfunction sparx5_set_link_settingsfunction sparx5_config_statsfunction sparx5_config_port_statsfunction sparx5_get_ts_infofunction sparx5_get_pauseparamfunction sparx5_set_pauseparamfunction sparx5_stats_initfunction sparx5_stats_deinit
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/* Microchip Sparx5 Switch driver
*
* Copyright (c) 2021 Microchip Technology Inc. and its subsidiaries.
*/
#include <linux/ethtool.h>
#include "sparx5_main_regs.h"
#include "sparx5_main.h"
#include "sparx5_port.h"
/* Index of ANA_AC port counters */
#define SPX5_PORT_POLICER_DROPS 0
/* Add a potentially wrapping 32 bit value to a 64 bit counter */
static void sparx5_update_counter(u64 *cnt, u32 val)
{
if (val < (*cnt & U32_MAX))
*cnt += (u64)1 << 32; /* value has wrapped */
*cnt = (*cnt & ~(u64)U32_MAX) + val;
}
enum sparx5_stats_entry {
spx5_stats_rx_symbol_err_cnt = 0,
spx5_stats_pmac_rx_symbol_err_cnt = 1,
spx5_stats_tx_uc_cnt = 2,
spx5_stats_pmac_tx_uc_cnt = 3,
spx5_stats_tx_mc_cnt = 4,
spx5_stats_tx_bc_cnt = 5,
spx5_stats_tx_backoff1_cnt = 6,
spx5_stats_tx_multi_coll_cnt = 7,
spx5_stats_rx_uc_cnt = 8,
spx5_stats_pmac_rx_uc_cnt = 9,
spx5_stats_rx_mc_cnt = 10,
spx5_stats_rx_bc_cnt = 11,
spx5_stats_rx_crc_err_cnt = 12,
spx5_stats_pmac_rx_crc_err_cnt = 13,
spx5_stats_rx_alignment_lost_cnt = 14,
spx5_stats_pmac_rx_alignment_lost_cnt = 15,
spx5_stats_tx_ok_bytes_cnt = 16,
spx5_stats_pmac_tx_ok_bytes_cnt = 17,
spx5_stats_tx_defer_cnt = 18,
spx5_stats_tx_late_coll_cnt = 19,
spx5_stats_tx_xcoll_cnt = 20,
spx5_stats_tx_csense_cnt = 21,
spx5_stats_rx_ok_bytes_cnt = 22,
spx5_stats_pmac_rx_ok_bytes_cnt = 23,
spx5_stats_pmac_tx_mc_cnt = 24,
spx5_stats_pmac_tx_bc_cnt = 25,
spx5_stats_tx_xdefer_cnt = 26,
spx5_stats_pmac_rx_mc_cnt = 27,
spx5_stats_pmac_rx_bc_cnt = 28,
spx5_stats_rx_in_range_len_err_cnt = 29,
spx5_stats_pmac_rx_in_range_len_err_cnt = 30,
spx5_stats_rx_out_of_range_len_err_cnt = 31,
spx5_stats_pmac_rx_out_of_range_len_err_cnt = 32,
spx5_stats_rx_oversize_cnt = 33,
spx5_stats_pmac_rx_oversize_cnt = 34,
spx5_stats_tx_pause_cnt = 35,
spx5_stats_pmac_tx_pause_cnt = 36,
spx5_stats_rx_pause_cnt = 37,
spx5_stats_pmac_rx_pause_cnt = 38,
spx5_stats_rx_unsup_opcode_cnt = 39,
spx5_stats_pmac_rx_unsup_opcode_cnt = 40,
spx5_stats_rx_undersize_cnt = 41,
spx5_stats_pmac_rx_undersize_cnt = 42,
spx5_stats_rx_fragments_cnt = 43,
spx5_stats_pmac_rx_fragments_cnt = 44,
spx5_stats_rx_jabbers_cnt = 45,
spx5_stats_pmac_rx_jabbers_cnt = 46,
spx5_stats_rx_size64_cnt = 47,
spx5_stats_pmac_rx_size64_cnt = 48,
spx5_stats_rx_size65to127_cnt = 49,
spx5_stats_pmac_rx_size65to127_cnt = 50,
spx5_stats_rx_size128to255_cnt = 51,
spx5_stats_pmac_rx_size128to255_cnt = 52,
spx5_stats_rx_size256to511_cnt = 53,
spx5_stats_pmac_rx_size256to511_cnt = 54,
spx5_stats_rx_size512to1023_cnt = 55,
spx5_stats_pmac_rx_size512to1023_cnt = 56,
spx5_stats_rx_size1024to1518_cnt = 57,
spx5_stats_pmac_rx_size1024to1518_cnt = 58,
spx5_stats_rx_size1519tomax_cnt = 59,
spx5_stats_pmac_rx_size1519tomax_cnt = 60,
spx5_stats_tx_size64_cnt = 61,
spx5_stats_pmac_tx_size64_cnt = 62,
spx5_stats_tx_size65to127_cnt = 63,
spx5_stats_pmac_tx_size65to127_cnt = 64,
spx5_stats_tx_size128to255_cnt = 65,
Annotation
- Immediate include surface: `linux/ethtool.h`, `sparx5_main_regs.h`, `sparx5_main.h`, `sparx5_port.h`.
- Detected declarations: `enum sparx5_stats_entry`, `function Copyright`, `function sparx5_get_queue_sys_stats`, `function sparx5_get_ana_ac_stats_stats`, `function sparx5_get_dev_phy_stats`, `function sparx5_get_dev_mac_stats`, `function sparx5_get_dev_mac_ctrl_stats`, `function sparx5_get_dev_rmon_stats`, `function sparx5_get_dev_misc_stats`, `function sparx5_get_device_stats`.
- 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.
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.