Skip to content

Commit

Permalink
Add a check if OID exists before setting Host Tx Ready Signal Enable (#…
Browse files Browse the repository at this point in the history
…3232)

- What I did
I added a query before setting host tx ready - must check that Oid exists before setting attribute to SAI.

- Why I did it
When we do dynamic port breakout to a Fw-control port, portsorch receives a notification that something was deleted in TRANSCEIVER_INFO table from State DB, and tries to set HOST_TX_READY_SIGNAL_ENABLE attribute to false for the deleted OID.
The issue is the Oid is already deleted and we receive an error from SAI.

- How I verified it
Run DPB on the switch
  • Loading branch information
noaOrMlnx authored Jul 22, 2024
1 parent 43ac585 commit 2367bca
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ bool PortsOrch::addPortBulk(const std::vector<PortConfig> &portList)
attr.value.booldata = false;
attrList.push_back(attr);
}

if (cit.pt_intf_id.is_set)
{
if (!m_isPathTracingSupported)
Expand Down Expand Up @@ -5128,14 +5128,19 @@ bool PortsOrch::setSaiHostTxSignal(const Port &port, bool enable)
sai_attribute_t attr;
attr.id = SAI_PORT_ATTR_HOST_TX_SIGNAL_ENABLE;
attr.value.booldata = enable;
sai_status_t status = sai_port_api->set_port_attribute(port.m_port_id, &attr);

if (status != SAI_STATUS_SUCCESS)
if (saiOidToAlias.find(port.m_port_id) != saiOidToAlias.end())
{
SWSS_LOG_ERROR("Could not setSAI_PORT_ATTR_HOST_TX_SIGNAL_ENABLE to port 0x%" PRIx64, port.m_port_id);
return false;
sai_status_t status = sai_port_api->set_port_attribute(port.m_port_id, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Could not set SAI_PORT_ATTR_HOST_TX_SIGNAL_ENABLE to port 0x%" PRIx64, port.m_port_id);
return false;
}
return true;
}

SWSS_LOG_NOTICE("Could not set SAI_PORT_ATTR_HOST_TX_SIGNAL_ENABLE - OID does not exist 0x%" PRIx64, port.m_port_id);
return true;
}

Expand Down Expand Up @@ -8122,7 +8127,7 @@ void PortsOrch::updatePortOperStatus(Port &port, sai_port_oper_status_t status)
}
}
SWSS_LOG_INFO("Updating the nexthop for port %s and operational status %s", port.m_alias.c_str(), isUp ? "up" : "down");

if (!gNeighOrch->ifChangeInformNextHop(port.m_alias, isUp))
{
SWSS_LOG_WARN("Inform nexthop operation failed for interface %s", port.m_alias.c_str());
Expand Down

0 comments on commit 2367bca

Please sign in to comment.