On Wed, Aug 18, 2021 at 03:31:12PM +0000, Karthikkumar V via Linuxptp-devel 
wrote:
> This patch addresses the bug observed in ptp4l in slaveOnly mode. When the
> upstream master is no longer available (not reachable), the slave moves to
> LISTENING state. However, the gmIdentity is not updated in ptp4l. This causes
> gmPresent reported as true despite GM being non-reachable in pmc commands.
> 
> Signed-off-by: Karthikkumar V <kval...@altiostar.com>
> Signed-off-by: Ramana Reddy <rre...@altiostar.com>
> Reviewed-by: Miroslav Lichvar <mlich...@redhat.com>
> ---
>  clock.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/clock.c b/clock.c
> index ec70f91..3759b0f 100644
> --- a/clock.c
> +++ b/clock.c
> @@ -1970,6 +1970,12 @@ static void handle_state_decision_event(struct clock 
> *c)
>               ps = bmc_state_decision(c, piter, c->dscmp);
>               switch (ps) {
>               case PS_LISTENING:
> +                     if (!cid_eq(&best_id, &c->dad.pds.grandmasterIdentity)) 
> {
> +                             clock_update_grandmaster(c);

This is wrong.

The function, clock_update_grandmaster, implements the data set update
as specified in IEEE 1588, Clause 9.3.5 "Update of data sets".

The function should only be called for state decision codes M1 and M2.

Thanks,
Richard


> +                             pr_notice("%s: Updated grandmasterIdentity: %s 
> ",
> +                                     port_log_name(piter),
> +                                     
> cid2str(&c->dad.pds.grandmasterIdentity));
> +                     }
>                       event = EV_NONE;
>                       break;
>               case PS_GRAND_MASTER:
> -- 
> 1.8.3.1


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

Reply via email to