On Fri, Dec 02, 2022 at 03:33:42PM -0500, vincent.cheng...@renesas.com wrote:
> @@ -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); Calling this unconditionally, regardless of port state transitions, will update the parentPortIdentity incorrectly in some cases. According the 1588, the update should only occur when a port enters one of two specific states. > LIST_FOREACH(piter, &c->ports, list) { > enum port_state ps; > enum fsm_event event; Let me suggest another way that avoids the incorrect parentPortIdentity update: In port_state_update() don't call unicast_client_state_changed(). Instead, set a flag in the port that means "unicast state dirty". 3417 int port_state_update(struct port *p, enum fsm_event event, int mdiff) 3418 { ... 3447 if (mdiff) { 3448 - unicast_client_state_changed(p); + p->unicast_state_dirty = true; 3449 } 3450 if (next != p->state) { 3451 port_show_transition(p, next, event); 3452 p->state = next; 3453 port_notify_event(p, NOTIFY_PORT_STATE); 3454 - unicast_client_state_changed(p); + p->unicast_state_dirty = true; 3455 return 1; 3456 } Then, in handle_state_decision_event(), after the big LIST_FOREACH(piter, &c->ports, list) loop, iterate once again over the ports: LIST_FOREACH(piter, &c->ports, list) { port_update_unicast_state(piter); } where port_update_unicast_state() calls unicast_client_state_changed() and clears the flag. Thanks, Richard _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel