mpls: fix default mpls lb hash config 47/40447/3
authorVladislav Grishenko <themiron@yandex-team.ru>
Wed, 24 Jan 2024 11:17:23 +0000 (16:17 +0500)
committerNeale Ranns <neale@graphiant.com>
Tue, 9 Apr 2024 04:47:02 +0000 (04:47 +0000)
commit302db471a01b5c21b80e9bc769315cef4da0ed80
treebe284a966c720d6dc601128759e42a62553db2a7
parent2a7bc81ae302b02e8e0d4eec7db82c1ca15b7f7a
mpls: fix default mpls lb hash config

In case of multiple path within tunnel, mpls lookup node
computes lb hash with mpls_compute_flow_hash config value 0,
so only mpls label and l4 ports gets accounted, not 5-tuple.
This leads to flow traffic polarization and disbalance over
mpls paths.

Use mpls hash config from lb instead, usually it'll be
MPLS_FLOw_HASH_DEFAULT with 5-tuple plus flowlabel.
As optimization, fix flow hash reuse from the previous lookup
node if present, like ip_lookup does. Previously mpls lookup
always calcs the hash.
Test lb distribution for both cases.

Also, use the same flow hash hex format in ip4/ip6 and mpls
traces for easier reading, most code changes is due fixstyle
formatting.

Type: fix
Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru>
Change-Id: Ib89e1ab3edec14269866fe825a3e887d6c817b7c
src/vnet/ip/ip4_forward.c
src/vnet/ip/ip6_forward.c
src/vnet/mpls/mpls_lookup.c
test/test_mpls.py