diff mbox series

[ovs-dev,RFC,v4,17/24] Pull Table 13 Arp/ND responder to a separate function

Message ID 20200902145950.25875-17-anton.ivanov@cambridgegreys.com
State Superseded
Headers show
Series [ovs-dev,RFC,v4,01/24] Move out Table 0 (ingress) operations to functions | expand

Commit Message

Anton Ivanov Sept. 2, 2020, 2:59 p.m. UTC
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

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

Patch

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 28b69ac54..a4549f5ef 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -6643,6 +6643,27 @@  build_lswitch_flows_admission_control(struct ovn_datapath *od, struct hmap *lflo
     }
 }
 
+static void
+build_lswitch_flows_arp_nd_responder(struct ovn_port *op, struct hmap *lflows)
+{
+    struct ds match = DS_EMPTY_INITIALIZER;
+
+    /* Ingress table 13: ARP/ND responder, skip requests coming from localnet
+     * and vtep ports. (priority 100); see ovn-northd.8.xml for the
+     * rationale. */
+    if (op->nbsp) {
+        if ((!strcmp(op->nbsp->type, "localnet")) ||
+            (!strcmp(op->nbsp->type, "vtep"))) {
+            ds_clear(&match);
+            ds_put_format(&match, "inport == %s", op->json_key);
+            ovn_lflow_add_with_hint(lflows, op->od, S_SWITCH_IN_ARP_ND_RSP,
+                                    100, ds_cstr(&match), "next;",
+                                    &op->nbsp->header_);
+        }
+    }
+    ds_destroy(&match);
+}
+
 static void
 build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
                     struct hmap *port_groups, struct hmap *lflows,
@@ -6680,22 +6701,8 @@  build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
         build_lswitch_input_port_sec_od(od, lflows);
     }
 
-    /* Ingress table 13: ARP/ND responder, skip requests coming from localnet
-     * and vtep ports. (priority 100); see ovn-northd.8.xml for the
-     * rationale. */
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbsp) {
-            continue;
-        }
-
-        if ((!strcmp(op->nbsp->type, "localnet")) ||
-            (!strcmp(op->nbsp->type, "vtep"))) {
-            ds_clear(&match);
-            ds_put_format(&match, "inport == %s", op->json_key);
-            ovn_lflow_add_with_hint(lflows, op->od, S_SWITCH_IN_ARP_ND_RSP,
-                                    100, ds_cstr(&match), "next;",
-                                    &op->nbsp->header_);
-        }
+        build_lswitch_flows_arp_nd_responder(op, lflows);
     }
 
     /* Ingress table 13: ARP/ND responder, reply for known IPs.