l2: fix vxlan src port entropy with mpls payload

l2 tunnels like vxlan, gtpu, geneva use vnet_l2_compute_flow_hash() to
compute flow hash for udp src port entropy. In case of inner mpls tunnels
to the same lsr ethernet src and dst macs are the same, so l2 flow hash
is also the same leading to no src port entropy and the only rss queue
overflow on receiver side.

Fix it for all the possible vnet_l2_compute_flow_hash callers by making
mpls playload hash in additon to ip4/ip6. Visible performance impact is
not expected as it's only one check for mpls ethertype for common cases.

Type: fix
Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru>
Change-Id: I69153d42fb3d7c094a670c674fac8d14039c626a
This commit is contained in:
Vladislav Grishenko
2024-01-24 20:33:12 +05:00
committed by Dave Wallace
parent 704d5a53e0
commit f2fc97aafc
3 changed files with 85 additions and 4 deletions

View File

@ -5,6 +5,8 @@ import abc
from scapy.layers.l2 import Ether
from scapy.packet import Raw
from scapy.layers.inet import IP, UDP
from scapy.layers.inet6 import IPv6
from scapy.contrib.mpls import MPLS
class BridgeDomain(metaclass=abc.ABCMeta):
@ -61,8 +63,16 @@ class BridgeDomain(metaclass=abc.ABCMeta):
"""
self.assertEqual(pkt1[Ether].src, pkt2[Ether].src)
self.assertEqual(pkt1[Ether].dst, pkt2[Ether].dst)
self.assertEqual(pkt1[IP].src, pkt2[IP].src)
self.assertEqual(pkt1[IP].dst, pkt2[IP].dst)
if MPLS in pkt1 or MPLS in pkt2:
self.assertEqual(pkt1[MPLS].label, pkt2[MPLS].label)
self.assertEqual(pkt1[MPLS].cos, pkt2[MPLS].cos)
self.assertEqual(pkt1[MPLS].ttl, pkt2[MPLS].ttl)
if IP in pkt1 or IP in pkt2:
self.assertEqual(pkt1[IP].src, pkt2[IP].src)
self.assertEqual(pkt1[IP].dst, pkt2[IP].dst)
elif IPv6 in pkt1 or IPv6 in pkt2:
self.assertEqual(pkt1[IPv6].src, pkt2[IPv6].src)
self.assertEqual(pkt1[IPv6].dst, pkt2[IPv6].dst)
self.assertEqual(pkt1[UDP].sport, pkt2[UDP].sport)
self.assertEqual(pkt1[UDP].dport, pkt2[UDP].dport)
self.assertEqual(pkt1[Raw], pkt2[Raw])