Introduce an event recommending the grand master state.
We already have a grand master state. Adding this event will simplify the overall logic, since it will avoid the silly requirement to set the qualification timeout to zero when entering the grand master state. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
10753faccf
commit
b76c4e108f
3
clock.c
3
clock.c
|
@ -451,7 +451,8 @@ static void handle_state_decision_event(struct clock *c)
|
||||||
break;
|
break;
|
||||||
case PS_GRAND_MASTER:
|
case PS_GRAND_MASTER:
|
||||||
clock_update_grandmaster(c);
|
clock_update_grandmaster(c);
|
||||||
/*fall through*/
|
event = EV_RS_GRAND_MASTER;
|
||||||
|
break;
|
||||||
case PS_MASTER:
|
case PS_MASTER:
|
||||||
event = EV_RS_MASTER;
|
event = EV_RS_MASTER;
|
||||||
break;
|
break;
|
||||||
|
|
15
fsm.c
15
fsm.c
|
@ -62,6 +62,9 @@ enum port_state ptp_fsm(enum port_state state, enum fsm_event event)
|
||||||
case EV_RS_MASTER:
|
case EV_RS_MASTER:
|
||||||
next = PS_PRE_MASTER;
|
next = PS_PRE_MASTER;
|
||||||
break;
|
break;
|
||||||
|
case EV_RS_GRAND_MASTER:
|
||||||
|
next = PS_GRAND_MASTER;
|
||||||
|
break;
|
||||||
case EV_RS_SLAVE:
|
case EV_RS_SLAVE:
|
||||||
next = PS_UNCALIBRATED;
|
next = PS_UNCALIBRATED;
|
||||||
break;
|
break;
|
||||||
|
@ -129,6 +132,9 @@ enum port_state ptp_fsm(enum port_state state, enum fsm_event event)
|
||||||
case EV_RS_MASTER:
|
case EV_RS_MASTER:
|
||||||
next = PS_PRE_MASTER;
|
next = PS_PRE_MASTER;
|
||||||
break;
|
break;
|
||||||
|
case EV_RS_GRAND_MASTER:
|
||||||
|
next = PS_GRAND_MASTER;
|
||||||
|
break;
|
||||||
case EV_RS_SLAVE:
|
case EV_RS_SLAVE:
|
||||||
next = PS_UNCALIBRATED;
|
next = PS_UNCALIBRATED;
|
||||||
break;
|
break;
|
||||||
|
@ -154,6 +160,9 @@ enum port_state ptp_fsm(enum port_state state, enum fsm_event event)
|
||||||
case EV_RS_MASTER:
|
case EV_RS_MASTER:
|
||||||
next = PS_PRE_MASTER;
|
next = PS_PRE_MASTER;
|
||||||
break;
|
break;
|
||||||
|
case EV_RS_GRAND_MASTER:
|
||||||
|
next = PS_GRAND_MASTER;
|
||||||
|
break;
|
||||||
case EV_RS_SLAVE:
|
case EV_RS_SLAVE:
|
||||||
next = PS_UNCALIBRATED;
|
next = PS_UNCALIBRATED;
|
||||||
break;
|
break;
|
||||||
|
@ -182,6 +191,9 @@ enum port_state ptp_fsm(enum port_state state, enum fsm_event event)
|
||||||
case EV_RS_MASTER:
|
case EV_RS_MASTER:
|
||||||
next = PS_PRE_MASTER;
|
next = PS_PRE_MASTER;
|
||||||
break;
|
break;
|
||||||
|
case EV_RS_GRAND_MASTER:
|
||||||
|
next = PS_GRAND_MASTER;
|
||||||
|
break;
|
||||||
case EV_RS_SLAVE:
|
case EV_RS_SLAVE:
|
||||||
next = PS_UNCALIBRATED;
|
next = PS_UNCALIBRATED;
|
||||||
break;
|
break;
|
||||||
|
@ -237,6 +249,7 @@ enum port_state ptp_slave_fsm(enum port_state state, enum fsm_event event)
|
||||||
break;
|
break;
|
||||||
case EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES:
|
case EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES:
|
||||||
case EV_RS_MASTER:
|
case EV_RS_MASTER:
|
||||||
|
case EV_RS_GRAND_MASTER:
|
||||||
case EV_RS_PASSIVE:
|
case EV_RS_PASSIVE:
|
||||||
next = PS_LISTENING;
|
next = PS_LISTENING;
|
||||||
break;
|
break;
|
||||||
|
@ -258,6 +271,7 @@ enum port_state ptp_slave_fsm(enum port_state state, enum fsm_event event)
|
||||||
break;
|
break;
|
||||||
case EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES:
|
case EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES:
|
||||||
case EV_RS_MASTER:
|
case EV_RS_MASTER:
|
||||||
|
case EV_RS_GRAND_MASTER:
|
||||||
case EV_RS_PASSIVE:
|
case EV_RS_PASSIVE:
|
||||||
next = PS_LISTENING;
|
next = PS_LISTENING;
|
||||||
break;
|
break;
|
||||||
|
@ -279,6 +293,7 @@ enum port_state ptp_slave_fsm(enum port_state state, enum fsm_event event)
|
||||||
break;
|
break;
|
||||||
case EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES:
|
case EV_ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES:
|
||||||
case EV_RS_MASTER:
|
case EV_RS_MASTER:
|
||||||
|
case EV_RS_GRAND_MASTER:
|
||||||
case EV_RS_PASSIVE:
|
case EV_RS_PASSIVE:
|
||||||
next = PS_LISTENING;
|
next = PS_LISTENING;
|
||||||
break;
|
break;
|
||||||
|
|
1
fsm.h
1
fsm.h
|
@ -49,6 +49,7 @@ enum fsm_event {
|
||||||
EV_SYNCHRONIZATION_FAULT,
|
EV_SYNCHRONIZATION_FAULT,
|
||||||
EV_MASTER_CLOCK_SELECTED,
|
EV_MASTER_CLOCK_SELECTED,
|
||||||
EV_RS_MASTER,
|
EV_RS_MASTER,
|
||||||
|
EV_RS_GRAND_MASTER,
|
||||||
EV_RS_SLAVE,
|
EV_RS_SLAVE,
|
||||||
EV_RS_PASSIVE,
|
EV_RS_PASSIVE,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue