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.pa...@intel.com> --- config.c | 1 + configs/default.cfg | 1 + port.c | 22 ++++++++++++++++------ port_private.h | 1 + ptp4l.8 | 6 ++++++ 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/config.c b/config.c index 702ee1b4e52a..1e7734bc8607 100644 --- a/config.c +++ b/config.c @@ -223,6 +223,7 @@ struct config_item config_tab[] = { PORT_ITEM_INT("G.8275.portDS.localPriority", 128, 1, UINT8_MAX), GLOB_ITEM_INT("gmCapable", 1, 0, 1), 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), diff --git a/configs/default.cfg b/configs/default.cfg index 56dfbe4aace1..3f18830f8d9f 100644 --- a/configs/default.cfg +++ b/configs/default.cfg @@ -33,6 +33,7 @@ masterOnly 0 G.8275.portDS.localPriority 128 BMCA ptp inhibit_announce 0 +ignore_source_id 0 # # Run time options # diff --git a/port.c b/port.c index 1c14a8da1970..b326b9c2fa51 100644 --- a/port.c +++ b/port.c @@ -1594,6 +1594,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"); @@ -1867,10 +1868,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: @@ -1885,8 +1896,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; } @@ -2175,7 +2186,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: @@ -2190,8 +2200,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; } diff --git a/port_private.h b/port_private.h index b454901f208d..55ce791f8494 100644 --- a/port_private.h +++ b/port_private.h @@ -98,6 +98,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*/ diff --git a/ptp4l.8 b/ptp4l.8 index 902d7314db30..c66396601e97 100644 --- a/ptp4l.8 +++ b/ptp4l.8 @@ -678,6 +678,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_port_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 -- 2.7.3 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel