On Sat, May 22, 2021 at 05:09:07PM +0300, Amar Subramanyam via Linuxptp-devel 
wrote:
> The LISTENING port prints continuously
> "selected best master clock 000000.0000.000003
> updating UTC offset to 37"
> 
> We limited the log such that now it prints only when there is a
> change in the best-master clock.
> 
> Signed-off-by: Amar Subramanyam <asubraman...@altiostar.com>
> Signed-off-by: Karthikkumar Valoor <kval...@altiostar.com>
> Signed-off-by: Ramana Reddy <rre...@altiostar.com>
> ---
>  clock.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/clock.c b/clock.c
> index e545a9b..2a95d79 100644
> --- a/clock.c
> +++ b/clock.c
> @@ -1939,14 +1939,6 @@ static void handle_state_decision_event(struct clock 
> *c)
>               best_id = c->dds.clockIdentity;
>       }
>  
> -     if (cid_eq(&best_id, &c->dds.clockIdentity)) {
> -             pr_notice("selected local clock %s as best master",
> -                       cid2str(&best_id));
> -     } else {
> -             pr_notice("selected best master clock %s",
> -                       cid2str(&best_id));
> -     }
> -
>       if (!cid_eq(&best_id, &c->best_id)) {
>               clock_freq_est_reset(c);
>               tsproc_reset(c->tsproc, 1);
> @@ -1957,6 +1949,13 @@ static void handle_state_decision_event(struct clock 
> *c)
>               c->master_local_rr = 1.0;
>               c->nrr = 1.0;
>               fresh_best = 1;
> +             if (cid_eq(&best_id, &c->dds.clockIdentity)) {
> +                     pr_notice("selected local clock %s as best master",
> +                                     cid2str(&best_id));
> +             } else {
> +                     pr_notice("selected best master clock %s",
> +                                     cid2str(&best_id));
> +             }

This is a nice improvement as it prevent log spam in common
situations.

>       }
>  
>       c->best = best;
> @@ -1983,7 +1982,9 @@ static void handle_state_decision_event(struct clock *c)
>                       event = EV_RS_PASSIVE;
>                       break;
>               case PS_SLAVE:
> -                     clock_update_slave(c);
> +                     if (fresh_best) {
> +                             clock_update_slave(c);
> +                     }

This is not correct.  Elements of the upstream data sets might have
changed, and the port needs to stay up to date.

>                       event = EV_RS_SLAVE;
>                       break;
>               default:
> -- 
> 1.8.3.1

Thanks,
Richard


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

Reply via email to