Skip to content

Commit

Permalink
[orchagent] Ensure Path Tracing is supported before configuring it in…
Browse files Browse the repository at this point in the history
… SAI

Reject Path Tracing Interface ID and Timestamp Template configuration when
Path Tracing is not supported

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
  • Loading branch information
cscarpitta committed Oct 26, 2023
1 parent 653a2e2 commit 06b7459
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,14 @@ bool PortsOrch::addPortBulk(const std::vector<PortConfig> &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.
*
Expand Down Expand Up @@ -911,6 +919,14 @@ bool PortsOrch::addPortBulk(const std::vector<PortConfig> &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);
Expand Down Expand Up @@ -4215,6 +4231,14 @@ 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"
);
continue;
}

if (p.m_pt_intf_id != pCfg.pt_intf_id.value)
{
/*
Expand Down Expand Up @@ -4277,6 +4301,14 @@ 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"
);
continue;
}

if (p.m_pt_timestamp_template != pCfg.pt_timestamp_template.value)
{
if (!setPortPtTimestampTemplate(p, pCfg.pt_timestamp_template.value))
Expand Down

0 comments on commit 06b7459

Please sign in to comment.