get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2220548,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2220548/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/0ccb442b44a47164601c59739dc8cc9c1e01a39c.1775568640.git.tredaelli@redhat.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/47/?format=api",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs"
    },
    "msgid": "<0ccb442b44a47164601c59739dc8cc9c1e01a39c.1775568640.git.tredaelli@redhat.com>",
    "date": "2026-04-07T13:34:28",
    "name": "[ovs-dev,v2,2/5] ofproto-dpif-upcall: Add JSON output to upcall/show.",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "5dd83b8078ecfac90553de4024ca8a29460996cb",
    "submitter": {
        "id": 70949,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/70949/?format=api",
        "name": "Timothy Redaelli",
        "email": "tredaelli@redhat.com"
    },
    "delegate": {
        "id": 75123,
        "url": "http://patchwork.ozlabs.org/api/1.1/users/75123/?format=api",
        "username": "echaudron",
        "first_name": "Eelco",
        "last_name": "Chaudron",
        "email": "echaudro@redhat.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/0ccb442b44a47164601c59739dc8cc9c1e01a39c.1775568640.git.tredaelli@redhat.com/mbox/",
    "series": [
        {
            "id": 498985,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/498985/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=498985",
            "date": "2026-04-07T13:34:24",
            "name": "Add JSON output to several ovs-appctl commands",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/498985/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2220548/comments/",
    "check": "fail",
    "checks": "http://patchwork.ozlabs.org/api/patches/2220548/checks/",
    "tags": {},
    "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=TQM98vWY;\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=TQM98vWY",
            "smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com",
            "smtp1.osuosl.org;\n dkim=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=TQM98vWY"
        ],
        "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 4fqnJK5cCmz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 07 Apr 2026 23:35:29 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id 6B96260071;\n\tTue,  7 Apr 2026 13:35:28 +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 PcOkceS9-Ska; Tue,  7 Apr 2026 13:35:26 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp3.osuosl.org (Postfix) with ESMTPS id 003BA60D59;\n\tTue,  7 Apr 2026 13:35:25 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id D2E2CC04FB;\n\tTue,  7 Apr 2026 13:35:25 +0000 (UTC)",
            "from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n by lists.linuxfoundation.org (Postfix) with ESMTP id F3815C04FA\n for <dev@openvswitch.org>; Tue,  7 Apr 2026 13:35:24 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id B395380B3D\n for <dev@openvswitch.org>; Tue,  7 Apr 2026 13:35:23 +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 1Z2JCQNqALNL for <dev@openvswitch.org>;\n Tue,  7 Apr 2026 13:35:22 +0000 (UTC)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp1.osuosl.org (Postfix) with ESMTPS id A2E1C80B23\n for <dev@openvswitch.org>; Tue,  7 Apr 2026 13:35:22 +0000 (UTC)",
            "from mx-prod-mc-03.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-180-bY-J7ss7PZuox2v5ZhDq_A-1; Tue,\n 07 Apr 2026 09:35:18 -0400",
            "from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 793CE1956067; Tue,  7 Apr 2026 13:35:17 +0000 (UTC)",
            "from aldebaran.char-dominant.ts.net (unknown [10.44.34.48])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 3DF7919560A6; Tue,  7 Apr 2026 13:35:15 +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 smtp3.osuosl.org 003BA60D59",
            "OpenDKIM Filter v2.11.0 smtp1.osuosl.org A2E1C80B23"
        ],
        "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124;\n helo=us-smtp-delivery-124.mimecast.com; envelope-from=tredaelli@redhat.com;\n receiver=<UNKNOWN>",
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp1.osuosl.org A2E1C80B23",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1775568921;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc: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=d3lLElKh21tJtBemj++tzI6TIT8unNWUAaquhHg3pvo=;\n b=TQM98vWYwYKiaFPkUmqvThV8At6jDYfh1hQg0DVFqNOuMQyi70P+iXYpy4ni8dhjC9BIno\n RvUG1Jdwk0E+p7Y6kJsQL5lCXMcvNBbuBciWDmdqxiAFUNTjVXt+iIGKX8Wzth+L/dRiur\n aOmvHaM4hvtZyGVYR1OFDJ+D54hzWO4=",
        "X-MC-Unique": "bY-J7ss7PZuox2v5ZhDq_A-1",
        "X-Mimecast-MFC-AGG-ID": "bY-J7ss7PZuox2v5ZhDq_A_1775568917",
        "To": "dev@openvswitch.org",
        "Date": "Tue,  7 Apr 2026 15:34:28 +0200",
        "Message-ID": "\n <0ccb442b44a47164601c59739dc8cc9c1e01a39c.1775568640.git.tredaelli@redhat.com>",
        "In-Reply-To": "<cover.1775568640.git.tredaelli@redhat.com>",
        "References": "<cover.1775568640.git.tredaelli@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.12",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "z3Psl5X5MF2_YlfVLokwUSdz26m_RWKqpA09cQ3VVxk_1775568917",
        "X-Mimecast-Originator": "redhat.com",
        "Subject": "[ovs-dev] [PATCH v2 2/5] ofproto-dpif-upcall: Add JSON output to\n upcall/show.",
        "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": "Timothy Redaelli via dev <ovs-dev@openvswitch.org>",
        "Reply-To": "Timothy Redaelli <tredaelli@redhat.com>",
        "Cc": "i.maximets@ovn.org",
        "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": "When --format json is passed to ovs-appctl, upcall/show returns a JSON\nobject keyed by datapath name.  Each entry contains a \"flows\" sub-object\n(with \"average\", \"current\", \"limit\", \"maximum\", and \"offloaded\" counts),\n\"dump-duration-ms\", \"ufid-enabled\", and a \"revalidators\" object indexed\nby revalidator ID.\n\nThe implementation is split into separate text and JSON helper functions.\n\nExample output:\n  {\"ovs-system\": {\"dump-duration-ms\": 1,\n                   \"flows\": {\"average\": 0, \"current\": 0,\n                             \"limit\": 10000, \"maximum\": 0,\n                             \"offloaded\": 0},\n                   \"revalidators\": {\"4\": {\"keys\": 0}},\n                   \"ufid-enabled\": true}}\n\nSigned-off-by: Timothy Redaelli <tredaelli@redhat.com>\n---\n ofproto/ofproto-dpif-upcall.c | 94 +++++++++++++++++++++++++++++------\n tests/ofproto-dpif.at         | 29 +++++++++++\n 2 files changed, 108 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c\nindex 8e4897202..1616b66cc 100644\n--- a/ofproto/ofproto-dpif-upcall.c\n+++ b/ofproto/ofproto-dpif-upcall.c\n@@ -26,6 +26,7 @@\n #include \"dpif.h\"\n #include \"dpif-offload.h\"\n #include \"openvswitch/dynamic-string.h\"\n+#include \"openvswitch/json.h\"\n #include \"fail-open.h\"\n #include \"guarded-list.h\"\n #include \"latch.h\"\n@@ -3160,13 +3161,65 @@ dp_purge_cb(void *aux, unsigned pmd_id)\n     udpif_resume_revalidators(udpif);\n }\n \f\n+static struct json *\n+upcall_unixctl_show_json(void)\n+{\n+    struct json *json_udpifs = json_object_create();\n+    struct udpif *udpif;\n+\n+    LIST_FOR_EACH (udpif, list_node, &all_udpifs) {\n+        struct json *json_udpif = json_object_create();\n+        struct json *json_revalidators = json_object_create();\n+        struct json *json_flows = json_object_create();\n+        uint64_t n_offloaded_flows;\n+        unsigned int flow_limit;\n+        bool ufid_enabled;\n+        size_t i;\n+\n+        atomic_read_relaxed(&udpif->flow_limit, &flow_limit);\n+        ufid_enabled = udpif_use_ufid(udpif);\n+        n_offloaded_flows = dpif_offload_flow_count(udpif->dpif);\n+\n+        json_object_put(json_flows, \"average\",\n+                        json_integer_create(udpif->avg_n_flows));\n+        json_object_put(json_flows, \"current\",\n+                        json_integer_create(udpif_get_n_flows(udpif)));\n+        json_object_put(json_flows, \"limit\",\n+                        json_integer_create(flow_limit));\n+        json_object_put(json_flows, \"maximum\",\n+                        json_integer_create(udpif->max_n_flows));\n+        json_object_put(json_flows, \"offloaded\",\n+                        json_integer_create(n_offloaded_flows));\n+        json_object_put(json_udpif, \"dump-duration-ms\",\n+                        json_integer_create(udpif->dump_duration));\n+        json_object_put(json_udpif, \"flows\", json_flows);\n+\n+        for (i = 0; i < udpif->n_revalidators; i++) {\n+            struct revalidator *revalidator = &udpif->revalidators[i];\n+            struct json *json_rv = json_object_create();\n+            char *key = xasprintf(\"%u\", revalidator->id);\n+            int j, elements = 0;\n+\n+            for (j = i; j < N_UMAPS; j += udpif->n_revalidators) {\n+                elements += cmap_count(&udpif->ukeys[j].cmap);\n+            }\n+            json_object_put(json_rv, \"keys\", json_integer_create(elements));\n+            json_object_put_nocopy(json_revalidators, key, json_rv);\n+        }\n+        json_object_put(json_udpif, \"revalidators\", json_revalidators);\n+        json_object_put(json_udpif, \"ufid-enabled\",\n+                        json_boolean_create(ufid_enabled));\n+\n+        json_object_put(json_udpifs, dpif_name(udpif->dpif), json_udpif);\n+    }\n+    return json_udpifs;\n+}\n+\n static void\n-upcall_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED,\n-                    const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED)\n+upcall_unixctl_show_text(struct ds *ds)\n {\n-    struct ds ds = DS_EMPTY_INITIALIZER;\n-    uint64_t n_offloaded_flows;\n     struct udpif *udpif;\n+    uint64_t n_offloaded_flows;\n \n     LIST_FOR_EACH (udpif, list_node, &all_udpifs) {\n         unsigned int flow_limit;\n@@ -3176,23 +3229,23 @@ upcall_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED,\n         atomic_read_relaxed(&udpif->flow_limit, &flow_limit);\n         ufid_enabled = udpif_use_ufid(udpif);\n \n-        ds_put_format(&ds, \"%s:\\n\", dpif_name(udpif->dpif));\n-        ds_put_format(&ds, \"  flows         : (current %lu)\"\n+        ds_put_format(ds, \"%s:\\n\", dpif_name(udpif->dpif));\n+        ds_put_format(ds, \"  flows         : (current %lu)\"\n             \" (avg %u) (max %u) (limit %u)\\n\", udpif_get_n_flows(udpif),\n             udpif->avg_n_flows, udpif->max_n_flows, flow_limit);\n         n_offloaded_flows = dpif_offload_flow_count(udpif->dpif);\n         if (n_offloaded_flows) {\n-            ds_put_format(&ds, \"  offloaded flows : %\"PRIu64\"\\n\",\n+            ds_put_format(ds, \"  offloaded flows : %\"PRIu64\"\\n\",\n                           n_offloaded_flows);\n         }\n-        ds_put_format(&ds, \"  dump duration : %lldms\\n\", udpif->dump_duration);\n-        ds_put_format(&ds, \"  ufid enabled : \");\n+        ds_put_format(ds, \"  dump duration : %lldms\\n\", udpif->dump_duration);\n+        ds_put_format(ds, \"  ufid enabled : \");\n         if (ufid_enabled) {\n-            ds_put_format(&ds, \"true\\n\");\n+            ds_put_format(ds, \"true\\n\");\n         } else {\n-            ds_put_format(&ds, \"false\\n\");\n+            ds_put_format(ds, \"false\\n\");\n         }\n-        ds_put_char(&ds, '\\n');\n+        ds_put_char(ds, '\\n');\n \n         for (i = 0; i < udpif->n_revalidators; i++) {\n             struct revalidator *revalidator = &udpif->revalidators[i];\n@@ -3201,12 +3254,23 @@ upcall_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED,\n             for (j = i; j < N_UMAPS; j += udpif->n_revalidators) {\n                 elements += cmap_count(&udpif->ukeys[j].cmap);\n             }\n-            ds_put_format(&ds, \"  %u: (keys %d)\\n\", revalidator->id, elements);\n+            ds_put_format(ds, \"  %u: (keys %d)\\n\", revalidator->id, elements);\n         }\n     }\n+}\n \n-    unixctl_command_reply(conn, ds_cstr(&ds));\n-    ds_destroy(&ds);\n+static void\n+upcall_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED,\n+                    const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED)\n+{\n+    if (unixctl_command_get_output_format(conn) == UNIXCTL_OUTPUT_FMT_JSON) {\n+        unixctl_command_reply_json(conn, upcall_unixctl_show_json());\n+    } else {\n+        struct ds ds = DS_EMPTY_INITIALIZER;\n+        upcall_unixctl_show_text(&ds);\n+        unixctl_command_reply(conn, ds_cstr(&ds));\n+        ds_destroy(&ds);\n+    }\n }\n \n /* Disable using the megaflows.\ndiff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at\nindex 70e28b7d9..a03824fcf 100644\n--- a/tests/ofproto-dpif.at\n+++ b/tests/ofproto-dpif.at\n@@ -13623,6 +13623,35 @@ dnl Make sure the ukey exists.\n AT_CHECK([ovs-appctl upcall/show | grep '(keys' | awk '{print $3}' | \\\n             grep -q '1)'], [0])\n \n+dnl Check upcall/show JSON output has the expected structure.\n+dnl The number of revalidators depends on CPU count, so set it to 1\n+dnl for deterministic output.\n+AT_CHECK([ovs-vsctl set open_vswitch . other_config:n-revalidator-threads=1])\n+OVS_WAIT_UNTIL([ovs-appctl upcall/show | grep -c '(keys' | grep -q '^1$'])\n+AT_CHECK([ovs-appctl --format json --pretty upcall/show | dnl\n+          sed 's/\"dummy@[[^\"]]*\"/\"<datapath>\"/g' | dnl\n+          sed 's/\"dump-duration-ms\": [[0-9]][[0-9]]*/\"dump-duration-ms\": <cleared>/g' | dnl\n+          sed 's/\"average\": [[0-9]][[0-9]]*/\"average\": <cleared>/g' | dnl\n+          sed 's/\"current\": [[0-9]][[0-9]]*/\"current\": <cleared>/g' | dnl\n+          sed 's/\"limit\": [[0-9]][[0-9]]*/\"limit\": <cleared>/g' | dnl\n+          sed 's/\"maximum\": [[0-9]][[0-9]]*/\"maximum\": <cleared>/g' | dnl\n+          sed 's/\"keys\": [[0-9]][[0-9]]*/\"keys\": <cleared>/g' | dnl\n+          sed 's/\"[[0-9]][[0-9]]*\": {/\"<revalidator>\": {/g'], [0], [dnl\n+{\n+  \"<datapath>\": {\n+    \"dump-duration-ms\": <cleared>,\n+    \"flows\": {\n+      \"average\": <cleared>,\n+      \"current\": <cleared>,\n+      \"limit\": <cleared>,\n+      \"maximum\": <cleared>,\n+      \"offloaded\": 0},\n+    \"revalidators\": {\n+      \"<revalidator>\": {\n+        \"keys\": <cleared>}},\n+    \"ufid-enabled\": true}}\n+])\n+\n dnl Delete all datapath flows, and make sure they are gone.\n AT_CHECK([ovs-appctl dpctl/del-flows])\n AT_CHECK([ovs-appctl dpctl/dump-flows --names ], [0], [])\n",
    "prefixes": [
        "ovs-dev",
        "v2",
        "2/5"
    ]
}