api: Fold the empty pool check into the main macro
[vpp.git] / src / plugins / map / ip6_map.c
index 96f81ef..1193dda 100644 (file)
@@ -155,20 +155,6 @@ ip6_map_security_check (map_domain_t * d, vlib_buffer_t * b0,
     }
 }
 
-static_always_inline bool
-ip6_map_ip4_lookup_bypass (vlib_buffer_t * p0, ip4_header_t * ip)
-{
-#ifdef MAP_SKIP_IP6_LOOKUP
-  if (FIB_NODE_INDEX_INVALID != pre_resolved[FIB_PROTOCOL_IP4].fei)
-    {
-      vnet_buffer (p0)->ip.adj_index[VLIB_TX] =
-       pre_resolved[FIB_PROTOCOL_IP4].dpo.dpoi_index;
-      return (true);
-    }
-#endif
-  return (false);
-}
-
 /*
  * ip6_map
  */
@@ -314,7 +300,7 @@ ip6_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
                    {
                      vnet_buffer (p0)->ip_frag.flags = 0;
                      vnet_buffer (p0)->ip_frag.next_index =
-                       IP4_FRAG_NEXT_IP4_LOOKUP;
+                       IP_FRAG_NEXT_IP4_LOOKUP;
                      vnet_buffer (p0)->ip_frag.mtu = d0->mtu;
                      next0 = IP6_MAP_NEXT_IP4_FRAGMENT;
                    }
@@ -346,7 +332,7 @@ ip6_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
                    {
                      vnet_buffer (p1)->ip_frag.flags = 0;
                      vnet_buffer (p1)->ip_frag.next_index =
-                       IP4_FRAG_NEXT_IP4_LOOKUP;
+                       IP_FRAG_NEXT_IP4_LOOKUP;
                      vnet_buffer (p1)->ip_frag.mtu = d1->mtu;
                      next1 = IP6_MAP_NEXT_IP4_FRAGMENT;
                    }
@@ -497,7 +483,7 @@ ip6_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
                    {
                      vnet_buffer (p0)->ip_frag.flags = 0;
                      vnet_buffer (p0)->ip_frag.next_index =
-                       IP4_FRAG_NEXT_IP4_LOOKUP;
+                       IP_FRAG_NEXT_IP4_LOOKUP;
                      vnet_buffer (p0)->ip_frag.mtu = d0->mtu;
                      next0 = IP6_MAP_NEXT_IP4_FRAGMENT;
                    }
@@ -618,11 +604,11 @@ ip6_map_post_ip4_reass (vlib_main_t * vm,
              MAP_ERROR_DECAP_SEC_CHECK;
 
          if (PREDICT_FALSE
-             (d0->mtu && (clib_host_to_net_u16 (ip40->length) > d0->mtu)
-              && error0 == MAP_ERROR_NONE))
+             (error0 == MAP_ERROR_NONE &&
+              d0->mtu && (clib_host_to_net_u16 (ip40->length) > d0->mtu)))
            {
              vnet_buffer (p0)->ip_frag.flags = 0;
-             vnet_buffer (p0)->ip_frag.next_index = IP4_FRAG_NEXT_IP4_LOOKUP;
+             vnet_buffer (p0)->ip_frag.next_index = IP_FRAG_NEXT_IP4_LOOKUP;
              vnet_buffer (p0)->ip_frag.mtu = d0->mtu;
              next0 = IP6_MAP_POST_IP4_REASS_NEXT_IP4_FRAGMENT;
            }
@@ -817,12 +803,6 @@ ip6_map_icmp_relay (vlib_main_t * vm,
 
 }
 
-static char *map_error_strings[] = {
-#define _(sym,string) string,
-  foreach_map_error
-#undef _
-};
-
 /* *INDENT-OFF* */
 VNET_FEATURE_INIT (ip6_map_feature, static) =
 {
@@ -840,7 +820,7 @@ VLIB_REGISTER_NODE(ip6_map_node) = {
   .type = VLIB_NODE_TYPE_INTERNAL,
 
   .n_errors = MAP_N_ERROR,
-  .error_strings = map_error_strings,
+  .error_counters = map_error_counters,
 
   .n_next_nodes = IP6_MAP_N_NEXT,
   .next_nodes = {
@@ -866,7 +846,7 @@ VLIB_REGISTER_NODE(ip6_map_post_ip4_reass_node) = {
   .format_trace = format_ip6_map_post_ip4_reass_trace,
   .type = VLIB_NODE_TYPE_INTERNAL,
   .n_errors = MAP_N_ERROR,
-  .error_strings = map_error_strings,
+  .error_counters = map_error_counters,
   .n_next_nodes = IP6_MAP_POST_IP4_REASS_N_NEXT,
   .next_nodes = {
     [IP6_MAP_POST_IP4_REASS_NEXT_IP4_LOOKUP] = "ip4-lookup",
@@ -884,7 +864,7 @@ VLIB_REGISTER_NODE(ip6_map_icmp_relay_node, static) = {
   .format_trace = format_map_trace, //FIXME
   .type = VLIB_NODE_TYPE_INTERNAL,
   .n_errors = MAP_N_ERROR,
-  .error_strings = map_error_strings,
+  .error_counters = map_error_counters,
   .n_next_nodes = IP6_ICMP_RELAY_N_NEXT,
   .next_nodes = {
     [IP6_ICMP_RELAY_NEXT_IP4_LOOKUP] = "ip4-lookup",