Skip to content

Commit 670b738

Browse files
authored
Avoid updating the NHGroup when mux state changes. (#126)
Port PR sonic-net/sonic-swss#3822 NHGroup update is not required during mux state updates. When a mux neighbor in a ECMP NexthopGroup changes state to standby we point the prefix route originally pointing to the ECMP nexthop group to any available active neighbor NH or tunnel NH and the original ECMP nexthopgroup remains unused, so this update is useless and uncessarily takes extra SAI calls. This fix also avoid creation of nexthop group with a mix of different types of NextHops which will allow platform that do not support such nexthop groups. Signed-off-by: Manas Kumar Mandal <[email protected]>
1 parent 2f603cc commit 670b738

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

orchagent/muxorch.cpp

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -818,27 +818,6 @@ bool MuxNbrHandler::enable(bool update_rt)
818818
/* Increment ref count for new NHs */
819819
gNeighOrch->increaseNextHopRefCount(nh_key, num_routes);
820820

821-
/*
822-
* Invalidate current nexthop group and update with new NH
823-
* Ref count update is not required for tunnel NH IDs (nh_removed)
824-
*/
825-
uint32_t nh_removed, nh_added;
826-
if (!gRouteOrch->invalidnexthopinNextHopGroup(nh_key, nh_removed))
827-
{
828-
SWSS_LOG_ERROR("Removing existing NH failed for %s", nh_key.ip_address.to_string().c_str());
829-
return false;
830-
}
831-
832-
if (!gRouteOrch->validnexthopinNextHopGroup(nh_key, nh_added))
833-
{
834-
SWSS_LOG_ERROR("Adding NH failed for %s", nh_key.ip_address.to_string().c_str());
835-
return false;
836-
}
837-
SWSS_LOG_INFO("Adding NH for %s, nh_added: %u", nh_key.ip_address.to_string().c_str(), nh_added);
838-
839-
/* Increment ref count for ECMP NH members */
840-
gNeighOrch->increaseNextHopRefCount(nh_key, nh_added);
841-
842821
if (update_rt)
843822
{
844823
updateTunnelRoute(nh_key, false);
@@ -892,24 +871,6 @@ bool MuxNbrHandler::disable(sai_object_id_t tnh)
892871
/* Decrement ref count for old NHs */
893872
gNeighOrch->decreaseNextHopRefCount(nh_key, num_routes);
894873

895-
/* Invalidate current nexthop group and update with new NH */
896-
uint32_t nh_removed, nh_added;
897-
if (!gRouteOrch->invalidnexthopinNextHopGroup(nh_key, nh_removed))
898-
{
899-
SWSS_LOG_ERROR("Removing existing NH failed for %s", nh_key.ip_address.to_string().c_str());
900-
return false;
901-
}
902-
SWSS_LOG_INFO("Removing existing NH for %s, nh_removed: %u", nh_key.ip_address.to_string().c_str(), nh_removed);
903-
904-
/* Decrement ref count for ECMP NH members */
905-
gNeighOrch->decreaseNextHopRefCount(nh_key, nh_removed);
906-
907-
if (!gRouteOrch->validnexthopinNextHopGroup(nh_key, nh_added))
908-
{
909-
SWSS_LOG_ERROR("Adding NH failed for %s", nh_key.ip_address.to_string().c_str());
910-
return false;
911-
}
912-
913874
updateTunnelRoute(nh_key, true);
914875

915876
it++;

0 commit comments

Comments
 (0)