[ovs-dev] [PATCH] flow: Wildcard UDP ports when using SYMMETRIC_L4 hash for select groups.

Vishal Deep Ajmera vishal.deep.ajmera at ericsson.com
Wed Jul 10 13:32:30 UTC 2019


UDP source and destination ports are not used to derive the hash index
used for selecting the bucket in case of SYMMETRIC_L4 hash based select
groups. However, they are un-wildcarded in the megaflow entry match criteria.
This results in distinct megaflow entry being created for each pair of UDP
source and destination ports unnecessarily and causes significant performance
deterioration when the megaflow cache limit is reached.

This patch wildcards UDP ports when using select group with SYMMETRIC_L4
hash function.

Signed-off-by: Vishal Deep Ajmera <vishal.deep.ajmera at ericsson.com>
CC: Jan Scheurich <jan.scheurich at ericsson.com>
---
 lib/flow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/flow.c b/lib/flow.c
index de93704..95da7d4 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -2478,7 +2478,12 @@ flow_mask_hash_fields(const struct flow *flow, struct flow_wildcards *wc,
         }
         if (is_ip_any(flow)) {
             memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
-            flow_unwildcard_tp_ports(flow, wc);
+            /* Unwildcard port only for non-UDP packets as udp port
+             * numbers are not used in hash calculations.
+             */
+            if (flow->nw_proto != IPPROTO_UDP) {
+                flow_unwildcard_tp_ports(flow, wc);
+            }
         }
         for (i = 0; i < FLOW_MAX_VLAN_HEADERS; i++) {
             wc->masks.vlans[i].tci |= htons(VLAN_VID_MASK | VLAN_CFI);
-- 
1.9.1



More information about the dev mailing list