Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ena: View PHC stats using debugfs

Add an entry named `phc_stats` to view the PHC statistics.
If PHC is enabled, the stats are printed, as below:

phc_cnt: 0
phc_exp: 0
phc_skp: 0
phc_err_dv: 0
phc_err_ts: 0

If PHC is disabled, no statistics will be displayed.

Signed-off-by: David Arinzon <darinzon@amazon.com>
Link: https://patch.msgid.link/20250617110545.5659-9-darinzon@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

David Arinzon and committed by
Jakub Kicinski
e14521e9 60e28350

+35
+35
drivers/net/ethernet/amazon/ena/ena_debugfs.c
··· 8 8 #include <linux/seq_file.h> 9 9 #include <linux/pci.h> 10 10 #include "ena_debugfs.h" 11 + #include "ena_phc.h" 12 + 13 + static int phc_stats_show(struct seq_file *file, void *priv) 14 + { 15 + struct ena_adapter *adapter = file->private; 16 + 17 + if (!ena_phc_is_active(adapter)) 18 + return 0; 19 + 20 + seq_printf(file, 21 + "phc_cnt: %llu\n", 22 + adapter->ena_dev->phc.stats.phc_cnt); 23 + seq_printf(file, 24 + "phc_exp: %llu\n", 25 + adapter->ena_dev->phc.stats.phc_exp); 26 + seq_printf(file, 27 + "phc_skp: %llu\n", 28 + adapter->ena_dev->phc.stats.phc_skp); 29 + seq_printf(file, 30 + "phc_err_dv: %llu\n", 31 + adapter->ena_dev->phc.stats.phc_err_dv); 32 + seq_printf(file, 33 + "phc_err_ts: %llu\n", 34 + adapter->ena_dev->phc.stats.phc_err_ts); 35 + 36 + return 0; 37 + } 38 + 39 + DEFINE_SHOW_ATTRIBUTE(phc_stats); 11 40 12 41 void ena_debugfs_init(struct net_device *dev) 13 42 { ··· 44 15 45 16 adapter->debugfs_base = 46 17 debugfs_create_dir(dev_name(&adapter->pdev->dev), NULL); 18 + 19 + debugfs_create_file("phc_stats", 20 + 0400, 21 + adapter->debugfs_base, 22 + adapter, 23 + &phc_stats_fops); 47 24 } 48 25 49 26 void ena_debugfs_terminate(struct net_device *dev)