From 84f80e0270c19a678eeb5c6e43f650ebee219058 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Mon, 28 Oct 2019 11:34:14 +0000 Subject: [PATCH] [portsorch] optimize to 3 iterations instead of 4 Signed-off-by: Stepan Blyschak --- orchagent/orchdaemon.cpp | 16 +++++++--------- orchagent/portsorch.cpp | 16 ++++++++++++++++ orchagent/portsorch.h | 1 + 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/orchagent/orchdaemon.cpp b/orchagent/orchdaemon.cpp index c8b2c78d1ab..5f1491a7e42 100644 --- a/orchagent/orchdaemon.cpp +++ b/orchagent/orchdaemon.cpp @@ -475,22 +475,20 @@ bool OrchDaemon::warmRestoreAndSyncUp() } /* - * Four iterations are needed. + * Three iterations are needed. * - * First iteration: switchorch, Port init/hostif create part of portorch. + * First iteration: switchorch, Port init/hostif create part of portorch, buffers configuration * - * Second iteratoin: gBufferOrch which requires port created, - * then port speed/mtu/fec_mode/pfc_asym/admin_status config. + * Second iteratoin: port speed/mtu/fec_mode/pfc_asym/admin_status config, + * other orch(s) which wait for port to become ready. * - * Third iteration: other orch(s) which wait for port init done. - * - * Fourth iteration: Drain remaining data that are out of order like LAG_MEMBER_TABLE and + * Third iteration: Drain remaining data that are out of order like LAG_MEMBER_TABLE and * VLAN_MEMBER_TABLE since they were checked before LAG_TABLE and VLAN_TABLE within gPortsOrch. */ - for (auto it = 0; it < 4; it++) + for (auto it = 0; it < 3; it++) { - SWSS_LOG_DEBUG("The current iteration is %d", it); + SWSS_LOG_NOTICE("The current iteration is %d", it); for (Orch *o : m_orchList) { diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index 6e003ec8121..4d5093f9d41 100644 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -2361,6 +2361,22 @@ void PortsOrch::doLagMemberTask(Consumer &consumer) } } +void PortsOrch::doTask() +{ + auto portConsumer = getExecutor(APP_PORT_TABLE_NAME); + portConsumer->drain(); + + for (auto& it: m_consumerMap) + { + auto consumer = it.second.get(); + if (consumer == portConsumer) + { + continue; + } + consumer->drain(); + } +} + void PortsOrch::doTask(Consumer &consumer) { SWSS_LOG_ENTER(); diff --git a/orchagent/portsorch.h b/orchagent/portsorch.h index d2819e62eaf..5fb6f4aed2c 100644 --- a/orchagent/portsorch.h +++ b/orchagent/portsorch.h @@ -126,6 +126,7 @@ class PortsOrch : public Orch, public Subject NotificationConsumer* m_portStatusNotificationConsumer; + void doTask() override; void doTask(Consumer &consumer); void doPortTask(Consumer &consumer); void doVlanTask(Consumer &consumer);