Skip to content

Commit

Permalink
Fix CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
noaOrMlnx committed Oct 31, 2023
1 parent 138dbdc commit 2ca67a8
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 56 deletions.
3 changes: 1 addition & 2 deletions lib/Switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions meta/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ libsaimeta_la_SOURCES = \
NotificationSwitchShutdownRequest.cpp \
NotificationSwitchStateChange.cpp \
NotificationBfdSessionStateChange.cpp \
NotificationPortHostTxReadyEvent.cpp \
NumberOidIndexGenerator.cpp \
OidRefCounter.cpp \
PerformanceIntervalTimer.cpp \
Expand Down
24 changes: 9 additions & 15 deletions meta/Meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion meta/NotificationFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 1 addition & 14 deletions meta/NotificationPortHostTxReadyEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion meta/NotificationPortHostTxReadyEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ namespace sairedis
sai_port_host_tx_ready_status_t m_portHostTxReadyStatus;

};
}
}
11 changes: 1 addition & 10 deletions meta/SaiSerialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions meta/sai_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 3 additions & 5 deletions syncd/NotificationProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 0 additions & 5 deletions syncd/scripts/syncd_init_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2ca67a8

Please sign in to comment.