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
4 changes: 4 additions & 0 deletions orchagent/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ int main(int argc, char **argv)
attr.value.ptr = (void *)on_switch_shutdown_request;
attrs.push_back(attr);

attr.id = SAI_SWITCH_ATTR_PORT_HOST_TX_READY_NOTIFY;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it handle if a platform does not support this notification?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, this line purpose is only to have the callback function for the notification.
In PortsOrch we have 2 queries to check whether this functionality is supported, and if not, the notification will not be registered and this line will not be relevant.

attr.value.ptr = (void *)on_port_host_tx_ready;
attrs.push_back(attr);

if (gMySwitchType != "fabric" && gMacAddress)
{
attr.id = SAI_SWITCH_ATTR_SRC_MAC_ADDRESS;
Expand Down
6 changes: 6 additions & 0 deletions orchagent/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ void on_switch_shutdown_request(sai_object_id_t switch_id)

quick_exit(EXIT_FAILURE);
}

void on_port_host_tx_ready(sai_object_id_t switch_id, sai_object_id_t port_id, sai_port_host_tx_ready_status_t m_portHostTxReadyStatus)
{
// don't use this event handler, because it runs by libsairedis in a separate thread
// which causes concurrency access to the DB
}
1 change: 1 addition & 0 deletions orchagent/notifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ void on_bfd_session_state_change(uint32_t count, sai_bfd_session_state_notificat
// The function prototype information can be found here:
// https://github.com/sonic-net/sonic-sairedis/blob/master/meta/NotificationSwitchShutdownRequest.cpp#L49
void on_switch_shutdown_request(sai_object_id_t switch_id);
void on_port_host_tx_ready(sai_object_id_t switch_id, sai_object_id_t port_id, sai_port_host_tx_ready_status_t m_portHostTxReadyStatus);
Loading
Loading