Skip to content

Commit

Permalink
[portsorch] optimize to 3 iterations instead of 4
Browse files Browse the repository at this point in the history
Signed-off-by: Stepan Blyschak <[email protected]>
  • Loading branch information
Stepan Blyschak committed Oct 28, 2019
1 parent 51e8707 commit 84f80e0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
16 changes: 7 additions & 9 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
16 changes: 16 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 84f80e0

Please sign in to comment.