port: allow running a boundary clock with multiple clock devices.
If the user has configured the appropriate option, then simply warn about the clock device mismatch, and then go on in "JBOD" mode. Whenever the port enters the uncalibrated state, it tells the clock to switch to the new PHC device. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
a96797a7fc
commit
e706f48981
1
fault.c
1
fault.c
|
@ -21,6 +21,7 @@
|
|||
static const char *fault_type_str[FT_CNT] = {
|
||||
"FT_UNSPECIFIED",
|
||||
"FT_BAD_PEER_NETWORK",
|
||||
"FT_SWITCH_PHC",
|
||||
};
|
||||
|
||||
const char *ft_str(enum fault_type ft)
|
||||
|
|
1
fault.h
1
fault.h
|
@ -21,6 +21,7 @@
|
|||
enum fault_type {
|
||||
FT_UNSPECIFIED = 0,
|
||||
FT_BAD_PEER_NETWORK,
|
||||
FT_SWITCH_PHC,
|
||||
FT_CNT,
|
||||
};
|
||||
|
||||
|
|
22
port.c
22
port.c
|
@ -29,6 +29,7 @@
|
|||
#include "filter.h"
|
||||
#include "missing.h"
|
||||
#include "msg.h"
|
||||
#include "phc.h"
|
||||
#include "port.h"
|
||||
#include "print.h"
|
||||
#include "sk.h"
|
||||
|
@ -68,6 +69,8 @@ struct port {
|
|||
enum timestamp_type timestamping;
|
||||
struct fdarray fda;
|
||||
int fault_fd;
|
||||
int phc_index;
|
||||
int jbod;
|
||||
struct foreign_clock *best;
|
||||
enum syfu_state syfu;
|
||||
struct ptp_message *last_syncfup;
|
||||
|
@ -2138,6 +2141,15 @@ int port_dispatch(struct port *p, enum fsm_event event, int mdiff)
|
|||
|
||||
p->state = next;
|
||||
port_notify_event(p, NOTIFY_PORT_STATE);
|
||||
|
||||
if (p->jbod && next == PS_UNCALIBRATED) {
|
||||
if (clock_switch_phc(p->clock, p->phc_index)) {
|
||||
p->last_fault_type = FT_SWITCH_PHC;
|
||||
return port_dispatch(p, EV_FAULT_DETECTED, 0);
|
||||
}
|
||||
clock_sync_interval(p->clock, p->log_sync_interval);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2483,16 +2495,24 @@ struct port *port_open(int phc_index,
|
|||
|
||||
memset(p, 0, sizeof(*p));
|
||||
|
||||
p->phc_index = phc_index;
|
||||
p->jbod = interface->boundary_clock_jbod;
|
||||
|
||||
if (interface->transport == TRANS_UDS)
|
||||
; /* UDS cannot have a PHC. */
|
||||
else if (!interface->ts_info.valid)
|
||||
pr_warning("port %d: get_ts_info not supported", number);
|
||||
else if (phc_index >= 0 && phc_index != interface->ts_info.phc_index) {
|
||||
if (interface->boundary_clock_jbod) {
|
||||
pr_warning("port %d: just a bunch of devices", number);
|
||||
p->phc_index = interface->ts_info.phc_index;
|
||||
} else {
|
||||
pr_err("port %d: PHC device mismatch", number);
|
||||
pr_err("port %d: /dev/ptp%d requested, but /dev/ptp%d attached",
|
||||
pr_err("port %d: /dev/ptp%d requested, ptp%d attached",
|
||||
number, phc_index, interface->ts_info.phc_index);
|
||||
goto err_port;
|
||||
}
|
||||
}
|
||||
|
||||
p->pod = interface->pod;
|
||||
p->name = interface->name;
|
||||
|
|
Loading…
Reference in New Issue