Introducing speculative enqueue 97/8497/3
authorAlberto Compagno <[email protected]>
Fri, 22 Sep 2017 07:57:24 +0000 (09:57 +0200)
committerAlberto Compagno <[email protected]>
Fri, 22 Sep 2017 08:03:38 +0000 (10:03 +0200)
Change-Id: I5e22334fd03747811bb352c95d3682a91fc6b9f4
Signed-off-by: Alberto Compagno <[email protected]>
cicn-plugin/cicn/node.c

index 0279df8..0d755c6 100644 (file)
@@ -279,6 +279,11 @@ icnfwd_node_fn (vlib_main_t * vm,
          from += 1;
          n_left_from -= 1;
 
+          /* Enqueue packet to next graph node */
+          to_next[0] = bi0;
+          to_next += 1;
+          n_left_to_next -= 1;
+
          b0 = vlib_get_buffer (vm, bi0);
 
          if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
@@ -544,6 +549,10 @@ icnfwd_node_fn (vlib_main_t * vm,
 
                  if (cicn_cs_enabled (&rt->pitcs))
                    {
+                      /* Remove b0 from the frame, we hold it in the CS */
+                     to_next -= 1;
+                     n_left_to_next += 1;
+                      
                      /* At this point we think we're safe to proceed.
                       * Store the CS buf in the PIT/CS hashtable entry
                       */
@@ -591,6 +600,7 @@ icnfwd_node_fn (vlib_main_t * vm,
 
                      /* Store the original packet buffer in the CS node */
                      pitp->u.cs.cs_pkt_buf = vlib_get_buffer_index (vm, b0);
+                      
 
                      /* Add to CS LRU */
                      cicn_cs_lru_insert (&rt->pitcs, nodep, pitp);
@@ -1335,13 +1345,6 @@ icnfwd_node_fn (vlib_main_t * vm,
              t->next_index = next0;
            }
 
-         /* Speculatively enqueue packet b0 (index in bi0)
-          * to the current next frame
-          */
-         to_next[0] = bi0;
-         to_next += 1;
-         n_left_to_next -= 1;
-
          /* Incr packet counter */
          pkts_processed += 1;