Commit bd2f31ab authored by Maciej Lipinski's avatar Maciej Lipinski

Detect change to new foreign master only if already synchronized to a foreign master

Do it only if a foreign master is changed to a new one,
do not do it if this is the first foreign master, i.e.
we were not synchronized to any PTP master and the clockIdentity
in the parent DS was our own. In other words, the flag
newGrandmaster is meant to detect change between foreign
masters, and not connection to a foreign master when
before there was none). The "if" was added to prevent
unnecessary trashing between SLAVE and UNCALIBRATED
state (without the if, the UNCALIBRATED would be forced
unnecesserily when connecting the link).
parent 7d72d594
......@@ -130,6 +130,7 @@ void bmc_s1(struct pp_instance *ppi,
{
parentDS_t *parent = DSPAR(ppi);
timePropertiesDS_t *prop = DSPRO(ppi);
defaultDS_t *defds = DSDEF(ppi);
int ret = 0;
int offset, leap59, leap61;
int hours, minutes, seconds;
......@@ -140,8 +141,22 @@ void bmc_s1(struct pp_instance *ppi,
/* Check if it is a new foreign master
* In this case the BMCA state machine must be informed
* to transition form SLAVE to UNCALIBRATED state.
* Do it only if a foreign master is changed to a new one,
* do not do it if this is the first foreign master, i.e.
* we were not synchronized to any PTP master and the clockIdentity
* in the parent DS was our own. In other words, the flag
* newGrandmaster is meant to detect change between foreign
* masters, and not connection to a foreign master when
* before there was none). The "if" was added to prevent
* unnecessary trashing between SLAVE and UNCALIBRATED
* state (without the if, the UNCALIBRATED would be forced
* unnecesserily when connecting the link).
* FIXME: change the name from newGrandmaster to newForeignMaster
*/
parent->newGrandmaster=bmc_pidcmp(&parent->parentPortIdentity,&frgn_master->sourcePortIdentity)!=0;
if ( bmc_idcmp(&defds->clockIdentity, &parent->parentPortIdentity.clockIdentity) != 0)
parent->newGrandmaster=bmc_pidcmp(&parent->parentPortIdentity,&frgn_master->sourcePortIdentity)!=0;
else
parent->newGrandmaster= FALSE;
/* Parent DS */
parent->parentPortIdentity = frgn_master->sourcePortIdentity;
......
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