get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68232,
    "url": "https://patches.dpdk.org/api/patches/68232/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1586740309-449310-7-git-send-email-suanmingm@mellanox.com/",
    "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": "<1586740309-449310-7-git-send-email-suanmingm@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1586740309-449310-7-git-send-email-suanmingm@mellanox.com",
    "date": "2020-04-13T01:11:45",
    "name": "[06/10] net/mlx5: convert tag resource to indexed",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "62d6dd7103c303fd3139f3cd5544f8a4be8e2dde",
    "submitter": {
        "id": 1358,
        "url": "https://patches.dpdk.org/api/people/1358/?format=api",
        "name": "Suanming Mou",
        "email": "suanmingm@mellanox.com"
    },
    "delegate": {
        "id": 3268,
        "url": "https://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1586740309-449310-7-git-send-email-suanmingm@mellanox.com/mbox/",
    "series": [
        {
            "id": 9321,
            "url": "https://patches.dpdk.org/api/series/9321/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9321",
            "date": "2020-04-13T01:11:39",
            "name": "net/mlx5: optimize flow resource allocation",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/9321/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/68232/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/68232/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 A4237A0577;\n\tMon, 13 Apr 2020 03:12:55 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 78BE71BEE7;\n\tMon, 13 Apr 2020 03:12:08 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 458241BEE1\n for <dev@dpdk.org>; Mon, 13 Apr 2020 03:12:07 +0200 (CEST)"
        ],
        "From": "Suanming Mou <suanmingm@mellanox.com>",
        "To": "Matan Azrad <matan@mellanox.com>, Shahaf Shuler <shahafs@mellanox.com>,\n Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "Cc": "rasland@mellanox.com,\n\tdev@dpdk.org",
        "Date": "Mon, 13 Apr 2020 09:11:45 +0800",
        "Message-Id": "<1586740309-449310-7-git-send-email-suanmingm@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1586740309-449310-1-git-send-email-suanmingm@mellanox.com>",
        "References": "<1586740309-449310-1-git-send-email-suanmingm@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH 06/10] net/mlx5: convert tag resource to indexed",
        "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": "This commit convert tag resource to indexed.\n\nAs tag resources are add in the hash list, to avoid introduce performance\nissue and keep the hash list, only the tag resource memory is allocated\nfrom indexed memory. The resources is still added to the hash list. Add\nfour bytes index in the tag resource struct and change the tag resources\nin the flow handle from pointer to uint32_t seems be no benefit for tag\nresource, but it saves memory for flows without tag action. And also for\nsub flows share one tag action resource.\n\nSigned-off-by: Suanming Mou <suanmingm@mellanox.com>\nAcked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>\n---\n drivers/net/mlx5/mlx5.c         | 11 +++++++++++\n drivers/net/mlx5/mlx5.h         |  1 +\n drivers/net/mlx5/mlx5_flow.h    |  7 +++++--\n drivers/net/mlx5/mlx5_flow_dv.c | 27 +++++++++++++++++----------\n 4 files changed, 34 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 3a26378..798df18 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -217,6 +217,17 @@ struct mlx5_dev_spawn_data {\n \t\t.free = rte_free,\n \t\t.type = \"mlx5_push_vlan_ipool\",\n \t},\n+\t{\n+\t\t.size = sizeof(struct mlx5_flow_dv_tag_resource),\n+\t\t.trunk_size = 64,\n+\t\t.grow_trunk = 3,\n+\t\t.grow_shift = 2,\n+\t\t.need_lock = 0,\n+\t\t.release_mem_en = 1,\n+\t\t.malloc = rte_malloc_socket,\n+\t\t.free = rte_free,\n+\t\t.type = \"mlx5_tag_ipool\",\n+\t},\n };\n \n \ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 10e9071..6c25d6a 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -54,6 +54,7 @@ enum mlx5_mp_req_type {\n enum mlx5_ipool_index {\n \tMLX5_IPOOL_DECAP_ENCAP = 0, /* Pool for encap/decap resource. */\n \tMLX5_IPOOL_PUSH_VLAN, /* Pool for push vlan resource. */\n+\tMLX5_IPOOL_TAG, /* Pool for tag resource. */\n \tMLX5_IPOOL_MAX,\n };\n \ndiff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 8d169fe..6364bfe 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -383,6 +383,7 @@ struct mlx5_flow_dv_tag_resource {\n \tvoid *action;\n \t/**< Verbs tag action object. */\n \trte_atomic32_t refcnt; /**< Reference counter. */\n+\tuint32_t idx; /**< Index for the index memory pool. */\n };\n \n /*\n@@ -494,8 +495,8 @@ struct mlx5_flow_handle_dv {\n \t/**< Structure for VF VLAN workaround. */\n \tuint32_t push_vlan_res;\n \t/**< Index to push VLAN action resource in cache. */\n-\tstruct mlx5_flow_dv_tag_resource *tag_resource;\n-\t/**< pointer to the tag action. */\n+\tuint32_t tag_resource;\n+\t/**< Index to the tag action. */\n };\n \n /** Device flow handle structure: used both for creating & destroying. */\n@@ -547,6 +548,8 @@ struct mlx5_flow_dv_workspace {\n \t/**< Pointer to encap/decap resource in cache. */\n \tstruct mlx5_flow_dv_push_vlan_action_resource *push_vlan_res;\n \t/**< Pointer to push VLAN action resource in cache. */\n+\tstruct mlx5_flow_dv_tag_resource *tag_resource;\n+\t/**< pointer to the tag action. */\n \tstruct mlx5_flow_dv_match_params value;\n \t/**< Holds the value that the packet is compared to. */\n };\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 9965374..07ec629 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -7073,14 +7073,16 @@ struct field_modify_info modify_tcp[] = {\n \t\tcache_resource = container_of\n \t\t\t(entry, struct mlx5_flow_dv_tag_resource, entry);\n \t\trte_atomic32_inc(&cache_resource->refcnt);\n-\t\tdev_flow->handle->dvh.tag_resource = cache_resource;\n+\t\tdev_flow->handle->dvh.tag_resource = cache_resource->idx;\n+\t\tdev_flow->dv.tag_resource = cache_resource;\n \t\tDRV_LOG(DEBUG, \"cached tag resource %p: refcnt now %d++\",\n \t\t\t(void *)cache_resource,\n \t\t\trte_atomic32_read(&cache_resource->refcnt));\n \t\treturn 0;\n \t}\n \t/* Register new resource. */\n-\tcache_resource = rte_calloc(__func__, 1, sizeof(*cache_resource), 0);\n+\tcache_resource = mlx5_ipool_zmalloc(sh->ipool[MLX5_IPOOL_TAG],\n+\t\t\t\t       &dev_flow->handle->dvh.tag_resource);\n \tif (!cache_resource)\n \t\treturn rte_flow_error_set(error, ENOMEM,\n \t\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\n@@ -7102,7 +7104,7 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n \t\t\t\t\t  NULL, \"cannot insert tag\");\n \t}\n-\tdev_flow->handle->dvh.tag_resource = cache_resource;\n+\tdev_flow->dv.tag_resource = cache_resource;\n \tDRV_LOG(DEBUG, \"new tag resource %p: refcnt now %d++\",\n \t\t(void *)cache_resource,\n \t\trte_atomic32_read(&cache_resource->refcnt));\n@@ -7114,20 +7116,23 @@ struct field_modify_info modify_tcp[] = {\n  *\n  * @param dev\n  *   Pointer to Ethernet device.\n- * @param flow\n- *   Pointer to mlx5_flow.\n+ * @param tag_idx\n+ *   Tag index.\n  *\n  * @return\n  *   1 while a reference on it exists, 0 when freed.\n  */\n static int\n flow_dv_tag_release(struct rte_eth_dev *dev,\n-\t\t    struct mlx5_flow_dv_tag_resource *tag)\n+\t\t    uint32_t tag_idx)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n \tstruct mlx5_ibv_shared *sh = priv->sh;\n+\tstruct mlx5_flow_dv_tag_resource *tag;\n \n-\tMLX5_ASSERT(tag);\n+\ttag = mlx5_ipool_get(priv->sh->ipool[MLX5_IPOOL_TAG], tag_idx);\n+\tif (!tag)\n+\t\treturn 0;\n \tDRV_LOG(DEBUG, \"port %u tag %p: refcnt %d--\",\n \t\tdev->data->port_id, (void *)tag,\n \t\trte_atomic32_read(&tag->refcnt));\n@@ -7136,7 +7141,7 @@ struct field_modify_info modify_tcp[] = {\n \t\tmlx5_hlist_remove(sh->tag_table, &tag->entry);\n \t\tDRV_LOG(DEBUG, \"port %u tag %p: removed\",\n \t\t\tdev->data->port_id, (void *)tag);\n-\t\trte_free(tag);\n+\t\tmlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_TAG], tag_idx);\n \t\treturn 0;\n \t}\n \treturn 1;\n@@ -7433,8 +7438,9 @@ struct field_modify_info modify_tcp[] = {\n \t\t\tif (flow_dv_tag_resource_register(dev, tag_be,\n \t\t\t\t\t\t\t  dev_flow, error))\n \t\t\t\treturn -rte_errno;\n+\t\t\tMLX5_ASSERT(dev_flow->dv.tag_resource);\n \t\t\tdev_flow->dv.actions[actions_n++] =\n-\t\t\t\t\thandle->dvh.tag_resource->action;\n+\t\t\t\t\tdev_flow->dv.tag_resource->action;\n \t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_MARK:\n \t\t\taction_flags |= MLX5_FLOW_ACTION_MARK;\n@@ -7460,8 +7466,9 @@ struct field_modify_info modify_tcp[] = {\n \t\t\tif (flow_dv_tag_resource_register(dev, tag_be,\n \t\t\t\t\t\t\t  dev_flow, error))\n \t\t\t\treturn -rte_errno;\n+\t\t\tMLX5_ASSERT(dev_flow->dv.tag_resource);\n \t\t\tdev_flow->dv.actions[actions_n++] =\n-\t\t\t\t\thandle->dvh.tag_resource->action;\n+\t\t\t\t\tdev_flow->dv.tag_resource->action;\n \t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_SET_META:\n \t\t\tif (flow_dv_convert_action_set_meta\n",
    "prefixes": [
        "06/10"
    ]
}