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

[bitmap_vnet] Fix VNET route priority issue #1421

Merged
merged 1 commit into from
Sep 3, 2020
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
17 changes: 13 additions & 4 deletions orchagent/vnetorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,20 @@ void VNetBitmapObject::recycleBitmapId(const string& vnet)
}
}

uint32_t VNetBitmapObject::getFreeTunnelRouteTableOffset()
uint32_t VNetBitmapObject::getFreeTunnelRouteTableOffset(IpPrefix ipPfx)
{
SWSS_LOG_ENTER();

for (uint32_t i = 0; i < tunnelOffsets_.size(); i++)
uint32_t offsetStart = VNET_ROUTE_FULL_MASK_OFFSET_MAX + 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

tunnelOffsets[VNET_ROUTE_FULL_MASK_OFFSET_MAX] will not be included in any range.
It should be uint32_t offsetStart = VNET_ROUTE_FULL_MASK_OFFSET_MAX;

uint32_t offsetEnd = tunnelOffsets_.size();

if (ipPfx.isFullMask())
{
offsetStart = 0;
offsetEnd = VNET_ROUTE_FULL_MASK_OFFSET_MAX;
}

for (uint32_t i = offsetStart; i < offsetEnd; i++)
{
if (tunnelOffsets_[i] == false)
{
Expand Down Expand Up @@ -958,7 +967,7 @@ bool VNetBitmapObject::addTunnelRoute(IpPrefix& ipPrefix, tunnelEndpoint& endp)
attr.value.s32 = SAI_TABLE_BITMAP_ROUTER_ENTRY_ACTION_TO_NEXTHOP;
tr_attrs.push_back(attr);

tunnelRouteInfo.offset = getFreeTunnelRouteTableOffset();
tunnelRouteInfo.offset = getFreeTunnelRouteTableOffset(ipPrefix);
attr.id = SAI_TABLE_BITMAP_ROUTER_ENTRY_ATTR_PRIORITY;
attr.value.u32 = tunnelRouteInfo.offset;
tr_attrs.push_back(attr);
Expand Down Expand Up @@ -1175,7 +1184,7 @@ bool VNetBitmapObject::addRoute(IpPrefix& ipPrefix, nextHop& nh)
return true;
}

routeInfo.offset = getFreeTunnelRouteTableOffset();
routeInfo.offset = getFreeTunnelRouteTableOffset(ipPrefix);
attr.id = SAI_TABLE_BITMAP_ROUTER_ENTRY_ATTR_PRIORITY;
attr.value.u32 = routeInfo.offset;
attrs.push_back(attr);
Expand Down
3 changes: 2 additions & 1 deletion orchagent/vnetorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#define VNET_BITMAP_SIZE 32
#define VNET_TUNNEL_SIZE 40960
#define VNET_ROUTE_FULL_MASK_OFFSET_MAX 3000
#define VNET_NEIGHBOR_MAX 0xffff
#define VXLAN_ENCAP_TTL 128
#define VNET_BITMAP_RIF_MTU 9100
Expand Down Expand Up @@ -266,7 +267,7 @@ class VNetBitmapObject: public VNetObject
static uint32_t getBitmapId(const string& name);
static void recycleBitmapId(const string& name);

static uint32_t getFreeTunnelRouteTableOffset();
static uint32_t getFreeTunnelRouteTableOffset(IpPrefix ipPfx);
static void recycleTunnelRouteTableOffset(uint32_t offset);

static uint16_t getFreeTunnelId();
Expand Down