Add option to set maximum frequency adjustment.
The option sets an additional limit to the hardware limit. It's disabled if set to zero. The default is 900000000 ppb. Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>master
parent
4929d50a3f
commit
3012cf0540
5
config.c
5
config.c
|
@ -290,6 +290,11 @@ static enum parser_result parse_global_setting(const char *option,
|
|||
return BAD_VALUE;
|
||||
*cfg->pi_offset_const = df;
|
||||
|
||||
} else if (!strcmp(option, "pi_max_frequency")) {
|
||||
if (1 != sscanf(value, "%d", &val) || !(val >= 0))
|
||||
return BAD_VALUE;
|
||||
*cfg->pi_max_frequency = val;
|
||||
|
||||
} else if (!strcmp(option, "ptp_dst_mac")) {
|
||||
if (MAC_LEN != sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
|
||||
&mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]))
|
||||
|
|
1
config.h
1
config.h
|
@ -68,6 +68,7 @@ struct config {
|
|||
double *pi_proportional_const;
|
||||
double *pi_integral_const;
|
||||
double *pi_offset_const;
|
||||
int *pi_max_frequency;
|
||||
|
||||
unsigned char *ptp_dst_mac;
|
||||
unsigned char *p2p_dst_mac;
|
||||
|
|
|
@ -41,6 +41,7 @@ kernel_leap 1
|
|||
pi_proportional_const 0.0
|
||||
pi_integral_const 0.0
|
||||
pi_offset_const 0.0
|
||||
pi_max_frequency 900000000
|
||||
clock_servo pi
|
||||
#
|
||||
# Transport options
|
||||
|
|
1
gPTP.cfg
1
gPTP.cfg
|
@ -40,6 +40,7 @@ kernel_leap 1
|
|||
pi_proportional_const 0.0
|
||||
pi_integral_const 0.0
|
||||
pi_offset_const 0.0
|
||||
pi_max_frequency 900000000
|
||||
clock_servo pi
|
||||
#
|
||||
# Transport options
|
||||
|
|
7
pi.c
7
pi.c
|
@ -31,10 +31,11 @@
|
|||
|
||||
#define NSEC_PER_SEC 1000000000
|
||||
|
||||
/* These two take their values from the configuration file. (see ptp4l.c) */
|
||||
/* These take their values from the configuration file. (see ptp4l.c) */
|
||||
double configured_pi_kp = 0.0;
|
||||
double configured_pi_ki = 0.0;
|
||||
double configured_pi_offset = 0.0;
|
||||
int configured_pi_max_freq = 900000000;
|
||||
|
||||
struct pi_servo {
|
||||
struct servo servo;
|
||||
|
@ -150,5 +151,9 @@ struct servo *pi_servo_create(int fadj, int max_ppb, int sw_ts)
|
|||
s->max_offset = 0.0;
|
||||
}
|
||||
|
||||
if (configured_pi_max_freq && s->maxppb > configured_pi_max_freq) {
|
||||
s->maxppb = configured_pi_max_freq;
|
||||
}
|
||||
|
||||
return &s->servo;
|
||||
}
|
||||
|
|
6
pi.h
6
pi.h
|
@ -42,6 +42,12 @@ extern double configured_pi_ki;
|
|||
*/
|
||||
extern double configured_pi_offset;
|
||||
|
||||
/**
|
||||
* When set to a non-zero value, this variable sets an additional limit for
|
||||
* the frequency adjustment of the clock. It's in ppb.
|
||||
*/
|
||||
extern int configured_pi_max_freq;
|
||||
|
||||
struct servo *pi_servo_create(int fadj, int max_ppb, int sw_ts);
|
||||
|
||||
#endif
|
||||
|
|
6
ptp4l.8
6
ptp4l.8
|
@ -292,6 +292,12 @@ frequency instead of stepping the clock. When set to 0.0, the controller will
|
|||
never step the clock.
|
||||
The default is 0.0.
|
||||
.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
|
||||
set to 0, the hardware limit will be used.
|
||||
The default is 900000000 (90%).
|
||||
.TP
|
||||
.B ptp_dst_mac
|
||||
The MAC address where should be PTP messages sent.
|
||||
Relevant only with L2 transport. The default is 01:1B:19:00:00:00.
|
||||
|
|
1
ptp4l.c
1
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_max_frequency = &configured_pi_max_freq,
|
||||
|
||||
.ptp_dst_mac = ptp_dst_mac,
|
||||
.p2p_dst_mac = p2p_dst_mac,
|
||||
|
|
Loading…
Reference in New Issue