Skip to content

Commit

Permalink
Create empty ready lists for buffers by default (#535)
Browse files Browse the repository at this point in the history
* Pospone QueueMap initialization until activation of counters

* Generate queue maps only for front panel ports

* Create empty buffer lists by default
  • Loading branch information
pavel-shirshov authored and lguohan committed Jul 5, 2018
1 parent 19f9108 commit 5d31b2d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion orchagent/bufferorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,20 @@ void BufferOrch::initBufferReadyList(Table& table)
{
SWSS_LOG_ENTER();

// init all ports with an empty list
for (const auto& it: gPortsOrch->getAllPorts())
{
if (it.second.m_type == Port::PHY)
{
const auto& port_name = it.first;
m_port_ready_list_ref[port_name] = {};
}
}

std::vector<std::string> keys;
table.getKeys(keys);

// populate the lists with buffer configuration information
for (const auto& key: keys)
{
m_ready_list[key] = false;
Expand Down Expand Up @@ -88,7 +99,9 @@ bool BufferOrch::isPortReady(const std::string& port_name) const
const auto it = m_port_ready_list_ref.find(port_name);
if (it == m_port_ready_list_ref.cend())
{
return false;
// we got a port name which wasn't in our gPortsOrch->getAllPorts() list
// so make the port ready, because we don't have any buffer configuration for it
return true;
}

const auto& list_of_keys = it->second;
Expand Down

0 comments on commit 5d31b2d

Please sign in to comment.