get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 833264,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/833264/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/1509614611-4233-2-git-send-email-ciara.loftus@intel.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<1509614611-4233-2-git-send-email-ciara.loftus@intel.com>",
    "list_archive_url": null,
    "date": "2017-11-02T09:23:30",
    "name": "[ovs-dev,v4,1/2] netdev-dpdk: Helper function for vHost device setup",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ad43a30c61498263863dc545d692cb8ea8cc7ae2",
    "submitter": {
        "id": 67255,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/67255/?format=api",
        "name": "Ciara Loftus",
        "email": "ciara.loftus@intel.com"
    },
    "delegate": {
        "id": 70734,
        "url": "http://patchwork.ozlabs.org/api/1.2/users/70734/?format=api",
        "username": "istokes",
        "first_name": "Ian",
        "last_name": "Stokes",
        "email": "ian.stokes@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/1509614611-4233-2-git-send-email-ciara.loftus@intel.com/mbox/",
    "series": [
        {
            "id": 11459,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/11459/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=11459",
            "date": "2017-11-02T09:23:29",
            "name": "vHost Dequeue Zero Copy",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/11459/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/833264/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/833264/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"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)",
        "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 3ySKR33Wr3z9sNw\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Nov 2017 20:24:15 +1100 (AEDT)",
            "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 56F69AAB;\n\tThu,  2 Nov 2017 09:23:45 +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 62F36A86\n\tfor <dev@openvswitch.org>; Thu,  2 Nov 2017 09:23:44 +0000 (UTC)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id BB8C916A\n\tfor <dev@openvswitch.org>; Thu,  2 Nov 2017 09:23:43 +0000 (UTC)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Nov 2017 02:23:43 -0700",
            "from sivswdev01.ir.intel.com (HELO localhost.localdomain)\n\t([10.237.217.45])\n\tby orsmga004.jf.intel.com with ESMTP; 02 Nov 2017 02:23:42 -0700"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.44,333,1505804400\"; d=\"scan'208\";a=\"145057672\"",
        "From": "Ciara Loftus <ciara.loftus@intel.com>",
        "To": "dev@openvswitch.org",
        "Date": "Thu,  2 Nov 2017 09:23:30 +0000",
        "Message-Id": "<1509614611-4233-2-git-send-email-ciara.loftus@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": "<1509614611-4233-1-git-send-email-ciara.loftus@intel.com>",
        "References": "<1509614611-4233-1-git-send-email-ciara.loftus@intel.com>",
        "X-Spam-Status": "No, score=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,\n\tRP_MATCHES_RCVD autolearn=disabled version=3.3.1",
        "X-Spam-Checker-Version": "SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org",
        "Subject": "[ovs-dev] [PATCH v4 1/2] netdev-dpdk: Helper function for vHost\n\tdevice setup",
        "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": "dpdkvhostuser and dpdkvhostuserclient ports share a lot of the same\nsetup & configuration code. Create a common function they can share in\norder to remove some duplication of code.\n\nSigned-off-by: Ciara Loftus <ciara.loftus@intel.com>\n---\n lib/netdev-dpdk.c | 113 +++++++++++++++++++++++++-----------------------------\n 1 file changed, 52 insertions(+), 61 deletions(-)",
    "diff": "diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c\nindex 1e9d78f..4643f6f 100644\n--- a/lib/netdev-dpdk.c\n+++ b/lib/netdev-dpdk.c\n@@ -991,35 +991,27 @@ vhost_common_construct(struct netdev *netdev)\n }\n \n static int\n-netdev_dpdk_vhost_construct(struct netdev *netdev)\n+dpdk_setup_vhost_device(struct netdev_dpdk *dev, bool client_mode)\n {\n-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);\n-    const char *name = netdev->name;\n-    int err;\n+    const char *name = dev->up.name;\n+    uint64_t flags = dev->vhost_driver_flags;\n+    int err = 0;\n \n-    /* 'name' is appended to 'vhost_sock_dir' and used to create a socket in\n-     * the file system. '/' or '\\' would traverse directories, so they're not\n-     * acceptable in 'name'. */\n-    if (strchr(name, '/') || strchr(name, '\\\\')) {\n-        VLOG_ERR(\"\\\"%s\\\" is not a valid name for a vhost-user port. \"\n-                 \"A valid name must not include '/' or '\\\\'\",\n-                 name);\n-        return EINVAL;\n+    if (client_mode) {\n+        flags |= RTE_VHOST_USER_CLIENT;\n     }\n \n-    ovs_mutex_lock(&dpdk_mutex);\n-    /* Take the name of the vhost-user port and append it to the location where\n-     * the socket is to be created, then register the socket.\n-     */\n-    snprintf(dev->vhost_id, sizeof dev->vhost_id, \"%s/%s\",\n-             dpdk_get_vhost_sock_dir(), name);\n-\n-    dev->vhost_driver_flags &= ~RTE_VHOST_USER_CLIENT;\n-    err = rte_vhost_driver_register(dev->vhost_id, dev->vhost_driver_flags);\n+    err = rte_vhost_driver_register(dev->vhost_id, flags);\n     if (err) {\n         VLOG_ERR(\"vhost-user socket device setup failure for socket %s\\n\",\n                  dev->vhost_id);\n-        goto out;\n+        return err;\n+    } else if (client_mode) {\n+            /* Configuration successful */\n+            dev->vhost_driver_flags |= RTE_VHOST_USER_CLIENT;\n+            VLOG_INFO(\"vHost User device '%s' created in 'client' mode, \"\n+                      \"using client socket '%s'\",\n+                      name, dev->vhost_id);\n     } else {\n         fatal_signal_add_file_to_unlink(dev->vhost_id);\n         VLOG_INFO(\"Socket %s created for vhost-user port %s\\n\",\n@@ -1027,11 +1019,11 @@ netdev_dpdk_vhost_construct(struct netdev *netdev)\n     }\n \n     err = rte_vhost_driver_callback_register(dev->vhost_id,\n-                                                &virtio_net_device_ops);\n+                                             &virtio_net_device_ops);\n     if (err) {\n         VLOG_ERR(\"rte_vhost_driver_callback_register failed for vhost user \"\n                  \"port: %s\\n\", name);\n-        goto out;\n+        return err;\n     }\n \n     err = rte_vhost_driver_disable_features(dev->vhost_id,\n@@ -1041,13 +1033,46 @@ netdev_dpdk_vhost_construct(struct netdev *netdev)\n     if (err) {\n         VLOG_ERR(\"rte_vhost_driver_disable_features failed for vhost user \"\n                  \"port: %s\\n\", name);\n-        goto out;\n+        return err;\n     }\n \n     err = rte_vhost_driver_start(dev->vhost_id);\n     if (err) {\n         VLOG_ERR(\"rte_vhost_driver_start failed for vhost user \"\n-                 \"port: %s\\n\", name);\n+                \"port: %s\\n\", name);\n+        return err;\n+    }\n+\n+    return err;\n+}\n+\n+static int\n+netdev_dpdk_vhost_construct(struct netdev *netdev)\n+{\n+    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);\n+    const char *name = netdev->name;\n+    int err;\n+\n+    /* 'name' is appended to 'vhost_sock_dir' and used to create a socket in\n+     * the file system. '/' or '\\' would traverse directories, so they're not\n+     * acceptable in 'name'. */\n+    if (strchr(name, '/') || strchr(name, '\\\\')) {\n+        VLOG_ERR(\"\\\"%s\\\" is not a valid name for a vhost-user port. \"\n+                 \"A valid name must not include '/' or '\\\\'\",\n+                 name);\n+        return EINVAL;\n+    }\n+\n+    ovs_mutex_lock(&dpdk_mutex);\n+    /* Take the name of the vhost-user port and append it to the location where\n+     * the socket is to be created, then register the socket.\n+     */\n+    snprintf(dev->vhost_id, sizeof dev->vhost_id, \"%s/%s\",\n+             dpdk_get_vhost_sock_dir(), name);\n+\n+    dev->vhost_driver_flags &= ~RTE_VHOST_USER_CLIENT;\n+    err = dpdk_setup_vhost_device(dev, false);\n+    if (err) {\n         goto out;\n     }\n \n@@ -3316,42 +3341,8 @@ netdev_dpdk_vhost_client_reconfigure(struct netdev *netdev)\n     if (!(dev->vhost_driver_flags & RTE_VHOST_USER_CLIENT)\n             && strlen(dev->vhost_id)) {\n         /* Register client-mode device */\n-        err = rte_vhost_driver_register(dev->vhost_id,\n-                                        RTE_VHOST_USER_CLIENT);\n-        if (err) {\n-            VLOG_ERR(\"vhost-user device setup failure for device %s\\n\",\n-                     dev->vhost_id);\n-            goto unlock;\n-        } else {\n-            /* Configuration successful */\n-            dev->vhost_driver_flags |= RTE_VHOST_USER_CLIENT;\n-            VLOG_INFO(\"vHost User device '%s' created in 'client' mode, \"\n-                      \"using client socket '%s'\",\n-                      dev->up.name, dev->vhost_id);\n-        }\n-\n-        err = rte_vhost_driver_callback_register(dev->vhost_id,\n-                                                 &virtio_net_device_ops);\n-        if (err) {\n-            VLOG_ERR(\"rte_vhost_driver_callback_register failed for \"\n-                     \"vhost user client port: %s\\n\", dev->up.name);\n-            goto unlock;\n-        }\n-\n-        err = rte_vhost_driver_disable_features(dev->vhost_id,\n-                                    1ULL << VIRTIO_NET_F_HOST_TSO4\n-                                    | 1ULL << VIRTIO_NET_F_HOST_TSO6\n-                                    | 1ULL << VIRTIO_NET_F_CSUM);\n-        if (err) {\n-            VLOG_ERR(\"rte_vhost_driver_disable_features failed for vhost user \"\n-                     \"client port: %s\\n\", dev->up.name);\n-            goto unlock;\n-        }\n-\n-        err = rte_vhost_driver_start(dev->vhost_id);\n+        err = dpdk_setup_vhost_device(dev, true);\n         if (err) {\n-            VLOG_ERR(\"rte_vhost_driver_start failed for vhost user \"\n-                     \"client port: %s\\n\", dev->up.name);\n             goto unlock;\n         }\n     }\n",
    "prefixes": [
        "ovs-dev",
        "v4",
        "1/2"
    ]
}