Menu

Switch from PTP Master/PTP Passive into PTP Slave

Help
Radu Onica
2015-05-07
2018-07-11
  • Radu Onica

    Radu Onica - 2015-05-07

    I am currently working on modifying the ptpd2 implementation to add some fault tolerance capabilities and I am having some problems when I try to switch from PTP Master/PTP Passive state into PTP Slave state.
    In the current architecture Im using 4 Port for testing on 3 Linux Boxes. 1 PC acts as a grandmaster (master only), 1 PC acts like a boundary clock (slave only for GM and Master only for 3rd PC), 3rd PC is running as a secondary Master only connected only to the master port of the boundary clock. The idea is when the slave port of the boundary clock detects a GM failure if disables itself and sends a signal to the master port running on the same PC to go into Slave and synchronize the clock to the 3rd Master PC.

    I bypassed the verification of the startup parameters which would not let the Master only port go into slave and managed to make this architecture work.
    The problem is that when the boundary clock Master port going into Slave and starts to sync with the other master the perceived Master-Slave delay is starts growing and growing and never stops (which is the opposite of the normal functioning a slave port). I think this happens because of the way I force the PTP Master/PTP Passive port to go into PTP Slave :

    when signal is detected:
    clearTime(&ptpClock->offsetFromMaster);
    clearTime(&ptpClock->meanPathDelay);
    clearTime(&ptpClock->delaySM);
    clearTime(&ptpClock->delayMS);
    toState(PTP_SLAVE, rtOpts, ptpClock);

    Is this the right way to force a specific port into another state not allowed by the original startup configuration ??

    Thank you in advance !

     
  • Jan Breuer

    Jan Breuer - 2015-05-07

    There are three possible configurations
    - master only - goes passive if there is better master
    - master/slave aka ordinary clock - goes master if there is no better master
    - slave only - never goes master

    Another task is to handle boundary clock - PTPd is not designed for it.

    If you have your own inter process communication between two PTPd instancies on the BC, you should rather change priority2 or clockClass to change behaviour of its "master" port.

    PTPd uses these clockClasses
    255 = slave only
    248 = master/slave
    13 = master only

    Proposed configuration for you. Best Master Clock algorithm will do its work. You don't need to bypass anything, just configure it correctly.

    Normal situation:
    BC port2: clockClass = 13, priority2 = 128 (default value)
    3rd clock: clockClass = 248, priority2 = 100 (lower is better)

    Because of clockClass 13, BC port2 will be master

    GM fails situation:
    just change BC port2: clockClass = 248

    Because of clockClass of both are the same, better clock is with lower priority2 so 3rd clock will be master.

    EDIT: I mean priority2 and not priority1. I have corrected it.

     

    Last edit: Jan Breuer 2015-05-07
  • Radu Onica

    Radu Onica - 2015-05-07

    One thing that I forgot to mention is that the 3rd clock is just another Master Port of another Boundary clock on the network meaning it can only stay in PTP Master or Passive and has to go into Slave only when that BC's connection to the GM has failed.Also the BMC algorithm runs between these master ports. When on of these master ports has to go into slave, this information is passed to the others and the BMC will disqualify it until it goest into Slave mode.

     
  • Jan Breuer

    Jan Breuer - 2015-05-07

    It is completely ok. You should just change clockClass according to the source of clock on BC.

    If the BC is synchronized to GM, clockClass is 13. This means: be master or passive.

    If GM fails, clockClass of BC will be 248. This means: be slave or master if there is nobody better.

    You can just change priority of BC1 or BC2 by priority2 (I have corrected this in previous answer, priority1 is bad idea for this.)

     
  • Radu Onica

    Radu Onica - 2015-05-07

    Changing clock classes works so I can freely move between states however the delay problem still exists which leads me to believe the problem resides with my other changes.

    Thank for everything :)

     
  • Chander Panwar

    Chander Panwar - 2018-07-11

    Hi All

    I have a query related to PTP setup. We have PTP running to sync time in multiple servers and designed topology is like the PTP master clock (It sync with GM on same location) runs on one location (Say A location) and the slaves clock is in other location (Say B location) and both the locations are connected in the network.
    We use ptpd utility in ubuntu OS server boxes and PTPD version 2.2 for server and PTPD version 2.3.1 for client.

    Now the plan is to introduce another PTP master for time sync on a machine (SayZ) and to provide PTP feed on slave machine in (location B) the same network . But the same machine (Z) is the slave for another master running at A location.

    Can you please share that how can we make arrangements to ensure:
    1. The slave running on Z machine should not take feed from PTP master running on Z machine, otherwise it will be a loop and will defeat the entire purpose of having Master at location B.

    1. Any other arrangement to tight time sync (through PTP) at loaction B,and where master is running at location A.

    TIA

     

Log in to post a comment.