diff --git a/clock.c b/clock.c index b6e96cc..a1ede51 100644 --- a/clock.c +++ b/clock.c @@ -451,7 +451,8 @@ static void handle_state_decision_event(struct clock *c) break; case PS_GRAND_MASTER: clock_update_grandmaster(c); - /*fall through*/ + event = EV_RS_GRAND_MASTER; + break; case PS_MASTER: event = EV_RS_MASTER; break; diff --git a/fsm.c b/fsm.c index 1f142e4..476de45 100644 --- a/fsm.c +++ b/fsm.c @@ -62,6 +62,9 @@ enum port_state ptp_fsm(enum port_state state, enum fsm_event event) case EV_RS_MASTER: next = PS_PRE_MASTER; break; + case EV_RS_GRAND_MASTER: + next = PS_GRAND_MASTER; + break; case EV_RS_SLAVE: next = PS_UNCALIBRATED; break; @@ -129,6 +132,9 @@ enum port_state ptp_fsm(enum port_state state, enum fsm_event event) case EV_RS_MASTER: next = PS_PRE_MASTER; break; + case EV_RS_GRAND_MASTER: + next = PS_GRAND_MASTER; + break; case EV_RS_SLAVE: next = PS_UNCALIBRATED; break; @@ -154,6 +160,9 @@ enum port_state ptp_fsm(enum port_state state, enum fsm_event event) case EV_RS_MASTER: next = PS_PRE_MASTER; break; + case EV_RS_GRAND_MASTER: + next = PS_GRAND_MASTER; + break; case EV_RS_SLAVE: next = PS_UNCALIBRATED; break; @@ -182,6 +191,9 @@ enum port_state ptp_fsm(enum port_state state, enum fsm_event event) case EV_RS_MASTER: next = PS_PRE_MASTER; break; + case EV_RS_GRAND_MASTER: + next = PS_GRAND_MASTER; + break; case EV_RS_SLAVE: next = PS_UNCALIBRATED; break; @@ -237,6 +249,7 @@ enum port_state ptp_slave_fsm(enum port_state state, enum fsm_event event) break; case EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES: case EV_RS_MASTER: + case EV_RS_GRAND_MASTER: case EV_RS_PASSIVE: next = PS_LISTENING; break; @@ -258,6 +271,7 @@ enum port_state ptp_slave_fsm(enum port_state state, enum fsm_event event) break; case EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES: case EV_RS_MASTER: + case EV_RS_GRAND_MASTER: case EV_RS_PASSIVE: next = PS_LISTENING; break; @@ -279,6 +293,7 @@ enum port_state ptp_slave_fsm(enum port_state state, enum fsm_event event) break; case EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES: case EV_RS_MASTER: + case EV_RS_GRAND_MASTER: case EV_RS_PASSIVE: next = PS_LISTENING; break; diff --git a/fsm.h b/fsm.h index c24d82c..b4b2eff 100644 --- a/fsm.h +++ b/fsm.h @@ -49,6 +49,7 @@ enum fsm_event { EV_SYNCHRONIZATION_FAULT, EV_MASTER_CLOCK_SELECTED, EV_RS_MASTER, + EV_RS_GRAND_MASTER, EV_RS_SLAVE, EV_RS_PASSIVE, }; diff --git a/util.c b/util.c index 0e01e21..f597c49 100644 --- a/util.c +++ b/util.c @@ -48,6 +48,7 @@ char *ev_str[] = { "SYNCHRONIZATION_FAULT", "MASTER_CLOCK_SELECTED", "RS_MASTER", + "RS_GRAND_MASTER", "RS_SLAVE", "RS_PASSIVE", };