Add an option to assume two step messaging.
Some commercial 802.1AS switches do not feel obliged to set the two step flag. When we try to synchronize to their apparent one step sync messages, nothing good happens. This commit adds a global option to work around the issue. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
4b0f4fda42
commit
eed8ed05c8
4
config.c
4
config.c
|
@ -91,6 +91,10 @@ static void scan_line(char *s, struct config *cfg)
|
||||||
|
|
||||||
pod->transportSpecific = u8 << 4;
|
pod->transportSpecific = u8 << 4;
|
||||||
|
|
||||||
|
} else if (1 == sscanf(s, " assume_two_step %u", &val)) {
|
||||||
|
|
||||||
|
*cfg->assume_two_step = val ? 1 : 0;
|
||||||
|
|
||||||
} else if (1 == sscanf(s, " tx_timestamp_retries %u", &val)) {
|
} else if (1 == sscanf(s, " tx_timestamp_retries %u", &val)) {
|
||||||
|
|
||||||
if (val > 0)
|
if (val > 0)
|
||||||
|
|
1
config.h
1
config.h
|
@ -25,6 +25,7 @@
|
||||||
struct config {
|
struct config {
|
||||||
struct defaultDS *dds;
|
struct defaultDS *dds;
|
||||||
struct port_defaults *pod;
|
struct port_defaults *pod;
|
||||||
|
int *assume_two_step;
|
||||||
int *tx_timestamp_retries;
|
int *tx_timestamp_retries;
|
||||||
int *rx_timestamp_l2only;
|
int *rx_timestamp_l2only;
|
||||||
double *pi_proportional_const;
|
double *pi_proportional_const;
|
||||||
|
|
7
msg.h
7
msg.h
|
@ -284,6 +284,11 @@ void msg_put(struct ptp_message *m);
|
||||||
*/
|
*/
|
||||||
int msg_sots_missing(struct ptp_message *m);
|
int msg_sots_missing(struct ptp_message *m);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Work around buggy 802.1AS switches.
|
||||||
|
*/
|
||||||
|
extern int assume_two_step;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether a message is one-step message.
|
* Test whether a message is one-step message.
|
||||||
* @param m Message to test.
|
* @param m Message to test.
|
||||||
|
@ -291,6 +296,8 @@ int msg_sots_missing(struct ptp_message *m);
|
||||||
*/
|
*/
|
||||||
static inline Boolean one_step(struct ptp_message *m)
|
static inline Boolean one_step(struct ptp_message *m)
|
||||||
{
|
{
|
||||||
|
if (assume_two_step)
|
||||||
|
return 0;
|
||||||
return !field_is_set(m, 0, TWO_STEP);
|
return !field_is_set(m, 0, TWO_STEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
ptp4l.c
2
ptp4l.c
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#define DEFAULT_PHC "/dev/ptp0"
|
#define DEFAULT_PHC "/dev/ptp0"
|
||||||
|
|
||||||
|
int assume_two_step;
|
||||||
int sk_tx_retries = 2, sk_prefer_layer2 = 0; /*see sk.c*/
|
int sk_tx_retries = 2, sk_prefer_layer2 = 0; /*see sk.c*/
|
||||||
double configured_pi_kp, configured_pi_ki; /*see pi.c*/
|
double configured_pi_kp, configured_pi_ki; /*see pi.c*/
|
||||||
extern unsigned char ptp_dst_mac[]; /*see raw.c*/
|
extern unsigned char ptp_dst_mac[]; /*see raw.c*/
|
||||||
|
@ -219,6 +220,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
cfg_settings.dds = &ds;
|
cfg_settings.dds = &ds;
|
||||||
cfg_settings.pod = &pod;
|
cfg_settings.pod = &pod;
|
||||||
|
cfg_settings.assume_two_step = &assume_two_step;
|
||||||
cfg_settings.tx_timestamp_retries = &sk_tx_retries;
|
cfg_settings.tx_timestamp_retries = &sk_tx_retries;
|
||||||
cfg_settings.rx_timestamp_l2only = &sk_prefer_layer2;
|
cfg_settings.rx_timestamp_l2only = &sk_prefer_layer2;
|
||||||
cfg_settings.pi_proportional_const = &configured_pi_kp;
|
cfg_settings.pi_proportional_const = &configured_pi_kp;
|
||||||
|
|
Loading…
Reference in New Issue