summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-02-20 14:19:51 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2017-04-03 08:45:12 +0000
commitfa5d19829759cef45cc34efe844d9471f5a1fc61 (patch)
tree5ee804ee3707f766bd5ab13bf3a1db54abecde2a
parent3e350af5d3e9744a4529a28dd293b2d4601442f7 (diff)
Adjacency layout change and move to vnet/adj
Change-Id: I03195a86c69f84a301051c6b3ab64456bbf28645 Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r--src/vnet.am9
-rw-r--r--src/vnet/adj/adj.c3
-rw-r--r--src/vnet/adj/adj.h220
-rw-r--r--src/vnet/adj/adj_midchain.c25
-rw-r--r--src/vnet/adj/adj_midchain.h22
-rw-r--r--src/vnet/adj/adj_nbr.c8
-rw-r--r--src/vnet/adj/rewrite.c (renamed from src/vnet/rewrite.c)0
-rw-r--r--src/vnet/adj/rewrite.h (renamed from src/vnet/rewrite.h)0
-rw-r--r--src/vnet/ethernet/arp.c1
-rw-r--r--src/vnet/gre/gre.c4
-rw-r--r--src/vnet/ip/ip6_neighbor.c1
-rw-r--r--src/vnet/ip/lookup.c10
-rw-r--r--src/vnet/ip/lookup.h209
-rw-r--r--src/vnet/lisp-gpe/lisp_gpe_adjacency.c4
-rw-r--r--src/vnet/mpls/mpls_tunnel.c2
15 files changed, 253 insertions, 265 deletions
diff --git a/src/vnet.am b/src/vnet.am
index 823dd0d6965..f95ec2fb5af 100644
--- a/src/vnet.am
+++ b/src/vnet.am
@@ -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
diff --git a/src/vnet/adj/adj.c b/src/vnet/adj/adj.c
index c1d036a0e8b..7cf9e9d081d 100644
--- a/src/vnet/adj/adj.c
+++ b/src/vnet/adj/adj.c
@@ -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,
diff --git a/src/vnet/adj/adj.h b/src/vnet/adj/adj.h
index 271fdbc6114..af7730f7086 100644
--- a/src/vnet/adj/adj.h
+++ b/src/vnet/adj/adj.h
@@ -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
@@ -42,10 +41,227 @@
#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
diff --git a/src/vnet/adj/adj_midchain.c b/src/vnet/adj/adj_midchain.c
index 55b5e44bc43..e8087f08d21 100644
--- a/src/vnet/adj/adj_midchain.c
+++ b/src/vnet/adj/adj_midchain.c
@@ -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);
}
diff --git a/src/vnet/adj/adj_midchain.h b/src/vnet/adj/adj_midchain.h
index ae414aea6dc..27ca1d3398d 100644
--- a/src/vnet/adj/adj_midchain.h
+++ b/src/vnet/adj/adj_midchain.h
@@ -25,26 +25,6 @@
#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);
/**
diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c
index 072abd0300d..ddacb030f1d 100644
--- a/src/vnet/adj/adj_nbr.c
+++ b/src/vnet/adj/adj_nbr.c
@@ -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));
diff --git a/src/vnet/rewrite.c b/src/vnet/adj/rewrite.c
index 47fb74df01b..47fb74df01b 100644
--- a/src/vnet/rewrite.c
+++ b/src/vnet/adj/rewrite.c
diff --git a/src/vnet/rewrite.h b/src/vnet/adj/rewrite.h
index 1dea72f5ed8..1dea72f5ed8 100644
--- a/src/vnet/rewrite.h
+++ b/src/vnet/adj/rewrite.h
diff --git a/src/vnet/ethernet/arp.c b/src/vnet/ethernet/arp.c
index 09ecd0ccebc..ee757505192 100644
--- a/src/vnet/ethernet/arp.c
+++ b/src/vnet/ethernet/arp.c
@@ -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:
diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c
index 29d0f0fe50c..3d3813881ae 100644
--- a/src/vnet/gre/gre.c
+++ b/src/vnet/gre/gre.c
@@ -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));
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index b1a03546920..5d1fb6f8994 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -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:
diff --git a/src/vnet/ip/lookup.c b/src/vnet/ip/lookup.c
index dabfa012eb1..95f36d41a86 100644
--- a/src/vnet/ip/lookup.c
+++ b/src/vnet/ip/lookup.c
@@ -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)
diff --git a/src/vnet/ip/lookup.h b/src/vnet/ip/lookup.h
index f76ddb37863..662a1cc0066 100644
--- a/src/vnet/ip/lookup.h
+++ b/src/vnet/ip/lookup.h
@@ -53,93 +53,9 @@
#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;
diff --git a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
index 50662dd679f..79b2a07f7cd 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
+++ b/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
@@ -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)));
diff --git a/src/vnet/mpls/mpls_tunnel.c b/src/vnet/mpls/mpls_tunnel.c
index e488271dd41..ac6fdcdf1d7 100644
--- a/src/vnet/mpls/mpls_tunnel.c
+++ b/src/vnet/mpls/mpls_tunnel.c
@@ -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));