Add support for the priority1 management request.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2013-03-03 19:41:06 +01:00
parent 49699c7830
commit f0c0f7b121
2 changed files with 14 additions and 1 deletions

View File

@ -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;

8
pmc.c
View File

@ -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 "