Re: [Linuxptp-devel] [PATCH 1/3] clock: Reset state when switching port with same best clock.

2021-05-25 Thread Keller, Jacob E



> -Original Message-
> From: Miroslav Lichvar 
> Sent: Tuesday, May 25, 2021 5:28 AM
> To: linuxptp-devel@lists.sourceforge.net
> Subject: [Linuxptp-devel] [PATCH 1/3] clock: Reset state when switching port 
> with
> same best clock.
> 
> When the best port is changed, but the ID of the best clock doesn't
> change (e.g. a passive port is activated on link failure), reset the
> current delay and other master/link-specific state to avoid the switch
> throwing the clock off.
> 

Right. Since we are on a new port, we are going to have different 
characteristics, even if the clock is still the same.

Makes sense.

Reviewed-by: Jacob Keller 

> Signed-off-by: Miroslav Lichvar 
> ---
>  clock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/clock.c b/clock.c
> index e545a9b..a073575 100644
> --- a/clock.c
> +++ b/clock.c
> @@ -1947,7 +1947,7 @@ static void handle_state_decision_event(struct clock
> *c)
> cid2str(&best_id));
>   }
> 
> - if (!cid_eq(&best_id, &c->best_id)) {
> + if (!cid_eq(&best_id, &c->best_id) || best != c->best) {
>   clock_freq_est_reset(c);
>   tsproc_reset(c->tsproc, 1);
>   if (!tmv_is_zero(c->initial_delay))
> --
> 2.26.3
> 
> 
> 
> ___
> Linuxptp-devel mailing list
> Linuxptp-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


[Linuxptp-devel] [PATCH 1/3] clock: Reset state when switching port with same best clock.

2021-05-25 Thread Miroslav Lichvar
When the best port is changed, but the ID of the best clock doesn't
change (e.g. a passive port is activated on link failure), reset the
current delay and other master/link-specific state to avoid the switch
throwing the clock off.

Signed-off-by: Miroslav Lichvar 
---
 clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clock.c b/clock.c
index e545a9b..a073575 100644
--- a/clock.c
+++ b/clock.c
@@ -1947,7 +1947,7 @@ static void handle_state_decision_event(struct clock *c)
  cid2str(&best_id));
}
 
-   if (!cid_eq(&best_id, &c->best_id)) {
+   if (!cid_eq(&best_id, &c->best_id) || best != c->best) {
clock_freq_est_reset(c);
tsproc_reset(c->tsproc, 1);
if (!tmv_is_zero(c->initial_delay))
-- 
2.26.3



___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel