Skip to content

Commit e5f9a9b

Browse files
authored
[PFCWD]: create pfcwd handler only when it doesn't exist. (sonic-net#413)
1 parent 833178e commit e5f9a9b

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

orchagent/orchdaemon.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ bool OrchDaemon::init()
177177
SAI_QUEUE_ATTR_PAUSE_STATUS,
178178
};
179179

180-
m_orchList.push_back(new PfcWdSwOrch<PfcWdActionHandler, PfcWdActionHandler>(
180+
m_orchList.push_back(new PfcWdSwOrch<PfcWdAclHandler, PfcWdLossyHandler>(
181181
m_configDb,
182182
pfc_wd_tables,
183183
portStatIds,

orchagent/pfcwdorch.cpp

+17-11
Original file line numberDiff line numberDiff line change
@@ -481,19 +481,25 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(swss::NotificationConsumer
481481
}
482482
else if (entry->second.action == PfcWdAction::PFC_WD_ACTION_DROP)
483483
{
484-
entry->second.handler = make_shared<DropHandler>(
485-
entry->second.portId,
486-
entry->first,
487-
entry->second.index,
488-
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
484+
if (entry->second.handler == nullptr)
485+
{
486+
entry->second.handler = make_shared<DropHandler>(
487+
entry->second.portId,
488+
entry->first,
489+
entry->second.index,
490+
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
491+
}
489492
}
490493
else if (entry->second.action == PfcWdAction::PFC_WD_ACTION_FORWARD)
491494
{
492-
entry->second.handler = make_shared<ForwardHandler>(
493-
entry->second.portId,
494-
entry->first,
495-
entry->second.index,
496-
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
495+
if (entry->second.handler == nullptr)
496+
{
497+
entry->second.handler = make_shared<ForwardHandler>(
498+
entry->second.portId,
499+
entry->first,
500+
entry->second.index,
501+
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
502+
}
497503
}
498504
else
499505
{
@@ -512,4 +518,4 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(swss::NotificationConsumer
512518

513519
// Trick to keep member functions in a separate file
514520
template class PfcWdSwOrch<PfcWdZeroBufferHandler, PfcWdLossyHandler>;
515-
template class PfcWdSwOrch<PfcWdActionHandler, PfcWdActionHandler>;
521+
template class PfcWdSwOrch<PfcWdAclHandler, PfcWdLossyHandler>;

0 commit comments

Comments
 (0)