Zebra: Perform NHT evaluation for VRFs

NHT evaluation was not being triggered for any VRF after RIB processing. Fix
this and attempt to schedule only those VRFs for which RIB processing was
scheduled.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>

Ticket: CM-9175
Reviewed By: CCR-4149
Testing Done: Manual verification
This commit is contained in:
vivek 2016-02-23 03:42:19 +00:00
parent e186aa9ffa
commit 9ec6b0bb0e
2 changed files with 28 additions and 4 deletions

View File

@ -323,6 +323,10 @@ struct zebra_vrf
/* FIB identifier. */ /* FIB identifier. */
u_char fib_id; u_char fib_id;
/* Flags. */
u_int16_t flags;
#define ZEBRA_VRF_RIB_SCHEDULED (1 << 0)
u_int32_t table_id; u_int32_t table_id;
/* Routing table. */ /* Routing table. */

View File

@ -1656,10 +1656,25 @@ process_subq (struct list * subq, u_char qindex)
static void static void
meta_queue_process_complete (struct work_queue *dummy) meta_queue_process_complete (struct work_queue *dummy)
{ {
zebra_evaluate_rnh(0, AF_INET, 0, RNH_NEXTHOP_TYPE, NULL); vrf_iter_t iter;
zebra_evaluate_rnh(0, AF_INET, 0, RNH_IMPORT_CHECK_TYPE, NULL); struct zebra_vrf *zvrf;
zebra_evaluate_rnh(0, AF_INET6, 0, RNH_NEXTHOP_TYPE, NULL);
zebra_evaluate_rnh(0, AF_INET6, 0, RNH_IMPORT_CHECK_TYPE, NULL); /* Evaluate nexthops for those VRFs which underwent route processing. This
* should limit the evaluation to the necessary VRFs in most common
* situations.
*/
for (iter = vrf_first (); iter != VRF_ITER_INVALID; iter = vrf_next (iter))
{
if (((zvrf = vrf_iter2info (iter)) != NULL) &&
(zvrf->flags & ZEBRA_VRF_RIB_SCHEDULED))
{
zvrf->flags &= ~ZEBRA_VRF_RIB_SCHEDULED;
zebra_evaluate_rnh(zvrf->vrf_id, AF_INET, 0, RNH_NEXTHOP_TYPE, NULL);
zebra_evaluate_rnh(zvrf->vrf_id, AF_INET, 0, RNH_IMPORT_CHECK_TYPE, NULL);
zebra_evaluate_rnh(zvrf->vrf_id, AF_INET6, 0, RNH_NEXTHOP_TYPE, NULL);
zebra_evaluate_rnh(zvrf->vrf_id, AF_INET6, 0, RNH_IMPORT_CHECK_TYPE, NULL);
}
}
} }
/* Dispatch the meta queue by picking, processing and unlocking the next RN from /* Dispatch the meta queue by picking, processing and unlocking the next RN from
@ -1714,6 +1729,7 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn)
RNODE_FOREACH_RIB (rn, rib) RNODE_FOREACH_RIB (rn, rib)
{ {
u_char qindex = meta_queue_map[rib->type]; u_char qindex = meta_queue_map[rib->type];
struct zebra_vrf *zvrf;
/* Invariant: at this point we always have rn->info set. */ /* Invariant: at this point we always have rn->info set. */
if (CHECK_FLAG (rib_dest_from_rnode (rn)->flags, if (CHECK_FLAG (rib_dest_from_rnode (rn)->flags,
@ -1728,6 +1744,10 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn)
if (IS_ZEBRA_DEBUG_RIB_DETAILED) if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug ("%u:%s/%d: rn %p queued into sub-queue %u", zlog_debug ("%u:%s/%d: rn %p queued into sub-queue %u",
rib->vrf_id, buf, rn->p.prefixlen, rn, qindex); rib->vrf_id, buf, rn->p.prefixlen, rn, qindex);
zvrf = zebra_vrf_lookup (rib->vrf_id);
if (zvrf)
zvrf->flags |= ZEBRA_VRF_RIB_SCHEDULED;
} }
} }