aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/adj/.clang-format2
-rw-r--r--src/vnet/adj/adj_midchain.c17
-rw-r--r--src/vnet/gre/gre.c25
-rw-r--r--src/vnet/ipip/ipip.c23
4 files changed, 50 insertions, 17 deletions
diff --git a/src/vnet/adj/.clang-format b/src/vnet/adj/.clang-format
new file mode 100644
index 00000000000..9d159247d51
--- /dev/null
+++ b/src/vnet/adj/.clang-format
@@ -0,0 +1,2 @@
+DisableFormat: true
+SortIncludes: false
diff --git a/src/vnet/adj/adj_midchain.c b/src/vnet/adj/adj_midchain.c
index 93cfb550e3e..a21cd21ea25 100644
--- a/src/vnet/adj/adj_midchain.c
+++ b/src/vnet/adj/adj_midchain.c
@@ -623,8 +623,23 @@ adj_nbr_midchain_stack_on_fib_entry (adj_index_t ai,
choice = load_balance_get_bucket_i (lb, hash & lb->lb_n_buckets_minus_1);
dpo_copy (&tmp, choice);
}
- else if (adj->ia_flags & ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH)
+ else if (lb->lb_n_buckets > 1)
{
+ /*
+ * the client has chosen not to use the stacking to select a
+ * bucket, and there are more than one buckets. there's no
+ * value in using the midchain's fixed rewrite string to select
+ * the path, so force a flow hash on the inner.
+ */
+ adj->rewrite_header.flags |= VNET_REWRITE_FIXUP_FLOW_HASH;
+ }
+
+ if (adj->ia_flags & ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH)
+ {
+ /*
+ * The client, for reasons unbeknownst to adj, wants to force
+ * a flow hash on the inner, we will oblige.
+ */
adj->rewrite_header.flags |= VNET_REWRITE_FIXUP_FLOW_HASH;
}
}
diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c
index a355a224ee1..0669c676bf5 100644
--- a/src/vnet/gre/gre.c
+++ b/src/vnet/gre/gre.c
@@ -410,11 +410,15 @@ gre_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
ti = gm->tunnel_index_by_sw_if_index[sw_if_index];
t = pool_elt_at_index (gm->tunnels, ti);
+ af = ADJ_FLAG_NONE;
- if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH)
- af = ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH;
- else
- af = ADJ_FLAG_MIDCHAIN_IP_STACK;
+ /*
+ * the user has not requested that the load-balancing be based on
+ * a flow hash of the inner packet. so use the stacking to choose
+ * a path.
+ */
+ if (!(t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH))
+ af |= ADJ_FLAG_MIDCHAIN_IP_STACK;
if (VNET_LINK_ETHERNET == adj_get_link_type (ai))
af |= ADJ_FLAG_MIDCHAIN_NO_COUNT;
@@ -435,10 +439,15 @@ mgre_mk_complete_walk (adj_index_t ai, void *data)
mgre_walk_ctx_t *ctx = data;
adj_flags_t af;
- if (ctx->t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH)
- af = ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH;
- else
- af = ADJ_FLAG_MIDCHAIN_IP_STACK;
+ af = ADJ_FLAG_NONE;
+
+ /*
+ * the user has not requested that the load-balancing be based on
+ * a flow hash of the inner packet. so use the stacking to choose
+ * a path.
+ */
+ if (!(ctx->t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH))
+ af |= ADJ_FLAG_MIDCHAIN_IP_STACK;
adj_nbr_midchain_update_rewrite
(ai, gre_get_fixup (ctx->t->tunnel_dst.fp_proto,
diff --git a/src/vnet/ipip/ipip.c b/src/vnet/ipip/ipip.c
index d43bcd1cb53..e6ea3ebe79d 100644
--- a/src/vnet/ipip/ipip.c
+++ b/src/vnet/ipip/ipip.c
@@ -335,14 +335,18 @@ ipip_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai)
ipip_tunnel_t *t;
adj_flags_t af;
+ af = ADJ_FLAG_NONE;
t = ipip_tunnel_db_find_by_sw_if_index (sw_if_index);
if (!t)
return;
- if (t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH)
- af = ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH;
- else
- af = ADJ_FLAG_MIDCHAIN_IP_STACK;
+ /*
+ * the user has not requested that the load-balancing be based on
+ * a flow hash of the inner packet. so use the stacking to choose
+ * a path.
+ */
+ if (!(t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH))
+ af |= ADJ_FLAG_MIDCHAIN_IP_STACK;
if (VNET_LINK_ETHERNET == adj_get_link_type (ai))
af |= ADJ_FLAG_MIDCHAIN_NO_COUNT;
@@ -372,10 +376,13 @@ mipip_mk_complete_walk (adj_index_t ai, void *data)
af = ADJ_FLAG_NONE;
fixup = ipip_get_fixup (ctx->t, adj_get_link_type (ai), &af);
- if (ctx->t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH)
- af = ADJ_FLAG_MIDCHAIN_FIXUP_FLOW_HASH;
- else
- af = ADJ_FLAG_MIDCHAIN_IP_STACK;
+ /*
+ * the user has not requested that the load-balancing be based on
+ * a flow hash of the inner packet. so use the stacking to choose
+ * a path.
+ */
+ if (!(ctx->t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH))
+ af |= ADJ_FLAG_MIDCHAIN_IP_STACK;
adj_nbr_midchain_update_rewrite
(ai, fixup,