summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-04-13 11:21:07 +0200
committerGerrit Code Review <gerrit@fd.io>2016-04-13 13:42:07 +0000
commitb2707897416967feffd127a5907f49bd1aa2813f (patch)
tree391419a9bb8fabb3dae581ae04d7257cd2913d19
parentba22b8e6c1a30092369b4d42d3d45a10595cfd8d (diff)
Create macro for next_nodes used in lookup family of nodes
This should help when adding new adjacency types Change-Id: I1832c6b7a80b6bc69ed83423a60511b7932f336f Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--vnet/vnet/classify/ip_classify.c32
-rw-r--r--vnet/vnet/ip/ip4_forward.c33
-rw-r--r--vnet/vnet/ip/ip4_hop_by_hop.c48
-rw-r--r--vnet/vnet/ip/ip6_forward.c16
-rw-r--r--vnet/vnet/ip/ip6_hop_by_hop.c51
-rw-r--r--vnet/vnet/ip/lookup.h32
6 files changed, 44 insertions, 168 deletions
diff --git a/vnet/vnet/classify/ip_classify.c b/vnet/vnet/classify/ip_classify.c
index ba5269e2a62..55c08e0ceeb 100644
--- a/vnet/vnet/classify/ip_classify.c
+++ b/vnet/vnet/classify/ip_classify.c
@@ -323,21 +323,7 @@ VLIB_REGISTER_NODE (ip4_classify_node) = {
.error_strings = ip_classify_error_strings,
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip4-miss",
- [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_REWRITE] = "ip4-rewrite-transit",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", /* probably not... */
- [IP_LOOKUP_NEXT_MAP] = "ip4-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop",
- },
+ .next_nodes = IP4_LOOKUP_NEXT_NODES,
};
static uword
@@ -358,21 +344,7 @@ VLIB_REGISTER_NODE (ip6_classify_node) = {
.error_strings = ip_classify_error_strings,
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
- [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_REWRITE] = "ip6-rewrite",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", /* probably not... */
- [IP_LOOKUP_NEXT_MAP] = "ip6-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
- },
+ .next_nodes = IP6_LOOKUP_NEXT_NODES,
};
static clib_error_t *
diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c
index e099cd9d047..ef3624a8171 100644
--- a/vnet/vnet/ip/ip4_forward.c
+++ b/vnet/vnet/ip/ip4_forward.c
@@ -1301,27 +1301,14 @@ ip4_sw_interface_add_del (vnet_main_t * vnm,
VNET_SW_INTERFACE_ADD_DEL_FUNCTION (ip4_sw_interface_add_del);
+
VLIB_REGISTER_NODE (ip4_lookup_node) = {
.function = ip4_lookup,
.name = "ip4-lookup",
.vector_size = sizeof (u32),
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip4-miss",
- [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_REWRITE] = "ip4-rewrite-transit",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify",
- [IP_LOOKUP_NEXT_MAP] = "ip4-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop",
- },
+ .next_nodes = IP4_LOOKUP_NEXT_NODES,
};
/* Global IP4 main. */
@@ -2979,21 +2966,7 @@ VLIB_REGISTER_NODE (ip4_lookup_multicast_node,static) = {
.vector_size = sizeof (u32),
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip4-miss",
- [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_REWRITE] = "ip4-rewrite-transit",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify",
- [IP_LOOKUP_NEXT_MAP] = "ip4-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop",
- },
+ .next_nodes = IP4_LOOKUP_NEXT_NODES,
};
VLIB_REGISTER_NODE (ip4_multicast_node,static) = {
diff --git a/vnet/vnet/ip/ip4_hop_by_hop.c b/vnet/vnet/ip/ip4_hop_by_hop.c
index db6a50f271f..ae46040a5d3 100644
--- a/vnet/vnet/ip/ip4_hop_by_hop.c
+++ b/vnet/vnet/ip/ip4_hop_by_hop.c
@@ -230,21 +230,7 @@ VLIB_REGISTER_NODE (ip4_hop_by_hop_node) = {
/* See ip/lookup.h */
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip4-miss",
- [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_REWRITE] = "ip4-rewrite-transit",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify",
- [IP_LOOKUP_NEXT_MAP] = "ip4-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", /* probably not */
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop",
- },
+ .next_nodes = IP4_LOOKUP_NEXT_NODES,
};
VLIB_REGISTER_NODE (ip4_add_hop_by_hop_node) = {
@@ -259,21 +245,7 @@ VLIB_REGISTER_NODE (ip4_add_hop_by_hop_node) = {
/* See ip/lookup.h */
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip4-miss",
- [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_REWRITE] = "ip4-rewrite-transit",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify",
- [IP_LOOKUP_NEXT_MAP] = "ip4-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", /* probably not */
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop",
- },
+ .next_nodes = IP4_LOOKUP_NEXT_NODES,
};
VLIB_REGISTER_NODE (ip4_pop_hop_by_hop_node) = {
@@ -288,21 +260,7 @@ VLIB_REGISTER_NODE (ip4_pop_hop_by_hop_node) = {
/* See ip/lookup.h */
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip4-miss",
- [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_REWRITE] = "ip4-rewrite-transit",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify",
- [IP_LOOKUP_NEXT_MAP] = "ip4-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", /* probably not */
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop",
- },
+ .next_nodes = IP4_LOOKUP_NEXT_NODES,
};
static clib_error_t *
diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c
index 6c8d18d6d58..a79bae6905a 100644
--- a/vnet/vnet/ip/ip6_forward.c
+++ b/vnet/vnet/ip/ip6_forward.c
@@ -1173,21 +1173,7 @@ VLIB_REGISTER_NODE (ip6_lookup_node) = {
.vector_size = sizeof (u32),
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
- [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_REWRITE] = "ip6-rewrite",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
- [IP_LOOKUP_NEXT_MAP] = "ip6-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
- },
+ .next_nodes = IP6_LOOKUP_NEXT_NODES,
};
typedef struct {
diff --git a/vnet/vnet/ip/ip6_hop_by_hop.c b/vnet/vnet/ip/ip6_hop_by_hop.c
index 50dc38b7fed..057d16cec1d 100644
--- a/vnet/vnet/ip/ip6_hop_by_hop.c
+++ b/vnet/vnet/ip/ip6_hop_by_hop.c
@@ -497,22 +497,7 @@ VLIB_REGISTER_NODE (ip6_hop_by_hop_node) = {
/* See ip/lookup.h */
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
- [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_REWRITE] = "ip6-rewrite",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
- [IP_LOOKUP_NEXT_MAP] = "ip6-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
- /* Next 3 arcs probably never used */
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
- },
+ .next_nodes = IP6_LOOKUP_NEXT_NODES,
};
/* The main h-b-h tracer will be invoked, no need to do much here */
@@ -729,22 +714,7 @@ VLIB_REGISTER_NODE (ip6_add_hop_by_hop_node) = {
/* See ip/lookup.h */
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
- [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_REWRITE] = "ip6-rewrite",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
- [IP_LOOKUP_NEXT_MAP] = "ip6-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
- /* Next 3 arcs probably never used */
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
- },
+ .next_nodes = IP6_LOOKUP_NEXT_NODES,
};
@@ -980,22 +950,7 @@ VLIB_REGISTER_NODE (ip6_pop_hop_by_hop_node) = {
/* See ip/lookup.h */
.n_next_nodes = IP_LOOKUP_N_NEXT,
- .next_nodes = {
- [IP_LOOKUP_NEXT_MISS] = "ip6-miss",
- [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_REWRITE] = "ip6-rewrite",
- [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify",
- [IP_LOOKUP_NEXT_MAP] = "ip6-map",
- [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t",
- [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd",
- /* Next 3 arcs probably never used */
- [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop",
- [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop",
- [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop",
- },
+ .next_nodes = IP6_LOOKUP_NEXT_NODES,
};
diff --git a/vnet/vnet/ip/lookup.h b/vnet/vnet/ip/lookup.h
index fcac675d899..76d803d2699 100644
--- a/vnet/vnet/ip/lookup.h
+++ b/vnet/vnet/ip/lookup.h
@@ -86,6 +86,38 @@ typedef enum {
IP_LOOKUP_N_NEXT,
} ip_lookup_next_t;
+#define IP4_LOOKUP_NEXT_NODES { \
+ [IP_LOOKUP_NEXT_MISS] = "ip4-miss", \
+ [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_REWRITE] = "ip4-rewrite-transit", \
+ [IP_LOOKUP_NEXT_CLASSIFY] = "ip4-classify", \
+ [IP_LOOKUP_NEXT_MAP] = "ip4-map", \
+ [IP_LOOKUP_NEXT_MAP_T] = "ip4-map-t", \
+ [IP_LOOKUP_NEXT_SIXRD] = "ip4-sixrd", \
+ [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip4-hop-by-hop", \
+ [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip4-add-hop-by-hop", \
+ [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip4-pop-hop-by-hop", \
+}
+
+#define IP6_LOOKUP_NEXT_NODES { \
+ [IP_LOOKUP_NEXT_MISS] = "ip6-miss", \
+ [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_REWRITE] = "ip6-rewrite", \
+ [IP_LOOKUP_NEXT_CLASSIFY] = "ip6-classify", \
+ [IP_LOOKUP_NEXT_MAP] = "ip6-map", \
+ [IP_LOOKUP_NEXT_MAP_T] = "ip6-map-t", \
+ [IP_LOOKUP_NEXT_SIXRD] = "ip6-sixrd", \
+ [IP_LOOKUP_NEXT_HOP_BY_HOP] = "ip6-hop-by-hop", \
+ [IP_LOOKUP_NEXT_ADD_HOP_BY_HOP] = "ip6-add-hop-by-hop", \
+ [IP_LOOKUP_NEXT_POP_HOP_BY_HOP] = "ip6-pop-hop-by-hop", \
+}
+
/* Flow hash configuration */
#define IP_FLOW_HASH_SRC_ADDR (1<<0)
#define IP_FLOW_HASH_DST_ADDR (1<<1)