get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 756274,
    "url": "http://patchwork.ozlabs.org/api/patches/756274/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/1493370083-7385-4-git-send-email-azhou@ovn.org/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/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",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1493370083-7385-4-git-send-email-azhou@ovn.org>",
    "list_archive_url": null,
    "date": "2017-04-28T09:01:22",
    "name": "[ovs-dev,action,upcall,meter,v2,4/5] ofproto: Meter sample action when configured.",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b70c32980dbbcba214a4440f724792c3fb4d5fd4",
    "submitter": {
        "id": 67699,
        "url": "http://patchwork.ozlabs.org/api/people/67699/?format=api",
        "name": "Andy Zhou",
        "email": "azhou@ovn.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/1493370083-7385-4-git-send-email-azhou@ovn.org/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/756274/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/756274/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@mail.linuxfoundation.org"
        ],
        "Received": [
            "from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3wDntB3PJqz9s8S\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 28 Apr 2017 19:03:46 +1000 (AEST)",
            "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 3828EB7F;\n\tFri, 28 Apr 2017 09:01:46 +0000 (UTC)",
            "from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 991C6B56\n\tfor <dev@openvswitch.org>; Fri, 28 Apr 2017 09:01:42 +0000 (UTC)",
            "from mail-pf0-f194.google.com (mail-pf0-f194.google.com\n\t[209.85.192.194])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id A684F15B\n\tfor <dev@openvswitch.org>; Fri, 28 Apr 2017 09:01:41 +0000 (UTC)",
            "by mail-pf0-f194.google.com with SMTP id b23so595421pfc.0\n\tfor <dev@openvswitch.org>; Fri, 28 Apr 2017 02:01:41 -0700 (PDT)",
            "from centos.hsd1.ca.comcast.net.\n\t([2601:647:4280:45d0:d6be:d9ff:fe69:1f8d])\n\tby smtp.gmail.com with ESMTPSA id\n\ts68sm9307944pfj.77.2017.04.28.02.01.40\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 28 Apr 2017 02:01:40 -0700 (PDT)"
        ],
        "X-Greylist": "whitelisted by SQLgrey-1.7.6",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:content-transfer-encoding;\n\tbh=f10V9u94adXmD/3fCBp4d59D6OIIrhJ84JqC5VPdUaE=;\n\tb=q86nd0a6dMHdVf/2HXc/+XDgK5IZu7j+ijRW+lRZ1RYLipBbnvWTpxGnuU+/vlijqn\n\tV5+Rbq2nmEQ8CmonObWfindG3Vg9TCi9oIU0rLt+I+L18Myww43VBoV+RvsdY7H/4s8s\n\tHbKNu8zRvU0SMy7Y4qiSk+brc/gQkTtMm3puxFpbG8arGirnd814IrGpIa8jRu5KAZoX\n\tfnD49YAjbactLVzzAxVanEAyDGWk8d+hfmLSvKP9PrLGSi+R0j95FvVlDW+HhOZXu8dZ\n\tdnyV6EBvnCZJqfYdki1z99qf2jIfPCr3UeD3wMzzI4wCs+eCQB6wpyo6LxlUk3eW+l7p\n\tEbDw==",
        "X-Gm-Message-State": "AN3rC/4psms9ZTugj8Bb1G9NIjMGJNNxxSQYhgMuU53xf7/kFhhxOg+v\n\tPRAIAisIZOHwJ45P",
        "X-Received": "by 10.84.141.3 with SMTP id 3mr6191554plu.8.1493370101132;\n\tFri, 28 Apr 2017 02:01:41 -0700 (PDT)",
        "From": "Andy Zhou <azhou@ovn.org>",
        "To": "dev@openvswitch.org",
        "Date": "Fri, 28 Apr 2017 02:01:22 -0700",
        "Message-Id": "<1493370083-7385-4-git-send-email-azhou@ovn.org>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1493370083-7385-1-git-send-email-azhou@ovn.org>",
        "References": "<1493370083-7385-1-git-send-email-azhou@ovn.org>",
        "X-Spam-Status": "No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1",
        "X-Spam-Checker-Version": "SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org",
        "Subject": "[ovs-dev] [action upcall meter v2 4/5] ofproto: Meter sample action\n\twhen configured.",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.12",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<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\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "ovs-dev-bounces@openvswitch.org",
        "Errors-To": "ovs-dev-bounces@openvswitch.org"
    },
    "content": "When slowpath meter is configured, add meter action when translate\nsample action.\n\nSigned-off-by: Andy Zhou <azhou@ovn.org>\n\n---\nv1->v2: Fix test case 1128 failure.\n---\n ofproto/ofproto-dpif-xlate.c | 14 ++++++++++++--\n tests/ofproto-dpif.at        | 14 ++++++++++++++\n 2 files changed, 26 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c\nindex d8c6a7ccb38c..f34413b9bc94 100644\n--- a/ofproto/ofproto-dpif-xlate.c\n+++ b/ofproto/ofproto-dpif-xlate.c\n@@ -2850,8 +2850,14 @@ compose_sample_action(struct xlate_ctx *ctx,\n         return 0;\n     }\n \n-    /* No need to generate sample action for 100% sampling rate. */\n-    bool is_sample = probability < UINT32_MAX;\n+    /* If the slow path meter is configured by the controller,\n+     * insert a meter action before the user space action.  */\n+    struct ofproto *ofproto = &ctx->xin->ofproto->up;\n+    uint32_t meter_id = ofproto->slowpath_meter_id;\n+\n+    /* When meter action is not required, avoid generate sample action\n+     * for 100% sampling rate.  */\n+    bool is_sample = probability < UINT32_MAX || meter_id != UINT32_MAX;\n     size_t sample_offset, actions_offset;\n     if (is_sample) {\n         sample_offset = nl_msg_start_nested(ctx->odp_actions,\n@@ -2862,6 +2868,10 @@ compose_sample_action(struct xlate_ctx *ctx,\n                                              OVS_SAMPLE_ATTR_ACTIONS);\n     }\n \n+    if (meter_id != UINT32_MAX) {\n+        nl_msg_put_u32(ctx->odp_actions, OVS_ACTION_ATTR_METER, meter_id);\n+    }\n+\n     odp_port_t odp_port = ofp_port_to_odp_port(\n         ctx->xbridge, ctx->xin->flow.in_port.ofp_port);\n     uint32_t pid = dpif_port_get_pid(ctx->xbridge->dpif, odp_port,\ndiff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at\nindex 9f7c6beb0c58..22cb533b57bb 100644\n--- a/tests/ofproto-dpif.at\n+++ b/tests/ofproto-dpif.at\n@@ -6490,6 +6490,20 @@ flow-dump from non-dpdk interfaces:\n packets:2, bytes:68, used:0.001s, actions:userspace(pid=0,ipfix(output_port=4294967295))\n ])\n \n+AT_CHECK([ovs-appctl revalidator/purge])\n+dnl\n+dnl Add a slowpath meter. The userspace action should be metered.\n+AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=slowpath pktps burst stats bands=type=drop rate=3 burst_size=1'])\n+\n+dnl Send some packets that should be sampled and metered.\n+for i in `seq 1 3`; do\n+    AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800)'])\n+done\n+AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\\(packets:\\)/\\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl\n+flow-dump from non-dpdk interfaces:\n+packets:2, bytes:68, used:0.001s, actions:sample(sample=100.0%,actions(meter(0),userspace(pid=0,ipfix(output_port=4294967295))))\n+])\n+\n dnl Remove the IPFIX configuration.\n AT_CHECK([ovs-vsctl clear bridge br0 ipfix])\n AT_CHECK([ovs-appctl revalidator/purge])\n",
    "prefixes": [
        "ovs-dev",
        "action",
        "upcall",
        "meter",
        "v2",
        "4/5"
    ]
}