get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 8512,
    "url": "https://patches.dpdk.org/api/patches/8512/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1446436737-25606-2-git-send-email-mukawa@igel.co.jp/",
    "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": "<1446436737-25606-2-git-send-email-mukawa@igel.co.jp>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1446436737-25606-2-git-send-email-mukawa@igel.co.jp",
    "date": "2015-11-02T03:58:56",
    "name": "[dpdk-dev,v2,1/2] vhost: Add callback and private data for vhost PMD",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f96beab1f957e45499f3cac3691e4f2ddc6b07bc",
    "submitter": {
        "id": 64,
        "url": "https://patches.dpdk.org/api/people/64/?format=api",
        "name": "Tetsuya Mukawa",
        "email": "mukawa@igel.co.jp"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1446436737-25606-2-git-send-email-mukawa@igel.co.jp/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/8512/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/8512/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 DEA768E7E;\n\tMon,  2 Nov 2015 04:59:16 +0100 (CET)",
            "from mail-pa0-f52.google.com (mail-pa0-f52.google.com\n\t[209.85.220.52]) by dpdk.org (Postfix) with ESMTP id A10458D9F\n\tfor <dev@dpdk.org>; Mon,  2 Nov 2015 04:59:15 +0100 (CET)",
            "by padec8 with SMTP id ec8so25454409pad.1\n\tfor <dev@dpdk.org>; Sun, 01 Nov 2015 19:59:15 -0800 (PST)",
            "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby smtp.gmail.com with ESMTPSA id\n\td7sm4808772pas.31.2015.11.01.19.59.12\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSun, 01 Nov 2015 19:59:14 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=igel_co_jp.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=M9HOK9Ymbx/Z3Gf7dje8jkcjqNa9XN2YLPlXvwPidZE=;\n\tb=L+21xI7ABffyC9ypU2NGFl49H35buShG4sre5lK1QqjnYDMNfb3h1/XF6rG8mG9ORs\n\tFyNpp/u1Tz5Qvuu2Ph5mAz+gDr1tCLOgIKJlgpRLGUVfL5UMSXXbNf19RxYeYosE1xoG\n\tFhI5cjAMhn2xAzJibPqeZBEZoqkRII/82Gat+gLeSSv8dDDIfaYOrCCaCR9y29ZV2tB4\n\t+59KFzs2SyYMTem+9MTzV7fI0ua4v14NWp7PksmhOJbTf75x3xe8mVDktssZigBT/CY5\n\tmt1FfA5QL7N25p6OXuK7klPttEfD8FEB179AXeQVAWg+Q/AOAgjTpnalTVk856KRMZ/4\n\txKmw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=M9HOK9Ymbx/Z3Gf7dje8jkcjqNa9XN2YLPlXvwPidZE=;\n\tb=CpFd8inDggU+dktjLrvwNPln10yg5vhg7rsejrcX4aedPoZ92L6Jqugu42LV25Gd1X\n\tdf/Ajbt/aAxad0DpTNIMkNUr8MKTLUaPJVwjreynvvI5T/VV1PCRv7+gqjrCJJPRHocZ\n\tcMdENFtu8f2qJQKUpajBqIalh0AniiLSOEE+8mxXpOFAzwM4xPNXmmVY75OWjqEng9ZD\n\tO4HcEFFFbaSyWJEu24XB+eQ5urNQVW9zaaGqm7hHQL96i0HT0jo5mCCfaKonGuMlEDxU\n\tNN6Oz0/fnnylDsLWY0rLCVuu+R2ALuqLigQB3oNLMdbL6J6qhQgWBd1fw/sZ6sK6QoRJ\n\teFpg==",
        "X-Gm-Message-State": "ALoCoQk5b9uGqei689fhnATWj10qeCSvCEjZT24o/jXZQqyc2JoOY6pIednJRYfrx/JcBM0OTlSM",
        "X-Received": "by 10.66.228.199 with SMTP id sk7mr25007810pac.8.1446436755015; \n\tSun, 01 Nov 2015 19:59:15 -0800 (PST)",
        "From": "Tetsuya Mukawa <mukawa@igel.co.jp>",
        "To": "dev@dpdk.org",
        "Date": "Mon,  2 Nov 2015 12:58:56 +0900",
        "Message-Id": "<1446436737-25606-2-git-send-email-mukawa@igel.co.jp>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1446436737-25606-1-git-send-email-mukawa@igel.co.jp>",
        "References": "<1445926375-18986-4-git-send-email-mukawa@igel.co.jp>\n\t<1446436737-25606-1-git-send-email-mukawa@igel.co.jp>",
        "Cc": "ann.zhuangyanying@huawei.com",
        "Subject": "[dpdk-dev] [PATCH v2 1/2] vhost: Add callback and private data for\n\tvhost PMD",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "These variables are needed to be able to manage one of virtio devices\nusing both vhost library APIs and vhost PMD.\nFor example, if vhost PMD uses current callback handler and private data\nprovided by vhost library, A DPDK application that links vhost library\ncannot use some of vhost library APIs. To avoid it, callback and private\ndata for vhost PMD are needed.\n\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\n---\n lib/librte_vhost/rte_vhost_version.map        |  6 +++\n lib/librte_vhost/rte_virtio_net.h             |  3 ++\n lib/librte_vhost/vhost_user/virtio-net-user.c | 13 +++----\n lib/librte_vhost/virtio-net.c                 | 56 +++++++++++++++++++++++++--\n lib/librte_vhost/virtio-net.h                 |  4 +-\n 5 files changed, 70 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/rte_vhost_version.map b/lib/librte_vhost/rte_vhost_version.map\nindex 3d8709e..00a9ce5 100644\n--- a/lib/librte_vhost/rte_vhost_version.map\n+++ b/lib/librte_vhost/rte_vhost_version.map\n@@ -20,3 +20,9 @@ DPDK_2.1 {\n \trte_vhost_driver_unregister;\n \n } DPDK_2.0;\n+\n+DPDK_2.2 {\n+\tglobal:\n+\n+\trte_vhost_driver_pmd_callback_register;\n+} DPDK_2.1;\ndiff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h\nindex b6386f9..033edde 100644\n--- a/lib/librte_vhost/rte_virtio_net.h\n+++ b/lib/librte_vhost/rte_virtio_net.h\n@@ -121,6 +121,7 @@ struct virtio_net {\n \tchar\t\t\tifname[IF_NAME_SZ];\t/**< Name of the tap device or socket path. */\n \tuint32_t\t\tvirt_qp_nb;\t/**< number of queue pair we have allocated */\n \tvoid\t\t\t*priv;\t\t/**< private context */\n+\tvoid\t\t\t*pmd_priv;\t/**< private context for vhost PMD */\n \tstruct vhost_virtqueue\t*virtqueue[VHOST_MAX_QUEUE_PAIRS * 2];\t/**< Contains all virtqueue information. */\n } __rte_cache_aligned;\n \n@@ -217,6 +218,8 @@ int rte_vhost_driver_unregister(const char *dev_name);\n \n /* Register callbacks. */\n int rte_vhost_driver_callback_register(struct virtio_net_device_ops const * const);\n+/* Register callbacks for vhost PMD (Only for internal). */\n+int rte_vhost_driver_pmd_callback_register(struct virtio_net_device_ops const * const);\n /* Start vhost driver session blocking loop. */\n int rte_vhost_driver_session_start(void);\n \ndiff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c\nindex d07452a..d8ae2fc 100644\n--- a/lib/librte_vhost/vhost_user/virtio-net-user.c\n+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c\n@@ -111,7 +111,7 @@ user_set_mem_table(struct vhost_device_ctx ctx, struct VhostUserMsg *pmsg)\n \n \t/* Remove from the data plane. */\n \tif (dev->flags & VIRTIO_DEV_RUNNING)\n-\t\tnotify_ops->destroy_device(dev);\n+\t\tnotify_destroy_device(dev);\n \n \tif (dev->mem) {\n \t\tfree_mem_region(dev);\n@@ -272,7 +272,7 @@ user_set_vring_kick(struct vhost_device_ctx ctx, struct VhostUserMsg *pmsg)\n \n \tif (virtio_is_ready(dev) &&\n \t\t!(dev->flags & VIRTIO_DEV_RUNNING))\n-\t\t\tnotify_ops->new_device(dev);\n+\t\t\tnotify_new_device(dev);\n }\n \n /*\n@@ -288,7 +288,7 @@ user_get_vring_base(struct vhost_device_ctx ctx,\n \t\treturn -1;\n \t/* We have to stop the queue (virtio) if it is running. */\n \tif (dev->flags & VIRTIO_DEV_RUNNING)\n-\t\tnotify_ops->destroy_device(dev);\n+\t\tnotify_destroy_device(dev);\n \n \t/* Here we are safe to get the last used index */\n \tops->get_vring_base(ctx, state->index, state);\n@@ -324,10 +324,7 @@ user_set_vring_enable(struct vhost_device_ctx ctx,\n \t\t\"set queue enable: %d to qp idx: %d\\n\",\n \t\tenable, state->index);\n \n-\tif (notify_ops->vring_state_changed) {\n-\t\tnotify_ops->vring_state_changed(dev, base_idx / VIRTIO_QNUM,\n-\t\t\t\t\t\tenable);\n-\t}\n+\tnotify_vring_state_changed(dev, base_idx / VIRTIO_QNUM, enable);\n \n \tdev->virtqueue[base_idx + VIRTIO_RXQ]->enabled = enable;\n \tdev->virtqueue[base_idx + VIRTIO_TXQ]->enabled = enable;\n@@ -341,7 +338,7 @@ user_destroy_device(struct vhost_device_ctx ctx)\n \tstruct virtio_net *dev = get_device(ctx);\n \n \tif (dev && (dev->flags & VIRTIO_DEV_RUNNING))\n-\t\tnotify_ops->destroy_device(dev);\n+\t\tnotify_destroy_device(dev);\n \n \tif (dev && dev->mem) {\n \t\tfree_mem_region(dev);\ndiff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c\nindex 3e82605..ee54beb 100644\n--- a/lib/librte_vhost/virtio-net.c\n+++ b/lib/librte_vhost/virtio-net.c\n@@ -65,6 +65,8 @@ struct virtio_net_config_ll {\n \n /* device ops to add/remove device to/from data core. */\n struct virtio_net_device_ops const *notify_ops;\n+/* device ops for vhost PMD to add/remove device to/from data core. */\n+struct virtio_net_device_ops const *pmd_notify_ops;\n /* root address of the linked list of managed virtio devices */\n static struct virtio_net_config_ll *ll_root;\n \n@@ -80,6 +82,43 @@ static struct virtio_net_config_ll *ll_root;\n static uint64_t VHOST_FEATURES = VHOST_SUPPORTED_FEATURES;\n \n \n+int\n+notify_new_device(struct virtio_net *dev)\n+{\n+\tif ((pmd_notify_ops != NULL) && (pmd_notify_ops->new_device != NULL)) {\n+\t\tint ret = pmd_notify_ops->new_device(dev);\n+\t\tif (ret != 0)\n+\t\t\treturn ret;\n+\t}\n+\tif ((notify_ops != NULL) && (notify_ops->new_device != NULL))\n+\t\treturn notify_ops->new_device(dev);\n+\n+\treturn 0;\n+}\n+\n+void\n+notify_destroy_device(volatile struct virtio_net *dev)\n+{\n+\tif ((pmd_notify_ops != NULL) && (pmd_notify_ops->destroy_device != NULL))\n+\t\tpmd_notify_ops->destroy_device(dev);\n+\tif ((notify_ops != NULL) && (notify_ops->destroy_device != NULL))\n+\t\tnotify_ops->destroy_device(dev);\n+}\n+\n+int\n+notify_vring_state_changed(struct virtio_net *dev, uint16_t queue_id, int enable)\n+{\n+\tif ((pmd_notify_ops != NULL) && (pmd_notify_ops->vring_state_changed != NULL)) {\n+\t\tint ret = pmd_notify_ops->vring_state_changed(dev, queue_id, enable);\n+\t\tif (ret != 0)\n+\t\t\treturn ret;\n+\t}\n+\tif ((notify_ops != NULL) && (notify_ops->vring_state_changed != NULL))\n+\t\treturn notify_ops->vring_state_changed(dev, queue_id, enable);\n+\n+\treturn 0;\n+}\n+\n /*\n  * Converts QEMU virtual address to Vhost virtual address. This function is\n  * used to convert the ring addresses to our address space.\n@@ -377,7 +416,7 @@ destroy_device(struct vhost_device_ctx ctx)\n \t\t\t * the function to remove it from the data core.\n \t\t\t */\n \t\t\tif ((ll_dev_cur->dev.flags & VIRTIO_DEV_RUNNING))\n-\t\t\t\tnotify_ops->destroy_device(&(ll_dev_cur->dev));\n+\t\t\t\tnotify_destroy_device(&(ll_dev_cur->dev));\n \t\t\tll_dev_cur = rm_config_ll_entry(ll_dev_cur,\n \t\t\t\t\tll_dev_last);\n \t\t} else {\n@@ -793,12 +832,12 @@ set_backend(struct vhost_device_ctx ctx, struct vhost_vring_file *file)\n \tif (!(dev->flags & VIRTIO_DEV_RUNNING)) {\n \t\tif (((int)dev->virtqueue[VIRTIO_TXQ]->backend != VIRTIO_DEV_STOPPED) &&\n \t\t\t((int)dev->virtqueue[VIRTIO_RXQ]->backend != VIRTIO_DEV_STOPPED)) {\n-\t\t\treturn notify_ops->new_device(dev);\n+\t\t\treturn notify_new_device(dev);\n \t\t}\n \t/* Otherwise we remove it. */\n \t} else\n \t\tif (file->fd == VIRTIO_DEV_STOPPED)\n-\t\t\tnotify_ops->destroy_device(dev);\n+\t\t\tnotify_destroy_device(dev);\n \treturn 0;\n }\n \n@@ -882,3 +921,14 @@ rte_vhost_driver_callback_register(struct virtio_net_device_ops const * const op\n \n \treturn 0;\n }\n+\n+/*\n+ * Register ops so that we can add/remove device to data core.\n+ */\n+int\n+rte_vhost_driver_pmd_callback_register(struct virtio_net_device_ops const * const ops)\n+{\n+\tpmd_notify_ops = ops;\n+\n+\treturn 0;\n+}\ndiff --git a/lib/librte_vhost/virtio-net.h b/lib/librte_vhost/virtio-net.h\nindex 75fb57e..0816e71 100644\n--- a/lib/librte_vhost/virtio-net.h\n+++ b/lib/librte_vhost/virtio-net.h\n@@ -37,7 +37,9 @@\n #include \"vhost-net.h\"\n #include \"rte_virtio_net.h\"\n \n-struct virtio_net_device_ops const *notify_ops;\n struct virtio_net *get_device(struct vhost_device_ctx ctx);\n \n+int notify_new_device(struct virtio_net *dev);\n+void notify_destroy_device(volatile struct virtio_net *dev);\n+int notify_vring_state_changed(struct virtio_net *dev, uint16_t queue_id, int enable);\n #endif\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "1/2"
    ]
}