ip: support flow-hash gtpv1teid
[vpp.git] / src / vnet / ip / ip6_forward.c
index 5951de4..84ea5a0 100644 (file)
@@ -1319,7 +1319,7 @@ ip6_local_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
          vlib_prefetch_buffer_data (b[3], LOAD);
        }
 
-      ip6_error_t error[2];
+      vl_counter_ip6_enum_t error[2];
       error[0] = IP6_ERROR_UNKNOWN_PROTOCOL;
       error[1] = IP6_ERROR_UNKNOWN_PROTOCOL;
 
@@ -1475,6 +1475,11 @@ ip6_local_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
            vnet_buffer (b[1])->sw_if_index[VLIB_TX] != ~0 ?
            vnet_buffer (b[1])->sw_if_index[VLIB_TX] :
            vnet_buffer (b[1])->ip.fib_index;
+
+         vnet_buffer (b[0])->ip.rx_sw_if_index =
+           vnet_buffer (b[0])->sw_if_index[VLIB_RX];
+         vnet_buffer (b[1])->ip.rx_sw_if_index =
+           vnet_buffer (b[1])->sw_if_index[VLIB_RX];
          if (is_receive_dpo)
            {
              const receive_dpo_t *rd0, *rd1;
@@ -1482,15 +1487,10 @@ ip6_local_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
                receive_dpo_get (vnet_buffer (b[0])->ip.adj_index[VLIB_TX]);
              rd1 =
                receive_dpo_get (vnet_buffer (b[1])->ip.adj_index[VLIB_TX]);
-             vnet_buffer (b[0])->ip.rx_sw_if_index = rd0->rd_sw_if_index;
-             vnet_buffer (b[1])->ip.rx_sw_if_index = rd1->rd_sw_if_index;
-           }
-         else
-           {
-             vnet_buffer (b[0])->ip.rx_sw_if_index =
-               vnet_buffer (b[0])->ip.adj_index[VLIB_RX];
-             vnet_buffer (b[1])->ip.rx_sw_if_index =
-               vnet_buffer (b[1])->ip.adj_index[VLIB_RX];
+             if (rd0->rd_sw_if_index != ~0)
+               vnet_buffer (b[0])->ip.rx_sw_if_index = rd0->rd_sw_if_index;
+             if (rd1->rd_sw_if_index != ~0)
+               vnet_buffer (b[1])->ip.rx_sw_if_index = rd1->rd_sw_if_index;
            }
        }                       /* head_of_feature_arc */
 
@@ -1619,15 +1619,16 @@ ip6_local_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
            vnet_buffer (b[0])->sw_if_index[VLIB_TX] != ~0 ?
            vnet_buffer (b[0])->sw_if_index[VLIB_TX] :
            vnet_buffer (b[0])->ip.fib_index;
+
+         vnet_buffer (b[0])->ip.rx_sw_if_index =
+           vnet_buffer (b[0])->sw_if_index[VLIB_RX];
          if (is_receive_dpo)
            {
              receive_dpo_t *rd;
              rd = receive_dpo_get (vnet_buffer (b[0])->ip.adj_index[VLIB_TX]);
-             vnet_buffer (b[0])->ip.rx_sw_if_index = rd->rd_sw_if_index;
+             if (rd->rd_sw_if_index != ~0)
+               vnet_buffer (b[0])->ip.rx_sw_if_index = rd->rd_sw_if_index;
            }
-         else
-           vnet_buffer (b[0])->ip.rx_sw_if_index =
-             vnet_buffer (b[0])->ip.adj_index[VLIB_RX];
        }                       /* head_of_feature_arc */
 
       next[0] = lm->local_next_by_ip_protocol[ip->protocol];
@@ -1670,6 +1671,8 @@ VLIB_REGISTER_NODE (ip6_local_node) =
   .name = "ip6-local",
   .vector_size = sizeof (u32),
   .format_trace = format_ip6_forward_next_trace,
+  .n_errors = IP6_N_ERROR,
+  .error_counters = ip6_error_counters,
   .n_next_nodes = IP_LOCAL_N_NEXT,
   .next_nodes =
   {
@@ -2241,19 +2244,20 @@ VLIB_NODE_FN (ip6_mcast_midchain_node) (vlib_main_t * vm,
 }
 
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (ip6_midchain_node) =
-{
+VLIB_REGISTER_NODE (ip6_midchain_node) = {
   .name = "ip6-midchain",
   .vector_size = sizeof (u32),
   .format_trace = format_ip6_forward_next_trace,
   .sibling_of = "ip6-rewrite",
-  };
+};
 
 VLIB_REGISTER_NODE (ip6_rewrite_node) =
 {
   .name = "ip6-rewrite",
   .vector_size = sizeof (u32),
   .format_trace = format_ip6_rewrite_trace,
+  .n_errors = IP6_N_ERROR,
+  .error_counters = ip6_error_counters,
   .n_next_nodes = IP6_REWRITE_N_NEXT,
   .next_nodes =
   {