Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 notification.h |  1 +
 pmc.c          |  6 ++++--
 pmc_common.c   | 14 ++++++++++----
 port.c         |  7 +++++++
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/notification.h b/notification.h
index c1a6395..7a8f641 100644
--- a/notification.h
+++ b/notification.h
@@ -45,6 +45,7 @@ enum notification {
        NOTIFY_PORT_STATE,
        NOTIFY_TIME_SYNC,
        NOTIFY_PARENT_DATA_SET,
+       NOTIFY_CMLDS,
 };
 
 #endif
diff --git a/pmc.c b/pmc.c
index 12a6109..6cdd7b0 100644
--- a/pmc.c
+++ b/pmc.c
@@ -453,11 +453,13 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
                        IFMT "duration               %hu"
                        IFMT "NOTIFY_PORT_STATE      %s"
                        IFMT "NOTIFY_TIME_SYNC       %s"
-                       IFMT "NOTIFY_PARENT_DATA_SET %s",
+                       IFMT "NOTIFY_PARENT_DATA_SET %s"
+                       IFMT "NOTIFY_CMLDS           %s",
                        sen->duration,
                        event_bitmask_get(sen->bitmask, NOTIFY_PORT_STATE) ? 
"on" : "off",
                        event_bitmask_get(sen->bitmask, NOTIFY_TIME_SYNC) ? 
"on" : "off",
-                       event_bitmask_get(sen->bitmask, NOTIFY_PARENT_DATA_SET) 
? "on" : "off");
+                       event_bitmask_get(sen->bitmask, NOTIFY_PARENT_DATA_SET) 
? "on" : "off",
+                       event_bitmask_get(sen->bitmask, NOTIFY_CMLDS) ? "on" : 
"off");
                break;
        case MID_SYNCHRONIZATION_UNCERTAIN_NP:
                mtd = (struct management_tlv_datum *) mgt->data;
diff --git a/pmc_common.c b/pmc_common.c
index 1d537f2..a549af5 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -180,6 +180,7 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
        char onoff_port_state[4] = "off";
        char onoff_time_status[4] = "off";
        char onoff_parent_data_set[4] = "off";
+       char onoff_cmlds[4] = "off";
        char display_name[11] = {0};
        uint64_t jump;
        uint8_t key;
@@ -306,13 +307,15 @@ static void do_set_action(struct pmc *pmc, int action, 
int index, char *str)
                             "duration          %hu "
                             "NOTIFY_PORT_STATE %3s "
                             "NOTIFY_TIME_SYNC  %3s "
-                            "NOTIFY_PARENT_DATA_SET %3s ",
+                            "NOTIFY_PARENT_DATA_SET %3s "
+                            "NOTIFY_CMLDS %3s ",
                             &sen.duration,
                             onoff_port_state,
                             onoff_time_status,
-                            onoff_parent_data_set);
-               if (cnt != 4) {
-                       fprintf(stderr, "%s SET needs 4 values\n",
+                            onoff_parent_data_set,
+                            onoff_cmlds);
+               if (cnt != 5) {
+                       fprintf(stderr, "%s SET needs 5 values\n",
                                idtab[index].name);
                        break;
                }
@@ -326,6 +329,9 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
                        event_bitmask_set(sen.bitmask, NOTIFY_PARENT_DATA_SET,
                                          TRUE);
                }
+               if (!strcasecmp(onoff_cmlds, "on")) {
+                       event_bitmask_set(sen.bitmask, NOTIFY_CMLDS, TRUE);
+               }
                pmc_send_set_action(pmc, code, &sen, sizeof(sen));
                break;
        case MID_SYNCHRONIZATION_UNCERTAIN_NP:
diff --git a/port.c b/port.c
index 2eca876..23f021c 100644
--- a/port.c
+++ b/port.c
@@ -748,6 +748,7 @@ capable:
        if (p->asCapable == NOT_CAPABLE) {
                pr_debug("%s: setting asCapable", p->log_name);
                p->asCapable = AS_CAPABLE;
+               port_notify_event(p, NOTIFY_CMLDS);
        }
        return 1;
 
@@ -755,6 +756,7 @@ not_capable:
        if (p->asCapable)
                port_nrate_initialize(p);
        p->asCapable = NOT_CAPABLE;
+       port_notify_event(p, NOTIFY_CMLDS);
        return 0;
 }
 
@@ -2467,6 +2469,8 @@ calc:
 
        msg_put(p->peer_delay_req);
        p->peer_delay_req = NULL;
+
+       port_notify_event(p, NOTIFY_CMLDS);
 }
 
 int process_pdelay_resp(struct port *p, struct ptp_message *m)
@@ -3264,6 +3268,9 @@ void port_notify_event(struct port *p, enum notification 
event)
        case NOTIFY_PORT_STATE:
                id = MID_PORT_DATA_SET;
                break;
+       case NOTIFY_CMLDS:
+               id = MID_CMLDS_INFO_NP;
+               break;
        default:
                return;
        }
-- 
2.39.2



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

Reply via email to