get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 62736,
    "url": "http://patches.dpdk.org/api/patches/62736/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1573188297-51428-3-git-send-email-bingz@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": "<1573188297-51428-3-git-send-email-bingz@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1573188297-51428-3-git-send-email-bingz@mellanox.com",
    "date": "2019-11-08T04:44:56",
    "name": "[2/3] net/mlx5: reorganize jump table resources",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "fc74802a7b70360967fdc170f60caac21e0b4a79",
    "submitter": {
        "id": 1357,
        "url": "http://patches.dpdk.org/api/people/1357/?format=api",
        "name": "Bing Zhao",
        "email": "bingz@mellanox.com"
    },
    "delegate": {
        "id": 3268,
        "url": "http://patches.dpdk.org/api/users/3268/?format=api",
        "username": "rasland",
        "first_name": "Raslan",
        "last_name": "Darawsheh",
        "email": "rasland@nvidia.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1573188297-51428-3-git-send-email-bingz@mellanox.com/mbox/",
    "series": [
        {
            "id": 7345,
            "url": "http://patches.dpdk.org/api/series/7345/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7345",
            "date": "2019-11-08T04:44:54",
            "name": "Reorganize resources of flow tables",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/7345/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/62736/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/62736/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 D2910A04AB;\n\tFri,  8 Nov 2019 05:45:24 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 54F011BF94;\n\tFri,  8 Nov 2019 05:45:15 +0100 (CET)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n by dpdk.org (Postfix) with ESMTP id 2D0C11BF5A\n for <dev@dpdk.org>; Fri,  8 Nov 2019 05:45:11 +0100 (CET)"
        ],
        "From": "Bing Zhao <bingz@mellanox.com>",
        "To": "viacheslavo@mellanox.com",
        "Cc": "orika@mellanox.com,\n\trasland@mellanox.com,\n\tdev@dpdk.org",
        "Date": "Fri,  8 Nov 2019 06:44:56 +0200",
        "Message-Id": "<1573188297-51428-3-git-send-email-bingz@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1573188297-51428-1-git-send-email-bingz@mellanox.com>",
        "References": "<1573188297-51428-1-git-send-email-bingz@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH 2/3] net/mlx5: reorganize jump table resources",
        "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": "Jump object is associated with table object, so there is no need to\nuse a single linked list to store it. All the jump objects could be\nput together with related flow tables.\n\nSigned-off-by: Bing Zhao <bingz@mellanox.com>\n---\n drivers/net/mlx5/mlx5.h         |  1 -\n drivers/net/mlx5/mlx5_flow.h    |  7 ++--\n drivers/net/mlx5/mlx5_flow_dv.c | 82 +++++++++++++++++------------------------\n 3 files changed, 37 insertions(+), 53 deletions(-)",
    "diff": "diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 73324da..5a77870 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -654,7 +654,6 @@ struct mlx5_ibv_shared {\n \tLIST_HEAD(encap_decap, mlx5_flow_dv_encap_decap_resource) encaps_decaps;\n \tLIST_HEAD(modify_cmd, mlx5_flow_dv_modify_hdr_resource) modify_cmds;\n \tLIST_HEAD(tag, mlx5_flow_dv_tag_resource) tags;\n-\tLIST_HEAD(jump, mlx5_flow_dv_jump_tbl_resource) jump_tbl;\n \tLIST_HEAD(port_id_action_list, mlx5_flow_dv_port_id_action_resource)\n \t\tport_id_action_list; /* List of port ID actions. */\n \tLIST_HEAD(push_vlan_action_list, mlx5_flow_dv_push_vlan_action_resource)\ndiff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h\nindex 8911f19..c21afd8 100644\n--- a/drivers/net/mlx5/mlx5_flow.h\n+++ b/drivers/net/mlx5/mlx5_flow.h\n@@ -390,12 +390,9 @@ struct mlx5_flow_dv_modify_hdr_resource {\n \n /* Jump action resource structure. */\n struct mlx5_flow_dv_jump_tbl_resource {\n-\tLIST_ENTRY(mlx5_flow_dv_jump_tbl_resource) next;\n-\t/* Pointer to next element. */\n \trte_atomic32_t refcnt; /**< Reference counter. */\n-\tvoid *action; /**< Pointer to the rdma core action. */\n \tuint8_t ft_type; /**< Flow table type, Rx or Tx. */\n-\tstruct mlx5_flow_tbl_resource *tbl; /**< The target table. */\n+\tvoid *action; /**< Pointer to the rdma core action. */\n };\n \n /* Port ID resource structure. */\n@@ -439,6 +436,8 @@ struct mlx5_flow_tbl_data_entry {\n \t/**< flow table resource, better to locate at the beginning. */\n \tstruct mlx5_flow_tbl_resource tbl;\n \t/**< flow table resource, better to locate at the beginning. */\n+\tstruct mlx5_flow_dv_jump_tbl_resource jump;\n+\t/**< jump resource, at most one for each table created. */\n };\n \n /*\ndiff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c\nindex 2253e98..2942850 100644\n--- a/drivers/net/mlx5/mlx5_flow_dv.c\n+++ b/drivers/net/mlx5/mlx5_flow_dv.c\n@@ -2267,8 +2267,8 @@ struct field_modify_info modify_tcp[] = {\n  *\n  * @param[in, out] dev\n  *   Pointer to rte_eth_dev structure.\n- * @param[in, out] resource\n- *   Pointer to jump table resource.\n+ * @param[in, out] tbl\n+ *   Pointer to flow table resource.\n  * @parm[in, out] dev_flow\n  *   Pointer to the dev_flow.\n  * @param[out] error\n@@ -2279,49 +2279,34 @@ struct field_modify_info modify_tcp[] = {\n  */\n static int\n flow_dv_jump_tbl_resource_register\n-\t\t\t(struct rte_eth_dev *dev,\n-\t\t\t struct mlx5_flow_dv_jump_tbl_resource *resource,\n+\t\t\t(struct rte_eth_dev *dev __rte_unused,\n+\t\t\t struct mlx5_flow_tbl_resource *tbl,\n \t\t\t struct mlx5_flow *dev_flow,\n \t\t\t struct rte_flow_error *error)\n {\n-\tstruct mlx5_priv *priv = dev->data->dev_private;\n-\tstruct mlx5_ibv_shared *sh = priv->sh;\n-\tstruct mlx5_flow_dv_jump_tbl_resource *cache_resource;\n+\tstruct mlx5_flow_tbl_data_entry *tbl_data =\n+\t\tcontainer_of(tbl, struct mlx5_flow_tbl_data_entry, tbl);\n+\tint cnt;\n \n-\t/* Lookup a matching resource from cache. */\n-\tLIST_FOREACH(cache_resource, &sh->jump_tbl, next) {\n-\t\tif (resource->tbl == cache_resource->tbl) {\n-\t\t\tDRV_LOG(DEBUG, \"jump table resource resource %p: refcnt %d++\",\n-\t\t\t\t(void *)cache_resource,\n-\t\t\t\trte_atomic32_read(&cache_resource->refcnt));\n-\t\t\trte_atomic32_inc(&cache_resource->refcnt);\n-\t\t\tdev_flow->dv.jump = cache_resource;\n-\t\t\treturn 0;\n-\t\t}\n-\t}\n-\t/* Register new jump table resource. */\n-\tcache_resource = rte_calloc(__func__, 1, sizeof(*cache_resource), 0);\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-\t*cache_resource = *resource;\n-\tcache_resource->action =\n-\t\tmlx5_glue->dr_create_flow_action_dest_flow_tbl\n-\t\t(resource->tbl->obj);\n-\tif (!cache_resource->action) {\n-\t\trte_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+\tassert(tbl);\n+\tcnt = rte_atomic32_read(&tbl_data->jump.refcnt);\n+\tif (!cnt) {\n+\t\ttbl_data->jump.action =\n+\t\t\tmlx5_glue->dr_create_flow_action_dest_flow_tbl\n+\t\t\t(tbl->obj);\n+\t\tif (!tbl_data->jump.action)\n+\t\t\treturn rte_flow_error_set(error, ENOMEM,\n+\t\t\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n+\t\t\t\t\tNULL, \"cannot create jump action\");\n+\t\tDRV_LOG(DEBUG, \"new jump table resource %p: refcnt %d++\",\n+\t\t\t(void *)&tbl_data->jump, cnt);\n+\t} else {\n+\t\tassert(tbl_data->jump.action);\n+\t\tDRV_LOG(DEBUG, \"existed jump table resource %p: refcnt %d++\",\n+\t\t\t(void *)&tbl_data->jump, cnt);\n \t}\n-\trte_atomic32_init(&cache_resource->refcnt);\n-\trte_atomic32_inc(&cache_resource->refcnt);\n-\tLIST_INSERT_HEAD(&sh->jump_tbl, cache_resource, next);\n-\tdev_flow->dv.jump = cache_resource;\n-\tDRV_LOG(DEBUG, \"new jump table  resource %p: refcnt %d++\",\n-\t\t(void *)cache_resource,\n-\t\trte_atomic32_read(&cache_resource->refcnt));\n+\trte_atomic32_inc(&tbl_data->jump.refcnt);\n+\tdev_flow->dv.jump = &tbl_data->jump;\n \treturn 0;\n }\n \n@@ -6142,6 +6127,8 @@ struct field_modify_info modify_tcp[] = {\n \t * count before insert it into the hash list.\n \t */\n \trte_atomic32_init(&tbl->refcnt);\n+\t/* Jump action reference count is initialized here. */\n+\trte_atomic32_init(&tbl_data->jump.refcnt);\n \tpos->key = table_key.v64;\n \tret = mlx5_hlist_insert(sh->flow_tbls, pos);\n \tif (ret < 0) {\n@@ -6551,7 +6538,6 @@ struct field_modify_info modify_tcp[] = {\n \t\tconst struct rte_flow_action_count *count = action->conf;\n \t\tconst uint8_t *rss_key;\n \t\tconst struct rte_flow_action_jump *jump_data;\n-\t\tstruct mlx5_flow_dv_jump_tbl_resource jump_tbl_resource;\n \t\tstruct mlx5_flow_tbl_resource *tbl;\n \t\tuint32_t port_id = 0;\n \t\tstruct mlx5_flow_dv_port_id_action_resource port_id_resource;\n@@ -6816,9 +6802,8 @@ struct field_modify_info modify_tcp[] = {\n \t\t\t\t\t\t RTE_FLOW_ERROR_TYPE_ACTION,\n \t\t\t\t\t\t NULL,\n \t\t\t\t\t\t \"cannot create jump action.\");\n-\t\t\tjump_tbl_resource.tbl = tbl;\n \t\t\tif (flow_dv_jump_tbl_resource_register\n-\t\t\t    (dev, &jump_tbl_resource, dev_flow, error)) {\n+\t\t\t    (dev, tbl, dev_flow, error)) {\n \t\t\t\tflow_dv_tbl_resource_release(dev, tbl);\n \t\t\t\treturn rte_flow_error_set\n \t\t\t\t\t\t(error, errno,\n@@ -7361,8 +7346,10 @@ struct field_modify_info modify_tcp[] = {\n flow_dv_jump_tbl_resource_release(struct rte_eth_dev *dev,\n \t\t\t\t  struct mlx5_flow *flow)\n {\n-\tstruct mlx5_flow_dv_jump_tbl_resource *cache_resource =\n-\t\t\t\t\t\tflow->dv.jump;\n+\tstruct mlx5_flow_dv_jump_tbl_resource *cache_resource = flow->dv.jump;\n+\tstruct mlx5_flow_tbl_data_entry *tbl_data =\n+\t\t\tcontainer_of(cache_resource,\n+\t\t\t\t     struct mlx5_flow_tbl_data_entry, jump);\n \n \tassert(cache_resource->action);\n \tDRV_LOG(DEBUG, \"jump table resource %p: refcnt %d--\",\n@@ -7371,9 +7358,8 @@ struct field_modify_info modify_tcp[] = {\n \tif (rte_atomic32_dec_and_test(&cache_resource->refcnt)) {\n \t\tclaim_zero(mlx5_glue->destroy_flow_action\n \t\t\t\t(cache_resource->action));\n-\t\tLIST_REMOVE(cache_resource, next);\n-\t\tflow_dv_tbl_resource_release(dev, cache_resource->tbl);\n-\t\trte_free(cache_resource);\n+\t\t/* jump action memory free is inside the table release. */\n+\t\tflow_dv_tbl_resource_release(dev, &tbl_data->tbl);\n \t\tDRV_LOG(DEBUG, \"jump table resource %p: removed\",\n \t\t\t(void *)cache_resource);\n \t\treturn 0;\n",
    "prefixes": [
        "2/3"
    ]
}