summaryrefslogtreecommitdiffstats
path: root/src/vnet/adj/adj_midchain.c
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 /src/vnet/adj/adj_midchain.c
parent3e350af5d3e9744a4529a28dd293b2d4601442f7 (diff)
Adjacency layout change and move to vnet/adj
Change-Id: I03195a86c69f84a301051c6b3ab64456bbf28645 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/adj/adj_midchain.c')
-rw-r--r--src/vnet/adj/adj_midchain.c25
1 files changed, 16 insertions, 9 deletions
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);
}