get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2095628,
    "url": "http://patchwork.ozlabs.org/api/patches/2095628/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20250609173539.1636916-2-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-2-mmichels@redhat.com>",
    "list_archive_url": null,
    "date": "2025-06-09T17:35:20",
    "name": "[ovs-dev,01/14] northd: Find ovn_datapath from a single hmap.",
    "commit_ref": null,
    "pull_url": null,
    "state": "deferred",
    "archived": false,
    "hash": "caf78744a5088823562d78bbba613870cb23b417",
    "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-2-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/2095628/comments/",
    "check": "fail",
    "checks": "http://patchwork.ozlabs.org/api/patches/2095628/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=DnDZZ0vf;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)",
            "smtp3.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=DnDZZ0vf",
            "smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com",
            "smtp1.osuosl.org; dkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=DnDZZ0vf"
        ],
        "Received": [
            "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\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 4bGJwp5vgfz1yZ1\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Jun 2025 03:35:38 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 9287D61454;\n\tMon,  9 Jun 2025 17:35:49 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id tCXrakNfjo4h; Mon,  9 Jun 2025 17:35:48 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp3.osuosl.org (Postfix) with ESMTPS id EDC326142E;\n\tMon,  9 Jun 2025 17:35:47 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 6EB74C0AC8;\n\tMon,  9 Jun 2025 17:35:47 +0000 (UTC)",
            "from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 1C770C0AC5\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:46 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id 0EE8C81FA3\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:46 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id 9DkT-MfZGBeg for <dev@openvswitch.org>;\n Mon,  9 Jun 2025 17:35:45 +0000 (UTC)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by smtp1.osuosl.org (Postfix) with ESMTPS id 3E7C381B72\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:44 +0000 (UTC)",
            "from mx-prod-mc-04.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-9-GmHSZCTXOJybOp23pbX4gw-1; Mon,\n 09 Jun 2025 13:35:42 -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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id A282919560AA\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:41 +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 323FC18003FC\n for <dev@openvswitch.org>; Mon,  9 Jun 2025 17:35:41 +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 smtp3.osuosl.org EDC326142E",
            "OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3E7C381B72"
        ],
        "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124;\n helo=us-smtp-delivery-124.mimecast.com; envelope-from=mmichels@redhat.com;\n receiver=<UNKNOWN>",
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp1.osuosl.org 3E7C381B72",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1749490543;\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=NoM/+p8blLCimB4u57EsKoFNrnqEBXHt9bPj/tT8N/Q=;\n b=DnDZZ0vfPnC/i2v+dBN3Sik8wcTXhTPCaM7pTQEGYb2nzIWvQYFoGPiEEse7sMp2fk5GVj\n Qs7yiBD3G0zWk6PEp4LVUPV13lp6k7TfyCKI3Oyh5DYSS+SUSHA11/aYffjshBOsci+3Tm\n y6CA7pCfVOMnpXrF7xk1OrRqip5Um4o=",
        "X-MC-Unique": "GmHSZCTXOJybOp23pbX4gw-1",
        "X-Mimecast-MFC-AGG-ID": "GmHSZCTXOJybOp23pbX4gw_1749490541",
        "To": "dev@openvswitch.org",
        "Date": "Mon,  9 Jun 2025 13:35:20 -0400",
        "Message-ID": "<20250609173539.1636916-2-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": "9bcVjJkp4nJAv8qriQrh8TAfq85DVD1Ez96VCTvgqDA_1749490541",
        "X-Mimecast-Originator": "redhat.com",
        "Subject": "[ovs-dev] [PATCH ovn 01/14] northd: Find ovn_datapath from a single\n hmap.",
        "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": "The ovn_datapath_from_sbrec() function requires two hmaps to be passed\nin. It needs the hmap of logical_switches and the hmap of\nlogical_routers.\n\nIn many cases, there is only a single northbound type that we care to\ntry to find. In this commit, we add a new version of\novn_datapath_from_sbrec() that takes a single hmap. This works because\nin the previous commit, we changed the southbound external_ids key to be\nconsistent across datapath types.\n\nSince there are several places in the code that passed NULL as one of\nthe hmap arguments to ovn_datapath_from_sbrec(), these have been\nconverted to use ovn_datapath_from_sbrec_() instead.\n\nSigned-off-by: Mark Michelson <mmichels@redhat.com>\n---\n northd/en-learned-route-sync.c |  8 +++----\n northd/en-multicast.c          |  3 +--\n northd/northd.c                | 41 +++++++++++++++++++++-------------\n northd/northd.h                |  3 +++\n 4 files changed, 33 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/northd/en-learned-route-sync.c b/northd/en-learned-route-sync.c\nindex f14f610ac..1e51dec40 100644\n--- a/northd/en-learned-route-sync.c\n+++ b/northd/en-learned-route-sync.c\n@@ -149,8 +149,8 @@ parse_route_from_sbrec_route(struct hmap *parsed_routes_out,\n                              const struct hmap *lr_datapaths,\n                              const struct sbrec_learned_route *route)\n {\n-    const struct ovn_datapath *od = ovn_datapath_from_sbrec(\n-        NULL, lr_datapaths, route->datapath);\n+    const struct ovn_datapath *od = ovn_datapath_from_sbrec_(\n+        lr_datapaths, route->datapath);\n \n     if (!od || ovn_datapath_is_stale(od)) {\n         return NULL;\n@@ -236,8 +236,8 @@ find_learned_route(const struct sbrec_learned_route *learned_route,\n                    const struct ovn_datapaths *lr_datapaths,\n                    const struct hmap *routes)\n {\n-    const struct ovn_datapath *od = ovn_datapath_from_sbrec(\n-        NULL, &lr_datapaths->datapaths, learned_route->datapath);\n+    const struct ovn_datapath *od = ovn_datapath_from_sbrec_(\n+        &lr_datapaths->datapaths, learned_route->datapath);\n     if (!od) {\n         return NULL;\n     }\ndiff --git a/northd/en-multicast.c b/northd/en-multicast.c\nindex d51db557e..504ff0f1b 100644\n--- a/northd/en-multicast.c\n+++ b/northd/en-multicast.c\n@@ -273,8 +273,7 @@ build_mcast_groups(struct multicast_igmp_data *data,\n         }\n \n         /* If the datapath value is stale, purge the group. */\n-        od = ovn_datapath_from_sbrec(ls_datapaths, NULL,\n-                                     sb_igmp->datapath);\n+        od = ovn_datapath_from_sbrec_(ls_datapaths, sb_igmp->datapath);\n \n         if (!od || ovn_datapath_is_stale(od)) {\n             sbrec_igmp_group_delete(sb_igmp);\ndiff --git a/northd/northd.c b/northd/northd.c\nindex 7f882df18..5efadd3f7 100644\n--- a/northd/northd.c\n+++ b/northd/northd.c\n@@ -577,12 +577,30 @@ ovn_datapath_find_by_key(struct hmap *datapaths, uint32_t dp_key)\n     return NULL;\n }\n \n+struct ovn_datapath *\n+ovn_datapath_from_sbrec_(const struct hmap *datapaths,\n+                         const struct sbrec_datapath_binding *sb)\n+{\n+    struct uuid key;\n+\n+    if (!uuid_from_string(&key, sb->nb_uuid)) {\n+        /* This was inserted by something other than ovn-northd. */\n+        return NULL;\n+    }\n+\n+    struct ovn_datapath *od = ovn_datapath_find_(datapaths, &key);\n+    if (od && (od->sb == sb)) {\n+        return od;\n+    }\n+\n+    return NULL;\n+}\n+\n struct ovn_datapath *\n ovn_datapath_from_sbrec(const struct hmap *ls_datapaths,\n                         const struct hmap *lr_datapaths,\n                         const struct sbrec_datapath_binding *sb)\n {\n-    struct uuid key;\n     const struct hmap *dps;\n \n     if (!strcmp(sb->type, \"logical-switch\")) {\n@@ -593,15 +611,7 @@ ovn_datapath_from_sbrec(const struct hmap *ls_datapaths,\n         return NULL;\n     }\n \n-    if (!uuid_from_string(&key, sb->nb_uuid)) {\n-        return NULL;\n-    }\n-    struct ovn_datapath *od = ovn_datapath_find_(dps, &key);\n-    if (od && (od->sb == sb)) {\n-        return od;\n-    }\n-\n-    return NULL;\n+    return ovn_datapath_from_sbrec_(dps, sb);\n }\n \n static bool\n@@ -2027,8 +2037,7 @@ join_logical_ports(\n     struct shash_node *node;\n     SHASH_FOR_EACH (node, &paired_lrps->paired_router_ports) {\n         struct ovn_paired_logical_router_port *slrp = node->data;\n-        od = ovn_datapath_from_sbrec(ls_datapaths, lr_datapaths,\n-                                     slrp->router->sb);\n+        od = ovn_datapath_from_sbrec_(lr_datapaths, slrp->router->sb);\n         if (!od) {\n             /* This can happen if the router is not enabled */\n             continue;\n@@ -2047,10 +2056,10 @@ join_logical_ports(\n \n     SHASH_FOR_EACH (node, &paired_lsps->paired_switch_ports) {\n         struct ovn_paired_logical_switch_port *slsp = node->data;\n-        od = ovn_datapath_from_sbrec(ls_datapaths, lr_datapaths,\n-                                     slsp->sw->sb);\n+        od = ovn_datapath_from_sbrec_(ls_datapaths, slsp->sw->sb);\n \n         ovs_assert(od);\n+\n         join_logical_ports_lsp(ls_ports, od, slsp->nb, slsp->sb,\n                                slsp->nb->name, queue_id_bitmap,\n                                tag_alloc_table);\n@@ -3133,7 +3142,7 @@ cleanup_mac_bindings(\n     const struct sbrec_mac_binding *b;\n     SBREC_MAC_BINDING_TABLE_FOR_EACH_SAFE (b, sbrec_mac_binding_table) {\n         const struct ovn_datapath *od =\n-            ovn_datapath_from_sbrec(NULL, lr_datapaths, b->datapath);\n+            ovn_datapath_from_sbrec_(lr_datapaths, b->datapath);\n \n         if (!od || ovn_datapath_is_stale(od) ||\n                 !ovn_port_find(lr_ports, b->logical_port)) {\n@@ -18456,7 +18465,7 @@ build_ip_mcast(struct ovsdb_idl_txn *ovnsb_txn,\n     const struct sbrec_ip_multicast *sb;\n \n     SBREC_IP_MULTICAST_TABLE_FOR_EACH_SAFE (sb, sbrec_ip_multicast_table) {\n-        od = ovn_datapath_from_sbrec(ls_datapaths, NULL, sb->datapath);\n+        od = ovn_datapath_from_sbrec_(ls_datapaths, sb->datapath);\n         if (!od || ovn_datapath_is_stale(od)) {\n             sbrec_ip_multicast_delete(sb);\n         }\ndiff --git a/northd/northd.h b/northd/northd.h\nindex 3a7198616..21c068f35 100644\n--- a/northd/northd.h\n+++ b/northd/northd.h\n@@ -445,6 +445,9 @@ struct ovn_datapath *ovn_datapath_from_sbrec(\n     const struct hmap *ls_datapaths, const struct hmap *lr_datapaths,\n     const struct sbrec_datapath_binding *);\n \n+struct ovn_datapath *ovn_datapath_from_sbrec_(\n+    const struct hmap *datapaths, const struct sbrec_datapath_binding *);\n+\n static inline bool\n ovn_datapath_is_stale(const struct ovn_datapath *od)\n {\n",
    "prefixes": [
        "ovs-dev",
        "01/14"
    ]
}