diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 89f6691dab..c5e1bbf5c2 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -36,6 +36,7 @@ #include "zebra/zebra_routemap.h" #include "zebra/rt.h" #include "zebra_errors.h" +#include "zebra_dplane.h" /** * zebra_nhg_lookup_id() - Lookup the nexthop group id in the id table @@ -845,3 +846,27 @@ int nexthop_active_update(struct route_node *rn, struct route_entry *re) return curr_active; } + +/** + * zebra_nhg_install_kernel() - Install Nexthop Group hash entry into kernel + * + * @nhe: Nexthop Group hash entry to install + */ +void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe) +{ + int ret = dplane_nexthop_add(nhe); + switch (ret) { + case ZEBRA_DPLANE_REQUEST_QUEUED: + SET_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED); + break; + case ZEBRA_DPLANE_REQUEST_FAILURE: + flog_err(EC_ZEBRA_DP_INSTALL_FAIL, + "Failed to install Nexthop ID (%u) into the kernel", + nhe->id); + break; + case ZEBRA_DPLANE_REQUEST_SUCCESS: + SET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED); + break; + } +} + diff --git a/zebra/zebra_nhg.h b/zebra/zebra_nhg.h index e8c0a4b34b..d5f9a89df2 100644 --- a/zebra/zebra_nhg.h +++ b/zebra/zebra_nhg.h @@ -78,4 +78,6 @@ void zebra_nhg_release(struct nhg_hash_entry *nhe); void zebra_nhg_decrement_ref(struct nhg_hash_entry *nhe); extern int nexthop_active_update(struct route_node *rn, struct route_entry *re); + +void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe); #endif