Message ID | 20201224162405.28032-1-grygorii.strashko@ti.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] net: ethernet: ti: cpts: fix ethtool output when no ptp_clock registered | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 1 maintainers not CCed: kurt@linutronix.de |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 14 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Thu, Dec 24, 2020 at 06:24:05PM +0200, Grygorii Strashko wrote: > The CPTS driver registers PTP PHC clock when first netif is going up and > unregister it when all netif are down. Now ethtool will show: > - PTP PHC clock index 0 after boot until first netif is up; > - the last assigned PTP PHC clock index even if PTP PHC clock is not > registered any more after all netifs are down. > > This patch ensures that -1 is returned by ethtool when PTP PHC clock is not > registered any more. > > Fixes: 8a2c9a5ab4b9 ("net: ethernet: ti: cpts: rework initialization/deinitialization") > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Richard Cochran <richardcochran@gmail.com>
On Thu, 24 Dec 2020 13:21:36 -0800 Richard Cochran wrote: > On Thu, Dec 24, 2020 at 06:24:05PM +0200, Grygorii Strashko wrote: > > The CPTS driver registers PTP PHC clock when first netif is going up and > > unregister it when all netif are down. Now ethtool will show: > > - PTP PHC clock index 0 after boot until first netif is up; > > - the last assigned PTP PHC clock index even if PTP PHC clock is not > > registered any more after all netifs are down. > > > > This patch ensures that -1 is returned by ethtool when PTP PHC clock is not > > registered any more. > > > > Fixes: 8a2c9a5ab4b9 ("net: ethernet: ti: cpts: rework initialization/deinitialization") > > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> > > Acked-by: Richard Cochran <richardcochran@gmail.com> Applied, thank you!
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index d1fc7955d422..43222a34cba0 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -599,6 +599,7 @@ void cpts_unregister(struct cpts *cpts) ptp_clock_unregister(cpts->clock); cpts->clock = NULL; + cpts->phc_index = -1; cpts_write32(cpts, 0, int_enable); cpts_write32(cpts, 0, control); @@ -784,6 +785,7 @@ struct cpts *cpts_create(struct device *dev, void __iomem *regs, cpts->cc.read = cpts_systim_read; cpts->cc.mask = CLOCKSOURCE_MASK(32); cpts->info = cpts_info; + cpts->phc_index = -1; if (n_ext_ts) cpts->info.n_ext_ts = n_ext_ts;
The CPTS driver registers PTP PHC clock when first netif is going up and unregister it when all netif are down. Now ethtool will show: - PTP PHC clock index 0 after boot until first netif is up; - the last assigned PTP PHC clock index even if PTP PHC clock is not registered any more after all netifs are down. This patch ensures that -1 is returned by ethtool when PTP PHC clock is not registered any more. Fixes: 8a2c9a5ab4b9 ("net: ethernet: ti: cpts: rework initialization/deinitialization") Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> --- drivers/net/ethernet/ti/cpts.c | 2 ++ 1 file changed, 2 insertions(+)