Add missing attribute maxStepsRemoved which is included for
telecom profile

Signed-off-by: Anders Selhammer <anders.selham...@est.tech>
---
 clock.c              |  7 +++++++
 clock.h              |  7 +++++++
 config.c             |  1 +
 configs/G.8275.1.cfg |  9 +++++----
 configs/G.8275.2.cfg | 25 +++++++++++++------------
 configs/default.cfg  |  1 +
 ds.h                 |  1 +
 port.c               |  5 +----
 8 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/clock.c b/clock.c
index faf2dea..cbe7dea 100644
--- a/clock.c
+++ b/clock.c
@@ -930,6 +930,8 @@ struct clock *clock_create(enum clock_type type, struct 
config *config,
        }
        c->default_dataset.localPriority =
                config_get_int(config, NULL, "G.8275.defaultDS.localPriority");
+       c->default_dataset.maxStepsRemoved =
+               config_get_int(config, NULL,"G.8275.defaultDS.maxStepsRemoved");
 
        /* Harmonize the twoStepFlag with the time_stamping option. */
        if (config_harmonize_onestep(config)) {
@@ -1564,6 +1566,11 @@ int clock_slave_only(struct clock *c)
        return c->dds.flags & DDS_SLAVE_ONLY;
 }
 
+UInteger8 clock_max_steps_removed(struct clock *c)
+{
+       return c->default_dataset.maxStepsRemoved;
+}
+
 UInteger16 clock_steps_removed(struct clock *c)
 {
        return c->cur.stepsRemoved;
diff --git a/clock.h b/clock.h
index cc2910a..07aba18 100644
--- a/clock.h
+++ b/clock.h
@@ -261,6 +261,13 @@ int clock_poll(struct clock *c);
 int clock_slave_only(struct clock *c);
 
 /**
+ * Obtain the max steps removed field from a clock's default data set.
+ * @param c  The clock instance.
+ * @return   The value of the clock's max steps removed field.
+ */
+UInteger8 clock_max_steps_removed(struct clock *c);
+
+/**
  * Obtain the steps removed field from a clock's current data set.
  * @param c  The clock instance.
  * @return   The value of the clock's steps removed field.
diff --git a/config.c b/config.c
index 7914ba4..f603b26 100644
--- a/config.c
+++ b/config.c
@@ -213,6 +213,7 @@ struct config_item config_tab[] = {
        GLOB_ITEM_INT("free_running", 0, 0, 1),
        PORT_ITEM_INT("freq_est_interval", 1, 0, INT_MAX),
        GLOB_ITEM_INT("G.8275.defaultDS.localPriority", 128, 1, UINT8_MAX),
+       GLOB_ITEM_INT("G.8275.defaultDS.maxStepsRemoved", 255, 1, UINT8_MAX),
        PORT_ITEM_INT("G.8275.portDS.localPriority", 128, 1, UINT8_MAX),
        GLOB_ITEM_INT("gmCapable", 1, 0, 1),
        PORT_ITEM_INT("hybrid_e2e", 0, 0, 1),
diff --git a/configs/G.8275.1.cfg b/configs/G.8275.1.cfg
index f40cda0..e186b76 100644
--- a/configs/G.8275.1.cfg
+++ b/configs/G.8275.1.cfg
@@ -5,7 +5,8 @@
 # available options.
 #
 [global]
-dataset_comparison             G.8275.x
-G.8275.defaultDS.localPriority 128
-masterOnly                     0
-G.8275.portDS.localPriority    128
+dataset_comparison                     G.8275.x
+G.8275.defaultDS.localPriority         128
+G.8275.defaultDS.maxStepsRemoved       255
+masterOnly                             0
+G.8275.portDS.localPriority            128
diff --git a/configs/G.8275.2.cfg b/configs/G.8275.2.cfg
index 3d7a908..810ad75 100644
--- a/configs/G.8275.2.cfg
+++ b/configs/G.8275.2.cfg
@@ -5,21 +5,22 @@
 # available options.
 #
 [global]
-dataset_comparison             G.8275.x
-G.8275.defaultDS.localPriority 128
-masterOnly                     0
-G.8275.portDS.localPriority    128
-hybrid_e2e                     1
-inhibit_multicast_service      1
-unicast_listen                 1
-unicast_req_duration           60
+dataset_comparison                     G.8275.x
+G.8275.defaultDS.localPriority         128
+G.8275.defaultDS.maxStepsRemoved       255
+masterOnly                             0
+G.8275.portDS.localPriority            128
+hybrid_e2e                             1
+inhibit_multicast_service              1
+unicast_listen                         1
+unicast_req_duration                   60
 #
 # Customize the following for slave operation:
 #
 #[unicast_master_table]
-#table_id                      1
-#logQueryInterval              2
-#UDPv4                         192.168.1.11
+#table_id                              1
+#logQueryInterval                      2
+#UDPv4                                 192.168.1.11
 #
 #[eth0]
-#unicast_master_table          1
+#unicast_master_table                  1
diff --git a/configs/default.cfg b/configs/default.cfg
index c5a8b57..9aef98f 100644
--- a/configs/default.cfg
+++ b/configs/default.cfg
@@ -17,6 +17,7 @@ dscp_event            0
 dscp_general           0
 dataset_comparison     ieee1588
 G.8275.defaultDS.localPriority 128
+G.8275.defaultDS.maxStepsRemoved       255
 #
 # Port Data Set
 #
diff --git a/ds.h b/ds.h
index 9d9c417..0590fa6 100644
--- a/ds.h
+++ b/ds.h
@@ -56,6 +56,7 @@ struct dataset {
        struct ClockQuality  quality;
        UInteger8            priority2;
        UInteger8            localPriority; /* Telecom Profile only */
+       UInteger8            maxStepsRemoved; /* Telecom Profile only */
        UInteger16           stepsRemoved;
        struct PortIdentity  sender;
        struct PortIdentity  receiver;
diff --git a/port.c b/port.c
index 5e0aed7..01e99a2 100644
--- a/port.c
+++ b/port.c
@@ -1711,10 +1711,7 @@ int process_announce(struct port *p, struct ptp_message 
*m)
 {
        int result = 0;
 
-       /* Do not qualify announce messages with stepsRemoved >= 255, see
-        * IEEE1588-2008 section 9.3.2.5 (d)
-        */
-       if (m->announce.stepsRemoved >= 255) {
+       if (m->announce.stepsRemoved >= clock_max_steps_removed(p->clock)) {
                return result;
        }
 
-- 
1.8.3.1



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

Reply via email to