ip: add support for buffer offload metadata in ip midchain
[vpp.git] / src / vnet / ip / ip6_input.c
index 6fab582..64c9d76 100644 (file)
@@ -41,6 +41,7 @@
 #include <vnet/ethernet/ethernet.h>
 #include <vnet/ppp/ppp.h>
 #include <vnet/hdlc/hdlc.h>
+#include <vnet/pg/pg.h>
 
 typedef struct
 {
@@ -218,21 +219,12 @@ VLIB_NODE_FN (ip6_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
   return frame->n_vectors;
 }
 
-#ifndef CLIB_MARCH_VARIANT
-char *ip6_error_strings[] = {
-#define _(sym,string) string,
-  foreach_ip6_error
-#undef _
-};
-#endif /* CLIB_MARCH_VARIANT */
-
-/* *INDENT-OFF* */
 VLIB_REGISTER_NODE (ip6_input_node) = {
   .name = "ip6-input",
   .vector_size = sizeof (u32),
 
   .n_errors = IP6_N_ERROR,
-  .error_strings = ip6_error_strings,
+  .error_counters = ip6_error_counters,
 
   .n_next_nodes = IP6_INPUT_N_NEXT,
   .next_nodes = {
@@ -245,26 +237,6 @@ VLIB_REGISTER_NODE (ip6_input_node) = {
   .format_buffer = format_ip6_header,
   .format_trace = format_ip6_input_trace,
 };
-/* *INDENT-ON* */
-
-static u8 *
-format_ipv6_fragmentation (u8 * s, va_list * args)
-{
-  ip6_frag_hdr_t *h = va_arg (*args, ip6_frag_hdr_t *);
-  u32 max_header_bytes = va_arg (*args, u32);
-  u32 header_bytes;
-
-  header_bytes = sizeof (h[0]);
-  if (max_header_bytes != 0 && header_bytes > max_header_bytes)
-    return format (s, "ipv6 frag header truncated");
-
-  s =
-    format (s,
-           "fragmentation header: next_hdr: %u, rsv: %u, frag_offset_and_more: %u, id: %u",
-           h->next_hdr, h->rsv, h->fragment_offset_and_more,
-           clib_net_to_host_u32 (h->identification));
-  return s;
-}
 
 static clib_error_t *
 ip6_init (vlib_main_t * vm)
@@ -287,27 +259,18 @@ ip6_init (vlib_main_t * vm)
 
 
   uword *u = hash_get (ip_main.protocol_info_by_name, "IPV6_FRAGMENTATION");
-  ip_protocol_info_t *info = vec_elt_at_index (ip_main.protocol_infos, *u);
-  ASSERT (NULL == info->format_header);
-  info->format_header = format_ipv6_fragmentation;
+  if (u)
+    {
+      ip_protocol_info_t *info =
+       vec_elt_at_index (ip_main.protocol_infos, *u);
+      ASSERT (NULL == info->format_header);
+      info->format_header = format_ip6_frag_hdr;
+    }
   return /* no error */ 0;
 }
 
 VLIB_INIT_FUNCTION (ip6_init);
 
-static clib_error_t *
-ip6_main_loop_enter (vlib_main_t * vm)
-{
-  ip6_main_t *im = &ip6_main;
-  vlib_thread_main_t *tm = &vlib_thread_main;
-
-  throttle_init (&im->nd_throttle, tm->n_vlib_mains, 1e-3);
-
-  return 0;
-}
-
-VLIB_MAIN_LOOP_ENTER_FUNCTION (ip6_main_loop_enter);
-
 /*
  * fd.io coding-style-patch-verification: ON
  *