Cancel messages don't trigger BMCA leaving best GM select for the port.
In case when new Announces mesages are the same as they were before
Cancel, BMCA algorithm will select the same GM and the stae machine will
not change best GM into UC_NEED_SYDY. And all unicast GMs will be
UC_HAVE_ANN state with best GM selected for port without Sync messages
subscription. This patch forces state machine to recalculate new GM upon
receiving Cancel message and prevent such state.

Signed-off-by: Alexander Bulimov <abuli...@meta.com>
Signed-off-by: Vadim Fedorenko <vad...@meta.com>
---
 unicast_client.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/unicast_client.c b/unicast_client.c
index 5bb383f..039967f 100644
--- a/unicast_client.c
+++ b/unicast_client.c
@@ -339,11 +339,14 @@ int unicast_client_cancel(struct port *p, struct 
ptp_message *m,
        if (cancel->message_type_flags & CANCEL_UNICAST_MAINTAIN_GRANT) {
                return 0;
        }
+
        pr_warning("%s: server unilaterally canceled unicast %s grant",
                   p->log_name, msg_type_string(mtype));
 
        ucma->state = unicast_fsm(ucma->state, UC_EV_CANCEL);
        ucma->granted &= ~(1 << mtype);
+       // trigger clock state change event
+       clock_set_sde(p->clock, 1);
 
        /* Respond with ACK. */
        msg = port_signaling_uc_construct(p, &ucma->address, 
&ucma->portIdentity);
@@ -446,6 +449,8 @@ void unicast_client_grant(struct port *p, struct 
ptp_message *m,
                           p->log_name, msg_type_string(mtype));
                if (mtype != PDELAY_RESP) {
                        ucma->state = UC_WAIT;
+                       // trigger clock state change event
+                       clock_set_sde(p->clock, 1);
                }
                return;
        }
-- 
2.30.2



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

Reply via email to