Before the patch, LOG_CT_ZONE might have been set twice, when virtual or
localports are present.

For virtual ports, for which a ct_zone is allocated when recomputing but not
in incremental processing, this also resulted in differences between flows
produced by recompute and incremental processing.

A future patch will be checking the differences between recompute and
incremental processing produced flows in all tests.

Signed-off-by: Xavier Simonart <xsimo...@redhat.com>

---
v2: - Rebased on origin/main.
    - Updated commit message (as per Numan's feedback).
    - Avoid code duplication (as per Dumitru's feedback).

Signed-off-by: Xavier Simonart <xsimo...@redhat.com>
---
 controller/physical.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/controller/physical.c b/controller/physical.c
index 69bf05347..48bf0717c 100644
--- a/controller/physical.c
+++ b/controller/physical.c
@@ -2178,6 +2178,17 @@ local_output_pb(int64_t tunnel_key, struct ofpbuf 
*ofpacts)
     put_resubmit(OFTABLE_CHECK_LOOPBACK, ofpacts);
 }
 
+static void
+local_set_ct_zone_and_output_pb(int tunnel_key, int64_t zone_id,
+                                struct ofpbuf *ofpacts)
+{
+    if (zone_id) {
+        put_load(zone_id, MFF_LOG_CT_ZONE, 0, 16, ofpacts);
+    }
+    put_load(tunnel_key, MFF_LOG_OUTPORT, 0, 32, ofpacts);
+    put_resubmit(OFTABLE_CHECK_LOOPBACK, ofpacts);
+}
+
 #define MC_OFPACTS_MAX_MSG_SIZE     8192
 #define MC_BUF_START_ID             0x9000
 
@@ -2279,16 +2290,14 @@ consider_mc_group(const struct physical_ctx *ctx,
         }
 
         int zone_id = ct_zone_find_zone(ctx->ct_zones, port->logical_port);
-        if (zone_id) {
-            put_load(zone_id, MFF_LOG_CT_ZONE, 0, 16, &ofpacts);
-        }
 
         const char *lport_name = (port->parent_port && *port->parent_port) ?
                                   port->parent_port : port->logical_port;
 
         if (type == LP_PATCH) {
             if (ldp->is_transit_switch) {
-                local_output_pb(port->tunnel_key, &ofpacts);
+                local_set_ct_zone_and_output_pb(port->tunnel_key, zone_id,
+                                                &ofpacts);
             } else {
                 remote_ramp_ports = true;
                 remote_ports = true;
@@ -2304,9 +2313,11 @@ consider_mc_group(const struct physical_ctx *ctx,
                    && (local_binding_get_primary_pb(ctx->local_bindings,
                                                     lport_name)
                        || type == LP_L3GATEWAY)) {
-            local_output_pb(port->tunnel_key, &ofpacts);
+            local_set_ct_zone_and_output_pb(port->tunnel_key, zone_id,
+                                            &ofpacts);
         } else if (simap_contains(ctx->patch_ofports, port->logical_port)) {
-            local_output_pb(port->tunnel_key, &ofpacts);
+            local_set_ct_zone_and_output_pb(port->tunnel_key, zone_id,
+                                            &ofpacts);
         } else if (type == LP_CHASSISREDIRECT
                    && port->chassis == ctx->chassis) {
             const char *distributed_port = smap_get(&port->options,
@@ -2317,7 +2328,8 @@ consider_mc_group(const struct physical_ctx *ctx,
                                            distributed_port);
                 if (distributed_binding
                     && port->datapath == distributed_binding->datapath) {
-                    local_output_pb(distributed_binding->tunnel_key, &ofpacts);
+                    local_set_ct_zone_and_output_pb(
+                        distributed_binding->tunnel_key, zone_id, &ofpacts);
                 }
             }
         } else if (!get_localnet_port(ctx->local_datapaths,
-- 
2.47.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to