Commit 577ed159 authored by Alessandro Rubini's avatar Alessandro Rubini

bug workaround for slave states: don't refuse a new master

This works around a design problem that must be checked carefully.
The "is from current parent" flags set at receive time reveales bad,
as we should only check when needed.

So by now just say it is the current parent if we don't have a current
parent yet (i.e., we are not in error, even if it is not from current
parent).

Also, forget about current parent and foreign masters when the servo
is initialized (e.g., at link-up on the wr node).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 27e3c6a9
......@@ -48,11 +48,16 @@ int msg_unpack_header(struct pp_instance *ppi, void *buf, int plen)
PP_CLOCK_IDENTITY_LENGTH))
return -1;
if (!memcmp(&DSPAR(ppi)->parentPortIdentity.clockIdentity,
/*
* This "is_from_cur_par" must be killed. Meanwhile, say it's
* from current parent if we have no current parent, so the rest works
*/
if (!DSPAR(ppi)->parentPortIdentity.portNumber ||
(!memcmp(&DSPAR(ppi)->parentPortIdentity.clockIdentity,
&hdr->sourcePortIdentity.clockIdentity,
PP_CLOCK_IDENTITY_LENGTH) &&
(DSPAR(ppi)->parentPortIdentity.portNumber ==
hdr->sourcePortIdentity.portNumber))
hdr->sourcePortIdentity.portNumber)))
ppi->is_from_cur_par = 1;
else
ppi->is_from_cur_par = 0;
......
......@@ -14,7 +14,8 @@ void pp_servo_init(struct pp_instance *ppi)
SRV(ppi)->mpd_fltr.s_exp = 0; /* clears one-way delay filter */
SRV(ppi)->ofm_fltr.s_exp = 0; /* clears offset-from-master filter */
ppi->frgn_rec_num = 0; /* no known master */
DSPAR(ppi)->parentPortIdentity.portNumber = 0; /* invalid */
if (ppi->t_ops->init_servo) {
/* The system may pre-set us to keep current frequency */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment