get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 8039,
    "url": "https://patches.dpdk.org/api/patches/8039/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445926375-18986-3-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": "<1445926375-18986-3-git-send-email-mukawa@igel.co.jp>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1445926375-18986-3-git-send-email-mukawa@igel.co.jp",
    "date": "2015-10-27T06:12:54",
    "name": "[dpdk-dev,2/3] vhost: Add callback and private data for vhost PMD",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "1f24f337bb43dae547dc59d5be110ff13aa66171",
    "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/1445926375-18986-3-git-send-email-mukawa@igel.co.jp/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/8039/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/8039/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 3B72B8DA8;\n\tTue, 27 Oct 2015 07:13:18 +0100 (CET)",
            "from mail-pa0-f44.google.com (mail-pa0-f44.google.com\n\t[209.85.220.44]) by dpdk.org (Postfix) with ESMTP id A37A38DA8\n\tfor <dev@dpdk.org>; Tue, 27 Oct 2015 07:13:15 +0100 (CET)",
            "by pabla5 with SMTP id la5so19060863pab.0\n\tfor <dev@dpdk.org>; Mon, 26 Oct 2015 23:13:15 -0700 (PDT)",
            "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby smtp.gmail.com with ESMTPSA id\n\tcn4sm37312954pbc.94.2015.10.26.23.13.12\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tMon, 26 Oct 2015 23:13:14 -0700 (PDT)"
        ],
        "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=HSLfo5aJfZ7S3SiGTckRX65UxuA0eKOkAgk6DeUJcCk=;\n\tb=YgSQRQ4SfnRigJcck3xbJbu6g8owg4+mS/tfGqD1P9VdIgoOO1FZ4iy56vFe0XVtse\n\tmOWZMaNsTVzJ44NDEfryX/0rPLl4mEKiF1Fix5/HkAF/CkUwpOqEo3G927RKz1IcRdUf\n\tG1VdW/WocoHWMHfnkbDQXGFSUrnD0Gmj+VwdPrdhjbdM7bT3Tsx6Cbqaf+3JrgE9yy68\n\tziQsaisVbrvv2Vn/k6luH3Hsqp2PWmZEjUgpO8dR/mzUnjVKcHB7fzmSIri8bTHdd2Sg\n\tH/YspMLv5RIFnbBKeUnWaKy5vUyQBi9bu/61Zvb44KDFRc1U+ELmn/gyIxndoGJBWTGP\n\t8rEQ==",
        "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=HSLfo5aJfZ7S3SiGTckRX65UxuA0eKOkAgk6DeUJcCk=;\n\tb=FD0F1pFqqbcGJgZ9z48uGQ3DAcA0qPD2TrvkMENeUze8UO84tALGLsIbB3wwbHreWQ\n\tOk/61IJeGUgkf+OijRNF4KYrn0o+UwFgTT3YPRbCnkY2V3fQwMxLp1v2D8gf1kxfq0HO\n\tjjQldpYHmCIXRPgzLKXgOqsHb353Mi2WT5/ALBUQlr7z8t0xuRJ+qhst1O5jHQCv9u1w\n\tODU4Cuz7mtDVPlaeYHYs5jpFbwopGl1LN85Zpqn+yOuE13n9h9uUhsJoHFh8y5Gdg3S8\n\tu5Pi/paHh0ITNa0ZlaOTcUyWdn34T9rDUZp9KQOd/3/dbqWzl2erNNror333FICZt+Su\n\tNB7g==",
        "X-Gm-Message-State": "ALoCoQkpbZ5ZL9HOxphlwtUdrZzPrCoP6SjQgsFh3L7GgPANygHKpp0NO6kQPkUmRKjOlIfbkZ0I",
        "X-Received": "by 10.66.194.105 with SMTP id hv9mr25898811pac.79.1445926394987; \n\tMon, 26 Oct 2015 23:13:14 -0700 (PDT)",
        "From": "Tetsuya Mukawa <mukawa@igel.co.jp>",
        "To": "dev@dpdk.org",
        "Date": "Tue, 27 Oct 2015 15:12:54 +0900",
        "Message-Id": "<1445926375-18986-3-git-send-email-mukawa@igel.co.jp>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1445926375-18986-1-git-send-email-mukawa@igel.co.jp>",
        "References": "<1445507150-1481-2-git-send-email-mukawa@igel.co.jp>\n\t<1445926375-18986-1-git-send-email-mukawa@igel.co.jp>",
        "Cc": "ann.zhuangyanying@huawei.com",
        "Subject": "[dpdk-dev] [PATCH 2/3] 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 426a70d..08e77af 100644\n--- a/lib/librte_vhost/rte_virtio_net.h\n+++ b/lib/librte_vhost/rte_virtio_net.h\n@@ -106,6 +106,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[VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX];\t/**< Contains all virtqueue information. */\n } __rte_cache_aligned;\n \n@@ -202,6 +203,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 3e8dfea..dad083b 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@@ -307,7 +307,7 @@ user_get_vring_base(struct vhost_device_ctx ctx,\n \tif ((dev->flags & VIRTIO_DEV_RUNNING) &&\n \t\t\t(dev->virtqueue[base_idx + VIRTIO_RXQ]->kickfd == -1) &&\n \t\t\t(dev->virtqueue[base_idx + VIRTIO_TXQ]->kickfd == -1))\n-\t\tnotify_ops->destroy_device(dev);\n+\t\tnotify_destroy_device(dev);\n \n \treturn 0;\n }\n@@ -328,10 +328,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@@ -345,7 +342,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 ee2e84d..de5d8ff 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@@ -794,12 +833,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[base_idx + VIRTIO_RXQ]->backend != VIRTIO_DEV_STOPPED) &&\n \t\t\t((int)dev->virtqueue[base_idx + VIRTIO_TXQ]->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@@ -883,3 +922,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",
        "2/3"
    ]
}