Discussion:
[Linuxptp-devel] [PATCH] ptp4l: add support for using configured_pi_f_offset servo option
Ken ICHIKAWA
2013-06-21 07:55:44 UTC
Permalink
This patch adds support for using the configured_pi_f_offset servo option to ptp4l.
If "pi_f_offset_const 0.0" is specified in the config file, stepping on the first
update is prevented. If any other positive value is specified, stepping on the
first update occurs when the offset is larger than the specified value.

Signed-off-by: Ken ICHIKAWA <***@jp.fujitsu.com>
---
config.c | 6 ++++++
config.h | 1 +
ptp4l.8 | 8 +++++++-
ptp4l.c | 1 +
4 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/config.c b/config.c
index f2a78d4..ad63bba 100644
--- a/config.c
+++ b/config.c
@@ -313,6 +313,12 @@ static enum parser_result parse_global_setting(const char *option,
return r;
*cfg->pi_offset_const = df;

+ } else if (!strcmp(option, "pi_f_offset_const")) {
+ r = get_ranged_double(value, &df, 0.0, DBL_MAX);
+ if (r != PARSED_OK)
+ return r;
+ *cfg->pi_f_offset_const = df;
+
} else if (!strcmp(option, "pi_max_frequency")) {
r = get_ranged_int(value, &val, 0, INT_MAX);
if (r != PARSED_OK)
diff --git a/config.h b/config.h
index d4a58b3..c5de3ff 100644
--- a/config.h
+++ b/config.h
@@ -76,6 +76,7 @@ struct config {
double *pi_proportional_const;
double *pi_integral_const;
double *pi_offset_const;
+ double *pi_f_offset_const;
int *pi_max_frequency;

unsigned char *ptp_dst_mac;
diff --git a/ptp4l.8 b/ptp4l.8
index 43a8697..fb49b21 100644
--- a/ptp4l.8
+++ b/ptp4l.8
@@ -268,9 +268,15 @@ The default is 0.0.
.B pi_offset_const
The maximum offset the PI controller will correct by changing the clock
frequency instead of stepping the clock. When set to 0.0, the controller will
-never step the clock.
+never step the clock except on start.
The default is 0.0.
.TP
+.B pi_f_offset_const
+The maximum offset the PI controller will correct by changing the clock
+frequency instead of stepping the clock. This is only applied on the first
+update. When set to 0.0, the controller won't step the clock on start.
+The default is 0.0000001 (100 nanoseconds).
+.TP
.B pi_max_frequency
The maximum allowed frequency adjustment of the clock in parts per billion
(ppb). This is an additional limit to the maximum allowed by the hardware. When
diff --git a/ptp4l.c b/ptp4l.c
index 8ad58bf..1e0304e 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -96,6 +96,7 @@ static struct config cfg_settings = {
.pi_proportional_const = &configured_pi_kp,
.pi_integral_const = &configured_pi_ki,
.pi_offset_const = &configured_pi_offset,
+ .pi_f_offset_const = &configured_pi_f_offset,
.pi_max_frequency = &configured_pi_max_freq,

.ptp_dst_mac = ptp_dst_mac,
--
1.7.1
Miroslav Lichvar
2013-06-24 14:10:49 UTC
Permalink
Post by Ken ICHIKAWA
This patch adds support for using the configured_pi_f_offset servo option to ptp4l.
If "pi_f_offset_const 0.0" is specified in the config file, stepping on the first
update is prevented. If any other positive value is specified, stepping on the
first update occurs when the offset is larger than the specified value.
---
config.c | 6 ++++++
config.h | 1 +
ptp4l.8 | 8 +++++++-
ptp4l.c | 1 +
4 files changed, 15 insertions(+), 1 deletions(-)
Can you please also add the new option to default.cfg and gPTP.cfg?

Thanks,
--
Miroslav Lichvar
Ken ICHIKAWA
2013-06-24 23:58:55 UTC
Permalink
Post by Miroslav Lichvar
Post by Ken ICHIKAWA
This patch adds support for using the configured_pi_f_offset servo option to ptp4l.
If "pi_f_offset_const 0.0" is specified in the config file, stepping on the first
update is prevented. If any other positive value is specified, stepping on the
first update occurs when the offset is larger than the specified value.
---
config.c | 6 ++++++
config.h | 1 +
ptp4l.8 | 8 +++++++-
ptp4l.c | 1 +
4 files changed, 15 insertions(+), 1 deletions(-)
Can you please also add the new option to default.cfg and gPTP.cfg?
OK. Thank you for pointing it out.

Ken ICHIKAWA

Loading...