Skip to content

Commit e14521e

Browse files
davidarinzonkuba-moo
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 60e2835 commit e14521e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

drivers/net/ethernet/amazon/ena/ena_debugfs.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,48 @@
88
#include <linux/seq_file.h>
99
#include <linux/pci.h>
1010
#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);
1140

1241
void ena_debugfs_init(struct net_device *dev)
1342
{
1443
struct ena_adapter *adapter = netdev_priv(dev);
1544

1645
adapter->debugfs_base =
1746
debugfs_create_dir(dev_name(&adapter->pdev->dev), NULL);
47+
48+
debugfs_create_file("phc_stats",
49+
0400,
50+
adapter->debugfs_base,
51+
adapter,
52+
&phc_stats_fops);
1853
}
1954

2055
void ena_debugfs_terminate(struct net_device *dev)

0 commit comments

Comments
 (0)