diff mbox series

[ovs-dev] physical.c: Move localport remote output flow definition

Message ID 20220510054553.72216-1-amusil@redhat.com
State Handled Elsewhere
Headers show
Series [ovs-dev] physical.c: Move localport remote output flow definition | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Ales Musil May 10, 2022, 5:45 a.m. UTC
The localport should always delegate traffic locally,
move the definition into consider_port_binding as
the physical_run is not evaluated during I-P.

Fixes: 3ae8470 ("I-P: Handle runtime data changes for pflow_output engine.")
Signed-off-by: Ales Musil <amusil@redhat.com>
---
 controller/physical.c | 44 ++++++++++++++++++-------------------------
 1 file changed, 18 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/controller/physical.c b/controller/physical.c
index 734444320..9b8688065 100644
--- a/controller/physical.c
+++ b/controller/physical.c
@@ -1280,6 +1280,24 @@  consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
             }
         }
 
+        /* Table 37, priority 150.
+         * =======================
+         *
+         * Handles packets received from ports of type "localport".  These
+         * ports are present on every hypervisor.  Traffic that originates at
+         * one should never go over a tunnel to a remote hypervisor,
+         * so resubmit them to table 38 for local delivery. */
+        if (!strcmp(binding->type, "localport")) {
+            ofpbuf_clear(ofpacts_p);
+            put_resubmit(OFTABLE_LOCAL_OUTPUT, ofpacts_p);
+            match_init_catchall(&match);
+            match_set_reg(&match, MFF_LOG_INPORT - MFF_REG0,
+                          binding->tunnel_key);
+            match_set_metadata(&match, htonll(binding->datapath->tunnel_key));
+            ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 150,
+                            binding->header_.uuid.parts[0], &match,
+                            ofpacts_p, &binding->header_.uuid);
+        }
     } else if (!tun && !is_ha_remote) {
         /* Remote port connected by localnet port */
         /* Table 38, priority 100.
@@ -1838,32 +1856,6 @@  physical_run(struct physical_ctx *p_ctx,
     ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 150, 0,
                     &match, &ofpacts, hc_uuid);
 
-    /* Table 37, priority 150.
-     * =======================
-     *
-     * Handles packets received from ports of type "localport".  These ports
-     * are present on every hypervisor.  Traffic that originates at one should
-     * never go over a tunnel to a remote hypervisor, so resubmit them to table
-     * 38 for local delivery. */
-    match_init_catchall(&match);
-    ofpbuf_clear(&ofpacts);
-    put_resubmit(OFTABLE_LOCAL_OUTPUT, &ofpacts);
-    const char *localport;
-    SSET_FOR_EACH (localport, p_ctx->local_lports) {
-        /* Iterate over all local logical ports and insert a drop
-         * rule with higher priority for every localport in this
-         * datapath. */
-        const struct sbrec_port_binding *pb = lport_lookup_by_name(
-            p_ctx->sbrec_port_binding_by_name, localport);
-        if (pb && !strcmp(pb->type, "localport")) {
-            match_set_reg(&match, MFF_LOG_INPORT - MFF_REG0, pb->tunnel_key);
-            match_set_metadata(&match, htonll(pb->datapath->tunnel_key));
-            ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 150,
-                            pb->header_.uuid.parts[0],
-                            &match, &ofpacts, hc_uuid);
-        }
-    }
-
     /* Table 37, Priority 0.
      * =======================
      *