Adjacency layout change and move to vnet/adj 24/5924/3
authorNeale Ranns <nranns@cisco.com>
Mon, 20 Feb 2017 22:19:51 +0000 (14:19 -0800)
committerDamjan Marion <dmarion.lists@gmail.com>
Mon, 3 Apr 2017 08:45:12 +0000 (08:45 +0000)
Change-Id: I03195a86c69f84a301051c6b3ab64456bbf28645
Signed-off-by: Neale Ranns <nranns@cisco.com>
15 files changed:
src/vnet.am
src/vnet/adj/adj.c
src/vnet/adj/adj.h
src/vnet/adj/adj_midchain.c
src/vnet/adj/adj_midchain.h
src/vnet/adj/adj_nbr.c
src/vnet/adj/rewrite.c [moved from src/vnet/rewrite.c with 100% similarity]
src/vnet/adj/rewrite.h [moved from src/vnet/rewrite.h with 100% similarity]
src/vnet/ethernet/arp.c
src/vnet/gre/gre.c
src/vnet/ip/ip6_neighbor.c
src/vnet/ip/lookup.c
src/vnet/ip/lookup.h
src/vnet/lisp-gpe/lisp_gpe_adjacency.c
src/vnet/mpls/mpls_tunnel.c

index 823dd0d..f95ec2f 100644 (file)
@@ -40,8 +40,7 @@ libvnet_la_SOURCES +=                         \
   vnet/interface_format.c                      \
   vnet/interface_output.c                      \
   vnet/misc.c                                  \
-  vnet/replication.c                            \
-  vnet/rewrite.c
+  vnet/replication.c
 
 nobase_include_HEADERS +=                      \
   vnet/api_errno.h                             \
@@ -963,14 +962,16 @@ libvnet_la_SOURCES +=                             \
   vnet/adj/adj_mcast.c                         \
   vnet/adj/adj_l2.c                            \
   vnet/adj/adj_nsh.c                           \
-  vnet/adj/adj.c
+  vnet/adj/adj.c                               \
+  vnet/adj/rewrite.c
 
 nobase_include_HEADERS +=                      \
   vnet/adj/adj.h                               \
   vnet/adj/adj_types.h                         \
   vnet/adj/adj_glean.h                         \
   vnet/adj/adj_nsh.h                           \
-  vnet/adj/adj_nbr.h
+  vnet/adj/adj_nbr.h                           \
+  vnet/adj/rewrite.h
 
 ########################################
 # Data-Plane Objects
index c1d036a..7cf9e9d 100644 (file)
@@ -48,7 +48,7 @@ adj_alloc (fib_protocol_t proto)
 {
     ip_adjacency_t *adj;
 
-    pool_get(adj_pool, adj);
+    pool_get_aligned(adj_pool, adj, CLIB_CACHE_LINE_BYTES);
 
     adj_poison(adj);
 
@@ -58,7 +58,6 @@ adj_alloc (fib_protocol_t proto)
                                    adj_get_index(adj));
 
     adj->rewrite_header.sw_if_index = ~0;
