diff --git a/lib/Switch.cpp b/lib/Switch.cpp index f153af4b3..7094b0e39 100644 --- a/lib/Switch.cpp +++ b/lib/Switch.cpp @@ -121,8 +121,7 @@ void Switch::updateNotifications( case SAI_SWITCH_ATTR_PORT_HOST_TX_READY_NOTIFY: m_switchNotifications.on_port_host_tx_ready = (sai_port_host_tx_ready_notification_fn)attr.value.ptr; - break; - + break; default: SWSS_LOG_ERROR("pointer for %s is not handled, FIXME!", meta->attridname); diff --git a/meta/Makefile.am b/meta/Makefile.am index c2de85b3f..d604241b2 100644 --- a/meta/Makefile.am +++ b/meta/Makefile.am @@ -35,6 +35,7 @@ libsaimeta_la_SOURCES = \ NotificationSwitchShutdownRequest.cpp \ NotificationSwitchStateChange.cpp \ NotificationBfdSessionStateChange.cpp \ + NotificationPortHostTxReadyEvent.cpp \ NumberOidIndexGenerator.cpp \ OidRefCounter.cpp \ PerformanceIntervalTimer.cpp \ diff --git a/meta/Meta.cpp b/meta/Meta.cpp index 921625d1a..b9d03a3a2 100644 --- a/meta/Meta.cpp +++ b/meta/Meta.cpp @@ -6445,29 +6445,23 @@ void Meta::meta_sai_on_port_host_tx_ready_change( &sai_metadata_enum_sai_port_host_tx_ready_status_t, host_tx_ready_status)) { - SWSS_LOG_WARN("port host_tx_ready value (%d) not found in sai_port_host_tx_ready_status_t", + SWSS_LOG_WARN("port host_tx_ready value (%d) not found in sai_port_host_tx_ready_status_t. Dropping the notification", host_tx_ready_status); + + return; } - + auto ot = objectTypeQuery(port_id); - auto valid = false; - - switch (ot) - { - case SAI_OBJECT_TYPE_PORT: - // case SAI_OBJECT_TYPE_BRIDGE_PORT: - // case SAI_OBJECT_TYPE_LAG: - valid = true; - break; - default: - SWSS_LOG_ERROR("port_id %s has unexpected type: %s, expected PORT", //, BRIDGE_PORT or LAG + if (ot != SAI_OBJECT_TYPE_PORT) + { + SWSS_LOG_ERROR("port_id %s has unexpected type: %s, expected PORT", sai_serialize_object_id(port_id).c_str(), sai_serialize_object_type(ot).c_str()); - break; + return; } - if (valid && !m_oids.objectReferenceExists(port_id)) + if (!m_oids.objectReferenceExists(port_id)) { SWSS_LOG_NOTICE("port_id new object spotted %s not present in local DB (snoop!)", sai_serialize_object_id(port_id).c_str()); diff --git a/meta/NotificationFactory.cpp b/meta/NotificationFactory.cpp index 894bc8ab7..456af8891 100644 --- a/meta/NotificationFactory.cpp +++ b/meta/NotificationFactory.cpp @@ -6,7 +6,7 @@ #include "NotificationSwitchShutdownRequest.h" #include "NotificationSwitchStateChange.h" #include "NotificationBfdSessionStateChange.h" -#include "NotificationPortHostTxReadyEvent.cpp" +#include "NotificationPortHostTxReadyEvent.h" #include "sairediscommon.h" #include "swss/logger.h" diff --git a/meta/NotificationPortHostTxReadyEvent.cpp b/meta/NotificationPortHostTxReadyEvent.cpp index 83a25434b..d1a2ecc52 100644 --- a/meta/NotificationPortHostTxReadyEvent.cpp +++ b/meta/NotificationPortHostTxReadyEvent.cpp @@ -6,12 +6,6 @@ using namespace sairedis; -// NotificationSwitchStateChange::NotificationSwitchStateChange( -// _In_ const std::string& serializedNotification): -// Notification( -// SAI_SWITCH_NOTIFICATION_TYPE_SWITCH_STATE_CHANGE, -// serializedNotification) - NotificationPortHostTxReady::NotificationPortHostTxReady( _In_ const std::string& serializedNotification): Notification( @@ -30,8 +24,6 @@ NotificationPortHostTxReady::NotificationPortHostTxReady( NotificationPortHostTxReady::~NotificationPortHostTxReady() { SWSS_LOG_ENTER(); - - sai_deserialize_free_port_host_tx_ready_ntf(m_portHostTxReadyStatus); } sai_object_id_t NotificationPortHostTxReady::getSwitchId() const @@ -45,12 +37,7 @@ sai_object_id_t NotificationPortHostTxReady::getAnyObjectId() const { SWSS_LOG_ENTER(); - if (m_portId != SAI_NULL_OBJECT_ID) - { - return m_portId; - } - - return SAI_NULL_OBJECT_ID; + return m_portId; } void NotificationPortHostTxReady::processMetadata( diff --git a/meta/NotificationPortHostTxReadyEvent.h b/meta/NotificationPortHostTxReadyEvent.h index 2de2ba118..9f46c33f9 100644 --- a/meta/NotificationPortHostTxReadyEvent.h +++ b/meta/NotificationPortHostTxReadyEvent.h @@ -35,4 +35,4 @@ namespace sairedis sai_port_host_tx_ready_status_t m_portHostTxReadyStatus; }; -} \ No newline at end of file +} diff --git a/meta/SaiSerialize.cpp b/meta/SaiSerialize.cpp index 60c3cb1b7..583780020 100644 --- a/meta/SaiSerialize.cpp +++ b/meta/SaiSerialize.cpp @@ -2287,7 +2287,6 @@ std::string sai_serialize_port_oper_status_ntf( return j.dump(); } - std::string sai_serialize_port_host_tx_ready_ntf( _In_ sai_object_id_t switch_id, _In_ sai_object_id_t port_id, @@ -2307,7 +2306,6 @@ std::string sai_serialize_port_host_tx_ready_ntf( return j.dump(); } - std::string sai_serialize_queue_deadlock_ntf( _In_ uint32_t count, _In_ const sai_queue_deadlock_notification_data_t* deadlock_data) @@ -4657,10 +4655,9 @@ void sai_deserialize_port_host_tx_ready_ntf( SWSS_LOG_ERROR("Recieved an exception after trying to parse %s", s.c_str()); return; } - // auto count = (uint32_t)j.size(); sai_deserialize_object_id(j[0]["port_id"], port_id); - sai_deserialize_object_id(j[0]["switch_id"], switch_id); + sai_deserialize_object_id(j[0]["switch_id"], switch_id); sai_deserialize_port_host_tx_ready_status(j[0]["host_tx_ready_status"], host_tx_ready_status); } @@ -4952,12 +4949,6 @@ void sai_deserialize_free_port_oper_status_ntf( delete[] port_oper_status; } -void sai_deserialize_free_port_host_tx_ready_ntf( - _In_ sai_port_host_tx_ready_status_t host_tx_ready_status) -{ - SWSS_LOG_ENTER(); -} - void sai_deserialize_free_queue_deadlock_ntf( _In_ uint32_t count, _In_ sai_queue_deadlock_notification_data_t* queue_deadlock) diff --git a/meta/sai_serialize.h b/meta/sai_serialize.h index 5922c41ab..7d53c11cc 100644 --- a/meta/sai_serialize.h +++ b/meta/sai_serialize.h @@ -513,9 +513,6 @@ void sai_deserialize_free_bfd_session_state_ntf( _In_ uint32_t count, _In_ sai_bfd_session_state_notification_t* bfdsessionstate); -void sai_deserialize_free_port_host_tx_ready_ntf( - _In_ sai_port_host_tx_ready_status_t host_tx_ready_status); - void sai_deserialize_ingress_priority_group_attr( _In_ const std::string& s, _Out_ sai_ingress_priority_group_attr_t& attr); diff --git a/syncd/NotificationProcessor.cpp b/syncd/NotificationProcessor.cpp index 54f9eda3e..539695699 100644 --- a/syncd/NotificationProcessor.cpp +++ b/syncd/NotificationProcessor.cpp @@ -471,12 +471,12 @@ void NotificationProcessor::process_on_port_host_tx_ready_change( { SWSS_LOG_ENTER(); - SWSS_LOG_DEBUG("Port ID before translating from RID to VID is 0x%lx", port_id); + SWSS_LOG_DEBUG("Port ID before translating from RID to VID is %s", sai_serialize_object_id(port_id).c_str()); sai_object_id_t port_vid = m_translator->translateRidToVid(port_id, SAI_NULL_OBJECT_ID); - SWSS_LOG_DEBUG("Port ID after translating from RID to VID is 0x%lx", port_vid); + SWSS_LOG_DEBUG("Port ID after translating from RID to VID is %s", sai_serialize_object_id(port_id).c_str()); sai_object_id_t switch_vid = m_translator->translateRidToVid(switch_id, SAI_NULL_OBJECT_ID); - + std::string s = sai_serialize_port_host_tx_ready_ntf(switch_vid, port_vid, *host_tx_ready_status); SWSS_LOG_DEBUG("Host_tx_ready status after sai_serialize is %s", s.c_str()); @@ -660,8 +660,6 @@ void NotificationProcessor::handle_port_host_tx_ready_change( sai_deserialize_port_host_tx_ready_ntf(data, switch_id, port_id, host_tx_ready_status); process_on_port_host_tx_ready_change(switch_id, port_id, &host_tx_ready_status); - - sai_deserialize_free_port_host_tx_ready_ntf(host_tx_ready_status); } void NotificationProcessor::handle_bfd_session_state_change( diff --git a/syncd/scripts/syncd_init_common.sh b/syncd/scripts/syncd_init_common.sh index dd663b1ed..214d3b125 100644 --- a/syncd/scripts/syncd_init_common.sh +++ b/syncd/scripts/syncd_init_common.sh @@ -233,11 +233,6 @@ config_syncd_mlnx() if [[ -f /tmp/sai_extra.profile ]]; then cat /tmp/sai_extra.profile >> /tmp/sai.profile fi - - if [[ -f /$HWSKU_DIR/independent_mode_support.profile ]]; then - cat /$HWSKU_DIR/independent_mode_support.profile >> /tmp/sai.profile - fi - } config_syncd_centec()