get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 22597,
    "url": "https://patches.dpdk.org/api/patches/22597/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1490705142-893-2-git-send-email-yuanhan.liu@linux.intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1490705142-893-2-git-send-email-yuanhan.liu@linux.intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1490705142-893-2-git-send-email-yuanhan.liu@linux.intel.com",
    "date": "2017-03-28T12:45:21",
    "name": "[dpdk-dev,v3,01/22] vhost: introduce driver features related APIs",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c6fce71fd92d0c5cf6e503589daddeae260af4c6",
    "submitter": {
        "id": 307,
        "url": "https://patches.dpdk.org/api/people/307/?format=api",
        "name": "Yuanhan Liu",
        "email": "yuanhan.liu@linux.intel.com"
    },
    "delegate": {
        "id": 355,
        "url": "https://patches.dpdk.org/api/users/355/?format=api",
        "username": "yliu",
        "first_name": "Yuanhan",
        "last_name": "Liu",
        "email": "yuanhan.liu@linux.intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1490705142-893-2-git-send-email-yuanhan.liu@linux.intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/22597/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/22597/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 5CF10CFA4;\n\tTue, 28 Mar 2017 14:48:27 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id A55EA69D4\n\tfor <dev@dpdk.org>; Tue, 28 Mar 2017 14:48:20 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga105.jf.intel.com with ESMTP; 28 Mar 2017 05:48:07 -0700",
            "from yliu-dev.sh.intel.com ([10.239.67.162])\n\tby orsmga002.jf.intel.com with ESMTP; 28 Mar 2017 05:48:06 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.36,236,1486454400\"; d=\"scan'208\";a=\"65960948\"",
        "From": "Yuanhan Liu <yuanhan.liu@linux.intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n\tHarris James R <james.r.harris@intel.com>,\n\tLiu Changpeng <changpeng.liu@intel.com>,\n\tYuanhan Liu <yuanhan.liu@linux.intel.com>",
        "Date": "Tue, 28 Mar 2017 20:45:21 +0800",
        "Message-Id": "<1490705142-893-2-git-send-email-yuanhan.liu@linux.intel.com>",
        "X-Mailer": "git-send-email 1.9.0",
        "In-Reply-To": "<1490705142-893-1-git-send-email-yuanhan.liu@linux.intel.com>",
        "References": "<1490253059-28112-1-git-send-email-yuanhan.liu@linux.intel.com>\n\t<1490705142-893-1-git-send-email-yuanhan.liu@linux.intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 01/22] vhost: introduce driver features\n\trelated APIs",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Introduce few APIs to set/get/enable/disable driver features.\n\nSigned-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n doc/guides/prog_guide/vhost_lib.rst    | 10 +++-\n lib/librte_vhost/rte_vhost_version.map |  4 ++\n lib/librte_vhost/rte_virtio_net.h      | 51 +++++++++++++++++++\n lib/librte_vhost/socket.c              | 90 ++++++++++++++++++++++++++++++++++\n 4 files changed, 153 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst\nindex f0862e6..6a4d206 100644\n--- a/doc/guides/prog_guide/vhost_lib.rst\n+++ b/doc/guides/prog_guide/vhost_lib.rst\n@@ -53,7 +53,7 @@ vhost library should be able to:\n Vhost API Overview\n ------------------\n \n-The following is an overview of the Vhost API functions:\n+The following is an overview of some key Vhost API functions:\n \n * ``rte_vhost_driver_register(path, flags)``\n \n@@ -110,6 +110,12 @@ The following is an overview of the Vhost API functions:\n       of those segments, thus the fewer the segments, the quicker we will get\n       the mapping. NOTE: we may speed it by using tree searching in future.\n \n+* ``rte_vhost_driver_set_features(path, features)``\n+\n+  This function sets the feature bits the vhost-user driver supports. The\n+  vhost-user driver could be vhost-user net, yet it could be something else,\n+  say, vhost-user SCSI.\n+\n * ``rte_vhost_driver_session_start()``\n \n   This function starts the vhost session loop to handle vhost messages. It\n@@ -145,7 +151,7 @@ The following is an overview of the Vhost API functions:\n \n   Receives (dequeues) ``count`` packets from guest, and stored them at ``pkts``.\n \n-* ``rte_vhost_feature_disable/rte_vhost_feature_enable(feature_mask)``\n+* ``rte_vhost_driver_disable/enable_features(path, features))``\n \n   This function disables/enables some features. For example, it can be used to\n   disable mergeable buffers and TSO features, which both are enabled by\ndiff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rte_vhost_version.map\nindex 30b4671..ca6259c 100644\n--- a/lib/librte_vhost/rte_vhost_version.map\n+++ b/lib/librte_vhost/rte_vhost_version.map\n@@ -34,6 +34,10 @@ DPDK_16.07 {\n DPDK_17.05 {\n \tglobal:\n \n+\trte_vhost_driver_disable_features;\n+\trte_vhost_driver_enable_features;\n+\trte_vhost_driver_get_features;\n+\trte_vhost_driver_set_features;\n \trte_vhost_get_mtu;\n \n } DPDK_16.07;\ndiff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h\nindex 56829aa..3daf35c 100644\n--- a/lib/librte_vhost/rte_virtio_net.h\n+++ b/lib/librte_vhost/rte_virtio_net.h\n@@ -94,6 +94,57 @@ struct virtio_net_device_ops {\n /* Unregister vhost driver. This is only meaningful to vhost user. */\n int rte_vhost_driver_unregister(const char *path);\n \n+/**\n+ * Set the feature bits the vhost-user driver supports.\n+ *\n+ * @param path\n+ *  The vhost-user socket file path\n+ * @return\n+ *  0 on success, -1 on failure\n+ */\n+int rte_vhost_driver_set_features(const char *path, uint64_t features);\n+\n+/**\n+ * Enable vhost-user driver features.\n+ *\n+ * Note that\n+ * - the param @features should be a subset of the feature bits provided\n+ *   by rte_vhost_driver_set_features().\n+ * - it must be invoked before vhost-user negotiation starts.\n+ *\n+ * @param path\n+ *  The vhost-user socket file path\n+ * @param features\n+ *  Features to enable\n+ * @return\n+ *  0 on success, -1 on failure\n+ */\n+int rte_vhost_driver_enable_features(const char *path, uint64_t features);\n+\n+/**\n+ * Disable vhost-user driver features.\n+ *\n+ * The two notes at rte_vhost_driver_enable_features() also apply here.\n+ *\n+ * @param path\n+ *  The vhost-user socket file path\n+ * @param features\n+ *  Features to disable\n+ * @return\n+ *  0 on success, -1 on failure\n+ */\n+int rte_vhost_driver_disable_features(const char *path, uint64_t features);\n+\n+/**\n+ * Get the final feature bits for feature negotiation.\n+ *\n+ * @param path\n+ *  The vhost-user socket file path\n+ * @return\n+ *  Feature bits on success, 0 on failure\n+ */\n+uint64_t rte_vhost_driver_get_features(const char *path);\n+\n /* Register callbacks. */\n int rte_vhost_driver_callback_register(struct virtio_net_device_ops const * const);\n /* Start vhost driver session blocking loop. */\ndiff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c\nindex 2afde98..e3f3450 100644\n--- a/lib/librte_vhost/socket.c\n+++ b/lib/librte_vhost/socket.c\n@@ -67,6 +67,16 @@ struct vhost_user_socket {\n \tbool is_server;\n \tbool reconnect;\n \tbool dequeue_zero_copy;\n+\n+\t/*\n+\t * The \"supported_features\" indicates the feature bits the\n+\t * vhost driver supports. The \"features\" indicates the feature\n+\t * bits after the rte_vhost_driver_features_disable/enable().\n+\t * It is also the final feature bits used for vhost-user\n+\t * features negotiation.\n+\t */\n+\tuint64_t supported_features;\n+\tuint64_t features;\n };\n \n struct vhost_user_connection {\n@@ -490,6 +500,86 @@ struct vhost_user_reconnect_list {\n \treturn 0;\n }\n \n+static struct vhost_user_socket *\n+find_vhost_user_socket(const char *path)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < vhost_user.vsocket_cnt; i++) {\n+\t\tstruct vhost_user_socket *vsocket = vhost_user.vsockets[i];\n+\n+\t\tif (!strcmp(vsocket->path, path))\n+\t\t\treturn vsocket;\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+int\n+rte_vhost_driver_disable_features(const char *path, uint64_t features)\n+{\n+\tstruct vhost_user_socket *vsocket;\n+\n+\tpthread_mutex_lock(&vhost_user.mutex);\n+\tvsocket = find_vhost_user_socket(path);\n+\tif (vsocket)\n+\t\tvsocket->features &= ~features;\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\n+\treturn vsocket ? 0 : -1;\n+}\n+\n+int\n+rte_vhost_driver_enable_features(const char *path, uint64_t features)\n+{\n+\tstruct vhost_user_socket *vsocket;\n+\n+\tpthread_mutex_lock(&vhost_user.mutex);\n+\tvsocket = find_vhost_user_socket(path);\n+\tif (vsocket) {\n+\t\tif ((vsocket->supported_features & features) != features) {\n+\t\t\t/*\n+\t\t\t * trying to enable features the driver doesn't\n+\t\t\t * support.\n+\t\t\t */\n+\t\t\tpthread_mutex_unlock(&vhost_user.mutex);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tvsocket->features |= features;\n+\t}\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\n+\treturn vsocket ? 0 : -1;\n+}\n+\n+int\n+rte_vhost_driver_set_features(const char *path, uint64_t features)\n+{\n+\tstruct vhost_user_socket *vsocket;\n+\n+\tpthread_mutex_lock(&vhost_user.mutex);\n+\tvsocket = find_vhost_user_socket(path);\n+\tif (vsocket) {\n+\t\tvsocket->supported_features = features;\n+\t\tvsocket->features = features;\n+\t}\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\n+\treturn vsocket ? 0 : -1;\n+}\n+\n+uint64_t\n+rte_vhost_driver_get_features(const char *path)\n+{\n+\tstruct vhost_user_socket *vsocket;\n+\n+\tpthread_mutex_lock(&vhost_user.mutex);\n+\tvsocket = find_vhost_user_socket(path);\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\n+\treturn vsocket ? vsocket->features : (uint64_t)-1;\n+}\n+\n /*\n  * Register a new vhost-user socket; here we could act as server\n  * (the default case), or client (when RTE_VHOST_USER_CLIENT) flag\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "01/22"
    ]
}