[Linuxptp-devel] [PATCH v1 4/5] Add a push notification for the CMLDS TLV.
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
|
From: Richard C. <ric...@gm...> - 2023-11-30 07:57:46
|
Signed-off-by: Richard Cochran <ric...@gm...>
---
notification.h | 1 +
pmc.c | 6 ++++--
pmc_common.c | 14 ++++++++++----
port.c | 5 +++++
4 files changed, 20 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 c29e3b7..e733cf0 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 aab9d3f..8afe1b2 100644
--- a/port.c
+++ b/port.c
@@ -2466,6 +2466,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)
@@ -3263,6 +3265,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
|