zebra: Move resolve/add depend install into api

Move the resolving and installing of a single nhg_hash_entry
into the install function itself, rather than letting zebra_rib
handle it.

Further, ensure depends are installed/queued before installing
a group. The ordering should be find here since only one thread
will call this API.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
Stephen Worley 2019-07-25 11:45:19 -04:00
parent 8dfbc65724
commit f429bd1b24
2 changed files with 11 additions and 4 deletions

View File

@ -1475,6 +1475,16 @@ uint8_t zebra_nhg_nhe2grp(struct nh_grp *grp, struct nhg_hash_entry *nhe)
void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe)
{
struct nhg_connected *rb_node_dep = NULL;
/* Resolve it first */
nhe = zebra_nhg_resolve(nhe);
/* Make sure all depends are installed/queued */
frr_each (nhg_connected_tree, &nhe->nhg_depends, rb_node_dep) {
zebra_nhg_install_kernel(rb_node_dep->nhe);
}
if (!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED)
&& !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) {
nhe->is_kernel_nh = false;

View File

@ -519,7 +519,6 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
struct zebra_vrf *zvrf = vrf_info_lookup(re->vrf_id);
const struct prefix *p, *src_p;
enum zebra_dplane_result ret;
struct nhg_hash_entry *nhe;
rib_dest_t *dest = rib_dest_from_rnode(rn);
@ -549,9 +548,7 @@ void rib_install_kernel(struct route_node *rn, struct route_entry *re,
/*
* Install the resolved nexthop object first.
*/
nhe = zebra_nhg_resolve(zebra_nhg_lookup_id(re->nhe_id));
if (!nhe->is_kernel_nh)
zebra_nhg_install_kernel(nhe);
zebra_nhg_install_kernel(zebra_nhg_lookup_id(re->nhe_id));
/*
* If this is a replace to a new RE let the originator of the RE