diff --git a/orchagent/orchdaemon.cpp b/orchagent/orchdaemon.cpp index 6f09bca9678..f9df5aac3e2 100644 --- a/orchagent/orchdaemon.cpp +++ b/orchagent/orchdaemon.cpp @@ -32,6 +32,7 @@ AclOrch *gAclOrch; CrmOrch *gCrmOrch; BufferOrch *gBufferOrch; SwitchOrch *gSwitchOrch; +QosOrch *gQosOrch; Directory gDirectory; OrchDaemon::OrchDaemon(DBConnector *applDb, DBConnector *configDb, DBConnector *stateDb) : @@ -116,7 +117,7 @@ bool OrchDaemon::init() CFG_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE_NAME, CFG_PFC_PRIORITY_TO_QUEUE_MAP_TABLE_NAME }; - QosOrch *qos_orch = new QosOrch(m_configDb, qos_tables); + gQosOrch = new QosOrch(m_configDb, qos_tables); vector buffer_tables = { CFG_BUFFER_POOL_TABLE_NAME, @@ -158,7 +159,7 @@ bool OrchDaemon::init() * when iterating ConsumerMap. * That is ensured implicitly by the order of map key, "LAG_TABLE" is smaller than "VLAN_TABLE" in lexicographic order. */ - m_orchList = { gSwitchOrch, gCrmOrch, gBufferOrch, gPortsOrch, gIntfsOrch, gNeighOrch, gRouteOrch, copp_orch, tunnel_decap_orch, qos_orch, wm_orch }; + m_orchList = { gSwitchOrch, gCrmOrch, gBufferOrch, gPortsOrch, gIntfsOrch, gNeighOrch, gRouteOrch, copp_orch, tunnel_decap_orch, gQosOrch, wm_orch }; bool initialize_dtel = false; diff --git a/orchagent/pfcwdorch.cpp b/orchagent/pfcwdorch.cpp index e0283bfeee2..36dc9875867 100644 --- a/orchagent/pfcwdorch.cpp +++ b/orchagent/pfcwdorch.cpp @@ -8,6 +8,7 @@ #include "select.h" #include "notifier.h" #include "redisclient.h" +#include "qosorch.h" #define PFC_WD_GLOBAL "GLOBAL" #define PFC_WD_ACTION "action" @@ -28,6 +29,7 @@ extern sai_port_api_t *sai_port_api; extern sai_queue_api_t *sai_queue_api; extern PortsOrch *gPortsOrch; +extern QosOrch *gQosOrch; template PfcWdOrch::PfcWdOrch(DBConnector *db, vector &tableNames): @@ -50,7 +52,7 @@ void PfcWdOrch::doTask(Consumer& consumer) { SWSS_LOG_ENTER(); - if (!gPortsOrch->isPortReady()) + if ((!gPortsOrch->isPortReady()) || (!gQosOrch->isQosMapsApplied())) { return; } @@ -469,6 +471,11 @@ void PfcWdSwOrch::registerInWdDb(const Port& port, losslessTc.insert(i); } + if (losslessTc.empty()) + { + SWSS_LOG_ERROR("No lossless TC found on port %s", port.m_alias.c_str()); + return; + } if (!c_portStatIds.empty()) { diff --git a/orchagent/qosorch.cpp b/orchagent/qosorch.cpp index 514cb5ec4da..bbe2e231e18 100644 --- a/orchagent/qosorch.cpp +++ b/orchagent/qosorch.cpp @@ -1357,6 +1357,7 @@ task_process_status QosOrch::handlePortQosMapTable(Consumer& consumer) } } + m_qosMapsApplied = true; SWSS_LOG_NOTICE("Applied QoS maps to ports"); return task_process_status::task_success; } diff --git a/orchagent/qosorch.h b/orchagent/qosorch.h index 0d9d22cd35f..4680ad0d085 100644 --- a/orchagent/qosorch.h +++ b/orchagent/qosorch.h @@ -113,6 +113,11 @@ class QosOrch : public Orch static type_map& getTypeMap(); static type_map m_qos_maps; + + bool isQosMapsApplied(void) + { + return m_qosMapsApplied; + } private: virtual void doTask(Consumer& consumer); @@ -155,5 +160,7 @@ class QosOrch : public Orch }; std::unordered_map m_scheduler_group_port_info; + + bool m_qosMapsApplied = false; }; #endif /* SWSS_QOSORCH_H */