@@ -47,6 +47,7 @@ extern BufferOrch *gBufferOrch;
4747#define MAX_VALID_VLAN_ID 4094
4848
4949#define PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS 1000
50+ #define PORT_BUFFER_DROP_STAT_POLLING_INTERVAL_MS 60000
5051#define QUEUE_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS 10000
5152#define QUEUE_WATERMARK_FLEX_STAT_COUNTER_POLL_MSECS " 10000"
5253#define PG_WATERMARK_FLEX_STAT_COUNTER_POLL_MSECS " 10000"
@@ -145,6 +146,12 @@ const vector<sai_port_stat_t> port_stat_ids =
145146 SAI_PORT_STAT_ETHER_IN_PKTS_128_TO_255_OCTETS,
146147};
147148
149+ const vector<sai_port_stat_t > port_buffer_drop_stat_ids =
150+ {
151+ SAI_PORT_STAT_IN_DROPPED_PKTS,
152+ SAI_PORT_STAT_OUT_DROPPED_PKTS
153+ };
154+
148155static const vector<sai_queue_stat_t > queue_stat_ids =
149156{
150157 SAI_QUEUE_STAT_PACKETS,
@@ -187,6 +194,7 @@ static char* hostif_vlan_tag[] = {
187194PortsOrch::PortsOrch (DBConnector *db, vector<table_name_with_pri_t > &tableNames) :
188195 Orch(db, tableNames),
189196 port_stat_manager(PORT_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, true ),
197+ port_buffer_drop_stat_manager(PORT_BUFFER_DROP_STAT_FLEX_COUNTER_GROUP, StatsMode::READ, PORT_BUFFER_DROP_STAT_POLLING_INTERVAL_MS, true ),
190198 queue_stat_manager(QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP, StatsMode::READ, QUEUE_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS, true )
191199{
192200 SWSS_LOG_ENTER ();
@@ -1845,6 +1853,13 @@ bool PortsOrch::initPort(const string &alias, const int index, const set<int> &l
18451853 counter_stats.emplace (sai_serialize_port_stat (it));
18461854 }
18471855 port_stat_manager.setCounterIdList (p.m_port_id , CounterType::PORT, counter_stats);
1856+ std::unordered_set<std::string> port_buffer_drop_stats;
1857+ for (const auto & it: port_buffer_drop_stat_ids)
1858+ {
1859+ port_buffer_drop_stats.emplace (sai_serialize_port_stat (it));
1860+ }
1861+ port_buffer_drop_stat_manager.setCounterIdList (p.m_port_id , CounterType::PORT, port_buffer_drop_stats);
1862+
18481863 PortUpdate update = { p, true };
18491864 notify (SUBJECT_TYPE_PORT_CHANGE, static_cast <void *>(&update));
18501865
0 commit comments