This commit addresses the handling of multiple pdelay responses. As per IEEE AS-2020 11.2.13.4, 'allowedLostResponses' specifies the maximum number of pdelay requests without valid responses before resetting 'asCapable'. This threshold includes instances of receiving multiple pdelay responses. Avnu Alliance Test Plan for '802.1AS Time Synchronization' Avnu PTP-5 also mandates that a device should stop transmitting pdelay_requests upon detecting > allowedLostResponses of multiple pdelay responses.
The current implementation falls short in detecting duplicate pdelay responses, i.e., multiple responses from the same peer. The detection of multiple responses also triggers an immediate reset of 'asCapable,' whereas transitioning to a faulty state (FT_BAD_PEER_NETWORK) is hard-coded to receiving >= 3 sequential multiple pdelay responses. This patch introduces support for handling multiple pdelay responses from the same peer (duplicate pdelay responses) and rectifies the detection and management of more than 'allowedLostResponses' sequential multiple pdelay responses. This involves resetting 'asCapable' and transitioning to the faulty state 'FT_BAD_PEER_NETWORK.' With this patch, the logs will distinguish between multiple pdelay responses from the same peer and distinct peers, providing better clarity when handling these scenarios: - For the same peer: port 1 (eth0): multiple peer responses - For multiple peers: port 1 (eth0): multiple peer responses port 1 (eth0): received pdelay_resp msg with unexpected peer port id 001201.fffe.000001-1 Signed-off-by: Chwee-Lin Choong <chwee.lin.cho...@intel.com> --- port.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/port.c b/port.c index 69ac9e3..786a1e3 100644 --- a/port.c +++ b/port.c @@ -726,14 +726,14 @@ int port_capable(struct port *p) goto not_capable; } - if (p->multiple_seq_pdr_count) { + if (p->multiple_seq_pdr_count > p->allowedLostResponses) { if (p->asCapable) - pr_debug("%s: multiple sequential peer delay resp, " - "resetting asCapable", p->log_name); + pr_debug("%s: received %d multiple sequential peer delay resp, " + "resetting asCapable", p->log_name, p->multiple_seq_pdr_count); goto not_capable; } - if (!p->peer_portid_valid) { + if (!p->peer_portid_valid && p->multiple_pdr_detected == 0) { if (p->asCapable) pr_debug("%s: invalid peer port id, " "resetting asCapable", p->log_name); @@ -2464,18 +2464,17 @@ calc: int process_pdelay_resp(struct port *p, struct ptp_message *m) { if (p->peer_delay_resp) { - if (!source_pid_eq(p->peer_delay_resp, m)) { - pr_err("%s: multiple peer responses", p->log_name); - if (!p->multiple_pdr_detected) { - p->multiple_pdr_detected = 1; - p->multiple_seq_pdr_count++; - } - if (p->multiple_seq_pdr_count >= 3) { - p->last_fault_type = FT_BAD_PEER_NETWORK; - return -1; - } - } - } + if (!p->multiple_pdr_detected) { + pr_err("%s: multiple peer responses", p->log_name); + p->multiple_pdr_detected = 1; + p->multiple_seq_pdr_count++; + } + if (p->multiple_seq_pdr_count > p->allowedLostResponses) { + p->last_fault_type = FT_BAD_PEER_NETWORK; + return -1; + } + } + if (!p->peer_delay_req) { pr_err("%s: rogue peer delay response", p->log_name); return -1; -- 2.42.0 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel