Skip to content

Commit

Permalink
Introduce an event recommending the grand master state.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
richardcochran committed Jan 7, 2012
1 parent 10753fa commit b76c4e1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
1 change: 1 addition & 0 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ char *ev_str[] = {
"SYNCHRONIZATION_FAULT",
"MASTER_CLOCK_SELECTED",
"RS_MASTER",
"RS_GRAND_MASTER",
"RS_SLAVE",
"RS_PASSIVE",
};
Expand Down

0 comments on commit b76c4e1

Please sign in to comment.