From: Vincent Cheng <vincent.cheng...@renesas.com>

When a unicast master is no longer the best master, an UC_EV_UNSELECTED
event occurs for that unicast master entry. However, the sync/delay_response
contracts are not explicitly cancelled.

This patch updates unicast_client_state_changed() to send 
CANCEL_UNICAST_TRANSMISSION to cancel sync/delay_response messages on 
UC_EV_UNSELECTED event.

Signed-off-by: Vincent Cheng <vincent.cheng...@renesas.com>
---
 unicast_client.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/unicast_client.c b/unicast_client.c
index fcaeb65..011c1c7 100644
--- a/unicast_client.c
+++ b/unicast_client.c
@@ -527,6 +527,7 @@ void unicast_client_state_changed(struct port *p)
 {
        struct unicast_master_address *ucma;
        struct PortIdentity pid;
+       enum unicast_state prev_state;
 
        if (!unicast_client_enabled(p)) {
                return;
@@ -537,7 +538,13 @@ void unicast_client_state_changed(struct port *p)
                if (pid_eq(&ucma->portIdentity, &pid)) {
                        ucma->state = unicast_fsm(ucma->state, UC_EV_SELECTED);
                } else {
+                       prev_state = ucma->state;
+
                        ucma->state = unicast_fsm(ucma->state, 
UC_EV_UNSELECTED);
+
+                       if ((prev_state != ucma->state) && (prev_state == 
UC_HAVE_SYDY)) {
+                               unicast_client_tx_cancel(p, ucma, 
UNICAST_CANCEL_SYDY);
+                       }
                }
        }
 }
-- 
2.34.1



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

Reply via email to