drivers/net/ethernet/qlogic/qede/qede_ethtool.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/qlogic/qede/qede_ethtool.c- Extension
.c- Size
- 64414 bytes
- Lines
- 2365
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
linux/types.hlinux/netdevice.hlinux/etherdevice.hlinux/ethtool.hlinux/string.hlinux/pci.hlinux/capability.hlinux/vmalloc.hlinux/phylink.hqede.hqede_ptp.h
Detected Declarations
enum qede_ethtool_testsfunction qede_forced_speed_maps_initfunction qede_get_strings_stats_txqfunction qede_get_strings_stats_rxqfunction qede_is_irrelevant_statfunction qede_get_strings_statsfunction qede_get_stringsfunction qede_get_ethtool_stats_txqfunction qede_get_ethtool_stats_rxqfunction qede_get_ethtool_statsfunction qede_get_sset_countfunction qede_get_priv_flagsfunction qede_set_priv_flagsfunction qede_get_link_ksettingsfunction qede_set_link_ksettingsfunction qede_get_drvinfofunction qede_get_wolfunction qede_set_wolfunction qede_get_msglevelfunction qede_set_msglevelfunction qede_nway_resetfunction qede_get_linkfunction qede_flash_devicefunction qede_get_coalescefunction for_each_queuefunction for_each_queuefunction qede_set_coalescefunction qede_get_ringparamfunction qede_set_ringparamfunction qede_get_pauseparamfunction qede_set_pauseparamfunction qede_get_regsfunction qede_get_regs_lenfunction qede_update_mtufunction qede_change_mtufunction qede_get_channelsfunction qede_set_channelsfunction qede_get_ts_infofunction qede_set_phys_idfunction qede_get_rxfh_fieldsfunction qede_get_rx_ring_countfunction qede_get_rxnfcfunction qede_set_rxfh_fieldsfunction qede_set_rxnfcfunction qede_get_rxfh_indir_sizefunction qede_get_rxfh_key_sizefunction qede_get_rxfhfunction qede_set_rxfh
Annotated Snippet
if (fp->type & QEDE_FASTPATH_TX) {
int cos;
for_each_cos_in_txq(edev, cos)
qede_get_strings_stats_txq(edev,
&fp->txq[cos], &buf);
}
}
/* Account for non-queue statistics */
for (i = 0; i < QEDE_NUM_STATS; i++) {
if (qede_is_irrelevant_stat(edev, i))
continue;
ethtool_puts(&buf, qede_stats_arr[i].string);
}
}
static void qede_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
{
struct qede_dev *edev = netdev_priv(dev);
int i;
switch (stringset) {
case ETH_SS_STATS:
qede_get_strings_stats(edev, buf);
break;
case ETH_SS_PRIV_FLAGS:
for (i = 0; i < QEDE_PRI_FLAG_LEN; i++)
ethtool_puts(&buf, qede_private_arr[i]);
break;
case ETH_SS_TEST:
for (i = 0; i < QEDE_ETHTOOL_TEST_MAX; i++)
ethtool_puts(&buf, qede_tests_str_arr[i]);
break;
default:
DP_VERBOSE(edev, QED_MSG_DEBUG,
"Unsupported stringset 0x%08x\n", stringset);
}
}
static void qede_get_ethtool_stats_txq(struct qede_tx_queue *txq, u64 **buf)
{
int i;
for (i = 0; i < QEDE_NUM_TQSTATS; i++) {
**buf = *((u64 *)(((void *)txq) + qede_tqstats_arr[i].offset));
(*buf)++;
}
}
static void qede_get_ethtool_stats_rxq(struct qede_rx_queue *rxq, u64 **buf)
{
int i;
for (i = 0; i < QEDE_NUM_RQSTATS; i++) {
**buf = *((u64 *)(((void *)rxq) + qede_rqstats_arr[i].offset));
(*buf)++;
}
}
static void qede_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *buf)
{
struct qede_dev *edev = netdev_priv(dev);
struct qede_fastpath *fp;
int i;
qede_fill_by_demand_stats(edev);
/* Need to protect the access to the fastpath array */
__qede_lock(edev);
for (i = 0; i < QEDE_QUEUE_CNT(edev); i++) {
fp = &edev->fp_array[i];
if (fp->type & QEDE_FASTPATH_RX)
qede_get_ethtool_stats_rxq(fp->rxq, &buf);
if (fp->type & QEDE_FASTPATH_XDP)
qede_get_ethtool_stats_txq(fp->xdp_tx, &buf);
if (fp->type & QEDE_FASTPATH_TX) {
int cos;
for_each_cos_in_txq(edev, cos)
qede_get_ethtool_stats_txq(&fp->txq[cos], &buf);
}
}
spin_lock(&edev->stats_lock);
Annotation
- Immediate include surface: `linux/types.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/string.h`, `linux/pci.h`, `linux/capability.h`, `linux/vmalloc.h`.
- Detected declarations: `enum qede_ethtool_tests`, `function qede_forced_speed_maps_init`, `function qede_get_strings_stats_txq`, `function qede_get_strings_stats_rxq`, `function qede_is_irrelevant_stat`, `function qede_get_strings_stats`, `function qede_get_strings`, `function qede_get_ethtool_stats_txq`, `function qede_get_ethtool_stats_rxq`, `function qede_get_ethtool_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.
- 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.