Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[portsorch] Ports initialization speedup #3506

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions orchagent/orch.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@ class Orch
virtual void doTask(swss::NotificationConsumer &consumer) { }
virtual void doTask(swss::SelectableTimer &timer) { }

/*
* Called once after APPLY_VIEW in warm/fast boot scenario.
* Orch can override this method to perform orch specific operations after boot is finished.
* These operations are not meant to produce additional ASIC configuration,
* instead a capability fetch and STATE_DB update here is encouraged.
* Orch is not expected to call the base method implementation as it must remain
* empty for compatibility reasons.
*/
virtual void onWarmBootEnd() { }

void dumpPendingTasks(std::vector<std::string> &ts);

/**
Expand Down
8 changes: 6 additions & 2 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,8 @@ void OrchDaemon::start(long heartBeatInterval)
*/
bool OrchDaemon::warmRestoreAndSyncUp()
{
SWSS_LOG_ENTER();

WarmStart::setWarmStartState("orchagent", WarmStart::INITIALIZED);

for (Orch *o : m_orchList)
Expand Down Expand Up @@ -998,8 +1000,10 @@ bool OrchDaemon::warmRestoreAndSyncUp()

syncd_apply_view();

/* Start dynamic state sync up */
gPortsOrch->refreshPortStatus();
for (Orch *o : m_orchList)
{
o->onWarmBootEnd();
}

/*
* Note. Arp sync up is handled in neighsyncd.
Expand Down
23 changes: 7 additions & 16 deletions orchagent/p4orch/tests/fake_portorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,24 +418,11 @@ void PortsOrch::removeDefaultBridgePorts()
{
}

bool PortsOrch::initializePort(Port &port)
{
return true;
}

void PortsOrch::initializePriorityGroups(Port &port)
{
}

void PortsOrch::initializePortBufferMaximumParameters(Port &port)
void PortsOrch::initializePortBufferMaximumParameters(const Port &port)
{
}

void PortsOrch::initializeQueues(Port &port)
{
}

bool PortsOrch::addHostIntfs(Port &port, string alias, sai_object_id_t &host_intfs_id)
bool PortsOrch::addHostIntfs(Port &port, string alias, sai_object_id_t &host_intfs_id, bool up)
{
return true;
}
Expand Down Expand Up @@ -500,7 +487,7 @@ sai_status_t PortsOrch::removePort(sai_object_id_t port_id)
return SAI_STATUS_SUCCESS;
}

bool PortsOrch::initPort(const PortConfig &port)
bool PortsOrch::initExistingPort(const PortConfig &port)
{
return true;
}
Expand Down Expand Up @@ -699,3 +686,7 @@ std::unordered_set<std::string> PortsOrch::generateCounterStats(const string &ty
void PortsOrch::doTask(swss::SelectableTimer &timer)
{
}

void PortsOrch::onWarmBootEnd()
{
}
8 changes: 6 additions & 2 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ extern "C" {
#include <sairedis.h>

#define DEFAULT_PORT_VLAN_ID 1

#define MAX_MACSEC_SECTAG_SIZE 32

/*
* Default MTU is derived from SAI_PORT_ATTR_MTU (1514)
* Orchagent adds extra 22 bytes for Ethernet header and FCS,
* hence setting to 1492 (1514 - 22)
*/
#define DEFAULT_MTU 1492
#define DEFAULT_MTU (1492 - MAX_MACSEC_SECTAG_SIZE)

/*
* Default TPID is 8100
Expand Down Expand Up @@ -210,7 +213,6 @@ class Port
uint32_t m_fdb_count = 0;
uint64_t m_flap_count = 0;
uint32_t m_up_member_count = 0;
uint32_t m_maximum_headroom = 0;
std::set<uint32_t> m_adv_speeds;
sai_port_interface_type_t m_interface_type = SAI_PORT_INTERFACE_TYPE_NONE;
std::set<sai_port_interface_type_t> m_adv_interface_types;
Expand Down Expand Up @@ -268,6 +270,8 @@ class Port
uint32_t m_suppress_threshold = 0;
uint32_t m_reuse_threshold = 0;
uint32_t m_flap_penalty = 0;

Role m_role;
};

}
Expand Down
Loading
Loading