@@ -288,6 +288,7 @@ PortsOrch::PortsOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames)
288
288
289
289
m_cpuPort = Port (" CPU" , Port::CPU);
290
290
m_cpuPort.m_port_id = attr.value .oid ;
291
+ initCpuPort (m_cpuPort);
291
292
m_portList[m_cpuPort.m_alias ] = m_cpuPort;
292
293
m_port_ref_count[m_cpuPort.m_alias ] = 0 ;
293
294
@@ -1787,6 +1788,11 @@ sai_status_t PortsOrch::removePort(sai_object_id_t port_id)
1787
1788
return status;
1788
1789
}
1789
1790
1791
+ string PortsOrch::getPortFlexCounterTableKey (string key)
1792
+ {
1793
+ return string (PORT_STAT_COUNTER_FLEX_COUNTER_GROUP) + " :" + key;
1794
+ }
1795
+
1790
1796
string PortsOrch::getQueueWatermarkFlexCounterTableKey (string key)
1791
1797
{
1792
1798
return string (QUEUE_WATERMARK_STAT_COUNTER_FLEX_COUNTER_GROUP) + " :" + key;
@@ -1871,6 +1877,35 @@ bool PortsOrch::initPort(const string &alias, const int index, const set<int> &l
1871
1877
return true ;
1872
1878
}
1873
1879
1880
+ void PortsOrch::initCpuPort (Port &cpu_port)
1881
+ {
1882
+ SWSS_LOG_ENTER ();
1883
+
1884
+ initializeQueues (cpu_port);
1885
+
1886
+ /* Add port name map to counter table */
1887
+ FieldValueTuple tuple (cpu_port.m_alias , sai_serialize_object_id (cpu_port.m_port_id ));
1888
+ vector<FieldValueTuple> fields;
1889
+ fields.push_back (tuple);
1890
+ m_counterTable->set (" " , fields);
1891
+
1892
+ /* Add port to flex_counter for updating stat counters */
1893
+ string key = getPortFlexCounterTableKey (sai_serialize_object_id (cpu_port.m_port_id ));
1894
+ std::string delimiter = " " ;
1895
+ std::ostringstream counters_stream;
1896
+ for (const auto &id: port_stat_ids)
1897
+ {
1898
+ counters_stream << delimiter << sai_serialize_port_stat (id);
1899
+ delimiter = comma;
1900
+ }
1901
+
1902
+ fields.clear ();
1903
+ fields.emplace_back (PORT_COUNTER_ID_LIST, counters_stream.str ());
1904
+
1905
+ m_flexCounterTable->set (key, fields);
1906
+ return ;
1907
+ }
1908
+
1874
1909
void PortsOrch::deInitPort (string alias, sai_object_id_t port_id)
1875
1910
{
1876
1911
SWSS_LOG_ENTER ();
@@ -3934,7 +3969,7 @@ void PortsOrch::generateQueueMap()
3934
3969
3935
3970
for (const auto & it: m_portList)
3936
3971
{
3937
- if (it.second .m_type == Port::PHY)
3972
+ if (( it.second .m_type == Port::PHY) || (it. second . m_type == Port::CPU) )
3938
3973
{
3939
3974
generateQueueMapPerPort (it.second );
3940
3975
}
0 commit comments