diff options
author | Damjan Marion <damarion@cisco.com> | 2016-03-29 13:06:36 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2016-03-29 12:50:53 +0000 |
commit | f1bd8bec8776755dfb98f1a93be0f9ee884aa7da (patch) | |
tree | 644d2e9673c3f9b421ef391a6a5edccf52af5fd1 /vnet | |
parent | b2ef4dde97b51b73a596093f06cbbdb84f23a824 (diff) |
Move classify_table_index under the union
Fields needed only by specific adj type should
be shared.
Change-Id: I59ee15a29d2f5f527f46910a1a63866b291734c7
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/classify/ip_classify.c | 6 | ||||
-rw-r--r-- | vnet/vnet/ip/ip4_forward.c | 2 | ||||
-rw-r--r-- | vnet/vnet/ip/ip6_forward.c | 2 | ||||
-rw-r--r-- | vnet/vnet/ip/lookup.c | 6 | ||||
-rw-r--r-- | vnet/vnet/ip/lookup.h | 9 | ||||
-rw-r--r-- | vnet/vnet/mpls-gre/interface.c | 2 |
6 files changed, 16 insertions, 11 deletions
diff --git a/vnet/vnet/classify/ip_classify.c b/vnet/vnet/classify/ip_classify.c index c922608547c..eff447bcc74 100644 --- a/vnet/vnet/classify/ip_classify.c +++ b/vnet/vnet/classify/ip_classify.c @@ -112,11 +112,11 @@ ip_classify_inline (vlib_main_t * vm, adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX]; adj0 = ip_get_adjacency (lm, adj_index0); - table_index0 = adj0->classify_table_index; + table_index0 = adj0->classify.table_index; adj_index1 = vnet_buffer (b1)->ip.adj_index[VLIB_TX]; adj1 = ip_get_adjacency (lm, adj_index1); - table_index1 = adj1->classify_table_index; + table_index1 = adj1->classify.table_index; t0 = pool_elt_at_index (vcm->tables, table_index0); @@ -156,7 +156,7 @@ ip_classify_inline (vlib_main_t * vm, adj_index0 = vnet_buffer (b0)->ip.adj_index[VLIB_TX]; adj0 = ip_get_adjacency (lm, adj_index0); - table_index0 = adj0->classify_table_index; + table_index0 = adj0->classify.table_index; t0 = pool_elt_at_index (vcm->tables, table_index0); vnet_buffer(b0)->l2_classify.hash = diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c index 04619837469..6bfe1cff2f2 100644 --- a/vnet/vnet/ip/ip4_forward.c +++ b/vnet/vnet/ip/ip4_forward.c @@ -998,7 +998,7 @@ ip4_add_interface_routes (u32 sw_if_index, if (classify_table_index != (u32) ~0) { adj->lookup_next_index = IP_LOOKUP_NEXT_CLASSIFY; - adj->classify_table_index = classify_table_index; + adj->classify.table_index = classify_table_index; } else adj->lookup_next_index = IP_LOOKUP_NEXT_LOCAL; diff --git a/vnet/vnet/ip/ip6_forward.c b/vnet/vnet/ip/ip6_forward.c index a478bab5fc4..3e8261a05a5 100644 --- a/vnet/vnet/ip/ip6_forward.c +++ b/vnet/vnet/ip/ip6_forward.c @@ -930,7 +930,7 @@ ip6_add_interface_routes (vnet_main_t * vnm, u32 sw_if_index, if (classify_table_index != (u32) ~0) { adj->lookup_next_index = IP_LOOKUP_NEXT_CLASSIFY; - adj->classify_table_index = classify_table_index; + adj->classify.table_index = classify_table_index; } else adj->lookup_next_index = IP_LOOKUP_NEXT_LOCAL; diff --git a/vnet/vnet/ip/lookup.c b/vnet/vnet/ip/lookup.c index a6b037a3ad9..629c900a6b6 100644 --- a/vnet/vnet/ip/lookup.c +++ b/vnet/vnet/ip/lookup.c @@ -132,7 +132,7 @@ ip_add_adjacency (ip_lookup_main_t * lm, adj[i].rewrite_header.sw_if_index = ~0; adj[i].explicit_fib_index = ~0; adj[i].mcast_group_index = ~0; - adj[i].classify_table_index = ~0; + adj[i].classify.table_index = ~0; adj[i].saved_lookup_next_index = 0; if (copy_adj) @@ -958,7 +958,7 @@ u8 * format_ip_adjacency (u8 * s, va_list * args) break; case IP_LOOKUP_NEXT_CLASSIFY: - s = format (s, " table %d", adj->classify_table_index); + s = format (s, " table %d", adj->classify.table_index); default: break; @@ -1072,7 +1072,7 @@ static uword unformat_ip_adjacency (unformat_input_t * input, va_list * args) (void) unformat (input, "%d", &adj->if_address_index); else if (next == IP_LOOKUP_NEXT_CLASSIFY) { - if (!unformat (input, "%d", &adj->classify_table_index)) + if (!unformat (input, "%d", &adj->classify.table_index)) { clib_warning ("classify adj must specify table index"); return 0; diff --git a/vnet/vnet/ip/lookup.h b/vnet/vnet/ip/lookup.h index 42869350dff..ba242ef5de4 100644 --- a/vnet/vnet/ip/lookup.h +++ b/vnet/vnet/ip/lookup.h @@ -129,11 +129,16 @@ typedef struct { i16 explicit_fib_index; u16 mcast_group_index; - /* When classifying, start here */ - u16 classify_table_index; /* Highest possible perf subgraph arc interposition, e.g. for ip6 ioam */ u16 saved_lookup_next_index; + union { + /* IP_LOOKUP_NEXT_CLASSIFY only */ + struct { + u16 table_index; + } classify; + }; + STRUCT_MARK(signature_end); /* Number of FIB entries sharing this adjacency */ diff --git a/vnet/vnet/mpls-gre/interface.c b/vnet/vnet/mpls-gre/interface.c index c345054bdec..259211a940f 100644 --- a/vnet/vnet/mpls-gre/interface.c +++ b/vnet/vnet/mpls-gre/interface.c @@ -1777,7 +1777,7 @@ int vnet_mpls_ethernet_add_del_policy_tunnel (u8 *dst, memset(&adj, 0, sizeof (adj)); adj.explicit_fib_index = ~0; adj.lookup_next_index = IP_LOOKUP_NEXT_CLASSIFY; - adj.classify_table_index = classify_table_index; + adj.classify.table_index = classify_table_index; if (!l2_only) ip_add_adjacency (lm, &adj, 1 /* one adj */, |