Skip to content

Commit

Permalink
[portsorch]: Handle review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Nazarii Hnydyn <nazariig@nvidia.com>
  • Loading branch information
nazariig committed Aug 19, 2022
1 parent 66a8bbc commit 4b8ded6
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 25 deletions.
36 changes: 26 additions & 10 deletions orchagent/p4orch/tests/fake_portorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,35 @@ bool PortsOrch::setPortPfc(sai_object_id_t portId, uint8_t pfc_bitmask)
return true;
}

void PortsOrch::generateQueueMap()
void PortsOrch::generateQueueMap(map<string, FlexCounterQueueStates> queuesStateVector)
{
}

void PortsOrch::generatePriorityGroupMap()
void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates& queuesState)
{
}

void PortsOrch::createPortBufferQueueCounters(const Port &port, string queues)
{
}

void PortsOrch::removePortBufferQueueCounters(const Port &port, string queues)
{
}

void PortsOrch::generatePriorityGroupMap(map<string, FlexCounterPgStates> pgsStateVector)
{
}

void PortsOrch::generatePriorityGroupMapPerPort(const Port& port, FlexCounterPgStates& pgsState)
{
}

void PortsOrch::createPortBufferPgCounters(const Port& port, string pgs)
{
}

void PortsOrch::removePortBufferPgCounters(const Port& port, string pgs)
{
}

Expand Down Expand Up @@ -582,14 +606,6 @@ bool PortsOrch::getQueueTypeAndIndex(sai_object_id_t queue_id, string &type, uin
return true;
}

void PortsOrch::generateQueueMapPerPort(const Port &port)
{
}

void PortsOrch::generatePriorityGroupMapPerPort(const Port &port)
{
}

task_process_status PortsOrch::setPortAutoNeg(sai_object_id_t id, int an)
{
return task_success;
Expand Down
40 changes: 25 additions & 15 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6112,19 +6112,27 @@ void PortsOrch::removePortBufferQueueCounters(const Port &port, string queues)
name << port.m_alias << ":" << queueIndex;
const auto id = sai_serialize_object_id(port.m_queue_ids[queueIndex]);

/* Remove watermark queue counters */
string key = getQueueWatermarkFlexCounterTableKey(id);
m_flexCounterTable->del(key);
// Remove the queue counter from counters DB maps
m_queueTable->hdel("", name.str());
m_queuePortTable->hdel("", id);

string queueType;
uint8_t queueRealIndex = 0;
if (getQueueTypeAndIndex(port.m_queue_ids[queueIndex], queueType, queueRealIndex))
{
m_queueTypeTable->hdel("", id);
m_queueIndexTable->hdel("", id);
}

// Remove the flex counter for this queue
queue_stat_manager.clearCounterIdList(port.m_queue_ids[queueIndex]);

// Remove the queue counter from counters DB maps
m_queueTable->hdel("", name.str());
m_queuePortTable->hdel("", id);
m_queueIndexTable->hdel("", id);
m_queueTypeTable->hdel("", id);
// Remove watermark queue counters
string key = getQueueWatermarkFlexCounterTableKey(id);
m_flexCounterTable->del(key);
}

CounterCheckOrch::getInstance().removePort(port);
}

void PortsOrch::generatePriorityGroupMap(map<string, FlexCounterPgStates> pgsStateVector)
Expand Down Expand Up @@ -6301,19 +6309,21 @@ void PortsOrch::removePortBufferPgCounters(const Port& port, string pgs)
name << port.m_alias << ":" << pgIndex;
const auto id = sai_serialize_object_id(port.m_priority_group_ids[pgIndex]);

/* Remove dropped packets counters from flex_counter */
// Remove the pg counter from counters DB maps
m_pgTable->hdel("", name.str());
m_pgPortTable->hdel("", id);
m_pgIndexTable->hdel("", id);

// Remove dropped packets counters from flex_counter
string key = getPriorityGroupDropPacketsFlexCounterTableKey(id);
m_flexCounterTable->del(key);

/* Remove watermark counters from flex_counter */
// Remove watermark counters from flex_counter
key = getPriorityGroupWatermarkFlexCounterTableKey(id);
m_flexCounterTable->del(key);

// Remove the pg counter from counters DB maps
m_pgTable->hdel("", name.str());
m_pgPortTable->hdel("", id);
m_pgIndexTable->hdel("", id);
}

CounterCheckOrch::getInstance().removePort(port);
}

void PortsOrch::generatePortCounterMap()
Expand Down

0 comments on commit 4b8ded6

Please sign in to comment.