• PTP Best Master Clock Algorithm (BMCA)

 
 
Print Friendly, PDF & Email

Scope

This article describes the “Best Master Clock Algorithm”(BMCA) and the manner in which it’s carried out on Arista switches.

BMCA

BMCA is used for selecting a Grandmaster (GM) in a PTP domain. Additionally, it is also used to decide the PTP port-states on the Arista switches.

PTP port-states

Master

It provides timing to a downstream clock. PTP master ports send out announce messages.

Slave

It retrieves timing from an upstream clock. In this state, the port doesn’t send out announce messages.

Passive

A backup slave port. This state prevents timing loops. There are no announce messages sent out of a port in this state.

Example

BMCA- GM election order

The GM is elected by comparing the below attributes in the increasing order:

1. Priority 1

2. Clock class

3. Clock accuracy

4. Clock offsetScaledLogVariance

5. Priority 2

6. Clock Identity

BMCA- GM election attributes

Priority 1 and Priority 2

The value ranges from 0-255. A lower value is preferred for electing a GM. Grandmasters have a lower priority 1 and priority 2 value in comparison to slave clocks. Arista switches have a default value of 128. Priority 2 is similar w.r.t priority 1 except that it is compared at a later stage.

Configuration

switch-1...14:49:04(config)#ptp priority1 ?
<0-255>  Priority
switch-1...14:49:04(config)#ptp priority1 255

Clock class

It’s an unsigned 8-bit integer. Arista switches have a default value of 248. It is not user-configurable. A lower clock class if preferred for electing a GM.

Clock Accuracy

Arista switches have a default value of 0xfe/0x30. It is not user-configurable. The smaller the clock accuracy the better the clock. A lower clock accuracy value is preferred for electing a GM.

Clock offsetScaledLogVariance

A log scaled statistic which represents the jitter and wanders of the clocks oscillator over a Sync message interval. Arista switches have a default value of 0xfffff. It is not user-configurable. A smaller value is preferred for electing a GM.

“show ptp clock”

The “show ptp clock” command can be used to view the BMCA-GM election attributes:

switch-1...08:03:53#show ptp clock
PTP Mode: Boundary Clock
Clock Identity: 0x00:1c:73:ff:ff:86:5d:bd
Clock Domain: 0
Number of PTP ports: 128
Priority1: 25
Priority2: 128
Clock Quality:
Class: 248
Accuracy: 0x30
OffsetScaledLogVariance: 0xffff
Offset From Master: 0
Mean Path Delay: 0 nanoseconds
Steps Removed: 0
Skew: 1.0

PTP Domain

1. A PTP domain is a network (or a portion of a network) within which PTP operates. The BMCA occurs on a per-domain basis.

2. For a PTP clock to synchronize to a GM, it is required that both the clock and the GM are in the same domain. Arista switches are in domain 0 by default. Arista switches support only one PTP domain.

switch-1...05:41:19(config)#ptp domain ? 
<0-255> The PTP domain number

Announce Messages

Announce messages carry the BMCA attributes. The announce messages received on different PTP enabled ports are compared in order to decide the GM and the relevant PTP port-states.

L3 announce Messages

Announce messages sent out are destined for 224.0.1.129.

L2 announce Messages

Announce messages sent out are destined for 01:1b:19:00:00:00.

“show ptp interface”

The “show ptp interface” command can be used to check the number of announce messages that have been both sent out and received on an interface.

switch-1...10:24:06#show ptp interface ethernet 50/1 | head -n 11
Interface Ethernet50/1
PTP: Enabled
Port state: Master
Sync interval: 1.0 seconds
Announce interval: 2.0 seconds
Announce interval timeout multiplier: 3
Delay mechanism: end to end
Delay request message interval: 32.0 seconds
Transport mode: ipv4
Announce messages sent: 7605
Announce messages received: 0

BMCA-GM election example

Topology

Configurations

switch-1

ptp priority1 25
ptp mode boundary
!
interface Ethernet50/1
   no switchport
   ip address 21.58.0.58/24
   ptp enable

switch-2

ptp mode boundary
!
interface Ethernet6/1
   no switchport
   ip address 21.22.0.21/24
   ptp enable
!
interface Ethernet25/1
   no switchport
   ip address 21.58.0.21/24
   ptp enable

switch-3

ptp mode boundary
!
interface Ethernet6/1
   no switchport
   ip address 21.22.0.22/24
   ptp enable

Observations

1. Considering that switch-1 has a lower priority-1 value, switch-1 is elected as the GM. Since it is the GM, both the clock identity and the GM clock identity are the same:

switch-1...06:39:21(config)#show ptp
PTP Mode: Boundary Clock
PTP Profile: Default ( IEEE1588 )
Clock Identity: 0x00:1c:73:ff:ff:86:5d:bd
Grandmaster Clock Identity: 0x00:1c:73:ff:ff:86:5d:bd
Number of slave ports: 0
Number of master ports: 1
Mean Path Delay (nanoseconds): 0
Steps Removed: 0
Skew (estimated local-to-master clock frequency ratio): 1.0
   Interface       State          Transport    Delay
                                             Mechanism
--------------- ------------ --------------- ---------
   Et50/1          Master          ipv4         e2e

2. Ethernet 25/1 on switch-2 and Ethernet 6/1 on switch-3 become the slave ports:

switch-2...06:54:23(config)#show ptp
PTP Mode: Boundary Clock
PTP Profile: Default ( IEEE1588 )
Clock Identity: 0x00:1c:73:ff:ff:7b:83:95
Grandmaster Clock Identity: 0x00:1c:73:ff:ff:86:5d:bd
Number of slave ports: 1
Number of master ports: 1
Slave port: Ethernet25/1
Offset From Master: 1853297
Mean Path Delay (nanoseconds): 41840861
Steps Removed: 1
Skew (estimated local-to-master clock frequency ratio): 0.999984683638
Last Sync Time: 06:56:48 UTC Jul 08 2019
Current PTP System Time: 06:56:48 UTC Jul 08 2019
   Interface       State          Transport    Delay
                                             Mechanism
--------------- ------------ --------------- ---------
   Et6/1           Master           ipv4         e2e
   Et25/1          Slave            ipv4         e2e

 

switch-3...06:40:31(config)#show ptp
PTP Mode: Boundary Clock
PTP Profile: Default ( IEEE1588 )
Clock Identity: 0x00:1c:73:ff:ff:7b:32:55
Grandmaster Clock Identity: 0x00:1c:73:ff:ff:86:5d:bd
Number of slave ports: 1
Number of master ports: 0
Slave port: Ethernet6/1
Offset From Master: 1928198
Mean Path Delay (nanoseconds): 475138
Steps Removed: 2
Skew (estimated local-to-master clock frequency ratio): 1.00003149477
Last Sync Time: 06:57:31 UTC Jul 08 2019
Current PTP System Time: 06:57:31 UTC Jul 08 2019
   Interface       State         Transport    Delay
                                            Mechanism
--------------- ----------- --------------- ---------
   Et6/1           Slave           ipv4         e2e

Converged PTP topology

Slave/passive port-election

Please refer to this link to understand the sequence of comparison for electing a slave port.

 

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: