]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Quagga: Fix MPLS LSP scheduling to follow nexthop route update
authorvivek <vivek@cumulusnetworks.com>
Mon, 18 Apr 2016 18:24:10 +0000 (18:24 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 23 Sep 2016 13:30:59 +0000 (09:30 -0400)
Fix LSP scheduling to occur only after routes are processed because
the LSP resolution depends on the nexthop route being selected. This
is similar to how NHT processing is scheduled.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-6743
Reviewed By: CCR-3233
Testing Done: Verified the failed test multiple times.

zebra/connected.c
zebra/zebra_mpls.c
zebra/zebra_mpls.h
zebra/zebra_rib.c
zebra/zebra_vrf.h

index 9737f8debab3c7ddb1754884a310ae9902742793..55c3792d4f48cacc1ff7eda60a92c8e5e46b2af4 100644 (file)
@@ -39,6 +39,7 @@
 #include "zebra/connected.h"
 #include "zebra/rtadv.h"
 #include "zebra/zebra_mpls.h"
+#include "zebra/debug.h"
 
 /* communicate the withdrawal of a connected address */
 static void
@@ -218,10 +219,10 @@ connected_up_ipv4 (struct interface *ifp, struct connected *ifc)
   /* Schedule LSP forwarding entries for processing, if appropriate. */
   if (ifp->vrf_id == VRF_DEFAULT)
     {
-      if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+      if (IS_ZEBRA_DEBUG_MPLS)
         zlog_debug ("%u: IF %s IPv4 address add/up, scheduling MPLS processing",
                 ifp->vrf_id, ifp->name);
-      zebra_mpls_lsp_schedule (vrf_info_lookup(ifp->vrf_id));
+      mpls_mark_lsps_for_processing (vrf_info_lookup(ifp->vrf_id));
     }
 }
 
@@ -347,10 +348,10 @@ connected_down_ipv4 (struct interface *ifp, struct connected *ifc)
   /* Schedule LSP forwarding entries for processing, if appropriate. */
   if (ifp->vrf_id == VRF_DEFAULT)
     {
-      if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+      if (IS_ZEBRA_DEBUG_MPLS)
         zlog_debug ("%u: IF %s IPv4 address add/up, scheduling MPLS processing",
                 ifp->vrf_id, ifp->name);
-      zebra_mpls_lsp_schedule (vrf_info_lookup(ifp->vrf_id));
+      mpls_mark_lsps_for_processing (vrf_info_lookup(ifp->vrf_id));
     }
 }
 
@@ -382,10 +383,10 @@ connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
   /* Schedule LSP forwarding entries for processing, if appropriate. */
   if (ifp->vrf_id == VRF_DEFAULT)
     {
-      if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+      if (IS_ZEBRA_DEBUG_MPLS)
         zlog_debug ("%u: IF %s IPv4 address add/up, scheduling MPLS processing",
                 ifp->vrf_id, ifp->name);
-      zebra_mpls_lsp_schedule (vrf_info_lookup(ifp->vrf_id));
+      mpls_mark_lsps_for_processing (vrf_info_lookup(ifp->vrf_id));
     }
 }
 
@@ -421,10 +422,10 @@ connected_up_ipv6 (struct interface *ifp, struct connected *ifc)
   /* Schedule LSP forwarding entries for processing, if appropriate. */
   if (ifp->vrf_id == VRF_DEFAULT)
     {
-      if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+      if (IS_ZEBRA_DEBUG_MPLS)
         zlog_debug ("%u: IF %s IPv4 address add/up, scheduling MPLS processing",
                 ifp->vrf_id, ifp->name);
-      zebra_mpls_lsp_schedule (vrf_info_lookup(ifp->vrf_id));
+      mpls_mark_lsps_for_processing (vrf_info_lookup(ifp->vrf_id));
     }
 }
 
@@ -520,10 +521,10 @@ connected_down_ipv6 (struct interface *ifp, struct connected *ifc)
   /* Schedule LSP forwarding entries for processing, if appropriate. */
   if (ifp->vrf_id == VRF_DEFAULT)
     {
-      if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+      if (IS_ZEBRA_DEBUG_MPLS)
         zlog_debug ("%u: IF %s IPv4 address add/up, scheduling MPLS processing",
                 ifp->vrf_id, ifp->name);
-      zebra_mpls_lsp_schedule (vrf_info_lookup(ifp->vrf_id));
+      mpls_mark_lsps_for_processing (vrf_info_lookup(ifp->vrf_id));
     }
 }
 
