get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1524857,
    "url": "http://patchwork.ozlabs.org/api/patches/1524857/",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/163091841785.96839.4880012333775292574.stgit@ebuild/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/projects/47/",
        "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",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<163091841785.96839.4880012333775292574.stgit@ebuild>",
    "list_archive_url": null,
    "date": "2021-09-06T08:53:42",
    "name": "[ovs-dev,v6,1/2] dpctl: dpif: add kernel datapath cache hit output",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f5109549a565d15c5ce9057a2d482eedc4587843",
    "submitter": {
        "id": 70613,
        "url": "http://patchwork.ozlabs.org/api/people/70613/",
        "name": "Eelco Chaudron",
        "email": "echaudro@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/163091841785.96839.4880012333775292574.stgit@ebuild/mbox/",
    "series": [
        {
            "id": 261091,
            "url": "http://patchwork.ozlabs.org/api/series/261091/",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=261091",
            "date": "2021-09-06T08:53:28",
            "name": "dpctl: cache visibility/configuration enhancements",
            "version": 6,
            "mbox": "http://patchwork.ozlabs.org/series/261091/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1524857/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/1524857/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@bilbo.ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "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=MneEbmNI;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)",
            "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=echaudro@redhat.com"
        ],
        "Received": [
            "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H32J32Lrwz9sRN\n\tfor <incoming@patchwork.ozlabs.org>; Mon,  6 Sep 2021 18:53:55 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id C28B481A47;\n\tMon,  6 Sep 2021 08:53:52 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n\tby localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id YHUEUqAqypZC; Mon,  6 Sep 2021 08:53:51 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp1.osuosl.org (Postfix) with ESMTPS id E00D181776;\n\tMon,  6 Sep 2021 08:53:50 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id B71CBC001C;\n\tMon,  6 Sep 2021 08:53:50 +0000 (UTC)",
            "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 2D7DEC001B\n for <dev@openvswitch.org>; Mon,  6 Sep 2021 08:53:50 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id 724EA81776\n for <dev@openvswitch.org>; Mon,  6 Sep 2021 08:53:49 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id 1Fbp5st48IBI for <dev@openvswitch.org>;\n Mon,  6 Sep 2021 08:53:48 +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 B8C6B81024\n for <dev@openvswitch.org>; Mon,  6 Sep 2021 08:53:48 +0000 (UTC)",
            "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-412-sLwALNrUOSGSFZu3By6Mvw-1; Mon, 06 Sep 2021 04:53:46 -0400",
            "from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com\n [10.5.11.14])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C376B84A5EA;\n Mon,  6 Sep 2021 08:53:45 +0000 (UTC)",
            "from ebuild.redhat.com (unknown [10.39.194.213])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 09D075D9CA;\n Mon,  6 Sep 2021 08:53:44 +0000 (UTC)"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.8.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1630918427;\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=G2imxAPX+KgtM9EUae1D2tLHBMMrkvYzUTOznjssh/c=;\n b=MneEbmNITsC8xABSupvpaV/nBHHOYc2Ks+UtB298hJqZpCR4wFOK1FG5LryiKyN1vX0Lxx\n gk8inUwtYOBdUm3SwGF0Bc64RfehvPur7nx1Uu0I8Q+hzUlDWYpwBCcU0fr6gSIK94aoTy\n W4CdjAgMZX0Ov48zUltCQkIVmStn0qM=",
        "X-MC-Unique": "sLwALNrUOSGSFZu3By6Mvw-1",
        "From": "Eelco Chaudron <echaudro@redhat.com>",
        "To": "dev@openvswitch.org",
        "Date": "Mon,  6 Sep 2021 10:53:42 +0200",
        "Message-Id": "<163091841785.96839.4880012333775292574.stgit@ebuild>",
        "In-Reply-To": "<163091839517.96839.8006181203263313854.stgit@ebuild>",
        "References": "<163091839517.96839.8006181203263313854.stgit@ebuild>",
        "User-Agent": "StGit/0.21",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.14",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Cc": "fbl@sysclose.org",
        "Subject": "[ovs-dev] [PATCH v6 1/2] dpctl: dpif: add kernel datapath cache hit\n\toutput",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.15",
        "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>",
        "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": "This patch adds cache usage statistics to the output:\n\n$ ovs-dpctl show\nsystem@ovs-system:\n  lookups: hit:24 missed:71 lost:0\n  flows: 0\n  masks: hit:334 total:0 hit/pkt:3.52\n  cache: hit:4 hit rate:4.21%\n  port 0: ovs-system (internal)\n  port 1: genev_sys_6081 (geneve: packet_type=ptap)\n  port 2: br-int (internal)\n  port 3: br-ex (internal)\n  port 4: eth2\n  port 5: sw1p1 (internal)\n  port 6: sw0p4 (internal)\n\nSigned-off-by: Eelco Chaudron <echaudro@redhat.com>\nAcked-by: Flavio Leitner <fbl@sysclose.org>\nAcked-by: Paolo Valerio <pvalerio@redhat.com>\n\nv2: - Changed cache naming to use a hyphen instead of spaces\n    - Some error message grammar changes\n    - Update dpctl man page\n    - Add self tests to for the new set/get commands\nv3: - Rebase on the latest master branch\nv4: - Fixed commit message and tab/spaces in datapath include\nv5: - No updates\nv6: - Add ACKs\n---\n datapath/linux/compat/include/linux/openvswitch.h |    2 +-\n lib/dpctl.c                                       |    9 +++++++++\n lib/dpif-netdev.c                                 |    1 +\n lib/dpif-netlink.c                                |    9 +++++++++\n lib/dpif.h                                        |    2 ++\n 5 files changed, 22 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h\nindex f0595eeba..a3f5fb919 100644\n--- a/datapath/linux/compat/include/linux/openvswitch.h\n+++ b/datapath/linux/compat/include/linux/openvswitch.h\n@@ -126,8 +126,8 @@ struct ovs_dp_megaflow_stats {\n \t__u64 n_mask_hit;\t /* Number of masks used for flow lookups. */\n \t__u32 n_masks;\t\t /* Number of masks for the datapath. */\n \t__u32 pad0;\t\t /* Pad for future expension. */\n+\t__u64 n_cache_hit;\t /* Number of cache matches for flow lookups. */\n \t__u64 pad1;\t\t /* Pad for future expension. */\n-\t__u64 pad2;\t\t /* Pad for future expension. */\n };\n \n struct ovs_vport_stats {\ndiff --git a/lib/dpctl.c b/lib/dpctl.c\nindex ef8ae7402..acc677974 100644\n--- a/lib/dpctl.c\n+++ b/lib/dpctl.c\n@@ -611,6 +611,15 @@ show_dpif(struct dpif *dpif, struct dpctl_params *dpctl_p)\n             dpctl_print(dpctl_p, \"  masks: hit:%\"PRIu64\" total:%\"PRIu32\n                                  \" hit/pkt:%.2f\\n\",\n                         stats.n_mask_hit, stats.n_masks, avg);\n+\n+            if (stats.n_cache_hit != UINT64_MAX) {\n+                double avg_hits = n_pkts ?\n+                    (double) stats.n_cache_hit / n_pkts * 100 : 0.0;\n+\n+                dpctl_print(dpctl_p,\n+                            \"  cache: hit:%\"PRIu64\" hit rate:%.2f%%\\n\",\n+                            stats.n_cache_hit, avg_hits);\n+            }\n         }\n     }\n \ndiff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c\nindex b3e57bb95..0d0623013 100644\n--- a/lib/dpif-netdev.c\n+++ b/lib/dpif-netdev.c\n@@ -1963,6 +1963,7 @@ dpif_netdev_get_stats(const struct dpif *dpif, struct dpif_dp_stats *stats)\n     }\n     stats->n_masks = UINT32_MAX;\n     stats->n_mask_hit = UINT64_MAX;\n+    stats->n_cache_hit = UINT64_MAX;\n \n     return 0;\n }\ndiff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c\nindex 34fc04237..70751e634 100644\n--- a/lib/dpif-netlink.c\n+++ b/lib/dpif-netlink.c\n@@ -749,9 +749,18 @@ dpif_netlink_get_stats(const struct dpif *dpif_, struct dpif_dp_stats *stats)\n             stats->n_masks = dp.megaflow_stats->n_masks;\n             stats->n_mask_hit = get_32aligned_u64(\n                 &dp.megaflow_stats->n_mask_hit);\n+            stats->n_cache_hit = get_32aligned_u64(\n+                &dp.megaflow_stats->n_cache_hit);\n+\n+            if (!stats->n_cache_hit) {\n+                /* Old kernels don't use this field and always\n+                 * report zero instead. Disable this stat. */\n+                stats->n_cache_hit = UINT64_MAX;\n+            }\n         } else {\n             stats->n_masks = UINT32_MAX;\n             stats->n_mask_hit = UINT64_MAX;\n+            stats->n_cache_hit = UINT64_MAX;\n         }\n         ofpbuf_delete(buf);\n     }\ndiff --git a/lib/dpif.h b/lib/dpif.h\nindex 7c322d20e..b32ae5fc7 100644\n--- a/lib/dpif.h\n+++ b/lib/dpif.h\n@@ -429,6 +429,8 @@ struct dpif_dp_stats {\n     uint64_t n_missed;          /* Number of flow table misses. */\n     uint64_t n_lost;            /* Number of misses not sent to userspace. */\n     uint64_t n_flows;           /* Number of flows present. */\n+    uint64_t n_cache_hit;       /* Number of mega flow mask cache hits for\n+                                   flow table matches. */\n     uint64_t n_mask_hit;        /* Number of mega flow masks visited for\n                                    flow table matches. */\n     uint32_t n_masks;           /* Number of mega flow masks. */\n",
    "prefixes": [
        "ovs-dev",
        "v6",
        "1/2"
    ]
}