Allow ORDINARY_CLOCK (OC) as doubly-attached clock according to IEC
62439-3:2016 standard.

Signed-off-by: Stephan Wurm <stephan.w...@a-eberle.de>
---
 ptp4l.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/ptp4l.c b/ptp4l.c
index c61175b..24a49f3 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -23,6 +23,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "bmc.h"
 #include "clock.h"
 #include "config.h"
 #include "ntpshm.h"
@@ -73,6 +74,7 @@ int main(int argc, char *argv[])
        char *config = NULL, *req_phc = NULL, *progname;
        enum clock_type type = CLOCK_TYPE_ORDINARY;
        int c, err = -1, index, print_level;
+       bool iec_dac = false;
        struct clock *clock = NULL;
        struct option *opts;
        struct config *cfg;
@@ -203,10 +205,18 @@ int main(int argc, char *argv[])
                goto out;
        }
 
+       if (config_get_int(cfg, NULL, "dataset_comparison") == 
DS_CMP_IEC62439_3) {
+               iec_dac = true;
+       }
+
        type = config_get_int(cfg, NULL, "clock_type");
        switch (type) {
        case CLOCK_TYPE_ORDINARY:
-               if (cfg->n_interfaces > 1) {
+               if ((!iec_dac && cfg->n_interfaces > 1) ||
+                   /* The IEC 62439-3 standard allows doubly attached ordinary
+                    * clocks
+                    */
+                   (iec_dac && cfg->n_interfaces > 2)) {
                        type = CLOCK_TYPE_BOUNDARY;
                }
                break;

-- 
2.34.1



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

Reply via email to