Signed-off-by: Richard Cochran <[email protected]>
---
 config.c |    6 ++++++
 gPTP.cfg |    2 +-
 ptp4l.8  |    7 +++++++
 ptp4l.c  |    8 +++++++-
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/config.c b/config.c
index c86ab01..cfe36b8 100644
--- a/config.c
+++ b/config.c
@@ -255,6 +255,12 @@ static enum parser_result parse_global_setting(const char 
*option,
                                dds->flags &= ~DDS_SLAVE_ONLY;
                }
 
+       } else if (!strcmp(option, "gmCapable")) {
+               r = get_ranged_int(value, &val, 0, 1);
+               if (r != PARSED_OK)
+                       return r;
+               cfg->dds.grand_master_capable = val;
+
        } else if (!strcmp(option, "priority1")) {
                r = get_ranged_uint(value, &uval, 0, UINT8_MAX);
                if (r != PARSED_OK)
diff --git a/gPTP.cfg b/gPTP.cfg
index 3c0842c..249269e 100644
--- a/gPTP.cfg
+++ b/gPTP.cfg
@@ -3,7 +3,7 @@
 # Default Data Set
 #
 twoStepFlag            1
-slaveOnly              0
+gmCapable              1
 priority1              248
 priority2              248
 domainNumber           0
diff --git a/ptp4l.8 b/ptp4l.8
index c59b6e7..5cf642f 100644
--- a/ptp4l.8
+++ b/ptp4l.8
@@ -212,8 +212,15 @@ The default is 1 (enabled).
 .TP
 .B slaveOnly
 The local clock is a slave-only clock if enabled.
+This option is only for use with 1588 clocks and should not be enabled
+for 802.1AS clocks.
 The default is 0 (disabled).
 .TP
+.B gmCapable
+If this option is enabled, then the local clock is able to become grand master.
+This is only for use with 802.1AS clocks and has no effect on 1588 clocks.
+The default is 1 (enabled).
+.TP
 .B priority1
 The priority1 attribute of the local clock. It is used in the best master
 selection algorithm, lower values take precedence. Must be in the range 0 to
diff --git a/ptp4l.c b/ptp4l.c
index e86dd91..d9bb470 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -284,7 +284,13 @@ int main(int argc, char *argv[])
        if (config && (c = config_read(config, &cfg_settings))) {
                return c;
        }
-       if (ds->flags & DDS_SLAVE_ONLY) {
+       if (!cfg_settings.dds.grand_master_capable &&
+           ds->flags & DDS_SLAVE_ONLY) {
+               fprintf(stderr, "Invalid slaveOnly = 1 with gmCapable = 0.\n");
+               return -1;
+       }
+       if (!cfg_settings.dds.grand_master_capable ||
+           ds->flags & DDS_SLAVE_ONLY) {
                ds->clockQuality.clockClass = 255;
        }
 
-- 
1.7.10.4


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to