Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add host_tx_ready enhancements #2930

Merged
merged 10 commits into from
Jan 9, 2024

Conversation

noaOrMlnx
Copy link
Collaborator

@noaOrMlnx noaOrMlnx commented Oct 12, 2023

Depending on sonic-net/sonic-swss-common#824
Depending on sonic-net/sonic-sairedis#1307

HLD: sonic-net/SONiC#1453

What I did
Add host_tx_ready enhancements to sonic-swss branch according to HLD mentioned above.

Why I did it
Module and Asic configurations must be synchronized in order to not configure an non-existing module.

How I verified it
Manually & unit tests.

Details if related

@noaOrMlnx noaOrMlnx force-pushed the host_tx_ready_swss_enhancements branch 2 times, most recently from 7c4f5c4 to 68ccc1d Compare October 22, 2023 12:41
@noaOrMlnx noaOrMlnx force-pushed the host_tx_ready_swss_enhancements branch from 68ccc1d to 62a59ae Compare November 12, 2023 20:32
@noaOrMlnx noaOrMlnx requested a review from prgeor November 20, 2023 07:39
@noaOrMlnx noaOrMlnx marked this pull request as ready for review November 20, 2023 07:40
@noaOrMlnx noaOrMlnx requested a review from prsunny as a code owner November 20, 2023 07:40
@noaOrMlnx noaOrMlnx force-pushed the host_tx_ready_swss_enhancements branch from 62a59ae to adaf4be Compare November 29, 2023 07:39
@noaOrMlnx
Copy link
Collaborator Author

/azpw run Azure.sonic-swss

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-swss

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@noaOrMlnx noaOrMlnx force-pushed the host_tx_ready_swss_enhancements branch from adaf4be to 28fbbec Compare November 30, 2023 07:13
@keboliu keboliu force-pushed the host_tx_ready_swss_enhancements branch from 28fbbec to 7efd62e Compare December 1, 2023 09:19
@noaOrMlnx
Copy link
Collaborator Author

/azpw run Azure.sonic-swss

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-swss

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@noaOrMlnx noaOrMlnx force-pushed the host_tx_ready_swss_enhancements branch from 7efd62e to 45242f5 Compare December 3, 2023 12:57
@@ -60,6 +60,19 @@ def check_port_oper_status(appl_db, port_name, state):
break
assert oper_status == state

def check_port_host_tx_ready_status(state_db, port_name, status):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noaOrMlnx have you tested in actual switch host_tx_ready is not deleted during warm-reboot? If its not delted, what is preventing it from deleted from STATE_DB's port table? Any code pointers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table is deleted.
The thing is, that after warm reboot, host_tx_ready value will be false, and we won't get any new notification from lower layers saying that host_tx_ready=true.
That's the reason we need to take the current value of host_tx_ready using the new API

@@ -7345,6 +7521,18 @@ void PortsOrch::doTask(NotificationConsumer &consumer)

sai_deserialize_free_port_oper_status_ntf(count, portoperstatus);
}
else if (&consumer == m_portHostTxReadyNotificationConsumer && op == "port_host_tx_ready")
Copy link
Contributor

@prgeor prgeor Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noaOrMlnx Have you tested, when user does admin down, the host_tx_ready becomes false?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@@ -4469,6 +4561,69 @@ void PortsOrch::doVlanMemberTask(Consumer &consumer)
}
}

