Added get and set handling of mentioned tlv

Signed-off-by: Anders Selhammer <[email protected]>
---
 pmc.c        |  5 +++++
 pmc_common.c | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/pmc.c b/pmc.c
index 440c905..69ac2df 100644
--- a/pmc.c
+++ b/pmc.c
@@ -342,6 +342,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
                fprintf(fp, "VERSION_NUMBER "
                        IFMT "versionNumber %hhu", mtd->val);
                break;
+       case TLV_UNICAST_NEGOTIATION_ENABLE:
+               mtd = (struct management_tlv_datum *) mgt->data;
+               fprintf(fp, "UNICAST_NEGOTIATION_ENABLE "
+                       IFMT "unicastNegotiationEnable %hhu", mtd->val);
+               break;
        case TLV_DELAY_MECHANISM:
                mtd = (struct management_tlv_datum *) mgt->data;
                fprintf(fp, "DELAY_MECHANISM "
diff --git a/pmc_common.c b/pmc_common.c
index 4a160f6..3cd5e57 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -111,7 +111,7 @@ struct management_id idtab[] = {
        { "VERSION_NUMBER", TLV_VERSION_NUMBER, do_get_action },
        { "ENABLE_PORT", TLV_ENABLE_PORT, not_supported },
        { "DISABLE_PORT", TLV_DISABLE_PORT, not_supported },
-       { "UNICAST_NEGOTIATION_ENABLE", TLV_UNICAST_NEGOTIATION_ENABLE, 
not_supported },
+       { "UNICAST_NEGOTIATION_ENABLE", TLV_UNICAST_NEGOTIATION_ENABLE, 
do_set_action },
        { "UNICAST_MASTER_TABLE", TLV_UNICAST_MASTER_TABLE, not_supported },
        { "UNICAST_MASTER_MAX_TABLE_SIZE", TLV_UNICAST_MASTER_MAX_TABLE_SIZE, 
not_supported },
        { "ACCEPTABLE_MASTER_TABLE_ENABLED", 
TLV_ACCEPTABLE_MASTER_TABLE_ENABLED, not_supported },
@@ -208,6 +208,15 @@ static void do_set_action(struct pmc *pmc, int action, int 
index, char *str)
                        gsn.time_flags |= FREQ_TRACEABLE;
                pmc_send_set_action(pmc, code, &gsn, sizeof(gsn));
                break;
+       case TLV_UNICAST_NEGOTIATION_ENABLE:
+               cnt = sscanf(str,  " %*s %*s %hhu", &mtd.val);
+               if (cnt != 1) {
+                       fprintf(stderr, "%s SET needs 1 value\n",
+                               idtab[index].name);
+                       break;
+               }
+               pmc_send_set_action(pmc, code, &mtd, sizeof(mtd));
+               break;
        case TLV_PORT_DATA_SET_NP:
                cnt = sscanf(str, " %*s %*s "
                             "neighborPropDelayThresh %u "
@@ -471,6 +480,7 @@ static int pmc_tlv_datalen(struct pmc *pmc, int id)
        case TLV_ANNOUNCE_RECEIPT_TIMEOUT:
        case TLV_LOG_SYNC_INTERVAL:
        case TLV_VERSION_NUMBER:
+       case TLV_UNICAST_NEGOTIATION_ENABLE:
        case TLV_DELAY_MECHANISM:
        case TLV_LOG_MIN_PDELAY_REQ_INTERVAL:
                len += sizeof(struct management_tlv_datum);
-- 
1.8.3.1



_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to