port: switch PHC in jbod mode when in UNCALIBRATED or SLAVE state

In the (still downstream) patch "Add BMCA support for IEEE
802.1AS-2011", we are making ieee8021as_fsm() skip the UNCALIBRATED
state. This means that the PHC on which the servo loop is applied will
never be switched in JBOD mode. Make the switching logic take place
either on a MASTER to SLAVE, or on a MASTER to UNCALIBRATED transition.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
master
Vladimir Oltean 2020-08-01 20:06:09 +03:00
parent 76657d6da3
commit 8001bd3c4e
1 changed files with 8 additions and 1 deletions

9
port.c
View File

@ -2597,6 +2597,8 @@ void port_dispatch(struct port *p, enum fsm_event event, int mdiff)
static void bc_dispatch(struct port *p, enum fsm_event event, int mdiff)
{
enum port_state switching_state;
if (clock_slave_only(p->clock)) {
if (event == EV_RS_MASTER || event == EV_RS_GRAND_MASTER) {
port_slave_priority_warning(p);
@ -2613,7 +2615,12 @@ static void bc_dispatch(struct port *p, enum fsm_event event, int mdiff)
port_e2e_transition(p, p->state);
}
if (p->jbod && p->state == PS_UNCALIBRATED) {
if (port_is_ieee8021as(p))
switching_state = PS_SLAVE;
else
switching_state = PS_UNCALIBRATED;
if (p->jbod && p->state == switching_state) {
if (clock_switch_phc(p->clock, p->phc_index)) {
p->last_fault_type = FT_SWITCH_PHC;
port_dispatch(p, EV_FAULT_DETECTED, 0);