get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 65299,
    "url": "http://patches.dpdk.org/api/patches/65299/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1580292549-27439-11-git-send-email-matan@mellanox.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": "<1580292549-27439-11-git-send-email-matan@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1580292549-27439-11-git-send-email-matan@mellanox.com",
    "date": "2020-01-29T10:09:06",
    "name": "[v2,10/13] vdpa/mlx5: map doorbell",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "366ea1851bde52fd819fefcf686cdc7484ffde4b",
    "submitter": {
        "id": 796,
        "url": "http://patches.dpdk.org/api/people/796/?format=api",
        "name": "Matan Azrad",
        "email": "matan@mellanox.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/1580292549-27439-11-git-send-email-matan@mellanox.com/mbox/",
    "series": [
        {
            "id": 8335,
            "url": "http://patches.dpdk.org/api/series/8335/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8335",
            "date": "2020-01-29T10:08:56",
            "name": "Introduce mlx5 vDPA driver",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/8335/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/65299/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/65299/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B3ED9A0531;\n\tWed, 29 Jan 2020 11:11:38 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 54A861C01B;\n\tWed, 29 Jan 2020 11:10:27 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id 5E8031BFB1\n for <dev@dpdk.org>; Wed, 29 Jan 2020 11:10:24 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n asafp@mellanox.com)\n with ESMTPS (AES256-SHA encrypted); 29 Jan 2020 12:10:20 +0200",
            "from pegasus07.mtr.labs.mlnx (pegasus07.mtr.labs.mlnx\n [10.210.16.112])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 00TA9BHQ032108;\n Wed, 29 Jan 2020 12:10:20 +0200"
        ],
        "From": "Matan Azrad <matan@mellanox.com>",
        "To": "dev@dpdk.org, Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Wed, 29 Jan 2020 10:09:06 +0000",
        "Message-Id": "<1580292549-27439-11-git-send-email-matan@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1580292549-27439-1-git-send-email-matan@mellanox.com>",
        "References": "<1579539790-3882-1-git-send-email-matan@mellanox.com>\n <1580292549-27439-1-git-send-email-matan@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v2 10/13] vdpa/mlx5: map doorbell",
        "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://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The HW supports only 4 bytes doorbell writing detection.\nThe virtio device set only 2 bytes when it rings the doorbell.\n\nMap the virtio doorbell detected by the virtio queue kickfd to the HW\nVAR space when it expects to get the virtio emulation doorbell.\n\nUse the EAL interrupt mechanism to get notification when a new event\nappears in kickfd by the guest and write 4 bytes to the HW doorbell space\nin the notification callback.\n\nSigned-off-by: Matan Azrad <matan@mellanox.com>\nAcked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>\n---\n drivers/vdpa/mlx5/mlx5_vdpa.h       |  3 ++\n drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 82 ++++++++++++++++++++++++++++++++++++-\n 2 files changed, 84 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h\nindex 383a33e..af78ea1 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa.h\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa.h\n@@ -75,6 +75,7 @@ struct mlx5_vdpa_virtq {\n \t\tvoid *buf;\n \t\tuint32_t size;\n \t} umems[3];\n+\tstruct rte_intr_handle intr_handle;\n };\n \n struct mlx5_vdpa_steer {\n@@ -112,6 +113,8 @@ struct mlx5_vdpa_priv {\n \tuint16_t log_max_rqt_size;\n \tSLIST_HEAD(virtq_list, mlx5_vdpa_virtq) virtq_list;\n \tstruct mlx5_vdpa_steer steer;\n+\tstruct mlx5dv_var *var;\n+\tvoid *virtq_db_addr;\n \tSLIST_HEAD(mr_list, mlx5_vdpa_query_mr) mr_list;\n };\n \ndiff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c\nindex 60aa040..91347e9 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c\n@@ -2,9 +2,12 @@\n  * Copyright 2019 Mellanox Technologies, Ltd\n  */\n #include <string.h>\n+#include <unistd.h>\n+#include <sys/mman.h>\n \n #include <rte_malloc.h>\n #include <rte_errno.h>\n+#include <rte_io.h>\n \n #include <mlx5_common.h>\n \n@@ -12,11 +15,52 @@\n #include \"mlx5_vdpa.h\"\n \n \n+static void\n+mlx5_vdpa_virtq_handler(void *cb_arg)\n+{\n+\tstruct mlx5_vdpa_virtq *virtq = cb_arg;\n+\tstruct mlx5_vdpa_priv *priv = virtq->priv;\n+\tuint64_t buf;\n+\tint nbytes;\n+\n+\tdo {\n+\t\tnbytes = read(virtq->intr_handle.fd, &buf, 8);\n+\t\tif (nbytes < 0) {\n+\t\t\tif (errno == EINTR ||\n+\t\t\t    errno == EWOULDBLOCK ||\n+\t\t\t    errno == EAGAIN)\n+\t\t\t\tcontinue;\n+\t\t\tDRV_LOG(ERR,  \"Failed to read kickfd of virtq %d: %s\",\n+\t\t\t\tvirtq->index, strerror(errno));\n+\t\t}\n+\t\tbreak;\n+\t} while (1);\n+\trte_write32(virtq->index, priv->virtq_db_addr);\n+\tDRV_LOG(DEBUG, \"Ring virtq %u doorbell.\", virtq->index);\n+}\n+\n static int\n mlx5_vdpa_virtq_unset(struct mlx5_vdpa_virtq *virtq)\n {\n-\tunsigned int;\n+\tunsigned int i;\n+\tint retries = MLX5_VDPA_INTR_RETRIES;\n+\tint ret = -EAGAIN;\n \n+\tif (virtq->intr_handle.fd) {\n+\t\twhile (retries-- && ret == -EAGAIN) {\n+\t\t\tret = rte_intr_callback_unregister(&virtq->intr_handle,\n+\t\t\t\t\t\t\tmlx5_vdpa_virtq_handler,\n+\t\t\t\t\t\t\tvirtq);\n+\t\t\tif (ret == -EAGAIN) {\n+\t\t\t\tDRV_LOG(DEBUG, \"Try again to unregister fd %d \"\n+\t\t\t\t\t\"of virtq %d interrupt, retries = %d.\",\n+\t\t\t\t\tvirtq->intr_handle.fd,\n+\t\t\t\t\t(int)virtq->index, retries);\n+\t\t\t\tusleep(MLX5_VDPA_INTR_RETRIES_USEC);\n+\t\t\t}\n+\t\t}\n+\t\tmemset(&virtq->intr_handle, 0, sizeof(virtq->intr_handle));\n+\t}\n \tif (virtq->virtq) {\n \t\tclaim_zero(mlx5_devx_cmd_destroy(virtq->virtq));\n \t\tvirtq->virtq = NULL;\n@@ -57,6 +101,14 @@\n \t\tclaim_zero(mlx5_devx_cmd_destroy(priv->td));\n \t\tpriv->td = NULL;\n \t}\n+\tif (priv->virtq_db_addr) {\n+\t\tclaim_zero(munmap(priv->virtq_db_addr, priv->var->length));\n+\t\tpriv->virtq_db_addr = NULL;\n+\t}\n+\tif (priv->var) {\n+\t\tmlx5_glue->dv_free_var(priv->var);\n+\t\tpriv->var = NULL;\n+\t}\n \tpriv->features = 0;\n }\n \n@@ -201,6 +253,17 @@\n \tif (mlx5_vdpa_virtq_modify(virtq, 1))\n \t\tgoto error;\n \tvirtq->enable = 1;\n+\tvirtq->intr_handle.fd = vq.kickfd;\n+\tvirtq->intr_handle.type = RTE_INTR_HANDLE_EXT;\n+\tif (rte_intr_callback_register(&virtq->intr_handle,\n+\t\t\t\t       mlx5_vdpa_virtq_handler, virtq)) {\n+\t\tvirtq->intr_handle.fd = 0;\n+\t\tDRV_LOG(ERR, \"Failed to register virtq %d interrupt.\", index);\n+\t\tgoto error;\n+\t} else {\n+\t\tDRV_LOG(DEBUG, \"Register fd %d interrupt for virtq %d.\",\n+\t\t\tvirtq->intr_handle.fd, index);\n+\t}\n \treturn 0;\n error:\n \tmlx5_vdpa_virtq_unset(virtq);\n@@ -275,6 +338,23 @@\n \t\tDRV_LOG(ERR, \"Failed to configure negotiated features.\");\n \t\treturn -1;\n \t}\n+\tpriv->var = mlx5_glue->dv_alloc_var(priv->ctx, 0);\n+\tif (!priv->var) {\n+\t\tDRV_LOG(ERR, \"Failed to allocate VAR %u.\\n\", errno);\n+\t\treturn -1;\n+\t}\n+\t/* Always map the entire page. */\n+\tpriv->virtq_db_addr = mmap(NULL, priv->var->length, PROT_READ |\n+\t\t\t\t   PROT_WRITE, MAP_SHARED, priv->ctx->cmd_fd,\n+\t\t\t\t   priv->var->mmap_off);\n+\tif (priv->virtq_db_addr == MAP_FAILED) {\n+\t\tDRV_LOG(ERR, \"Failed to map doorbell page %u.\", errno);\n+\t\tpriv->virtq_db_addr = NULL;\n+\t\tgoto error;\n+\t} else {\n+\t\tDRV_LOG(DEBUG, \"VAR address of doorbell mapping is %p.\",\n+\t\t\tpriv->virtq_db_addr);\n+\t}\n \tpriv->td = mlx5_devx_cmd_create_td(priv->ctx);\n \tif (!priv->td) {\n \t\tDRV_LOG(ERR, \"Failed to create transport domain.\");\n",
    "prefixes": [
        "v2",
        "10/13"
    ]
}