Send peer delay requests continuously in P2P mode.
When a port makes a transition from one state to another, it resets all of the message timers. While this is the correct behavior for E2E mode, the P2P mode requires sending peer delay requests most of the time. Even though all the other timer logic is identical, still making an exception for P2P mode would make the code even harder to follow. So this patch introduces two nearly identical helper functions to handle timer reprogramming during a state transition. Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
f8be779f28
commit
6dc1b90306
127
port.c
127
port.c
|
@ -1490,6 +1490,79 @@ struct foreign_clock *port_compute_best(struct port *p)
|
||||||
return p->best;
|
return p->best;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void port_e2e_transition(struct port *p, enum port_state next)
|
||||||
|
{
|
||||||
|
port_clr_tmo(p->fda.fd[FD_ANNOUNCE_TIMER]);
|
||||||
|
port_clr_tmo(p->fda.fd[FD_DELAY_TIMER]);
|
||||||
|
port_clr_tmo(p->fda.fd[FD_QUALIFICATION_TIMER]);
|
||||||
|
port_clr_tmo(p->fda.fd[FD_MANNO_TIMER]);
|
||||||
|
port_clr_tmo(p->fda.fd[FD_SYNC_TIMER]);
|
||||||
|
|
||||||
|
switch (next) {
|
||||||
|
case PS_INITIALIZING:
|
||||||
|
break;
|
||||||
|
case PS_FAULTY:
|
||||||
|
case PS_DISABLED:
|
||||||
|
port_disable(p);
|
||||||
|
break;
|
||||||
|
case PS_LISTENING:
|
||||||
|
port_set_announce_tmo(p);
|
||||||
|
break;
|
||||||
|
case PS_PRE_MASTER:
|
||||||
|
port_set_qualification_tmo(p);
|
||||||
|
break;
|
||||||
|
case PS_MASTER:
|
||||||
|
case PS_GRAND_MASTER:
|
||||||
|
port_set_manno_tmo(p);
|
||||||
|
port_set_sync_tmo(p);
|
||||||
|
break;
|
||||||
|
case PS_PASSIVE:
|
||||||
|
port_set_announce_tmo(p);
|
||||||
|
break;
|
||||||
|
case PS_UNCALIBRATED:
|
||||||
|
case PS_SLAVE:
|
||||||
|
port_set_announce_tmo(p);
|
||||||
|
port_set_delay_tmo(p);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static void port_p2p_transition(struct port *p, enum port_state next)
|
||||||
|
{
|
||||||
|
port_clr_tmo(p->fda.fd[FD_ANNOUNCE_TIMER]);
|
||||||
|
/* Leave FD_DELAY_TIMER running. */
|
||||||
|
port_clr_tmo(p->fda.fd[FD_QUALIFICATION_TIMER]);
|
||||||
|
port_clr_tmo(p->fda.fd[FD_MANNO_TIMER]);
|
||||||
|
port_clr_tmo(p->fda.fd[FD_SYNC_TIMER]);
|
||||||
|
|
||||||
|
switch (next) {
|
||||||
|
case PS_INITIALIZING:
|
||||||
|
break;
|
||||||
|
case PS_FAULTY:
|
||||||
|
case PS_DISABLED:
|
||||||
|
port_disable(p);
|
||||||
|
break;
|
||||||
|
case PS_LISTENING:
|
||||||
|
port_set_announce_tmo(p);
|
||||||
|
break;
|
||||||
|
case PS_PRE_MASTER:
|
||||||
|
port_set_qualification_tmo(p);
|
||||||
|
break;
|
||||||
|
case PS_MASTER:
|
||||||
|
case PS_GRAND_MASTER:
|
||||||
|
port_set_manno_tmo(p);
|
||||||
|
port_set_sync_tmo(p);
|
||||||
|
break;
|
||||||
|
case PS_PASSIVE:
|
||||||
|
port_set_announce_tmo(p);
|
||||||
|
break;
|
||||||
|
case PS_UNCALIBRATED:
|
||||||
|
case PS_SLAVE:
|
||||||
|
port_set_announce_tmo(p);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
int port_dispatch(struct port *p, enum fsm_event event, int mdiff)
|
int port_dispatch(struct port *p, enum fsm_event event, int mdiff)
|
||||||
{
|
{
|
||||||
enum port_state next;
|
enum port_state next;
|
||||||
|
@ -1527,58 +1600,12 @@ int port_dispatch(struct port *p, enum fsm_event event, int mdiff)
|
||||||
|
|
||||||
port_show_transition(p, next, event);
|
port_show_transition(p, next, event);
|
||||||
|
|
||||||
port_clr_tmo(p->fda.fd[FD_ANNOUNCE_TIMER]);
|
|
||||||
port_clr_tmo(p->fda.fd[FD_DELAY_TIMER]);
|
|
||||||
port_clr_tmo(p->fda.fd[FD_QUALIFICATION_TIMER]);
|
|
||||||
port_clr_tmo(p->fda.fd[FD_MANNO_TIMER]);
|
|
||||||
port_clr_tmo(p->fda.fd[FD_SYNC_TIMER]);
|
|
||||||
|
|
||||||
switch (next) {
|
|
||||||
case PS_INITIALIZING:
|
|
||||||
break;
|
|
||||||
case PS_FAULTY:
|
|
||||||
case PS_DISABLED:
|
|
||||||
port_disable(p);
|
|
||||||
break;
|
|
||||||
case PS_LISTENING:
|
|
||||||
port_set_announce_tmo(p);
|
|
||||||
break;
|
|
||||||
case PS_PRE_MASTER:
|
|
||||||
port_set_qualification_tmo(p);
|
|
||||||
break;
|
|
||||||
case PS_MASTER:
|
|
||||||
case PS_GRAND_MASTER:
|
|
||||||
port_set_manno_tmo(p);
|
|
||||||
port_set_sync_tmo(p);
|
|
||||||
break;
|
|
||||||
case PS_PASSIVE:
|
|
||||||
port_set_announce_tmo(p);
|
|
||||||
break;
|
|
||||||
case PS_UNCALIBRATED:
|
|
||||||
case PS_SLAVE:
|
|
||||||
port_set_announce_tmo(p);
|
|
||||||
port_set_delay_tmo(p);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
if (p->delayMechanism == DM_P2P) {
|
if (p->delayMechanism == DM_P2P) {
|
||||||
switch (next) {
|
port_p2p_transition(p, next);
|
||||||
case PS_INITIALIZING:
|
} else {
|
||||||
case PS_FAULTY:
|
port_e2e_transition(p, next);
|
||||||
case PS_DISABLED:
|
|
||||||
break;
|
|
||||||
case PS_LISTENING:
|
|
||||||
case PS_PRE_MASTER:
|
|
||||||
case PS_MASTER:
|
|
||||||
case PS_GRAND_MASTER:
|
|
||||||
case PS_PASSIVE:
|
|
||||||
port_set_delay_tmo(p);
|
|
||||||
break;
|
|
||||||
case PS_UNCALIBRATED:
|
|
||||||
case PS_SLAVE:
|
|
||||||
/*already set above*/
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p->state = next;
|
p->state = next;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue