get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 34875,
    "url": "http://patches.dpdk.org/api/patches/34875/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1517614137-62926-5-git-send-email-zhihong.wang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1517614137-62926-5-git-send-email-zhihong.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1517614137-62926-5-git-send-email-zhihong.wang@intel.com",
    "date": "2018-02-02T23:28:54",
    "name": "[dpdk-dev,4/7] vhost: add apis for datapath configuration",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "27f9881c224bebca943d223ae30ead466e8d4b84",
    "submitter": {
        "id": 156,
        "url": "http://patches.dpdk.org/api/people/156/?format=api",
        "name": "Zhihong Wang",
        "email": "zhihong.wang@intel.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1517614137-62926-5-git-send-email-zhihong.wang@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/34875/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/34875/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DCBEE1B16F;\n\tFri,  2 Feb 2018 12:33:52 +0100 (CET)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id C368B3250\n\tfor <dev@dpdk.org>; Fri,  2 Feb 2018 12:33:49 +0100 (CET)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Feb 2018 03:33:49 -0800",
            "from unknown (HELO dpdk98.sh.intel.com) ([10.67.111.140])\n\tby orsmga004.jf.intel.com with ESMTP; 02 Feb 2018 03:33:47 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.46,448,1511856000\"; d=\"scan'208\";a=\"171132743\"",
        "From": "Zhihong Wang <zhihong.wang@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "jianfeng.tan@intel.com, tiwei.bie@intel.com, maxime.coquelin@redhat.com, \n\tyliu@fridaylinux.org, cunming.liang@intel.com, xiao.w.wang@intel.com,\n\tdan.daly@intel.com, Zhihong Wang <zhihong.wang@intel.com>",
        "Date": "Fri,  2 Feb 2018 18:28:54 -0500",
        "Message-Id": "<1517614137-62926-5-git-send-email-zhihong.wang@intel.com>",
        "X-Mailer": "git-send-email 2.7.5",
        "In-Reply-To": "<1517614137-62926-1-git-send-email-zhihong.wang@intel.com>",
        "References": "<1517614137-62926-1-git-send-email-zhihong.wang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 4/7] vhost: add apis for datapath configuration",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://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": "<https://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": "This patch adds APIs for datapath configuration. The eid and did of the\nvhost-user socket can be configured to identify the actual device.\n\nWhen the default software datapath is used, eid and did are set to -1.\nWhen alternative datapath is used, eid and did are set by app to specify\nwhich device to use. Each vhost-user socket can have only 1 connection in\nthis case.\n\nSigned-off-by: Zhihong Wang <zhihong.wang@intel.com>\n---\n lib/librte_vhost/rte_vhost.h | 68 ++++++++++++++++++++++++++++++++++++++++++++\n lib/librte_vhost/socket.c    | 65 ++++++++++++++++++++++++++++++++++++++++++\n lib/librte_vhost/vhost.c     | 44 ++++++++++++++++++++++++++++\n lib/librte_vhost/vhost.h     | 10 +++++++\n 4 files changed, 187 insertions(+)",
    "diff": "diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h\nindex 6c92580..03f4ed1 100644\n--- a/lib/librte_vhost/rte_vhost.h\n+++ b/lib/librte_vhost/rte_vhost.h\n@@ -178,6 +178,50 @@ int rte_vhost_driver_register(const char *path, uint64_t flags);\n int rte_vhost_driver_unregister(const char *path);\n \n /**\n+ * Set the engine id, enforce single connection per socket\n+ *\n+ * @param path\n+ *  The vhost-user socket file path\n+ * @param eid\n+ *  Engine id\n+ * @return\n+ *  0 on success, -1 on failure\n+ */\n+int rte_vhost_driver_set_vdpa_eid(const char *path, int eid);\n+\n+/**\n+ * Set the device id, enforce single connection per socket\n+ *\n+ * @param path\n+ *  The vhost-user socket file path\n+ * @param did\n+ *  Device id\n+ * @return\n+ *  0 on success, -1 on failure\n+ */\n+int rte_vhost_driver_set_vdpa_did(const char *path, int did);\n+\n+/**\n+ * Get the engine id\n+ *\n+ * @param path\n+ *  The vhost-user socket file path\n+ * @return\n+ *  Engine id, -1 on failure\n+ */\n+int rte_vhost_driver_get_vdpa_eid(const char *path);\n+\n+/**\n+ * Get the device id\n+ *\n+ * @param path\n+ *  The vhost-user socket file path\n+ * @return\n+ *  Device id, -1 on failure\n+ */\n+int rte_vhost_driver_get_vdpa_did(const char *path);\n+\n+/**\n  * Set the feature bits the vhost-user driver supports.\n  *\n  * @param path\n@@ -492,6 +536,30 @@ int rte_vhost_vring_call(int vid, uint16_t vring_idx);\n  */\n uint32_t rte_vhost_rx_queue_count(int vid, uint16_t qid);\n \n+/**\n+ * Get vdpa engine id for vhost device.\n+ *\n+ * @param vid\n+ *  vhost device ID\n+ * @param eid\n+ *  engine id\n+ * @return\n+ *  engine id\n+ */\n+int rte_vhost_get_vdpa_eid(int vid);\n+\n+/**\n+ * Get vdpa device id for vhost device.\n+ *\n+ * @param vid\n+ *  vhost device ID\n+ * @param did\n+ *  device id\n+ * @return\n+ *  device id\n+ */\n+int rte_vhost_get_vdpa_did(int vid);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c\nindex e1d0036..c4f90af 100644\n--- a/lib/librte_vhost/socket.c\n+++ b/lib/librte_vhost/socket.c\n@@ -54,6 +54,13 @@ struct vhost_user_socket {\n \tuint64_t protocol_features;\n \tuint16_t queue_num;\n \n+\t/* engine and device id to identify a certain port on a specific\n+\t * backend, both are set to -1 for sw. when used, one socket can\n+\t * have 1 connection only.\n+\t */\n+\tint eid;\n+\tint did;\n+\n \tstruct vhost_device_ops const *notify_ops;\n };\n \n@@ -524,6 +531,64 @@ find_vhost_user_socket(const char *path)\n }\n \n int\n+rte_vhost_driver_set_vdpa_eid(const char *path, int eid)\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->eid = eid;\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\n+\treturn vsocket ? 0 : -1;\n+}\n+\n+int\n+rte_vhost_driver_set_vdpa_did(const char *path, int did)\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->did = did;\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\n+\treturn vsocket ? 0 : -1;\n+}\n+\n+int\n+rte_vhost_driver_get_vdpa_eid(const char *path)\n+{\n+\tstruct vhost_user_socket *vsocket;\n+\tint eid = -1;\n+\n+\tpthread_mutex_lock(&vhost_user.mutex);\n+\tvsocket = find_vhost_user_socket(path);\n+\tif (vsocket)\n+\t\teid = vsocket->eid;\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\n+\treturn eid;\n+}\n+\n+int\n+rte_vhost_driver_get_vdpa_did(const char *path)\n+{\n+\tstruct vhost_user_socket *vsocket;\n+\tint did = -1;\n+\n+\tpthread_mutex_lock(&vhost_user.mutex);\n+\tvsocket = find_vhost_user_socket(path);\n+\tif (vsocket)\n+\t\tdid = vsocket->did;\n+\tpthread_mutex_unlock(&vhost_user.mutex);\n+\n+\treturn did;\n+}\n+\n+int\n rte_vhost_driver_disable_features(const char *path, uint64_t features)\n {\n \tstruct vhost_user_socket *vsocket;\ndiff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c\nindex 1dd9adb..2dff199 100644\n--- a/lib/librte_vhost/vhost.c\n+++ b/lib/librte_vhost/vhost.c\n@@ -288,6 +288,8 @@ vhost_new_device(void)\n \tvhost_devices[i] = dev;\n \tdev->vid = i;\n \tdev->slave_req_fd = -1;\n+\tdev->eid = -1;\n+\tdev->did = -1;\n \n \treturn i;\n }\n@@ -316,6 +318,28 @@ vhost_destroy_device(int vid)\n }\n \n void\n+vhost_set_vdpa_eid(int vid, int eid)\n+{\n+\tstruct virtio_net *dev = get_device(vid);\n+\n+\tif (dev == NULL)\n+\t\treturn;\n+\n+\tdev->eid = eid;\n+}\n+\n+void\n+vhost_set_vdpa_did(int vid, int did)\n+{\n+\tstruct virtio_net *dev = get_device(vid);\n+\n+\tif (dev == NULL)\n+\t\treturn;\n+\n+\tdev->did = did;\n+}\n+\n+void\n vhost_set_ifname(int vid, const char *if_name, unsigned int if_len)\n {\n \tstruct virtio_net *dev;\n@@ -605,3 +629,23 @@ rte_vhost_rx_queue_count(int vid, uint16_t qid)\n \n \treturn *((volatile uint16_t *)&vq->avail->idx) - vq->last_avail_idx;\n }\n+\n+int rte_vhost_get_vdpa_eid(int vid)\n+{\n+\tstruct virtio_net *dev = get_device(vid);\n+\n+\tif (dev == NULL)\n+\t\treturn -1;\n+\n+\treturn dev->eid;\n+}\n+\n+int rte_vhost_get_vdpa_did(int vid)\n+{\n+\tstruct virtio_net *dev = get_device(vid);\n+\n+\tif (dev == NULL)\n+\t\treturn -1;\n+\n+\treturn dev->did;\n+}\ndiff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex 09a745d..23d9060 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -19,6 +19,7 @@\n #include <rte_rwlock.h>\n \n #include \"rte_vhost.h\"\n+#include \"rte_vdpa.h\"\n \n /* Used to indicate that the device is running on a data core */\n #define VIRTIO_DEV_RUNNING 1\n@@ -237,6 +238,12 @@ struct virtio_net {\n \tstruct guest_page       *guest_pages;\n \n \tint\t\t\tslave_req_fd;\n+\n+\t/* engine and device id to identify a certain port on a specific\n+\t * backend, both are set to -1 for sw.\n+\t */\n+\tint\t\t\teid;\n+\tint\t\t\tdid;\n } __rte_cache_aligned;\n \n \n@@ -353,6 +360,9 @@ void free_vq(struct vhost_virtqueue *vq);\n \n int alloc_vring_queue(struct virtio_net *dev, uint32_t vring_idx);\n \n+void vhost_set_vdpa_eid(int vid, int eid);\n+void vhost_set_vdpa_did(int vid, int did);\n+\n void vhost_set_ifname(int, const char *if_name, unsigned int if_len);\n void vhost_enable_dequeue_zero_copy(int vid);\n \n",
    "prefixes": [
        "dpdk-dev",
        "4/7"
    ]
}