This patch lets the pmc program change the priority1 and priority2
elements of the "default data set" at run time.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 pmc.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/pmc.c b/pmc.c
index d58e190..c21911c 100644
--- a/pmc.c
+++ b/pmc.c
@@ -66,8 +66,8 @@ struct management_id idtab[] = {
        { "CURRENT_DATA_SET", TLV_CURRENT_DATA_SET, do_get_action },
        { "PARENT_DATA_SET", TLV_PARENT_DATA_SET, do_get_action },
        { "TIME_PROPERTIES_DATA_SET", TLV_TIME_PROPERTIES_DATA_SET, 
do_get_action },
-       { "PRIORITY1", TLV_PRIORITY1, do_get_action },
-       { "PRIORITY2", TLV_PRIORITY2, do_get_action },
+       { "PRIORITY1", TLV_PRIORITY1, do_set_action },
+       { "PRIORITY2", TLV_PRIORITY2, do_set_action },
        { "DOMAIN", TLV_DOMAIN, do_get_action },
        { "SLAVE_ONLY", TLV_SLAVE_ONLY, do_get_action },
        { "TIME", TLV_TIME, not_supported },
@@ -493,6 +493,7 @@ static void do_get_action(int action, int index, char *str)
 static void do_set_action(int action, int index, char *str)
 {
        struct grandmaster_settings_np gsn;
+       struct management_tlv_datum mtd;
        struct port_ds_np pnp;
        int cnt, code = idtab[index].code;
        int leap_61, leap_59, utc_off_valid;
@@ -513,6 +514,24 @@ static void do_set_action(int action, int index, char *str)
                return;
        }
        switch (code) {
+       case TLV_PRIORITY1:
+               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_PRIORITY2:
+               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_GRANDMASTER_SETTINGS_NP:
                cnt = sscanf(str, " %*s %*s "
                             "clockClass              %hhu "
-- 
2.1.4


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to