get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1525863,
    "url": "http://patchwork.ozlabs.org/api/patches/1525863/",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/f8b2ce76444797ac139d1d8304a5a7f44fd4fd3a.1631107257.git.lorenzo.bianconi@redhat.com/",
    "project": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/projects/68/",
        "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": "<f8b2ce76444797ac139d1d8304a5a7f44fd4fd3a.1631107257.git.lorenzo.bianconi@redhat.com>",
    "list_archive_url": null,
    "date": "2021-09-08T13:27:07",
    "name": "[ovs-dev,v2] controller: add datapath meter capability check",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a1c83a8e2b31c526a363e57611c295f2acb789cf",
    "submitter": {
        "id": 73083,
        "url": "http://patchwork.ozlabs.org/api/people/73083/",
        "name": "Lorenzo Bianconi",
        "email": "lorenzo.bianconi@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/f8b2ce76444797ac139d1d8304a5a7f44fd4fd3a.1631107257.git.lorenzo.bianconi@redhat.com/mbox/",
    "series": [
        {
            "id": 261461,
            "url": "http://patchwork.ozlabs.org/api/series/261461/",
            "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=261461",
            "date": "2021-09-08T13:27:07",
            "name": "[ovs-dev,v2] controller: add datapath meter capability check",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/261461/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1525863/comments/",
    "check": "fail",
    "checks": "http://patchwork.ozlabs.org/api/patches/1525863/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "ovs-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=CAflGbRe;\n\tdkim-atps=neutral",
            "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=<UNKNOWN>)",
            "smtp3.osuosl.org (amavisd-new);\n dkim=pass (1024-bit key) header.d=redhat.com",
            "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lorenzo.bianconi@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 RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H4NGj3DK2z9sVw\n\tfor <incoming@patchwork.ozlabs.org>; Wed,  8 Sep 2021 23:27:22 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 1D576406DF;\n\tWed,  8 Sep 2021 13:27:19 +0000 (UTC)",
            "from smtp4.osuosl.org ([127.0.0.1])\n\tby localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id hP5hVmlEppNH; Wed,  8 Sep 2021 13:27:18 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp4.osuosl.org (Postfix) with ESMTPS id 47DE540624;\n\tWed,  8 Sep 2021 13:27:17 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 252E4C000F;\n\tWed,  8 Sep 2021 13:27:17 +0000 (UTC)",
            "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n by lists.linuxfoundation.org (Postfix) with ESMTP id C32B0C000D\n for <ovs-dev@openvswitch.org>; Wed,  8 Sep 2021 13:27:15 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id AD0256074A\n for <ovs-dev@openvswitch.org>; Wed,  8 Sep 2021 13:27:15 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id qGDgsG_x_ODG for <ovs-dev@openvswitch.org>;\n Wed,  8 Sep 2021 13:27:14 +0000 (UTC)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [216.205.24.124])\n by smtp3.osuosl.org (Postfix) with ESMTPS id BE24E60688\n for <ovs-dev@openvswitch.org>; Wed,  8 Sep 2021 13:27:14 +0000 (UTC)",
            "from mail-ej1-f72.google.com (mail-ej1-f72.google.com\n [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-451-jg51wZD7MjmoAH-EtofOJA-1; Wed, 08 Sep 2021 09:27:12 -0400",
            "by mail-ej1-f72.google.com with SMTP id\n ga42-20020a1709070c2a00b005dc8c1cc3a1so982333ejc.17\n for <ovs-dev@openvswitch.org>; Wed, 08 Sep 2021 06:27:12 -0700 (PDT)",
            "from lore-desk.redhat.com (net-37-116-49-210.cust.vodafonedsl.it.\n [37.116.49.210])\n by smtp.gmail.com with ESMTPSA id t1sm1189478edq.31.2021.09.08.06.27.10\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 08 Sep 2021 06:27:10 -0700 (PDT)"
        ],
        "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=1631107633;\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 bh=sk2XKRO8HL0Xn5Pe6py0YRn7JbD7N/eJPhqZyL5qY+Y=;\n b=CAflGbReezqHdS9F+TZd8FUaE5H0w3sZ5Hz7mVQnxC83nEOrPchxJXzizCdiBMq4Xotzgv\n BGsSW02YH3GEB0PvrzVHUv/1JOG6qpgNMPDdd9n0Fqjxej8ex4jUMzn88SKyeghqrRalMY\n YJVu/707yC9mzljo9wSXBQHlPZVeFUg=",
        "X-MC-Unique": "jg51wZD7MjmoAH-EtofOJA-1",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=sk2XKRO8HL0Xn5Pe6py0YRn7JbD7N/eJPhqZyL5qY+Y=;\n b=7TEVYBBb0H0nxfis2P2DGsAXdgX3FhfL1LbcGx5FqFKOu+cf5ct2ry9BFDhuKEhzb7\n a1P6W9tKh2h0ez8xV99X+fwkXoBPRJOL5affJ4Qx7eZFNKwTVpb4xZw7/6iliQBz2bNi\n UmQOZXmimVgO92KOpos7a6yY7qVFXqa5iSBLCsgHEYKNKIkrp2/T0EkNvtjDWDVDPs4p\n M4iaw1Qdz8BFQViqPzL/r/sNGSOAJvg00ZtKwGtSLdTTMAqrOGyGuvZyDq/myG/BrAB/\n iRqVrQOyrVvDqFwlR3bDj6nR6LtqOvE3h1Kge71xxcelUWJWtVa6ezpvc4SlthYJibKn\n JFcg==",
        "X-Gm-Message-State": "AOAM533MJVC7tTTg2/Ve9LQHqeIZ1BevUh6svMrBID6u6fnWw4iQc/es\n gIg4oA0P0KlHu9l2RN/SHCJadvyEbM6+eTrKK2R0d2SJ5FGHmP6z9yjZBT6Sb3vV2j0W2DUAvyd\n liETl3mGJ0X6EHMrrO3gWXPfG0E7A3Bj6f/4fVJ9RfrP/fHtk/8uoHaRZ+I4AMwUiXRq6ZCxAEV\n LRkr3V",
        "X-Received": [
            "by 2002:a17:906:1146:: with SMTP id\n i6mr4199128eja.12.1631107631059;\n Wed, 08 Sep 2021 06:27:11 -0700 (PDT)",
            "by 2002:a17:906:1146:: with SMTP id\n i6mr4199089eja.12.1631107630616;\n Wed, 08 Sep 2021 06:27:10 -0700 (PDT)"
        ],
        "X-Google-Smtp-Source": "\n ABdhPJxuTY3wX9dxoQUJCh3pK7kRHylztwJVE6r8jSsLMiofOS4m2M/fW3pSAvD8hqda4kAs9lWeFA==",
        "From": "Lorenzo Bianconi <lorenzo.bianconi@redhat.com>",
        "To": "ovs-dev@openvswitch.org",
        "Date": "Wed,  8 Sep 2021 15:27:07 +0200",
        "Message-Id": "\n <f8b2ce76444797ac139d1d8304a5a7f44fd4fd3a.1631107257.git.lorenzo.bianconi@redhat.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "MIME-Version": "1.0",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Cc": "dceara@redhat.com",
        "Subject": "[ovs-dev] [PATCH v2 ovn] controller: add datapath meter capability\n\tcheck",
        "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": "Dump datapath meter capabilities before configuring meters in\novn-controller\n\nSigned-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>\n---\nChanges since v1:\n- move rconn in ovn-controller to avoid concurrency issues\n---\n controller/lflow.c          |  2 +-\n controller/ovn-controller.c | 65 +++++++++++++++++++++++++++++++++++++\n controller/ovn-controller.h |  2 ++\n 3 files changed, 68 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/controller/lflow.c b/controller/lflow.c\nindex 923d8f0a4..d4fda6114 100644\n--- a/controller/lflow.c\n+++ b/controller/lflow.c\n@@ -648,7 +648,7 @@ add_matches_to_flow_table(const struct sbrec_logical_flow *lflow,\n         .ct_snat_vip_ptable = OFTABLE_CT_SNAT_HAIRPIN,\n         .fdb_ptable = OFTABLE_GET_FDB,\n         .fdb_lookup_ptable = OFTABLE_LOOKUP_FDB,\n-        .ctrl_meter_id = ctrl_meter_id,\n+        .ctrl_meter_id = dp_meter_capa > 0 ? ctrl_meter_id : NX_CTLR_NO_METER,\n     };\n     ovnacts_encode(ovnacts->data, ovnacts->size, &ep, &ofpacts);\n \ndiff --git a/controller/ovn-controller.c b/controller/ovn-controller.c\nindex 0031a1035..5e77f5c2e 100644\n--- a/controller/ovn-controller.c\n+++ b/controller/ovn-controller.c\n@@ -73,6 +73,9 @@\n #include \"stopwatch.h\"\n #include \"lib/inc-proc-eng.h\"\n #include \"hmapx.h\"\n+#include \"openvswitch/rconn.h\"\n+#include \"openvswitch/ofp-msgs.h\"\n+#include \"openvswitch/ofp-meter.h\"\n \n VLOG_DEFINE_THIS_MODULE(main);\n \n@@ -117,6 +120,9 @@ static const char *ssl_private_key_file;\n static const char *ssl_certificate_file;\n static const char *ssl_ca_cert_file;\n \n+/* datapath meter capabilities. */\n+int dp_meter_capa = -1;\n+\n /* By default don't set an upper bound for the lflow cache and enable auto\n  * trimming above 10K logical flows when reducing cache size by 50%.\n  */\n@@ -3065,6 +3071,58 @@ check_northd_version(struct ovsdb_idl *ovs_idl, struct ovsdb_idl *ovnsb_idl,\n     return true;\n }\n \n+static void\n+ovn_controller_connect_vswitch(struct rconn *swconn,\n+                               const struct ovsrec_bridge *br_int)\n+{\n+    if (!rconn_is_connected(swconn)) {\n+        char *target = xasprintf(\"unix:%s/%s.mgmt\", ovs_rundir(),\n+                                 br_int->name);\n+        if (strcmp(target, rconn_get_target(swconn))) {\n+            VLOG_INFO(\"%s: connecting to switch\", target);\n+            rconn_connect(swconn, target, target);\n+        }\n+        free(target);\n+    }\n+}\n+\n+static void\n+ovn_controller_get_meter_capa(struct rconn *swconn)\n+{\n+    if (dp_meter_capa >= 0) {\n+        return;\n+    }\n+\n+    rconn_run(swconn);\n+    if (!rconn_is_connected(swconn)) {\n+        return;\n+    }\n+\n+    /* dump datapath meter capabilities. */\n+    struct ofpbuf *msg = ofpraw_alloc(OFPRAW_OFPST13_METER_FEATURES_REQUEST,\n+                                      rconn_get_version(swconn), 0);\n+    rconn_send(swconn, msg, NULL);\n+    for (int i = 0; i < 10; i++) {\n+        msg = rconn_recv(swconn);\n+        if (!msg) {\n+            break;\n+        }\n+\n+        const struct ofp_header *oh = msg->data;\n+        enum ofptype type;\n+        ofptype_decode(&type, oh);\n+\n+        if (type == OFPTYPE_METER_FEATURES_STATS_REPLY) {\n+            struct ofputil_meter_features mf;\n+\n+            ofputil_decode_meter_features(oh, &mf);\n+            dp_meter_capa = mf.max_meters > 0;\n+            engine_set_force_recompute(true);\n+        }\n+        ofpbuf_delete(msg);\n+    }\n+}\n+\n int\n main(int argc, char *argv[])\n {\n@@ -3445,6 +3503,8 @@ main(int argc, char *argv[])\n     char *ovn_version = ovn_get_internal_version();\n     VLOG_INFO(\"OVN internal version is : [%s]\", ovn_version);\n \n+    struct rconn *swconn = rconn_create(5, 0, DSCP_DEFAULT,\n+                                        1 << OFP15_VERSION);\n     /* Main loop. */\n     exiting = false;\n     restart = false;\n@@ -3523,6 +3583,10 @@ main(int argc, char *argv[])\n                        ovsrec_server_has_datapath_table(ovs_idl_loop.idl)\n                        ? &br_int_dp\n                        : NULL);\n+        if (br_int) {\n+            ovn_controller_connect_vswitch(swconn, br_int);\n+        }\n+        ovn_controller_get_meter_capa(swconn);\n \n         /* Enable ACL matching for double tagged traffic. */\n         if (ovs_idl_txn) {\n@@ -3898,6 +3962,7 @@ loop_done:\n     ovsdb_idl_loop_destroy(&ovs_idl_loop);\n     ovsdb_idl_loop_destroy(&ovnsb_idl_loop);\n \n+    rconn_destroy(swconn);\n     free(ovs_remote);\n     service_stop();\n \ndiff --git a/controller/ovn-controller.h b/controller/ovn-controller.h\nindex 78a53312f..0eda72724 100644\n--- a/controller/ovn-controller.h\n+++ b/controller/ovn-controller.h\n@@ -22,6 +22,8 @@\n \n struct ovsrec_bridge_table;\n \n+extern int dp_meter_capa;\n+\n /* Linux supports a maximum of 64K zones, which seems like a fine default. */\n #define MAX_CT_ZONES 65535\n \n",
    "prefixes": [
        "ovs-dev",
        "v2"
    ]
}