diff mbox series

[ovs-dev,ovn,RFC,v3,14/29] Pull forwarding groups and admission control to separate functions

Message ID 20200716131927.3943-15-anton.ivanov@cambridgegreys.com
State RFC
Headers show
Series [ovs-dev,ovn,RFC,v3,01/29] Move out Table 0 operations to functions | expand

Commit Message

Anton Ivanov July 16, 2020, 1:19 p.m. UTC
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
---
 northd/ovn-northd.c | 54 +++++++++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 22 deletions(-)
diff mbox series

Patch

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 750a2a2b7..d00fef94d 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -6470,6 +6470,36 @@  build_lswitch_flows_step_0_od(
     }
 }
 
+static void
+build_lswitch_flows_step_10_od(struct ovn_datapath *od, struct hmap *lflows)
+{
+    /* Build logical flows for the forwarding groups */
+    if (!od->nbs || !od->nbs->n_forwarding_groups) {
+        return;
+    }
+    build_fwd_group_lflows(od, lflows);
+}
+
+static void
+build_lswitch_flows_step_20_od(struct ovn_datapath *od, struct hmap *lflows)
+{
+
+    /* Logical switch ingress table 0: Admission control framework (priority
+     * 100). */
+    if (od->nbs) {
+        /* Logical VLANs not supported. */
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_L2, 100, "vlan.present",
+                      "drop;");
+
+        /* Broadcast/multicast source address is invalid. */
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_L2, 100, "eth.src[40]",
+                      "drop;");
+
+        /* Port security flows have priority 50 (see below) and will continue
+         * to the next table if packet source is acceptable. */
+    }
+}
+
 static void
 build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
                     struct hmap *port_groups, struct hmap *lflows,
@@ -6489,32 +6519,12 @@  build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
                 od, lflows, meter_groups, lbs, port_groups);
     }
 
-    /* Build logical flows for the forwarding groups */
     HMAP_FOR_EACH (od, key_node, datapaths) {
-        if (!od->nbs || !od->nbs->n_forwarding_groups) {
-            continue;
-        }
-
-        build_fwd_group_lflows(od, lflows);
+        build_lswitch_flows_step_10_od(od, lflows);
     }
 
-    /* Logical switch ingress table 0: Admission control framework (priority
-     * 100). */
     HMAP_FOR_EACH (od, key_node, datapaths) {
-        if (!od->nbs) {
-            continue;
-        }
-
-        /* Logical VLANs not supported. */
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_L2, 100, "vlan.present",
-                      "drop;");
-
-        /* Broadcast/multicast source address is invalid. */
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_PORT_SEC_L2, 100, "eth.src[40]",
-                      "drop;");
-
-        /* Port security flows have priority 50 (see below) and will continue
-         * to the next table if packet source is acceptable. */
+        build_lswitch_flows_step_20_od(od, lflows);
     }
 
     build_lswitch_input_port_sec(ports, datapaths, lflows);