@@ -233,9 +233,9 @@ static char* hostif_vlan_tag[] = {
233
233
*/
234
234
PortsOrch::PortsOrch (DBConnector *db, vector<table_name_with_pri_t > &tableNames, DBConnector *chassisAppDb) :
235
235
Orch(db, tableNames),
236
- port_stat_manager(PORT_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false ),
237
- port_buffer_drop_stat_manager(PORT_BUFFER_DROP_STAT_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_BUFFER_DROP_STAT_POLLING_INTERVAL_MS, false ),
238
- queue_stat_manager(QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, QUEUE_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, false )
236
+ port_stat_manager(PORT_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, true ),
237
+ port_buffer_drop_stat_manager(PORT_BUFFER_DROP_STAT_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_BUFFER_DROP_STAT_POLLING_INTERVAL_MS, true ),
238
+ queue_stat_manager(QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, QUEUE_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, true )
239
239
{
240
240
SWSS_LOG_ENTER ();
241
241
@@ -2131,21 +2131,19 @@ bool PortsOrch::initPort(const string &alias, const int index, const set<int> &l
2131
2131
vector<FieldValueTuple> fields;
2132
2132
fields.push_back (tuple);
2133
2133
m_counterTable->set (" " , fields);
2134
-
2135
2134
// Install a flex counter for this port to track stats
2136
- auto flex_counters_orch = gDirectory .get <FlexCounterOrch*>();
2137
- /* Delay installing the counters if they are yet enabled
2138
- If they are enabled, install the counters immediately */
2139
- if (flex_counters_orch->getPortCountersState ())
2135
+ std::unordered_set<std::string> counter_stats;
2136
+ for (const auto & it: port_stat_ids)
2140
2137
{
2141
- auto port_counter_stats = generateCounterStats (PORT_STAT_COUNTER_FLEX_COUNTER_GROUP);
2142
- port_stat_manager.setCounterIdList (p.m_port_id , CounterType::PORT, port_counter_stats);
2138
+ counter_stats.emplace (sai_serialize_port_stat (it));
2143
2139
}
2144
- if (flex_counters_orch->getPortBufferDropCountersState ())
2140
+ port_stat_manager.setCounterIdList (p.m_port_id , CounterType::PORT, counter_stats);
2141
+ std::unordered_set<std::string> port_buffer_drop_stats;
2142
+ for (const auto & it: port_buffer_drop_stat_ids)
2145
2143
{
2146
- auto port_buffer_drop_stats = generateCounterStats (PORT_BUFFER_DROP_STAT_FLEX_COUNTER_GROUP);
2147
- port_buffer_drop_stat_manager.setCounterIdList (p.m_port_id , CounterType::PORT, port_buffer_drop_stats);
2144
+ port_buffer_drop_stats.emplace (sai_serialize_port_stat (it));
2148
2145
}
2146
+ port_buffer_drop_stat_manager.setCounterIdList (p.m_port_id , CounterType::PORT, port_buffer_drop_stats);
2149
2147
2150
2148
PortUpdate update = { p, true };
2151
2149
notify (SUBJECT_TYPE_PORT_CHANGE, static_cast <void *>(&update));
@@ -2178,11 +2176,8 @@ void PortsOrch::deInitPort(string alias, sai_object_id_t port_id)
2178
2176
p.m_port_id = port_id;
2179
2177
2180
2178
/* remove port from flex_counter_table for updating counters */
2181
- auto flex_counters_orch = gDirectory .get <FlexCounterOrch*>();
2182
- if ((flex_counters_orch->getPortCountersState ()))
2183
- {
2184
- port_stat_manager.clearCounterIdList (p.m_port_id );
2185
- }
2179
+ port_stat_manager.clearCounterIdList (p.m_port_id );
2180
+
2186
2181
/* remove port name map from counter table */
2187
2182
m_counter_db->hdel (COUNTERS_PORT_NAME_MAP, alias);
2188
2183
@@ -4704,38 +4699,6 @@ void PortsOrch::generatePriorityGroupMapPerPort(const Port& port)
4704
4699
CounterCheckOrch::getInstance ().addPort (port);
4705
4700
}
4706
4701
4707
- void PortsOrch::generatePortCounterMap ()
4708
- {
4709
- if (m_isPortCounterMapGenerated)
4710
- {
4711
- return ;
4712
- }
4713
-
4714
- auto port_counter_stats = generateCounterStats (PORT_STAT_COUNTER_FLEX_COUNTER_GROUP);
4715
- for (const auto & it: m_portList)
4716
- {
4717
- port_stat_manager.setCounterIdList (it.second .m_port_id , CounterType::PORT, port_counter_stats);
4718
- }
4719
-
4720
- m_isPortCounterMapGenerated = true ;
4721
- }
4722
-
4723
- void PortsOrch::generatePortBufferDropCounterMap ()
4724
- {
4725
- if (m_isPortBufferDropCounterMapGenerated)
4726
- {
4727
- return ;
4728
- }
4729
-
4730
- auto port_buffer_drop_stats = generateCounterStats (PORT_BUFFER_DROP_STAT_FLEX_COUNTER_GROUP);
4731
- for (const auto & it: m_portList)
4732
- {
4733
- port_buffer_drop_stat_manager.setCounterIdList (it.second .m_port_id , CounterType::PORT, port_buffer_drop_stats);
4734
- }
4735
-
4736
- m_isPortBufferDropCounterMapGenerated = true ;
4737
- }
4738
-
4739
4702
void PortsOrch::doTask (NotificationConsumer &consumer)
4740
4703
{
4741
4704
SWSS_LOG_ENTER ();
@@ -5602,26 +5565,6 @@ bool PortsOrch::setVoqInbandIntf(string &alias, string &type)
5602
5565
return true ;
5603
5566
}
5604
5567
5605
- std::unordered_set<std::string> PortsOrch::generateCounterStats (const string& type)
5606
- {
5607
- std::unordered_set<std::string> counter_stats;
5608
- if (type == PORT_STAT_COUNTER_FLEX_COUNTER_GROUP)
5609
- {
5610
- for (const auto & it: port_stat_ids)
5611
- {
5612
- counter_stats.emplace (sai_serialize_port_stat (it));
5613
- }
5614
- }
5615
- else if (type == PORT_BUFFER_DROP_STAT_FLEX_COUNTER_GROUP)
5616
- {
5617
- for (const auto & it: port_buffer_drop_stat_ids)
5618
- {
5619
- counter_stats.emplace (sai_serialize_port_stat (it));
5620
- }
5621
- }
5622
- return counter_stats;
5623
- }
5624
-
5625
5568
void PortsOrch::voqSyncAddLag (Port &lag)
5626
5569
{
5627
5570
int32_t switch_id = lag.m_system_lag_info .switch_id ;
0 commit comments