{"id":2095632,"url":"http://patchwork.ozlabs.org/api/patches/2095632/?format=json","web_url":"http://patchwork.ozlabs.org/project/ovn/patch/20250609173539.1636916-5-mmichels@redhat.com/","project":{"id":68,"url":"http://patchwork.ozlabs.org/api/projects/68/?format=json","name":"Open Virtual Network development","link_name":"ovn","list_id":"ovs-dev.openvswitch.org","list_email":"ovs-dev@openvswitch.org","web_url":"http://openvswitch.org/","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20250609173539.1636916-5-mmichels@redhat.com>","list_archive_url":null,"date":"2025-06-09T17:35:23","name":"[ovs-dev,04/14] lflow-mgr: Pass one ovn_datapaths arg to sync_lflow_to_sb().","commit_ref":null,"pull_url":null,"state":"deferred","archived":false,"hash":"1a2487d92696449bf6e4663fdda6ec2fbaddca4f","submitter":{"id":71978,"url":"http://patchwork.ozlabs.org/api/people/71978/?format=json","name":"Mark Michelson","email":"mmichels@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ovn/patch/20250609173539.1636916-5-mmichels@redhat.com/mbox/","series":[{"id":460139,"url":"http://patchwork.ozlabs.org/api/series/460139/?format=json","web_url":"http://patchwork.ozlabs.org/project/ovn/list/?series=460139","date":"2025-06-09T17:35:19","name":"Logical Flow Sync Refactor.","version":1,"mbox":"http://patchwork.ozlabs.org/series/460139/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2095632/comments/","check":"success","checks":"http://patchwork.ozlabs.org/api/patches/2095632/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ovs-dev@lists.linuxfoundation.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=RbDPhdvn;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)","smtp4.osuosl.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=RbDPhdvn","smtp2.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","smtp2.osuosl.org;\n dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.a=rsa-sha256 header.s=mimecast20190719 header.b=RbDPhdvn"],"Received":["from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4bGJwx6gNfz1yDx\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Jun 2025 03:35:45 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 503F841CD0;\n\tMon,  9 Jun 2025 17:35:56 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id 5ne_bul3waN2; Mon,  9 Jun 2025 17:35:53 +0000 (UTC)","from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp4.osuosl.org (Postfix) with ESMTPS id 27A8741C46;\n\tMon,  9 Jun 2025 17:35:51 +0000 (UTC)","from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id C9CF1C0AC6;\n\tMon,  9 Jun 2025 17:35:50 +0000 (UTC)","from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 46C42C0AC4\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:48 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp2.osuosl.org (Postfix) with ESMTP id E9FB141D5F\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:47 +0000 (UTC)","from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id t7Cqka6F7dFp for <dev@openvswitch.org>;\n Mon,  9 Jun 2025 17:35:47 +0000 (UTC)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp2.osuosl.org (Postfix) with ESMTPS id 29E8041D71\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:46 +0000 (UTC)","from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-412-7xjY3DLfPQ-rh5f6mdqtaw-1; Mon,\n 09 Jun 2025 13:35:44 -0400","from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id E627418002A4\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:43 +0000 (UTC)","from localhost.localdomain.com (unknown [10.22.58.15])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 73A711800284\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:43 +0000 (UTC)"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections -\n client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp4.osuosl.org 27A8741C46","OpenDKIM Filter v2.11.0 smtp2.osuosl.org 29E8041D71"],"Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124;\n helo=us-smtp-delivery-124.mimecast.com; envelope-from=mmichels@redhat.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp2.osuosl.org 29E8041D71","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1749490546;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=c6FAaXmlVLbkJl3/kKPlC9pQPZMeYu6on/WK2+RNhAA=;\n b=RbDPhdvn5NBwir47/mNiuNPbUPe+Nb2T/KOGFH/elK5yHh1uN6jkgnJskQP0cCZDkM78oP\n HpKkKqVqm6pmbIQO99G95DFBBZBW5FH99becw0focjFoJl84A3iukcMDv4g26M3n1xjpJh\n olmFXu0DNCEalHa23YGuQmPbu/w+TG4=","X-MC-Unique":"7xjY3DLfPQ-rh5f6mdqtaw-1","X-Mimecast-MFC-AGG-ID":"7xjY3DLfPQ-rh5f6mdqtaw_1749490544","To":"dev@openvswitch.org","Date":"Mon,  9 Jun 2025 13:35:23 -0400","Message-ID":"<20250609173539.1636916-5-mmichels@redhat.com>","In-Reply-To":"<20250609173539.1636916-1-mmichels@redhat.com>","References":"<20250609173539.1636916-1-mmichels@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.111","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"7EdPNnFqYOm1MIPlgYRRUnZ9OV9iaUosNtNyuzbHUAQ_1749490544","X-Mimecast-Originator":"redhat.com","Subject":"[ovs-dev] [PATCH ovn 04/14] lflow-mgr: Pass one ovn_datapaths arg\n to sync_lflow_to_sb().","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","From":"Mark Michelson via dev <ovs-dev@openvswitch.org>","Reply-To":"Mark Michelson <mmichels@redhat.com>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ovs-dev-bounces@openvswitch.org","Sender":"\"dev\" <ovs-dev-bounces@openvswitch.org>"},"content":"Each caller of this function is aware of which set of datapaths is\nrelevant when syncing an lflow to the southbound database. This change\nmakes it so sync_lflow_to_sb() only deals with the relevant set of\ndatapaths for each lflow.\n\nSigned-off-by: Mark Michelson <mmichels@redhat.com>\n---\n northd/lflow-mgr.c | 50 +++++++++++++++++++++++++---------------------\n 1 file changed, 27 insertions(+), 23 deletions(-)","diff":"diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c\nindex 4456d9ea6..b41eb1d87 100644\n--- a/northd/lflow-mgr.c\n+++ b/northd/lflow-mgr.c\n@@ -90,8 +90,7 @@ static bool lflow_ref_sync_lflows__(\n static bool sync_lflow_to_sb(struct ovn_lflow *,\n                              struct ovsdb_idl_txn *ovnsb_txn,\n                              struct lflow_table *,\n-                             const struct ovn_datapaths *ls_datapaths,\n-                             const struct ovn_datapaths *lr_datapaths,\n+                             const struct ovn_datapaths *datapaths,\n                              bool ovn_internal_version_changed,\n                              const struct sbrec_logical_flow *sbflow,\n                              const struct sbrec_logical_dp_group_table *);\n@@ -302,15 +301,19 @@ lflow_table_sync_to_sb(struct lflow_table *lflow_table,\n         enum ovn_pipeline pipeline\n             = !strcmp(sbflow->pipeline, \"ingress\") ? P_IN : P_OUT;\n \n+        enum ovn_datapath_type dp_type\n+            = ovn_datapath_get_type(logical_datapath_od);\n+\n         lflow = ovn_lflow_find(\n             lflows,\n-            ovn_stage_build(ovn_datapath_get_type(logical_datapath_od),\n-                            pipeline, sbflow->table_id),\n+            ovn_stage_build(dp_type, pipeline, sbflow->table_id),\n             sbflow->priority, sbflow->match, sbflow->actions,\n             sbflow->controller_meter, sbflow->hash);\n         if (lflow) {\n-            sync_lflow_to_sb(lflow, ovnsb_txn, lflow_table, ls_datapaths,\n-                             lr_datapaths, ovn_internal_version_changed,\n+            const struct ovn_datapaths *datapaths;\n+            datapaths = dp_type == DP_SWITCH ? ls_datapaths : lr_datapaths;\n+            sync_lflow_to_sb(lflow, ovnsb_txn, lflow_table, datapaths,\n+                             ovn_internal_version_changed,\n                              sbflow, dpgrp_table);\n \n             hmap_remove(lflows, &lflow->hmap_node);\n@@ -322,9 +325,14 @@ lflow_table_sync_to_sb(struct lflow_table *lflow_table,\n     }\n \n     HMAP_FOR_EACH_SAFE (lflow, hmap_node, lflows) {\n-        sync_lflow_to_sb(lflow, ovnsb_txn, lflow_table, ls_datapaths,\n-                         lr_datapaths, ovn_internal_version_changed,\n-                         NULL, dpgrp_table);\n+        const struct ovn_datapaths *datapaths;\n+        if (ovn_stage_to_datapath_type(lflow->stage) == DP_SWITCH) {\n+            datapaths = ls_datapaths;\n+        } else {\n+            datapaths = lr_datapaths;\n+        }\n+        sync_lflow_to_sb(lflow, ovnsb_txn, lflow_table, datapaths,\n+                         ovn_internal_version_changed, NULL, dpgrp_table);\n \n         hmap_remove(lflows, &lflow->hmap_node);\n         hmap_insert(&lflows_temp, &lflow->hmap_node,\n@@ -1001,8 +1009,7 @@ static bool\n sync_lflow_to_sb(struct ovn_lflow *lflow,\n                  struct ovsdb_idl_txn *ovnsb_txn,\n                  struct lflow_table *lflow_table,\n-                 const struct ovn_datapaths *ls_datapaths,\n-                 const struct ovn_datapaths *lr_datapaths,\n+                 const struct ovn_datapaths *datapaths,\n                  bool ovn_internal_version_changed,\n                  const struct sbrec_logical_flow *sbflow,\n                  const struct sbrec_logical_dp_group_table *sb_dpgrp_table)\n@@ -1012,18 +1019,13 @@ sync_lflow_to_sb(struct ovn_lflow *lflow,\n     struct ovn_datapath **datapaths_array;\n     struct hmap *dp_groups;\n     size_t n_datapaths;\n-    bool is_switch;\n \n+    n_datapaths = ods_size(datapaths);\n+    datapaths_array = datapaths->array;\n     if (ovn_stage_to_datapath_type(lflow->stage) == DP_SWITCH) {\n-        n_datapaths = ods_size(ls_datapaths);\n-        datapaths_array = ls_datapaths->array;\n         dp_groups = &lflow_table->ls_dp_groups;\n-        is_switch = true;\n     } else {\n-        n_datapaths = ods_size(lr_datapaths);\n-        datapaths_array = lr_datapaths->array;\n         dp_groups = &lflow_table->lr_dp_groups;\n-        is_switch = false;\n     }\n \n     lflow->n_ods = bitmap_count1(lflow->dpg_bitmap, n_datapaths);\n@@ -1165,8 +1167,7 @@ sync_lflow_to_sb(struct ovn_lflow *lflow,\n             lflow->dpg = ovn_dp_group_create(\n                                 ovnsb_txn, dp_groups, sbrec_dp_group,\n                                 lflow->n_ods, lflow->dpg_bitmap,\n-                                n_datapaths,\n-                                is_switch ? ls_datapaths : lr_datapaths);\n+                                n_datapaths, datapaths);\n         }\n         sbrec_logical_flow_set_logical_dp_group(sbflow,\n                                                 lflow->dpg->dp_group);\n@@ -1286,20 +1287,23 @@ lflow_ref_sync_lflows__(struct lflow_ref  *lflow_ref,\n \n         struct hmap *dp_groups = NULL;\n         size_t n_datapaths;\n+        const struct ovn_datapaths *datapaths;\n         if (ovn_stage_to_datapath_type(lflow->stage) == DP_SWITCH) {\n             dp_groups = &lflow_table->ls_dp_groups;\n             n_datapaths = ods_size(ls_datapaths);\n+            datapaths = ls_datapaths;\n         } else {\n             dp_groups = &lflow_table->lr_dp_groups;\n             n_datapaths = ods_size(lr_datapaths);\n+            datapaths = lr_datapaths;\n         }\n \n         size_t n_ods = bitmap_count1(lflow->dpg_bitmap, n_datapaths);\n \n         if (n_ods) {\n-            if (!sync_lflow_to_sb(lflow, ovnsb_txn, lflow_table, ls_datapaths,\n-                                  lr_datapaths, ovn_internal_version_changed,\n-                                  sblflow, dpgrp_table)) {\n+            if (!sync_lflow_to_sb(lflow, ovnsb_txn, lflow_table, datapaths,\n+                                  ovn_internal_version_changed, sblflow,\n+                                  dpgrp_table)) {\n                 return false;\n             }\n         }\n","prefixes":["ovs-dev","04/14"]}