Fixes for 'make UNATTENDED=yes CC=clang CXX=clang verify'
[vpp.git] / src / vnet / gre / gre.c
index 75b1101..0b8d2cc 100644 (file)
@@ -320,13 +320,10 @@ gre_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
 
 typedef enum
 {
-  GRE_ENCAP_NEXT_DROP,
   GRE_ENCAP_NEXT_L2_MIDCHAIN,
   GRE_ENCAP_N_NEXT,
 } gre_encap_next_t;
 
-#define NEXT_IDX (GRE_ENCAP_NEXT_L2_MIDCHAIN)
-
 /**
  * @brief TX function. Only called for L2 payload including TEB or ERSPAN.
  *        L3 traffic uses the adj-midchains.
@@ -353,7 +350,7 @@ gre_interface_tx (vlib_main_t * vm,
   n_left_from = frame->n_vectors;
 
   /* Speculatively send the first buffer to the last disposition we used */
-  next_index = node->cached_next_index;
+  next_index = GRE_ENCAP_NEXT_L2_MIDCHAIN;
 
   while (n_left_from > 0)
     {
@@ -410,10 +407,10 @@ gre_interface_tx (vlib_main_t * vm,
              vlib_buffer_advance (b0, -sizeof (erspan_t2_t));
              erspan_t2_t *h0 = vlib_buffer_get_current (b0);
              u32 seq_num = clib_smp_atomic_add (&gt0->gre_sn->seq_num, 1);
-             u64 ver1 = clib_host_to_net_u64 (0x1000000000000000);
+             u64 hdr = clib_host_to_net_u64 (ERSPAN_HDR2);
              h0->seq_num = clib_host_to_net_u32 (seq_num);
-             h0->t2_u64 = ver1;        /* all 0's except ver=1 */
-             h0->t2.cos_en_t_session =
+             h0->t2_u64 = hdr;
+             h0->t2.cos_en_t_session |=
                clib_host_to_net_u16 (gt0->session_id);
            }
          if (PREDICT_FALSE (gt1->type == GRE_TUNNEL_TYPE_ERSPAN))
@@ -422,10 +419,10 @@ gre_interface_tx (vlib_main_t * vm,
              vlib_buffer_advance (b1, -sizeof (erspan_t2_t));
              erspan_t2_t *h1 = vlib_buffer_get_current (b1);
              u32 seq_num = clib_smp_atomic_add (&gt1->gre_sn->seq_num, 1);
-             u64 ver1 = clib_host_to_net_u64 (0x1000000000000000);
+             u64 hdr = clib_host_to_net_u64 (ERSPAN_HDR2);
              h1->seq_num = clib_host_to_net_u32 (seq_num);
-             h1->t2_u64 = ver1;        /* all 0's except ver=1 */
-             h1->t2.cos_en_t_session =
+             h1->t2_u64 = hdr;
+             h1->t2.cos_en_t_session |=
                clib_host_to_net_u16 (gt1->session_id);
            }
 
@@ -447,10 +444,6 @@ gre_interface_tx (vlib_main_t * vm,
              tr1->dst = gt1->tunnel_dst.fp_addr;
              tr1->length = vlib_buffer_length_in_chain (vm, b1);
            }
-
-         vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
-                                          to_next, n_left_to_next,
-                                          bi0, bi1, NEXT_IDX, NEXT_IDX);
        }
 
       while (n_left_from > 0 && n_left_to_next > 0)
@@ -481,10 +474,10 @@ gre_interface_tx (vlib_main_t * vm,
              vlib_buffer_advance (b0, -sizeof (erspan_t2_t));
              erspan_t2_t *h0 = vlib_buffer_get_current (b0);
              u32 seq_num = clib_smp_atomic_add (&gt0->gre_sn->seq_num, 1);
-             u64 ver1 = clib_host_to_net_u64 (0x1000000000000000);
+             u64 hdr = clib_host_to_net_u64 (ERSPAN_HDR2);
              h0->seq_num = clib_host_to_net_u32 (seq_num);
-             h0->t2_u64 = ver1;        /* all 0's except ver=1 */
-             h0->t2.cos_en_t_session =
+             h0->t2_u64 = hdr;
+             h0->t2.cos_en_t_session |=
                clib_host_to_net_u16 (gt0->session_id);
            }
 
@@ -497,10 +490,6 @@ gre_interface_tx (vlib_main_t * vm,
              tr->dst = gt0->tunnel_dst.fp_addr;
              tr->length = vlib_buffer_length_in_chain (vm, b0);
            }
-
-         vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
-                                          to_next, n_left_to_next,
-                                          bi0, NEXT_IDX);
        }
 
       vlib_put_next_frame (vm, node, next_index, n_left_to_next);
@@ -530,7 +519,6 @@ VLIB_REGISTER_NODE (gre_encap_node) =
   .error_strings = gre_error_strings,
   .n_next_nodes = GRE_ENCAP_N_NEXT,
   .next_nodes = {
-    [GRE_ENCAP_NEXT_DROP] = "error-drop",
     [GRE_ENCAP_NEXT_L2_MIDCHAIN] = "adj-l2-midchain",
   },
 };
@@ -644,14 +632,6 @@ gre_init (vlib_main_t * vm)
 
 VLIB_INIT_FUNCTION (gre_init);
 
-gre_main_t *
-gre_get_main (vlib_main_t * vm)
-{
-  vlib_call_init_function (vm, gre_init);
-  return &gre_main;
-}
-
-
 /*
  * fd.io coding-style-patch-verification: ON
  *