Skip to content

Commit

Permalink
add remove queue port map function
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnushetty committed Dec 17, 2020
1 parent e1dd327 commit e6c9ee6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
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

0 comments on commit e6c9ee6

Please sign in to comment.