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

add remove queue port map function #1558

Open
wants to merge 1 commit 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 37 additions & 2 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1915,12 +1915,47 @@ bool PortsOrch::initPort(const string &alias, const int index, const set<int> &l
return true;
}

void PortsOrch::removeQueueMapPerPort(const Port& port)
{
/* Delete the Queue map in the Counter DB
* FIXME : Remove flex_counter counter part of generateQueueMapPerPort
*/
for (size_t queueIndex = 0; queueIndex < port.m_queue_ids.size(); ++queueIndex)
{
std::ostringstream name;
name << port.m_alias << ":" << queueIndex;

const auto id = sai_serialize_object_id(port.m_queue_ids[queueIndex]);

m_queueTable->hdel("", name.str(), id);
m_queuePortTable->hdel("", id, sai_serialize_object_id(port.m_port_id));

string queueType;
uint8_t queueRealIndex = 0;
if (getQueueTypeAndIndex(port.m_queue_ids[queueIndex], queueType, queueRealIndex))
{
m_queueTypeTable->hdel("", id, queueType);
m_queueIndexTable->hdel("", id, to_string(queueRealIndex));
}
SWSS_LOG_DEBUG("removeQueueMapPerPort: Port %s queueIndex %zu qid:%s", port.m_alias.c_str(), queueIndex, id.c_str());
}
CounterCheckOrch::getInstance().removePort(port);
}

void PortsOrch::deInitPort(string alias, sai_object_id_t port_id)
{
SWSS_LOG_ENTER();

Port p(alias, Port::PHY);
p.m_port_id = port_id;
Port p;

if(!getPort(alias, p))
{
SWSS_LOG_WARN("deInitPort: Port %s not found!", alias.c_str());
return;
}

/* remove queue port map associated to this port */
removeQueueMapPerPort(p);

/* remove port from flex_counter_table for updating counters */
port_stat_manager.clearCounterIdList(p.m_port_id);
Expand Down
1 change: 1 addition & 0 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ class PortsOrch : public Orch, public Subject

bool m_isQueueMapGenerated = false;
void generateQueueMapPerPort(const Port& port);
void removeQueueMapPerPort(const Port& port);

bool m_isPriorityGroupMapGenerated = false;
void generatePriorityGroupMapPerPort(const Port& port);
Expand Down