get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 65472,
    "url": "http://patches.dpdk.org/api/patches/65472/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1580659433-25581-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": "<1580659433-25581-11-git-send-email-matan@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1580659433-25581-11-git-send-email-matan@mellanox.com",
    "date": "2020-02-02T16:03:50",
    "name": "[v3,10/13] vdpa/mlx5: map doorbell",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e035873fe14ff209f5f62e9ee008f3b68207d849",
    "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/1580659433-25581-11-git-send-email-matan@mellanox.com/mbox/",
    "series": [
        {
            "id": 8390,
            "url": "http://patches.dpdk.org/api/series/8390/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8390",
            "date": "2020-02-02T16:03:40",
            "name": "Introduce mlx5 vDPA driver",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/8390/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/65472/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/65472/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 A911FA04FA;\n\tSun,  2 Feb 2020 17:05:55 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 426441C132;\n\tSun,  2 Feb 2020 17:04:45 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id A37001BFE0\n for <dev@dpdk.org>; Sun,  2 Feb 2020 17:04:42 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n asafp@mellanox.com)\n with ESMTPS (AES256-SHA encrypted); 2 Feb 2020 18:04:41 +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 012G3uj8032300;\n Sun, 2 Feb 2020 18:04:41 +0200"
        ],
        "From": "Matan Azrad <matan@mellanox.com>",
        "To": "dev@dpdk.org, Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Date": "Sun,  2 Feb 2020 16:03:50 +0000",
        "Message-Id": "<1580659433-25581-11-git-send-email-matan@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1580659433-25581-1-git-send-email-matan@mellanox.com>",
        "References": "<1580292549-27439-1-git-send-email-matan@mellanox.com>\n <1580659433-25581-1-git-send-email-matan@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v3 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>\nAcked-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n drivers/vdpa/mlx5/mlx5_vdpa.h       |  3 ++\n drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 80 +++++++++++++++++++++++++++++++++++++\n 2 files changed, 83 insertions(+)",
    "diff": "diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h\nindex 629a282..5424be5 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa.h\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa.h\n@@ -81,6 +81,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@@ -118,6 +119,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 9967be3..32a13ce 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 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": [
        "v3",
        "10/13"
    ]
}