@@ -554,10 +555,10 @@ connected_delete_ipv6 (struct interface *ifp, struct in6_addr *address,
   /* Schedule LSP forwarding entries for processing, if appropriate. */
   if (ifp->vrf_id == VRF_DEFAULT)
     {
-      if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+      if (IS_ZEBRA_DEBUG_MPLS)
         zlog_debug ("%u: IF %s IPv4 address add/up, scheduling MPLS processing",
                 ifp->vrf_id, ifp->name);
-      zebra_mpls_lsp_schedule (vrf_info_lookup(ifp->vrf_id));
+      mpls_mark_lsps_for_processing (vrf_info_lookup(ifp->vrf_id));
     }
 }
 
index 096f576a4cc68a6d4a798483b12bc9e74e38139e..edfc08019bd3a6ca0511c57d306467e67d8b1900 100644 (file)
@@ -1554,6 +1554,7 @@ zebra_mpls_init_tables (struct zebra_vrf *zvrf)
     return;
   zvrf->slsp_table = hash_create(label_hash, label_cmp);
   zvrf->lsp_table = hash_create(label_hash, label_cmp);
+  zvrf->mpls_flags = 0;
 }
 
 /*
index 7d1f4941426cb0389f2cb3fb8194fd0048532190..d25869664c3c9e70e251d338df91575a06e7c846 100644 (file)
@@ -33,6 +33,7 @@
 #include "memory.h"
 #include "mpls.h"
 #include "zebra/zserv.h"
+#include "zebra/zebra_vrf.h"
 
 
 /* Definitions and macros. */
@@ -280,4 +281,31 @@ nhlfe_type2str(enum lsp_types_t lsp_type)
     }
 }
 
+static inline void
+mpls_mark_lsps_for_processing(struct zebra_vrf *zvrf)
+{
+  if (!zvrf)
+    return;
+
+  zvrf->mpls_flags |= MPLS_FLAG_SCHEDULE_LSPS;
+}
+
+static inline void
+mpls_unmark_lsps_for_processing(struct zebra_vrf *zvrf)
+{
+  if (!zvrf)
+    return;
+
+  zvrf->mpls_flags &= ~MPLS_FLAG_SCHEDULE_LSPS;
+}
+
+static inline int
+mpls_should_lsps_be_processed(struct zebra_vrf *zvrf)
+{
+  if (!zvrf)
+    return 0;
+
+  return ((zvrf->mpls_flags & MPLS_FLAG_SCHEDULE_LSPS) ? 1 : 0);
+}
+
 #endif /*_ZEBRA_MPLS_H */
index 910610fc60c5f8701a09fac8f4fd64711b2fd956..601721c6d4d81876068eaa9f006acd3ca56522b3 100644 (file)
@@ -2033,6 +2033,16 @@ meta_queue_process_complete (struct work_queue *dummy)
           zebra_evaluate_rnh(zvrf->vrf_id, AF_INET6, 0, RNH_IMPORT_CHECK_TYPE, NULL);
         }
     }
+
+  /* Schedule LSPs for processing, if needed. */
+  zvrf = vrf_info_lookup(VRF_DEFAULT);
+  if (mpls_should_lsps_be_processed(zvrf))
+    {
+      if (IS_ZEBRA_DEBUG_MPLS)
+        zlog_debug ("%u: Scheduling all LSPs upon RIB completion", zvrf->vrf_id);
+      zebra_mpls_lsp_schedule (zvrf);
+      mpls_unmark_lsps_for_processing(zvrf);
+    }
 }
 
 /* Dispatch the meta queue by picking, processing and unlocking the next RN from
index 1062c9098805a0c797c8b0f4468659812077467a..0baddc1b6a72b3883eaac6010699761b62eac5ca 100644 (file)
@@ -80,6 +80,10 @@ struct zebra_vrf
 
   /* MPLS label forwarding table */
   struct hash *lsp_table;
+
+  /* MPLS processing flags */
+  u_int16_t mpls_flags;
+#define MPLS_FLAG_SCHEDULE_LSPS    (1 << 0)
 };
 
 extern struct list *zvrf_list;