get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 64964,
    "url": "http://patches.dpdk.org/api/patches/64964/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1579539790-3882-30-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": "<1579539790-3882-30-git-send-email-matan@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1579539790-3882-30-git-send-email-matan@mellanox.com",
    "date": "2020-01-20T17:03:01",
    "name": "[v1,29/38] vdpa/mlx5: support queue state operation",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5018ad4657bf6a8f9e62365a8dfd511a2ceb03cf",
    "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/1579539790-3882-30-git-send-email-matan@mellanox.com/mbox/",
    "series": [
        {
            "id": 8223,
            "url": "http://patches.dpdk.org/api/series/8223/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8223",
            "date": "2020-01-20T17:02:37",
            "name": "Introduce mlx5 vDPA driver",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/8223/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/64964/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/64964/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 D9E5FA0526;\n\tMon, 20 Jan 2020 18:08:11 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8F41B1C0B3;\n\tMon, 20 Jan 2020 18:04:04 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id BE1E51BFAE\n for <dev@dpdk.org>; Mon, 20 Jan 2020 18:03:14 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n asafp@mellanox.com)\n with ESMTPS (AES256-SHA encrypted); 20 Jan 2020 19:03:13 +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 00KH3BGm024424;\n Mon, 20 Jan 2020 19:03:13 +0200"
        ],
        "From": "Matan Azrad <matan@mellanox.com>",
        "To": "dev@dpdk.org",
        "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n Thomas Monjalon <thomas@monjalon.net>",
        "Date": "Mon, 20 Jan 2020 17:03:01 +0000",
        "Message-Id": "<1579539790-3882-30-git-send-email-matan@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1579539790-3882-1-git-send-email-matan@mellanox.com>",
        "References": "<1579539790-3882-1-git-send-email-matan@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v1 29/38] vdpa/mlx5: support queue state operation",
        "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": "Add support for set_vring_state operation.\n\nUsing DevX API the virtq state can be changed as described in PRM:\n\tenable - move to ready state.\n\tdisable - move to suspend state.\n\nSigned-off-by: Matan Azrad <matan@mellanox.com>\n---\n drivers/vdpa/mlx5/mlx5_vdpa.c       | 23 ++++++++++++++++++++++-\n drivers/vdpa/mlx5/mlx5_vdpa.h       | 15 +++++++++++++++\n drivers/vdpa/mlx5/mlx5_vdpa_steer.c | 22 ++++++++++++++++++++--\n drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 25 +++++++++++++++++++++----\n 4 files changed, 78 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c\nindex d6014fc..8f078e5 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa.c\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c\n@@ -106,13 +106,34 @@\n \treturn 0;\n }\n \n+static int\n+mlx5_vdpa_set_vring_state(int vid, int vring, int state)\n+{\n+\tint did = rte_vhost_get_vdpa_device_id(vid);\n+\tstruct mlx5_vdpa_priv *priv = mlx5_vdpa_find_priv_resource_by_did(did);\n+\tstruct mlx5_vdpa_virtq *virtq = NULL;\n+\n+\tif (priv == NULL) {\n+\t\tDRV_LOG(ERR, \"Invalid device id: %d.\", did);\n+\t\treturn -EINVAL;\n+\t}\n+\tSLIST_FOREACH(virtq, &priv->virtq_list, next)\n+\t\tif (virtq->index == vring)\n+\t\t\tbreak;\n+\tif (!virtq) {\n+\t\tDRV_LOG(ERR, \"Invalid or unconfigured vring id: %d.\", vring);\n+\t\treturn -EINVAL;\n+\t}\n+\treturn mlx5_vdpa_virtq_enable(virtq, state);\n+}\n+\n static struct rte_vdpa_dev_ops mlx5_vdpa_ops = {\n \t.get_queue_num = mlx5_vdpa_get_queue_num,\n \t.get_features = mlx5_vdpa_get_vdpa_features,\n \t.get_protocol_features = mlx5_vdpa_get_protocol_features,\n \t.dev_conf = NULL,\n \t.dev_close = NULL,\n-\t.set_vring_state = NULL,\n+\t.set_vring_state = mlx5_vdpa_set_vring_state,\n \t.set_features = NULL,\n \t.migration_done = NULL,\n \t.get_vfio_group_fd = NULL,\ndiff --git a/drivers/vdpa/mlx5/mlx5_vdpa.h b/drivers/vdpa/mlx5/mlx5_vdpa.h\nindex 0f91682..318f1e8 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa.h\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa.h\n@@ -55,8 +55,10 @@ struct mlx5_vdpa_query_mr {\n \n struct mlx5_vdpa_virtq {\n \tSLIST_ENTRY(mlx5_vdpa_virtq) next;\n+\tuint8_t enable;\n \tuint16_t index;\n \tuint16_t vq_size;\n+\tstruct mlx5_vdpa_priv *priv;\n \tstruct mlx5_devx_obj *virtq;\n \tstruct mlx5_vdpa_cq cq;\n \tstruct {\n@@ -198,6 +200,19 @@ int mlx5_vdpa_cq_create(struct mlx5_vdpa_priv *priv, uint16_t desc_n,\n int mlx5_vdpa_virtqs_prepare(struct mlx5_vdpa_priv *priv);\n \n /**\n+ * Enable\\Disable virtq..\n+ *\n+ * @param[in] virtq\n+ *   The vdpa driver private virtq structure.\n+ * @param[in] enable\n+ *   Set to enable, otherwise disable.\n+ *\n+ * @return\n+ *   0 on success, a negative value otherwise.\n+ */\n+int mlx5_vdpa_virtq_enable(struct mlx5_vdpa_virtq *virtq, int enable);\n+\n+/**\n  * Unset steering and release all its related resources- stop traffic.\n  *\n  * @param[in] priv\ndiff --git a/drivers/vdpa/mlx5/mlx5_vdpa_steer.c b/drivers/vdpa/mlx5/mlx5_vdpa_steer.c\nindex b3cfebd..37b7668 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa_steer.c\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa_steer.c\n@@ -78,7 +78,7 @@\n }\n \n #define MLX5_VDPA_DEFAULT_RQT_SIZE 512\n-static int __rte_unused\n+static int\n mlx5_vdpa_rqt_prepare(struct mlx5_vdpa_priv *priv)\n {\n \tstruct mlx5_vdpa_virtq *virtq;\n@@ -96,7 +96,8 @@\n \t\treturn -ENOMEM;\n \t}\n \tSLIST_FOREACH(virtq, &priv->virtq_list, next) {\n-\t\tif (is_virtq_recvq(virtq->index, priv->nr_virtqs)) {\n+\t\tif (is_virtq_recvq(virtq->index, priv->nr_virtqs) &&\n+\t\t    virtq->enable) {\n \t\t\tattr->rq_list[i] = virtq->virtq->id;\n \t\t\ti++;\n \t\t}\n@@ -121,6 +122,23 @@\n \treturn ret;\n }\n \n+int\n+mlx5_vdpa_virtq_enable(struct mlx5_vdpa_virtq *virtq, int enable)\n+{\n+\tstruct mlx5_vdpa_priv *priv = virtq->priv;\n+\tint ret = 0;\n+\n+\tif (virtq->enable == !!enable)\n+\t\treturn 0;\n+\tvirtq->enable = !!enable;\n+\tif (is_virtq_recvq(virtq->index, priv->nr_virtqs)) {\n+\t\tret = mlx5_vdpa_rqt_prepare(priv);\n+\t\tif (ret)\n+\t\t\tvirtq->enable = !enable;\n+\t}\n+\treturn ret;\n+}\n+\n static int __rte_unused\n mlx5_vdpa_rss_flows_create(struct mlx5_vdpa_priv *priv)\n {\ndiff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c\nindex 332913c..a294117 100644\n--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c\n+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c\n@@ -15,14 +15,14 @@\n mlx5_vdpa_virtq_unset(struct mlx5_vdpa_virtq *virtq)\n {\n \tint ret __rte_unused;\n-\tint i;\n+\tunsigned i;\n \n \tif (virtq->virtq) {\n \t\tret = mlx5_devx_cmd_destroy(virtq->virtq);\n \t\tassert(!ret);\n \t\tvirtq->virtq = NULL;\n \t}\n-\tfor (i = 0; i < 3; ++i) {\n+\tfor (i = 0; i < RTE_DIM(virtq->umems); ++i) {\n \t\tif (virtq->umems[i].obj) {\n \t\t\tret = mlx5_glue->devx_umem_dereg(virtq->umems[i].obj);\n \t\t\tassert(!ret);\n@@ -65,6 +65,19 @@\n \tpriv->features = 0;\n }\n \n+static int\n+mlx5_vdpa_virtq_modify(struct mlx5_vdpa_virtq *virtq, int state)\n+{\n+\tstruct mlx5_devx_virtq_attr attr = {\n+\t\t\t.type = MLX5_VIRTQ_MODIFY_TYPE_STATE,\n+\t\t\t.state = state ? MLX5_VIRTQ_STATE_RDY :\n+\t\t\t\t\t MLX5_VIRTQ_STATE_SUSPEND,\n+\t\t\t.queue_index = virtq->index,\n+\t};\n+\n+\treturn mlx5_devx_cmd_modify_virtq(virtq->virtq, &attr);\n+}\n+\n static uint64_t\n mlx5_vdpa_hva_to_gpa(struct rte_vhost_memory *mem, uint64_t hva)\n {\n@@ -91,7 +104,7 @@\n \tstruct mlx5_devx_virtq_attr attr = {0};\n \tuint64_t gpa;\n \tint ret;\n-\tint i;\n+\tunsigned i;\n \tuint16_t last_avail_idx;\n \tuint16_t last_used_idx;\n \n@@ -130,7 +143,7 @@\n \t\t\t\" need CQ and event mechanism.\", index);\n \t}\n \t/* Setup 3 UMEMs for each virtq. */\n-\tfor (i = 0; i < 3; ++i) {\n+\tfor (i = 0; i < RTE_DIM(virtq->umems); ++i) {\n \t\tvirtq->umems[i].size = priv->caps.umems[i].a * vq.size +\n \t\t\t\t\t\t\t  priv->caps.umems[i].b;\n \t\tassert(virtq->umems[i].size);\n@@ -188,8 +201,12 @@\n \tattr.tis_id = priv->tis->id;\n \tattr.queue_index = index;\n \tvirtq->virtq = mlx5_devx_cmd_create_virtq(priv->ctx, &attr);\n+\tvirtq->priv = priv;\n \tif (!virtq->virtq)\n \t\tgoto error;\n+\tif (mlx5_vdpa_virtq_modify(virtq, 1))\n+\t\tgoto error;\n+\tvirtq->enable = 1;\n \treturn 0;\n error:\n \tmlx5_vdpa_virtq_unset(virtq);\n",
    "prefixes": [
        "v1",
        "29/38"
    ]
}