FILE
ena_debugfs.c
File preview with syntax highlighting.
linux-6.19.14/drivers/net/ethernet/amazon/ena/ena_debugfs.c
1// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB 2/* Copyright (c) Amazon.com, Inc. or its affiliates. 3 * All rights reserved. 4 */ 5 6#ifdef CONFIG_DEBUG_FS 7 8#include <linux/seq_file.h> 9#include <linux/pci.h> 10#include "ena_debugfs.h" 11#include "ena_phc.h" 12 13static 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 39DEFINE_SHOW_ATTRIBUTE(phc_stats); 40 41void ena_debugfs_init(struct net_device *dev) 42{ 43 struct ena_adapter *adapter = netdev_priv(dev); 44 45 adapter->debugfs_base = 46 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); 53} 54 55void ena_debugfs_terminate(struct net_device *dev) 56{ 57 struct ena_adapter *adapter = netdev_priv(dev); 58 59 debugfs_remove_recursive(adapter->debugfs_base); 60} 61 62#endif /* CONFIG_DEBUG_FS */
~/
Read-only file preview.