PTP移植笔记四:announce和BMC算法

ANNOUNCE报文的作用:
当域中没有人为指定主时钟时,域中设备利用此报文自动选出主时钟。每个域中只能有一个主时钟。
ANNOUNCE报文对外发送自身时钟的特性信息,域中的其它设备将此报文用于最佳主时钟算法。

BMC算法:最佳主时钟算法。
每台设备独立计算自身的主、从状态。设备之间并不通过协商决定,谁是主时钟,谁是从时钟。而是通过运算结果决定主时钟、从时钟。
算法的数据来自Announce报文,以及自身defaultDS中的数据。
算法分为两个部分:
第一部分:从所有Annouce报文中选出最佳报文。
第二部分:使用最佳报文和自身属性比较,算出最终状态。

ANNOUNCE报文发送方式:
方式一:
地址:UDP组播224.0.1.229 目的MAC地址:01-00-5E-00-01-81
端口号:320
方式二:
ethernet帧,ethertype=0x88F7。
地址:
普通消息:01-1B-19-00-00-00
事件消息:01-80-C2-00-00-0E

发送者:立志成为主时钟的设备。
结果:不一定成为主时钟。

ANNOUNCE报文的内容:
originTimestamp:=0。接收到的dante数据中此值固定为0。
currentUtcOffset:=timePropertiesDS.currentUtcOffset。接收到的dante数据中此值固定为0.
grandmasterPriority1:=parentDS.grandmasterPriority1
grandmasterClockQuality:=parentDS.grandmasterClockQuality
grandmasterPriority2:=parentDS.grandmasterPriority2
grandmasterIdentity:=parentDS.grandmasterIdentity
stempsRemoved:=currentDS.stepsRemoved
simeSource:=timePropertiesDS.timeSource

数据集说明:
defaultDS: Attributes describing the ordinary clock.本地时钟的数据。
currentDS:Attributes related to synchronization.时钟同步相关的信息。
parentDS:Attributes describing the parent (the clock to which the ordinary clock synchronizes) and the grandmaster (the clock at the root of the master−slave hierarchy).父时钟和最高级时钟的信息。
timePropertiesDS: Attributes of the timescale.

处理函数:
void handleAnnounce(MsgHeader *header, ssize_t length,
Boolean isFromSelf, const RunTimeOpts *rtOpts, PtpClock *ptpClock)

1.人工设定为主时钟的设备可忽略此报文。
2.如果从时钟状态时收到来自主时钟的报文,执行此状态对应的数据集更新。
3.保存报文数据,供BMC算法调用时使用。

  • 1
    点赞
  • 35
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值