This patch enables setting the domainNumber via the pmc command in runtime.

Signed-off-by: Petr Kulhavy <br...@jikos.cz>
---
 clock.c | 6 ++++++
 pmc.c   | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/clock.c b/clock.c
index 629a160..a2a61a2 100644
--- a/clock.c
+++ b/clock.c
@@ -538,6 +538,12 @@ static int clock_management_set(struct clock *c, struct 
port *p,
                *changed = 1;
                respond = 1;
                break;
+       case TLV_DOMAIN:
+               mtd = (struct management_tlv_datum *) tlv->data;
+               c->dds.domainNumber = mtd->val;
+               *changed = 1;
+               respond = 1;
+               break;
        case TLV_GRANDMASTER_SETTINGS_NP:
                gsn = (struct grandmaster_settings_np *) tlv->data;
                c->dds.clockQuality = gsn->clockQuality;
diff --git a/pmc.c b/pmc.c
index cefa771..63e33b1 100644
--- a/pmc.c
+++ b/pmc.c
@@ -68,7 +68,7 @@ struct management_id idtab[] = {
        { "TIME_PROPERTIES_DATA_SET", TLV_TIME_PROPERTIES_DATA_SET, 
do_get_action },
        { "PRIORITY1", TLV_PRIORITY1, do_set_action },
        { "PRIORITY2", TLV_PRIORITY2, do_set_action },
-       { "DOMAIN", TLV_DOMAIN, do_get_action },
+       { "DOMAIN", TLV_DOMAIN, do_set_action },
        { "SLAVE_ONLY", TLV_SLAVE_ONLY, do_get_action },
        { "TIME", TLV_TIME, not_supported },
        { "CLOCK_ACCURACY", TLV_CLOCK_ACCURACY, do_get_action },
@@ -516,6 +516,7 @@ static void do_set_action(int action, int index, char *str)
        switch (code) {
        case TLV_PRIORITY1:
        case TLV_PRIORITY2:
+       case TLV_DOMAIN:
                cnt = sscanf(str,  " %*s %*s %hhu", &mtd.val);
                if (cnt != 1) {
                        fprintf(stderr, "%s SET needs 1 value\n",
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to