get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2095639/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2095639,
    "url": "http://patchwork.ozlabs.org/api/patches/2095639/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20250609173539.1636916-12-mmichels@redhat.com/",
    "project": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/projects/68/?format=api",
        "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-12-mmichels@redhat.com>",
    "list_archive_url": null,
    "date": "2025-06-09T17:35:30",
    "name": "[ovs-dev,11/14] lflows: Move dp_groups from lflow_data to lflow_sync_data.",
    "commit_ref": null,
    "pull_url": null,
    "state": "deferred",
    "archived": false,
    "hash": "5df3da4fb147b50db4c9344160ec6658d57671c4",
    "submitter": {
        "id": 71978,
        "url": "http://patchwork.ozlabs.org/api/people/71978/?format=api",
        "name": "Mark Michelson",
        "email": "mmichels@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20250609173539.1636916-12-mmichels@redhat.com/mbox/",
    "series": [
        {
            "id": 460139,
            "url": "http://patchwork.ozlabs.org/api/series/460139/?format=api",
            "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/2095639/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/2095639/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=cXTfOn1D;\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=cXTfOn1D",
            "smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com"
        ],
        "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 4bGJxf0bZCz1yDx\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Jun 2025 03:36:22 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 4C8CC41CBC;\n\tMon,  9 Jun 2025 17:36:34 +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 dXUvRjjGt4FE; Mon,  9 Jun 2025 17:36:30 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp4.osuosl.org (Postfix) with ESMTPS id E42F341D87;\n\tMon,  9 Jun 2025 17:36:18 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id C39F3C0AC5;\n\tMon,  9 Jun 2025 17:36:18 +0000 (UTC)",
            "from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 012C3C0AC4\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:36:17 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id E94E041D64\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:36:01 +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 5HcWlfyrwcks for <dev@openvswitch.org>;\n Mon,  9 Jun 2025 17:35:57 +0000 (UTC)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp4.osuosl.org (Postfix) with ESMTPS id B3BC6417D4\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:53 +0000 (UTC)",
            "from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-600-rlFvN2izP1SbNjVvRaA5hQ-1; Mon,\n 09 Jun 2025 13:35:50 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 96F1C19560A5\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:49 +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 2532C1800285\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:49 +0000 (UTC)"
        ],
        "X-Virus-Scanned": [
            "amavis at osuosl.org",
            "amavis at osuosl.org"
        ],
        "X-Comment": "SPF check N/A for local connections - client-ip=140.211.9.56;\n helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ",
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 smtp4.osuosl.org E42F341D87",
            "OpenDKIM Filter v2.11.0 smtp4.osuosl.org B3BC6417D4"
        ],
        "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 smtp4.osuosl.org B3BC6417D4",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1749490552;\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=HWxzghEcLuGewRuOSat77fpTfhQob+3pnvqshY8YvIM=;\n b=cXTfOn1DtlcUFoqK8gDZPW9m55jCnHGp16W1Aec+JefT3rj0xXu4L6uPHOxJPqEM8SwSlS\n XOdu1IplUU+tog0pz0UTe0Y/lZZx8ql0fD6iOX+5ajJfEyUyOd7OQkJ10nPj22wCpbEZq1\n LTYqftRWOVJudpxbWuJSCLk/aoIuznc=",
        "X-MC-Unique": "rlFvN2izP1SbNjVvRaA5hQ-1",
        "X-Mimecast-MFC-AGG-ID": "rlFvN2izP1SbNjVvRaA5hQ_1749490549",
        "To": "dev@openvswitch.org",
        "Date": "Mon,  9 Jun 2025 13:35:30 -0400",
        "Message-ID": "<20250609173539.1636916-12-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": "ojofsAB4_fbNVu9G0JNrHvNoPzojVZAqOt0qGlWjZqA_1749490549",
        "X-Mimecast-Originator": "redhat.com",
        "Subject": "[ovs-dev] [PATCH ovn 11/14] lflows: Move dp_groups from lflow_data\n to lflow_sync_data.",
        "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": "dp_groups are handled entirely within the en-lflow-sync node, so there's\nno need for the en-lflow node to own them. This commit moves the\ndp_groups to the en-lflow-sync node, using an array to group the\ndp_groups by datpath type. We also store the relevant ovn_datapaths in\nthe same array index. This allows for us to more easily pass the correct\ndp_groups and datapaths around.\n\nSigned-off-by: Mark Michelson <mmichels@redhat.com>\n---\n northd/en-lflow.c  | 47 +++++++++++++++++-------------\n northd/en-lflow.h  |  6 ++++\n northd/lflow-mgr.c | 71 +++++++++++++---------------------------------\n northd/lflow-mgr.h |  7 ++---\n 4 files changed, 55 insertions(+), 76 deletions(-)",
    "diff": "diff --git a/northd/en-lflow.c b/northd/en-lflow.c\nindex 2e8f1ef60..07d7c7882 100644\n--- a/northd/en-lflow.c\n+++ b/northd/en-lflow.c\n@@ -373,7 +373,9 @@ sb_lflows_sync_for_datapaths(\n static void\n lflow_sync_data_init(struct lflow_sync_data *lflow_sync,\n                      const struct sbrec_logical_flow_table *sb_lflow_table,\n-                     const struct lflow_data *lflow_data)\n+                     const struct lflow_data *lflow_data,\n+                     const struct ovn_datapaths *ls_datapaths,\n+                     const struct ovn_datapaths *lr_datapaths)\n {\n     hmap_init(&lflow_sync->sb_lflows.valid);\n     hmap_init(&lflow_sync->sb_lflows.to_delete);\n@@ -382,6 +384,11 @@ lflow_sync_data_init(struct lflow_sync_data *lflow_sync,\n         lflow_table_clear_dp_groups(lflow_data->lflow_table);\n     }\n \n+    ovn_dp_groups_init(&lflow_sync->all_dp_info[DP_SWITCH].dp_groups);\n+    lflow_sync->all_dp_info[DP_SWITCH].datapaths = ls_datapaths;\n+    ovn_dp_groups_init(&lflow_sync->all_dp_info[DP_ROUTER].dp_groups);\n+    lflow_sync->all_dp_info[DP_ROUTER].datapaths = lr_datapaths;\n+\n     if (!sb_lflow_table) {\n         return;\n     }\n@@ -411,6 +418,9 @@ lflow_sync_data_destroy(struct lflow_sync_data *lflow_sync)\n     }\n     hmap_destroy(&lflow_sync->sb_lflows.valid);\n     hmap_destroy(&lflow_sync->sb_lflows.to_delete);\n+    for (enum ovn_datapath_type i = 0; i < DP_MAX; i++) {\n+        ovn_dp_groups_destroy(&lflow_sync->all_dp_info[i].dp_groups);\n+    }\n }\n \n enum engine_node_state\n@@ -422,12 +432,7 @@ en_lflow_sync_run(struct engine_node *node, void *data)\n         engine_get_input_data(\"datapath_synced_logical_switch\", node);\n     const struct ovn_synced_logical_router_map *synced_lrs =\n         engine_get_input_data(\"datapath_synced_logical_router\", node);\n-    /* XXX The lflow table is currently not treated as const because it\n-     * contains mutable logical datapath groups. A future commit will\n-     * separate the dp groups from the lflow_table so that this can be\n-     * treated as const.\n-     */\n-    struct lflow_data *lflow_data =\n+    const struct lflow_data *lflow_data =\n         engine_get_input_data(\"lflow\", node);\n     const struct northd_data *northd =\n         engine_get_input_data(\"northd\", node);\n@@ -439,15 +444,15 @@ en_lflow_sync_run(struct engine_node *node, void *data)\n \n     struct lflow_sync_data *lflow_sync = data;\n     lflow_sync_data_destroy(lflow_sync);\n-    lflow_sync_data_init(lflow_sync, sb_lflow_table, lflow_data);\n+    lflow_sync_data_init(lflow_sync, sb_lflow_table, lflow_data,\n+                         &northd->ls_datapaths, &northd->lr_datapaths);\n \n     stopwatch_start(LFLOWS_TO_SB_STOPWATCH_NAME, time_msec());\n \n     sb_lflows_sync_for_datapaths(synced_lses, synced_lrs,\n                                  &lflow_sync->sb_lflows);\n     lflow_table_sync_to_sb(lflow_data->lflow_table, eng_ctx->ovnsb_idl_txn,\n-                           &northd->ls_datapaths,\n-                           &northd->lr_datapaths,\n+                           lflow_sync->all_dp_info,\n                            global_config->ovn_internal_version_changed,\n                            &lflow_sync->sb_lflows, sb_dp_group_table);\n     lflow_table_sync_finish(&lflow_sync->sb_lflows);\n@@ -467,7 +472,7 @@ en_lflow_sync_init(struct engine_node *node OVS_UNUSED,\n                         struct engine_arg *arg OVS_UNUSED)\n {\n     struct lflow_sync_data *lflow_sync = xzalloc(sizeof *lflow_sync);\n-    lflow_sync_data_init(lflow_sync, NULL, NULL);\n+    lflow_sync_data_init(lflow_sync, NULL, NULL, NULL, NULL);\n     return lflow_sync;\n }\n \n@@ -479,19 +484,20 @@ en_lflow_sync_cleanup(void *data)\n }\n \n enum engine_input_handler_result\n-lflow_sync_lflow_handler(struct engine_node *node, void *data OVS_UNUSED)\n+lflow_sync_lflow_handler(struct engine_node *node, void *data)\n {\n     const struct sbrec_logical_flow_table *sb_lflow_table =\n         EN_OVSDB_GET(engine_get_input(\"SB_logical_flow\", node));\n-    /* XXX The lflow table is currently not treated as const because it\n-     * contains mutable logical datapath groups. A future commit will\n-     * separate the dp groups from the lflow_table so that this can be\n-     * treated as const.\n+    /* The \"const\" designation is a bit of a misnomer. None of the fields\n+     * of lflow_data are changed by this node. However, the following\n+     * changes can be made to its components:\n+     *  * The lflow_data->lflow_table can have lflows removed as a result\n+     *    of syncing.\n+     *  * The lflows within the lflow_table can have their \"dpg\" field\n+     *    updated as a result of datapath group changes from syncing.\n      */\n-    struct lflow_data *lflow_data =\n+    const struct lflow_data *lflow_data =\n         engine_get_input_data(\"lflow\", node);\n-    const struct northd_data *northd =\n-        engine_get_input_data(\"northd\", node);\n     struct ed_type_global_config *global_config =\n         engine_get_input_data(\"global_config\", node);\n     const struct sbrec_logical_dp_group_table *sb_dp_group_table =\n@@ -506,6 +512,7 @@ lflow_sync_lflow_handler(struct engine_node *node, void *data OVS_UNUSED)\n         return EN_UNHANDLED;\n     }\n \n+    struct lflow_sync_data *lflow_sync = data;\n     struct lflow_ref *lflow_ref;\n     bool handled = true;\n     VECTOR_FOR_EACH (&lflow_data->lflow_refs, lflow_ref) {\n@@ -519,7 +526,7 @@ lflow_sync_lflow_handler(struct engine_node *node, void *data OVS_UNUSED)\n          */\n         handled &= lflow_ref_sync_lflows(\n             lflow_ref, lflow_data->lflow_table, eng_ctx->ovnsb_idl_txn,\n-            &northd->ls_datapaths, &northd->lr_datapaths,\n+            lflow_sync->all_dp_info,\n             global_config->ovn_internal_version_changed, sb_lflow_table,\n             sb_dp_group_table);\n     }\ndiff --git a/northd/en-lflow.h b/northd/en-lflow.h\nindex a057f9193..d99d7f9cf 100644\n--- a/northd/en-lflow.h\n+++ b/northd/en-lflow.h\n@@ -47,8 +47,14 @@ enum engine_input_handler_result\n lflow_group_ecmp_route_change_handler(struct engine_node *node, void *data);\n \n struct sb_lflows;\n+struct dp_info {\n+    struct hmap dp_groups;\n+    const struct ovn_datapaths *datapaths;\n+};\n+\n struct lflow_sync_data {\n     struct sb_lflows sb_lflows;\n+    struct dp_info all_dp_info[DP_MAX];\n };\n \n enum engine_node_state en_lflow_sync_run(struct engine_node *, void *data);\ndiff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c\nindex cb5511235..334353902 100644\n--- a/northd/lflow-mgr.c\n+++ b/northd/lflow-mgr.c\n@@ -27,6 +27,7 @@\n #include \"lib/ovn-parallel-hmap.h\"\n #include \"lib/ovn-util.h\"\n #include \"en-datapath-logical-switch.h\"\n+#include \"en-lflow.h\"\n \n VLOG_DEFINE_THIS_MODULE(lflow_mgr);\n \n@@ -83,8 +84,7 @@ static void ovn_dp_group_add_with_reference(struct ovn_lflow *,\n static bool lflow_ref_sync_lflows__(\n     struct lflow_ref  *, struct lflow_table *,\n     struct ovsdb_idl_txn *ovnsb_txn,\n-    const struct ovn_datapaths *ls_datapaths,\n-    const struct ovn_datapaths *lr_datapaths,\n+    struct dp_info *all_dp_info,\n     bool ovn_internal_version_changed,\n     const struct sbrec_logical_flow_table *,\n     const struct sbrec_logical_dp_group_table *);\n@@ -187,8 +187,6 @@ struct ovn_lflow {\n /* Logical flow table. */\n struct lflow_table {\n     struct hmap entries; /* hmap of lflows. */\n-    struct hmap ls_dp_groups; /* hmap of logical switch dp groups. */\n-    struct hmap lr_dp_groups; /* hmap of logical router dp groups. */\n     ssize_t max_seen_lflow_size;\n };\n \n@@ -206,8 +204,6 @@ lflow_table_init(struct lflow_table *lflow_table)\n {\n     fast_hmap_size_for(&lflow_table->entries,\n                        lflow_table->max_seen_lflow_size);\n-    ovn_dp_groups_init(&lflow_table->ls_dp_groups);\n-    ovn_dp_groups_init(&lflow_table->lr_dp_groups);\n }\n \n void\n@@ -217,9 +213,6 @@ lflow_table_clear(struct lflow_table *lflow_table)\n     HMAP_FOR_EACH_SAFE (lflow, hmap_node, &lflow_table->entries) {\n         ovn_lflow_destroy(lflow_table, lflow);\n     }\n-\n-    ovn_dp_groups_clear(&lflow_table->ls_dp_groups);\n-    ovn_dp_groups_clear(&lflow_table->lr_dp_groups);\n }\n \n void\n@@ -227,8 +220,6 @@ lflow_table_destroy(struct lflow_table *lflow_table)\n {\n     lflow_table_clear(lflow_table);\n     hmap_destroy(&lflow_table->entries);\n-    ovn_dp_groups_destroy(&lflow_table->ls_dp_groups);\n-    ovn_dp_groups_destroy(&lflow_table->lr_dp_groups);\n     free(lflow_table);\n }\n \n@@ -272,8 +263,7 @@ datapath_type_from_sb_lflow(const struct sbrec_logical_flow *sb_lflow)\n void\n lflow_table_sync_to_sb(struct lflow_table *lflow_table,\n                        struct ovsdb_idl_txn *ovnsb_txn,\n-                       const struct ovn_datapaths *ls_datapaths,\n-                       const struct ovn_datapaths *lr_datapaths,\n+                       struct dp_info *all_dp_info,\n                        bool ovn_internal_version_changed,\n                        struct sb_lflows *sb_lflows,\n                        const struct sbrec_logical_dp_group_table *dpgrp_table)\n@@ -285,9 +275,6 @@ lflow_table_sync_to_sb(struct lflow_table *lflow_table,\n     fast_hmap_size_for(&lflows_temp,\n                        lflow_table->max_seen_lflow_size);\n \n-    ovn_dp_groups_clear(&lflow_table->ls_dp_groups);\n-    ovn_dp_groups_clear(&lflow_table->lr_dp_groups);\n-\n     /* Push changes to the Logical_Flow table to database. */\n     struct sb_lflow *sb_lflow;\n     HMAP_FOR_EACH (sb_lflow, hmap_node, &sb_lflows->valid) {\n@@ -311,15 +298,9 @@ lflow_table_sync_to_sb(struct lflow_table *lflow_table,\n             sbflow->priority, sbflow->match, sbflow->actions,\n             sbflow->controller_meter, sbflow->hash);\n         if (lflow) {\n-            const struct ovn_datapaths *datapaths;\n-            struct hmap *dp_groups;\n-            if (dp_type == DP_SWITCH) {\n-                datapaths = ls_datapaths;\n-                dp_groups = &lflow_table->ls_dp_groups;\n-            } else {\n-                datapaths = lr_datapaths;\n-                dp_groups = &lflow_table->lr_dp_groups;\n-            }\n+            const struct ovn_datapaths *datapaths =\n+                all_dp_info[dp_type].datapaths;\n+            struct hmap *dp_groups = &all_dp_info[dp_type].dp_groups;\n             sync_lflow_to_sb(lflow, ovnsb_txn, dp_groups, datapaths,\n                              ovn_internal_version_changed,\n                              sbflow, dpgrp_table);\n@@ -332,15 +313,10 @@ lflow_table_sync_to_sb(struct lflow_table *lflow_table,\n     }\n \n     HMAP_FOR_EACH_SAFE (lflow, hmap_node, lflows) {\n-        const struct ovn_datapaths *datapaths;\n-        struct hmap *dp_groups;\n-        if (ovn_stage_to_datapath_type(lflow->stage) == DP_SWITCH) {\n-            datapaths = ls_datapaths;\n-            dp_groups = &lflow_table->ls_dp_groups;\n-        } else {\n-            datapaths = lr_datapaths;\n-            dp_groups = &lflow_table->lr_dp_groups;\n-        }\n+        enum ovn_datapath_type dp_type =\n+            ovn_stage_to_datapath_type(lflow->stage);\n+        struct hmap *dp_groups = &all_dp_info[dp_type].dp_groups;\n+        const struct ovn_datapaths *datapaths = all_dp_info[dp_type].datapaths;\n         sync_lflow_to_sb(lflow, ovnsb_txn, dp_groups, datapaths,\n                          ovn_internal_version_changed, NULL, dpgrp_table);\n \n@@ -627,16 +603,14 @@ bool\n lflow_ref_sync_lflows(struct lflow_ref *lflow_ref,\n                       struct lflow_table *lflow_table,\n                       struct ovsdb_idl_txn *ovnsb_txn,\n-                      const struct ovn_datapaths *ls_datapaths,\n-                      const struct ovn_datapaths *lr_datapaths,\n+                      struct dp_info *all_dp_info,\n                       bool ovn_internal_version_changed,\n                       const struct sbrec_logical_flow_table *sbflow_table,\n                       const struct sbrec_logical_dp_group_table *dpgrp_table)\n {\n     return lflow_ref_sync_lflows__(lflow_ref, lflow_table, ovnsb_txn,\n-                                   ls_datapaths, lr_datapaths,\n-                                   ovn_internal_version_changed, sbflow_table,\n-                                   dpgrp_table);\n+                                   all_dp_info, ovn_internal_version_changed,\n+                                   sbflow_table, dpgrp_table);\n }\n \n /* Adds a logical flow to the logical flow table for the match 'match'\n@@ -1258,8 +1232,7 @@ static bool\n lflow_ref_sync_lflows__(struct lflow_ref  *lflow_ref,\n                         struct lflow_table *lflow_table,\n                         struct ovsdb_idl_txn *ovnsb_txn,\n-                        const struct ovn_datapaths *ls_datapaths,\n-                        const struct ovn_datapaths *lr_datapaths,\n+                        struct dp_info *all_dp_info,\n                         bool ovn_internal_version_changed,\n                         const struct sbrec_logical_flow_table *sbflow_table,\n                         const struct sbrec_logical_dp_group_table *dpgrp_table)\n@@ -1273,18 +1246,12 @@ lflow_ref_sync_lflows__(struct lflow_ref  *lflow_ref,\n             sbrec_logical_flow_table_get_for_uuid(sbflow_table,\n                                                   &lflow->sb_uuid);\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+        enum ovn_datapath_type dp_type =\n+            ovn_stage_to_datapath_type(lflow->stage);\n+        struct hmap *dp_groups = &all_dp_info[dp_type].dp_groups;\n+        const struct ovn_datapaths *datapaths = all_dp_info[dp_type].datapaths;\n+        n_datapaths = ods_size(datapaths);\n \n         size_t n_ods = bitmap_count1(lflow->dpg_bitmap, n_datapaths);\n \ndiff --git a/northd/lflow-mgr.h b/northd/lflow-mgr.h\nindex f3f16f8f2..ada1756f3 100644\n--- a/northd/lflow-mgr.h\n+++ b/northd/lflow-mgr.h\n@@ -42,10 +42,10 @@ void lflow_table_set_size(struct lflow_table *, size_t);\n  * lflow_tables.\n  */\n struct sb_lflows;\n+struct dp_info;\n void lflow_table_sync_to_sb(struct lflow_table *,\n                             struct ovsdb_idl_txn *ovnsb_txn,\n-                            const struct ovn_datapaths *ls_datapaths,\n-                            const struct ovn_datapaths *lr_datapaths,\n+                            struct dp_info *all_dp_info,\n                             bool ovn_internal_version_changed,\n                             struct sb_lflows *sb_lflows,\n                             const struct sbrec_logical_dp_group_table *);\n@@ -66,8 +66,7 @@ void lflow_ref_unlink_lflows(struct lflow_ref *);\n bool lflow_ref_sync_lflows(struct lflow_ref *,\n                            struct lflow_table *lflow_table,\n                            struct ovsdb_idl_txn *ovnsb_txn,\n-                           const struct ovn_datapaths *ls_datapaths,\n-                           const struct ovn_datapaths *lr_datapaths,\n+                           struct dp_info *all_dp_info,\n                            bool ovn_internal_version_changed,\n                            const struct sbrec_logical_flow_table *,\n                            const struct sbrec_logical_dp_group_table *);\n",
    "prefixes": [
        "ovs-dev",
        "11/14"
    ]
}