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

[Chassis][Voq] Remote ECMP acceleration for voq chassis #3139

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
57 changes: 54 additions & 3 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ void IntfsOrch::doTask(Consumer &consumer)
bool mpls = false;
string vlan = "";
string loopbackAction = "";

string oper_status ="";
for (auto idx : data)
{
const auto &field = fvField(idx);
Expand Down Expand Up @@ -811,6 +811,10 @@ void IntfsOrch::doTask(Consumer &consumer)
{
loopbackAction = value;
}
else if (field == "oper_status")
{
oper_status = value;
}
}

if (alias == "eth0" || alias == "docker0")
Expand Down Expand Up @@ -864,7 +868,19 @@ void IntfsOrch::doTask(Consumer &consumer)
it = consumer.m_toSync.erase(it);
continue;
}

if(table_name == CHASSIS_APP_SYSTEM_INTERFACE_TABLE_NAME)
{
if(isRemoteSystemPortIntf(alias))
{
SWSS_LOG_INFO("Handle remote systemport intf %s, oper status %s", alias.c_str(), oper_status.c_str());
bool isUp = (oper_status == "up") ? true : false;
if (!gNeighOrch->ifChangeInformRemoteNextHop(alias, isUp))
{
SWSS_LOG_WARN("Unable to update the nexthop for port %s, oper status %s", alias.c_str(), oper_status.c_str());
}

}
}
//Voq Inband interface config processing
if(inband_type.size() && !ip_prefix_in_key)
{
Expand Down Expand Up @@ -1659,7 +1675,10 @@ void IntfsOrch::voqSyncAddIntf(string &alias)
return;
}

FieldValueTuple nullFv ("NULL", "NULL");

string oper_status = port.m_oper_status == SAI_PORT_OPER_STATUS_UP ? "up" : "down";

FieldValueTuple nullFv ("oper_status", oper_status);
vector<FieldValueTuple> attrs;
attrs.push_back(nullFv);

Expand Down Expand Up @@ -1699,3 +1718,35 @@ void IntfsOrch::voqSyncDelIntf(string &alias)
m_tableVoqSystemInterfaceTable->del(alias);
}

void IntfsOrch::voqSyncIntfState(string &alias, bool isUp)
{
Port port;
string port_alias;
if(gPortsOrch->getPort(alias, port))
{
if (port.m_type == Port::LAG)
{
if (port.m_system_lag_info.switch_id != gVoqMySwitchId)
{
return;
}
port_alias = port.m_system_lag_info.alias;
}
else
{
if(port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_REMOTE)
{
return;
}
port_alias = port.m_system_port_info.alias;
}
}
else
{
SWSS_LOG_ERROR("Port does not exist for %s!", port_alias.c_str());
return;
}

SWSS_LOG_NOTICE("Syncing system interface state %s for port %s", isUp ? "up" : "down", port_alias.c_str());
m_tableVoqSystemInterfaceTable->hset(port_alias, "oper_status", isUp ? "up" : "down");
}
1 change: 1 addition & 0 deletions orchagent/intfsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class IntfsOrch : public Orch

bool isRemoteSystemPortIntf(string alias);
bool isLocalSystemPortIntf(string alias);
void voqSyncIntfState(string &alias, bool);

private:

Expand Down
42 changes: 42 additions & 0 deletions orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ bool NeighOrch::setNextHopFlag(const NextHopKey &nexthop, const uint32_t nh_flag
auto nhop = m_syncdNextHops.find(nexthop);
bool rc = false;

SWSS_LOG_INFO("setNextHopFlag on %s seen on port %s ",
nexthop.ip_address.to_string().c_str(), nexthop.alias.c_str());
assert(nhop != m_syncdNextHops.end());

if (nhop->second.nh_flags & nh_flag)
Expand Down Expand Up @@ -379,6 +381,8 @@ bool NeighOrch::clearNextHopFlag(const NextHopKey &nexthop, const uint32_t nh_fl

nhop->second.nh_flags &= ~nh_flag;
uint32_t count;
SWSS_LOG_INFO("clearnexthop on %s seen on port %s ",
nexthop.ip_address.to_string().c_str(), nexthop.alias.c_str());
switch (nh_flag)
{
case NHFLAGS_IFDOWN:
Expand Down Expand Up @@ -1906,3 +1910,41 @@ bool NeighOrch::addZeroMacTunnelRoute(const NeighborEntry& entry, const MacAddre

return false;
}

bool NeighOrch::ifChangeInformRemoteNextHop(const string &alias, bool if_up)
{
SWSS_LOG_ENTER();
bool rc = true;
Port inbp;
gPortsOrch->getInbandPort(inbp);
SWSS_LOG_INFO("Inband port %s", inbp.m_alias.c_str());

for (auto nbr = m_syncdNeighbors.begin(); nbr != m_syncdNeighbors.end(); ++nbr)
{
if (nbr->first.alias != alias)
{
continue;
}
SWSS_LOG_INFO"Found remote Neighbor %s on %s", nbr->first.ip_address.to_string().c_str(), alias.c_str());
NextHopKey nhop = { nbr->first.ip_address, inbp.m_alias };

if (if_up)
{
rc = clearNextHopFlag(nhop, NHFLAGS_IFDOWN);
}
else
{
rc = setNextHopFlag(nhop, NHFLAGS_IFDOWN);
}

if (rc == true)
{
continue;
}
else
{
break;
}
}
return rc;
}
2 changes: 2 additions & 0 deletions orchagent/neighorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class NeighOrch : public Orch, public Subject, public Observer
bool removeTunnelNextHop(const NextHopKey&);

bool ifChangeInformNextHop(const string &, bool);

bool isNextHopFlagSet(const NextHopKey &, const uint32_t);
bool removeOverlayNextHop(const NextHopKey &);
void update(SubjectType, void *);
Expand All @@ -81,6 +82,7 @@ class NeighOrch : public Orch, public Subject, public Observer

void resolveNeighbor(const NeighborEntry &);
void updateSrv6Nexthop(const NextHopKey &, const sai_object_id_t &);
bool ifChangeInformRemoteNextHop(const string &, bool);

private:
PortsOrch *m_portsOrch;
Expand Down
11 changes: 11 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7654,6 +7654,8 @@ void PortsOrch::updatePortOperStatus(Port &port, sai_port_oper_status_t status)
isUp ? "up" : "down");
}
}
SWSS_LOG_NOTICE("Updating the nexthop for port %s and operational status %s", port.m_alias.c_str(), isUp ? "up" : "down");

if (!gNeighOrch->ifChangeInformNextHop(port.m_alias, isUp))
{
SWSS_LOG_WARN("Inform nexthop operation failed for interface %s", port.m_alias.c_str());
Expand All @@ -7666,6 +7668,15 @@ void PortsOrch::updatePortOperStatus(Port &port, sai_port_oper_status_t status)
}
}

if(gMySwitchType == "voq")
{
if (gIntfsOrch->isLocalSystemPortIntf(port.m_alias))
{
gIntfsOrch->voqSyncIntfState(port.m_alias, isUp);
}
}


PortOperStateUpdate update = {port, status};
notify(SUBJECT_TYPE_PORT_OPER_STATE_CHANGE, static_cast<void *>(&update));
}
Expand Down
Loading