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

[voq/systemlag] Voq system lag functionality #1605

Merged
merged 5 commits into from
Mar 31, 2021
Merged
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
6 changes: 4 additions & 2 deletions orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ dist_swss_DATA = \
port_rates.lua \
watermark_queue.lua \
watermark_pg.lua \
watermark_bufferpool.lua
watermark_bufferpool.lua \
lagids.lua

bin_PROGRAMS = orchagent routeresync orchagent_restart_check

Expand Down Expand Up @@ -62,7 +63,8 @@ orchagent_SOURCES = \
debugcounterorch.cpp \
natorch.cpp \
muxorch.cpp \
macsecorch.cpp
macsecorch.cpp \
lagid.cpp

orchagent_SOURCES += flex_counter/flex_counter_manager.cpp flex_counter/flex_counter_stat_manager.cpp
orchagent_SOURCES += debug_counter/debug_counter.cpp debug_counter/drop_counter.cpp
Expand Down
42 changes: 35 additions & 7 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern BufferOrch *gBufferOrch;
extern bool gIsNatSupported;
extern NeighOrch *gNeighOrch;
extern string gMySwitchType;
extern int32_t gVoqMySwitchId;

const int intfsorch_pri = 35;

Expand Down Expand Up @@ -1362,9 +1363,14 @@ bool IntfsOrch::isRemoteSystemPortIntf(string alias)
Port port;
if(gPortsOrch->getPort(alias, port))
{
if (port.m_type == Port::LAG)
{
return(port.m_system_lag_info.switch_id != gVoqMySwitchId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put the statement in {} to be consistent with the rest of the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o.k. I'll fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

}

return(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE);
}
//Given alias is system port alias of the local port
//Given alias is system port alias of the local port/LAG
return false;
}

Expand All @@ -1375,11 +1381,22 @@ void IntfsOrch::voqSyncAddIntf(string &alias)
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
if (port.m_type == Port::LAG)
{
return;
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
alias = port.m_system_lag_info.alias;
}
else
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
alias = port.m_system_port_info.alias;
}
else
{
Expand All @@ -1401,11 +1418,22 @@ void IntfsOrch::voqSyncDelIntf(string &alias)
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
if (port.m_type == Port::LAG)
{
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
alias = port.m_system_lag_info.alias;
}
else
{
return;
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
alias = port.m_system_port_info.alias;
}
else
{
Expand Down
30 changes: 30 additions & 0 deletions orchagent/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ string gMySwitchType = "";
int32_t gVoqMySwitchId = -1;
int32_t gVoqMaxCores = 0;
uint32_t gCfgSystemPorts = 0;
string gMyHostName = "";
string gMyAsicName = "";

void usage()
{
Expand Down Expand Up @@ -212,6 +214,34 @@ bool getSystemPortConfigList(DBConnector *cfgDb, DBConnector *appDb, vector<sai_
return false;
}

if (!cfgDeviceMetaDataTable.hget("localhost", "hostname", value))
{
// hostname is not configured.
SWSS_LOG_ERROR("Host name is not configured");
return false;
}
gMyHostName = value;

if (!gMyHostName.size())
{
SWSS_LOG_ERROR("Invalid host name %s configured", gMyHostName.c_str());
return false;
}

if (!cfgDeviceMetaDataTable.hget("localhost", "asic_name", value))
{
// asic_name is not configured.
SWSS_LOG_ERROR("Asic name is not configured");
return false;
}
gMyAsicName = value;

if (!gMyAsicName.size())
{
SWSS_LOG_ERROR("Invalid asic name %s configured", gMyAsicName.c_str());
return false;
}

vector<string> spKeys;
cfgSystemPortTable.getKeys(spKeys);

Expand Down
37 changes: 29 additions & 8 deletions orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern RouteOrch *gRouteOrch;
extern FgNhgOrch *gFgNhgOrch;
extern Directory<Orch*> gDirectory;
extern string gMySwitchType;
extern int32_t gVoqMySwitchId;

const int neighorch_pri = 30;

Expand Down Expand Up @@ -1092,7 +1093,6 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Failed to add voq neighbor %s to SAI", kfvKey(t).c_str());
it++;
}
}
Expand All @@ -1117,7 +1117,6 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer)
}
else
{
SWSS_LOG_ERROR("Failed to remove voq neighbor %s from SAI", kfvKey(t).c_str());
it++;
}
}
Expand Down Expand Up @@ -1208,11 +1207,22 @@ void NeighOrch::voqSyncAddNeigh(string &alias, IpAddress &ip_address, const MacA
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
if (port.m_type == Port::LAG)
{
return;
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
alias = port.m_system_lag_info.alias;
}
else
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
alias = port.m_system_port_info.alias;
}
else
{
Expand Down Expand Up @@ -1254,11 +1264,22 @@ void NeighOrch::voqSyncDelNeigh(string &alias, IpAddress &ip_address)
Port port;
if(gPortsOrch->getPort(alias, port))
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
if (port.m_type == Port::LAG)
{
return;
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
alias = port.m_system_lag_info.alias;
}
else
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
alias = port.m_system_port_info.alias;
}
alias = port.m_system_port_info.alias;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bool OrchDaemon::init()
};

gCrmOrch = new CrmOrch(m_configDb, CFG_CRM_TABLE_NAME);
gPortsOrch = new PortsOrch(m_applDb, ports_tables);
gPortsOrch = new PortsOrch(m_applDb, ports_tables, m_chassisAppDb);
TableConnector stateDbFdb(m_stateDb, STATE_FDB_TABLE_NAME);
gFdbOrch = new FdbOrch(m_applDb, app_fdb_tables, stateDbFdb, gPortsOrch);

Expand Down
8 changes: 8 additions & 0 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ struct SystemPortInfo
uint32_t num_voq = 8;
};

struct SystemLagInfo
{
std::string alias = "";
int32_t switch_id = -1;
int32_t spa_id = 0;
};

class Port
{
public:
Expand Down Expand Up @@ -142,6 +149,7 @@ class Port

sai_object_id_t m_system_port_oid = 0;
SystemPortInfo m_system_port_info;
SystemLagInfo m_system_lag_info;

};

Expand Down
Loading