nvethernet: Skip PHC update if no config change

Issue: Restarting of PTP daemon updates
the current system time in MAC registers.

Fix: Configure PTP registers only if PTP daemon
sends updated configuration. If the configuration
is same continue with earlier registers update.
System time will be set in the MAC registers at
the time of ptp_early_init and the 1st ptp
daemon ioctl to set HW configuration.

Bug 4259584

Change-Id: Ied0eec498cfd4283b71797abf3b272d19998064f
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2994409
(cherry picked from commit e774e69777d92a7136ec6c61571e677bfbde6ebf)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3010369
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Rakesh Goyal
2023-10-10 08:15:55 +00:00
committed by mobile promotions
parent 99fa3ab6b2
commit 8ca3fa5c51
3 changed files with 11 additions and 0 deletions

View File

@@ -3035,6 +3035,8 @@ static int ether_close(struct net_device *ndev)
/* Reset MAC loopback variable */
pdata->mac_loopback_mode = OSI_DISABLE;
memset(&pdata->ptp_config, 0, sizeof(sizeof(struct hwtstamp_config)));
return 0;
}
@@ -6973,6 +6975,7 @@ static int ether_suspend_noirq(struct device *dev)
if (osi_core->mac == OSI_MAC_HW_MGBE)
pm_runtime_put_sync(pdata->dev);
memset(&pdata->ptp_config, 0, sizeof(sizeof(struct hwtstamp_config)));
return 0;
}

View File

@@ -666,6 +666,8 @@ struct ether_priv_data {
struct tasklet_struct lane_restart_task;
/** xtra sw error counters */
struct ether_xtra_stat_counters xstats;
/** PTP configuration passed by aplication */
struct hwtstamp_config ptp_config;
};
/**

View File

@@ -423,6 +423,10 @@ int ether_handle_hwtstamp_ioctl(struct ether_priv_data *pdata,
return -EINVAL;
}
if (memcmp(&config, &pdata->ptp_config, sizeof(struct hwtstamp_config)) == 0) {
goto skip;
}
switch (config.tx_type) {
case HWTSTAMP_TX_OFF:
pdata->hwts_tx_en = OSI_DISABLE;
@@ -607,6 +611,8 @@ int ether_handle_hwtstamp_ioctl(struct ether_priv_data *pdata,
#endif /* !OSI_STRIPPED_LIB */
}
memcpy(&pdata->ptp_config, &config, sizeof(struct hwtstamp_config));
skip:
return (copy_to_user(ifr->ifr_data, &config,
sizeof(struct hwtstamp_config))) ? -EFAULT : 0;
}