Inhibit sync messages from unwilling 802.1AS ports.

According to 802.1AS, ports are always expected to transmit announce
messages, even if they never want to become the grand master. Instead
of using a slave only BMC state machine as in 1588, 802.1AS offers a
"grand master capable" flag which allows clocks to not send sync
messages.

This patch keeps a port from transmitting sync (but not announce)
messages when there is no other master.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2013-12-01 20:47:10 +01:00
parent bdbda10c73
commit d72e795727
1 changed files with 28 additions and 0 deletions

28
port.c
View File

@ -532,6 +532,31 @@ static int port_ignore(struct port *p, struct ptp_message *m)
return 0;
}
/*
* Test whether a 802.1AS port may transmit a sync message.
*/
static int port_sync_incapable(struct port *p)
{
struct ClockIdentity cid;
struct PortIdentity pid;
if (!port_is_ieee8021as(p)) {
return 0;
}
if (clock_gm_capable(p->clock)) {
return 0;
}
cid = clock_identity(p->clock);
pid = clock_parent_identity(p->clock);
if (!memcmp(&cid, &pid.clockIdentity, sizeof(cid))) {
/*
* We are the GM, but without gmCapable set.
*/
return 1;
}
return 0;
}
static int port_is_ieee8021as(struct port *p)
{
return p->pod.follow_up_info ? 1 : 0;
@ -1148,6 +1173,9 @@ static int port_tx_sync(struct port *p)
if (!port_capable(p)) {
return 0;
}
if (port_sync_incapable(p)) {
return 0;
}
msg = msg_allocate();
if (!msg)
return -1;