nvethernet: suspend/resume time profiling

Add suspend/resume time to the debugfs so that
tests can be written to monitor the SC7 KPI

Bug 4202840

Change-Id: I92531277ab7149269186f8c61237931de99a3368
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3300390
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
This commit is contained in:
Bhadram Varka
2023-07-31 03:28:19 +00:00
committed by Jon Hunter
parent b5a64188d3
commit 1960558372
3 changed files with 47 additions and 0 deletions

View File

@@ -25,6 +25,24 @@
#include <soc/tegra/fuse.h> #include <soc/tegra/fuse.h>
#include <soc/tegra/fuse-helper.h> #include <soc/tegra/fuse-helper.h>
#include <soc/tegra/virt/hv-ivc.h> #include <soc/tegra/virt/hv-ivc.h>
#include <linux/time.h>
#ifdef CONFIG_DEBUG_FS
static u64 ether_get_systime_us(void)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
return ktime_to_us(ktime_get_boottime());
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
struct timespec ts;
get_monotonic_boottime(&ts);
return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000;
#else
struct timeval tv;
do_gettimeofday(&tv);
return ((u64)tv.tv_sec * 1000000) + tv.tv_usec;
#endif
}
#endif
/** /**
* @brief ether_get_free_timestamp_node - get free node for timestmap info for SKB * @brief ether_get_free_timestamp_node - get free node for timestmap info for SKB
@@ -7821,10 +7839,17 @@ int ether_suspend_noirq(struct device *dev)
struct osi_dma_priv_data *osi_dma = pdata->osi_dma; struct osi_dma_priv_data *osi_dma = pdata->osi_dma;
struct osi_ioctl ioctl_data = {}; struct osi_ioctl ioctl_data = {};
unsigned int i = 0, chan = 0; unsigned int i = 0, chan = 0;
#ifdef CONFIG_DEBUG_FS
u64 t0, t1;
#endif
if (!netif_running(ndev)) if (!netif_running(ndev))
return 0; return 0;
#ifdef CONFIG_DEBUG_FS
t0 = ether_get_systime_us();
#endif
tasklet_kill(&pdata->lane_restart_task); tasklet_kill(&pdata->lane_restart_task);
/* stop workqueue */ /* stop workqueue */
@@ -7873,6 +7898,10 @@ int ether_suspend_noirq(struct device *dev)
pm_runtime_put_sync(pdata->dev); pm_runtime_put_sync(pdata->dev);
memset(&pdata->ptp_config, 0, sizeof(sizeof(struct hwtstamp_config))); memset(&pdata->ptp_config, 0, sizeof(sizeof(struct hwtstamp_config)));
#ifdef CONFIG_DEBUG_FS
t1 = ether_get_systime_us();
pdata->suspend_profile_time = (t1 - t0);
#endif
return 0; return 0;
} }
@@ -7881,9 +7910,15 @@ int ether_resume_noirq(struct device *dev)
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct ether_priv_data *pdata = netdev_priv(ndev); struct ether_priv_data *pdata = netdev_priv(ndev);
int ret = 0; int ret = 0;
#ifdef CONFIG_DEBUG_FS
u64 t0, t1;
#endif
if (!netif_running(ndev)) if (!netif_running(ndev))
return 0; return 0;
#ifdef CONFIG_DEBUG_FS
t0 = ether_get_systime_us();
#endif
if (!device_may_wakeup(&ndev->dev) && if (!device_may_wakeup(&ndev->dev) &&
gpio_is_valid(pdata->phy_reset) && gpio_is_valid(pdata->phy_reset) &&
@@ -7898,6 +7933,10 @@ int ether_resume_noirq(struct device *dev)
return ret; return ret;
} }
#ifdef CONFIG_DEBUG_FS
t1 = ether_get_systime_us();
pdata->resume_profile_time = (t1 - t0);
#endif
return 0; return 0;
} }

View File

@@ -653,6 +653,10 @@ struct ether_priv_data {
struct dentry *dbgfs_desc_dump; struct dentry *dbgfs_desc_dump;
/** Register dump debug fs pointer */ /** Register dump debug fs pointer */
struct dentry *dbgfs_reg_dump; struct dentry *dbgfs_reg_dump;
/** Holds the time in usec for suspend routine completion */
u64 suspend_profile_time;
/** Holds the time in usec for resume routine completion */
u64 resume_profile_time;
#endif #endif
#ifdef MACSEC_SUPPORT #ifdef MACSEC_SUPPORT
/** MACsec priv data */ /** MACsec priv data */

View File

@@ -4137,6 +4137,10 @@ static int ether_create_debugfs(struct ether_priv_data *pdata)
goto exit; goto exit;
} }
debugfs_create_u64("suspend_profile_time", 0644, pdata->dbgfs_dir,
&pdata->suspend_profile_time);
debugfs_create_u64("resume_profile_time", 0644, pdata->dbgfs_dir,
&pdata->resume_profile_time);
exit: exit:
kfree(buf); kfree(buf);
return ret; return ret;