#include <vnet/dpo/load_balance.h>
#include <vnet/fib/fib_walk.h>
#include <vnet/fib/fib_entry.h>
+#include <vnet/ip/ip4_inlines.h>
+#include <vnet/ip/ip6_inlines.h>
/**
* @brief Trace data for packets traversing the midchain tx node
}
case VNET_LINK_NSH:
{
- arc = nsh_main_dummy.output_feature_arc_index;
+ arc = nsh_main_placeholder.output_feature_arc_index;
break;
}
case VNET_LINK_ARP:
dpo_reset(&adj->sub_type.midchain.next_dpo);
vlib_worker_thread_barrier_sync(vm);
- vnet_feature_modify_end_node(
+ adj->ia_cfg_index = vnet_feature_modify_end_node(
adj_midchain_get_feature_arc_index_for_link_type (adj),
adj->rewrite_header.sw_if_index,
vlib_get_node_by_name (vlib_get_main(),
{
adj->rewrite_header.flags &= ~VNET_REWRITE_FIXUP_IP4_O_4;
}
+ if (!(flags & ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH))
+ {
+ adj->rewrite_header.flags &= ~VNET_REWRITE_FIXUP_FLOW_HASH;
+ }
tx_node = adj_nbr_midchain_get_tx_node(adj);
vlib_worker_thread_barrier_sync(vm);
- vnet_feature_modify_end_node(
+ adj->ia_cfg_index = vnet_feature_modify_end_node(
adj_midchain_get_feature_arc_index_for_link_type (adj),
adj->rewrite_header.sw_if_index,
tx_node);
adj->ia_node_index,
next_node);
- vnet_feature_modify_end_node(
+ adj->ia_cfg_index = vnet_feature_modify_end_node(
adj_midchain_get_feature_arc_index_for_link_type (adj),
adj->rewrite_header.sw_if_index,
next_node);
}
void
-adj_nbr_midchain_reset_next_node(adj_index_t adj_index)
+adj_nbr_midchain_reset_next_node (adj_index_t adj_index)
{
ip_adjacency_t *adj;
vlib_main_t * vm;
adj->ia_node_index,
adj_nbr_midchain_get_tx_node(adj));
- vnet_feature_modify_end_node(
+ adj->ia_cfg_index = vnet_feature_modify_end_node(
adj_midchain_get_feature_arc_index_for_link_type (adj),
adj->rewrite_header.sw_if_index,
adj_nbr_midchain_get_tx_node(adj));
{
fib_entry_contribute_forwarding (fei, fct, &tmp);
- if ((adj->ia_flags & ADJ_FLAG_MIDCHAIN_IP_STACK) &&
- (DPO_LOAD_BALANCE == tmp.dpoi_type))
+ if (DPO_LOAD_BALANCE == tmp.dpoi_type)
{
- /*
- * do that hash now and stack on the choice.
- * If the choice is an incomplete adj then we will need a poke when
- * it becomes complete. This happens since the adj update walk propagates
- * as far a recursive paths.
- */
- const dpo_id_t *choice;
load_balance_t *lb;
- int hash;
lb = load_balance_get (tmp.dpoi_index);
- if (FIB_FORW_CHAIN_TYPE_UNICAST_IP4 == fct)
+ if ((adj->ia_flags & ADJ_FLAG_MIDCHAIN_IP_STACK) ||
+ lb->lb_n_buckets == 1)
{
- hash = ip4_compute_flow_hash ((ip4_header_t *) adj_get_rewrite (ai),
- lb->lb_hash_config);
+ /*
+ * do that hash now and stack on the choice.
+ * If the choice is an incomplete adj then we will need a poke when
+ * it becomes complete. This happens since the adj update walk propagates
+ * as far a recursive paths.
+ */
+ const dpo_id_t *choice;
+ int hash;
+
+ if (FIB_FORW_CHAIN_TYPE_UNICAST_IP4 == fct)
+ {
+ hash = ip4_compute_flow_hash ((ip4_header_t *) adj_get_rewrite (ai),
+ lb->lb_hash_config);
+ }
+ else if (FIB_FORW_CHAIN_TYPE_UNICAST_IP6 == fct)
+ {
+ hash = ip6_compute_flow_hash ((ip6_header_t *) adj_get_rewrite (ai),
+ lb->lb_hash_config);
+ }
+ else
+ {
+ hash = 0;
+ ASSERT(0);
+ }
+
+ choice = load_balance_get_bucket_i (lb, hash & lb->lb_n_buckets_minus_1);
+ dpo_copy (&tmp, choice);
}
- else if (FIB_FORW_CHAIN_TYPE_UNICAST_IP6 == fct)
+ else if (adj->ia_flags & ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH)
{
- hash = ip6_compute_flow_hash ((ip6_header_t *) adj_get_rewrite (ai),
- lb->lb_hash_config);
+ adj->rewrite_header.flags |= VNET_REWRITE_FIXUP_FLOW_HASH;
}
- else
- {
- hash = 0;
- ASSERT(0);
- }
-
- choice = load_balance_get_bucket_i (lb, hash & lb->lb_n_buckets_minus_1);
- dpo_copy (&tmp, choice);
}
}
adj_nbr_midchain_stack (ai, &tmp);