drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/enetc/enetc_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c- Extension
.c- Size
- 48394 bytes
- Lines
- 1650
- 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.
- 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_netlink.hlinux/net_tstamp.hlinux/module.hlinux/of.hlinux/ptp_clock_kernel.henetc.h
Detected Declarations
function enetc_get_reglenfunction enetc_get_regsfunction enetc_get_sset_countfunction enetc_get_pf_stringsfunction enetc4_get_pf_stringsfunction enetc_get_stringsfunction enetc_pf_get_ethtool_statsfunction enetc4_pf_get_ethtool_statsfunction enetc_get_ethtool_statsfunction enetc_pause_statsfunction enetc_get_pause_statsfunction enetc_mac_statsfunction enetc4_mac_statsfunction enetc_ctrl_statsfunction enetc_rmon_statsfunction enetc4_rmon_statsfunction enetc_get_mac_statsfunction enetc_get_eth_mac_statsfunction enetc_ppm_mac_statsfunction enetc_ppm_get_eth_mac_statsfunction enetc_get_eth_ctrl_statsfunction enetc_get_mac_rmon_statsfunction enetc_get_rmon_statsfunction enetc_get_rxfh_fieldsfunction ether_addr_copy_swapfunction enetc_set_cls_entryfunction enetc_get_rx_ring_countfunction enetc_get_rxnfcfunction enetc_set_rxnfcfunction enetc_get_rxfh_key_sizefunction enetc_get_rxfh_indir_sizefunction enetc_get_rss_key_basefunction enetc_get_rss_keyfunction enetc_get_rxfhfunction enetc_set_rss_keyfunction enetc_set_rxfhfunction enetc_get_ringparamfunction enetc_get_coalescefunction enetc_set_coalescefunction enetc_get_phc_index_by_pdevfunction enetc_get_phc_indexfunction enetc_get_ts_generic_infofunction enetc_get_ts_infofunction enetc_get_wolfunction enetc_set_wolfunction enetc_get_pauseparamfunction enetc_set_pauseparamfunction enetc_get_link_ksettings
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/* Copyright 2017-2019 NXP */
#include <linux/ethtool_netlink.h>
#include <linux/net_tstamp.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/ptp_clock_kernel.h>
#include "enetc.h"
static const u32 enetc_si_regs[] = {
ENETC_SIMR, ENETC_SIPMAR0, ENETC_SIPMAR1, ENETC_SICBDRMR,
ENETC_SICBDRSR, ENETC_SICBDRBAR0, ENETC_SICBDRBAR1, ENETC_SICBDRPIR,
ENETC_SICBDRCIR, ENETC_SICBDRLENR, ENETC_SICAPR0, ENETC_SICAPR1,
ENETC_SIUEFDCR
};
static const u32 enetc_txbdr_regs[] = {
ENETC_TBMR, ENETC_TBSR, ENETC_TBBAR0, ENETC_TBBAR1,
ENETC_TBPIR, ENETC_TBCIR, ENETC_TBLENR, ENETC_TBIER, ENETC_TBICR0,
ENETC_TBICR1
};
static const u32 enetc_rxbdr_regs[] = {
ENETC_RBMR, ENETC_RBSR, ENETC_RBBSR, ENETC_RBCIR, ENETC_RBBAR0,
ENETC_RBBAR1, ENETC_RBPIR, ENETC_RBLENR, ENETC_RBIER, ENETC_RBICR0,
ENETC_RBICR1
};
static const u32 enetc_port_regs[] = {
ENETC_PMR, ENETC_PSR, ENETC_PSIPMR, ENETC_PSIPMAR0(0),
ENETC_PSIPMAR1(0), ENETC_PTXMBAR, ENETC_PCAPR0, ENETC_PCAPR1,
ENETC_PSICFGR0(0), ENETC_PRFSCAPR, ENETC_PTCMSDUR(0),
ENETC_PM0_CMD_CFG, ENETC_PM0_MAXFRM, ENETC_PM0_IF_MODE
};
static const u32 enetc_port_mm_regs[] = {
ENETC_MMCSR, ENETC_PFPMR, ENETC_PTCFPR(0), ENETC_PTCFPR(1),
ENETC_PTCFPR(2), ENETC_PTCFPR(3), ENETC_PTCFPR(4), ENETC_PTCFPR(5),
ENETC_PTCFPR(6), ENETC_PTCFPR(7),
};
static int enetc_get_reglen(struct net_device *ndev)
{
struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_hw *hw = &priv->si->hw;
int len;
len = ARRAY_SIZE(enetc_si_regs);
len += ARRAY_SIZE(enetc_txbdr_regs) * priv->num_tx_rings;
len += ARRAY_SIZE(enetc_rxbdr_regs) * priv->num_rx_rings;
if (hw->port)
len += ARRAY_SIZE(enetc_port_regs);
if (hw->port && !!(priv->si->hw_features & ENETC_SI_F_QBU))
len += ARRAY_SIZE(enetc_port_mm_regs);
len *= sizeof(u32) * 2; /* store 2 entries per reg: addr and value */
return len;
}
static void enetc_get_regs(struct net_device *ndev, struct ethtool_regs *regs,
void *regbuf)
{
struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_hw *hw = &priv->si->hw;
u32 *buf = (u32 *)regbuf;
int i, j;
u32 addr;
for (i = 0; i < ARRAY_SIZE(enetc_si_regs); i++) {
*buf++ = enetc_si_regs[i];
*buf++ = enetc_rd(hw, enetc_si_regs[i]);
}
for (i = 0; i < priv->num_tx_rings; i++) {
for (j = 0; j < ARRAY_SIZE(enetc_txbdr_regs); j++) {
addr = ENETC_BDR(TX, i, enetc_txbdr_regs[j]);
*buf++ = addr;
*buf++ = enetc_rd(hw, addr);
}
}
for (i = 0; i < priv->num_rx_rings; i++) {
for (j = 0; j < ARRAY_SIZE(enetc_rxbdr_regs); j++) {
addr = ENETC_BDR(RX, i, enetc_rxbdr_regs[j]);
Annotation
- Immediate include surface: `linux/ethtool_netlink.h`, `linux/net_tstamp.h`, `linux/module.h`, `linux/of.h`, `linux/ptp_clock_kernel.h`, `enetc.h`.
- Detected declarations: `function enetc_get_reglen`, `function enetc_get_regs`, `function enetc_get_sset_count`, `function enetc_get_pf_strings`, `function enetc4_get_pf_strings`, `function enetc_get_strings`, `function enetc_pf_get_ethtool_stats`, `function enetc4_pf_get_ethtool_stats`, `function enetc_get_ethtool_stats`, `function enetc_pause_stats`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.