Skip to content

Commit

Permalink
What I did?
Browse files Browse the repository at this point in the history
Create voq to port name map during port initializa

Why I did it?
When ports are getting created and voq's are being assigned to them, create a
voq to port name map table in counter DB so that it is easy to find the port
name for a specific voq when creating an entry in chassis_app_db to calculate
agg voq counters.
  • Loading branch information
viveksrao-arista committed May 16, 2024
1 parent 0465818 commit 3df86c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_wi
/* Initialize queue tables */
m_queueTable = unique_ptr<Table>(new Table(m_counter_db.get(), COUNTERS_QUEUE_NAME_MAP));
m_voqTable = unique_ptr<Table>(new Table(m_counter_db.get(), COUNTERS_VOQ_NAME_MAP));
m_voqToPortNamTable = unique_ptr<Table>(new Table(m_counter_db.get(), COUNTERS_PORT_NAME_VOQ_MAP));
m_queuePortTable = unique_ptr<Table>(new Table(m_counter_db.get(), COUNTERS_QUEUE_PORT_MAP));
m_queueIndexTable = unique_ptr<Table>(new Table(m_counter_db.get(), COUNTERS_QUEUE_INDEX_MAP));
m_queueTypeTable = unique_ptr<Table>(new Table(m_counter_db.get(), COUNTERS_QUEUE_TYPE_MAP));
Expand Down Expand Up @@ -6817,6 +6818,7 @@ void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates
vector<FieldValueTuple> queuePortVector;
vector<FieldValueTuple> queueIndexVector;
vector<FieldValueTuple> queueTypeVector;
vector<FieldValueTuple> voqToPortNameVector;
std::vector<sai_object_id_t> queue_ids;

if (voq)
Expand Down Expand Up @@ -6865,6 +6867,7 @@ void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates
// flexcounter orch logic. Always enabled voq counters.
addQueueFlexCountersPerPortPerQueueIndex(port, queueIndex, true);
queuePortVector.emplace_back(id, sai_serialize_object_id(port.m_system_port_oid));
voqToPortNameVector.emplace_back(id, port.m_system_port_info.alias);
}
else
{
Expand All @@ -6885,6 +6888,7 @@ void PortsOrch::generateQueueMapPerPort(const Port& port, FlexCounterQueueStates
if (voq)
{
m_voqTable->set("", queueVector);
m_voqToPortNamTable->set("", voqToPortNameVector);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ class PortsOrch : public Orch, public Subject
unique_ptr<Table> m_gearboxTable;
unique_ptr<Table> m_queueTable;
unique_ptr<Table> m_voqTable;
unique_ptr<Table> m_voqToPortNamTable;
unique_ptr<Table> m_queuePortTable;
unique_ptr<Table> m_queueIndexTable;
unique_ptr<Table> m_queueTypeTable;
Expand Down

0 comments on commit 3df86c2

Please sign in to comment.