Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 33 additions & 10 deletions orchagent/pfcwdorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ void PfcWdOrch<DropHandler, ForwardHandler>::doTask(Consumer& consumer)

consumer.m_toSync.erase(it++);
}

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

Expand Down Expand Up @@ -735,11 +730,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 @@ -808,6 +798,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