The value comes from configuration on start up.
Our configuration file is read only.

The patch only implement a read operation (GET).

Erez


From: luigi.mantell...@sm-optics.com <luigi.mantell...@sm-optics.com>
Sent: Monday, 24 May 2021 08:53
To: linuxptp-devel@lists.sourceforge.net; Geva, Erez (ext) (DI PA DCP R&D 3) 
<erez.geva....@siemens.com>
Subject: R: [Linuxptp-devel] [PATCH v3 1/1] Add master only management TLV

Dear Erez,
Dear All,

I think that the value should  be stored into config also, because after a 
fault the complete configuration is reloaded.

ciao

luigi



________________________________
Luigi Mantellini
Senior Software Developer
Tel. (+39) 342 182 3893
luigi.mantell...@sm-optics.com<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fluigi.mantellini%40sm-optics.com%2F&data=04%7C01%7Cerez.geva.ext%40siemens.com%7C4a38427813cc4ecb904408d91e8089c6%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637574359810160636%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6uKXmqFQcovr4ER6wBcgp60uQOruvzk2MxtN2lu%2FGeY%3D&reserved=0>

<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.sm-optics.com%2F&data=04%7C01%7Cerez.geva.ext%40siemens.com%7C4a38427813cc4ecb904408d91e8089c6%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637574359810170631%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=fGz5tzKXZLDB5zUp7Q3SvwrJn91yoYiB0HIwoprxqNM%3D&reserved=0>
SM-Optics
SIAE Microelettronica Group
Via Michelangelo Buonarroti, 1
20093 Cologno Monzese, Milano
ITALY
Tel. (+39) 02 273 251
Fax (+39) 02 253 91585
https://www.sm-optics.com/<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.sm-optics.com%2F&data=04%7C01%7Cerez.geva.ext%40siemens.com%7C4a38427813cc4ecb904408d91e8089c6%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637574359810170631%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=fGz5tzKXZLDB5zUp7Q3SvwrJn91yoYiB0HIwoprxqNM%3D&reserved=0>

>>> Erez Geva <erez.geva....@siemens.com<mailto:erez.geva....@siemens.com>> 
>>> 24/05/21 1.25 >>>
- Add support in the pmc tool
- Add the TLV in port module.

Signed-off-by: Erez Geva 
<erez.geva....@siemens.com<mailto:erez.geva....@siemens.com>>
---
pmc.c | 5 +++++
pmc_common.c | 2 ++
port.c | 6 ++++++
3 files changed, 13 insertions(+)

diff --git a/pmc.c b/pmc.c
index a767c8a..00d6014 100644
--- a/pmc.c
+++ b/pmc.c
@@ -335,6 +335,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
        fprintf(fp, "TIMESCALE_PROPERTIES "
            IFMT "ptpTimescale %d", mtd->val & PTP_TIMESCALE ? 1 : 0);
        break;
+    case TLV_MASTER_ONLY:
+        mtd = (struct management_tlv_datum *) mgt->data;
+        fprintf(fp, "MASTER_ONLY "
+            IFMT "masterOnly %d", mtd->val);
+        break;
    case TLV_TIME_STATUS_NP:
        tsn = (struct time_status_np *) mgt->data;
        fprintf(fp, "TIME_STATUS_NP "
diff --git a/pmc_common.c b/pmc_common.c
index c5cd992..101df55 100644
--- a/pmc_common.c
+++ b/pmc_common.c
@@ -104,6 +104,7 @@ struct management_id idtab[] = {
    { "ALTERNATE_TIME_OFFSET_NAME", TLV_ALTERNATE_TIME_OFFSET_NAME, 
not_supported },
    { "ALTERNATE_TIME_OFFSET_MAX_KEY", TLV_ALTERNATE_TIME_OFFSET_MAX_KEY, 
not_supported },
    { "ALTERNATE_TIME_OFFSET_PROPERTIES", TLV_ALTERNATE_TIME_OFFSET_PROPERTIES, 
not_supported },
+    { "MASTER_ONLY", TLV_MASTER_ONLY, do_get_action },
    { "TRANSPARENT_CLOCK_DEFAULT_DATA_SET", 
TLV_TRANSPARENT_CLOCK_DEFAULT_DATA_SET, not_supported },
    { "PRIMARY_DOMAIN", TLV_PRIMARY_DOMAIN, not_supported },
    { "TIME_STATUS_NP", TLV_TIME_STATUS_NP, do_get_action },
@@ -510,6 +511,7 @@ static int pmc_tlv_datalen(struct pmc *pmc, int id)
    case TLV_CLOCK_ACCURACY:
    case TLV_TRACEABILITY_PROPERTIES:
    case TLV_TIMESCALE_PROPERTIES:
+    case TLV_MASTER_ONLY:
        len += sizeof(struct management_tlv_datum);
        break;
    case TLV_TIME_STATUS_NP:
diff --git a/port.c b/port.c
index 10bb9e1..250d46d 100644
--- a/port.c
+++ b/port.c
@@ -924,6 +924,11 @@ static int port_management_fill_response(struct port 
*target,
        mtd->val = target->versionNumber;
        datalen = sizeof(*mtd);
        break;
+    case TLV_MASTER_ONLY:
+        mtd = (struct management_tlv_datum *) tlv->data;
+        mtd->val = target->master_only;
+        datalen = sizeof(*mtd);
+        break;
    case TLV_DELAY_MECHANISM:
        mtd = (struct management_tlv_datum *) tlv->data;
        if (target->delayMechanism)
@@ -2898,6 +2903,7 @@ int port_manage(struct port *p, struct port *ingress, 
struct ptp_message *msg)
    case TLV_UNICAST_MASTER_MAX_TABLE_SIZE:
    case TLV_ACCEPTABLE_MASTER_TABLE_ENABLED:
    case TLV_ALTERNATE_MASTER:
+    case TLV_MASTER_ONLY:
    case TLV_TRANSPARENT_CLOCK_PORT_DATA_SET:
    case TLV_DELAY_MECHANISM:
    case TLV_LOG_MIN_PDELAY_REQ_INTERVAL:
--
2.20.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net<mailto:Linuxptp-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to