Skip to content

Commit

Permalink
[vnetorch] Add ECMP support for vnet tunnel routes (sonic-net#1960)
Browse files Browse the repository at this point in the history
What I did
Add functions to create/remove next hop groups for vnet tunnel routes.
Count the reference count of next hop groups to create and remove as needed.
Share the counter of next hop groups with routeorch.
Add vs test

Why I did it
To add support for overlay ECMP.

How I verified it
Verify ECMP groups are properly created and removed with the functions.
Verify vs test passes
  • Loading branch information
shi-su authored Nov 11, 2021
1 parent 5f8ebfa commit f502c32
Show file tree
Hide file tree
Showing 6 changed files with 640 additions and 59 deletions.
2 changes: 2 additions & 0 deletions orchagent/nexthopkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ struct NextHopKey
weight = 0;
}

NextHopKey(const IpAddress &ip, const MacAddress &mac, const uint32_t &vni, bool overlay_nh) : ip_address(ip), alias(""), vni(vni), mac_address(mac){}

const std::string to_string() const
{
std::string str = formatMplsNextHop();
Expand Down
15 changes: 15 additions & 0 deletions orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2335,3 +2335,18 @@ bool RouteOrch::removeOverlayNextHops(sai_object_id_t vrf_id, const NextHopGroup

return true;
}

void RouteOrch::increaseNextHopGroupCount()
{
m_nextHopGroupCount ++;
}

void RouteOrch::decreaseNextHopGroupCount()
{
m_nextHopGroupCount --;
}

bool RouteOrch::checkNextHopGroupCount()
{
return m_nextHopGroupCount < m_maxNextHopGroupCount;
}
4 changes: 4 additions & 0 deletions orchagent/routeorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ class RouteOrch : public Orch, public Subject

unsigned int getNhgCount() { return m_nextHopGroupCount; }
unsigned int getMaxNhgCount() { return m_maxNextHopGroupCount; }

void increaseNextHopGroupCount();
void decreaseNextHopGroupCount();
bool checkNextHopGroupCount();

private:
SwitchOrch *m_switchOrch;
Expand Down
Loading

0 comments on commit f502c32

Please sign in to comment.