diff --git a/orchagent/pfcwdorch.cpp b/orchagent/pfcwdorch.cpp index 9fe0daacfff..0f3785c18df 100644 --- a/orchagent/pfcwdorch.cpp +++ b/orchagent/pfcwdorch.cpp @@ -83,11 +83,6 @@ void PfcWdOrch::doTask(Consumer& consumer) consumer.m_toSync.erase(it++); } - - if (consumer.m_toSync.empty()) - { - m_entriesCreated = true; - } } } @@ -735,11 +730,6 @@ void PfcWdSwOrch::doTask(Consumer& consumer) { PfcWdOrch::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(); @@ -808,6 +798,39 @@ void PfcWdSwOrch::doTask(Consumer& consumer) } } +template +void PfcWdSwOrch::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 void PfcWdSwOrch::doTask(swss::NotificationConsumer& wdNotification) { diff --git a/orchagent/pfcwdorch.h b/orchagent/pfcwdorch.h index ac0f6f55a90..c1e2ffbc5e1 100644 --- a/orchagent/pfcwdorch.h +++ b/orchagent/pfcwdorch.h @@ -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 m_countersDb = nullptr; @@ -84,6 +83,7 @@ class PfcWdSwOrch: public PfcWdOrch //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;