summaryrefslogtreecommitdiffstats
path: root/src/plugins/geneve/geneve.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-11-12 16:53:51 +0000
committerOle Tr�an <otroan@employees.org>2020-11-17 12:26:40 +0000
commitb18796092bd1ef23d41b70c83c69d8d9cd2d051a (patch)
tree46c1b3da4f6d7d6a3c5dd677ceb7340863d48706 /src/plugins/geneve/geneve.c
parent2e8760628d6f629ddaa0f24bb901e10dcdbd5435 (diff)
geneve: Remove one bucket load-balance objects
Type: improvement geneve uses the UDP source port for the flow hash to get load-balancing over multiple paths to the tunnel destination. However, if there is only one path, then we can elide the LB object, contributed by the resolving FIB entry, from the dasta path. Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I13a1bedc307a474d258a757bc1bae28564798730
Diffstat (limited to 'src/plugins/geneve/geneve.c')
-rw-r--r--src/plugins/geneve/geneve.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/geneve/geneve.c b/src/plugins/geneve/geneve.c
index f991af97571..2c6f1ffded5 100644
--- a/src/plugins/geneve/geneve.c
+++ b/src/plugins/geneve/geneve.c
@@ -150,6 +150,18 @@ geneve_tunnel_restack_dpo (geneve_tunnel_t * t)
FIB_FORW_CHAIN_TYPE_UNICAST_IP4 : FIB_FORW_CHAIN_TYPE_UNICAST_IP6;
fib_entry_contribute_forwarding (t->fib_entry_index, forw_type, &dpo);
+
+ /* geneve uses the flow hash as the udp source port
+ * hence the packet's hash is unknown at this time.
+ * However, we can still skip single bucket load balance dpo's */
+ while (DPO_LOAD_BALANCE == dpo.dpoi_type)
+ {
+ load_balance_t *lb = load_balance_get (dpo.dpoi_index);
+ if (lb->lb_n_buckets > 1)
+ break;
+
+ dpo_copy (&dpo, load_balance_get_bucket_i (lb, 0));
+ }
dpo_stack_from_node (encap_index, &t->next_dpo, &dpo);
dpo_reset (&dpo);
}