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

Message ID 1562765550-8149-1-git-send-email-vishal.deep.ajmera@ericsson.com
State New
Headers show
Series
  • [ovs-dev] flow: Wildcard UDP ports when using SYMMETRIC_L4 hash for select groups.
Related show

Commit Message

Vishal Deep Ajmera July 10, 2019, 1:32 p.m. UTC
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@ericsson.com>
CC: Jan Scheurich <jan.scheurich@ericsson.com>
---
 lib/flow.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Vishal Deep Ajmera July 15, 2019, 6:29 a.m. UTC | #1
> 
> This patch wildcards UDP ports when using select group with SYMMETRIC_L4
> hash function.
> 

Hi Ben,

Any thoughts on this patch ? This looks like a bug in OVS master.

Warm Regards,
Vishal Ajmera
Ben Pfaff July 16, 2019, 10:30 p.m. UTC | #2
On Wed, Jul 10, 2019 at 07:02:30PM +0530, Vishal Deep Ajmera wrote:
> 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@ericsson.com>
> CC: Jan Scheurich <jan.scheurich@ericsson.com>

Applied to master, thanks!
Vishal Deep Ajmera July 17, 2019, 12:17 p.m. UTC | #3
> 
> Applied to master, thanks!

Thanks Ben.

Warm Regards,
Vishal Ajmera

Patch
diff mbox series

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);