void PortsOrch::doTransceiverInfoTableTask(Consumer &consumer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noaOrMlnx I would suggest to rename "doTransceiverPresenceCheck" since this routine is checking the presence of the module as notified in TRANSCEIVER_INFO SET/DEL

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

bool PortsOrch::setSaiHostTxSignal(const Port &port, bool enable)
{
sai_attribute_t attr;
attr.id = SAI_PORT_ATTR_HOST_TX_SIGNAL_ENABLE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noaOrMlnx Will this crash for platform that doesn't support this new SAI attribute? See failure message?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A vendor which doesn't support this function should not get to this flow.
setSaiHostTxSignal is called only from doTransceiverPresenceCheck() function.

This function will be called when TRANSCEIVER_INFO table in STATE DB will change.
OA will listen to the table, only if the flow is supported:

  if (saiHwTxSignalSupported && saiTxReadyNotifySupported)
    {
        SWSS_LOG_DEBUG("m_cmisModuleAsicSyncSupported is true");
        m_cmisModuleAsicSyncSupported = true;
        Orch::addExecutor(new Consumer(new SubscriberStateTable(stateDb, STATE_TRANSCEIVER_INFO_TABLE_NAME, TableConsumable::DEFAULT_POP_BATCH_SIZE, 0), this, STATE_TRANSCEIVER_INFO_TABLE_NAME));
    }

@noaOrMlnx noaOrMlnx force-pushed the host_tx_ready_swss_enhancements branch from ab22f5c to f30fc35 Compare December 7, 2023 05:46
@noaOrMlnx
Copy link
Collaborator Author

/azpw run Azure.sonic-swss

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-swss

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

prgeor
prgeor previously approved these changes Dec 8, 2023
@prgeor
Copy link
Contributor

prgeor commented Dec 8, 2023

@noaOrMlnx please check if failure is due to some other PR dependency

@noaOrMlnx noaOrMlnx force-pushed the host_tx_ready_swss_enhancements branch from f30fc35 to 3d1a6f3 Compare December 10, 2023 07:07
@noaOrMlnx noaOrMlnx force-pushed the host_tx_ready_swss_enhancements branch from c3301ba to 1c6a1fb Compare December 28, 2023 08:28
prsunny
prsunny previously approved these changes Jan 2, 2024
return;
}

SWSS_LOG_NOTICE("Setting host_tx_ready status = %s, port_id = 0x%" PRIx64, status.c_str(), portId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noaOrMlnx please log the logical port name (port.m_alias) as well for easy identification

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noaOrMlnx please add the logical port name as done previously port.m_alias.c_Str()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prgeor Done

{
m_portStateTable.hset(port.m_alias, "host_tx_ready", "false");
SWSS_LOG_NOTICE("Set host_tx_ready to false as gbstatus is false "
"for port %s", port.m_alias.c_str());
}

/* Update the state table for host_tx_ready*/
if (state && (gbstatus == true) && (status == SAI_STATUS_SUCCESS) )
if (state && (gbstatus == true) && (status == SAI_STATUS_SUCCESS) && !m_cmisModuleAsicSyncSupported)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noaOrMlnx can we use the newly introduced API setHostTxReady() here as well instead of directly calling hset?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


if (!m_cmisModuleAsicSyncSupported)
{
m_portStateTable.hset(port.m_alias, "host_tx_ready", "false");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noaOrMlnx can we use the newly introduced API setHostTxReady() here as well instead of directly calling hset?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/* Update the host_tx_ready to false before setting admin_state, when admin state is false */
if (!state)
if (!state && !m_cmisModuleAsicSyncSupported)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noaOrMlnx can we use the newly introduced API setHostTxReady() here as well instead of directly calling hset?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@noaOrMlnx noaOrMlnx force-pushed the host_tx_ready_swss_enhancements branch 3 times, most recently from 7a929f4 to 7a2ab85 Compare January 3, 2024 10:38
prsunny
prsunny previously approved these changes Jan 4, 2024
and add log with port alias
@prsunny prsunny merged commit 7702b8a into sonic-net:master Jan 9, 2024
14 of 15 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-swss that referenced this pull request Jan 18, 2024
What I did
Add host_tx_ready enhancements to sonic-swss branch according to HLD

Why I did it
Module and Asic configurations must be synchronized in order to not configure an non-existing module.
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202311: #3016

@mssonicbld
Copy link
Collaborator

@noaOrMlnx cherry pick PR didn't pass PR checker. Please check!!!
#3016

mssonicbld pushed a commit that referenced this pull request Jan 22, 2024
What I did
Add host_tx_ready enhancements to sonic-swss branch according to HLD

Why I did it
Module and Asic configurations must be synchronized in order to not configure an non-existing module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants