Skip to content

Commit

Permalink
Enhance QosOrch::doTask by handling QUEUE table after all the rest ta…
Browse files Browse the repository at this point in the history
…bles handled (sonic-net#2801)

Signed-off-by: Stephen Sun <[email protected]>

What I did

Enhance QosOrch::doTask by handling QUEUE table after all the rest tables handled to avoid retry

Signed-off-by: Stephen Sun [email protected]

Details if related
During system initialization, QoS table items are received before gPortsOrch->allPortsReady() becomes true and will be handled all together after it becomes true.
In most cases, it will be handled in the for loop in the following snippet of code in OrchDaemon::start()

        auto *c = (Executor *)s;
        c->execute();

        /* After each iteration, periodically check all m_toSync map to
         * execute all the remaining tasks that need to be retried. */

        /* TODO: Abstract Orch class to have a specific todo list */
        for (Orch *o : m_orchList)
            o->doTask();
The QUEUE table items reference WRED_PROFILE and SCHEDULER_PROFILE table items. In case the latter tables are handled after the QUEUE table, the QUEUE table needs to be retried in the next for loop, which is not necessary.
So, we adjust the order in which the tables are handled to guarantee that all QoS table items to be handled in a single call to QosOrch::doTask.
  • Loading branch information
stephenxs authored May 30, 2023
1 parent b2c03d1 commit 98d2b0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2137,12 +2137,13 @@ void QosOrch::doTask()
SWSS_LOG_ENTER();

auto *port_qos_map_cfg_exec = getExecutor(CFG_PORT_QOS_MAP_TABLE_NAME);
auto *queue_exec = getExecutor(CFG_QUEUE_TABLE_NAME);

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

if (exec == port_qos_map_cfg_exec)
if (exec == port_qos_map_cfg_exec || exec == queue_exec)
{
continue;
}
Expand All @@ -2151,6 +2152,7 @@ void QosOrch::doTask()
}

port_qos_map_cfg_exec->drain();
queue_exec->drain();
}

void QosOrch::doTask(Consumer &consumer)
Expand Down
2 changes: 2 additions & 0 deletions tests/mock_tests/qosorch_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,8 @@ namespace qosorch_test
entries.clear();
// Drain QUEUE table
static_cast<Orch *>(gQosOrch)->doTask();
// Drain SCHEDULER table
static_cast<Orch *>(gQosOrch)->doTask();
// The dependency should be removed
CheckDependency(CFG_QUEUE_TABLE_NAME, "Ethernet0|0", "scheduler", CFG_SCHEDULER_TABLE_NAME);
static_cast<Orch *>(gQosOrch)->dumpPendingTasks(ts);
Expand Down

0 comments on commit 98d2b0c

Please sign in to comment.