Skip to content

Commit

Permalink
[PFCWD]: create pfcwd handler only when it doesn't exist. (sonic-net#413
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sihuihan88 authored Dec 12, 2017
1 parent 833178e commit e5f9a9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ bool OrchDaemon::init()
SAI_QUEUE_ATTR_PAUSE_STATUS,
};

m_orchList.push_back(new PfcWdSwOrch<PfcWdActionHandler, PfcWdActionHandler>(
m_orchList.push_back(new PfcWdSwOrch<PfcWdAclHandler, PfcWdLossyHandler>(
m_configDb,
pfc_wd_tables,
portStatIds,
Expand Down
28 changes: 17 additions & 11 deletions orchagent/pfcwdorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,19 +481,25 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(swss::NotificationConsumer
}
else if (entry->second.action == PfcWdAction::PFC_WD_ACTION_DROP)
{
entry->second.handler = make_shared<DropHandler>(
entry->second.portId,
entry->first,
entry->second.index,
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
if (entry->second.handler == nullptr)
{
entry->second.handler = make_shared<DropHandler>(
entry->second.portId,
entry->first,
entry->second.index,
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
}
}
else if (entry->second.action == PfcWdAction::PFC_WD_ACTION_FORWARD)
{
entry->second.handler = make_shared<ForwardHandler>(
entry->second.portId,
entry->first,
entry->second.index,
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
if (entry->second.handler == nullptr)
{
entry->second.handler = make_shared<ForwardHandler>(
entry->second.portId,
entry->first,
entry->second.index,
PfcWdOrch<DropHandler, ForwardHandler>::getCountersTable());
}
}
else
{
Expand All @@ -512,4 +518,4 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(swss::NotificationConsumer

// Trick to keep member functions in a separate file
template class PfcWdSwOrch<PfcWdZeroBufferHandler, PfcWdLossyHandler>;
template class PfcWdSwOrch<PfcWdActionHandler, PfcWdActionHandler>;
template class PfcWdSwOrch<PfcWdAclHandler, PfcWdLossyHandler>;

0 comments on commit e5f9a9b

Please sign in to comment.