zebra: When reinstalling a NHG, set REINSTALL flag

The current code is unsetting the fact that the
NHG is installed.  It is installed but we are
reinstalling it.  Let's note this in the code
appropriately as REINSTALL and not remove the
INSTALLED FLAG.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2024-02-08 12:32:26 -05:00
parent e28162b215
commit b2ade8e3d2
3 changed files with 24 additions and 10 deletions

View File

@ -3090,9 +3090,10 @@ void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe)
zebra_nhg_install_kernel(rb_node_dep->nhe);
}
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID)
&& !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED)
&& !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) {
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID) &&
(!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) ||
CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_REINSTALL)) &&
!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) {
/* Change its type to us since we are installing it */
if (!ZEBRA_NHG_CREATED(nhe))
nhe->type = ZEBRA_ROUTE_NHG;
@ -3179,6 +3180,7 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
}
UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED);
UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_REINSTALL);
switch (status) {
case ZEBRA_DPLANE_REQUEST_SUCCESS:
SET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED);
@ -3686,12 +3688,11 @@ void zebra_interface_nhg_reinstall(struct interface *ifp)
&rb_node_dep->nhe->nhg_dependents,
rb_node_dependent) {
if (IS_ZEBRA_DEBUG_NHG)
zlog_debug(
"%s dependent nhe %pNG unset installed flag",
__func__,
rb_node_dependent->nhe);
UNSET_FLAG(rb_node_dependent->nhe->flags,
NEXTHOP_GROUP_INSTALLED);
zlog_debug("%s dependent nhe %pNG Setting Reinstall flag",
__func__,
rb_node_dependent->nhe);
SET_FLAG(rb_node_dependent->nhe->flags,
NEXTHOP_GROUP_REINSTALL);
}
}
}

View File

@ -144,6 +144,14 @@ struct nhg_hash_entry {
* Track FPM installation status..
*/
#define NEXTHOP_GROUP_FPM (1 << 7)
/*
* When an interface comes up install the
* singleton's and schedule the NHG's that
* are using this nhg to be reinstalled
* when installation is successful.
*/
#define NEXTHOP_GROUP_REINSTALL (1 << 8)
};
/* Upper 4 bits of the NHG are reserved for indicating the NHG type */

View File

@ -1220,7 +1220,12 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe,
json_object_boolean_true_add(json, "valid");
else
vty_out(vty, " Valid");
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_REINSTALL)) {
if (json)
json_object_boolean_true_add(json, "reInstall");
else
vty_out(vty, ", Reinstall");
}
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED)) {
if (json)
json_object_boolean_true_add(json, "installed");