-    adj->n_adj = 1;
     adj->lookup_next_index = 0;
 
     fib_node_init(&adj->ia_node,
index 271fdbc..af7730f 100644 (file)
@@ -24,7 +24,6 @@
  *            address in the ARP packet.
  *          UNSHARED. Only one per-interface.
  *   - midchain: a nighbour adj on a virtual/tunnel interface.
- *   - rewrite: an adj with no key, but with a rewrite string.
  *
  * The API to create and update the adjacency is very sub-type specific. This
  * is intentional as it encourages the user to carefully consider which adjacency
 #ifndef __ADJ_H__
 #define __ADJ_H__
 
-#include <vnet/ip/lookup.h>
 #include <vnet/adj/adj_types.h>
 #include <vnet/adj/adj_nbr.h>
 #include <vnet/adj/adj_glean.h>
+#include <vnet/adj/rewrite.h>
+
+/** @brief Common (IP4/IP6) next index stored in adjacency. */
+typedef enum
+{
+  /** Adjacency to drop this packet. */
+  IP_LOOKUP_NEXT_DROP,
+  /** Adjacency to punt this packet. */
+  IP_LOOKUP_NEXT_PUNT,
+
+  /** This packet is for one of our own IP addresses. */
+  IP_LOOKUP_NEXT_LOCAL,
+
+  /** This packet matches an "incomplete adjacency" and packets
+     need to be passed to ARP to find rewrite string for
+     this destination. */
+  IP_LOOKUP_NEXT_ARP,
+
+  /** This packet matches an "interface route" and packets
+     need to be passed to ARP to find rewrite string for
+     this destination. */
+  IP_LOOKUP_NEXT_GLEAN,
+
+  /** This packet is to be rewritten and forwarded to the next
+     processing node.  This is typically the output interface but
+     might be another node for further output processing. */
+  IP_LOOKUP_NEXT_REWRITE,
+
+  /** This packets follow a mid-chain adjacency */
+  IP_LOOKUP_NEXT_MIDCHAIN,
+
+  /** This packets needs to go to ICMP error */
+  IP_LOOKUP_NEXT_ICMP_ERROR,
+
+  /** Multicast Adjacency. */
+  IP_LOOKUP_NEXT_MCAST,
+
+  IP_LOOKUP_N_NEXT,
+} __attribute__ ((packed)) ip_lookup_next_t;
+
+typedef enum
+{
+  IP4_LOOKUP_N_NEXT = IP_LOOKUP_N_NEXT,
+} ip4_lookup_next_t;
+
+typedef enum
+{
+  /* Hop-by-hop header handling */
+  IP6_LOOKUP_NEXT_HOP_BY_HOP = IP_LOOKUP_N_NEXT,
+  IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP,
+  IP6_LOOKUP_NEXT_POP_HOP_BY_HOP,
+  IP6_LOOKUP_N_NEXT,
+} ip6_lookup_next_t;
+
+#define IP4_LOOKUP_NEXT_NODES {                                        \
+    [IP_LOOKUP_NEXT_DROP] = "ip4-drop",                                \
+    [IP_LOOKUP_NEXT_PUNT] = "ip4-punt",                                \
+    [IP_LOOKUP_NEXT_LOCAL] = "ip4-local",                      \
+    [IP_LOOKUP_NEXT_ARP] = "ip4-arp",                          \
+    [IP_LOOKUP_NEXT_GLEAN] = "ip4-glean",                      \
+    [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite",                  \
+    [IP_LOOKUP_NEXT_MCAST] = "ip4-rewrite-mcast",              \
+    [IP_LOOKUP_NEXT_MIDCHAIN] = "ip4-midchain",                        \
+    [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip4-icmp-error",            \
+}
+
+#define IP6_LOOKUP_NEXT_NODES {                                        \
+    [IP_LOOKUP_NEXT_DROP] = "ip6-drop",                                \
+    [IP_LOOKUP_NEXT_PUNT] = "ip6-punt",                                \
+    [IP_LOOKUP_NEXT_LOCAL] = "ip6-local",                      \
+    [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor",            \
+    [IP_LOOKUP_NEXT_GLEAN] = "ip6-glean",                      \
+    [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite",                  \
+    [IP_LOOKUP_NEXT_MCAST] = "ip6-rewrite-mcast",              \
+    [IP_LOOKUP_NEXT_MIDCHAIN] = "ip6-midchain",                        \
+    [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip6-icmp-error",            \
+    [IP6_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",           \
+    [IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",   \
+    [IP6_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",   \
+}
+
+/**
+ * Forward delcartion
+ */
+struct ip_adjacency_t_;
+
+/**
+ * @brief A function type for post-rewrite fixups on midchain adjacency
+ */
+typedef void (*adj_midchain_fixup_t) (vlib_main_t * vm,
+                                     struct ip_adjacency_t_ * adj,
+                                     vlib_buffer_t * b0);
+
+/**
+ * @brief Flags on an IP adjacency
+ */
+typedef enum ip_adjacency_flags_t_
+{
+    ADJ_FLAG_NONE = 0,
+
+    /**
+     * Currently a sync walk is active. Used to prevent re-entrant walking
+     */
+    ADJ_FLAG_SYNC_WALK_ACTIVE = (1 << 0),
+
+    /**
+     * Packets TX through the midchain do not increment the interface
+     * counters. This should be used when the adj is associated with an L2
+     * interface and that L2 interface is in a bridege domain. In that case
+     * the packet will have traversed the interface's TX node, and hence have
+     * been counted, before it traverses ths midchain
+     */
+    ADJ_FLAG_MIDCHAIN_NO_COUNT = (1 << 1),
+}  __attribute__ ((packed)) adj_flags_t;
+
+/**
+ * @brief IP unicast adjacency.
+ *  @note cache aligned.
+ *
+ * An adjacency is a represenation of a peer on a particular link.
+ */
+typedef struct ip_adjacency_t_
+{
+  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
+
+  /**
+   * Linkage into the FIB node grpah. First member since this type
+   * has 8 byte alignment requirements.
+   */
+  fib_node_t ia_node;
+
+  /**
+   * Next hop after ip4-lookup.
+   *  This is not accessed in the rewrite nodes.
+   * 1-bytes
+   */
+  ip_lookup_next_t lookup_next_index;
+
+  /**
+   * link/ether-type
+   * 1 bytes
+   */
+  vnet_link_t ia_link;
+
+  /**
+   * The protocol of the neighbor/peer. i.e. the protocol with
+   * which to interpret the 'next-hop' attirbutes of the sub-types.
+   * 1-btyes
+   */
+  fib_protocol_t ia_nh_proto;
+
+  /**
+   * Flags on the adjacency
+   * 1-bytes
+   */
+  adj_flags_t ia_flags;
+
+  union
+  {
+    /**
+     * IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE
+     *
+     * neighbour adjacency sub-type;
+     */
+    struct
+    {
+      ip46_address_t next_hop;
+    } nbr;
+      /**
+       * IP_LOOKUP_NEXT_MIDCHAIN
+       *
+       * A nbr adj that is also recursive. Think tunnels.
+       * A nbr adj can transition to be of type MDICHAIN
+       * so be sure to leave the two structs with the next_hop
+       * fields aligned.
+       */
+    struct
+    {
+      /**
+       * The recursive next-hop.
+       *  This field MUST be at the same memory location as
+       *   sub_type.nbr.next_hop
+       */
+      ip46_address_t next_hop;
+      /**
+       * The next DPO to use
+       */
+      dpo_id_t next_dpo;
+      /**
+       * A function to perform the post-rewrite fixup
+       */
+      adj_midchain_fixup_t fixup_func;
+    } midchain;
+    /**
+     * IP_LOOKUP_NEXT_GLEAN
+     *
+     * Glean the address to ARP for from the packet's destination.
+     * Technically these aren't adjacencies, i.e. they are not a
+     * representation of a peer. One day we might untangle this coupling
+     * and use a new Glean DPO.
+     */
+    struct
+    {
+      ip46_address_t receive_addr;
+    } glean;
+  } sub_type;
+
+  CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
+
+  /* Rewrite in second/third cache lines */
+  vnet_declare_rewrite (VLIB_BUFFER_PRE_DATA_SIZE);
+} ip_adjacency_t;
+
+STATIC_ASSERT ((STRUCT_OFFSET_OF (ip_adjacency_t, cacheline0) == 0),
+              "IP adjacency cachline 0 is not offset");
+STATIC_ASSERT ((STRUCT_OFFSET_OF (ip_adjacency_t, cacheline1) ==
+               CLIB_CACHE_LINE_BYTES),
+              "IP adjacency cachline 1 is more than one cachline size offset");
 
 /**
  * @brief
index 55b5e44..e8087f0 100644 (file)
@@ -384,6 +384,14 @@ adj_midchain_get_feature_arc_index_for_link_type (const ip_adjacency_t *adj)
     return (arc);
 }
 
+static u32
+adj_nbr_midchain_get_tx_node (ip_adjacency_t *adj)
+{
+    return ((adj->ia_flags & ADJ_FLAG_MIDCHAIN_NO_COUNT) ?
+            adj_midchain_tx_no_count_node.index :
+            adj_midchain_tx_node.index);
+}
+
 /**
  * adj_nbr_midchain_update_rewrite
  *
@@ -394,12 +402,12 @@ adj_midchain_get_feature_arc_index_for_link_type (const ip_adjacency_t *adj)
 void
 adj_nbr_midchain_update_rewrite (adj_index_t adj_index,
                                 adj_midchain_fixup_t fixup,
-                                adj_midchain_flag_t flags,
+                                adj_flags_t flags,
                                 u8 *rewrite)
 {
+    u32 feature_index, tx_node;
     ip_adjacency_t *adj;
     u8 arc_index;
-    u32 feature_index;
 
     ASSERT(ADJ_INDEX_INVALID != adj_index);
 
@@ -416,15 +424,14 @@ adj_nbr_midchain_update_rewrite (adj_index_t adj_index,
     ASSERT(NULL != rewrite);
 
     adj->sub_type.midchain.fixup_func = fixup;
+    adj->ia_flags |= flags;
 
     arc_index = adj_midchain_get_feature_arc_index_for_link_type (adj);
-    feature_index = (flags & ADJ_MIDCHAIN_FLAG_NO_COUNT) ?
+    feature_index = (flags & ADJ_FLAG_MIDCHAIN_NO_COUNT) ?
                     adj_midchain_tx_no_count_feature_node[adj->ia_link] :
                     adj_midchain_tx_feature_node[adj->ia_link];
 
-    adj->sub_type.midchain.tx_function_node = (flags & ADJ_MIDCHAIN_FLAG_NO_COUNT) ?
-                                               adj_midchain_tx_no_count_node.index :
-                                               adj_midchain_tx_node.index;
+    tx_node = adj_nbr_midchain_get_tx_node(adj);
 
     vnet_feature_enable_disable_with_index (arc_index, feature_index,
                                            adj->rewrite_header.sw_if_index,
@@ -437,7 +444,7 @@ adj_nbr_midchain_update_rewrite (adj_index_t adj_index,
      * node are any output features, then the midchain-tx.  from there we
      * need to get to the stacked child's node.
      */
-    dpo_stack_from_node(adj->sub_type.midchain.tx_function_node,
+    dpo_stack_from_node(tx_node,
                        &adj->sub_type.midchain.next_dpo,
                        drop_dpo_get(vnet_link_to_dpo_proto(adj->ia_link)));
 
@@ -447,7 +454,7 @@ adj_nbr_midchain_update_rewrite (adj_index_t adj_index,
     adj_nbr_update_rewrite_internal(adj,
                                    IP_LOOKUP_NEXT_MIDCHAIN,
                                    adj_get_midchain_node(adj->ia_link),
-                                   adj->sub_type.midchain.tx_function_node,
+                                   tx_node,
                                    rewrite);
 }
 
@@ -491,7 +498,7 @@ adj_nbr_midchain_stack (adj_index_t adj_index,
 
     ASSERT(IP_LOOKUP_NEXT_MIDCHAIN == adj->lookup_next_index);
 
-    dpo_stack_from_node(adj->sub_type.midchain.tx_function_node,
+    dpo_stack_from_node(adj_nbr_midchain_get_tx_node(adj),
                        &adj->sub_type.midchain.next_dpo,
                        next);
 }
index ae414ae..27ca1d3 100644 (file)
 
 #include <vnet/adj/adj.h>
 
-/**
- * @brief Flags controlling the midchain adjacency
- */
-typedef enum adj_midchain_flag_t_
-{
-    /**
-     * No flags
-     */
-    ADJ_MIDCHAIN_FLAG_NONE = 0,
-
-    /**
-     * Packets TX through the midchain do not increment the interface
-     * counters. This should be used when the adj is associated with an L2
-     * interface and that L2 interface is in a bridege domain. In that case
-     * the packet will have traversed the interface's TX node, and hence have
-     * been counted, before it traverses ths midchain
-     */
-    ADJ_MIDCHAIN_FLAG_NO_COUNT = (1 << 0),
-} adj_midchain_flag_t;
-
 /**
  * @brief
  *  Convert an existing neighbour adjacency into a midchain
@@ -60,7 +40,7 @@ typedef enum adj_midchain_flag_t_
  */
 extern void adj_nbr_midchain_update_rewrite(adj_index_t adj_index,
                                            adj_midchain_fixup_t fixup,
-                                           adj_midchain_flag_t flags,
+                                           adj_flags_t flags,
                                            u8 *rewrite);
 
 /**
index 072abd0..ddacb03 100644 (file)
@@ -333,7 +333,7 @@ adj_nbr_update_rewrite (adj_index_t adj_index,
  */
 void
 adj_nbr_update_rewrite_internal (ip_adjacency_t *adj,
-                                u32 adj_next_index,
+                                ip_lookup_next_t adj_next_index,
                                 u32 this_node,
                                 u32 next_node,
                                 u8 *rewrite)
@@ -367,7 +367,7 @@ adj_nbr_update_rewrite_internal (ip_adjacency_t *adj,
     if (ADJ_INDEX_INVALID != walk_ai)
     {
         walk_adj = adj_get(walk_ai);
-        if (IP_ADJ_SYNC_WALK_ACTIVE & walk_adj->ia_flags)
+        if (ADJ_FLAG_SYNC_WALK_ACTIVE & walk_adj->ia_flags)
         {
             do_walk = 0;
         }
@@ -376,7 +376,7 @@ adj_nbr_update_rewrite_internal (ip_adjacency_t *adj,
             /*
              * Prevent re-entrant walk of the same adj
              */
-            walk_adj->ia_flags |= IP_ADJ_SYNC_WALK_ACTIVE;
+            walk_adj->ia_flags |= ADJ_FLAG_SYNC_WALK_ACTIVE;
             do_walk = 1;
         }
     }
@@ -502,7 +502,7 @@ adj_nbr_update_rewrite_internal (ip_adjacency_t *adj,
      */
     if (do_walk)
     {
-        walk_adj->ia_flags &= ~IP_ADJ_SYNC_WALK_ACTIVE;
+        walk_adj->ia_flags &= ~ADJ_FLAG_SYNC_WALK_ACTIVE;
     }
 
     adj_unlock(adj_get_index(adj));
similarity index 100%
rename from src/vnet/rewrite.c
rename to src/vnet/adj/rewrite.c
similarity index 100%
rename from src/vnet/rewrite.h
rename to src/vnet/adj/rewrite.h
index 09ecd0c..ee75750 100644 (file)
@@ -507,7 +507,6 @@ arp_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai)
     case IP_LOOKUP_NEXT_PUNT:
     case IP_LOOKUP_NEXT_LOCAL:
     case IP_LOOKUP_NEXT_REWRITE:
-    case IP_LOOKUP_NEXT_LOAD_BALANCE:
     case IP_LOOKUP_NEXT_MIDCHAIN:
     case IP_LOOKUP_NEXT_ICMP_ERROR:
     case IP_LOOKUP_N_NEXT:
index 29d0f0f..3d38138 100644 (file)
@@ -242,8 +242,8 @@ gre_update_adj (vnet_main_t * vnm,
 {
     adj_nbr_midchain_update_rewrite (ai, gre_fixup, 
                                      (VNET_LINK_ETHERNET == adj_get_link_type (ai) ?
-                                      ADJ_MIDCHAIN_FLAG_NO_COUNT :
-                                      ADJ_MIDCHAIN_FLAG_NONE),
+                                      ADJ_FLAG_MIDCHAIN_NO_COUNT :
+                                      ADJ_FLAG_NONE),
                                     gre_build_rewrite(vnm, sw_if_index,
                                                       adj_get_link_type(ai),
                                                       NULL));
index b1a0354..5d1fb6f 100644 (file)
@@ -557,7 +557,6 @@ ip6_ethernet_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, u32 ai)
     case IP_LOOKUP_NEXT_PUNT:
     case IP_LOOKUP_NEXT_LOCAL:
     case IP_LOOKUP_NEXT_REWRITE:
-    case IP_LOOKUP_NEXT_LOAD_BALANCE:
     case IP_LOOKUP_NEXT_MIDCHAIN:
     case IP_LOOKUP_NEXT_ICMP_ERROR:
     case IP_LOOKUP_N_NEXT:
index dabfa01..95f36d4 100644 (file)
@@ -188,13 +188,6 @@ VNET_SW_INTERFACE_ADD_DEL_FUNCTION (ip_sw_interface_add_del);
 void
 ip_lookup_init (ip_lookup_main_t * lm, u32 is_ip6)
 {
-  /* ensure that adjacency is cacheline aligned and sized */
-  STATIC_ASSERT (STRUCT_OFFSET_OF (ip_adjacency_t, cacheline0) == 0,
-                "Cache line marker must be 1st element in struct");
-  STATIC_ASSERT (STRUCT_OFFSET_OF (ip_adjacency_t, cacheline1) ==
-                CLIB_CACHE_LINE_BYTES,
-                "Data in cache line 0 is bigger than cache line size");
-
   /* Preallocate three "special" adjacencies */
   lm->adjacency_heap = adj_pool;
 
@@ -251,7 +244,8 @@ format_ip_flow_hash_config (u8 * s, va_list * args)
 u8 *
 format_ip_lookup_next (u8 * s, va_list * args)
 {
-  ip_lookup_next_t n = va_arg (*args, ip_lookup_next_t);
+  /* int promotion of ip_lookup_next_t */
+  ip_lookup_next_t n = va_arg (*args, int);
   char *t = 0;
 
   switch (n)
index f76ddb3..662a1cc 100644 (file)
 #include <vnet/ip/ip4_packet.h>
 #include <vnet/ip/ip6_packet.h>
 #include <vnet/fib/fib_node.h>
+#include <vnet/adj/adj.h>
 #include <vnet/dpo/dpo.h>
 #include <vnet/feature/feature.h>
-#include <vnet/rewrite.h>
-
-/** @brief Common (IP4/IP6) next index stored in adjacency. */
-typedef enum
-{
-  /** Adjacency to drop this packet. */
-  IP_LOOKUP_NEXT_DROP,
-  /** Adjacency to punt this packet. */
-  IP_LOOKUP_NEXT_PUNT,
-
-  /** This packet is for one of our own IP addresses. */
-  IP_LOOKUP_NEXT_LOCAL,
-
-  /** This packet matches an "incomplete adjacency" and packets
-     need to be passed to ARP to find rewrite string for
-     this destination. */
-  IP_LOOKUP_NEXT_ARP,
-
-  /** This packet matches an "interface route" and packets
-     need to be passed to ARP to find rewrite string for
-     this destination. */
-  IP_LOOKUP_NEXT_GLEAN,
-
-  /** This packet is to be rewritten and forwarded to the next
-     processing node.  This is typically the output interface but
-     might be another node for further output processing. */
-  IP_LOOKUP_NEXT_REWRITE,
-
-  /** This packets follow a load-balance */
-  IP_LOOKUP_NEXT_LOAD_BALANCE,
-
-  /** This packets follow a mid-chain adjacency */
-  IP_LOOKUP_NEXT_MIDCHAIN,
-
-  /** This packets needs to go to ICMP error */
-  IP_LOOKUP_NEXT_ICMP_ERROR,
-
-  /** Multicast Adjacency. */
-  IP_LOOKUP_NEXT_MCAST,
-
-  IP_LOOKUP_N_NEXT,
-} ip_lookup_next_t;
-
-typedef enum
-{
-  IP4_LOOKUP_N_NEXT = IP_LOOKUP_N_NEXT,
-} ip4_lookup_next_t;
-
-typedef enum
-{
-  /* Hop-by-hop header handling */
-  IP6_LOOKUP_NEXT_HOP_BY_HOP = IP_LOOKUP_N_NEXT,
-  IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP,
-  IP6_LOOKUP_NEXT_POP_HOP_BY_HOP,
-  IP6_LOOKUP_N_NEXT,
-} ip6_lookup_next_t;
-
-#define IP4_LOOKUP_NEXT_NODES {                                        \
-    [IP_LOOKUP_NEXT_DROP] = "ip4-drop",                                \
-    [IP_LOOKUP_NEXT_PUNT] = "ip4-punt",                                \
-    [IP_LOOKUP_NEXT_LOCAL] = "ip4-local",                      \
-    [IP_LOOKUP_NEXT_ARP] = "ip4-arp",                          \
-    [IP_LOOKUP_NEXT_GLEAN] = "ip4-glean",                      \
-    [IP_LOOKUP_NEXT_REWRITE] = "ip4-rewrite",                  \
-    [IP_LOOKUP_NEXT_MCAST] = "ip4-rewrite-mcast",              \
-    [IP_LOOKUP_NEXT_MIDCHAIN] = "ip4-midchain",                        \
-    [IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip4-load-balance",                \
-    [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip4-icmp-error",            \
-}
-
-#define IP6_LOOKUP_NEXT_NODES {                                        \
-    [IP_LOOKUP_NEXT_DROP] = "ip6-drop",                                \
-    [IP_LOOKUP_NEXT_PUNT] = "ip6-punt",                                \
-    [IP_LOOKUP_NEXT_LOCAL] = "ip6-local",                      \
-    [IP_LOOKUP_NEXT_ARP] = "ip6-discover-neighbor",            \
-    [IP_LOOKUP_NEXT_GLEAN] = "ip6-glean",                      \
-    [IP_LOOKUP_NEXT_REWRITE] = "ip6-rewrite",                  \
-    [IP_LOOKUP_NEXT_MCAST] = "ip6-rewrite-mcast",              \
-    [IP_LOOKUP_NEXT_MIDCHAIN] = "ip6-midchain",                        \
-    [IP_LOOKUP_NEXT_LOAD_BALANCE] = "ip6-load-balance",                \
-    [IP_LOOKUP_NEXT_ICMP_ERROR] = "ip6-icmp-error",            \
-    [IP6_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",           \
-    [IP6_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",   \
-    [IP6_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",   \
-}
 
 /** Flow hash configuration */
 #define IP_FLOW_HASH_SRC_ADDR (1<<0)
@@ -165,129 +81,6 @@ _(reverse, IP_FLOW_HASH_REVERSE_SRC_DST)
  */
 typedef u32 flow_hash_config_t;
 
-/**
- * Forward delcartion
- */
-struct ip_adjacency_t_;
-
-/**
- * @brief A function type for post-rewrite fixups on midchain adjacency
- */
-typedef void (*adj_midchain_fixup_t) (vlib_main_t * vm,
-                                     struct ip_adjacency_t_ * adj,
-                                     vlib_buffer_t * b0);
-
-/**
- * @brief Flags on an IP adjacency
- */
-typedef enum ip_adjacency_flags_t_
-{
-    /**
-     * Currently a sync walk is active. Used to prevent re-entrant walking
-     */
-  IP_ADJ_SYNC_WALK_ACTIVE = (1 << 0),
-} ip_adjacency_flags_t;
-
-/** @brief IP unicast adjacency.
-    @note cache aligned.
-*/
-typedef struct ip_adjacency_t_
-{
-  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
-
-  /** Number of adjecencies in block.  Greater than 1 means multipath;
-     otherwise equal to 1. */
-  u16 n_adj;
-
-  /** Next hop after ip4-lookup. */
-  union
-  {
-    ip_lookup_next_t lookup_next_index:16;
-    u16 lookup_next_index_as_int;
-  };
-
-  /** Interface address index for this local/arp adjacency. */
-  u32 if_address_index;
-
-  /*
-   * link/ether-type
-   */
-  vnet_link_t ia_link;
-  u8 ia_nh_proto;
-
-  union
-  {
-    /**
-     * IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE
-     *
-     * neighbour adjacency sub-type;
-     */
-    struct
-    {
-      ip46_address_t next_hop;
-    } nbr;
-      /**
-       * IP_LOOKUP_NEXT_MIDCHAIN
-       *
-       * A nbr adj that is also recursive. Think tunnels.
-       * A nbr adj can transition to be of type MDICHAIN
-       * so be sure to leave the two structs with the next_hop
-       * fields aligned.
-       */
-    struct
-    {
-      /**
-       * The recursive next-hop
-       */
-      ip46_address_t next_hop;
-      /**
-       * The node index of the tunnel's post rewrite/TX function.
-       */
-      u32 tx_function_node;
-      /**
-       * The next DPO to use
-       */
-      dpo_id_t next_dpo;
-      /**
-       * A function to perform the post-rewrite fixup
-       */
-      adj_midchain_fixup_t fixup_func;
-    } midchain;
-    /**
-     * IP_LOOKUP_NEXT_GLEAN
-     *
-     * Glean the address to ARP for from the packet's destination
-     */
-    struct
-    {
-      ip46_address_t receive_addr;
-    } glean;
-  } sub_type;
-
-    CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
-
-  /* Rewrite in second/third cache lines */
-    vnet_declare_rewrite (VLIB_BUFFER_PRE_DATA_SIZE);
-
-  /*
-   * member not accessed in the data plane are relgated to the
-   * remaining cachelines
-   */
-  fib_node_t ia_node;
-
-  /**
-   * Flags on the adjacency
-   */
-  ip_adjacency_flags_t ia_flags;
-
-} ip_adjacency_t;
-
-STATIC_ASSERT ((STRUCT_OFFSET_OF (ip_adjacency_t, cacheline0) == 0),
-              "IP adjacency cachline 0 is not offset");
-STATIC_ASSERT ((STRUCT_OFFSET_OF (ip_adjacency_t, cacheline1) ==
-               CLIB_CACHE_LINE_BYTES),
-              "IP adjacency cachline 1 is more than one cachline size offset");
-
 /* An all zeros address */
 extern const ip46_address_t zero_addr;
 
index 50662dd..79b2a07 100644 (file)
@@ -361,8 +361,8 @@ lisp_gpe_update_adjacency (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
   adj_nbr_midchain_update_rewrite
     (ai, lisp_gpe_fixup,
      (VNET_LINK_ETHERNET == linkt ?
-      ADJ_MIDCHAIN_FLAG_NO_COUNT :
-      ADJ_MIDCHAIN_FLAG_NONE),
+      ADJ_FLAG_MIDCHAIN_NO_COUNT :
+      ADJ_FLAG_NONE),
      lisp_gpe_tunnel_build_rewrite (lgt, ladj,
                                    lisp_gpe_adj_proto_from_vnet_link_type
                                    (linkt)));
index e488271..ac6fdcd 100644 (file)
@@ -275,7 +275,7 @@ mpls_tunnel_update_adj (vnet_main_t * vnm,
 {
     adj_nbr_midchain_update_rewrite(
        ai, mpls_tunnel_fixup, 
-       ADJ_MIDCHAIN_FLAG_NONE,
+       ADJ_FLAG_NONE,
        mpls_tunnel_build_rewrite(vnm, sw_if_index,
                                  adj_get_link_type(ai),
                                  NULL));