From f0c0f7b1219a6075970e303b763a3b83dae15bf3 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 3 Mar 2013 19:41:06 +0100 Subject: [PATCH] Add support for the priority1 management request. Signed-off-by: Richard Cochran --- clock.c | 7 +++++++ pmc.c | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/clock.c b/clock.c index 87a2275..4cca1a4 100644 --- a/clock.c +++ b/clock.c @@ -156,6 +156,7 @@ static int clock_management_get_response(struct clock *c, struct port *p, { int datalen = 0, err, pdulen, respond = 0; struct management_tlv *tlv; + struct management_tlv_datum *mtd; struct ptp_message *rsp; struct time_status_np *tsn; struct PortIdentity pid = port_identity(p); @@ -197,6 +198,12 @@ static int clock_management_get_response(struct clock *c, struct port *p, datalen = sizeof(c->tds); respond = 1; break; + case PRIORITY1: + mtd = (struct management_tlv_datum *) tlv->data; + mtd->val = c->dds.priority1; + datalen = sizeof(*mtd); + respond = 1; + break; case TIME_STATUS_NP: tsn = (struct time_status_np *) tlv->data; tsn->master_offset = c->master_offset; diff --git a/pmc.c b/pmc.c index 633eeaa..e79fa63 100644 --- a/pmc.c +++ b/pmc.c @@ -64,7 +64,7 @@ struct management_id idtab[] = { { "CURRENT_DATA_SET", CURRENT_DATA_SET, do_get_action }, { "PARENT_DATA_SET", PARENT_DATA_SET, do_get_action }, { "TIME_PROPERTIES_DATA_SET", TIME_PROPERTIES_DATA_SET, do_get_action }, - { "PRIORITY1", PRIORITY1, not_supported }, + { "PRIORITY1", PRIORITY1, do_get_action }, { "PRIORITY2", PRIORITY2, not_supported }, { "DOMAIN", DOMAIN, not_supported }, { "SLAVE_ONLY", SLAVE_ONLY, not_supported }, @@ -175,6 +175,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp) int action; struct TLV *tlv; struct management_tlv *mgt; + struct management_tlv_datum *mtd; struct defaultDS *dds; struct currentDS *cds; struct parentDS *pds; @@ -312,6 +313,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp) tp->flags & FREQ_TRACEABLE ? 1 : 0, tp->timeSource); break; + case PRIORITY1: + mtd = (struct management_tlv_datum *) mgt->data; + fprintf(fp, "PRIORITY1 " + IFMT "priority1 %hhu", mtd->val); + break; case TIME_STATUS_NP: tsn = (struct time_status_np *) mgt->data; fprintf(fp, "TIME_STATUS_NP "