]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Start addition of timer wheel
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 2 Nov 2016 23:19:40 +0000 (19:19 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:13 +0000 (20:26 -0500)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_upstream.c

index 0ab21166da7481ed524e2080754152c0ab8d6158..89fc6178fa83d957fed8fd88f6896aabeabbc6b0 100644 (file)
@@ -32,6 +32,7 @@
 #include "plist.h"
 #include "hash.h"
 #include "jhash.h"
+#include "wheel.h"
 
 #include "pimd.h"
 #include "pim_pim.h"
@@ -53,6 +54,7 @@
 
 struct hash *pim_upstream_hash = NULL;
 struct list *pim_upstream_list = NULL;
+struct timer_wheel *pim_upstream_sg_wheel = NULL;
 
 static void join_timer_start(struct pim_upstream *up);
 static void pim_upstream_update_assert_tracking_desired(struct pim_upstream *up);
@@ -170,6 +172,9 @@ pim_upstream_del(struct pim_upstream *up, const char *name)
   THREAD_OFF(up->t_ka_timer);
   THREAD_OFF(up->t_rs_timer);
 
+  if (up->sg.src.s_addr != INADDR_ANY)
+    wheel_remove_item (pim_upstream_sg_wheel, up);
+
   pim_upstream_remove_children (up);
   pim_mroute_del (up->channel_oil);
   upstream_channel_oil_detach(up);
@@ -565,6 +570,9 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
   up->rpf.rpf_addr.family                         = AF_INET;
   up->rpf.rpf_addr.u.prefix4.s_addr               = PIM_NET_INADDR_ANY;
 
+  if (up->sg.src.s_addr != INADDR_ANY)
+    wheel_add_item (pim_upstream_sg_wheel, up);
+
   rpf_result = pim_rpf_update(up, NULL);
   if (rpf_result == PIM_RPF_FAILURE) {
     if (PIM_DEBUG_PIM_TRACE)
@@ -576,6 +584,10 @@ static struct pim_upstream *pim_upstream_new(struct prefix_sg *sg,
        listnode_delete (up->parent->sources, up);
        up->parent = NULL;
       }
+
+    if (up->sg.src.s_addr != INADDR_ANY)
+      wheel_remove_item (pim_upstream_sg_wheel, up);
+
     pim_upstream_remove_children (up);
     if (up->sources)
       list_delete (up->sources);
@@ -1254,9 +1266,25 @@ pim_upstream_equal (const void *arg1, const void *arg2)
   return 0;
 }
 
+/*
+ * Code to check and see if we've received packets on a S,G mroute
+ * and if so to set the SPT bit appropriately
+ */
+static void
+pim_upstream_sg_running (void *arg)
+{
+  struct pim_upstream *up = (struct pim_upstream *)arg;
+
+  zlog_debug ("%s: %s work", __PRETTY_FUNCTION__,
+             pim_str_sg_dump (&up->sg));
+}
+
 void
 pim_upstream_init (void)
 {
+  pim_upstream_sg_wheel = wheel_init (master, 31000, 100,
+                                     pim_upstream_hash_key,
+                                     pim_upstream_sg_running);
   pim_upstream_hash = hash_create_size (8192, pim_upstream_hash_key,
                                        pim_upstream_equal);