get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 82303,
    "url": "https://patches.dpdk.org/api/patches/82303/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1603801650-442376-17-git-send-email-suanmingm@nvidia.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": "<1603801650-442376-17-git-send-email-suanmingm@nvidia.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1603801650-442376-17-git-send-email-suanmingm@nvidia.com",
    "date": "2020-10-27T12:27:11",
    "name": "[v3,16/34] net/mlx5: make flow tag list thread safe",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ed132572e3ecd7837fdea97f4e25d456abdecba1",
    "submitter": {
        "id": 1887,
        "url": "https://patches.dpdk.org/api/people/1887/?format=api",
        "name": "Suanming Mou",
        "email": "suanmingm@nvidia.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/1603801650-442376-17-git-send-email-suanmingm@nvidia.com/mbox/",
    "series": [
        {
            "id": 13372,
            "url": "https://patches.dpdk.org/api/series/13372/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13372",
            "date": "2020-10-27T12:26:55",
            "name": "net/mlx5: support multiple-thread flow operations",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/13372/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/82303/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/82303/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 C6091A04B5;\n\tTue, 27 Oct 2020 13:33:45 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 63E6369FA;\n\tTue, 27 Oct 2020 13:29:13 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id 8477E54AE\n for <dev@dpdk.org>; Tue, 27 Oct 2020 13:28:07 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n suanmingm@nvidia.com) with SMTP; 27 Oct 2020 14:28:06 +0200",
            "from nvidia.com (mtbc-r640-04.mtbc.labs.mlnx [10.75.70.9])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09RCRZ7E024637;\n Tue, 27 Oct 2020 14:28:04 +0200"
        ],
        "From": "Suanming Mou <suanmingm@nvidia.com>",
        "To": "Matan Azrad <matan@nvidia.com>, Shahaf Shuler <shahafs@nvidia.com>,\n Viacheslav Ovsiienko <viacheslavo@nvidia.com>",
        "Cc": "dev@dpdk.org, Xueming Li <xuemingl@nvidia.com>",
        "Date": "Tue, 27 Oct 2020 20:27:11 +0800",
        "Message-Id": "<1603801650-442376-17-git-send-email-suanmingm@nvidia.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1603801650-442376-1-git-send-email-suanmingm@nvidia.com>",
        "References": "<1601984948-313027-1-git-send-email-suanmingm@nvidia.com>\n <1603801650-442376-1-git-send-email-suanmingm@nvidia.com>",
        "Subject": "[dpdk-dev] [PATCH v3 16/34] net/mlx5: make flow tag list thread safe",
        "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": "From: Xueming Li <xuemingl@nvidia.com>\n\nTo support multi-thread flow insertion, this patch updates flow tag list\nto use thread safe hash list with write-most mode.\n\nSigned-off-by: Xueming Li <xuemingl@nvidia.com>\nAcked-by: Matan Azrad <matan@nvidia.com>\n---\n drivers/net/mlx5/linux/mlx5_os.c |  5 ++-\n drivers/net/mlx5/mlx5_flow.h     |  5 +++\n drivers/net/mlx5/mlx5_flow_dv.c  | 97 +++++++++++++++++++---------------------\n 3 files changed, 56 insertions(+), 51 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c\nindex db32b39..540e1a7 100644\n--- a/drivers/net/mlx5/linux/mlx5_os.c\n+++ b/drivers/net/mlx5/linux/mlx5_os.c\n@@ -239,12 +239,15 @@\n \t/* Create tags hash list table. */\n \tsnprintf(s, sizeof(s), \"%s_tags\", sh->ibdev_name);\n \tsh->tag_table = mlx5_hlist_create(s, MLX5_TAGS_HLIST_ARRAY_SIZE, 0,\n-\t\t\t\t\t  0, NULL, NULL, NULL);\n+\t\t\t\t\t  MLX5_HLIST_WRITE_MOST,\n+\t\t\t\t\t  flow_dv_tag_create_cb, NULL,\n+\t\t\t\t\t  flow_dv_tag_remove_cb);\n \tif (!sh->tag_table) {\n \t\tDRV_LOG(ERR, \"tags with hash creation failed.\");\n \t\terr = ENOMEM;\n \t\tgoto error;\n \t}\n+\tsh->tag_table->ctx = sh;\n \tsnprintf(s, sizeof(s), \"%s_hdr_modify\", sh->ibdev_name);\n \tsh->modify_cmds = mlx5_hlist_create(s, MLX5_FLOW_HDR_MODIFY_HTABLE_SZ,\n \t\t\t\t\t    0, 0, NULL, NULL, NULL);\ndiff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 2e1e0c1..007dd31 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -1422,4 +1422,9 @@ struct mlx5_flow_tbl_resource *flow_dv_tbl_resource_get(struct rte_eth_dev *dev,\n \t\tbool external, const struct mlx5_flow_tunnel *tunnel,\n \t\tuint32_t group_id, uint8_t dummy, struct rte_flow_error *error);\n \n+struct mlx5_hlist_entry *flow_dv_tag_create_cb(struct mlx5_hlist *list,\n+\t\t\t\t\t       uint64_t key, void *cb_ctx);\n+void flow_dv_tag_remove_cb(struct mlx5_hlist *list,\n+\t\t\t   struct mlx5_hlist_entry *entry);\n+\n #endif /* RTE_PMD_MLX5_FLOW_H_ */\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 6b1eeb4..578019a 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -8215,6 +8215,35 @@ struct mlx5_flow_tbl_resource *\n \treturn 0;\n }\n \n+struct mlx5_hlist_entry *\n+flow_dv_tag_create_cb(struct mlx5_hlist *list, uint64_t key, void *ctx)\n+{\n+\tstruct mlx5_dev_ctx_shared *sh = list->ctx;\n+\tstruct rte_flow_error *error = ctx;\n+\tstruct mlx5_flow_dv_tag_resource *entry;\n+\tuint32_t idx = 0;\n+\tint ret;\n+\n+\tentry = mlx5_ipool_zmalloc(sh->ipool[MLX5_IPOOL_TAG], &idx);\n+\tif (!entry) {\n+\t\trte_flow_error_set(error, ENOMEM,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,\n+\t\t\t\t   \"cannot allocate resource memory\");\n+\t\treturn NULL;\n+\t}\n+\tentry->idx = idx;\n+\tret = mlx5_flow_os_create_flow_action_tag(key,\n+\t\t\t\t\t\t  &entry->action);\n+\tif (ret) {\n+\t\tmlx5_ipool_free(sh->ipool[MLX5_IPOOL_TAG], idx);\n+\t\trte_flow_error_set(error, ENOMEM,\n+\t\t\t\t   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t   NULL, \"cannot create action\");\n+\t\treturn NULL;\n+\t}\n+\treturn &entry->entry;\n+}\n+\n /**\n  * Find existing tag resource or create and register a new one.\n  *\n@@ -8238,54 +8267,32 @@ struct mlx5_flow_tbl_resource *\n \t\t\t struct rte_flow_error *error)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_dev_ctx_shared *sh = priv->sh;\n \tstruct mlx5_flow_dv_tag_resource *cache_resource;\n \tstruct mlx5_hlist_entry *entry;\n-\tint ret;\n \n-\t/* Lookup a matching resource from cache. */\n-\tentry = mlx5_hlist_lookup(sh->tag_table, (uint64_t)tag_be24, NULL);\n+\tentry = mlx5_hlist_register(priv->sh->tag_table, tag_be24, error);\n \tif (entry) {\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.rix_tag = 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 = mlx5_ipool_zmalloc(sh->ipool[MLX5_IPOOL_TAG],\n-\t\t\t\t       &dev_flow->handle->dvh.rix_tag);\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-\t\t\t\t\t  \"cannot allocate resource memory\");\n-\tcache_resource->entry.key = (uint64_t)tag_be24;\n-\tret = mlx5_flow_os_create_flow_action_tag(tag_be24,\n-\t\t\t\t\t\t  &cache_resource->action);\n-\tif (ret) {\n-\t\tmlx5_free(cache_resource);\n-\t\treturn rte_flow_error_set(error, ENOMEM,\n-\t\t\t\t\t  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n-\t\t\t\t\t  NULL, \"cannot create action\");\n-\t}\n-\trte_atomic32_init(&cache_resource->refcnt);\n-\trte_atomic32_inc(&cache_resource->refcnt);\n-\tif (mlx5_hlist_insert(sh->tag_table, &cache_resource->entry)) {\n-\t\tmlx5_flow_os_destroy_flow_action(cache_resource->action);\n-\t\tmlx5_free(cache_resource);\n-\t\treturn rte_flow_error_set(error, EEXIST,\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->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-\treturn 0;\n+\treturn -rte_errno;\n+}\n+\n+void\n+flow_dv_tag_remove_cb(struct mlx5_hlist *list,\n+\t\t      struct mlx5_hlist_entry *entry)\n+{\n+\tstruct mlx5_dev_ctx_shared *sh = list->ctx;\n+\tstruct mlx5_flow_dv_tag_resource *tag =\n+\t\tcontainer_of(entry, struct mlx5_flow_dv_tag_resource, entry);\n+\n+\tMLX5_ASSERT(tag && sh && tag->action);\n+\tclaim_zero(mlx5_flow_os_destroy_flow_action(tag->action));\n+\tDRV_LOG(DEBUG, \"Tag %p: removed.\", (void *)tag);\n+\tmlx5_ipool_free(sh->ipool[MLX5_IPOOL_TAG], tag->idx);\n }\n \n /**\n@@ -8304,24 +8311,14 @@ struct mlx5_flow_tbl_resource *\n \t\t    uint32_t tag_idx)\n {\n \tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_dev_ctx_shared *sh = priv->sh;\n \tstruct mlx5_flow_dv_tag_resource *tag;\n \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-\tif (rte_atomic32_dec_and_test(&tag->refcnt)) {\n-\t\tclaim_zero(mlx5_flow_os_destroy_flow_action(tag->action));\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\tmlx5_ipool_free(priv->sh->ipool[MLX5_IPOOL_TAG], tag_idx);\n-\t\treturn 0;\n-\t}\n-\treturn 1;\n+\t\tdev->data->port_id, (void *)tag, tag->entry.ref_cnt);\n+\treturn mlx5_hlist_unregister(priv->sh->tag_table, &tag->entry);\n }\n \n /**\n",
    "prefixes": [
        "v3",
        "16/34"
    ]
}