Separate heap for IPv4 mtries
[vpp.git] / src / vnet / ip / ip6_forward.c
index f54b433..67fedc9 100644 (file)
@@ -1341,8 +1341,14 @@ ip6_local_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          is_tcp_udp0 = ip6_next_proto_is_tcp_udp (p0, ip0, &udp_offset0);
          is_tcp_udp1 = ip6_next_proto_is_tcp_udp (p1, ip1, &udp_offset1);
 
-         good_l4_csum0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
-         good_l4_csum1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
+         good_l4_csum0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT
+                          || (flags0 & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM
+                              || flags0 & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM))
+           != 0;
+         good_l4_csum1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT
+                          || (flags1 & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM
+                              || flags1 & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM))
+           != 0;
          len_diff0 = 0;
          len_diff1 = 0;
 
@@ -1428,6 +1434,24 @@ ip6_local_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
                        ? IP6_ERROR_SRC_LOOKUP_MISS : error1);
            }
 
+         /* TODO maybe move to lookup? */
+         vnet_buffer (p0)->ip.fib_index =
+           vec_elt (im->fib_index_by_sw_if_index,
+                    vnet_buffer (p0)->sw_if_index[VLIB_RX]);
+         vnet_buffer (p0)->ip.fib_index =
+           (vnet_buffer (p0)->sw_if_index[VLIB_TX] ==
+            (u32) ~ 0) ? vnet_buffer (p0)->ip.
+           fib_index : vnet_buffer (p0)->sw_if_index[VLIB_TX];
+
+         vnet_buffer (p1)->ip.fib_index =
+           vec_elt (im->fib_index_by_sw_if_index,
+                    vnet_buffer (p1)->sw_if_index[VLIB_RX]);
+         vnet_buffer (p1)->ip.fib_index =
+           (vnet_buffer (p1)->sw_if_index[VLIB_TX] ==
+            (u32) ~ 0) ? vnet_buffer (p1)->ip.
+           fib_index : vnet_buffer (p1)->sw_if_index[VLIB_TX];
+
+
        skip_checks:
 
          next0 = lm->local_next_by_ip_protocol[ip0->protocol];
@@ -1488,7 +1512,10 @@ ip6_local_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          type0 = lm->builtin_protocol_by_ip_protocol[ip0->protocol];
          flags0 = p0->flags;
          is_tcp_udp0 = ip6_next_proto_is_tcp_udp (p0, ip0, &udp_offset0);
-         good_l4_csum0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0;
+         good_l4_csum0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT
+                          || (flags0 & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM
+                              || flags0 & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM))
+           != 0;
 
          len_diff0 = 0;
          if (PREDICT_TRUE (is_tcp_udp0))
@@ -1538,6 +1565,14 @@ ip6_local_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
                        ? IP6_ERROR_SRC_LOOKUP_MISS : error0);
            }
 
+         vnet_buffer (p0)->ip.fib_index =
+           vec_elt (im->fib_index_by_sw_if_index,
+                    vnet_buffer (p0)->sw_if_index[VLIB_RX]);
+         vnet_buffer (p0)->ip.fib_index =
+           (vnet_buffer (p0)->sw_if_index[VLIB_TX] ==
+            (u32) ~ 0) ? vnet_buffer (p0)->ip.
+           fib_index : vnet_buffer (p0)->sw_if_index[VLIB_TX];
+
        skip_check:
 
          next0 = lm->local_next_by_ip_protocol[ip0->protocol];
@@ -3459,14 +3494,9 @@ ip6_config (vlib_main_t * vm, unformat_input_t * input)
     {
       if (unformat (input, "hash-buckets %d", &tmp))
        nbuckets = tmp;
-      else if (unformat (input, "heap-size %dm", &tmp))
-       heapsize = ((u64) tmp) << 20;
-      else if (unformat (input, "heap-size %dM", &tmp))
-       heapsize = ((u64) tmp) << 20;
-      else if (unformat (input, "heap-size %dg", &tmp))
-       heapsize = ((u64) tmp) << 30;
-      else if (unformat (input, "heap-size %dG", &tmp))
-       heapsize = ((u64) tmp) << 30;
+      else if (unformat (input, "heap-size %U",
+                        unformat_memory_size, &heapsize))
+       ;
       else
        return clib_error_return (0, "unknown input '%U'",
                                  format_unformat_error, input);