Skip to content

Commit

Permalink
Add a fix to setSaiHostTxEnable (#3233)
Browse files Browse the repository at this point in the history
This is a cherry-pick of #3232

What I did
I added a query before setting host tx ready - must check that Oid exists before setting attribute to SAI.
  • Loading branch information
noaOrMlnx authored Jul 12, 2024
1 parent 4912733 commit 1cbaf9d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4678,14 +4678,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

0 comments on commit 1cbaf9d

Please sign in to comment.