Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3734,7 +3734,7 @@ void AclOrch::init(vector<TableConnector>& connectors, PortsOrch *portOrch, Mirr
string platform = getenv("platform") ? getenv("platform") : "";
string sub_platform = getenv("sub_platform") ? getenv("sub_platform") : "";
if (platform == BRCM_PLATFORM_SUBSTRING ||
platform == CISCO_8000_PLATFORM_SUBSTRING ||
isCiscoPlatform(platform) ||
platform == MLNX_PLATFORM_SUBSTRING ||
platform == BFN_PLATFORM_SUBSTRING ||
platform == MRVL_PRST_PLATFORM_SUBSTRING ||
Expand Down Expand Up @@ -3793,7 +3793,7 @@ void AclOrch::init(vector<TableConnector>& connectors, PortsOrch *portOrch, Mirr
// In Mellanox platform, V4 and V6 rules are stored in different tables
// In Broadcom DNX platform also, V4 and V6 rules are stored in different tables
if (platform == MLNX_PLATFORM_SUBSTRING ||
platform == CISCO_8000_PLATFORM_SUBSTRING ||
isCiscoPlatform(platform) ||
platform == MRVL_PRST_PLATFORM_SUBSTRING ||
platform == XS_PLATFORM_SUBSTRING ||
platform == CLX_PLATFORM_SUBSTRING ||
Expand Down
7 changes: 7 additions & 0 deletions orchagent/orch.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ const char state_db_key_delimiter = '|';
#define VS_PLATFORM_SUBSTRING "vs"
#define NPS_PLATFORM_SUBSTRING "nephos"
#define CISCO_8000_PLATFORM_SUBSTRING "cisco-8000"
#define CISCO_PLATFORM_SUBSTRING "cisco"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@anamehra Are you changing this platform substring in all Sonic submodules?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi @kperumalbfn , yes, I have two additional PRs:

sonic-net/sonic-sairedis#2006
sonic-net/sonic-utilities#4717

I will open one for sonic-mgmt as well. This is not replacement but additional of Cisco substring "cisco". We will keep cisco-8000 for backward compatibility for now.

#define XS_PLATFORM_SUBSTRING "xsight"
#define CLX_PLATFORM_SUBSTRING "clounix"

inline bool isCiscoPlatform(const std::string &platform)
{
return platform == CISCO_8000_PLATFORM_SUBSTRING ||
platform == CISCO_PLATFORM_SUBSTRING;
}

#define CONFIGDB_KEY_SEPARATOR "|"
#define DEFAULT_KEY_SEPARATOR ":"
#define VLAN_SUB_INTERFACE_SEPARATOR "."
Expand Down
2 changes: 1 addition & 1 deletion orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ bool OrchDaemon::init()
queueAttrIds,
PFC_WD_POLL_MSECS));
}
} else if (platform == CISCO_8000_PLATFORM_SUBSTRING)
} else if (isCiscoPlatform(platform))
{
static const vector<sai_port_stat_t> portStatIds =
{
Expand Down
4 changes: 2 additions & 2 deletions orchagent/pfcactionhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ PfcWdLossyHandler::PfcWdLossyHandler(sai_object_id_t port, sai_object_id_t queue
SWSS_LOG_ENTER();

string platform = getenv("platform") ? getenv("platform") : "";
if (platform == CISCO_8000_PLATFORM_SUBSTRING || ((platform == BRCM_PLATFORM_SUBSTRING) && (gSwitchOrch->checkPfcDlrInitEnable())))
if (isCiscoPlatform(platform) || ((platform == BRCM_PLATFORM_SUBSTRING) && (gSwitchOrch->checkPfcDlrInitEnable())))
{
SWSS_LOG_DEBUG("Skipping in constructor PfcWdLossyHandler for platform %s on port 0x%" PRIx64,
platform.c_str(), port);
Expand All @@ -572,7 +572,7 @@ PfcWdLossyHandler::~PfcWdLossyHandler(void)
SWSS_LOG_ENTER();

string platform = getenv("platform") ? getenv("platform") : "";
if (platform == CISCO_8000_PLATFORM_SUBSTRING || ((platform == BRCM_PLATFORM_SUBSTRING) && (gSwitchOrch->checkPfcDlrInitEnable())))
if (isCiscoPlatform(platform) || ((platform == BRCM_PLATFORM_SUBSTRING) && (gSwitchOrch->checkPfcDlrInitEnable())))
{
SWSS_LOG_DEBUG("Skipping in destructor PfcWdLossyHandler for platform %s on port 0x%" PRIx64,
platform.c_str(), getPort());
Expand Down
9 changes: 5 additions & 4 deletions orchagent/pfcwdorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ task_process_status PfcWdOrch<DropHandler, ForwardHandler>::createEntry(const st
SWSS_LOG_ERROR("Invalid PFC Watchdog action %s", value.c_str());
return task_process_status::task_invalid_entry;
}
if ((m_platform == CISCO_8000_PLATFORM_SUBSTRING) && (action == PfcWdAction::PFC_WD_ACTION_FORWARD)) {
if (isCiscoPlatform(m_platform) && (action == PfcWdAction::PFC_WD_ACTION_FORWARD)) {
SWSS_LOG_ERROR("Unsupported action %s for platform %s", value.c_str(), m_platform.c_str());
return task_process_status::task_invalid_entry;
}
Expand Down Expand Up @@ -711,12 +711,13 @@ PfcWdSwOrch<DropHandler, ForwardHandler>::PfcWdSwOrch(
SWSS_LOG_ENTER();

string detectSha, restoreSha;
string detectPluginName = "pfc_detect_" + this->m_platform + ".lua";
string pluginPlatform = getPfcWdPluginPlatform(this->m_platform);
string detectPluginName = "pfc_detect_" + pluginPlatform + ".lua";
string restorePluginName;
string pollIntervalStr = to_string(m_pollInterval);
string plugins;
if (this->m_platform == CISCO_8000_PLATFORM_SUBSTRING) {
restorePluginName = "pfc_restore_" + this->m_platform + ".lua";
if (isCiscoPlatform(this->m_platform)) {
restorePluginName = "pfc_restore_" + pluginPlatform + ".lua";
} else {
restorePluginName = "pfc_restore.lua";
}
Expand Down
5 changes: 5 additions & 0 deletions orchagent/pfcwdorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ extern "C" {

const string pfc_wd_flex_counter_group = PFC_WD_FLEX_COUNTER_GROUP;

inline std::string getPfcWdPluginPlatform(const std::string &platform)
{
return isCiscoPlatform(platform) ? CISCO_8000_PLATFORM_SUBSTRING : platform;
}

enum class PfcWdAction
{
PFC_WD_ACTION_UNKNOWN,
Expand Down
1 change: 1 addition & 0 deletions tests/mock_tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ LDADD_GTEST = -L/usr/src/gtest
tests_INCLUDES = -I $(FLEX_CTR_DIR) -I $(DEBUG_CTR_DIR) -I $(top_srcdir)/lib -I$(top_srcdir)/cfgmgr -I$(top_srcdir)/orchagent -I$(P4_ORCH_DIR)/tests -I$(DASH_ORCH_DIR) -I$(top_srcdir)/warmrestart

tests_SOURCES = aclorch_ut.cpp \
pfcwdorch_ut.cpp \
aclorch_rule_ut.cpp \
portsorch_ut.cpp \
routeorch_ut.cpp \
Expand Down
14 changes: 14 additions & 0 deletions tests/mock_tests/pfcwdorch_ut.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "pfcwdorch.h"

#include <gtest/gtest.h>

TEST(PfcWdPlatformTest, MapsCiscoNamesToExistingPlugin)
{
EXPECT_EQ(getPfcWdPluginPlatform("cisco-8000"), "cisco-8000");
EXPECT_EQ(getPfcWdPluginPlatform("cisco"), "cisco-8000");
}

TEST(PfcWdPlatformTest, PreservesOtherPlatformNames)
{
EXPECT_EQ(getPfcWdPluginPlatform("broadcom"), "broadcom");
}
Loading