Skip to content

Commit

Permalink
Address review comment: remove data member m_entriesCreated, which is…
Browse files Browse the repository at this point in the history
… introduced for dependancy resolution purpose. (sonic-net#839)

Signed-off-by: Wenda Ni <[email protected]>
  • Loading branch information
wendani authored and lguohan committed Jun 4, 2019
1 parent 7d0c551 commit 348e4b2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
43 changes: 33 additions & 10 deletions orchagent/pfcwdorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ void PfcWdOrch<DropHandler, ForwardHandler>::doTask(Consumer& consumer)
break;
}
}

if (consumer.m_toSync.empty())
{
m_entriesCreated = true;
}
}
}

Expand Down Expand Up @@ -763,11 +758,6 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(Consumer& consumer)
{
PfcWdOrch<DropHandler, ForwardHandler>::doTask(consumer);

if (!this->m_entriesCreated)
{
return;
}

if ((consumer.getDbId() == APPL_DB) && (consumer.getTableName() == APP_PFC_WD_TABLE_NAME))
{
auto it = consumer.m_toSync.begin();
Expand Down Expand Up @@ -836,6 +826,39 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(Consumer& consumer)
}
}

template <typename DropHandler, typename ForwardHandler>
void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask()
{
SWSS_LOG_ENTER();

// In the warm-reboot case with ongoing PFC storm,
// we care about dependency.
// PFC watchdog should be started on a port queue before
// a storm action can be taken in effect. The PFC watchdog
// configuration is stored in CONFIG_DB CFG_PFC_WD_TABLE_NAME,
// while the ongoing storming port queue is recorded
// in APPL_DB APP_PFC_WD_TABLE_NAME. We thus invoke the Executor
// in this order.
// In the cold-boot case, APP_PFC_WD_TABLE_NAME will not
// be populated. No dependency is introduced in this case.
auto *cfg_exec = this->getExecutor(CFG_PFC_WD_TABLE_NAME);
cfg_exec->drain();

auto *appl_exec = this->getExecutor(APP_PFC_WD_TABLE_NAME);
appl_exec->drain();

for (const auto &it : this->m_consumerMap)
{
auto *exec = it.second.get();

if ((exec == cfg_exec) || (exec == appl_exec))
{
continue;
}
exec->drain();
}
}

template <typename DropHandler, typename ForwardHandler>
void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(swss::NotificationConsumer& wdNotification)
{
Expand Down
2 changes: 1 addition & 1 deletion orchagent/pfcwdorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class PfcWdOrch: public Orch
protected:
virtual bool startWdActionOnQueue(const string &event, sai_object_id_t queueId) = 0;

bool m_entriesCreated = false;
private:

shared_ptr<DBConnector> m_countersDb = nullptr;
Expand Down Expand Up @@ -84,6 +83,7 @@ class PfcWdSwOrch: public PfcWdOrch<DropHandler, ForwardHandler>
//XXX Add port/queue state change event handlers

bool bake() override;
void doTask() override;

protected:
bool startWdActionOnQueue(const string &event, sai_object_id_t queueId) override;
Expand Down

0 comments on commit 348e4b2

Please sign in to comment.