From 448d8a357ae369c056bf7458b901415f46173ae9 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Thu, 26 Oct 2023 12:52:38 +0200 Subject: [PATCH] [orchagent] Ensure Path Tracing is supported before configuring it in SAI Reject Path Tracing Interface ID and Timestamp Template configuration when Path Tracing is not supported Signed-off-by: Carmine Scarpitta --- orchagent/portsorch.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index ef620d1457..2c17e0aa91 100644 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -866,6 +866,14 @@ bool PortsOrch::addPortBulk(const std::vector &portList) if (cit.pt_intf_id.is_set) { + if (!m_isPathTracingSupported) + { + SWSS_LOG_WARN( + "Failed to set Path Tracing Interface ID: Path Tracing is not supported by the switch" + ); + continue; + } + /* * First, let's check the Path Tracing Interface ID configured for the port. * @@ -912,6 +920,14 @@ bool PortsOrch::addPortBulk(const std::vector &portList) if (cit.pt_timestamp_template.is_set) { + if (!m_isPathTracingSupported) + { + SWSS_LOG_WARN( + "Failed to set Path Tracing Timestamp Template: Path Tracing is not supported by the switch" + ); + continue; + } + attr.id = SAI_PORT_ATTR_PATH_TRACING_TIMESTAMP_TYPE; attr.value.u16 = cit.pt_timestamp_template.value; attrList.push_back(attr); @@ -4216,6 +4232,15 @@ void PortsOrch::doPortTask(Consumer &consumer) if (pCfg.pt_intf_id.is_set) { + if (!m_isPathTracingSupported) + { + SWSS_LOG_WARN( + "Failed to set Path Tracing Interface ID: Path Tracing is not supported by the switch" + ); + it = taskMap.erase(it); + continue; + } + if (p.m_pt_intf_id != pCfg.pt_intf_id.value) { /* @@ -4278,6 +4303,15 @@ void PortsOrch::doPortTask(Consumer &consumer) if (pCfg.pt_timestamp_template.is_set) { + if (!m_isPathTracingSupported) + { + SWSS_LOG_WARN( + "Failed to set Path Tracing Timestamp Template: Path Tracing is not supported by the switch" + ); + it = taskMap.erase(it); + continue; + } + if (p.m_pt_timestamp_template != pCfg.pt_timestamp_template.value) { if (!setPortPtTimestampTemplate(p, pCfg.pt_timestamp_template.value))