Add ignore_source_id config option.

This config option will skip the source port identity verification in
the Sync and Follow_up messages. This option is needed when the announce
messages are disabled because the slave cannot know the identity of
master without announce messages.

This is required by Automotive Profile as part of skipping the Best
Master Clock Algorithm (BMCA).

Signed-off-by: Vedang Patel <vedang.patel@intel.com>
master
Vedang Patel 2018-10-03 09:41:52 -07:00 committed by Richard Cochran
parent 1cbeec80cd
commit d58b1080bc
5 changed files with 25 additions and 6 deletions

View File

@ -240,6 +240,7 @@ struct config_item config_tab[] = {
GLOB_ITEM_INT("gmCapable", 1, 0, 1),
GLOB_ITEM_ENU("hwts_filter", HWTS_FILTER_NORMAL, hwts_filter_enu),
PORT_ITEM_INT("hybrid_e2e", 0, 0, 1),
PORT_ITEM_INT("ignore_source_id", 0, 0, 1),
PORT_ITEM_INT("ignore_transport_specific", 0, 0, 1),
PORT_ITEM_INT("ingressLatency", 0, INT_MIN, INT_MAX),
PORT_ITEM_INT("inhibit_announce", 0, 0, 1),

View File

@ -35,6 +35,7 @@ G.8275.portDS.localPriority 128
asCapable auto
BMCA ptp
inhibit_announce 0
ignore_source_id 0
#
# Run time options
#

22
port.c
View File

@ -1593,6 +1593,7 @@ int port_initialize(struct port *p)
p->peerMeanPathDelay = 0;
p->logAnnounceInterval = config_get_int(cfg, p->name, "logAnnounceInterval");
p->inhibit_announce = config_get_int(cfg, p->name, "inhibit_announce");
p->ignore_source_id = config_get_int(cfg, p->name, "ignore_source_id");
p->announceReceiptTimeout = config_get_int(cfg, p->name, "announceReceiptTimeout");
p->syncReceiptTimeout = config_get_int(cfg, p->name, "syncReceiptTimeout");
p->transportSpecific = config_get_int(cfg, p->name, "transportSpecific");
@ -1877,10 +1878,20 @@ void process_delay_resp(struct port *p, struct ptp_message *m)
port_set_delay_tmo(p);
}
static int check_source_identity(struct port *p, struct ptp_message *m)
{
struct PortIdentity master;
if (p->ignore_source_id) {
return 0;
}
master = clock_parent_identity(p->clock);
return pid_eq(&master, &m->header.sourcePortIdentity) ? 0 : -1;
}
void process_follow_up(struct port *p, struct ptp_message *m)
{
enum syfu_event event;
struct PortIdentity master;
switch (p->state) {
case PS_INITIALIZING:
case PS_FAULTY:
@ -1895,8 +1906,8 @@ void process_follow_up(struct port *p, struct ptp_message *m)
case PS_SLAVE:
break;
}
master = clock_parent_identity(p->clock);
if (!pid_eq(&master, &m->header.sourcePortIdentity)) {
if (check_source_identity(p, m)) {
return;
}
@ -2185,7 +2196,6 @@ void process_pdelay_resp_fup(struct port *p, struct ptp_message *m)
void process_sync(struct port *p, struct ptp_message *m)
{
enum syfu_event event;
struct PortIdentity master;
switch (p->state) {
case PS_INITIALIZING:
case PS_FAULTY:
@ -2200,8 +2210,8 @@ void process_sync(struct port *p, struct ptp_message *m)
case PS_SLAVE:
break;
}
master = clock_parent_identity(p->clock);
if (!pid_eq(&master, &m->header.sourcePortIdentity)) {
if (check_source_identity(p, m)) {
return;
}

View File

@ -99,6 +99,7 @@ struct port {
enum fsm_event event, int mdiff);
int bmca;
int inhibit_announce;
int ignore_source_id;
/* portDS */
struct PortIdentity portIdentity;
enum port_state state; /*portState*/

View File

@ -709,6 +709,12 @@ by the Automotive profile as part of switching over to a static BMCA. if this
option is enabled, ignore_source_id has to be enabled in the slave because it
has no way to identify master identity in Sync and Follow_Up messages. The
default is 0 (disabled).
.TP
.B ignore_source_id
This will disable source port identity checking for Sync and Follow_Up
messages. This is useful when the announce messages are disabled in the master
and the slave does not have any way to know it's identity. The default is 0
(disabled).
.SH UNICAST DISCOVERY OPTIONS