On Mon, 2022-12-05 at 12:52 -0500, vincent.cheng...@renesas.com wrote:
> On Mon, Dec 05, 2022 at 02:44:07AM EST, Geva, Erez wrote:
> > On Fri, 2022-12-02 at 15:33 -0500,
> > vincent.cheng...@renesas.com wrote:
> > > From: Vincent Cheng <vincent.cheng...@renesas.com>
> > > 
> > > In handle_state_decision_event(), the update of the clock's
> > > parent
> > > pid after
> > > best master change is non-deterministic. It depends on the port
> > > processing
> > > order and bmc_state_decision() results.
> > > 
> > > +static void clock_update_parent_identity(struct clock *c)
> > > +{
> > > +       struct parentDS *pds = &c->dad.pds;
> > > +
> > > +       if (c->best) {
> > > +               pds->parentPortIdentity = c->best-
> > > >dataset.sender;
> > > +       } else {
> > > +               pds->parentPortIdentity.clockIdentity = c-
> > > > dds.clockIdentity;
> > > +               pds->parentPortIdentity.portNumber    = 0;
> > 
> > Why is the port 0?
> > It make sense that defaultDS do not have port as we work in the
> > context
> > of the clock.
> > Is it make sense to use port ID here?
> 
> I would like to say it is port 0 because I consulted 1588-2019.pdf
> and found the
> requirement in "Table 30 - Updates for state decision code M1 and
> M2".
> 
>   parentDS.clockIdentity member set to the value of
> defaultDS.clockIdentity field.
>   parentDS.parentPortIdentity.portNumber member is 0
> 
> However, realistically speaking, I copied the logic from
> clock_update_grandmaster()
> and clock_update_slave() first and then looked it up afterwards.

Make sense, please live a comment on the value assignment :-)

Something like ~ "follow IEEE table 30 updates for M1".
No need for a long one, just a short reference.

Erez

> 
> > 
> > 
> > > +       }
> > > +}
> > > +
> > >  static int clock_utc_correct(struct clock *c, tmv_t ingress)
> > >  {
> > >         struct timespec offset;
> > > @@ -2015,6 +2027,8 @@ static void
> > > handle_state_decision_event(struct
> > > clock *c)
> > >         c->best = best;
> > >         c->best_id = best_id;
> > >  
> > > +       clock_update_parent_identity(c);
> > > +
> > >         LIST_FOREACH(piter, &c->ports, list) {
> > >                 enum port_state ps;
> > >                 enum fsm_event event;
> > 
> > 
> > P.S.
> > All patches should be on top of master, no need to comment on
> > obvious.
> 
> Ok, will leave out commit next time if it's not needed. Thanks.
> 
> Vincent

-- 
Erez Geva
Siemens AG
www.siemens.com

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

Reply via email to