Add support for the free-running mode that will not adjust the sink
clock when enabled.
V2: changed implementation to instantiate NTPSHM servo that serves as
the nochange servo
Signed-off-by: Maciek Machnikowski <[email protected]>
---
phc2sys.8 | 4 ++++
phc2sys.c | 9 ++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/phc2sys.8 b/phc2sys.8
index 99fc937..42f2bdb 100644
--- a/phc2sys.8
+++ b/phc2sys.8
@@ -323,6 +323,10 @@ Same as option
.B \-E
(see above).
+.TP
+.B free-running
+Don't adjust the sink clock if enabled. The default is 0 (disabled).
+
.TP
.B transportSpecific
The transport specific field. Must be in the range 0 to 255.
diff --git a/phc2sys.c b/phc2sys.c
index 599f9bd..007ae21 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -103,6 +103,7 @@ struct phc2sys_private {
int forced_sync_offset;
int kernel_leap;
int state_changed;
+ int free_running;
struct pmc_agent *agent;
LIST_HEAD(port_head, port) ports;
LIST_HEAD(clock_head, clock) clocks;
@@ -129,7 +130,8 @@ static struct servo *servo_add(struct phc2sys_private *priv,
ppb = clockadj_get_freq(clock->clkid);
/* The reading may silently fail and return 0, reset the frequency to
make sure ppb is the actual frequency of the clock. */
- clockadj_set_freq(clock->clkid, ppb);
+ if (!priv->free_running)
+ clockadj_set_freq(clock->clkid, ppb);
if (clock->clkid == CLOCK_REALTIME) {
sysclk_set_leap(0);
max_ppb = sysclk_max_freq();
@@ -1280,6 +1282,11 @@ int main(int argc, char *argv[])
print_set_level(config_get_int(cfg, NULL, "logging_level"));
priv.servo_type = config_get_int(cfg, NULL, "clock_servo");
+ priv.free_running = config_get_int(cfg, NULL, "free_running");
+ if (priv.free_running) {
+ priv.servo_type = CLOCK_SERVO_NTPSHM;
+ }
+
if (priv.servo_type == CLOCK_SERVO_NTPSHM) {
config_set_int(cfg, "kernel_leap", 0);
config_set_int(cfg, "sanity_freq_limit", 0);
--
2.36.1
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel