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

Preventing dynamic generation of BUFFER_PROFILE and BUFFER_PG entries in CONFIG_DB #3418

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
16 changes: 15 additions & 1 deletion cfgmgr/buffermgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,19 @@ task_process_status BufferMgr::doSpeedUpdateTask(string port)
}
pfc_enable = m_portPfcStatus[port];

speed = m_speedLookup[port];
auto speed_iter = m_speedLookup.find(port);
if (speed_iter != m_speedLookup.end() && s_autonegEnabled.find(port) == s_autonegEnabled.end())
{
SWSS_LOG_NOTICE("Skipping dynamic creation of BUFFER_PROFILE and related BUFFER_PG entries for port %s because "
"port speed is set to %s Mbps and autoneg is not enabled for the port.",
port.c_str(), speed_iter->second.c_str());
return task_process_status::task_success;
}
if (speed_iter == m_speedLookup.end())
speed = "";
else
speed = speed_iter->second;

// key format is pg_lossless_<speed>_<cable>_profile
string buffer_profile_key = "pg_lossless_" + speed + "_" + cable + "_profile";
string profile_ref = buffer_profile_key;
Expand Down Expand Up @@ -541,6 +553,8 @@ void BufferMgr::doTask(Consumer &consumer)
{
m_portStatusLookup[port] = fvValue(i);
}
else if (fvField(i) == "autoneg" && (fvValue(i) == "on" || fvValue(i) == "1"))
s_autonegEnabled.insert(port);
}

if (m_speedLookup.count(port) != 0)
Expand Down
2 changes: 2 additions & 0 deletions cfgmgr/buffermgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "orch.h"

#include <map>
#include <unordered_set>
#include <string>

namespace swss {
Expand Down Expand Up @@ -59,6 +60,7 @@ class BufferMgr : public Orch
port_cable_length_t m_cableLenLookup;
port_admin_status_t m_portStatusLookup;
port_speed_t m_speedLookup;
std::unordered_set<std::string> s_autonegEnabled;
std::string getPgPoolMode();
void readPgProfileLookupFile(std::string);
task_process_status doCableTask(std::string port, std::string cable_length);
Expand Down
Loading