Skip to content

Commit 00e38be

Browse files
sihuihan88Shuotian Cheng
authored and
Shuotian Cheng
committed
[pfcwdorch]: Set correct polling interval for pfcWdOrch object (sonic-net#395)
Signed-off-by: Sihui Han <sihan@microsoft.com>
1 parent 4bcd3de commit 00e38be

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

orchagent/pfcwdorch.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::registerInWdDb(const Port& port,
269269

270270
if (!c_portStatIds.empty())
271271
{
272-
string key = sai_serialize_object_id(port.m_port_id) + ":" + std::to_string(INT_MAX);
272+
string key = sai_serialize_object_id(port.m_port_id) + ":" + std::to_string(m_pollInterval);
273273
vector<FieldValueTuple> fieldValues;
274274
string str = counterIdsToStr(c_portStatIds, &sai_serialize_port_stat);
275275
fieldValues.emplace_back(PFC_WD_PORT_COUNTER_ID_LIST, str);
@@ -318,7 +318,7 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::registerInWdDb(const Port& port,
318318
// Create internal entry
319319
m_entryMap.emplace(queueId, PfcWdQueueEntry(action, port.m_port_id, i));
320320

321-
string key = queueIdStr + ":" + std::to_string(INT_MAX);
321+
string key = queueIdStr + ":" + std::to_string(m_pollInterval);
322322

323323
m_pfcWdTable->set(key, queueFieldValues);
324324

@@ -337,7 +337,7 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::unregisterFromWdDb(const Port& po
337337
for (uint8_t i = 0; i < PFC_WD_TC_MAX; i++)
338338
{
339339
sai_object_id_t queueId = port.m_queue_ids[i];
340-
string key = sai_serialize_object_id(queueId) + ":" + std::to_string(INT_MAX);
340+
string key = sai_serialize_object_id(queueId) + ":" + std::to_string(m_pollInterval);
341341

342342
// Unregister in syncd
343343
m_pfcWdTable->del(key);
@@ -358,7 +358,8 @@ PfcWdSwOrch<DropHandler, ForwardHandler>::PfcWdSwOrch(
358358
m_pfcWdTable(new ProducerStateTable(m_pfcWdDb.get(), PFC_WD_STATE_TABLE)),
359359
c_portStatIds(portStatIds),
360360
c_queueStatIds(queueStatIds),
361-
c_queueAttrIds(queueAttrIds)
361+
c_queueAttrIds(queueAttrIds),
362+
m_pollInterval(pollInterval)
362363
{
363364
SWSS_LOG_ENTER();
364365

@@ -389,8 +390,10 @@ PfcWdSwOrch<DropHandler, ForwardHandler>::PfcWdSwOrch(
389390
fieldValues.emplace_back(SAI_OBJECT_TYPE, sai_serialize_object_type(SAI_OBJECT_TYPE_QUEUE));
390391

391392
auto pluginTable = ProducerStateTable(m_pfcWdDb.get(), PLUGIN_TABLE);
392-
pluginTable.set(detectSha, fieldValues);
393-
pluginTable.set(restoreSha, fieldValues);
393+
string detectShaKey = detectSha + ":" + std::to_string(m_pollInterval);
394+
string restoreShaKey = restoreSha + ":" + std::to_string(m_pollInterval);
395+
pluginTable.set(detectShaKey, fieldValues);
396+
pluginTable.set(restoreShaKey, fieldValues);
394397
}
395398
catch (...)
396399
{

orchagent/pfcwdorch.h

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ class PfcWdSwOrch: public PfcWdOrch<DropHandler, ForwardHandler>
101101

102102
atomic_bool m_runPfcWdSwOrchThread = { false };
103103
shared_ptr<thread> m_pfcWatchdogThread = nullptr;
104+
105+
int m_pollInterval;
104106
};
105107

106108
#endif

0 commit comments

Comments
 (0)