get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 35334,
    "url": "http://patches.dpdk.org/api/patches/35334/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1519293583-54933-1-git-send-email-junjie.j.chen@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": "<1519293583-54933-1-git-send-email-junjie.j.chen@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1519293583-54933-1-git-send-email-junjie.j.chen@intel.com",
    "date": "2018-02-22T09:59:43",
    "name": "[dpdk-dev] vhost: add support for interrupt mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4bbaaf2c974ddadcee611feb8fdb49c73d9388cb",
    "submitter": {
        "id": 903,
        "url": "http://patches.dpdk.org/api/people/903/?format=api",
        "name": null,
        "email": "junjie.j.chen@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/1519293583-54933-1-git-send-email-junjie.j.chen@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/35334/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/35334/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 5E53EA84F;\n\tThu, 22 Feb 2018 03:21:10 +0100 (CET)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id D5DB0A493\n\tfor <dev@dpdk.org>; Thu, 22 Feb 2018 03:21:08 +0100 (CET)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t21 Feb 2018 18:21:06 -0800",
            "from dpdk-dev.sh.intel.com ([10.67.111.147])\n\tby fmsmga006.fm.intel.com with ESMTP; 21 Feb 2018 18:21:05 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.47,376,1515484800\"; d=\"scan'208\";a=\"206063864\"",
        "From": "Junjie Chen <junjie.j.chen@intel.com>",
        "To": "mtetsuyah@gmail.com, yliu@fridaylinux.org,\n\tmaxime.coquelin@redhat.com, jianfeng.tan.intel.com@dpdk.org",
        "Cc": "dev@dpdk.org,\n\tJunjie Chen <junjie.j.chen@intel.com>",
        "Date": "Thu, 22 Feb 2018 04:59:43 -0500",
        "Message-Id": "<1519293583-54933-1-git-send-email-junjie.j.chen@intel.com>",
        "X-Mailer": "git-send-email 2.0.1",
        "Subject": "[dpdk-dev] [PATCH] vhost: add support for interrupt mode",
        "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": "In some cases we want vhost dequeue work in interrupt mode to\nrelease cpus to others when no data to transmit. So we install\ninterrupt handler of vhost device and interrupt vectors for each\nrx queue when creating new backend according to vhost intrerupt\nconfiguration. Thus, applications could register a epoll event fd\nto associate rx queues with interrupt vectors.\n\nSigned-off-by: Junjie Chen <junjie.j.chen@intel.com>\n---\n drivers/net/vhost/rte_eth_vhost.c | 116 ++++++++++++++++++++++++++++++++++++++\n 1 file changed, 116 insertions(+)",
    "diff": "diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c\nindex 4e541e3..f474235 100644\n--- a/drivers/net/vhost/rte_eth_vhost.c\n+++ b/drivers/net/vhost/rte_eth_vhost.c\n@@ -552,12 +552,115 @@ update_queuing_status(struct rte_eth_dev *dev)\n }\n \n static int\n+eth_rxq_intr_enable(struct rte_eth_dev *dev, uint16_t qid)\n+{\n+\tstruct rte_vhost_vring vring;\n+\tstruct vhost_queue *vq;\n+\n+\tvq = dev->data->rx_queues[qid];\n+\tif (!vq) {\n+\t\tRTE_LOG(ERR, PMD, \"rxq%d is not setup\", qid);\n+\t\treturn -1;\n+\t}\n+\n+\trte_vhost_get_vhost_vring(vq->vid, qid << 1, &vring);\n+\tvring.avail->flags &= (~VRING_AVAIL_F_NO_INTERRUPT);\n+\trte_wmb();\n+\n+\treturn 0;\n+}\n+\n+static int\n+eth_rxq_intr_disable(struct rte_eth_dev *dev, uint16_t qid)\n+{\n+\tstruct rte_vhost_vring vring;\n+\tstruct vhost_queue *vq;\n+\n+\tvq = dev->data->rx_queues[qid];\n+\tif (!vq) {\n+\t\tRTE_LOG(ERR, PMD, \"rxq%d is not setup\", qid);\n+\t\treturn -1;\n+\t}\n+\n+\trte_vhost_get_vhost_vring(vq->vid, qid << 1, &vring);\n+\tvring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;\n+\trte_wmb();\n+\n+\treturn 0;\n+}\n+\n+static void\n+eth_vhost_uninstall_intr(struct rte_eth_dev *dev)\n+{\n+\tstruct rte_intr_handle *intr_handle = dev->intr_handle;\n+\n+\tif (intr_handle) {\n+\t\tif (intr_handle->intr_vec)\n+\t\t\tfree(intr_handle->intr_vec);\n+\t\tfree(intr_handle);\n+\t}\n+\n+\tdev->intr_handle = NULL;\n+}\n+\n+static int\n+eth_vhost_install_intr(struct rte_eth_dev *dev)\n+{\n+\tstruct rte_vhost_vring vring;\n+\tstruct vhost_queue *vq;\n+\tint count = 0;\n+\tint nb_rxq = dev->data->nb_rx_queues;\n+\tint i;\n+\tint ret;\n+\n+\t/* uninstall firstly if we are reconnecting */\n+\tif (dev->intr_handle)\n+\t\teth_vhost_uninstall_intr(dev);\n+\n+\tdev->intr_handle = malloc(sizeof(*dev->intr_handle));\n+\tif (!dev->intr_handle) {\n+\t\tRTE_LOG(ERR, PMD, \"fail to allocate intr_handle\");\n+\t\treturn -ENOMEM;\n+\t}\n+\tmemset(dev->intr_handle, 0, sizeof(*dev->intr_handle));\n+\n+\tdev->intr_handle->intr_vec =\n+\t\tmalloc(nb_rxq * sizeof(dev->intr_handle->intr_vec[0]));\n+\n+\tif (!dev->intr_handle->intr_vec) {\n+\t\tRTE_LOG(ERR, PMD,\n+\t\t\t\"failed to allocate memory for interrupt vector\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tfor (i = 0; i < nb_rxq; i++) {\n+\t\tvq = dev->data->rx_queues[i];\n+\t\tif (!vq)\n+\t\t\tcontinue;\n+\t\tret = rte_vhost_get_vhost_vring(vq->vid, i << 1, &vring);\n+\t\tif (ret < 0)\n+\t\t\tcontinue;\n+\t\tRTE_LOG(INFO, PMD, \"install intr vec for rxq%d\", i);\n+\t\tdev->intr_handle->intr_vec[i] = RTE_INTR_VEC_RXTX_OFFSET + i;\n+\t\tdev->intr_handle->efds[i] = vring.callfd;\n+\t\tcount++;\n+\t}\n+\n+\tdev->intr_handle->nb_efd = count;\n+\tdev->intr_handle->max_intr = count + 1;\n+\tdev->intr_handle->type = RTE_INTR_HANDLE_VDEV;\n+\n+\treturn 0;\n+}\n+\n+static int\n new_device(int vid)\n {\n \tstruct rte_eth_dev *eth_dev;\n \tstruct internal_list *list;\n \tstruct pmd_internal *internal;\n \tstruct vhost_queue *vq;\n+\tstruct rte_eth_conf *dev_conf;\n \tunsigned i;\n \tchar ifname[PATH_MAX];\n #ifdef RTE_LIBRTE_VHOST_NUMA\n@@ -609,6 +712,15 @@ new_device(int vid)\n \n \tRTE_LOG(INFO, PMD, \"New connection established\\n\");\n \n+\tdev_conf = &eth_dev->data->dev_conf;\n+\n+\tif (dev_conf->intr_conf.rxq) {\n+\t\tif (eth_vhost_install_intr(eth_dev) < 0) {\n+\t\t\tRTE_LOG(INFO, PMD, \"Failed to prepare intr handler.\");\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n \t_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);\n \n \treturn 0;\n@@ -663,6 +775,8 @@ destroy_device(int vid)\n \n \tRTE_LOG(INFO, PMD, \"Connection closed\\n\");\n \n+\teth_vhost_uninstall_intr(eth_dev);\n+\n \t_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);\n }\n \n@@ -1007,6 +1121,8 @@ static const struct eth_dev_ops ops = {\n \t.xstats_reset = vhost_dev_xstats_reset,\n \t.xstats_get = vhost_dev_xstats_get,\n \t.xstats_get_names = vhost_dev_xstats_get_names,\n+\t.rx_queue_intr_enable = eth_rxq_intr_enable,\n+\t.rx_queue_intr_disable = eth_rxq_intr_disable,\n };\n \n static struct rte_vdev_driver pmd_vhost_drv;\n",
    "prefixes": [
        "dpdk-dev"
    ]
}