bbaaef
From 67d348798cddef1d48f1249c9dfdc0b8d9693371 Mon Sep 17 00:00:00 2001
bbaaef
From: Dumitru Ceara <dceara@redhat.com>
bbaaef
Date: Thu, 1 Aug 2019 13:26:20 +0200
bbaaef
Subject: [PATCH 1/4] ovn-northd: Use HMAP_FOR_EACH when adding multicast
bbaaef
 lflows
bbaaef
bbaaef
There's no need to use HMAP_FOR_EACH_SAFE when we add the logical flows
bbaaef
that correspond to IGMP groups as we don't modify the hashmap in the
bbaaef
loop.
bbaaef
bbaaef
Also, we should reinitialize match and actions only if the flow will be
bbaaef
added.
bbaaef
bbaaef
Fixes: ddc64665b678 ("OVN: Add ovn-northd IGMP support")
bbaaef
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
bbaaef
Acked-by: Numan Siddique <nusiddiq@redhat.com>
bbaaef
Signed-off-by: Mark Michelson <mmichels@redhat.com>
bbaaef
---
bbaaef
 ovn/northd/ovn-northd.c | 10 +++++-----
bbaaef
 1 file changed, 5 insertions(+), 5 deletions(-)
bbaaef
bbaaef
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
bbaaef
index eea9144d0..d81cfd893 100644
bbaaef
--- a/ovn/northd/ovn-northd.c
bbaaef
+++ b/ovn/northd/ovn-northd.c
bbaaef
@@ -5429,12 +5429,9 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
bbaaef
 
bbaaef
     /* Ingress table 17: Add IP multicast flows learnt from IGMP
bbaaef
      * (priority 90). */
bbaaef
-    struct ovn_igmp_group *igmp_group, *next_igmp_group;
bbaaef
-
bbaaef
-    HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, igmp_groups) {
bbaaef
-        ds_clear(&match);
bbaaef
-        ds_clear(&actions);
bbaaef
+    struct ovn_igmp_group *igmp_group;
bbaaef
 
bbaaef
+    HMAP_FOR_EACH (igmp_group, hmap_node, igmp_groups) {
bbaaef
         if (!igmp_group->datapath) {
bbaaef
             continue;
bbaaef
         }
bbaaef
@@ -5446,6 +5443,9 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
bbaaef
         }
bbaaef
         mcast_info->active_flows++;
bbaaef
 
bbaaef
+        ds_clear(&match);
bbaaef
+        ds_clear(&actions);
bbaaef
+
bbaaef
         ds_put_format(&match, "eth.mcast && ip4 && ip4.dst == %s ",
bbaaef
                       igmp_group->mcgroup.name);
bbaaef
         ds_put_format(&actions, "outport = \"%s\"; output; ",
bbaaef
-- 
bbaaef
2.21.0
bbaaef